@talkjs/web-components 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){var i;t[0]=0;for(var o=1;o<t.length;o++){var s=t[o++],a=t[o]?(t[0]|=s?1:2,e[t[o++]]):t[++o];s===3?r[0]=a:s===4?r[1]=Object.assign(r[1]||{},a):s===5?(r[1]=r[1]||{})[t[++o]]=a:s===6?r[1][t[++o]]+=a+"":s?(i=n.apply(a,Fp(n,a,e,["",null])),r.push(i),a[0]?t[0]|=2:(t[o-2]=0,t[o]=i)):r.push(a)}return r},Up=new Map;function zT(n){var t=Up.get(this);return t||(t=new Map,Up.set(this,t)),(t=Fp(this,t.get(n)||(t.set(n,t=function(e){for(var r,i,o=1,s="",a="",l=[0],u=function(h){o===1&&(h||(s=s.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?l.push(0,h,s):o===3&&(h||s)?(l.push(3,h,s),o=2):o===2&&s==="..."&&h?l.push(4,h,0):o===2&&s&&!h?l.push(5,0,!0,s):o>=5&&((s||!h&&o===5)&&(l.push(o,0,s,i),o=6),h&&(l.push(o,h,0,i),o=6)),s=""},c=0;c<e.length;c++){c&&(o===1&&u(),u(c));for(var d=0;d<e[c].length;d++)r=e[c][d],o===1?r==="<"?(u(),l=[l],o=3):s+=r:o===4?s==="--"&&r===">"?(o=1,s=""):s=r+s[0]:a?r===a?a="":s+=r:r==='"'||r==="'"?a=r:r===">"?(u(),o=1):o&&(r==="="?(o=5,i=s,s=""):r==="/"&&(o<5||e[c][d+1]===">")?(u(),o===3&&(l=l[0]),o=l,(l=l[0]).push(2,0,o),o=0):r===" "||r===" "||r===`
2
- `||r==="\r"?(u(),o=2):s+=r),o===3&&s==="!--"&&(o=4,l=l[0])}return u(),l}(n)),t),arguments,[])).length>1?t:t[0]}var Vo,at,Hp,jr,$p,jp,Yp,zp,Iu,wu,Ru,Vp,Wo={},Wp=[],VT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Go=Array.isArray;function Nn(n,t){for(var e in t)n[e]=t[e];return n}function Du(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function pt(n,t,e){var r,i,o,s={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Vo.call(arguments,2):e),typeof n=="function"&&n.defaultProps!=null)for(o in n.defaultProps)s[o]==null&&(s[o]=n.defaultProps[o]);return Xo(n,s,r,i,null)}function Xo(n,t,e,r,i){var o={type:n,props:t,key:e,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++Hp:i,__i:-1,__u:0};return i==null&&at.vnode!=null&&at.vnode(o),o}function Gp(){return{current:null}}function Vt(n){return n.children}function en(n,t){this.props=n,this.context=t}function Mi(n,t){if(t==null)return n.__?Mi(n.__,n.__i+1):null;for(var e;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null)return e.__e;return typeof n.type=="function"?Mi(n):null}function Xp(n){var t,e;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,t=0;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null){n.__e=n.__c.base=e.__e;break}return Xp(n)}}function ku(n){(!n.__d&&(n.__d=!0)&&jr.push(n)&&!Aa.__r++||$p!=at.debounceRendering)&&(($p=at.debounceRendering)||jp)(Aa)}function Aa(){for(var n,t,e,r,i,o,s,a=1;jr.length;)jr.length>a&&jr.sort(Yp),n=jr.shift(),a=jr.length,n.__d&&(e=void 0,i=(r=(t=n).__v).__e,o=[],s=[],t.__P&&((e=Nn({},r)).__v=r.__v+1,at.vnode&&at.vnode(e),Lu(t.__P,e,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,o,i==null?Mi(r):i,!!(32&r.__u),s),e.__v=r.__v,e.__.__k[e.__i]=e,Qp(o,e,s),e.__e!=i&&Xp(e)));Aa.__r=0}function Kp(n,t,e,r,i,o,s,a,l,u,c){var d,h,p,f,m,g,E=r&&r.__k||Wp,A=t.length;for(l=function(v,_,O,T,S){var N,y,I,R,b,L=O.length,k=L,B=0;for(v.__k=new Array(S),N=0;N<S;N++)(y=_[N])!=null&&typeof y!="boolean"&&typeof y!="function"?(R=N+B,(y=v.__k[N]=typeof y=="string"||typeof y=="number"||typeof y=="bigint"||y.constructor==String?Xo(null,y,null,null,null):Go(y)?Xo(Vt,{children:y},null,null,null):y.constructor==null&&y.__b>0?Xo(y.type,y.props,y.key,y.ref?y.ref:null,y.__v):y).__=v,y.__b=v.__b+1,I=null,(b=y.__i=WT(y,O,R,k))!=-1&&(k--,(I=O[b])&&(I.__u|=2)),I==null||I.__v==null?(b==-1&&(S>L?B--:S<L&&B++),typeof y.type!="function"&&(y.__u|=4)):b!=R&&(b==R-1?B--:b==R+1?B++:(b>R?B--:B++,y.__u|=4))):v.__k[N]=null;if(k)for(N=0;N<L;N++)(I=O[N])!=null&&!(2&I.__u)&&(I.__e==T&&(T=Mi(I)),ef(I,I));return T}(e,t,E,l,A),d=0;d<A;d++)(p=e.__k[d])!=null&&(h=p.__i==-1?Wo:E[p.__i]||Wo,p.__i=d,g=Lu(n,p,h,i,o,s,a,l,u,c),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&xu(h.ref,null,p),c.push(p.ref,p.__c||f,p)),m==null&&f!=null&&(m=f),4&p.__u||h.__k===p.__k?l=qp(p,l,n):typeof p.type=="function"&&g!==void 0?l=g:f&&(l=f.nextSibling),p.__u&=-7);return e.__e=m,l}function qp(n,t,e){var r,i;if(typeof n.type=="function"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,t=qp(r[i],t,e));return t}n.__e!=t&&(t&&n.type&&!e.contains(t)&&(t=Mi(n)),e.insertBefore(n.__e,t||null),t=n.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Xn(n,t){return t=t||[],n==null||typeof n=="boolean"||(Go(n)?n.some(function(e){Xn(e,t)}):t.push(n)),t}function WT(n,t,e,r){var i,o,s=n.key,a=n.type,l=t[e];if(l===null&&n.key==null||l&&s==l.key&&a==l.type&&!(2&l.__u))return e;if(r>(l==null||2&l.__u?0:1))for(i=e-1,o=e+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a==l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a==l.type)return o;o++}}return-1}function Jp(n,t,e){t[0]=="-"?n.setProperty(t,e==null?"":e):n[t]=e==null?"":typeof e!="number"||VT.test(t)?e:e+"px"}function va(n,t,e,r,i){var o,s;t:if(t=="style")if(typeof e=="string")n.style.cssText=e;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(t in r)e&&t in e||Jp(n.style,t,"");if(e)for(t in e)r&&e[t]==r[t]||Jp(n.style,t,e[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(zp,"$1")),s=t.toLowerCase(),t=s in n||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),n.l||(n.l={}),n.l[t+o]=e,e?r?e.u=r.u:(e.u=Iu,n.addEventListener(t,o?Ru:wu,o)):n.removeEventListener(t,o?Ru:wu,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in n)try{n[t]=e==null?"":e;break t}catch(a){}typeof e=="function"||(e==null||e===!1&&t[4]!="-"?n.removeAttribute(t):n.setAttribute(t,t=="popover"&&e==1?"":e))}}function Zp(n){return function(t){if(this.l){var e=this.l[t.type+n];if(t.t==null)t.t=Iu++;else if(t.t<e.u)return;return e(at.event?at.event(t):t)}}}function Lu(n,t,e,r,i,o,s,a,l,u){var c,d,h,p,f,m,g,E,A,v,_,O,T,S,N,y,I,R=t.type;if(t.constructor!=null)return null;128&e.__u&&(l=!!(32&e.__u),o=[a=t.__e=e.__e]),(c=at.__b)&&c(t);t:if(typeof R=="function")try{if(E=t.props,A="prototype"in R&&R.prototype.render,v=(c=R.contextType)&&r[c.__c],_=c?v?v.props.value:c.__:r,e.__c?g=(d=t.__c=e.__c).__=d.__E:(A?t.__c=d=new R(E,_):(t.__c=d=new en(E,_),d.constructor=R,d.render=GT),v&&v.sub(d),d.props=E,d.state||(d.state={}),d.context=_,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),A&&d.__s==null&&(d.__s=d.state),A&&R.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Nn({},d.__s)),Nn(d.__s,R.getDerivedStateFromProps(E,d.__s))),p=d.props,f=d.state,d.__v=t,h)A&&R.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),A&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(A&&R.getDerivedStateFromProps==null&&E!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(E,_),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(E,d.__s,_)===!1||t.__v==e.__v){for(t.__v!=e.__v&&(d.props=E,d.state=d.__s,d.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(b){b&&(b.__=t)}),O=0;O<d._sb.length;O++)d.__h.push(d._sb[O]);d._sb=[],d.__h.length&&s.push(d);break t}d.componentWillUpdate!=null&&d.componentWillUpdate(E,d.__s,_),A&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,f,m)})}if(d.context=_,d.props=E,d.__P=n,d.__e=!1,T=at.__r,S=0,A){for(d.state=d.__s,d.__d=!1,T&&T(t),c=d.render(d.props,d.state,d.context),N=0;N<d._sb.length;N++)d.__h.push(d._sb[N]);d._sb=[]}else do d.__d=!1,T&&T(t),c=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++S<25);d.state=d.__s,d.getChildContext!=null&&(r=Nn(Nn({},r),d.getChildContext())),A&&!h&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(p,f)),y=c,c!=null&&c.type===Vt&&c.key==null&&(y=tf(c.props.children)),a=Kp(n,Go(y)?y:[y],t,e,r,i,o,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),g&&(d.__E=d.__=null)}catch(b){if(t.__v=null,l||o!=null)if(b.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,t.__e=a}else for(I=o.length;I--;)Du(o[I]);else t.__e=e.__e,t.__k=e.__k;at.__e(b,t,e)}else o==null&&t.__v==e.__v?(t.__k=e.__k,t.__e=e.__e):a=t.__e=function(b,L,k,B,j,$,W,x,Q){var H,nt,ot,P,V,it,ut,F=k.props,ct=L.props,yt=L.type;if(yt=="svg"?j="http://www.w3.org/2000/svg":yt=="math"?j="http://www.w3.org/1998/Math/MathML":j||(j="http://www.w3.org/1999/xhtml"),$!=null){for(H=0;H<$.length;H++)if((V=$[H])&&"setAttribute"in V==!!yt&&(yt?V.localName==yt:V.nodeType==3)){b=V,$[H]=null;break}}if(b==null){if(yt==null)return document.createTextNode(ct);b=document.createElementNS(j,yt,ct.is&&ct),x&&(at.__m&&at.__m(L,$),x=!1),$=null}if(yt==null)F===ct||x&&b.data==ct||(b.data=ct);else{if($=$&&Vo.call(b.childNodes),F=k.props||Wo,!x&&$!=null)for(F={},H=0;H<b.attributes.length;H++)F[(V=b.attributes[H]).name]=V.value;for(H in F)if(V=F[H],H!="children"){if(H=="dangerouslySetInnerHTML")ot=V;else if(!(H in ct)){if(H=="value"&&"defaultValue"in ct||H=="checked"&&"defaultChecked"in ct)continue;va(b,H,null,V,j)}}for(H in ct)V=ct[H],H=="children"?P=V:H=="dangerouslySetInnerHTML"?nt=V:H=="value"?it=V:H=="checked"?ut=V:x&&typeof V!="function"||F[H]===V||va(b,H,V,F[H],j);if(nt)x||ot&&(nt.__html==ot.__html||nt.__html==b.innerHTML)||(b.innerHTML=nt.__html),L.__k=[];else if(ot&&(b.innerHTML=""),Kp(L.type=="template"?b.content:b,Go(P)?P:[P],L,k,B,yt=="foreignObject"?"http://www.w3.org/1999/xhtml":j,$,W,$?$[0]:k.__k&&Mi(k,0),x,Q),$!=null)for(H=$.length;H--;)Du($[H]);x||(H="value",yt=="progress"&&it==null?b.removeAttribute("value"):it!=null&&(it!==b[H]||yt=="progress"&&!it||yt=="option"&&it!=F[H])&&va(b,H,it,F[H],j),H="checked",ut!=null&&ut!=b[H]&&va(b,H,ut,F[H],j))}return b}(e.__e,t,e,r,i,o,s,l,u);return(c=at.diffed)&&c(t),128&t.__u?void 0:a}function Qp(n,t,e){for(var r=0;r<e.length;r++)xu(e[r],e[++r],e[++r]);at.__c&&at.__c(t,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(o){o.call(i)})}catch(o){at.__e(o,i.__v)}})}function tf(n){return typeof n!="object"||n==null||n.__b&&n.__b>0?n:Go(n)?n.map(tf):Nn({},n)}function xu(n,t,e){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&t==null||(n.__u=n(t))}else n.current=t}catch(i){at.__e(i,e)}}function ef(n,t,e){var r,i;if(at.unmount&&at.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||xu(r,null,t)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){at.__e(o,t)}r.base=r.__P=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&ef(r[i],t,e||typeof n.type!="function");e||Du(n.__e),n.__c=n.__=n.__e=void 0}function GT(n,t,e){return this.constructor(n,e)}function Ko(n,t,e){var r,i,o,s;t==document&&(t=document.documentElement),at.__&&at.__(n,t),i=(r=typeof e=="function")?null:e&&e.__k||t.__k,o=[],s=[],Lu(t,n=(!r&&e||t).__k=pt(Vt,null,[n]),i||Wo,Wo,t.namespaceURI,!r&&e?[e]:i?null:t.firstChild?Vo.call(t.childNodes):null,o,!r&&e?e:i?i.__e:t.firstChild,r,s),Qp(o,n,s)}function nf(n,t){Ko(n,t,nf)}function XT(n,t,e){var r,i,o,s,a=Nn({},n.props);for(o in n.type&&n.type.defaultProps&&(s=n.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o]==null&&s!=null?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?Vo.call(arguments,2):e),Xo(n.type,a,r||n.key,i||n.ref,null)}function nn(n){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(s){s.__e=!0,ku(s)})},this.sub=function(o){r.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),s&&s.call(o)}}),e.children}return t.__c="__cC"+Vp++,t.__=n,t.Provider=t.__l=(t.Consumer=function(e,r){return e.children(r)}).contextType=t,t}Vo=Wp.slice,at={__e:function(n,t,e,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(n)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),s=i.__d),s)return i.__E=i}catch(a){n=a}throw n}},Hp=0,en.prototype.setState=function(n,t){var e;e=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Nn({},this.state),typeof n=="function"&&(n=n(Nn({},e),this.props)),n&&Nn(e,n),n!=null&&this.__v&&(t&&this._sb.push(t),ku(this))},en.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),ku(this))},en.prototype.render=Vt,jr=[],jp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yp=function(n,t){return n.__v.__b-t.__v.__b},Aa.__r=0,zp=/(PointerCapture)$|Capture$/i,Iu=0,wu=Zp(!1),Ru=Zp(!0),Vp=0;var Kn,Tt,Mu,rf,Pi=0,of=[],Ct=at,sf=Ct.__b,af=Ct.__r,lf=Ct.diffed,uf=Ct.__c,cf=Ct.unmount,df=Ct.__;function Yr(n,t){Ct.__h&&Ct.__h(Tt,n,Pi||t),Pi=0;var e=Tt.__H||(Tt.__H={__:[],__h:[]});return n>=e.__.length&&e.__.push({}),e.__[n]}function et(n){return Pi=1,Bi(pf,n)}function Bi(n,t,e){var r=Yr(Kn++,2);if(r.t=n,!r.__c&&(r.__=[e?e(t):pf(void 0,t),function(a){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,a);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Tt,!Tt.__f)){var i=function(a,l,u){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(h){return!!h.__c});if(c.every(function(h){return!h.__N}))return!o||o.call(this,a,l,u);var d=r.__c.props!==a;return c.forEach(function(h){if(h.__N){var p=h.__[0];h.__=h.__N,h.__N=void 0,p!==h.__[0]&&(d=!0)}}),o&&o.call(this,a,l,u)||d};Tt.__f=!0;var o=Tt.shouldComponentUpdate,s=Tt.componentWillUpdate;Tt.componentWillUpdate=function(a,l,u){if(this.__e){var c=o;o=void 0,i(a,l,u),o=c}s&&s.call(this,a,l,u)},Tt.shouldComponentUpdate=i}return r.__N||r.__}function J(n,t){var e=Yr(Kn++,3);!Ct.__s&&Uu(e.__H,t)&&(e.__=n,e.u=t,Tt.__H.__h.push(e))}function he(n,t){var e=Yr(Kn++,4);!Ct.__s&&Uu(e.__H,t)&&(e.__=n,e.u=t,Tt.__h.push(e))}function q(n){return Pi=5,lt(function(){return{current:n}},[])}function qo(n,t,e){Pi=6,he(function(){if(typeof n=="function"){var r=n(t());return function(){n(null),r&&typeof r=="function"&&r()}}if(n)return n.current=t(),function(){return n.current=null}},e==null?e:e.concat(n))}function lt(n,t){var e=Yr(Kn++,7);return Uu(e.__H,t)&&(e.__=n(),e.__H=t,e.__h=n),e.__}function rt(n,t){return Pi=8,lt(function(){return n},t)}function Re(n){var t=Tt.context[n.__c],e=Yr(Kn++,9);return e.c=n,t?(e.__==null&&(e.__=!0,t.sub(Tt)),t.props.value):n.__}function Pu(n,t){Ct.useDebugValue&&Ct.useDebugValue(t?t(n):n)}function Bu(){var n=Yr(Kn++,11);if(!n.__){for(var t=Tt.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var e=t.__m||(t.__m=[0,0]);n.__="P"+e[0]+"-"+e[1]++}return n.__}function KT(){for(var n;n=of.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(_a),n.__H.__h.forEach(Fu),n.__H.__h=[]}catch(t){n.__H.__h=[],Ct.__e(t,n.__v)}}Ct.__b=function(n){Tt=null,sf&&sf(n)},Ct.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),df&&df(n,t)},Ct.__r=function(n){af&&af(n),Kn=0;var t=(Tt=n.__c).__H;t&&(Mu===Tt?(t.__h=[],Tt.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(_a),t.__h.forEach(Fu),t.__h=[],Kn=0)),Mu=Tt},Ct.diffed=function(n){lf&&lf(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(of.push(t)!==1&&rf===Ct.requestAnimationFrame||((rf=Ct.requestAnimationFrame)||qT)(KT)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Mu=Tt=null},Ct.__c=function(n,t){t.some(function(e){try{e.__h.forEach(_a),e.__h=e.__h.filter(function(r){return!r.__||Fu(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Ct.__e(r,e.__v)}}),uf&&uf(n,t)},Ct.unmount=function(n){cf&&cf(n);var t,e=n.__c;e&&e.__H&&(e.__H.__.forEach(function(r){try{_a(r)}catch(i){t=i}}),e.__H=void 0,t&&Ct.__e(t,e.__v))};var hf=typeof requestAnimationFrame=="function";function qT(n){var t,e=function(){clearTimeout(r),hf&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(e,35);hf&&(t=requestAnimationFrame(e))}function _a(n){var t=Tt,e=n.__c;typeof e=="function"&&(n.__c=void 0,e()),Tt=t}function Fu(n){var t=Tt;n.__c=n.__(),Tt=t}function Uu(n,t){return!n||n.length!==t.length||t.some(function(e,r){return e!==n[r]})}function pf(n,t){return typeof t=="function"?t(n):t}function ff(n,t){for(var e in t)n[e]=t[e];return n}function Hu(n,t){for(var e in n)if(e!=="__source"&&!(e in t))return!0;for(var r in t)if(r!=="__source"&&n[r]!==t[r])return!0;return!1}function $u(n,t){var e=t(),r=et({t:{__:e,u:t}}),i=r[0].t,o=r[1];return he(function(){i.__=e,i.u=t,ju(i)&&o({t:i})},[n,e,t]),J(function(){return ju(i)&&o({t:i}),n(function(){ju(i)&&o({t:i})})},[n]),e}function ju(n){var t,e,r=n.u,i=n.__;try{var o=r();return!((t=i)===(e=o)&&(t!==0||1/t==1/e)||t!=t&&e!=e)}catch(s){return!0}}function Yu(n){n()}function zu(n){return n}function Vu(){return[!1,Yu]}var Wu=he;function ya(n,t){this.props=n,this.context=t}function Fi(n,t){function e(i){var o=this.props.ref,s=o==i.ref;return!s&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!s:Hu(this.props,i)}function r(i){return this.shouldComponentUpdate=e,pt(n,i)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(ya.prototype=new en).isPureReactComponent=!0,ya.prototype.shouldComponentUpdate=function(n,t){return Hu(this.props,n)||Hu(this.state,t)};var mf=at.__b;at.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),mf&&mf(n)};var JT=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function tt(n){function t(e){var r=ff({},e);return delete r.ref,n(r,e.ref||null)}return t.$$typeof=JT,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var gf=function(n,t){return n==null?null:Xn(Xn(n).map(t))},Cn={map:gf,forEach:gf,count:function(n){return n?Xn(n).length:0},only:function(n){var t=Xn(n);if(t.length!==1)throw"Children.only";return t[0]},toArray:Xn},ZT=at.__e;at.__e=function(n,t,e,r){if(n.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),i.__c(n,t)}ZT(n,t,e,r)};var Ef=at.unmount;function Af(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ff({},n)).__c!=null&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return Af(r,t,e)})),n}function vf(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return vf(r,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function Jo(){this.__u=0,this.o=null,this.__b=null}function _f(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function yf(n){var t,e,r;function i(o){if(t||(t=n()).then(function(s){e=s.default||s},function(s){r=s}),r)throw r;if(!e)throw t;return pt(e,o)}return i.displayName="Lazy",i.__f=!0,i}function Ui(){this.i=null,this.l=null}at.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),Ef&&Ef(n)},(Jo.prototype=new en).__c=function(n,t){var e=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(e);var i=_f(r.__v),o=!1,s=function(){o||(o=!0,e.__R=null,i?i(a):a())};e.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=vf(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.o.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(s,s)},Jo.prototype.componentWillUnmount=function(){this.o=[]},Jo.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Af(this.__b,e,r.__O=r.__P)}this.__b=null}var i=t.__a&&pt(Vt,null,n.fallback);return i&&(i.__u&=-33),[pt(Vt,null,t.__a?null:n.children),i]};var Tf=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2]}};function QT(n){return this.getChildContext=function(){return n.context},n.children}function tO(n){var t=this,e=n.h;if(t.componentWillUnmount=function(){Ko(null,t.v),t.v=null,t.h=null},t.h&&t.h!==e&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=e,t.v={nodeType:1,parentNode:e,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(i,o){this.childNodes.push(i),t.h.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),t.h.removeChild(i)}}}Ko(pt(QT,{context:t.context},n.__v),t.v)}function Of(n,t){var e=pt(tO,{__v:n,h:t});return e.containerInfo=t,e}(Ui.prototype=new en).__a=function(n){var t=this,e=_f(t.__v),r=t.l.get(n);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Tf(t,n,r)):i()};e?e(o):o()}},Ui.prototype.render=function(n){this.i=null,this.l=new Map;var t=Xn(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},Ui.prototype.componentDidUpdate=Ui.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){Tf(n,e,t)})};var Sf=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,eO=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,nO=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,rO=/[A-Z0-9]/g,iO=typeof document!="undefined",oO=function(n){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function Gu(n,t,e){return t.__k==null&&(t.textContent=""),Ko(n,t),typeof e=="function"&&e(),n?n.__c:null}function Nf(n,t,e){return nf(n,t),typeof e=="function"&&e(),n?n.__c:null}en.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(en.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t})}})});var Cf=at.event;function sO(){}function aO(){return this.cancelBubble}function lO(){return this.defaultPrevented}at.event=function(n){return Cf&&(n=Cf(n)),n.persist=sO,n.isPropagationStopped=aO,n.isDefaultPrevented=lO,n.nativeEvent=n};var Xu,uO={enumerable:!1,configurable:!0,get:function(){return this.class}},bf=at.vnode;at.vnode=function(n){typeof n.type=="string"&&function(t){var e=t.props,r=t.type,i={},o=r.indexOf("-")===-1;for(var s in e){var a=e[s];if(!(s==="value"&&"defaultValue"in e&&a==null||iO&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in e&&e.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||oO(e.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":nO.test(s)&&(s=l):l=s="oninput":o&&eO.test(s)?s=s.replace(rO,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&i[s=l]&&(s="oninputCapture"),i[s]=a}}r=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=Xn(e.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),r=="select"&&i.defaultValue!=null&&(i.value=Xn(e.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value})),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",uO)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(n),n.$$typeof=Sf,bf&&bf(n)};var If=at.__r;at.__r=function(n){If&&If(n),Xu=n.__c};var wf=at.diffed;at.diffed=function(n){wf&&wf(n);var t=n.props,e=n.__e;e!=null&&n.type==="textarea"&&"value"in t&&t.value!==e.value&&(e.value=t.value==null?"":t.value),Xu=null};var Rf={ReactCurrentDispatcher:{current:{readContext:function(n){return Xu.__n[n.__c].props.value},useCallback:rt,useContext:Re,useDebugValue:Pu,useDeferredValue:zu,useEffect:J,useId:Bu,useImperativeHandle:qo,useInsertionEffect:Wu,useLayoutEffect:he,useMemo:lt,useReducer:Bi,useRef:q,useState:et,useSyncExternalStore:$u,useTransition:Vu}}};function Df(n){return pt.bind(null,n)}function qn(n){return!!n&&n.$$typeof===Sf}function kf(n){return qn(n)&&n.type===Vt}function Lf(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function zr(n){return qn(n)?XT.apply(null,arguments):n}function Ku(n){return!!n.__k&&(Ko(null,n),!0)}function xf(n){return n&&(n.base||n.nodeType===1&&n)||null}var Mf=function(n,t){return n(t)},Hi=function(n,t){return n(t)},Pf=Vt,Bf=qn,Ot={useState:et,useId:Bu,useReducer:Bi,useEffect:J,useLayoutEffect:he,useInsertionEffect:Wu,useTransition:Vu,useDeferredValue:zu,useSyncExternalStore:$u,startTransition:Yu,useRef:q,useImperativeHandle:qo,useMemo:lt,useCallback:rt,useContext:Re,useDebugValue:Pu,version:"18.3.1",Children:Cn,render:Gu,hydrate:Nf,unmountComponentAtNode:Ku,createPortal:Of,createElement:pt,createContext:nn,createFactory:Df,cloneElement:zr,createRef:Gp,Fragment:Vt,isValidElement:qn,isElement:Bf,isFragment:kf,isMemo:Lf,findDOMNode:xf,Component:en,PureComponent:ya,memo:Fi,forwardRef:tt,flushSync:Hi,unstable_batchedUpdates:Mf,StrictMode:Pf,Suspense:Jo,SuspenseList:Ui,lazy:yf,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rf};const qu=Object.freeze(Object.defineProperty({__proto__:null,Children:Cn,Component:en,Fragment:Vt,PureComponent:ya,StrictMode:Pf,Suspense:Jo,SuspenseList:Ui,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rf,cloneElement:zr,createContext:nn,createElement:pt,createFactory:Df,createPortal:Of,createRef:Gp,default:Ot,findDOMNode:xf,flushSync:Hi,forwardRef:tt,hydrate:Nf,isElement:Bf,isFragment:kf,isMemo:Lf,isValidElement:qn,lazy:yf,memo:Fi,render:Gu,startTransition:Yu,unmountComponentAtNode:Ku,unstable_batchedUpdates:Mf,useCallback:rt,useContext:Re,useDebugValue:Pu,useDeferredValue:zu,useEffect:J,useErrorBoundary:function(n){var t=Yr(Kn++,10),e=et();return t.__=n,Tt.componentDidCatch||(Tt.componentDidCatch=function(r,i){t.__&&t.__(r,i),e[1](r)}),[e[0],function(){e[1](void 0)}]},useId:Bu,useImperativeHandle:qo,useInsertionEffect:Wu,useLayoutEffect:he,useMemo:lt,useReducer:Bi,useRef:q,useState:et,useSyncExternalStore:$u,useTransition:Vu,version:"18.3.1"},Symbol.toStringTag,{value:"Module"}));var cO={TALK_GMK:"AIzaSyAs_WXNLlj31EHJI_Lw8siO2B3ZJLUzBH0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const dO=function(n){return cO[n]}("TALK_GMK");var Ta=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function hO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function pO(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var Ju={};function fO(n){return String.fromCharCode(parseInt(n.slice(1),16))}Object.defineProperty(Ju,"__esModule",{value:!0});var mO=Ju.encode=function(n){return btoa(encodeURIComponent(n).replace(/%[0-9A-F]{2}/g,fO))};function gO(n){return`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`}Ju.decode=function(n){return decodeURIComponent(Array.from(atob(n),gO).join(""))};const EO=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/,AO=n=>n.split(EO).filter(t=>t).map(t=>t[0]).join("")||n[Symbol.iterator]().next().value||"";function Ff(n){const t=function(e){let r=0;for(let i=0;i<e.length;i++)r=(r<<5)-r+e.charCodeAt(i),r|=0;return Math.abs(r)}(n)%Hf.length;return Hf[t]}function Zu(n,t){const e=t.lastIndex;let r;const i=[];for(;(r=t.exec(n))!==null;)i.push(r);return t.lastIndex=e,i}function Oa(n){const t=n.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function Uf(n,t){return n.localeCompare(t,void 0,{usage:"search",sensitivity:"base"})===0}function vO(n){return[...n.matchAll(/^|\s+/g)].map(e=>e.index+e[0].length).map(e=>n.substring(e))}const Hf=["#996666","#9A6E61","#8D7662","#8E775E","#948771","#8A8360","#888D65","#6F8E63","#749378","#678975","#779E86","#639A8F","#6D92A1","#65869F","#697E9A","#736C9F","#8C6495","#956387","#B05D54","#B16D52","#AF8751","#AC8A56","#B7A458","#B5B35C","#83AA5D","#4F9D5D","#5FA777","#66B58F","#5FB3AC","#589AAF","#4E7F9E","#456CAC","#6456B7","#714AB2","#9771B5","#C154C1","#B05E81","#B04C6A","#B94E48","#AF593E","#C5994B","#B8C25D","#87AB39","#4FA83D","#40A860","#41AA78","#3AB09E","#3FC1AA","#56B4BE","#3EABBF","#4682B4","#7A58C1","#9966CC","#C54B8C","#B44668","#AE4560","#A3807B","#AB917A","#ACA586","#A8AF8E","#9EA587","#8BA690","#7DA98D","#7CB0A1","#8BA9A5","#7CA1A6","#859FAF","#8D90A1","#A397B4","#AE809E","#C08081","#BB8983","#B19461","#B5A27F","#B8B56A","#9AB973","#7AC488","#7CB7BB","#80B3C4","#788BBA","#7A89B8","#9678B6","#CB8FA9","#B57281","#C6726B","#C88A65","#C2955D","#C8B568","#B9C46A","#74C365","#6FD0C5","#6093D1","#7666C6","#D06DA1"];var _O=0;function C(n,t,e,r,i,o){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var u={type:n,props:l,key:e,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_O,__i:-1,__u:0,__source:i,__self:o};if(typeof n=="function"&&(s=n.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return at.vnode&&at.vnode(u),u}function pe(n,t,e,r){return new(e||(e=Promise))(function(i,o){function s(u){try{l(r.next(u))}catch(c){o(c)}}function a(u){try{l(r.throw(u))}catch(c){o(c)}}function l(u){var c;u.done?i(u.value):(c=u.value,c instanceof e?c:new e(function(d){d(c)})).then(s,a)}l((r=r.apply(n,t||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let Zo=class{constructor(){this.listeners={}}on(n,t,e){if(this.listeners[n]||(this.listeners[n]=new Set),this.listeners[n].add(t),e==null?void 0:e.once){const r=()=>{this.un(n,r),this.un(n,t)};return this.on(n,r),r}return()=>this.un(n,t)}un(n,t){var e;(e=this.listeners[n])===null||e===void 0||e.delete(t)}once(n,t){return this.on(n,t,{once:!0})}unAll(){this.listeners={}}emit(n,...t){this.listeners[n]&&this.listeners[n].forEach(e=>e(...t))}};const $f={decode:function(n,t){return pe(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(n).finally(()=>e.close())})},createBuffer:function(n,t){return typeof n[0]=="number"&&(n=[n]),function(e){const r=e[0];if(r.some(i=>i>1||i<-1)){const i=r.length;let o=0;for(let s=0;s<i;s++){const a=Math.abs(r[s]);a>o&&(o=a)}for(const s of e)for(let a=0;a<i;a++)s[a]/=o}}(n),{duration:t,length:n[0].length,sampleRate:n[0].length/t,numberOfChannels:n.length,getChannelData:e=>n==null?void 0:n[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jf(n,t){const e=t.xmlns?document.createElementNS(t.xmlns,n):document.createElement(n);for(const[r,i]of Object.entries(t))if(r==="children")for(const[o,s]of Object.entries(t))typeof s=="string"?e.appendChild(document.createTextNode(s)):e.appendChild(jf(o,s));else r==="style"?Object.assign(e.style,i):r==="textContent"?e.textContent=i:e.setAttribute(r,i.toString());return e}function Yf(n,t,e){const r=jf(n,t||{});return e==null||e.appendChild(r),r}var yO=Object.freeze({__proto__:null,createElement:Yf,default:Yf});const TO={fetchBlob:function(n,t,e){return pe(this,void 0,void 0,function*(){const r=yield fetch(n,e);if(r.status>=400)throw new Error(`Failed to fetch ${n}: ${r.status} (${r.statusText})`);return function(i,o){pe(this,void 0,void 0,function*(){if(!i.body||!i.headers)return;const s=i.body.getReader(),a=Number(i.headers.get("Content-Length"))||0;let l=0;const u=d=>pe(this,void 0,void 0,function*(){l+=(d==null?void 0:d.length)||0;const h=Math.round(l/a*100);o(h)}),c=()=>pe(this,void 0,void 0,function*(){let d;try{d=yield s.read()}catch(h){return}d.done||(u(d.value),yield c())});c()})}(r.clone(),t),r.blob()})}};let OO=class extends Zo{constructor(n){super(),this.isExternalMedia=!1,n.media?(this.media=n.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),n.mediaControls&&(this.media.controls=!0),n.autoplay&&(this.media.autoplay=!0),n.playbackRate!=null&&this.onMediaEvent("canplay",()=>{n.playbackRate!=null&&(this.media.playbackRate=n.playbackRate)},{once:!0})}onMediaEvent(n,t,e){return this.media.addEventListener(n,t,e),()=>this.media.removeEventListener(n,t,e)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const n=this.getSrc();n.startsWith("blob:")&&URL.revokeObjectURL(n)}canPlayType(n){return this.media.canPlayType(n)!==""}setSrc(n,t){const e=this.getSrc();if(n&&e===n)return;this.revokeSrc();const r=t instanceof Blob&&(this.canPlayType(t.type)||!n)?URL.createObjectURL(t):n;try{this.media.src=r}catch(i){this.media.src=n}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(n){this.media=n}play(){return pe(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(n){this.media.currentTime=n}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(n){this.media.volume=n}getMuted(){return this.media.muted}setMuted(n){this.media.muted=n}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(n,t){t!=null&&(this.media.preservesPitch=t),this.media.playbackRate=n}getMediaElement(){return this.media}setSinkId(n){return this.media.setSinkId(n)}},Qu=class kp extends Zo{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const r=this.parentFromOptionsContainer(t.container);this.parent=r;const[i,o]=this.initHtml();r.appendChild(i),this.container=i,this.scrollContainer=o.querySelector(".scroll"),this.wrapper=o.querySelector(".wrapper"),this.canvasWrapper=o.querySelector(".canvases"),this.progressWrapper=o.querySelector(".progress"),this.cursor=o.querySelector(".cursor"),e&&o.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const r=this.wrapper.getBoundingClientRect(),i=e.clientX-r.left,o=e.clientY-r.top;return[i/r.width,o/r.height]};if(this.wrapper.addEventListener("click",e=>{const[r,i]=t(e);this.emit("click",r,i)}),this.wrapper.addEventListener("dblclick",e=>{const[r,i]=t(e);this.emit("dblclick",r,i)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:r,clientWidth:i}=this.scrollContainer,o=e/r,s=(e+i)/r;this.emit("scroll",o,s,e,e+i)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,r,i,o=3,s=0,a=100){if(!t)return()=>{};const l=matchMedia("(pointer: coarse)").matches;let u=()=>{};const c=d=>{if(d.button!==s)return;d.preventDefault(),d.stopPropagation();let h=d.clientX,p=d.clientY,f=!1;const m=Date.now(),g=O=>{if(O.preventDefault(),O.stopPropagation(),l&&Date.now()-m<a)return;const T=O.clientX,S=O.clientY,N=T-h,y=S-p;if(f||Math.abs(N)>o||Math.abs(y)>o){const I=t.getBoundingClientRect(),{left:R,top:b}=I;f||(r==null||r(h-R,p-b),f=!0),e(N,y,T-R,S-b),h=T,p=S}},E=O=>{if(f){const T=O.clientX,S=O.clientY,N=t.getBoundingClientRect(),{left:y,top:I}=N;i==null||i(T-y,S-I)}u()},A=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||E(O)},v=O=>{f&&(O.stopPropagation(),O.preventDefault())},_=O=>{f&&O.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",E),document.addEventListener("pointerout",A),document.addEventListener("pointercancel",A),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("click",v,{capture:!0}),u=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",E),document.removeEventListener("pointerout",A),document.removeEventListener("pointercancel",A),document.removeEventListener("touchmove",_),setTimeout(()=>{document.removeEventListener("click",v,{capture:!0})},10)}};return t.addEventListener("pointerdown",c),()=>{u(),t.removeEventListener("pointerdown",c)}}(this.wrapper,(t,e,r)=>{this.emit("drag",Math.max(0,Math.min(1,r/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var r;const i=((r=this.audioData)===null||r===void 0?void 0:r.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const o=this.parent.clientHeight||128;return e!=null&&e.every(s=>!s.overlay)?o/i:o}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"});return e.innerHTML=`
1
+ var TalkChatbox=function(Vo){"use strict";"use client";var Fp=function(n,t,e,r){var i;t[0]=0;for(var o=1;o<t.length;o++){var s=t[o++],a=t[o]?(t[0]|=s?1:2,e[t[o++]]):t[++o];s===3?r[0]=a:s===4?r[1]=Object.assign(r[1]||{},a):s===5?(r[1]=r[1]||{})[t[++o]]=a:s===6?r[1][t[++o]]+=a+"":s?(i=n.apply(a,Fp(n,a,e,["",null])),r.push(i),a[0]?t[0]|=2:(t[o-2]=0,t[o]=i)):r.push(a)}return r},Up=new Map;function zT(n){var t=Up.get(this);return t||(t=new Map,Up.set(this,t)),(t=Fp(this,t.get(n)||(t.set(n,t=function(e){for(var r,i,o=1,s="",a="",l=[0],u=function(h){o===1&&(h||(s=s.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?l.push(0,h,s):o===3&&(h||s)?(l.push(3,h,s),o=2):o===2&&s==="..."&&h?l.push(4,h,0):o===2&&s&&!h?l.push(5,0,!0,s):o>=5&&((s||!h&&o===5)&&(l.push(o,0,s,i),o=6),h&&(l.push(o,h,0,i),o=6)),s=""},c=0;c<e.length;c++){c&&(o===1&&u(),u(c));for(var d=0;d<e[c].length;d++)r=e[c][d],o===1?r==="<"?(u(),l=[l],o=3):s+=r:o===4?s==="--"&&r===">"?(o=1,s=""):s=r+s[0]:a?r===a?a="":s+=r:r==='"'||r==="'"?a=r:r===">"?(u(),o=1):o&&(r==="="?(o=5,i=s,s=""):r==="/"&&(o<5||e[c][d+1]===">")?(u(),o===3&&(l=l[0]),o=l,(l=l[0]).push(2,0,o),o=0):r===" "||r===" "||r===`
2
+ `||r==="\r"?(u(),o=2):s+=r),o===3&&s==="!--"&&(o=4,l=l[0])}return u(),l}(n)),t),arguments,[])).length>1?t:t[0]}var Wo,lt,Hp,jr,$p,jp,Yp,zp,Iu,wu,Ru,Vp,Go={},Wp=[],VT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xo=Array.isArray;function Nn(n,t){for(var e in t)n[e]=t[e];return n}function Du(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function ht(n,t,e){var r,i,o,s={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Wo.call(arguments,2):e),typeof n=="function"&&n.defaultProps!=null)for(o in n.defaultProps)s[o]==null&&(s[o]=n.defaultProps[o]);return Ko(n,s,r,i,null)}function Ko(n,t,e,r,i){var o={type:n,props:t,key:e,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++Hp:i,__i:-1,__u:0};return i==null&&lt.vnode!=null&&lt.vnode(o),o}function Gp(){return{current:null}}function Vt(n){return n.children}function en(n,t){this.props=n,this.context=t}function Mi(n,t){if(t==null)return n.__?Mi(n.__,n.__i+1):null;for(var e;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null)return e.__e;return typeof n.type=="function"?Mi(n):null}function Xp(n){var t,e;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,t=0;t<n.__k.length;t++)if((e=n.__k[t])!=null&&e.__e!=null){n.__e=n.__c.base=e.__e;break}return Xp(n)}}function ku(n){(!n.__d&&(n.__d=!0)&&jr.push(n)&&!Aa.__r++||$p!=lt.debounceRendering)&&(($p=lt.debounceRendering)||jp)(Aa)}function Aa(){for(var n,t,e,r,i,o,s,a=1;jr.length;)jr.length>a&&jr.sort(Yp),n=jr.shift(),a=jr.length,n.__d&&(e=void 0,i=(r=(t=n).__v).__e,o=[],s=[],t.__P&&((e=Nn({},r)).__v=r.__v+1,lt.vnode&&lt.vnode(e),Lu(t.__P,e,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,o,i==null?Mi(r):i,!!(32&r.__u),s),e.__v=r.__v,e.__.__k[e.__i]=e,Qp(o,e,s),e.__e!=i&&Xp(e)));Aa.__r=0}function Kp(n,t,e,r,i,o,s,a,l,u,c){var d,h,p,f,m,g,E=r&&r.__k||Wp,A=t.length;for(l=function(v,_,O,T,S){var N,y,w,b,I,P=O.length,k=P,B=0;for(v.__k=new Array(S),N=0;N<S;N++)(y=_[N])!=null&&typeof y!="boolean"&&typeof y!="function"?(b=N+B,(y=v.__k[N]=typeof y=="string"||typeof y=="number"||typeof y=="bigint"||y.constructor==String?Ko(null,y,null,null,null):Xo(y)?Ko(Vt,{children:y},null,null,null):y.constructor==null&&y.__b>0?Ko(y.type,y.props,y.key,y.ref?y.ref:null,y.__v):y).__=v,y.__b=v.__b+1,w=null,(I=y.__i=WT(y,O,b,k))!=-1&&(k--,(w=O[I])&&(w.__u|=2)),w==null||w.__v==null?(I==-1&&(S>P?B--:S<P&&B++),typeof y.type!="function"&&(y.__u|=4)):I!=b&&(I==b-1?B--:I==b+1?B++:(I>b?B--:B++,y.__u|=4))):v.__k[N]=null;if(k)for(N=0;N<P;N++)(w=O[N])!=null&&!(2&w.__u)&&(w.__e==T&&(T=Mi(w)),ef(w,w));return T}(e,t,E,l,A),d=0;d<A;d++)(p=e.__k[d])!=null&&(h=p.__i==-1?Go:E[p.__i]||Go,p.__i=d,g=Lu(n,p,h,i,o,s,a,l,u,c),f=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&xu(h.ref,null,p),c.push(p.ref,p.__c||f,p)),m==null&&f!=null&&(m=f),4&p.__u||h.__k===p.__k?l=qp(p,l,n):typeof p.type=="function"&&g!==void 0?l=g:f&&(l=f.nextSibling),p.__u&=-7);return e.__e=m,l}function qp(n,t,e){var r,i;if(typeof n.type=="function"){for(r=n.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=n,t=qp(r[i],t,e));return t}n.__e!=t&&(t&&n.type&&!e.contains(t)&&(t=Mi(n)),e.insertBefore(n.__e,t||null),t=n.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Xn(n,t){return t=t||[],n==null||typeof n=="boolean"||(Xo(n)?n.some(function(e){Xn(e,t)}):t.push(n)),t}function WT(n,t,e,r){var i,o,s=n.key,a=n.type,l=t[e];if(l===null&&n.key==null||l&&s==l.key&&a==l.type&&!(2&l.__u))return e;if(r>(l==null||2&l.__u?0:1))for(i=e-1,o=e+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a==l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a==l.type)return o;o++}}return-1}function Jp(n,t,e){t[0]=="-"?n.setProperty(t,e==null?"":e):n[t]=e==null?"":typeof e!="number"||VT.test(t)?e:e+"px"}function va(n,t,e,r,i){var o,s;t:if(t=="style")if(typeof e=="string")n.style.cssText=e;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(t in r)e&&t in e||Jp(n.style,t,"");if(e)for(t in e)r&&e[t]==r[t]||Jp(n.style,t,e[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(zp,"$1")),s=t.toLowerCase(),t=s in n||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),n.l||(n.l={}),n.l[t+o]=e,e?r?e.u=r.u:(e.u=Iu,n.addEventListener(t,o?Ru:wu,o)):n.removeEventListener(t,o?Ru:wu,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in n)try{n[t]=e==null?"":e;break t}catch(a){}typeof e=="function"||(e==null||e===!1&&t[4]!="-"?n.removeAttribute(t):n.setAttribute(t,t=="popover"&&e==1?"":e))}}function Zp(n){return function(t){if(this.l){var e=this.l[t.type+n];if(t.t==null)t.t=Iu++;else if(t.t<e.u)return;return e(lt.event?lt.event(t):t)}}}function Lu(n,t,e,r,i,o,s,a,l,u){var c,d,h,p,f,m,g,E,A,v,_,O,T,S,N,y,w,b=t.type;if(t.constructor!=null)return null;128&e.__u&&(l=!!(32&e.__u),o=[a=t.__e=e.__e]),(c=lt.__b)&&c(t);t:if(typeof b=="function")try{if(E=t.props,A="prototype"in b&&b.prototype.render,v=(c=b.contextType)&&r[c.__c],_=c?v?v.props.value:c.__:r,e.__c?g=(d=t.__c=e.__c).__=d.__E:(A?t.__c=d=new b(E,_):(t.__c=d=new en(E,_),d.constructor=b,d.render=GT),v&&v.sub(d),d.props=E,d.state||(d.state={}),d.context=_,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),A&&d.__s==null&&(d.__s=d.state),A&&b.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Nn({},d.__s)),Nn(d.__s,b.getDerivedStateFromProps(E,d.__s))),p=d.props,f=d.state,d.__v=t,h)A&&b.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),A&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(A&&b.getDerivedStateFromProps==null&&E!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(E,_),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(E,d.__s,_)===!1||t.__v==e.__v){for(t.__v!=e.__v&&(d.props=E,d.state=d.__s,d.__d=!1),t.__e=e.__e,t.__k=e.__k,t.__k.some(function(I){I&&(I.__=t)}),O=0;O<d._sb.length;O++)d.__h.push(d._sb[O]);d._sb=[],d.__h.length&&s.push(d);break t}d.componentWillUpdate!=null&&d.componentWillUpdate(E,d.__s,_),A&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,f,m)})}if(d.context=_,d.props=E,d.__P=n,d.__e=!1,T=lt.__r,S=0,A){for(d.state=d.__s,d.__d=!1,T&&T(t),c=d.render(d.props,d.state,d.context),N=0;N<d._sb.length;N++)d.__h.push(d._sb[N]);d._sb=[]}else do d.__d=!1,T&&T(t),c=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++S<25);d.state=d.__s,d.getChildContext!=null&&(r=Nn(Nn({},r),d.getChildContext())),A&&!h&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(p,f)),y=c,c!=null&&c.type===Vt&&c.key==null&&(y=tf(c.props.children)),a=Kp(n,Xo(y)?y:[y],t,e,r,i,o,s,a,l,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),g&&(d.__E=d.__=null)}catch(I){if(t.__v=null,l||o!=null)if(I.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,t.__e=a}else for(w=o.length;w--;)Du(o[w]);else t.__e=e.__e,t.__k=e.__k;lt.__e(I,t,e)}else o==null&&t.__v==e.__v?(t.__k=e.__k,t.__e=e.__e):a=t.__e=function(I,P,k,B,$,U,V,L,Q){var j,tt,it,x,q,ot,ut,F=k.props,ct=P.props,yt=P.type;if(yt=="svg"?$="http://www.w3.org/2000/svg":yt=="math"?$="http://www.w3.org/1998/Math/MathML":$||($="http://www.w3.org/1999/xhtml"),U!=null){for(j=0;j<U.length;j++)if((q=U[j])&&"setAttribute"in q==!!yt&&(yt?q.localName==yt:q.nodeType==3)){I=q,U[j]=null;break}}if(I==null){if(yt==null)return document.createTextNode(ct);I=document.createElementNS($,yt,ct.is&&ct),L&&(lt.__m&&lt.__m(P,U),L=!1),U=null}if(yt==null)F===ct||L&&I.data==ct||(I.data=ct);else{if(U=U&&Wo.call(I.childNodes),F=k.props||Go,!L&&U!=null)for(F={},j=0;j<I.attributes.length;j++)F[(q=I.attributes[j]).name]=q.value;for(j in F)if(q=F[j],j!="children"){if(j=="dangerouslySetInnerHTML")it=q;else if(!(j in ct)){if(j=="value"&&"defaultValue"in ct||j=="checked"&&"defaultChecked"in ct)continue;va(I,j,null,q,$)}}for(j in ct)q=ct[j],j=="children"?x=q:j=="dangerouslySetInnerHTML"?tt=q:j=="value"?ot=q:j=="checked"?ut=q:L&&typeof q!="function"||F[j]===q||va(I,j,q,F[j],$);if(tt)L||it&&(tt.__html==it.__html||tt.__html==I.innerHTML)||(I.innerHTML=tt.__html),P.__k=[];else if(it&&(I.innerHTML=""),Kp(P.type=="template"?I.content:I,Xo(x)?x:[x],P,k,B,yt=="foreignObject"?"http://www.w3.org/1999/xhtml":$,U,V,U?U[0]:k.__k&&Mi(k,0),L,Q),U!=null)for(j=U.length;j--;)Du(U[j]);L||(j="value",yt=="progress"&&ot==null?I.removeAttribute("value"):ot!=null&&(ot!==I[j]||yt=="progress"&&!ot||yt=="option"&&ot!=F[j])&&va(I,j,ot,F[j],$),j="checked",ut!=null&&ut!=I[j]&&va(I,j,ut,F[j],$))}return I}(e.__e,t,e,r,i,o,s,l,u);return(c=lt.diffed)&&c(t),128&t.__u?void 0:a}function Qp(n,t,e){for(var r=0;r<e.length;r++)xu(e[r],e[++r],e[++r]);lt.__c&&lt.__c(t,n),n.some(function(i){try{n=i.__h,i.__h=[],n.some(function(o){o.call(i)})}catch(o){lt.__e(o,i.__v)}})}function tf(n){return typeof n!="object"||n==null||n.__b&&n.__b>0?n:Xo(n)?n.map(tf):Nn({},n)}function xu(n,t,e){try{if(typeof n=="function"){var r=typeof n.__u=="function";r&&n.__u(),r&&t==null||(n.__u=n(t))}else n.current=t}catch(i){lt.__e(i,e)}}function ef(n,t,e){var r,i;if(lt.unmount&&lt.unmount(n),(r=n.ref)&&(r.current&&r.current!=n.__e||xu(r,null,t)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){lt.__e(o,t)}r.base=r.__P=null}if(r=n.__k)for(i=0;i<r.length;i++)r[i]&&ef(r[i],t,e||typeof n.type!="function");e||Du(n.__e),n.__c=n.__=n.__e=void 0}function GT(n,t,e){return this.constructor(n,e)}function qo(n,t,e){var r,i,o,s;t==document&&(t=document.documentElement),lt.__&&lt.__(n,t),i=(r=typeof e=="function")?null:e&&e.__k||t.__k,o=[],s=[],Lu(t,n=(!r&&e||t).__k=ht(Vt,null,[n]),i||Go,Go,t.namespaceURI,!r&&e?[e]:i?null:t.firstChild?Wo.call(t.childNodes):null,o,!r&&e?e:i?i.__e:t.firstChild,r,s),Qp(o,n,s)}function nf(n,t){qo(n,t,nf)}function XT(n,t,e){var r,i,o,s,a=Nn({},n.props);for(o in n.type&&n.type.defaultProps&&(s=n.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o]==null&&s!=null?s[o]:t[o];return arguments.length>2&&(a.children=arguments.length>3?Wo.call(arguments,2):e),Ko(n.type,a,r||n.key,i||n.ref,null)}function nn(n){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(s){s.__e=!0,ku(s)})},this.sub=function(o){r.add(o);var s=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),s&&s.call(o)}}),e.children}return t.__c="__cC"+Vp++,t.__=n,t.Provider=t.__l=(t.Consumer=function(e,r){return e.children(r)}).contextType=t,t}Wo=Wp.slice,lt={__e:function(n,t,e,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(n)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(n,r||{}),s=i.__d),s)return i.__E=i}catch(a){n=a}throw n}},Hp=0,en.prototype.setState=function(n,t){var e;e=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Nn({},this.state),typeof n=="function"&&(n=n(Nn({},e),this.props)),n&&Nn(e,n),n!=null&&this.__v&&(t&&this._sb.push(t),ku(this))},en.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),ku(this))},en.prototype.render=Vt,jr=[],jp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yp=function(n,t){return n.__v.__b-t.__v.__b},Aa.__r=0,zp=/(PointerCapture)$|Capture$/i,Iu=0,wu=Zp(!1),Ru=Zp(!0),Vp=0;var Kn,Tt,Mu,rf,Pi=0,of=[],Ct=lt,sf=Ct.__b,af=Ct.__r,lf=Ct.diffed,uf=Ct.__c,cf=Ct.unmount,df=Ct.__;function Yr(n,t){Ct.__h&&Ct.__h(Tt,n,Pi||t),Pi=0;var e=Tt.__H||(Tt.__H={__:[],__h:[]});return n>=e.__.length&&e.__.push({}),e.__[n]}function nt(n){return Pi=1,Bi(pf,n)}function Bi(n,t,e){var r=Yr(Kn++,2);if(r.t=n,!r.__c&&(r.__=[e?e(t):pf(void 0,t),function(a){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,a);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Tt,!Tt.__f)){var i=function(a,l,u){if(!r.__c.__H)return!0;var c=r.__c.__H.__.filter(function(h){return!!h.__c});if(c.every(function(h){return!h.__N}))return!o||o.call(this,a,l,u);var d=r.__c.props!==a;return c.forEach(function(h){if(h.__N){var p=h.__[0];h.__=h.__N,h.__N=void 0,p!==h.__[0]&&(d=!0)}}),o&&o.call(this,a,l,u)||d};Tt.__f=!0;var o=Tt.shouldComponentUpdate,s=Tt.componentWillUpdate;Tt.componentWillUpdate=function(a,l,u){if(this.__e){var c=o;o=void 0,i(a,l,u),o=c}s&&s.call(this,a,l,u)},Tt.shouldComponentUpdate=i}return r.__N||r.__}function J(n,t){var e=Yr(Kn++,3);!Ct.__s&&Uu(e.__H,t)&&(e.__=n,e.u=t,Tt.__H.__h.push(e))}function se(n,t){var e=Yr(Kn++,4);!Ct.__s&&Uu(e.__H,t)&&(e.__=n,e.u=t,Tt.__h.push(e))}function X(n){return Pi=5,at(function(){return{current:n}},[])}function Jo(n,t,e){Pi=6,se(function(){if(typeof n=="function"){var r=n(t());return function(){n(null),r&&typeof r=="function"&&r()}}if(n)return n.current=t(),function(){return n.current=null}},e==null?e:e.concat(n))}function at(n,t){var e=Yr(Kn++,7);return Uu(e.__H,t)&&(e.__=n(),e.__H=t,e.__h=n),e.__}function rt(n,t){return Pi=8,at(function(){return n},t)}function Re(n){var t=Tt.context[n.__c],e=Yr(Kn++,9);return e.c=n,t?(e.__==null&&(e.__=!0,t.sub(Tt)),t.props.value):n.__}function Pu(n,t){Ct.useDebugValue&&Ct.useDebugValue(t?t(n):n)}function Bu(){var n=Yr(Kn++,11);if(!n.__){for(var t=Tt.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var e=t.__m||(t.__m=[0,0]);n.__="P"+e[0]+"-"+e[1]++}return n.__}function KT(){for(var n;n=of.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(_a),n.__H.__h.forEach(Fu),n.__H.__h=[]}catch(t){n.__H.__h=[],Ct.__e(t,n.__v)}}Ct.__b=function(n){Tt=null,sf&&sf(n)},Ct.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),df&&df(n,t)},Ct.__r=function(n){af&&af(n),Kn=0;var t=(Tt=n.__c).__H;t&&(Mu===Tt?(t.__h=[],Tt.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(_a),t.__h.forEach(Fu),t.__h=[],Kn=0)),Mu=Tt},Ct.diffed=function(n){lf&&lf(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(of.push(t)!==1&&rf===Ct.requestAnimationFrame||((rf=Ct.requestAnimationFrame)||qT)(KT)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Mu=Tt=null},Ct.__c=function(n,t){t.some(function(e){try{e.__h.forEach(_a),e.__h=e.__h.filter(function(r){return!r.__||Fu(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Ct.__e(r,e.__v)}}),uf&&uf(n,t)},Ct.unmount=function(n){cf&&cf(n);var t,e=n.__c;e&&e.__H&&(e.__H.__.forEach(function(r){try{_a(r)}catch(i){t=i}}),e.__H=void 0,t&&Ct.__e(t,e.__v))};var hf=typeof requestAnimationFrame=="function";function qT(n){var t,e=function(){clearTimeout(r),hf&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(e,35);hf&&(t=requestAnimationFrame(e))}function _a(n){var t=Tt,e=n.__c;typeof e=="function"&&(n.__c=void 0,e()),Tt=t}function Fu(n){var t=Tt;n.__c=n.__(),Tt=t}function Uu(n,t){return!n||n.length!==t.length||t.some(function(e,r){return e!==n[r]})}function pf(n,t){return typeof t=="function"?t(n):t}function ff(n,t){for(var e in t)n[e]=t[e];return n}function Hu(n,t){for(var e in n)if(e!=="__source"&&!(e in t))return!0;for(var r in t)if(r!=="__source"&&n[r]!==t[r])return!0;return!1}function $u(n,t){var e=t(),r=nt({t:{__:e,u:t}}),i=r[0].t,o=r[1];return se(function(){i.__=e,i.u=t,ju(i)&&o({t:i})},[n,e,t]),J(function(){return ju(i)&&o({t:i}),n(function(){ju(i)&&o({t:i})})},[n]),e}function ju(n){var t,e,r=n.u,i=n.__;try{var o=r();return!((t=i)===(e=o)&&(t!==0||1/t==1/e)||t!=t&&e!=e)}catch(s){return!0}}function Yu(n){n()}function zu(n){return n}function Vu(){return[!1,Yu]}var Wu=se;function ya(n,t){this.props=n,this.context=t}function Fi(n,t){function e(i){var o=this.props.ref,s=o==i.ref;return!s&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!s:Hu(this.props,i)}function r(i){return this.shouldComponentUpdate=e,ht(n,i)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(ya.prototype=new en).isPureReactComponent=!0,ya.prototype.shouldComponentUpdate=function(n,t){return Hu(this.props,n)||Hu(this.state,t)};var mf=lt.__b;lt.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),mf&&mf(n)};var JT=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function et(n){function t(e){var r=ff({},e);return delete r.ref,n(r,e.ref||null)}return t.$$typeof=JT,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(n.displayName||n.name)+")",t}var gf=function(n,t){return n==null?null:Xn(Xn(n).map(t))},Cn={map:gf,forEach:gf,count:function(n){return n?Xn(n).length:0},only:function(n){var t=Xn(n);if(t.length!==1)throw"Children.only";return t[0]},toArray:Xn},ZT=lt.__e;lt.__e=function(n,t,e,r){if(n.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=e.__e,t.__k=e.__k),i.__c(n,t)}ZT(n,t,e,r)};var Ef=lt.unmount;function Af(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ff({},n)).__c!=null&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return Af(r,t,e)})),n}function vf(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return vf(r,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function Zo(){this.__u=0,this.o=null,this.__b=null}function _f(n){var t=n.__.__c;return t&&t.__a&&t.__a(n)}function yf(n){var t,e,r;function i(o){if(t||(t=n()).then(function(s){e=s.default||s},function(s){r=s}),r)throw r;if(!e)throw t;return ht(e,o)}return i.displayName="Lazy",i.__f=!0,i}function Ui(){this.i=null,this.l=null}lt.unmount=function(n){var t=n.__c;t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),Ef&&Ef(n)},(Zo.prototype=new en).__c=function(n,t){var e=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(e);var i=_f(r.__v),o=!1,s=function(){o||(o=!0,e.__R=null,i?i(a):a())};e.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=vf(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.o.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(s,s)},Zo.prototype.componentWillUnmount=function(){this.o=[]},Zo.prototype.render=function(n,t){if(this.__b){if(this.__v.__k){var e=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Af(this.__b,e,r.__O=r.__P)}this.__b=null}var i=t.__a&&ht(Vt,null,n.fallback);return i&&(i.__u&=-33),[ht(Vt,null,t.__a?null:n.children),i]};var Tf=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2]}};function QT(n){return this.getChildContext=function(){return n.context},n.children}function tO(n){var t=this,e=n.h;if(t.componentWillUnmount=function(){qo(null,t.v),t.v=null,t.h=null},t.h&&t.h!==e&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=e,t.v={nodeType:1,parentNode:e,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(i,o){this.childNodes.push(i),t.h.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),t.h.removeChild(i)}}}qo(ht(QT,{context:t.context},n.__v),t.v)}function Of(n,t){var e=ht(tO,{__v:n,h:t});return e.containerInfo=t,e}(Ui.prototype=new en).__a=function(n){var t=this,e=_f(t.__v),r=t.l.get(n);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Tf(t,n,r)):i()};e?e(o):o()}},Ui.prototype.render=function(n){this.i=null,this.l=new Map;var t=Xn(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},Ui.prototype.componentDidUpdate=Ui.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){Tf(n,e,t)})};var Sf=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,eO=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,nO=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,rO=/[A-Z0-9]/g,iO=typeof document!="undefined",oO=function(n){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function Gu(n,t,e){return t.__k==null&&(t.textContent=""),qo(n,t),typeof e=="function"&&e(),n?n.__c:null}function Nf(n,t,e){return nf(n,t),typeof e=="function"&&e(),n?n.__c:null}en.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(en.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t})}})});var Cf=lt.event;function sO(){}function aO(){return this.cancelBubble}function lO(){return this.defaultPrevented}lt.event=function(n){return Cf&&(n=Cf(n)),n.persist=sO,n.isPropagationStopped=aO,n.isDefaultPrevented=lO,n.nativeEvent=n};var Xu,uO={enumerable:!1,configurable:!0,get:function(){return this.class}},bf=lt.vnode;lt.vnode=function(n){typeof n.type=="string"&&function(t){var e=t.props,r=t.type,i={},o=r.indexOf("-")===-1;for(var s in e){var a=e[s];if(!(s==="value"&&"defaultValue"in e&&a==null||iO&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in e&&e.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||oO(e.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":nO.test(s)&&(s=l):l=s="oninput":o&&eO.test(s)?s=s.replace(rO,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&i[s=l]&&(s="oninputCapture"),i[s]=a}}r=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=Xn(e.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),r=="select"&&i.defaultValue!=null&&(i.value=Xn(e.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value})),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",uO)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(n),n.$$typeof=Sf,bf&&bf(n)};var If=lt.__r;lt.__r=function(n){If&&If(n),Xu=n.__c};var wf=lt.diffed;lt.diffed=function(n){wf&&wf(n);var t=n.props,e=n.__e;e!=null&&n.type==="textarea"&&"value"in t&&t.value!==e.value&&(e.value=t.value==null?"":t.value),Xu=null};var Rf={ReactCurrentDispatcher:{current:{readContext:function(n){return Xu.__n[n.__c].props.value},useCallback:rt,useContext:Re,useDebugValue:Pu,useDeferredValue:zu,useEffect:J,useId:Bu,useImperativeHandle:Jo,useInsertionEffect:Wu,useLayoutEffect:se,useMemo:at,useReducer:Bi,useRef:X,useState:nt,useSyncExternalStore:$u,useTransition:Vu}}};function Df(n){return ht.bind(null,n)}function qn(n){return!!n&&n.$$typeof===Sf}function kf(n){return qn(n)&&n.type===Vt}function Lf(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function zr(n){return qn(n)?XT.apply(null,arguments):n}function Ku(n){return!!n.__k&&(qo(null,n),!0)}function xf(n){return n&&(n.base||n.nodeType===1&&n)||null}var Mf=function(n,t){return n(t)},Hi=function(n,t){return n(t)},Pf=Vt,Bf=qn,Ot={useState:nt,useId:Bu,useReducer:Bi,useEffect:J,useLayoutEffect:se,useInsertionEffect:Wu,useTransition:Vu,useDeferredValue:zu,useSyncExternalStore:$u,startTransition:Yu,useRef:X,useImperativeHandle:Jo,useMemo:at,useCallback:rt,useContext:Re,useDebugValue:Pu,version:"18.3.1",Children:Cn,render:Gu,hydrate:Nf,unmountComponentAtNode:Ku,createPortal:Of,createElement:ht,createContext:nn,createFactory:Df,cloneElement:zr,createRef:Gp,Fragment:Vt,isValidElement:qn,isElement:Bf,isFragment:kf,isMemo:Lf,findDOMNode:xf,Component:en,PureComponent:ya,memo:Fi,forwardRef:et,flushSync:Hi,unstable_batchedUpdates:Mf,StrictMode:Pf,Suspense:Zo,SuspenseList:Ui,lazy:yf,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rf};const qu=Object.freeze(Object.defineProperty({__proto__:null,Children:Cn,Component:en,Fragment:Vt,PureComponent:ya,StrictMode:Pf,Suspense:Zo,SuspenseList:Ui,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rf,cloneElement:zr,createContext:nn,createElement:ht,createFactory:Df,createPortal:Of,createRef:Gp,default:Ot,findDOMNode:xf,flushSync:Hi,forwardRef:et,hydrate:Nf,isElement:Bf,isFragment:kf,isMemo:Lf,isValidElement:qn,lazy:yf,memo:Fi,render:Gu,startTransition:Yu,unmountComponentAtNode:Ku,unstable_batchedUpdates:Mf,useCallback:rt,useContext:Re,useDebugValue:Pu,useDeferredValue:zu,useEffect:J,useErrorBoundary:function(n){var t=Yr(Kn++,10),e=nt();return t.__=n,Tt.componentDidCatch||(Tt.componentDidCatch=function(r,i){t.__&&t.__(r,i),e[1](r)}),[e[0],function(){e[1](void 0)}]},useId:Bu,useImperativeHandle:Jo,useInsertionEffect:Wu,useLayoutEffect:se,useMemo:at,useReducer:Bi,useRef:X,useState:nt,useSyncExternalStore:$u,useTransition:Vu,version:"18.3.1"},Symbol.toStringTag,{value:"Module"}));var cO={TALK_GMK:"AIzaSyAs_WXNLlj31EHJI_Lw8siO2B3ZJLUzBH0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const dO=function(n){return cO[n]}("TALK_GMK");var Ta=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function hO(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function pO(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),e}var Ju={};function fO(n){return String.fromCharCode(parseInt(n.slice(1),16))}Object.defineProperty(Ju,"__esModule",{value:!0});var mO=Ju.encode=function(n){return btoa(encodeURIComponent(n).replace(/%[0-9A-F]{2}/g,fO))};function gO(n){return`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`}Ju.decode=function(n){return decodeURIComponent(Array.from(atob(n),gO).join(""))};const EO=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/,AO=n=>n.split(EO).filter(t=>t).map(t=>t[0]).join("")||n[Symbol.iterator]().next().value||"";function Ff(n){const t=function(e){let r=0;for(let i=0;i<e.length;i++)r=(r<<5)-r+e.charCodeAt(i),r|=0;return Math.abs(r)}(n)%Hf.length;return Hf[t]}function Zu(n,t){const e=t.lastIndex;let r;const i=[];for(;(r=t.exec(n))!==null;)i.push(r);return t.lastIndex=e,i}function Oa(n){const t=n.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function Uf(n,t){return n.localeCompare(t,void 0,{usage:"search",sensitivity:"base"})===0}function vO(n){return[...n.matchAll(/^|\s+/g)].map(e=>e.index+e[0].length).map(e=>n.substring(e))}const Hf=["#996666","#9A6E61","#8D7662","#8E775E","#948771","#8A8360","#888D65","#6F8E63","#749378","#678975","#779E86","#639A8F","#6D92A1","#65869F","#697E9A","#736C9F","#8C6495","#956387","#B05D54","#B16D52","#AF8751","#AC8A56","#B7A458","#B5B35C","#83AA5D","#4F9D5D","#5FA777","#66B58F","#5FB3AC","#589AAF","#4E7F9E","#456CAC","#6456B7","#714AB2","#9771B5","#C154C1","#B05E81","#B04C6A","#B94E48","#AF593E","#C5994B","#B8C25D","#87AB39","#4FA83D","#40A860","#41AA78","#3AB09E","#3FC1AA","#56B4BE","#3EABBF","#4682B4","#7A58C1","#9966CC","#C54B8C","#B44668","#AE4560","#A3807B","#AB917A","#ACA586","#A8AF8E","#9EA587","#8BA690","#7DA98D","#7CB0A1","#8BA9A5","#7CA1A6","#859FAF","#8D90A1","#A397B4","#AE809E","#C08081","#BB8983","#B19461","#B5A27F","#B8B56A","#9AB973","#7AC488","#7CB7BB","#80B3C4","#788BBA","#7A89B8","#9678B6","#CB8FA9","#B57281","#C6726B","#C88A65","#C2955D","#C8B568","#B9C46A","#74C365","#6FD0C5","#6093D1","#7666C6","#D06DA1"];var _O=0;function C(n,t,e,r,i,o){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var u={type:n,props:l,key:e,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_O,__i:-1,__u:0,__source:i,__self:o};if(typeof n=="function"&&(s=n.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return lt.vnode&&lt.vnode(u),u}function pe(n,t,e,r){return new(e||(e=Promise))(function(i,o){function s(u){try{l(r.next(u))}catch(c){o(c)}}function a(u){try{l(r.throw(u))}catch(c){o(c)}}function l(u){var c;u.done?i(u.value):(c=u.value,c instanceof e?c:new e(function(d){d(c)})).then(s,a)}l((r=r.apply(n,t||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;let Qo=class{constructor(){this.listeners={}}on(n,t,e){if(this.listeners[n]||(this.listeners[n]=new Set),this.listeners[n].add(t),e==null?void 0:e.once){const r=()=>{this.un(n,r),this.un(n,t)};return this.on(n,r),r}return()=>this.un(n,t)}un(n,t){var e;(e=this.listeners[n])===null||e===void 0||e.delete(t)}once(n,t){return this.on(n,t,{once:!0})}unAll(){this.listeners={}}emit(n,...t){this.listeners[n]&&this.listeners[n].forEach(e=>e(...t))}};const $f={decode:function(n,t){return pe(this,void 0,void 0,function*(){const e=new AudioContext({sampleRate:t});return e.decodeAudioData(n).finally(()=>e.close())})},createBuffer:function(n,t){return typeof n[0]=="number"&&(n=[n]),function(e){const r=e[0];if(r.some(i=>i>1||i<-1)){const i=r.length;let o=0;for(let s=0;s<i;s++){const a=Math.abs(r[s]);a>o&&(o=a)}for(const s of e)for(let a=0;a<i;a++)s[a]/=o}}(n),{duration:t,length:n[0].length,sampleRate:n[0].length/t,numberOfChannels:n.length,getChannelData:e=>n==null?void 0:n[e],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function jf(n,t){const e=t.xmlns?document.createElementNS(t.xmlns,n):document.createElement(n);for(const[r,i]of Object.entries(t))if(r==="children")for(const[o,s]of Object.entries(t))typeof s=="string"?e.appendChild(document.createTextNode(s)):e.appendChild(jf(o,s));else r==="style"?Object.assign(e.style,i):r==="textContent"?e.textContent=i:e.setAttribute(r,i.toString());return e}function Yf(n,t,e){const r=jf(n,t||{});return e==null||e.appendChild(r),r}var yO=Object.freeze({__proto__:null,createElement:Yf,default:Yf});const TO={fetchBlob:function(n,t,e){return pe(this,void 0,void 0,function*(){const r=yield fetch(n,e);if(r.status>=400)throw new Error(`Failed to fetch ${n}: ${r.status} (${r.statusText})`);return function(i,o){pe(this,void 0,void 0,function*(){if(!i.body||!i.headers)return;const s=i.body.getReader(),a=Number(i.headers.get("Content-Length"))||0;let l=0;const u=d=>pe(this,void 0,void 0,function*(){l+=(d==null?void 0:d.length)||0;const h=Math.round(l/a*100);o(h)}),c=()=>pe(this,void 0,void 0,function*(){let d;try{d=yield s.read()}catch(h){return}d.done||(u(d.value),yield c())});c()})}(r.clone(),t),r.blob()})}};let OO=class extends Qo{constructor(n){super(),this.isExternalMedia=!1,n.media?(this.media=n.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),n.mediaControls&&(this.media.controls=!0),n.autoplay&&(this.media.autoplay=!0),n.playbackRate!=null&&this.onMediaEvent("canplay",()=>{n.playbackRate!=null&&(this.media.playbackRate=n.playbackRate)},{once:!0})}onMediaEvent(n,t,e){return this.media.addEventListener(n,t,e),()=>this.media.removeEventListener(n,t,e)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const n=this.getSrc();n.startsWith("blob:")&&URL.revokeObjectURL(n)}canPlayType(n){return this.media.canPlayType(n)!==""}setSrc(n,t){const e=this.getSrc();if(n&&e===n)return;this.revokeSrc();const r=t instanceof Blob&&(this.canPlayType(t.type)||!n)?URL.createObjectURL(t):n;try{this.media.src=r}catch(i){this.media.src=n}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(n){this.media=n}play(){return pe(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(n){this.media.currentTime=n}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(n){this.media.volume=n}getMuted(){return this.media.muted}setMuted(n){this.media.muted=n}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(n,t){t!=null&&(this.media.preservesPitch=t),this.media.playbackRate=n}getMediaElement(){return this.media}setSinkId(n){return this.media.setSinkId(n)}},Qu=class kp extends Qo{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=t;const r=this.parentFromOptionsContainer(t.container);this.parent=r;const[i,o]=this.initHtml();r.appendChild(i),this.container=i,this.scrollContainer=o.querySelector(".scroll"),this.wrapper=o.querySelector(".wrapper"),this.canvasWrapper=o.querySelector(".canvases"),this.progressWrapper=o.querySelector(".progress"),this.cursor=o.querySelector(".cursor"),e&&o.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){const t=e=>{const r=this.wrapper.getBoundingClientRect(),i=e.clientX-r.left,o=e.clientY-r.top;return[i/r.width,o/r.height]};if(this.wrapper.addEventListener("click",e=>{const[r,i]=t(e);this.emit("click",r,i)}),this.wrapper.addEventListener("dblclick",e=>{const[r,i]=t(e);this.emit("dblclick",r,i)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:e,scrollWidth:r,clientWidth:i}=this.scrollContainer,o=e/r,s=(e+i)/r;this.emit("scroll",o,s,e,e+i)}),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{e().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender())}initDrag(){this.subscriptions.push(function(t,e,r,i,o=3,s=0,a=100){if(!t)return()=>{};const l=matchMedia("(pointer: coarse)").matches;let u=()=>{};const c=d=>{if(d.button!==s)return;d.preventDefault(),d.stopPropagation();let h=d.clientX,p=d.clientY,f=!1;const m=Date.now(),g=O=>{if(O.preventDefault(),O.stopPropagation(),l&&Date.now()-m<a)return;const T=O.clientX,S=O.clientY,N=T-h,y=S-p;if(f||Math.abs(N)>o||Math.abs(y)>o){const w=t.getBoundingClientRect(),{left:b,top:I}=w;f||(r==null||r(h-b,p-I),f=!0),e(N,y,T-b,S-I),h=T,p=S}},E=O=>{if(f){const T=O.clientX,S=O.clientY,N=t.getBoundingClientRect(),{left:y,top:w}=N;i==null||i(T-y,S-w)}u()},A=O=>{O.relatedTarget&&O.relatedTarget!==document.documentElement||E(O)},v=O=>{f&&(O.stopPropagation(),O.preventDefault())},_=O=>{f&&O.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",E),document.addEventListener("pointerout",A),document.addEventListener("pointercancel",A),document.addEventListener("touchmove",_,{passive:!1}),document.addEventListener("click",v,{capture:!0}),u=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",E),document.removeEventListener("pointerout",A),document.removeEventListener("pointercancel",A),document.removeEventListener("touchmove",_),setTimeout(()=>{document.removeEventListener("click",v,{capture:!0})},10)}};return t.addEventListener("pointerdown",c),()=>{u(),t.removeEventListener("pointerdown",c)}}(this.wrapper,(t,e,r)=>{this.emit("drag",Math.max(0,Math.min(1,r/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))},t=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,t/this.wrapper.getBoundingClientRect().width)))}))}getHeight(t,e){var r;const i=((r=this.audioData)===null||r===void 0?void 0:r.numberOfChannels)||1;if(t==null)return 128;if(!isNaN(Number(t)))return Number(t);if(t==="auto"){const o=this.parent.clientHeight||128;return e!=null&&e.every(s=>!s.overlay)?o/i:o}return 128}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"});return e.innerHTML=`
3
3
  <style>
4
4
  :host {
5
5
  user-select: none;
@@ -71,22 +71,22 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
71
71
  <div class="cursor" part="cursor"></div>
72
72
  </div>
73
73
  </div>
74
- `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,r=e*t;this.setScroll(r)}destroy(){var t,e;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.call(this)}createDelay(t=10){let e,r;const i=()=>{e&&clearTimeout(e),r&&r()};return this.timeouts.push(i),()=>new Promise((o,s)=>{i(),r=s,e=setTimeout(()=>{e=void 0,r=void 0,o()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),r=e.getContext("2d"),i=e.height*(window.devicePixelRatio||1),o=r.createLinearGradient(0,0,0,i),s=1/(t.length-1);return t.forEach((a,l)=>{const u=l*s;o.addColorStop(u,a)}),o}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,r,i){const o=t[0],s=t[1]||t[0],a=o.length,{width:l,height:u}=r.canvas,c=u/2,d=this.getPixelRatio(),h=e.barWidth?e.barWidth*d:1,p=e.barGap?e.barGap*d:e.barWidth?h/2:0,f=e.barRadius||0,m=l/(h+p)/a,g=f&&"roundRect"in r?"roundRect":"rect";r.beginPath();let E=0,A=0,v=0;for(let _=0;_<=a;_++){const O=Math.round(_*m);if(O>E){const N=Math.round(A*c*i),y=N+Math.round(v*c*i)||1;let I=c-N;e.barAlign==="top"?I=0:e.barAlign==="bottom"&&(I=u-y),r[g](E*(h+p),I,h,y,f),E=O,A=0,v=0}const T=Math.abs(o[_]||0),S=Math.abs(s[_]||0);T>A&&(A=T),S>v&&(v=S)}r.fill(),r.closePath()}renderLineWaveform(t,e,r,i){const o=s=>{const a=t[s]||t[0],l=a.length,{height:u}=r.canvas,c=u/2,d=r.canvas.width/l;r.moveTo(0,c);let h=0,p=0;for(let f=0;f<=l;f++){const m=Math.round(f*d);if(m>h){const E=c+(Math.round(p*c*i)||1)*(s===0?-1:1);r.lineTo(h,E),h=m,p=0}const g=Math.abs(a[f]||0);g>p&&(p=g)}r.lineTo(h,c)};r.beginPath(),o(0),o(1),r.fill(),r.closePath()}renderWaveform(t,e,r){if(r.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,r);let i=e.barHeight||1;if(e.normalize){const o=Array.from(t[0]).reduce((s,a)=>Math.max(s,Math.abs(a)),0);i=o?1/o:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,r,i):this.renderLineWaveform(t,e,r,i)}renderSingleCanvas(t,e,r,i,o,s,a){const l=this.getPixelRatio(),u=document.createElement("canvas");u.width=Math.round(r*l),u.height=Math.round(i*l),u.style.width=`${r}px`,u.style.height=`${i}px`,u.style.left=`${Math.round(o)}px`,s.appendChild(u);const c=u.getContext("2d");if(this.renderWaveform(t,e,c),u.width>0&&u.height>0){const d=u.cloneNode(),h=d.getContext("2d");h.drawImage(u,0,0),h.globalCompositeOperation="source-in",h.fillStyle=this.convertColorValues(e.progressColor),h.fillRect(0,0,u.width,u.height),a.appendChild(d)}}renderMultiCanvas(t,e,r,i,o,s){const a=this.getPixelRatio(),{clientWidth:l}=this.scrollContainer;if(l*a>=r)return void this.renderSingleCanvas(t,e,l,i,0,o,s);const u=r/a;let c=Math.min(kp.MAX_CANVAS_WIDTH,l,u),d={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,E=g+(e.barGap||g/2);c%E!=0&&(c=Math.floor(c/E)*E)}const h=g=>{if(g<0||g>=p||d[g])return;d[g]=!0;const E=g*c,A=Math.min(u-E,c);if(A<=0)return;const v=t.map(_=>{const O=Math.floor(E/u*_.length),T=Math.floor((E+A)/u*_.length);return _.slice(O,T)});this.renderSingleCanvas(v,e,A,i,E,o,s)},p=Math.ceil(u/c),f=this.scrollContainer.scrollLeft/u,m=Math.floor(f*p);h(m-1),h(m),h(m+1),p>1&&(this.unsubscribeOnScroll=this.on("scroll",()=>{const{scrollLeft:g}=this.scrollContainer,E=Math.floor(g/u*p);Object.keys(d).length>kp.MAX_NODES&&(o.innerHTML="",s.innerHTML="",d={}),h(E-1),h(E),h(E+1)}))}renderChannel(t,e,r,i){var{overlay:o}=e,s=function(c,d){var h={};for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&d.indexOf(p)<0&&(h[p]=c[p]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(p=Object.getOwnPropertySymbols(c);f<p.length;f++)d.indexOf(p[f])<0&&Object.prototype.propertyIsEnumerable.call(c,p[f])&&(h[p[f]]=c[p[f]])}return h}(e,["overlay"]);const a=document.createElement("div"),l=this.getHeight(s.height,s.splitChannels);a.style.height=`${l}px`,o&&i>0&&(a.style.marginTop=`-${l}px`),this.canvasWrapper.style.minHeight=`${l}px`,this.canvasWrapper.appendChild(a);const u=a.cloneNode();this.progressWrapper.appendChild(u),this.renderMultiCanvas(t,s,r,l,a,u)}render(t){return pe(this,void 0,void 0,function*(){var e;this.timeouts.forEach(l=>l()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),i=this.scrollContainer.clientWidth,o=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=o>i;const s=this.options.fillParent&&!this.isScrollable,a=(s?i:o)*r;if(this.wrapper.style.width=s?"100%":`${o}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let l=0;l<t.numberOfChannels;l++){const u=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[l]);this.renderChannel([t.getChannelData(l)],u,a,l)}else{const l=[t.getChannelData(0)];t.numberOfChannels>1&&l.push(t.getChannelData(1)),this.renderChannel(l,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){var t;if((t=this.unsubscribeOnScroll)===null||t===void 0||t.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:e}=this.scrollContainer,{right:r}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&e!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let o=i-r;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:r,scrollWidth:i,clientWidth:o}=this.scrollContainer,s=t*i,a=r,l=r+o,u=o/2;if(this.isDragging)s+30>l?this.scrollContainer.scrollLeft+=30:s-30<a&&(this.scrollContainer.scrollLeft-=30);else{(s<a||s>l)&&(this.scrollContainer.scrollLeft=s-(this.options.autoCenter?u:0));const c=s-r-u;e&&this.options.autoCenter&&c>0&&(this.scrollContainer.scrollLeft+=Math.min(c,10))}{const c=this.scrollContainer.scrollLeft,d=c/i,h=(c+o)/i;this.emit("scroll",d,h,c,c+o)}}renderProgress(t,e){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0, 100% 0, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,r){return pe(this,void 0,void 0,function*(){const i=this.canvasWrapper.querySelectorAll("canvas");if(!i.length)throw new Error("No waveform data");if(r==="dataURL"){const o=Array.from(i).map(s=>s.toDataURL(t,e));return Promise.resolve(o)}return Promise.all(Array.from(i).map(o=>new Promise((s,a)=>{o.toBlob(l=>{l?s(l):a(new Error("Could not export image"))},t,e)})))})}};Qu.MAX_CANVAS_WIDTH=8e3,Qu.MAX_NODES=10;let SO=class extends Zo{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}},zf=class extends Zo{constructor(n=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=n,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return pe(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(n){if(this.currentSrc=n,this._duration=void 0,!n)return this.buffer=null,void this.emit("emptied");fetch(n).then(t=>{if(t.status>=400)throw new Error(`Failed to fetch ${n}: ${t.status} (${t.statusText})`);return t.arrayBuffer()}).then(t=>this.currentSrc!==n?null:this.audioContext.decodeAudioData(t)).then(t=>{this.currentSrc===n&&(this.buffer=t,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var n;if(!this.paused)return;this.paused=!1,(n=this.bufferNode)===null||n===void 0||n.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playedDuration*this._playbackRate;t>=this.duration&&(t=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var n;this.paused=!0,(n=this.bufferNode)===null||n===void 0||n.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return pe(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(n){var t,e;const r=n-this.currentTime;(t=this.bufferNode)===null||t===void 0||t.stop(this.audioContext.currentTime+r),(e=this.bufferNode)===null||e===void 0||e.addEventListener("ended",()=>{this.bufferNode=null,this.pause()},{once:!0})}setSinkId(n){return pe(this,void 0,void 0,function*(){return this.audioContext.setSinkId(n)})}get playbackRate(){return this._playbackRate}set playbackRate(n){this._playbackRate=n,this.bufferNode&&(this.bufferNode.playbackRate.value=n)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(n){const t=!this.paused;t&&this._pause(),this.playedDuration=n/this._playbackRate,t&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var n,t;return(n=this._duration)!==null&&n!==void 0?n:((t=this.buffer)===null||t===void 0?void 0:t.duration)||0}set duration(n){this._duration=n}get volume(){return this.gainNode.gain.value}set volume(n){this.gainNode.gain.value=n,this.emit("volumechange")}get muted(){return this._muted}set muted(n){this._muted!==n&&(this._muted=n,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(n){return/^(audio|video)\//.test(n)}getGainNode(){return this.gainNode}getChannelData(){const n=[];if(!this.buffer)return n;const t=this.buffer.numberOfChannels;for(let e=0;e<t;e++)n.push(this.buffer.getChannelData(e));return n}};const NO={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};let tc=class $T extends OO{static create(t){return new $T(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new zf:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},NO,t),this.timer=new SO;const r=e?void 0:this.getMediaElement();this.renderer=new Qu(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const i=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:o,duration:s}=this.options;(i||o&&s)&&this.load(i,o,s).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t)}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop()}),this.onMediaEvent("emptied",()=>{this.timer.stop()}),this.onMediaEvent("ended",()=>{this.emit("finish")}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",t=>{this.emit("error",t.error)}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,r,i)=>{const o=this.getDuration();this.emit("scroll",t*o,e*o,r,i)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},r),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){return t._init(this),this.plugins.push(t),this.subscriptions.push(t.once("destroy",()=>{this.plugins=this.plugins.filter(e=>e!==t)})),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,r,i){return pe(this,void 0,void 0,function*(){var o;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!e&&!r){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(o=this.abortController)===null||o===void 0?void 0:o.signal);const l=u=>this.emit("loading",u);e=yield TO.fetchBlob(t,l,a)}this.setSrc(t,e);const s=yield new Promise(a=>{const l=i||this.getDuration();l?a(l):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof zf&&(a.duration=s)}if(r)this.decodedData=$f.createBuffer(r,s||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield $f.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,r){return pe(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,r)}catch(i){throw this.emit("error",i),i}})}loadBlob(t,e,r){return pe(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,r)}catch(i){throw this.emit("error",i),i}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const i=Math.min(t,this.decodedData.numberOfChannels),o=[];for(let s=0;s<i;s++){const a=this.decodedData.getChannelData(s),l=[],u=a.length/e;for(let c=0;c<e;c++){const d=a.slice(Math.floor(c*u),Math.ceil((c+1)*u));let h=0;for(let p=0;p<d.length;p++){const f=d[p];Math.abs(f)>Math.abs(h)&&(h=f)}l.push(Math.round(h*r)/r)}o.push(l)}return o}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}playPause(){return pe(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return pe(this,arguments,void 0,function*(t="image/png",e=1,r="dataURL"){return this.renderer.exportImage(t,e,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}};tc.BasePlugin=class extends Zo{constructor(n){super(),this.subscriptions=[],this.options=n}onInit(){}_init(n){this.wavesurfer=n,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(n=>n())}},tc.dom=yO;class Vf extends Error{}function Wf(n,t){if(!n)throw new Vf(t!=null?t:"Assertion failed")}const St=Object.assign(Wf,{is:function(n,t,e){return Wf(t,e)},unreachable:function(){throw new Error("Unreachable code")},never:function(n){throw new Error("Unreachable")},defined:function(n){if(n==null)throw new Vf("Value is not defined")}}),[Gf,cn]=Vr(),[Xf,Qo]=Vr(),[Kf,VD]=Vr(),[qf,ts]=Vr(),[CO,bO]=Vr(),ec=nn(void 0);function bt(){const n=Re(ec);return St(n!==void 0),n}const nc=nn(void 0);function $i(){const n=Re(nc);return St(n!==void 0),n}const[Jf,IO]=Vr(),[wO,RO]=Vr();function Vr(){const n=nn(void 0);return[n,()=>{const t=Re(n);return St(t!==void 0),t}]}var Zf=Object.prototype.hasOwnProperty;function qt(n){return Array.isArray(n)}function De(n){return!(!n||typeof n!="object"||n instanceof Date||qt(n))}function ft(n){return typeof n=="function"}function rn(n){const t=typeof n;return n!==void 0&&(rc(n)||t!=="object"&&t!=="function")}function rc(n){return n instanceof Date}function Qf(n){return typeof n=="boolean"}function ke(n){return n instanceof Promise}function Ue(n){return n instanceof Map}function ji(n){if(!n)return!1;if(qt(n))return n.length===0;for(const t in n)if(Zf.call(n,t))return!1;return!0}function tm(n){return n==null}var DO=new Set(["boolean","string","number"]);function Sa(n){return!!n.parent}var kO=Symbol.toPrimitive,Yi=Symbol("getNode"),es=Symbol("delete"),zi=Symbol("opaque"),ic=Symbol("optimized"),ns=Symbol("linked"),It={isLoadingLocal:!1,isMerging:!1,isLoadingRemote:!1,activateSyncedNode:void 0,pendingNodes:new Map,dirtyNodes:new Set,replacer:void 0,reviver:void 0};function em(n){return qt(n)?"array":Ue(n)?"map":n instanceof Set?"set":"object"}function LO(n,t){return Ue(t)?{__LSType:"Map",value:Array.from(t.entries())}:t instanceof Set?{__LSType:"Set",value:Array.from(t)}:(It.replacer&&(t=It.replacer(n,t)),t)}var xO=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;function MO(n,t){if(t){if(typeof t=="string"&&xO.test(t))return new Date(t);if(typeof t=="object"){if(t.__LSType==="Map")return new Map(t.value);if(t.__LSType==="Set")return new Set(t.value)}It.reviver&&(t=It.reviver(n,t))}return t}function nm(n){return n&&JSON.stringify(n,LO)}function rm(n){return n&&JSON.parse(n,MO)}function im(n){return rm(nm(n))}function wt(n){return!!n&&!!n[Yi]}function Na(n){return n&&n[Yi]}function bn(n,t){var e,r,i;const o=(e=n.parent)!=null?e:n,s=n.parent?n.key:"_",a=t===es;a&&(t=void 0);const l=n.parent?oc(o):o.root,u=l[s],c=ft(t);if(t=o.isAssigning||!c||ft(u)?t:t(u),!It.isMerging||tm(u)||ft(u)||!((i=(r=n.parent)==null?void 0:r.functions)!=null&&i.get(s)))try{o.isSetting=(o.isSetting||0)+1;const d=Ue(l);a?d?l.delete(s):delete l[s]:Ue(l)?l.set(s,t):l[s]=t}finally{o.isSetting--}return{prevValue:u,newValue:t}}var om=[];function kt(n){let t=0,e=n;for(;Sa(e);)om[t++]=e.key,e=e.parent;let r=n.root._;for(let i=t-1;r&&i>=0;i--){const o=om[i];r=o!=="size"&&(Ue(r)||r instanceof WeakMap)?r.get(o):r[o]}return r}function dn(n,t,e){var r,i;let o=(r=n.children)==null?void 0:r.get(t);return o||(o={root:n.root,parent:n,key:t,lazy:!0,numListenersRecursive:0},((i=n.lazyFn)==null?void 0:i.length)===1&&(e=n.lazyFn.bind(n,t)),ft(e)&&(o=Object.assign(()=>{},o),o.lazyFn=e),n.children||(n.children=new Map),n.children.set(t,o)),o}function oc(n){let t=kt(n);return(!t||ft(t))&&(Sa(n)?t=oc(n.parent)[n.key]={}:t=n.root._={}),t}function sm(n,t){var e,r;let i=wt(n)?void 0:De(n)?"id"in n?"id":"key"in n?"key":"_id"in n?"_id":"__id"in n?"__id":void 0:void 0;if(!i&&t.parent){const o=t.key+"_keyExtractor",s=(r=(e=t.functions)==null?void 0:e.get(o))!=null?r:kt(t.parent)[t.key+"_keyExtractor"];s&&ft(s)&&(i=s)}return i}function am(n,t,e){n.functions||(n.functions=new Map),n.functions.set(t,e)}function lm(n,t){return n===t||rc(n)&&rc(t)&&+n==+t}function rs(n,t,e){let r=n;return!wt(r)&&ft(r)&&(r=t?r(t):r()),wt(r)&&!e?r.get():r}function um(n){return n&&(n[zi]=!0),n}var is,PO=(n,t)=>n&&n[t];function cm(n,t,e,r,i,o,s){let a,l=n;if(t.length>0){let u=o;for(let c=0;c<t.length;c++){if(a=t[c],l[a]===es)return u&&(l[a]=u[a],s==null||s(t.slice(0,c+1),l[a])),n;if(l[a]===void 0&&r===void 0&&c===t.length-1)return n;l[a]!==void 0&&l[a]!==null||(l[a]=dm(e[c])),c<t.length-1&&(l=l[a],u&&(u=u[a]))}}return a===void 0?n=i==="merge"?sc(n,r):r:i==="merge"?l[a]=sc(l[a],r):Ue(l)?l.set(a,r):l[a]=r,n}function sc(n,t,e){var r;wt(t)&&(t=t.peek());const i=wt(n),o=i?n.peek():n,s=qt(o);if(!s&&De(o)&&De(t)&&!ji(o)||s&&o.length>0){const a=Object.keys(t);for(let l=0;l<a.length;l++){const u=a[l],c=t[u];if(c===es)i&&((r=n[u])!=null&&r.delete)?n[u].delete():delete n[u];else{const d=De(c),h=!d&&qt(c),p=n[u];if(!d&&!h||!p||!i&&ji(p))if(i)p.set(c);else{const f=De(c)?{...c}:qt(c)?[...c]:c;n[u]=f}else i||p&&(d?De(p):qt(p))?sc(p,c):n[u]=c}}}else t!==void 0&&(i?n.set(t):n=t);return n}function dm(n){switch(n){case"array":return[];case"object":return{};case"map":return new Map;case"set":return new Set}}function BO(n,t,e){const{path:r,valueAtPath:i,prevAtPath:o,pathTypes:s}=t;return cm(n,r,s,o)}var Ca=0,ac=!1,lc=!1,ss=new Map;function FO(){ss.size>0&&Vi(!0)}function hm(n,t){for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function UO(n,t){try{return function(e,r){for(let i=0;i<r.length;i++)e=BO(e,r[i]);return e}(n?im(n):{},t)}catch(e){return}}function uc(n,t){return function(){return UO(n,t)}}function as(n,t,e,r,i){const o=new Map;ba(o,n,It.isLoadingLocal,It.isLoadingRemote,t,[],[],t,e,!0,r,i),o.size&&pm(o,!0);const s=ss.get(n);s?s.value=t:ss.set(n,{value:t,prev:e,level:r,whenOptimizedOnlyIf:i,remote:It.isLoadingRemote,loading:It.isLoadingLocal}),Ca<=0&&fm()}function ba(n,t,e,r,i,o,s,a,l,u,c,d){if(function(h,p,f,m,g,E,A,v,_,O,T,S){if(O?p.listenersImmediate:p.listeners){const N={path:E,pathTypes:A,valueAtPath:v,prevAtPath:_},y=h.get(p);if(y&&E.length>0){const{changes:I}=y;hm(I[0].path,N.path)||I.push(N)}else h.set(p,{level:T,value:g,remote:m,loading:f,whenOptimizedOnlyIf:S,changes:[N]})}}(n,t,e,r,i,o,s,a,l,u,c,d),t.linkedFromNodes)for(const h of t.linkedFromNodes)ba(n,HO(h,o),e,r,a,[],[],a,l,u,0,d);if(t.parent){const h=t.parent;h&&ba(n,h,e,r,kt(h),[t.key].concat(o),[em(i)].concat(s),a,l,u,c+1,d)}}function pm(n,t){const e=new Set;n.forEach(({changes:r,level:i,value:o,loading:s,remote:a,whenOptimizedOnlyIf:l},u)=>{const c=t?u.listenersImmediate:u.listeners;if(c){let d;const h=Array.from(c);for(let p=0;p<h.length;p++){const f=h[p],{track:m,noArgs:g,listener:E}=f;e.has(E)||(m===!0?i<=0:m!==ic||l&&i<=0)&&(g||d||(d={value:o,loading:s,remote:a,getPrevious:uc(o,r),changes:r}),m||e.add(E),E(d))}}})}function fm(){const n=Array.from(It.dirtyNodes);It.dirtyNodes.clear(),n.forEach(r=>{const i=r.dirtyFn;i&&(r.dirtyFn=void 0,i())});const t=ss;ss=new Map;const e=new Map;t.forEach(({value:r,prev:i,level:o,loading:s,remote:a,whenOptimizedOnlyIf:l},u)=>{ba(e,u,s,a,r,[],[],r,i,!1,o,l)}),e.size&&pm(e,!1)}function ls(n){Ia();try{n()}finally{Vi()}}function Ia(){Ca++,is||(is=setTimeout(FO,0))}function Vi(n){(--Ca<=0||n)&&(ac?lc=!0:(is&&(clearTimeout(is),is=void 0),Ca=0,ac=!0,fm(),ac=!1,lc&&(lc=!1,Vi(!0))))}function HO(n,t){let e=n;for(let r=0;r<t.length;r++)e=dn(e,t[r]);return e}function cc(n,t,e,r,i){if(wt(n))return n;const o=ke(n);let s={root:{_:n},lazy:!0,numListenersRecursive:0};ft(n)&&(s=Object.assign(()=>{},s),s.lazyFn=n);var a;const l=(a=n,DO.has(typeof a)?new i(s):r(s));return o&&(bn(s,void 0),e(s,n)),l}function gr(n,t,e={},r){var i;const{initial:o,immediate:s,noArgs:a}=e,{trackingType:l}=e;let u=s?n.listenersImmediate:n.listeners;u||(u=new Set,s?n.listenersImmediate=u:n.listeners=u);const c={listener:t,track:l,noArgs:a};if(u.add(c),o){const m=kt(n);t({value:m,loading:!0,remote:!1,changes:[{path:[],pathTypes:[],prevAtPath:m,valueAtPath:m}],getPrevious:()=>{}})}let d;function h(m,g=t,E){if(!(r!=null&&r.has(m))){r||(r=new Set),r.add(E||n),g||(g=t);const A={trackingType:!0,...e};d=[...d||[],gr(m,g,A,r)]}}n.linkedToNode&&h(n.linkedToNode),(i=n.linkedFromNodes)==null||i.forEach(m=>h(m)),n.numListenersRecursive++;let p=n.parent,f=[n.key];for(;p;){if(p.linkedFromNodes)for(const m of p.linkedFromNodes)r!=null&&r.has(m)||h(m,$O(m,f,t),p);p.numListenersRecursive++,f=[p.key,...f],p=p.parent}return()=>{u.delete(c),d==null||d.forEach(g=>g());let m=n;for(;m;)m.numListenersRecursive--,m=m.parent}}function $O(n,t,e){let{valueAtPath:r}=mm(kt(n),t);return function({value:i,loading:o,remote:s}){const{valueAtPath:a}=mm(i,t);a!==r&&e({value:a,loading:o,remote:s,changes:[{path:[],pathTypes:[],prevAtPath:r,valueAtPath:a}],getPrevious:()=>r}),r=a}}function mm(n,t){let e=n;const r=[];for(let i=0;e&&i<t.length;i++)r.push(qt(e)?"array":"object"),e=e[t[i]];return{valueAtPath:e,pathTypes:r}}var wa=0,gm=[],Wi={current:void 0};function dc(n,t){if(wa){const e=Wi.current;if(e){e.nodes||(e.nodes=new Map);const r=e.nodes.get(n);r?(r.track=r.track||t,r.num++):e.nodes.set(n,{node:n,track:t,num:1})}}}function Em(n,t,e,r,i){let o,s=t;gm.push(Wi.current),wa++,Wi.current={};const a=n&&rs(n,e,r==null?void 0:r.fromComputed),l=Wi.current.nodes;return--wa<0&&(wa=0),Wi.current=gm.pop(),e!=null&&e.cancel||(o=function(u,c,d,h){let p=[];return u==null||u.forEach(f=>{const{node:m,track:g}=f;p.push(gr(m,c,{trackingType:g,immediate:h,noArgs:d}))}),()=>{if(p){for(let f=0;f<p.length;f++)p[f]();p=void 0}}}(l,s,!1,r==null?void 0:r.immediate)),{nodes:l,value:a,dispose:o,resubscribe:void 0}}function us(n,t,e){let r,i;ft(t)?r=t:e=t;const o={num:0},s=function(){o.onCleanup&&(o.onCleanup(),o.onCleanup=void 0),Ia(),delete o.value,i==null||i();const{dispose:a,value:l,nodes:u}=Em(n,s,o,e);i=a,o.value=l,o.nodes=u,o.refresh=s,o.onCleanupReaction&&(o.onCleanupReaction(),o.onCleanupReaction=void 0),Vi(),r&&(e!=null&&e.fromComputed||(o.num>0||!function(c){var d;return c&&((d=c[Yi])==null?void 0:d.isEvent)}(n))&&(o.previous!==o.value||typeof o.value=="object"))&&r(o),o.previous=o.value,o.num++};return s(),()=>{var a,l;(a=o.onCleanup)==null||a.call(o),o.onCleanup=void 0,(l=o.onCleanupReaction)==null||l.call(o),o.onCleanupReaction=void 0,i==null||i()}}function Am(n,t,e){if(ke(n))return t?n.then(t):n;let r,i;return us(function(o){const s=rs(n);if(!ke(s))return!ke(s)&&(e?function(a){return!(!a||(De(a)||qt(a))&&ji(a))}(s):s)&&(r=s,o.cancel=!0),r;r=s},function(){i=t==null?void 0:t(r)}),ke(r)?t?r.then(t):r:r!==void 0?t?i:Promise.resolve(r):new Promise(o=>{if(t){const s=t;t=a=>{const l=s(a);o(ke(l)?l.then(u=>u):l)}}else t=o})}function vm(n,t){return Am(n,t,!1)}function _m(n,t){return Am(n,t,!0)}var ym=new Set(["copyWithin","fill","from","pop","push","reverse","shift","sort","splice","unshift"]),Tm=new Set(["every","filter","find","findIndex","forEach","join","map","reduce","some"]),jO=new Set(["filter","find"]),hc=new Map,Ra=new Map([["get",ka],["set",In],["peek",qi],["onChange",gr],["assign",function(n,t){const e=He(n);if(Ia(),rn(n.root._)&&(n.root._={}),Ue(t)){const r=kt(n);Ue(r)&&t.forEach((i,o)=>r.set(o,i))}else{n.isAssigning=(n.isAssigning||0)+1;try{Object.assign(e,t)}finally{n.isAssigning--}}return Vi(),e}],["delete",function(n,t){t===void 0&&Sa(n)&&(t=n.key,n=n.parent);const e=kt(n);qt(e)?Om(n,e,"splice",t,1):Gi(n,t!=null?t:"_",es,-1)}],["toggle",function(n){const t=kt(n);(t==null||Qf(t))&&In(n,!t)}]]);function Om(n,t,e,...r){var i;if(e!=="push"||r.length!==1){const o=t.slice(),s=t[e].apply(t,r);if(n){const a=Sa(n),l=a?n.key:"_";(a?kt(n.parent):n.root)[l]=o,Gi((i=n.parent)!=null?i:n,l,t)}return s}Gi(n,t.length+"",r[0])}function Sm(n,t,e){return t?void 0:n?e?Array.from(n.keys()):Object.keys(n):[]}function pc(n,t,e){var r,i,o;if(De(t)&&t[zi]||De(e)&&e[zi]){const v=t!==e;return v&&(n.listeners||n.listenersImmediate)&&as(n,t,e,0),v}const s=qt(t);let a,l;const u=Ue(t),c=Ue(e),d=Sm(t,s,u),h=Sm(e,s,c),p=((r=d||t)==null?void 0:r.length)||0,f=((i=h||e)==null?void 0:i.length)||0;let m,g,E,A=!1;if(s&&qt(e)){if(e.length>0){const v=e[0];if(v!==void 0&&(m=sm(v,n),m&&(g=ft(m),a=new Map,l=[]),n.children))for(let _=0;_<e.length;_++){const O=e[_];if(O){const T=n.children.get(_+"");if(T&&(t[_]||Nm(T,O),m)){const S=g?m(O):O[m];a.set(S,T)}}}}}else if(e&&(!t||De(t))){const v=h.length;for(let _=0;_<v;_++){const O=h[_];if(!d.includes(O)){A=!0;const T=dn(n,O),S=c?e.get(O):e[O];S!==void 0&&Nm(T,S)}}}if(t&&!rn(t)){A=A||p!==f;const v=A;let _=!1;for(let O=0;O<p;O++){const T=s?O+"":d[O];let S=u?t.get(T):t[T];const N=c?e==null?void 0:e.get(T):e==null?void 0:e[T];let y=!lm(S,N);if(y){const I=m&&S?g?m(S):S[m]:void 0,R=(o=n.children)==null?void 0:o.get(T);if(wt(S)){const L=Na(S);if((R==null?void 0:R.linkedToNode)===L){const B=kt(L);u?t.set(T,B):t[T]=B;continue}const k=S;S=()=>k}let b=dn(n,T,S);if(b.lazy||!ft(S)&&!wt(S)||(YO(b,S),Wr(b)),s&&I!==void 0){const L=I!==void 0?a==null?void 0:a.get(I):void 0;if(L){if(L!==void 0&&L.key!==T){const k=e[L.key];v&&(b=L,n.children.delete(b.key),b.key=T,l.push([T,b])),_=!0,y=k!==S}}else A=!0}if(y)if(ft(S)||wt(S))Ki(n,T,S);else if(rn(S))A=!0;else{const L=pc(b,S,N);A=A||L,y=L}(y||s&&!v)&&(b.listeners||b.listenersImmediate)&&as(b,S,N,0,!v)}}if(l)for(let O=0;O<l.length;O++){const[T,S]=l[O];n.children.set(T,S)}E=A||_}else e!==void 0&&(E=!0);return E!=null&&E}function Nm(n,t){var e,r;(e=n.linkedToNodeDispose)==null||e.call(n),(r=n.activatedObserveDispose)==null||r.call(n),rn(t)||pc(n,void 0,t),(n.listeners||n.listenersImmediate)&&as(n,void 0,t,0)}function He(n,t,e){return t!==void 0&&(n=dn(n,t,e)),n.proxy||(n.proxy=new Proxy(n,Cm))}function fc(){if(It.pendingNodes.size>0){const n=Array.from(It.pendingNodes.values());It.pendingNodes.clear(),n.forEach(t=>t())}}var Cm={get(n,t,e){var r,i;if(t===kO)throw new Error("[legend-state] observable is not a primitive.");if(t===Yi)return n;if(t==="apply"){const d=kt(n);if(ft(d))return d.apply}let o=Wr(n,t==="get"||t==="peek");const s=n.linkedToNode||(o==null?void 0:o[Yi]);if(s&&t!=="onChange")return Cm.get(s,t,e);if(Ue(o)||o instanceof WeakMap||o instanceof Set||o instanceof WeakSet){const d=function(h,p,f){const m=f==null?void 0:f[p];if(p==="size")return He(h,p);if(ft(m))return function(g,E,A){const v=arguments.length,_=f;if(p==="get"){if(v>0&&typeof g!="boolean"&&g!==ic)return He(h,g)}else if(p==="set"){if(v===2){const T=_.get(g),S=_.set(g,E);return T!==E&&Da(dn(h,g),E,T),S}v===1&&Ue(f)&&In(h,g)}else if(p==="delete"){if(v>0){const T=f.get?_.get(g):g,S=f.delete(g);return S&&Da(dn(h,g),void 0,T),S}}else{if(p==="clear"){const T=new Map(_),S=_.size;return _.clear(),void(S&&Da(h,f,T))}if(p==="add"){const T=new Set(f),S=f.add(g);return f.has(p)||as(h,S,T,0),S}}const O=Ra.get(p);if(!O)return f[p](g,E);switch(v){case 0:return O(h);case 1:return O(h,g);case 2:return O(h,g,E);default:return O(h,g,E,A)}}}(n,t,o);if(d!==void 0)return d}const a=Ra.get(t);if(a)return t!=="get"&&t!=="peek"||fc(),function(d,h,p){switch(arguments.length){case 0:return a(n);case 1:return a(n,d);case 2:return a(n,d,h);default:return a(n,d,h,p)}};const l=hc.get(t);if(l)return l.get(n);let u=o==null?void 0:o[t];if(De(o)&&o[zi])return u;const c=(r=n.functions)==null?void 0:r.get(t);if(c)return wt(c)?c:He(n,t,c);if(u=function(d,h){if(d){const p=Object.getOwnPropertyDescriptor(d,h);return p!=null&&p.get&&(delete d[h],d[h]=p.set?function(f){ft(f)&&(f={get:f});const m=function(){return{[ns]:f}};return m.prototype[ns]=f,m}({get:p.get,set:({value:f})=>p.set(f)}):p.get),d[h]}}(o,t),tm(o)&&u===void 0&&(ym.has(t)||Tm.has(t))&&(o=[],bn(n,o),u=o[t]),ft(u)){if(qt(o)){if(ym.has(t))return(...h)=>Om(n,o,t,...h);if(Tm.has(t))return dc(n,!0),function(h,p){const f=t==="reduce",m=f?(A,v,_,O)=>h(A,He(n,_+"",v),_,O):(A,v,_)=>h(He(n,v+"",A),v,_);if(f||!jO.has(t))return o[t](m,p);const g=t==="find",E=[];for(let A=0;A<o.length;A++)if(m(o[A],A,o)){const v=He(n,A+"");if(g)return v;E.push(v)}return g?void 0:E}}Ki(n,t,u);const d=(i=n.functions)==null?void 0:i.get(t);return d?He(n,t,d):u.bind(o)}return rn(u)&&qt(o)&&t==="length"?(dc(n,!0),u):He(n,t)},getPrototypeOf(n){const t=kt(n);return t!==null&&typeof t=="object"?Reflect.getPrototypeOf(t):null},ownKeys(n){Wr(n);const t=ka(n,!0);if(rn(t))return[];const e=t?Reflect.ownKeys(t):[];if(qt(t)&&e[e.length-1]==="length"&&e.splice(e.length-1,1),ft(n)){const r=Reflect.ownKeys(n);["caller","arguments","prototype"].forEach(i=>r.includes(i)&&e.push(i))}return e},getOwnPropertyDescriptor(n,t){if(t==="caller"||t==="arguments"||t==="prototype")return{configurable:!1,enumerable:!1};const e=kt(n);return rn(e)?void 0:Reflect.getOwnPropertyDescriptor(e,t)},set(n,t,e){if(n.isSetting)return Reflect.set(n,t,e);if(n.isAssigning)return Gi(n,t,e),!0;const r=hc.get(t);return!!r&&(r.set(n,e),!0)},deleteProperty:(n,t)=>!!n.isSetting&&Reflect.deleteProperty(n,t),has(n,t){const e=kt(n);return Reflect.has(e,t)},apply:(n,t,e)=>(wt(t)&&(t=t.peek()),Reflect.apply(n.lazyFn||n,t,e))};function In(n,t){n.parent?Gi(n.parent,n.key,t):Gi(n,"_",t)}function Gi(n,t,e,r){const i=!n.parent&&t==="_";!n.parent||kt(n)||ft(e)||In(n,{[t]:e});const o=i?n:dn(n,t,e);if(wt(e))mc(o,e);else{const{newValue:s,prevValue:a}=bn(o,e),l=rn(s)||s instanceof Date;lm(s,a)||Da(n,s,a,o,l,i,r),l||(o.needsExtract=!0),Ki(n,t,s)}}function Da(n,t,e,r,i,o,s){r||(r=n),Ia(),i===void 0&&(i=rn(t));let a=i,l=!1;(!i||e&&!rn(e))&&(a=pc(r,t,e),qt(t)&&(l=(t==null?void 0:t.length)!==(e==null?void 0:e.length))),(i||!t||ji(t)&&!ji(e)?t!==e:a)&&as(i&&o?n:r,t,e,(s!=null?s:e===void 0)?-1:a?0:1,l),Vi()}function Xi(n,t,e){n.state||(n.state=cc({isLoaded:!1},0,Xi,He)),t.then(r=>{e?e({value:r}):In(n,r),n.state.assign({isLoaded:!0,error:void 0})}).catch(r=>{n.state.error.set(r)})}function Ki(n,t,e){if(ke(e)){const r=dn(n,t);return Xi(r,e),void bn(r,void 0)}if(wt(e)){const r=()=>e;am(n,t,r);const i=dn(n,t,r);return bn(i,qi(Na(e))),kt(i)}if(typeof e=="function")return am(n,t,e),t}function ka(n,t){return dc(n,t?De(t)?t.shallow:t:void 0),qi(n)}function qi(n){return Wr(n,!0)}var La=!1;function Wr(n,t){var e;if(La=!0,t&&((e=n.dirtyChildren)==null?void 0:e.size)){const i=Array.from(n.dirtyChildren);n.dirtyChildren.clear(),i.forEach(o=>o.dirtyFn&&Wr(o))}if(n.dirtyFn){const i=n.dirtyFn;n.dirtyFn=void 0,It.dirtyNodes.delete(n),i()}La=!1;let r=kt(n);return r=function(i,o,s){const a=o,l=i.lazy;if(l){const u=i.lazyFn;if(delete i.lazy,ft(u))if(u.length===1)o={};else{if(i.parent){const c=kt(i.parent);c?delete c[i.key]:i.root._=void 0}o=function(c,d){let h,p,f,m=!0;const g=d;let E,A,v=[];function _(){c.dirtyFn=A,It.dirtyNodes.add(c)}return c.activatedObserveDispose=us(()=>{var O,T,S,N;if(m)m=!1,bn(c,void 0);else if(!La&&A&&function(b,L){if(!La&&!function(B){var j,$;let W=B,x=B.numListenersRecursive>0;for(;W&&!x;)((j=W.listeners)!=null&&j.size||($=W.listenersImmediate)!=null&&$.size)&&(x=!0),W=W.parent;return x}(b)){L&&(b.dirtyFn=L);let B=b;for(;B;)B.dirtyChildren||(B.dirtyChildren=new Set),B.dirtyChildren.add(b),B=B.parent;return!0}}(c,A))return void(f=!0);let y=g(),I=!1;wt(y)&&(I=!0,y=mc(c,y)),ft(y)&&(y=y());const R=wt(y)||y==null?void 0:y[ns];if(R&&(c.activationState=R,y=void 0),f=!1,p=ke(y),c.activated){if(c.activationState){const b=c.activationState;(T=(O=c.state)==null?void 0:O.peek())!=null&&T.sync?(c.state.sync(),f=!0):y=(N=(S=b.get)==null?void 0:S.call(b))!=null?N:b.initial}}else{c.activated=!0;let b=zO;R!=null&&R.synced&&(b=It.activateSyncedNode,f=!0);const L=b(c,y);h=L.update;let k=L.value;!I&&wt(k)&&(k=mc(c,k)),y=k!=null?k:R==null?void 0:R.initial}return p=p||ke(y),y},O=>{const{value:T,nodes:S,refresh:N}=O;if(A=N,!f){if(!p||!It.isLoadingRemote)if(p)if(c.activationState){const{initial:y}=c.activationState;T&&ke(T)&&Xi(c,T,h),ft(kt(c))&&bn(c,y!=null?y:void 0)}else c.activated&&(Xi(c,T,h),ft(kt(c))&&bn(c,void 0));else E=T,c.state.isLoaded.peek()?(c.isComputing=!0,In(c,T),c.isComputing=!1):(bn(c,T),c.state.assign({isLoaded:!0,error:void 0}));v.forEach(y=>y()),v=[],S==null||S.forEach(({node:y,track:I})=>{v.push(gr(y,_,{immediate:!0,trackingType:I}))})}O.cancel=!0},{fromComputed:!0}),E}(i,u)}else wt(o)&&(o=Ki(i.parent,i.key,o))}return!l&&!i.needsExtract||wt(o)||rn(o)||(s&&function(u,c){if((De(u)||qt(u))&&!u[zi]){const d=[];bm(u,d,()=>{var p;let f=c;for(let m=0;m<d.length;m++){const{key:g}=d[m],E=(p=kt(f))==null?void 0:p[g];f=dn(f,g,ft(E)?E:void 0),Wr(f)}return f})}}(o,i),i.parent&&Ki(i.parent,i.key,a)),o}(n,r,!!t),r}function YO(n,t){var e,r;(e=n.activatedObserveDispose)==null||e.call(n),(r=n.linkedToNodeDispose)==null||r.call(n),n.activatedObserveDispose=n.linkedToNodeDispose=n.linkedToNode=void 0,n.lazyFn=t,n.lazy=!0}function zO(n,t){if(n.state||(n.state=cc({isLoaded:!1},0,Xi,He)),n.activationState){const{set:e,get:r,initial:i}=n.activationState;if((t=r==null?void 0:r())!=null&&t!==null||(t=i),e){let o,s=[],a=0;const l=u=>{if(s.length>0){let c,d,h,p=!1,f=!1;u?(c=u.changes,d=u.value,p=u.loading,f=u.remote,h=u.getPrevious):(c=s,d=o,h=uc(d,c)),s=[],o=void 0,It.pendingNodes.delete(n),a++;const m=a,g=()=>{m===a&&(n.isComputing=!0,e({value:d,changes:c,loading:p,remote:f,getPrevious:h}),n.isComputing=!1)};_m(n.state.isLoaded,g)}};gr(n,({value:u,changes:c})=>{n.isComputing||(c.length>1||!ft(c[0].prevAtPath))&&(o=u,s.length>0&&(c=c.filter(d=>!hm(s[0].path,d.path))),s.push(...c),It.pendingNodes.set(n,l))},{immediate:!0}),gr(n,l)}}return{update:({value:e})=>{n.isComputing||(n.isComputing=!0,In(n,e),n.isComputing=!1)},value:t}}function mc(n,t){var e;const r=Na(t);return r!==n&&(r==null?void 0:r.linkedToNode)!==n&&(n.linkedToNode=r,r.linkedFromNodes||(r.linkedFromNodes=new Set),r.linkedFromNodes.add(n),(e=n.linkedToNodeDispose)==null||e.call(n),n.linkedToNodeDispose=gr(r,()=>{t=Wr(r),In(n,t)},{initial:!0},new Set([n]))),t}function bm(n,t,e){var r;if((De(n)||qt(n))&&!n[zi]){for(const i in n)if(Zf.call(n,i)){const o=n[i];if(wt(o)){const s=e();Ki(s,i,o),delete s.lazy}else{const s=ft(o)&&((r=o.prototype)==null?void 0:r[ns]);if(s){const a=s.activate;(!a||a==="auto")&&qi(dn(e(),i,o))}}typeof o=="object"&&(t.push({key:i,value:o}),bm(o,t,e),t.pop())}}}var Im=["get","set","peek","onChange","toggle"];function Gr(n){this._node=n;for(let t=0;t<Im.length;t++){const e=Im[t];this[e]=this[e].bind(this)}}function xa(n,t){Gr.prototype[n]=function(...e){return t.call(this,this._node,...e)}}function Pt(n){return cc(n,0,Xi,He,Gr)}function VO(n,t,e){const r=function(i,o){const{backoff:s,delay:a=1e3,infinite:l,times:u=3,maxDelay:c=3e4}=i;return l||o<u?Math.min(a*(s==="constant"?1:2**o),c):null}(n,t);if(r)return setTimeout(e,r)}xa("peek",n=>(fc(),qi(n))),xa("get",(n,t)=>(fc(),ka(n,t))),xa("set",In),xa("onChange",gr),Object.defineProperty(Gr.prototype,Yi,{configurable:!0,get(){return this._node}}),Gr.prototype.toggle=function(){const n=this.peek();(n==null||Qf(n))&&this.set(!n)},Gr.prototype.delete=function(){return this.set(void 0),this};var wm={createPreviousHandler:uc,clone:im,ensureNodeValue:oc,findIDKey:sm,get:ka,getNode:Na,getNodeValue:kt,getPathType:em,getProxy:He,getValueAtPath:function(n,t){return t.reduce(PO,n)},globalState:It,initializePathType:dm,observableFns:Ra,optimized:ic,peek:qi,runWithRetry:function(n,t,e){const{waitFor:r}=n.activationState,{retry:i}=t,o={cancel:!1};let s;if(s=r?_m(r,()=>(n.activationState.waitFor=void 0,e(o))):e(o),ke(s)&&i){let a;return new Promise(l=>{const u=()=>{s.then(c=>{n.activationState.persistedRetry=!1,l(c)}).catch(()=>{t.attemptNum++,a&&clearTimeout(a),o.cancel||(a=VO(i,t.attemptNum,()=>{s=e(o),u()}))}).finally(()=>{n.activationState.persistedRetry=!1})};u()})}return s},safeParse:rm,safeStringify:nm,set:In,setAtPath:cm,setNodeValue:bn,symbolLinked:ns,symbolDelete:es,tracking:Wi},Rm={exports:{}},Dm={},Ji=pO(qu),WO=typeof Object.is=="function"?Object.is:function(n,t){return n===t&&(n!==0||1/n==1/t)||n!=n&&t!=t},GO=Ji.useState,XO=Ji.useEffect,KO=Ji.useLayoutEffect,qO=Ji.useDebugValue;function gc(n){var t=n.getSnapshot;n=n.value;try{var e=t();return!WO(n,e)}catch(r){return!0}}var JO=typeof window=="undefined"||window.document===void 0||window.document.createElement===void 0?function(n,t){return t()}:function(n,t){var e=t(),r=GO({inst:{value:e,getSnapshot:t}}),i=r[0].inst,o=r[1];return KO(function(){i.value=e,i.getSnapshot=t,gc(i)&&o({inst:i})},[n,e,t]),XO(function(){return gc(i)&&o({inst:i}),n(function(){gc(i)&&o({inst:i})})},[n]),qO(e),e};Dm.useSyncExternalStore=Ji.useSyncExternalStore!==void 0?Ji.useSyncExternalStore:JO,Rm.exports=Dm;var ZO=Rm.exports,Ec={inObserver:!1},km=void 0;function Et(n,t){if(Ec.inObserver&&wt(n)&&!(t!=null&&t.suspense))return rs(n);let e;try{const r=Re(km||(km=nn(null))),i=lt(()=>function(l,u){let c,d,h,p,f,m=0;const g=()=>{d==null||d();const{value:A,dispose:v,resubscribe:_}=Em(h,E,void 0,void 0);return d=v,A},E=({value:A})=>{if(u!=null&&u.peek()){const v=f;f=A,v===void 0&&vm(()=>!u.get(),()=>{const _=f;f=void 0,E({value:_})})}else{let v=l==null?void 0:l.skipCheck;if(!v){const _=g();(_!==p||!rn(_)&&_===A)&&(v=!0)}v&&(m++,c==null||c())}};return{subscribe:A=>(c=A,()=>{d==null||d(),d=void 0}),getVersion:()=>m,run:A=>(h=A,p=g())}}(t,r),[]),{subscribe:o,getVersion:s,run:a}=i;e=a(n),ZO.useSyncExternalStore(o,s,s)}catch(r){throw r}if(t!=null&&t.suspense){const r=ke(e);if(ke(e)||!e&&wt(n)){const i=r?e:vm(n);if(!Ot.use)throw i;Ot.use(i)}}return e}var Lm=typeof Symbol=="function"&&Symbol.for;function xm(n,t,e,r){const i=Lm?Symbol.for("react.forward_ref"):tt(h=>null).$$typeof,o=Lm?Symbol.for("react.memo"):Fi(h=>null).$$typeof;if(n.__legend_proxied)return n;let s=!1,a=!1,l=n;o&&l.$$typeof===o&&l.type&&(a=!0,l=l.type),i&&l.$$typeof===i&&(s=!0,l=l.render);const u={apply(h,p,f){if(e){const m=f[0],g={},E=Object.keys(m);for(let A=0;A<E.length;A++){const v=E[A],_=m[v];if(v==="children"&&(ft(_)||wt(_)))m[v]=Et(_,{skipCheck:!0});else if(v.startsWith("$")||v.endsWith("$")){const O=v.endsWith("$")?v.slice(0,-1):v.slice(1),T=r==null?void 0:r[O],S=T&&wt(_);if(g[O]=S&&(T!=null&&T.selector)?T.selector(g,_):Et(_),S&&(T.defaultValue!==void 0&&g[O]===void 0&&(g[O]=T.defaultValue),T.handler&&T.getValue)){const N=y=>{var I;_.set(T.getValue(y)),(I=m[T.handler])==null||I.call(m,y)};g[T.handler]=rt(N,[m[T.handler],r])}delete g[v]}else g[v]===void 0&&(g[v]=_)}f[0]=g}return t?Et(()=>{Ec.inObserver=!0;try{return Reflect.apply(h,p,f)}finally{Ec.inObserver=!1}},{skipCheck:!0}):Reflect.apply(h,p,f)}},c=new Proxy(l,u);let d;return s?(d=tt(c),d.__legend_proxied=!0):d=c,t||a?Fi(d):d}var{findIDKey:QO,getNode:tS,optimized:eS}=wm,Mm=new Map;function Ac({each:n,optimized:t,item:e,itemProps:r,sortValues:i,children:o}){var s;if(!n)return null;const a=Et(()=>n.get(!t||eS));if(!e&&o){const u=q();u.current=o,e=lt(()=>{return c=({item$:d,id:h})=>u.current(d,h),xm(c,!0);var c},[])}else if(e.$$typeof!==Symbol.for("react.memo")){let u=Mm.get(e);u||(u=Fi(e),Mm.set(e,u)),e=u}if(!a)return null;const l=[];if(qt(a)){const u=a[0],c=tS(n),d=a.length,h=d>0?c&&QO(u,c)||(u.id!==void 0?"id":u.key!==void 0?"key":void 0):void 0,p=ft(h);for(let f=0;f<d;f++)if(a[f]){const m=a[f],g=(s=p?h(m):m[h])!=null?s:f,E=n[f],A={key:g,id:g,item$:E,item:E};l.push(pt(e,r?Object.assign(A,r):A))}}else{const u=Ue(a),c=u?Array.from(a.keys()):Object.keys(a);i&&c.sort((d,h)=>i(u?a.get(d):a[d],u?a.get(h):a[h],d,h));for(let d=0;d<c.length;d++){const h=c[d];if(u?a.get(h):a[h]){const p=u?n.get(h):n[h],f={key:h,id:h,item$:p,item:p};l.push(pt(e,r?Object.assign(f,r):f))}}}return l}Fi(function({children:n}){return Et(()=>rs(rs(n)),{skipCheck:!0})},()=>!0);var nS=new Map,rS=new Map;function Er(n,t){var e;const r=q({});if(r.current.value=n,!((e=r.current)!=null&&e.obs$)){const i=n;r.current.obs$=Pt(i)}return r.current.obs$}new Proxy({},{get(n,t){if(!n[t]){const i=nS.get(t)||t,o=tt((s,a)=>{const l={...s};return!a||!ft(a)&&ji(a)||(l.ref=a),pt(i,l)});n[t]=(e=o,r=rS.get(t),xm(e,!1,!0,r))}var e,r;return n[t]}});var iS=function(n){J(()=>{const t=n();if(!ke(t))return t},[])};function Zi(n,t,e){let r;ft(t)?r=t:e=t;const i=q({selector:n});i.current={selector:n,reaction:r},iS(()=>us(o=>{const{selector:s}=i.current;return ft(s)?s(o):s},o=>{var s,a;return(a=(s=i.current).reaction)==null?void 0:a.call(s,o)},e))}const oS=Symbol("no_render");function $e(n){const t=Er(!1),e=q({_value:typeof n=="function"?n():n.peek(),get value(){return t.set(!0),e.current._value},set value(r){e.current._value=r}});return Et(()=>{if(!t.get())return oS;const r=typeof n=="function"?n():n.get();return e.current.value=r,r}),e.current}function Qi(){const n=ts(),t=bt(),e=$i(),r=cn(),i=$e(t.app$.appMetadata),o=$e(t.currentUser$),s=$e(t.state$.currentConversation),a=$e(t.t$),l=$e(t.device$),u=$e(t.themeCustom$),c=$e(()=>t.state$.typing.child(t.state$.extCurrentConversationId.get()).get()),d=$e(()=>t.state$.participants.child(t.state$.extCurrentConversationId.get()).get());return lt(()=>({session:n,store:t,chatbox:e,theme:r,get app(){return i.value},get currentUser(){return o.value},get conversation(){return s.value},get t(){return a.value},get device(){return l.value},get themeCustom(){return u.value.value},get typing(){return c.value},get participants(){return d.value}}),[i,e,s,o,l,t,a,r,u,c,d,n])}function Pm(){const n=ts(),t=bt(),e=cn(),r=$i(),i=$e(t.app$.appMetadata),o=$e(t.currentUser$),s=$e(t.t$),a=$e(t.device$),l=$e(t.themeCustom$);return lt(()=>({session:n,store:t,theme:e,conversationList:r,get app(){return i.value},get currentUser(){return o.value},get t(){return s.value},get device(){return a.value},get themeCustom(){return l.value.value}}),[i,r,o,a,n,t,s,e,l])}class Ma{constructor(t={}){this._handlers=new Set,this._meta=t}meta(t){return new Ma(t)}_emit(t,e){for(const r of this._handlers)r({level:t,data:e,timestamp:Date.now(),meta:this._meta})}error(...t){return this._emit("error",t)}warn(...t){return this._emit("warn",t)}info(...t){return this._emit("info",t)}log(...t){return this._emit("log",t)}trace(...t){return this._emit("trace",t)}registerHandler(t){return this._handlers.add(t),()=>this._handlers.delete(t)}}const vc=new Ma,Jn=new Ma,M={code:"en-US",name:"English (US)",translation:{YESTERDAY:"Yesterday",TODAY:"Today",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"just now",LOCATION:"Location",CANCEL:"Cancel",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browser notifications",DESKTOP_NOTIFICATIONS_ERROR:"Can't enable browser notifications because your browser actively blocks them. Try looking in the settings or using a different browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notification`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"If you keep your browser tab open, you'll see this pop up when someone talks to you.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Only 10,000 characters are allowed.",ENTRYBOX_PLACEHOLDER:"Say something...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"This conversation is no longer active.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"You can read, but not send messages.",MESSAGELIST_LOADING_OLDER:"Loading older messages...",MESSAGELIST_SHOW_OLDER:"Show older messages",MESSAGELIST_NEW_MARKER:"New",MESSAGE_SENT_VIA_EMAIL:"This message was sent via email",YOU_MARKER:"you",UPLOAD_IN_PROGRESS:"Uploading...",UPLOAD_SEND_FILE:"Send file",UPLOAD_SHARE_LOCATION:"Share location",UPLOAD_ERROR:"Unfortunately, something went wrong uploading. The file might be unsupported or too large.",SHARE_LOCATION_ERROR:"Cannot share location: ",LOADING:"Loading...",HUB_EMPTY:"Your chat history will show up here",HUB_SHOW_EARLIER:"Show earlier chats",INBOX_NO_CHATS_TITLE:"No chats yet!",INBOX_NO_CHATS_BODY:"Once you've had one or more conversations, they will show up here.",ENABLE_TRANSLATION:"Translate this conversation to English",DISABLE_TRANSLATION:"Show original",SEARCH_PLACEHOLDER_TEXT:"Search...",SEARCH_SEARCHING:"Searching...",SEARCH_NO_RESULTS:"No results found",SEARCH_NO_MORE_RESULTS:"No more results",CHAT_NOT_FOUND:"Chat not found",DELETE_MESSAGE:"Delete message",DELETION_EXPLANATION:"If you delete this message, it will disappear for everybody.",EDIT_MESSAGE:"Edit message",SAVE:"Save",EDITED_INDICATOR:"edited",REPLY_TO_MESSAGE:"Reply",REPLY_TO_ARIA_LABEL:(n,t)=>`Replying to ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Exit reply mode",ADD_REACTION:"Add reaction",AUTH_EXPIRED_OVERLAY_TITLE:"Your chat session has expired",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Refresh the page to continue",VOICE_MESSAGE:"Voice message",LEAVE_CONVERSATION:"Leave conversation",MARK_CONVERSATION_AS_UNREAD:"Mark as unread",STATUS_INDICATOR_ONLINE:"Active",STATUS_INDICATOR_OFFLINE:"Away",CONTACT_INFORMATION_HIDDEN:"hidden information"}},sS={code:"ar",name:"Arabic",translation:{YESTERDAY:"الأمس",TODAY:"اليوم",DAYS:"يوم",HOURS:"ساعة",MINUTES:"دقيقة",JUST_NOW:"فقط الآن",LOCATION:"الموقع",CANCEL:"إلغاء",INBOX:"علبة الوارد",DESKTOP_NOTIFICATIONS:"إشعارات المتصفح",DESKTOP_NOTIFICATIONS_ERROR:"لا يمكن تمكين إشعارات المتصفح لأن متصفحك يمنعها بشكل نشط. جرّب البحث في الإعدادات أو استخدام متصفح آخر.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`إعلام ${n} التجريبي`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"إذا أبقيت علامة تبويب المتصفح مفتوحة ، فسترى هذا ينبثق عندما يتحدث شخص معك.",SEND_BUTTON_TEXT:"إرسال",ENTRYBOX_TEXT_LIMIT:"يُسمح فقط بـ 10.000 حرف.",ENTRYBOX_PLACEHOLDER:"قل شيئًا ...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"هذه المحادثة لم تعد نشطة.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"يمكنك القراءة ، لكن لا يمكنك إرسال الرسائل.",MESSAGELIST_LOADING_OLDER:"جارٍ تحميل الرسائل القديمة ...",MESSAGELIST_SHOW_OLDER:"عرض الرسائل الأقدم",MESSAGELIST_NEW_MARKER:"جديد",MESSAGE_SENT_VIA_EMAIL:"تم إرسال هذه الرسالة عبر البريد الإلكتروني",YOU_MARKER:"أنت",UPLOAD_IN_PROGRESS:"جارٍ التحميل ...",UPLOAD_SEND_FILE:"إرسال ملف",UPLOAD_SHARE_LOCATION:"مشاركة الموقع",UPLOAD_ERROR:"حدث خطأ ما في تحميل شيء. ربما يكون الملف غير متوافق أو كبير جدًا.",SHARE_LOCATION_ERROR:"لا يمكن مشاركة الموقع:",LOADING:"جارٍ التحميل ...",HUB_EMPTY:"سوف يظهر سجل الدردشات هنا",HUB_SHOW_EARLIER:"إظهار الدردشات السابقة",INBOX_NO_CHATS_TITLE:"لا توجد دردشات بعد!",INBOX_NO_CHATS_BODY:"بمجرد أن يكون لديك واحد أو أكثر من المحادثات ، سوف تظهر هنا.",ENABLE_TRANSLATION:"ترجم هذه المحادثة إلى العربية",DISABLE_TRANSLATION:"إظهار الأصلي",SEARCH_PLACEHOLDER_TEXT:"...بحث",SEARCH_SEARCHING:"...يتم الآن البحث",SEARCH_NO_RESULTS:"لم يتم العثور على نتائج",SEARCH_NO_MORE_RESULTS:"لا يوجد المزيد من النتائج",CHAT_NOT_FOUND:"لم يتم العثور على الدردشة",DELETE_MESSAGE:"احذف الرسالة",DELETION_EXPLANATION:"إذا قمت بحذف هذه الرسالة، فهي ستختفي للجميع.",EDIT_MESSAGE:"تعديل الرسالة",SAVE:"حفظ",EDITED_INDICATOR:"معدّلة",REPLY_TO_MESSAGE:"رد",ADD_REACTION:"أضف تفاعلاً",AUTH_EXPIRED_OVERLAY_TITLE:"انتهت جلسة الدردشة المخصصة لك",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"يُرجى إعادة تحميل الصفحة للمتابعة",VOICE_MESSAGE:"رسالة صوتية",CONTACT_INFORMATION_HIDDEN:"المعلومات المخفية",LEAVE_CONVERSATION:"الخروج من المحادثة",MARK_CONVERSATION_AS_UNREAD:"وضع علامة غير مقروءة",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},aS={code:"bg-BG",name:"Bulgarian",translation:{YESTERDAY:"Вчера",TODAY:"Днес",DAYS:"Ден",HOURS:"Час",MINUTES:"m",JUST_NOW:"Току-що",LOCATION:"местоположението",CANCEL:"Откажи",INBOX:"Кутия",DESKTOP_NOTIFICATIONS:"Известия на браузъра",DESKTOP_NOTIFICATIONS_ERROR:"Не можете да активирате известията на браузъра, защото браузърът ви ги блокира активно. Опитайте да погледнете в настройките или да използвате друг браузър.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} демо известие`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ако държите раздела на браузъра си отворен, ще видите този изскачащ прозорец, когато някой говори с вас.",SEND_BUTTON_TEXT:"Изпрати",ENTRYBOX_TEXT_LIMIT:"Разрешени са само до 10.000 знака.",ENTRYBOX_PLACEHOLDER:"Кажете нещо...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Този ​​разговор вече не е активен.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Можете да четете, но не и да изпращате съобщения.",MESSAGELIST_LOADING_OLDER:"Зареждане на по-стари съобщения...",MESSAGELIST_SHOW_OLDER:"Показване на по-стари съобщения",MESSAGELIST_NEW_MARKER:"Нови",MESSAGE_SENT_VIA_EMAIL:"Това съобщение беше изпратено по имейл",YOU_MARKER:"Вие",UPLOAD_IN_PROGRESS:"Качване...",UPLOAD_SEND_FILE:"Изпращане на файл",UPLOAD_SHARE_LOCATION:"Споделяне на местоположението",UPLOAD_ERROR:"За съжаление нещо се обърка при качването. Файлът може да не се поддържа или е твърде голям.",SHARE_LOCATION_ERROR:"Не може да се сподели местоположението: ",LOADING:"Зареждане...",HUB_EMPTY:"Историята на вашите разговори ще се покаже тук",HUB_SHOW_EARLIER:"Показване на по-ранни чатове",INBOX_NO_CHATS_TITLE:"Все още нямате разговори!",INBOX_NO_CHATS_BODY:"След като проведете един или повече разговори, те ще се покажат тук.",ENABLE_TRANSLATION:"Преведете този разговор на български",DISABLE_TRANSLATION:"Показване на оригинал",SEARCH_PLACEHOLDER_TEXT:"Търсене...",SEARCH_SEARCHING:"Търсене...",SEARCH_NO_RESULTS:"Няма намерени резултати",SEARCH_NO_MORE_RESULTS:"Няма повече резултати",CHAT_NOT_FOUND:"Чатът не е намерен",DELETE_MESSAGE:"Изтриване на съобщение",DELETION_EXPLANATION:"Ако изтриете това съобщение, то ще изчезне за всички.",EDIT_MESSAGE:"Редактиране на съобщението",SAVE:"Запиши",EDITED_INDICATOR:"редактирано",REPLY_TO_MESSAGE:"Отговори",ADD_REACTION:"Добави реакция",AUTH_EXPIRED_OVERLAY_TITLE:"Вашата чат сесия е изтекла",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Обновете страницата, за да продължите",VOICE_MESSAGE:"Гласово съобщение",CONTACT_INFORMATION_HIDDEN:"Скрита информация",LEAVE_CONVERSATION:"Напускане на разговора",MARK_CONVERSATION_AS_UNREAD:"Маркирай като непрочетено",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},lS={code:"bs-BA",name:"Bosnian",translation:{YESTERDAY:"Jučer",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Obavijesti preglednika",DESKTOP_NOTIFICATIONS_ERROR:"Notifikacije preglednika se ne mogu omogućiti jer ih vaš preglednik aktivno blokira. Pokušajte pregledati postavke ili koristiti drugi preglednik.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu preglednika ostavite otvorenu, pojavit će se ovaj pop-up kada netko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Reci nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možeš čitati, ali ne i slati poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana e-poštom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podijeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podijeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovdje će se prikazati vaša povijest razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovdje.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na bosanski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Ćaskanje nije pronađeno",DELETE_MESSAGE:"Obriši poruku",DELETION_EXPLANATION:"Ako izbrišete ovu poruku, ona će nestati za sve.",EDIT_MESSAGE:"Uredi poruku",SAVE:"Sačuvati",EDITED_INDICATOR:"uređeno",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodajte reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša chat sesija je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvježite stranicu da nastavite",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Skrivene informacije",LEAVE_CONVERSATION:"Napusti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitano",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},uS={code:"ca-ES",name:"Catalan (ES)",translation:{YESTERDAY:"Ahir",TODAY:"Avui",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"ara mateix",LOCATION:"Ubicació",CANCEL:"Cancel·lar",INBOX:"Safata d'entrada",DESKTOP_NOTIFICATIONS:"Notificacions d'escriptori",DESKTOP_NOTIFICATIONS_ERROR:"No es poden habilitar les notificacions del navegador perquè el teu navegador les bloqueja activament. Prova de buscar a la configuració o utilitza un altre navegador.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notificació de demostració de ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si mantens la pestanya del navegador oberta, veuràs aquesta notificació quan algú et parli.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Només es permeten 10.000 caràcters.",ENTRYBOX_PLACEHOLDER:"Digues alguna cosa...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Aquesta conversa ja no està activa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Pots llegir, però no enviar missatges.",MESSAGELIST_LOADING_OLDER:"Carregant missatges antics...",MESSAGELIST_SHOW_OLDER:"Mostrar missatges més antics",MESSAGELIST_NEW_MARKER:"Nou",MESSAGE_SENT_VIA_EMAIL:"Aquest missatge s'ha enviat per correu electrònic",YOU_MARKER:"tu",UPLOAD_IN_PROGRESS:"S'està pujant...",UPLOAD_SEND_FILE:"Enviar arxiu",UPLOAD_SHARE_LOCATION:"Compartir ubicació",UPLOAD_ERROR:"Desafortunadament, alguna cosa ha anat malament en pujar. L'arxiu pot ser no compatible o massa gran.",SHARE_LOCATION_ERROR:"No es pot compartir la ubicació: ",LOADING:"Carregant...",HUB_EMPTY:"El teu historial de xat apareixerà aquí",HUB_SHOW_EARLIER:"Mostra xats anteriors",INBOX_NO_CHATS_TITLE:"Encara no hi ha xats!",INBOX_NO_CHATS_BODY:"Un cop hagis tingut una o més converses, apareixeran aquí.",ENABLE_TRANSLATION:"Traduir aquesta conversa al català",DISABLE_TRANSLATION:"Mostrar original",SEARCH_PLACEHOLDER_TEXT:"Cerca...",SEARCH_SEARCHING:"Buscant...",SEARCH_NO_RESULTS:"No s'han trobat resultats",SEARCH_NO_MORE_RESULTS:"No hi ha més resultats",CHAT_NOT_FOUND:"Xat no trobat",DELETE_MESSAGE:"Esborrar missatge",DELETION_EXPLANATION:"Si esborres aquest missatge, desapareixerà per a tothom.",EDIT_MESSAGE:"Editar missatge",SAVE:"Desar",EDITED_INDICATOR:"editat",REPLY_TO_MESSAGE:"Respondre",REPLY_TO_ARIA_LABEL:(n,t)=>`Responent a ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Sortir del mode de resposta",ADD_REACTION:"Afegir reacció",VOICE_MESSAGE:"Missatge de veu",LEAVE_CONVERSATION:"Abandonar la conversa",MARK_CONVERSATION_AS_UNREAD:"marcar com no llegit",STATUS_INDICATOR_ONLINE:"Actiu",STATUS_INDICATOR_OFFLINE:"Absent",CONTACT_INFORMATION_HIDDEN:"informació oculta",AUTH_EXPIRED_OVERLAY_TITLE:"La teva sessió de xat ha caducat",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualitza la pàgina per continuar"}},cS={code:"cs-CZ",name:"Czech",translation:{YESTERDAY:"Včera",TODAY:"Dnes",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"právě teď",LOCATION:"Lokace",CANCEL:"Zrušit",INBOX:"Doručené",DESKTOP_NOTIFICATIONS:"Oznámení v prohlížeči",DESKTOP_NOTIFICATIONS_ERROR:"Nelze povolit notifikace prohlížeče, protože váš prohlížeč je aktivně blokuje. Zkuste se podívat na nastavení nebo zkuste použít jiný prohlížeč.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikace`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Pokud necháte kartu prohlížeče otevřenou, uvidíte tento popup jakmile s vámi bude někdo mluvit.",SEND_BUTTON_TEXT:"Odeslat",ENTRYBOX_TEXT_LIMIT:"Je povoleno Maximálně 10.000 znaků.",ENTRYBOX_PLACEHOLDER:"Napište něco...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Tato konverzace již není aktivní.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Můžete číst, ale nemůžete posílat zprávy.",MESSAGELIST_LOADING_OLDER:"Nahrávám starší zprávy...",MESSAGELIST_SHOW_OLDER:"Zobrazit starší zprávy",MESSAGELIST_NEW_MARKER:"Nové",MESSAGE_SENT_VIA_EMAIL:"Tato zpráva byla odeslána přes mail.",YOU_MARKER:"vy",UPLOAD_IN_PROGRESS:"Nahrávám...",UPLOAD_SEND_FILE:"Poslat soubor",UPLOAD_SHARE_LOCATION:"Sdílet pozici",UPLOAD_ERROR:"Nepodařilo se nahrát soubor. Ten je buď nepodporován a/nebo příliš velký.",SHARE_LOCATION_ERROR:"Není možné sdílet pozici: ",LOADING:"Nahrávám...",HUB_EMPTY:"Vaše historie se zde zobrazí",HUB_SHOW_EARLIER:"Zobrazit dřívější konverzace",INBOX_NO_CHATS_TITLE:"Zatím zde nejsou žádné konverzace!",INBOX_NO_CHATS_BODY:"Jakmile budete mít jednu nebo více konverzací, objeví se zde.",ENABLE_TRANSLATION:"Přeložit tuto konverzaci do češtiny",DISABLE_TRANSLATION:"Zobrazit původní",SEARCH_PLACEHOLDER_TEXT:"Hledat...",SEARCH_SEARCHING:"Hledání...",SEARCH_NO_RESULTS:"Nenašly se žádné výsledky",SEARCH_NO_MORE_RESULTS:"Žádné další výsledky",CHAT_NOT_FOUND:"Chat nenalezen",DELETE_MESSAGE:"Smazat zprávu",DELETION_EXPLANATION:"Pokud tuto zprávu smažete, zmizí pro všechny.",EDIT_MESSAGE:"Upravit zprávu",SAVE:"Uložit",EDITED_INDICATOR:"upraveno",REPLY_TO_MESSAGE:"Odpovědět",ADD_REACTION:"Reagovat",AUTH_EXPIRED_OVERLAY_TITLE:"Váš chat byl kvůli nečinnosti odpojen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Pro pokračování obnovte stránku",VOICE_MESSAGE:"Hlasová zpráva",CONTACT_INFORMATION_HIDDEN:"Skrytá informace",LEAVE_CONVERSATION:"Opustit konverzaci",MARK_CONVERSATION_AS_UNREAD:"Označit jako nepřečtené",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},dS={code:"da-DK",name:"Danish",translation:{YESTERDAY:"I går",TODAY:"I dag",DAYS:"d",HOURS:"t",MINUTES:"m",JUST_NOW:"lige nu",LOCATION:"Placering",CANCEL:"Annuller",INBOX:"Indbakke",DESKTOP_NOTIFICATIONS:"Browsermeddelelser",DESKTOP_NOTIFICATIONS_ERROR:"Kan ikke aktivere Browsermeddelelser, fordi din browser aktivt blokerer dem. Prøv at kigge i indstillingerne eller benyt en anden browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demomeddelelse`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Hvis du holder dit browser-faneblad åben, vil du se det her komme op, når nogen taler til dig.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Kun 10.000 tegn er tilladt.",ENTRYBOX_PLACEHOLDER:"Sig noget...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Denne samtale er ikke længere aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan læse, men ikke sende beskeder.",MESSAGELIST_LOADING_OLDER:"Indlæser ældre beskeder...",MESSAGELIST_SHOW_OLDER:"Vis ældre beskeder",MESSAGELIST_NEW_MARKER:"Ny",MESSAGE_SENT_VIA_EMAIL:"Denne besked blev sendt via e-mail",YOU_MARKER:"dig",UPLOAD_IN_PROGRESS:"Overfører...",UPLOAD_SEND_FILE:"Send fil",UPLOAD_SHARE_LOCATION:"Del placering",UPLOAD_ERROR:"Der er sket noget forkert ved upload. Filen kan ikke understøttes eller filen er for stor.",SHARE_LOCATION_ERROR:"Kan ikke dele placering: ",LOADING:"Indlæser...",HUB_EMPTY:"Dine samtaler vises her",HUB_SHOW_EARLIER:"Vis tidligere chats",INBOX_NO_CHATS_TITLE:"Ingen chats endnu!",INBOX_NO_CHATS_BODY:"Når du har haft en eller flere samtaler, vises de her.",ENABLE_TRANSLATION:"Oversæt denne konversation til dansk",DISABLE_TRANSLATION:"Vis den oprindelige",SEARCH_PLACEHOLDER_TEXT:"Søg...",SEARCH_SEARCHING:"Søger...",SEARCH_NO_RESULTS:"Ingen resultater fundet",SEARCH_NO_MORE_RESULTS:"Ikke flere resultater",CHAT_NOT_FOUND:"Chat ikke fundet",DELETE_MESSAGE:"Slet besked",DELETION_EXPLANATION:"Hvis du sletter denne besked, vil ingen kunne se den.",EDIT_MESSAGE:"Rediger besked",SAVE:"Gem",EDITED_INDICATOR:"redigeret",REPLY_TO_MESSAGE:"Svar",ADD_REACTION:"Tilføj reaktion",AUTH_EXPIRED_OVERLAY_TITLE:"Din chatsession er udløbet",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Opdater siden for at fortsætte",VOICE_MESSAGE:"Talebesked",CONTACT_INFORMATION_HIDDEN:"Skjulte oplysninger",LEAVE_CONVERSATION:"Forlad samtale",MARK_CONVERSATION_AS_UNREAD:"Marker som ulæst",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},hS={code:"de-DE",name:"German",translation:{YESTERDAY:"Gestern",TODAY:"Heute",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"gerade jetzt",LOCATION:"Standort",CANCEL:"Abbrechen",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browser-Benachrichtigungen",DESKTOP_NOTIFICATIONS_ERROR:"Browser-Benachrichtigungen können nicht aktiviert werden, da Ihr Browser sie aktiv blockiert. Versuchen Sie, in den Einstellungen nachzuschlagen oder einen anderen Browser zu verwenden.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} Demo-Benachrichtigung`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Wenn Sie Ihre Browser-Registerkarte geöffnet lassen, wird dies angezeigt, wenn jemand mit Ihnen spricht.",SEND_BUTTON_TEXT:"Senden",ENTRYBOX_TEXT_LIMIT:"Nur 10.000 Zeichen sind erlaubt.",ENTRYBOX_PLACEHOLDER:"Sag etwas...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Diese Konversation ist nicht mehr aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Sie können Nachrichten lesen, aber nicht senden.",MESSAGELIST_LOADING_OLDER:"Ältere Nachrichten werden geladen...",MESSAGELIST_SHOW_OLDER:"Zeige ältere Nachrichten",MESSAGELIST_NEW_MARKER:"Neu",MESSAGE_SENT_VIA_EMAIL:"Diese Nachricht wurde per E-Mail gesendet",YOU_MARKER:"du",UPLOAD_IN_PROGRESS:"Hochladen...",UPLOAD_SEND_FILE:"Datei senden",UPLOAD_SHARE_LOCATION:"Standort teilen",UPLOAD_ERROR:"Beim Hochladen ist ein Fehler aufgetreten. Die Datei ist möglicherweise nicht unterstützt oder zu groß.",SHARE_LOCATION_ERROR:"Standort kann nicht freigegeben werden: ",LOADING:"Laden...",HUB_EMPTY:"Ihr Chat-Verlauf wird hier angezeigt",HUB_SHOW_EARLIER:"Zeige frühere Chats",INBOX_NO_CHATS_TITLE:"Noch keine Chats!",INBOX_NO_CHATS_BODY:"Sobald Sie eine oder mehrere Unterhaltungen geführt haben, werden sie hier angezeigt.",ENABLE_TRANSLATION:"Dieses Gespräch auf Deutsch übersetzen",DISABLE_TRANSLATION:"Originaltext anzeigen",SEARCH_PLACEHOLDER_TEXT:"Suche...",SEARCH_SEARCHING:"Suchen...",SEARCH_NO_RESULTS:"Keine Suchergebnisse gefunden",SEARCH_NO_MORE_RESULTS:"Keine weiteren Suchergebnisse",CHAT_NOT_FOUND:"Chat nicht gefunden",DELETE_MESSAGE:"Nachricht löschen",DELETION_EXPLANATION:"Wenn Sie diese Nachricht löschen, wird sie für alle verschwinden.",EDIT_MESSAGE:"Nachricht bearbeiten",SAVE:"Speichern",EDITED_INDICATOR:"bearbeitet",REPLY_TO_MESSAGE:"Antworten",ADD_REACTION:"Reaktion hinzufügen",AUTH_EXPIRED_OVERLAY_TITLE:"Ihre Chatsitzung ist abgelaufen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Laden Sie zum Fortfahren die Seite neu",VOICE_MESSAGE:"Sprachnachricht",CONTACT_INFORMATION_HIDDEN:"Geschützte Angaben",LEAVE_CONVERSATION:"Unterhaltung verlassen",MARK_CONVERSATION_AS_UNREAD:"als ungelesen markieren",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},pS={code:"el-GR",name:"Greek (Greece)",translation:{YESTERDAY:"Χθές",TODAY:"Σήμερα",DAYS:"Ημέρες",HOURS:"'Ωρες",MINUTES:"Λεπτά",JUST_NOW:"Μόλις τώρα",LOCATION:"Τοποθεσία",CANCEL:"Ακύρωση",INBOX:"Εισερχόμενα",DESKTOP_NOTIFICATIONS:"Ειδοποιήσεις περιηγητή",DESKTOP_NOTIFICATIONS_ERROR:"Δεν είναι δυνατή η ενεργοποίηση των ειδοποιήσεων του προγράμματος περιήγησης, επειδή το πρόγραμμα περιήγησης τις αποκλείει ενεργά. Δοκιμάστε να τσεκάρετε τις ρυθμίσεις ή να χρησιμοποιήσετε διαφορετικό πρόγραμμα περιήγησης.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} Δοκιμαστική επίδειξη`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Αν διατηρήσετε ανοιχτή τη σελίδα του προγράμματος περιήγησης, θα δείτε αυτό το pop up (παράθυρο) όταν κάποιος σας μιλάει.",SEND_BUTTON_TEXT:"Αποστολή",ENTRYBOX_TEXT_LIMIT:"Επιτρέπονται μόνο 10.000 χαρακτήρες.",ENTRYBOX_PLACEHOLDER:"Πείτε κάτι...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Αυτή η συζήτηση δεν είναι πλέον ενεργή.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Μπορείτε να διαβάσετε αλλά δεν μπορείτε να στείλετε μηνύματα.",MESSAGELIST_LOADING_OLDER:"Φόρτωση παλαιοτέρων μηνυμάτων...",MESSAGELIST_SHOW_OLDER:"Εμφάνιση παλαιότερων μηνυμάτων",MESSAGELIST_NEW_MARKER:"Νέο",MESSAGE_SENT_VIA_EMAIL:"Αυτό το μήνυμα εστάλη μέσω ηλεκτρονικού ταχυδρομείου",YOU_MARKER:"Εσείς",UPLOAD_IN_PROGRESS:"Ανέβασμα...",UPLOAD_SEND_FILE:"Αποστολή αρχείου",UPLOAD_SHARE_LOCATION:"Κοινή χρήση τοποθεσίας",UPLOAD_ERROR:"Κάτι πήγε στραβά κατά τη φόρτωση. Το αρχείο ενδέχεται να μην υποστηρίζεται ή να είναι υπερβολικά μεγάλο.",SHARE_LOCATION_ERROR:"Δεν είναι δυνατή η χρήση κοινής τοποθεσίας: ",LOADING:"Φόρτωση...",HUB_EMPTY:"Το ιστορικό των συνομιλιών σας θα εμφανιστεί εδώ",HUB_SHOW_EARLIER:"Εμφάνιση προηγούμενων συνομιλιών",INBOX_NO_CHATS_TITLE:"Δεν υπάρχουν ακόμα συζητήσεις!",INBOX_NO_CHATS_BODY:"Μόλις έχετε μία ή περισσότερες συνομιλίες, θα εμφανιστούν εδώ.",ENABLE_TRANSLATION:"Μετάφραση αυτής της συνομιλίας στα ελληνικά",DISABLE_TRANSLATION:"Προβολή πρωτοτύπου",SEARCH_PLACEHOLDER_TEXT:"Αναζήτηση...",SEARCH_SEARCHING:"Αναζήτηση...",SEARCH_NO_RESULTS:"Δεν βρέθηκαν αποτελέσματα",SEARCH_NO_MORE_RESULTS:"Δεν υπάρχουν περισσότερα αποτελέσματα",CHAT_NOT_FOUND:"Η συνομιλία δεν βρέθηκε",DELETE_MESSAGE:"Διαγραφή μηνύματος",DELETION_EXPLANATION:"Εάν διαγράψετε αυτό το μήνυμα, θα εξαφανιστεί για όλους.",EDIT_MESSAGE:"Επεξεργασία μηνύματος",SAVE:"Αποθήκευση",EDITED_INDICATOR:"επεξεργασμένο",REPLY_TO_MESSAGE:"Απάντηση",ADD_REACTION:"Προσθήκη αντίδρασης",AUTH_EXPIRED_OVERLAY_TITLE:"Η συνεδρία της συνομιλίας σας έχει λήξει",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Ανανεώστε τη σελίδα για να συνεχίσετε",VOICE_MESSAGE:"Ηχητικό μήνυμα",CONTACT_INFORMATION_HIDDEN:"Κρυμμένες πληροφορίες",LEAVE_CONVERSATION:"Αποσυρθείτε από τη συζήτηση",MARK_CONVERSATION_AS_UNREAD:"Επισήμανση ως μη αναγνωσμένα",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},fS={code:"es-ES",name:"Spanish",translation:{YESTERDAY:"Ayer",TODAY:"Hoy",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"justo ahora",LOCATION:"Ubicación",CANCEL:"Cancelar",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Notificaciones del navigator",DESKTOP_NOTIFICATIONS_ERROR:"No se logró habilitar las notificaciones del navigador, comprueba que tu navegador no las esté bloqueando o intenta con otro navegador.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} notificación de prueba`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si dejas esta pestaña abierta, verás este pop up cuando alguien te hable.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Sólo 10.000 caracteres permitidos.",ENTRYBOX_PLACEHOLDER:"Escribe algo...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Esta conversación ya no está activa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puedes leer pero no enviar mensajes.",MESSAGELIST_LOADING_OLDER:"Cargando mensajes pasados...",MESSAGELIST_SHOW_OLDER:"Ver mensajes pasados",MESSAGELIST_NEW_MARKER:"Nuevo",MESSAGE_SENT_VIA_EMAIL:"Este mensaje ha sido enviado vía email",YOU_MARKER:"tú",UPLOAD_IN_PROGRESS:"Subir...",UPLOAD_SEND_FILE:"Enviar archivo",UPLOAD_SHARE_LOCATION:"Compartir ubicación",UPLOAD_ERROR:"Ocurrió un problema subiendo el archivo. Puede que el archivo esté en un formato no soportado o que sea demasiado grande.",SHARE_LOCATION_ERROR:"No se logró compartir la ubicación: ",LOADING:"Cargando...",HUB_EMPTY:"Tu historial de conversaciones se mostrará aquí",HUB_SHOW_EARLIER:"Ver conversaciones pasadas",INBOX_NO_CHATS_TITLE:"¡Aún sin conversaciones!",INBOX_NO_CHATS_BODY:"Una vez que tengas una o más conversaciones, se mostrarán aquí.",ENABLE_TRANSLATION:"Traducir esta conversación al español",DISABLE_TRANSLATION:"Mostrar la conversación original",SEARCH_PLACEHOLDER_TEXT:"Buscar...",SEARCH_SEARCHING:"Buscando...",SEARCH_NO_RESULTS:"No se encontraron resultados",SEARCH_NO_MORE_RESULTS:"No hay más resultados",CHAT_NOT_FOUND:"Chat no encontrado",DELETE_MESSAGE:"Eliminar mensaje",DELETION_EXPLANATION:"Este mensaje desaparecerá para todos si lo borras.",EDIT_MESSAGE:"Editar mensaje",SAVE:"Guardar",EDITED_INDICATOR:"editado",REPLY_TO_MESSAGE:"Responder",ADD_REACTION:"Añadir reacción",AUTH_EXPIRED_OVERLAY_TITLE:"Su sesión de chat ha expirado",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualice la página para continuar",VOICE_MESSAGE:"Mensaje de voz",CONTACT_INFORMATION_HIDDEN:"Información oculta",LEAVE_CONVERSATION:"Abandonar conversación",MARK_CONVERSATION_AS_UNREAD:"Marcar como no leída",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},mS={code:"et-EE",name:"Estonian",translation:{YESTERDAY:"Eile",TODAY:"Täna",DAYS:"p",HOURS:"t",MINUTES:"m",JUST_NOW:"Just nüüd",LOCATION:"Asukoht",CANCEL:"Katkesta",INBOX:"Postkast",DESKTOP_NOTIFICATIONS:"Veebibrauseri teated",DESKTOP_NOTIFICATIONS_ERROR:"Töölaua teatisi ei saa lubada, kuna Teie brauser blokeerib need aktiivselt. Proovige muuta seadeid või kasutada mõnda muud brauserit.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo teavitus`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Kui hoiate oma brauseri vahekaardi lahti ja näete seda hüpikakent, siis keegi soovib Teiega rääkida.",SEND_BUTTON_TEXT:"Saada",ENTRYBOX_TEXT_LIMIT:"Ainult kuni 10.000 tähemärki on lubatud.",ENTRYBOX_PLACEHOLDER:"Kirjuta midagi...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"See vestlus ei ole enam aktiivne.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Sa saad lugeda teateid, aga mitte kirjutada.",MESSAGELIST_LOADING_OLDER:"Laen vanemaid teateid...",MESSAGELIST_SHOW_OLDER:"Näita vanemaid teateid",MESSAGELIST_NEW_MARKER:"Uus",MESSAGE_SENT_VIA_EMAIL:"See teade on saadetud e-postiga",YOU_MARKER:"Sina",UPLOAD_IN_PROGRESS:"Laen...",UPLOAD_SEND_FILE:"Saada fail",UPLOAD_SHARE_LOCATION:"Jaga faili asukohta",UPLOAD_ERROR:"Nüüd läks midagi nihu, seoses faili ülesse laadimisega. Tundmatu fail või liiga suur.",SHARE_LOCATION_ERROR:"Ei suuda jagada faili asukohta: ",LOADING:"Laen...",HUB_EMPTY:"Siin on Sinu vestluste ajalugu",HUB_SHOW_EARLIER:"Näita vanemaid vestlusi",INBOX_NO_CHATS_TITLE:"Pole ühtegi vestlust!",INBOX_NO_CHATS_BODY:"Kui Sul tekib üks või rohkem vestlust, siis on need kuvatakse siin.",ENABLE_TRANSLATION:"Tõlgi see vestlus eesti keelde",DISABLE_TRANSLATION:"Näita algteksti",SEARCH_PLACEHOLDER_TEXT:"Otsi...",SEARCH_SEARCHING:"Otsin...",SEARCH_NO_RESULTS:"Otsingu tulemused puuduvad",SEARCH_NO_MORE_RESULTS:"Rohkem tulemusi ei ole ",CHAT_NOT_FOUND:"Vestlust ei leitud",DELETE_MESSAGE:"Kustuta sõnum",DELETION_EXPLANATION:"Kui kustutate selle sõnumi, kaob see kõigi jaoks.",EDIT_MESSAGE:"Redigeeri sõnumit",SAVE:"Salvesta",EDITED_INDICATOR:"muudetud",REPLY_TO_MESSAGE:"Vasta",ADD_REACTION:"Lisa reaktsioon",AUTH_EXPIRED_OVERLAY_TITLE:"Teie vestlussessioon on lõppenud",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Jätkamiseks värskendage lehte",VOICE_MESSAGE:"Häälsõnum",CONTACT_INFORMATION_HIDDEN:"Varjatud informatsioon",LEAVE_CONVERSATION:"Lahku vestlusest",MARK_CONVERSATION_AS_UNREAD:"Märgi mitteloetuks",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},gS={code:"fa",name:"Persian (Farsi)",translation:{YESTERDAY:"دیروز",TODAY:"امروز",DAYS:"روز",HOURS:"ساعت",MINUTES:"دقیقه",JUST_NOW:"هم اکنون",LOCATION:"مکان",CANCEL:"لغو",INBOX:"صندوق",DESKTOP_NOTIFICATIONS:"اطلاعیه‌های مرورگر",DESKTOP_NOTIFICATIONS_ERROR:"خطا در فعال سازی اعلان های مرورگر، مرورگر شما آنها را مسدود می کند سعی کنید تنظیمات مرورگر را تغییر دهید یا از یک مرورگر دیگر استفاده کنید.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`نوتیفیکیشن دمو ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"اگر صفحه ی مرورگر را باز نگهدارید این را موقعه ای که کسی با شما صحبت کند خواهید دید",SEND_BUTTON_TEXT:"بفرست",ENTRYBOX_TEXT_LIMIT:"فقط ۱۰،۰۰۰ حروف مجاز می باشد.",ENTRYBOX_PLACEHOLDER:"...چیزی بنویسید",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:".این مکالمه دیگر فعال نمی باشد",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"شما می توانید بخوانید اما نمی توانید پیام بفرستید",MESSAGELIST_LOADING_OLDER:"...در حال بارگذاری پیام های قدیمی تر",MESSAGELIST_SHOW_OLDER:"نشان دادن پیام های قدیمی",MESSAGELIST_NEW_MARKER:"جدید",MESSAGE_SENT_VIA_EMAIL:"پیام توسط ایمل ارسال شد",YOU_MARKER:"شما",UPLOAD_IN_PROGRESS:"...در حال بارگذاری",UPLOAD_SEND_FILE:"فرستادن پوشه",UPLOAD_SHARE_LOCATION:"اشتراک گذاری مکان",UPLOAD_ERROR:"متاسفانه بارگذاری با مشکل روبه رو شد. ممکن است فایل حجیم باشد یا ساپورت نشده باشد.",SHARE_LOCATION_ERROR:"خطا در اشتراک گذاری مکان: ",LOADING:"...بارگذاری",HUB_EMPTY:"تاریخچه گفتگو اینجا نمایان می شود",HUB_SHOW_EARLIER:"دیدن گفتگو های قبلی",INBOX_NO_CHATS_TITLE:"هنوز گفتگویی وجود ندارد",INBOX_NO_CHATS_BODY:"بعد از داشتن یک مکالمه یا بیشتر، آنها اینجا نمایان می شوند.",ENABLE_TRANSLATION:"این مکالمه را به فارسی ترجمه کن",DISABLE_TRANSLATION:"زبان اصلی را نشان بده",SEARCH_PLACEHOLDER_TEXT:"...جستجو",SEARCH_SEARCHING:"...در حال جستجو",SEARCH_NO_RESULTS:"نتیجه ای یافت نشد",SEARCH_NO_MORE_RESULTS:"نتیجه بیشتری وجود ندارد",CHAT_NOT_FOUND:"مکالمه پیدا نشد",DELETE_MESSAGE:"حذف پیام ",DELETION_EXPLANATION:"اگر این پیام را حذف کنید، برای همه ناپدید می شود.",EDIT_MESSAGE:"ویرایش پیام",SAVE:"ذخیره",EDITED_INDICATOR:"ویرایش‌شده",REPLY_TO_MESSAGE:"پاسخ دادن",ADD_REACTION:"واکنش را اضافه کنید",AUTH_EXPIRED_OVERLAY_TITLE:"جلسه چت شما منقضی شده است",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"برای ادامه صفحه را بازخوانی کنید",VOICE_MESSAGE:"پیام صوتی",CONTACT_INFORMATION_HIDDEN:"اطلاعات پنهان",LEAVE_CONVERSATION:"خروج از گفتگو",MARK_CONVERSATION_AS_UNREAD:"به عنوان خوانده نشده علامت گذاری کن",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},ES={code:"fi-FI",name:"Finnish",translation:{YESTERDAY:"Eilen",TODAY:"Tänään",DAYS:"p",HOURS:"t",MINUTES:"m",JUST_NOW:"juuri nyt",LOCATION:"Sijainti",CANCEL:"Peruuta",INBOX:"Saapuneet",DESKTOP_NOTIFICATIONS:"Selaimen ilmoitukset",DESKTOP_NOTIFICATIONS_ERROR:"Työpöydän ilmoituksia ei voitu kytkeä päälle, koska selaimesi estää ne aktiivisesti. Koeta tutkia sen asetuksia tai vaihda selainta.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo ilmoitus`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jos pidät tämän sivun auki, näet vastaavan ilmoituksen kun joku puhuu sinulle.",SEND_BUTTON_TEXT:"Lähetä",ENTRYBOX_TEXT_LIMIT:"Maksimissaan 10000 merkkiä.",ENTRYBOX_PLACEHOLDER:"Sano jotain...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Tämä keskustelu ei ole enää aktiivinen.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Voit lukea, mutta et lähettää viestejä.",MESSAGELIST_LOADING_OLDER:"Ladataan vanhoja viestejä..",MESSAGELIST_SHOW_OLDER:"Näytä vanhat viestit",MESSAGELIST_NEW_MARKER:"Uusi",MESSAGE_SENT_VIA_EMAIL:"Tämä viesti on lähetetty sähköpostin välityksellä",YOU_MARKER:"sinä",UPLOAD_IN_PROGRESS:"Ladataan...",UPLOAD_SEND_FILE:"Lähetä tiedosto",UPLOAD_SHARE_LOCATION:"Jaa sijainti",UPLOAD_ERROR:"Valitettavasti jokin meni vikaan. Tiedostotyyppiä ei ehkä tueta tai se saattaa olla liian suuri.",SHARE_LOCATION_ERROR:"Sijaintia ei pystytty jakamaan: ",LOADING:"Ladataan...",HUB_EMPTY:"Keskusteluhistoriasi näkyy tässä",HUB_SHOW_EARLIER:"Näytä aiemmat keskustelut",INBOX_NO_CHATS_TITLE:"Ei keskusteluja, vielä!",INBOX_NO_CHATS_BODY:"Kun olet käynyt yhden tai useamman keskustelun, ne näkyvät täällä.",ENABLE_TRANSLATION:"Käännä keskustelu kielelle suomi",DISABLE_TRANSLATION:"Näytä alkuperäinen",SEARCH_PLACEHOLDER_TEXT:"Etsi...",SEARCH_SEARCHING:"Etsiminen...",SEARCH_NO_RESULTS:"Tuloksia ei löytynyt",SEARCH_NO_MORE_RESULTS:"Ei enempää tuloksia",CHAT_NOT_FOUND:"Keskustelua ei löytynyt",DELETE_MESSAGE:"Poista viesti",DELETION_EXPLANATION:"Jos poistat tämän viestin, se häviää kaikilta.",EDIT_MESSAGE:"Muokkaa viestiä",SAVE:"Tallenna",EDITED_INDICATOR:"muokattu",REPLY_TO_MESSAGE:"Vastaa",ADD_REACTION:"Lisää reaktio",AUTH_EXPIRED_OVERLAY_TITLE:"Istuntosi on vanhentunut",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Päivitä sivu jatkaaksesi",VOICE_MESSAGE:"Ääniviesti",CONTACT_INFORMATION_HIDDEN:"Piilotetut tiedot",LEAVE_CONVERSATION:"Poistu keskustelusta",MARK_CONVERSATION_AS_UNREAD:"Merkitse lukemattomaksi",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},AS={code:"fr-FR",name:"French",translation:{YESTERDAY:"Hier",TODAY:"Aujourd'hui",DAYS:"j",HOURS:"h",MINUTES:"m",JUST_NOW:"maintenant",LOCATION:"Emplacement",CANCEL:"Annuler",INBOX:"Boîte de réception",DESKTOP_NOTIFICATIONS:"Notifications du navigateur",DESKTOP_NOTIFICATIONS_ERROR:"Impossible d'activer les notifications du navigateur car votre navigateur les bloque. Essayez de changer ses paramètres ou de changer de navigateur.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notification de démonstration ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si vous maintenez l'onglet ouvert dans votre navigateur vous verrez apparaître une alerte lorsque quelqu'un vous parlera.",SEND_BUTTON_TEXT:"Envoyer",ENTRYBOX_TEXT_LIMIT:"Seuls 10.000 caractères sont autorisés.",ENTRYBOX_PLACEHOLDER:"Ecrivez quelque chose...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Cette conversation n'est plus active.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Vous pouvez lire, mais pas envoyer de messages.",MESSAGELIST_LOADING_OLDER:"Chargement des anciens messages ...",MESSAGELIST_SHOW_OLDER:"Afficher les anciens messages",MESSAGELIST_NEW_MARKER:"Nouveau",MESSAGE_SENT_VIA_EMAIL:"Ce message a été envoyé par e-mail",YOU_MARKER:"vous",UPLOAD_IN_PROGRESS:"Envoi en cours...",UPLOAD_SEND_FILE:"Envoyer un fichier",UPLOAD_SHARE_LOCATION:"Partager mon emplacement",UPLOAD_ERROR:"Un problème est survenu lors de l'envoi: le fichier est peut-être non pris en charge ou trop volumineux.",SHARE_LOCATION_ERROR:"Impossible de partager votre emplacement: ",LOADING:"Chargement en cours...",HUB_EMPTY:"Votre historique de discussion apparaîtra ici",HUB_SHOW_EARLIER:"Afficher les conversations précédentes",INBOX_NO_CHATS_TITLE:"Aucune conversation pour l'instant!",INBOX_NO_CHATS_BODY:"Une fois que vous aurez eu une ou plusieurs conversations, elles apparaîtront ici.",ENABLE_TRANSLATION:"Traduire cette conversation en français",DISABLE_TRANSLATION:"Remontrer la conversation originale",SEARCH_PLACEHOLDER_TEXT:"Rechercher...",SEARCH_SEARCHING:"Recherche...",SEARCH_NO_RESULTS:"Aucun résultat trouvé",SEARCH_NO_MORE_RESULTS:"Il n’y a plus de résultats",CHAT_NOT_FOUND:"Conversation introuvable",DELETE_MESSAGE:"Supprimer le message",DELETION_EXPLANATION:"Si vous supprimez ce message, il disparaîtra pour tout le monde.",EDIT_MESSAGE:"Modifier le message",SAVE:"Enregistrer",EDITED_INDICATOR:"modifié",REPLY_TO_MESSAGE:"Répondre",ADD_REACTION:"Ajouter une réaction",AUTH_EXPIRED_OVERLAY_TITLE:"Votre session de chat a expiré",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualisez la page pour continuer",VOICE_MESSAGE:"Message vocal",CONTACT_INFORMATION_HIDDEN:"Informations masquées",LEAVE_CONVERSATION:"Quitter la conversation",MARK_CONVERSATION_AS_UNREAD:"Marquer comme non lu",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},vS={code:"he-IL",name:"Hebrew",translation:{YESTERDAY:"אתמול",TODAY:"היום",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"עכשיו",LOCATION:"מיקום",CANCEL:"בטל",INBOX:"דואר נכנס",DESKTOP_NOTIFICATIONS:"התראות דפדפן",DESKTOP_NOTIFICATIONS_ERROR:"לא ניתן להפעיל התראות במרועה דפדפן מכיוון שהדפדפן שלך חוסם אותן באופן פעיל. נסה להסתכל בהגדרות או להשתמש בדפדפן אחר.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} הודעה על הדגמה`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"אם אתה שומר על כרטיסיית הדפדפן שלך פתוחה, תראה את זה צץ כשמישהו ידבר איתך.",SEND_BUTTON_TEXT:"שלח",ENTRYBOX_TEXT_LIMIT:"רק 10.000 תווים",ENTRYBOX_PLACEHOLDER:"תגיד משהו...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"שיחה זו אינה פעילה עוד.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"אתה יכול לקרוא, אך לא לשלוח הודעות.",MESSAGELIST_LOADING_OLDER:"טוען הודעות ישנות...",MESSAGELIST_SHOW_OLDER:"הצג הודעות ישנות",MESSAGELIST_NEW_MARKER:"חדש",MESSAGE_SENT_VIA_EMAIL:"הודעה זאת נשלחה דרך אימייל",YOU_MARKER:"אתה",UPLOAD_IN_PROGRESS:"מעלה ...",UPLOAD_SEND_FILE:"שלח קובץ",UPLOAD_SHARE_LOCATION:"שתף מיקום",UPLOAD_ERROR:"לרוע המזל משהו השתבש בהעלאה. ייתכן שהקובץ אינו נתמך או גדול מדי.",SHARE_LOCATION_ERROR:"לא ניתן לשתף מיקום: ",LOADING:"טוען...",HUB_EMPTY:"היסטוריית הצ'אט שלך תופיע כאן",HUB_SHOW_EARLIER:"הצג צ'אטים קודמים",INBOX_NO_CHATS_TITLE:"אין עדיין צ'אטים!",INBOX_NO_CHATS_BODY:"לאחר שניהלת שיחה אחת או יותר, הם יופיעו כאן.",ENABLE_TRANSLATION:"תרגם שיחה זו לעברית",DISABLE_TRANSLATION:"הצג מקור",SEARCH_PLACEHOLDER_TEXT:"...חפש",SEARCH_SEARCHING:"...מחפש",SEARCH_NO_RESULTS:"לא נמצאו תוצאות",SEARCH_NO_MORE_RESULTS:"אין תוצאות נוספות",CHAT_NOT_FOUND:"הצ'אט לא נמצא",DELETE_MESSAGE:"מחיקת הודעה",DELETION_EXPLANATION:"אם תמחק הודעה זו, היא תיעלם עבור כולם.",EDIT_MESSAGE:"עריכת הודעה",SAVE:"שמור",EDITED_INDICATOR:"ערוך",REPLY_TO_MESSAGE:"השב",ADD_REACTION:"הוספת תגובה",AUTH_EXPIRED_OVERLAY_TITLE:"הפעלת הצ׳אט שלכם פגה",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"רעננו את העמוד כדי להמשיך",VOICE_MESSAGE:"הודעה קולית",CONTACT_INFORMATION_HIDDEN:"מידע מוסתר",LEAVE_CONVERSATION:"צא מהשיחה",MARK_CONVERSATION_AS_UNREAD:"סמן כלא נקרא",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},_S={code:"hi-IN",name:"Hindi (IN)",translation:{YESTERDAY:"कल",TODAY:"आज",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"अभी",LOCATION:"जगह",CANCEL:"रद्द करें",INBOX:"इनबॉक्स",DESKTOP_NOTIFICATIONS:"ब्राउज़र सूचनाएं",DESKTOP_NOTIFICATIONS_ERROR:"ब्राउज़र सूचनाएं सक्षम नहीं कर सकता क्योंकि आपका ब्राउज़र सक्रिय रूप से उन्हें ब्लॉक करता है। सेटिंग्स में देखने या एक अलग ब्राउज़र का उपयोग करने का प्रयास करें।",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} डेमो अधिसूचना`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"यदि आप अपना ब्राउज़र टैब खुला रखते हैं, तो यह पॉप अप आपको तब दिखाई देगा जब कोई आपसे बात करेगा।",SEND_BUTTON_TEXT:"भेजें",ENTRYBOX_TEXT_LIMIT:"केवल 10,000 वर्णों की अनुमति है।",ENTRYBOX_PLACEHOLDER:"कुछ कहिए...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"यह चैट अब सक्रिय नहीं है।",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"आप पढ़ सकते हैं, लेकिन संदेश नहीं भेज सकते।",MESSAGELIST_LOADING_OLDER:"पुराने संदेश लोड हो रहे हैं ...",MESSAGELIST_SHOW_OLDER:"पुराने संदेश दिखाएं",MESSAGELIST_NEW_MARKER:"नया",MESSAGE_SENT_VIA_EMAIL:"यह संदेश ईमेल के माध्यम से भेजा गया था",YOU_MARKER:"आप",UPLOAD_IN_PROGRESS:"अपलोड हो रहा है...",UPLOAD_SEND_FILE:"फाइल भेजें",UPLOAD_SHARE_LOCATION:"जगह शेयर करें",UPLOAD_ERROR:"दुर्भाग्य से, अपलोड करते समय कुछ गलत हो गया। फ़ाइल असमर्थित या बहुत बड़ी हो सकती है।",SHARE_LOCATION_ERROR:"जगह शेयर नहीं हो पाया: ",LOADING:"लोड हो रहा है...",HUB_EMPTY:"आपका चैट इतिहास यहां दिखाई देगा",HUB_SHOW_EARLIER:"पहले की चैट दिखाओ",INBOX_NO_CHATS_TITLE:"अभी तक कोई चैट नहीं!",INBOX_NO_CHATS_BODY:"एक बार जब आप एक या अधिक चैट कर लेते हैं, तो वे यहां दिखाई देंगे।",ENABLE_TRANSLATION:"इस बातचीत का हिंदी में अनुवाद कीजिए",DISABLE_TRANSLATION:"मूल दिखाएँ",SEARCH_PLACEHOLDER_TEXT:"खोजें...",SEARCH_SEARCHING:"खोज जारी है...",SEARCH_NO_RESULTS:"कोई परिणाम नहीं मिला",SEARCH_NO_MORE_RESULTS:"और कोई परिणाम नहीं",CHAT_NOT_FOUND:"चैट नहीं मिली",DELETE_MESSAGE:"संदेश डिलीट करें",DELETION_EXPLANATION:"यदि आप इस संदेश को हटाते हैं, तो यह सभी के लिए गायब हो जाएगा.",EDIT_MESSAGE:"संदेश में बदलाव करें",SAVE:"सहेजें",EDITED_INDICATOR:"संपादित किया गया",REPLY_TO_MESSAGE:"जवाब दीजिए ।",ADD_REACTION:"प्रतिक्रिया जोड़ें",AUTH_EXPIRED_OVERLAY_TITLE:"आपका चैट सेशन समाप्त हो चुका है",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"आगे बढ़ने के लिए रिफ्रेश करें",VOICE_MESSAGE:"वॉयस मैसेज",CONTACT_INFORMATION_HIDDEN:"छुपी हुई जानकारी",LEAVE_CONVERSATION:"बातचीत को ख़त्म करें",MARK_CONVERSATION_AS_UNREAD:"अपठित के रूप में चिह्नित करें",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},yS={code:"hr-HR",name:"Croatian",translation:{YESTERDAY:"Jučer",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Obavijesti preglednika",DESKTOP_NOTIFICATIONS_ERROR:"Notifikacije preglednika nisu omogućene jer ih vaš preglednik aktivno blokira. Pokušajte pogledati postavke ili koristiti neki drugi preglednik.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu preglednika ostavite otvorenu, pojavit će se ovaj pop-up kada netko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Reci nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možeš čitati, ali ne i slati poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana e-poštom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podijeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podijeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovdje će se prikazati vaša povijest razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovdje.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na hrvatski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Razgovor nije pronađen",DELETE_MESSAGE:"Obriši poruku",DELETION_EXPLANATION:"Ako izbrišete ovu poruku, nestat će za sve.",EDIT_MESSAGE:"Uredi poruku",SAVE:"Spremi",EDITED_INDICATOR:"uređivao",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodajte reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša sesija razgovora je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvježite stranicu za nastavak",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Skrivene informacije",LEAVE_CONVERSATION:"Napustiti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitano",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},TS={code:"hu-HU",name:"Hungarian",translation:{YESTERDAY:"Tegnap",TODAY:"Ma",DAYS:"n",HOURS:"ó",MINUTES:"p",JUST_NOW:"éppen most",LOCATION:"Helyszín",CANCEL:"Visszavonás",INBOX:"Postaláda",DESKTOP_NOTIFICATIONS:"Böngésző értesítések",DESKTOP_NOTIFICATIONS_ERROR:"Azért nem tudja bekapcsolni a böngésző értesítések funkciót, mert böngészője aktívan blokkolja azt. Tekintse meg a beállításokat vagy használjon másik böngészőt.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo értesítés`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ha nyitva hagyja böngészőjét, felugró ablak fog megjelenni, ha valaki beszélni szeretne Önnel.",SEND_BUTTON_TEXT:"Küldés",ENTRYBOX_TEXT_LIMIT:"Mindőssze 10.000 karakter megengedett.",ENTRYBOX_PLACEHOLDER:"Mondjon valamit...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ez a beszélgetés már nem aktív.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Elolvashatja az üzeneteket, de nem küldhet újat.",MESSAGELIST_LOADING_OLDER:"Korábbi üzenetek betöltése...",MESSAGELIST_SHOW_OLDER:"Korábbi üzenetek megjelenítése",MESSAGELIST_NEW_MARKER:"Új",MESSAGE_SENT_VIA_EMAIL:"Ez az üzenet e-mailben került elküldésre",YOU_MARKER:"Ön",UPLOAD_IN_PROGRESS:"Feltöltés...",UPLOAD_SEND_FILE:"Fájl küldése",UPLOAD_SHARE_LOCATION:"Helyszín megosztása",UPLOAD_ERROR:"Sajnos hiba történt a feltöltés során. A fájl nem támogatott vagy túl nagy.",SHARE_LOCATION_ERROR:"Helyszín megosztása nem lehetséges: ",LOADING:"Betöltés...",HUB_EMPTY:"A beszélgetések előzményei itt láthatók",HUB_SHOW_EARLIER:"Korábbi beszélgetések megjelenítése",INBOX_NO_CHATS_TITLE:"Még nincs megjeleníthető beszélgetés!",INBOX_NO_CHATS_BODY:"Amint egy vagy több beszélgetéssel rendelkezik, azok itt fognak megjelenni.",ENABLE_TRANSLATION:"A beszélgetés lefordítása erre a nyelvre: magyar",DISABLE_TRANSLATION:"Eredeti megjelenítése",SEARCH_PLACEHOLDER_TEXT:"Keresés...",SEARCH_SEARCHING:"Keresés...",SEARCH_NO_RESULTS:"Nincs találat",SEARCH_NO_MORE_RESULTS:"Nincs több találat",CHAT_NOT_FOUND:"A csevegés nem található",DELETE_MESSAGE:"Üzenet törlése",DELETION_EXPLANATION:"Ha törlöd ezt az üzenetet, az mindenki számára eltűnik.",EDIT_MESSAGE:"Üzenet szerkesztése",SAVE:"Mentés",EDITED_INDICATOR:"szerkesztve",REPLY_TO_MESSAGE:"Válaszadás",ADD_REACTION:"Reagálás erre",AUTH_EXPIRED_OVERLAY_TITLE:"Chat munkamenete lejárt",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Folytatáshoz frissítse az oldalt",VOICE_MESSAGE:"Hangüzenet",CONTACT_INFORMATION_HIDDEN:"Rejtett információ",LEAVE_CONVERSATION:"Kilépés a beszélgetésből",MARK_CONVERSATION_AS_UNREAD:"Megjelölés olvasatlanként",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},OS={code:"id-ID",name:"Bahasa Indonesia",translation:{YESTERDAY:"Kemarin",TODAY:"Hari ini",DAYS:"h",HOURS:"j",MINUTES:"m",JUST_NOW:"sekarang",LOCATION:"Lokasi",CANCEL:"Batal",INBOX:"Kotak Masuk",DESKTOP_NOTIFICATIONS:"Notifikasi peramban",DESKTOP_NOTIFICATIONS_ERROR:"Tidak dapat mengaktifkan pemberitahuan browser karena browser Anda secara aktif memblokir mereka. Coba cari di pengaturan atau menggunakan browser yang berbeda.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`pemberitahuan demo ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jika Anda membiarkan tab browser tetap terbuka, Anda akan melihat ini muncul ketika seseorang berbicara kepada Anda.",SEND_BUTTON_TEXT:"Kirim",ENTRYBOX_TEXT_LIMIT:"Hanya 10.000 karakter yang diizinkan.",ENTRYBOX_PLACEHOLDER:"Katakan sesuatu...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Percakapan ini tidak lagi aktif.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Anda dapat membaca, tetapi tidak mengirim pesan.",MESSAGELIST_LOADING_OLDER:"Memuat pesan lama...",MESSAGELIST_SHOW_OLDER:"Tampilkan pesan yang lebih lama",MESSAGELIST_NEW_MARKER:"Baru",MESSAGE_SENT_VIA_EMAIL:"Pesan ini dikirim melalui email",YOU_MARKER:"Anda",UPLOAD_IN_PROGRESS:"Mengunggah...",UPLOAD_SEND_FILE:"Kirim mengajukan",UPLOAD_SHARE_LOCATION:"Bagikan lokasi",UPLOAD_ERROR:"Ada yang salah diunggah. File mungkin tidak didukung atau terlalu besar.",SHARE_LOCATION_ERROR:"Tidak dapat membagikan lokasi: ",LOADING:"Memuat...",HUB_EMPTY:"Riwayat obrolan Anda akan muncul di sini",HUB_SHOW_EARLIER:"Tampilkan obrolan sebelumnya",INBOX_NO_CHATS_TITLE:"Belum ada obrolan!",INBOX_NO_CHATS_BODY:"Setelah Anda melakukan satu atau lebih percakapan, mereka akan muncul di sini.",ENABLE_TRANSLATION:"Terjemahkan percakapan ini ke Indonesia",DISABLE_TRANSLATION:"Perlihatkan asli",SEARCH_PLACEHOLDER_TEXT:"Cari...",SEARCH_SEARCHING:"Mencari...",SEARCH_NO_RESULTS:"Tidak ditemukan hasil",SEARCH_NO_MORE_RESULTS:"Tidak ada hasil lainnya",CHAT_NOT_FOUND:"Obrolan tidak ditemukan",DELETE_MESSAGE:"Hapus pesan",DELETION_EXPLANATION:"Jika pesan ini Anda hapus, pesan ini akan tidak terlihat bagi siapa pun.",EDIT_MESSAGE:"Sunting pesan",SAVE:"Mentés",EDITED_INDICATOR:"diedit",REPLY_TO_MESSAGE:"Balas",ADD_REACTION:"Tambah reaksi",AUTH_EXPIRED_OVERLAY_TITLE:"Sesi obrolan Anda sudah lewat batas waktu",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Muat ulang halaman untuk melanjutkan",VOICE_MESSAGE:"Pesan suara",CONTACT_INFORMATION_HIDDEN:"Informasi tersembunyi",LEAVE_CONVERSATION:"Tinggalkan percakapan",MARK_CONVERSATION_AS_UNREAD:"Tandai sebagai Belum dibaca",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},SS={code:"is-IS",name:"Íslenska",translation:{YESTERDAY:"Í gær",TODAY:"Í dag",DAYS:"dagar",HOURS:"klst.",MINUTES:"mín.",JUST_NOW:"núna",LOCATION:"Staðsetning",CANCEL:"Hætta við",INBOX:"Pósthólf",DESKTOP_NOTIFICATIONS:"Tilkynningar í vafra",DESKTOP_NOTIFICATIONS_ERROR:"Ekki er hægt að birta tilkynningar í vafra vegna þess að vafrinn sem þú notar hindrar það. Reyndu að leita að stillingum eða að nota annan vafra.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} prufutilkynning`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ef flipinn í vafranum er opinn muntu sjá þessa tilkynningu birtast þegar einhver sendir þér skilaboð.",SEND_BUTTON_TEXT:"Senda",ENTRYBOX_TEXT_LIMIT:"Aðeins 10.000 stafir komast fyrir.",ENTRYBOX_PLACEHOLDER:"Segðu eitthvað...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Þessar samræður eru ekki lengar virkar.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Þú getur lesið, en ekki sent skilaboð.",MESSAGELIST_LOADING_OLDER:"Sæki eldri skilaboð...",MESSAGELIST_SHOW_OLDER:"Sýna eldri skilaboð",MESSAGELIST_NEW_MARKER:"Ný",MESSAGE_SENT_VIA_EMAIL:"Þessi skilaboð voru send með tölvupósti",YOU_MARKER:"þú",UPLOAD_IN_PROGRESS:"Hleð upp...",UPLOAD_SEND_FILE:"Senda skrá",UPLOAD_SHARE_LOCATION:"Deila staðsetningu",UPLOAD_ERROR:"Því miður fór eitthvað úrskeiðis við að hlaða upp. Skráin gæti verið af rangri tegund eð of stór.",SHARE_LOCATION_ERROR:"Ekki er hægt að deila staðsetningu: ",LOADING:"Hleð...",HUB_EMPTY:"Fyrri samtöl munu birtast hér",HUB_SHOW_EARLIER:"Sýna fyrri samtöl",INBOX_NO_CHATS_TITLE:"Engin samtöl enn!",INBOX_NO_CHATS_BODY:"Þegar þú hefur átt eitt eða fleiri samtöl, munu þau birtast hér.",ENABLE_TRANSLATION:"Þýða þetta samtal á ensku",DISABLE_TRANSLATION:"Sýna upprunalegt",SEARCH_PLACEHOLDER_TEXT:"Leita...",SEARCH_SEARCHING:"Leita...",SEARCH_NO_RESULTS:"Ekkert fannst",SEARCH_NO_MORE_RESULTS:"Engar fleiri niðurstöður",CHAT_NOT_FOUND:"Samtal fannst ekki",DELETE_MESSAGE:"Eyða skilaboðum",DELETION_EXPLANATION:"Ef þú eyðir þessum skilaboðum munu þau hverfa hjá öllum.",EDIT_MESSAGE:"Breyta skilaboðum",SAVE:"Vista",EDITED_INDICATOR:"breytt",REPLY_TO_MESSAGE:"Svara",REPLY_TO_ARIA_LABEL:(n,t)=>`Svara ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Fara úr svari",ADD_REACTION:"Setja inn viðbrögð",AUTH_EXPIRED_OVERLAY_TITLE:"Spjallið hefur runnið út",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Endurnýjaðu síðuna til að halda áfram",VOICE_MESSAGE:"Raddskilaboð",LEAVE_CONVERSATION:"Skilja eftir skilaboð",MARK_CONVERSATION_AS_UNREAD:"Merkja sem ólesið",STATUS_INDICATOR_ONLINE:"Virk",STATUS_INDICATOR_OFFLINE:"Ekki við",CONTACT_INFORMATION_HIDDEN:"faldar upplýsingar"}},NS={code:"it-IT",name:"Italian",translation:{YESTERDAY:"Ieri",TODAY:"Oggi",DAYS:"g",HOURS:"o",MINUTES:"m",JUST_NOW:"adesso",LOCATION:"Posizione",CANCEL:"Annulla",INBOX:"Posta in arrivo",DESKTOP_NOTIFICATIONS:"Notifiche browser",DESKTOP_NOTIFICATIONS_ERROR:"Impossibile abilitare le notifiche browser perché il browser le blocca attivamente. Prova a cercare le impostazioni o utilizzare un browser diverso.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notification`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Se si mantiene aperta la scheda del browser, questo verrà visualizzato quando qualcuno ti parla.",SEND_BUTTON_TEXT:"Invia",ENTRYBOX_TEXT_LIMIT:"Sono consentiti solo 10.000 caratteri.",ENTRYBOX_PLACEHOLDER:"Dì qualcosa...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Questa conversazione non è più attiva.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puoi leggere, ma non inviare messaggi.",MESSAGELIST_LOADING_OLDER:"Caricamento dei messaggi precedenti...",MESSAGELIST_SHOW_OLDER:"Mostra messaggi precedenti",MESSAGELIST_NEW_MARKER:"Nuovo",MESSAGE_SENT_VIA_EMAIL:"Questo messaggio è stato inviato via email",YOU_MARKER:"tu",UPLOAD_IN_PROGRESS:"Caricamento in corso...",UPLOAD_SEND_FILE:"Invia file",UPLOAD_SHARE_LOCATION:"Condividi posizione",UPLOAD_ERROR:"Qualcosa è andato storto durante il caricamento. Il file potrebbe non essere supportato o troppo grande.",SHARE_LOCATION_ERROR:"Impossibile condividere la posizione: ",LOADING:"Caricamento in corso...",HUB_EMPTY:"La cronologia della tua chat verrà mostrata qui",HUB_SHOW_EARLIER:"Mostra chat precedenti",INBOX_NO_CHATS_TITLE:"Non ci sono ancora chat!",INBOX_NO_CHATS_BODY:"Una volta che hai avuto una o più conversazioni, verranno visualizzate qui.",ENABLE_TRANSLATION:"Traduci questa conversazione in italiano",DISABLE_TRANSLATION:"Mostra l'originale",SEARCH_PLACEHOLDER_TEXT:"Cerca...",SEARCH_SEARCHING:"Cercando...",SEARCH_NO_RESULTS:"Nessun risultato trovato",SEARCH_NO_MORE_RESULTS:"Non ci sono più risultati",CHAT_NOT_FOUND:"Chat non trovata",DELETE_MESSAGE:"Elimina messaggio",DELETION_EXPLANATION:"Se elimini il messaggio, questo scomparirà per tutti.",EDIT_MESSAGE:"Modifica messaggio",SAVE:"Salva",EDITED_INDICATOR:"modificato",REPLY_TO_MESSAGE:"Rispondi",ADD_REACTION:"Aggiungi reazione",AUTH_EXPIRED_OVERLAY_TITLE:"La sessione di chat è scaduta",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Aggiorna la pagina per continuare",VOICE_MESSAGE:"Messaggio vocale",CONTACT_INFORMATION_HIDDEN:"Informazioni nascoste",LEAVE_CONVERSATION:"Abbandona la conversazione",MARK_CONVERSATION_AS_UNREAD:"Segna come non letto",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},CS={code:"ja-JP",name:"Japanese",translation:{YESTERDAY:"昨日",TODAY:"今日",DAYS:"日前",HOURS:"時間前",MINUTES:"分前",JUST_NOW:"たった今",LOCATION:"場所",CANCEL:"キャンセル",INBOX:"受信箱",DESKTOP_NOTIFICATIONS:"ブラウザの通知",DESKTOP_NOTIFICATIONS_ERROR:"ブラウザの通知はブロックされているため、ブラウザの通知を有効にできません。設定を確認するか、別のブラウザを使用してください。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} デモ通知`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"ブラウザのタブを開いたままにしておくと、誰かがあなたに話しかけたときにこのポップアップが表示されます。",SEND_BUTTON_TEXT:"送信",ENTRYBOX_TEXT_LIMIT:"許可されているのは10.000文字までです。",ENTRYBOX_PLACEHOLDER:"メッセージを入力してください",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"この会話はもうアクティブではありません。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"あなたは読むことはできますが、メッセージを送ることはできません。",MESSAGELIST_LOADING_OLDER:"古いメッセージを読み込んでいます...",MESSAGELIST_SHOW_OLDER:"古いメッセージを表示",MESSAGELIST_NEW_MARKER:"新着",MESSAGE_SENT_VIA_EMAIL:"このメッセージはメールで送信されました",YOU_MARKER:"あなたは",UPLOAD_IN_PROGRESS:"アップロード中...",UPLOAD_SEND_FILE:"ファイル送信",UPLOAD_SHARE_LOCATION:"共有場所",UPLOAD_ERROR:"アップロード中に問題が発生しました。ファイルがサポートされていないか、大きすぎる可能性があります。",SHARE_LOCATION_ERROR:"場所を共有できません: ",LOADING:"読み込み中...",HUB_EMPTY:"あなたのチャット履歴がここに表示されます",HUB_SHOW_EARLIER:"以前のチャットを表示",INBOX_NO_CHATS_TITLE:"まだチャットがありません!",INBOX_NO_CHATS_BODY:"会話が1つ以上あると、ここに表示されます",ENABLE_TRANSLATION:"この会話を日本語に翻訳する",DISABLE_TRANSLATION:"オリジナルを表示",SEARCH_PLACEHOLDER_TEXT:"検索...",SEARCH_SEARCHING:"検索中...",SEARCH_NO_RESULTS:"結果が見つかりません",SEARCH_NO_MORE_RESULTS:"これ以上結果はありません",CHAT_NOT_FOUND:"チャットが見つかりませんでした",DELETE_MESSAGE:"メッセージを削除する",DELETION_EXPLANATION:"このメッセージを削除すると、全ての人に表示されなくなります。",EDIT_MESSAGE:"メッセージを編集する",SAVE:"上書き保存",EDITED_INDICATOR:"編集",REPLY_TO_MESSAGE:"返信する",ADD_REACTION:"リアクションを追加",AUTH_EXPIRED_OVERLAY_TITLE:"チャットセッションの有効期限が切れました",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"続けるにはページを更新してください",VOICE_MESSAGE:"ボイスメッセージ",CONTACT_INFORMATION_HIDDEN:"機密情報",LEAVE_CONVERSATION:"会話をやめる",MARK_CONVERSATION_AS_UNREAD:"未読としてマーク",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},bS={code:"ka-GE",name:"Georgian",translation:{YESTERDAY:"გუშინ",TODAY:"დღეს",DAYS:"დღ",HOURS:"სთ",MINUTES:"წთ",JUST_NOW:"ახლა",LOCATION:"ადგილმდებარეობა",CANCEL:"გაუქმება",INBOX:"მიღებული შეტყობინება",DESKTOP_NOTIFICATIONS:"ბრაუზერის შეტყობინებები",DESKTOP_NOTIFICATIONS_ERROR:"შეუძლებელია ბრაუზერის შეტკობინებების ჩართვა. ეს ბრაუზერი ბლოკავს მათ. სცადე ცვლილება ოპციებიდან ან გამოიყენე სხვა ბრაუზერი.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} შეტყობინებების დემო ვერსია`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"თუ დატოვებ ბრაუზერის ფანჯარას გახსნილს, როცა ვიღაც მოგწერს საუბარი ამოვარდება დესკტოპზე.",SEND_BUTTON_TEXT:"გაგზავნა",ENTRYBOX_TEXT_LIMIT:"დაშვებულია მხოლოდ 10.000 სიმბოლო.",ENTRYBOX_PLACEHOLDER:"დაწერე რაღაც...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"ეს დიალოგი აღარ არის ხელმისაწვდომი.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"შეგიძლია წაიკითხო, მაგრამ ვერ გააგზავნი შეტყობინებას.",MESSAGELIST_LOADING_OLDER:"იტვირთება ძველი შეტყობინებები...",MESSAGELIST_SHOW_OLDER:"ძველი შეტყობინებების ჩვენება",MESSAGELIST_NEW_MARKER:"ახალი",MESSAGE_SENT_VIA_EMAIL:"ეს შეტყობინება გამოგზავნილია იმეილით",YOU_MARKER:"you",UPLOAD_IN_PROGRESS:"იტვირთება...",UPLOAD_SEND_FILE:"ფაილის გაგზავნა",UPLOAD_SHARE_LOCATION:"ადგილმდებარეობის გაზიარება",UPLOAD_ERROR:"პრობლემაა ატვირთვისას. ფაილის შესაძლოა არის არათავსებადი ან ძალიან დიდი.",SHARE_LOCATION_ERROR:"შეუძლებელია ადგილმდებარეობის გაზიარება: ",LOADING:"იტვირთება...",HUB_EMPTY:"საუბრების ისტორია გამოჩნდება აქ",HUB_SHOW_EARLIER:"წინა საუბრების ნახვა",INBOX_NO_CHATS_TITLE:"ჯერ-ჯერობით არ არის საუბრები!",INBOX_NO_CHATS_BODY:"უკვე დასრულებული საუბარები გამოჩნდება აქ",ENABLE_TRANSLATION:"თარგმნეთ ეს საუბარი ინგლისურად",DISABLE_TRANSLATION:"ორიგინალის ჩვენება",SEARCH_PLACEHOLDER_TEXT:"ძიება...",SEARCH_SEARCHING:"მიმდინარეობს ძიება...",SEARCH_NO_RESULTS:"შედეგები ვერ ქართველი",SEARCH_NO_MORE_RESULTS:"სხვა შედეგი ვერ მოიძებნა",CHAT_NOT_FOUND:"ჩატი ვერ მოიძებნა",DELETE_MESSAGE:"შეტყობინების წაშლა ",DELETION_EXPLANATION:"თუ ამ შეტყობინებას წაშლით, ის ყველასთვის გაქრება.",EDIT_MESSAGE:"შეტყობინების რედაქტირება",SAVE:"შენახვა",EDITED_INDICATOR:"რედაქტირებულია",REPLY_TO_MESSAGE:"პასუხის გაცემა",ADD_REACTION:"დაამატეთ რეაქცია",AUTH_EXPIRED_OVERLAY_TITLE:"თქვენი ჩეთის სესიის ვადა ამოიწურა",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"განაახლეთ გვერდი გასაგრძელებლად",VOICE_MESSAGE:"ხმოვანი შეტყობინება",CONTACT_INFORMATION_HIDDEN:"ფარული ინფორმაცია",LEAVE_CONVERSATION:"საუბრის დატოვება",MARK_CONVERSATION_AS_UNREAD:"წაუკითხავად მონიშვნა",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},IS={code:"ko-KR",name:"Korean (South Korea)",translation:{YESTERDAY:"어제",TODAY:"오늘",DAYS:"일 전",HOURS:"시간 전",MINUTES:"분 전",JUST_NOW:"방금",LOCATION:"위치",CANCEL:"취소",INBOX:"대화 목록",DESKTOP_NOTIFICATIONS:"브라우저 알림",DESKTOP_NOTIFICATIONS_ERROR:"브라우저 알림을 표시할 수 없습니다. 브라우저 설정을 확인하거나 다른 브라우저를 사용해주세요.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 데모 알림`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"브라우저 탭을 열어 둔 상태에서 누군가 대화 할 때 이 팝업이 표시됩니다.",SEND_BUTTON_TEXT:"전송",ENTRYBOX_TEXT_LIMIT:"최대 10,000자까지 입력할 수 있습니다.",ENTRYBOX_PLACEHOLDER:"메세지를 입력하세요...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"채팅이 종료되었습니다.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"읽기만 가능하며 메시지를 보낼 수 없습니다.",MESSAGELIST_LOADING_OLDER:"이전 메시지 로드 중...",MESSAGELIST_SHOW_OLDER:"이전 메시지 표시",MESSAGELIST_NEW_MARKER:"새 메시지",MESSAGE_SENT_VIA_EMAIL:"이 메시지는 이메일을 통해 전송되었습니다.",YOU_MARKER:"나",UPLOAD_IN_PROGRESS:"업로드 중...",UPLOAD_SEND_FILE:"파일 전송",UPLOAD_SHARE_LOCATION:"위치 공유",UPLOAD_ERROR:"업로드가 실패했습니다. 파일이 지원되지 않거나 너무 클 수 있습니다.",SHARE_LOCATION_ERROR:"위치를 공유 할 수 없습니다: ",LOADING:"로드 중...",HUB_EMPTY:"채팅 기록이 여기에 표시됩니다",HUB_SHOW_EARLIER:"이전 채팅보기",INBOX_NO_CHATS_TITLE:"아직 채팅이 없습니다!",INBOX_NO_CHATS_BODY:"대화가 하나 이상 있으면 여기에 표시됩니다.",ENABLE_TRANSLATION:"이 대화를 한국어로 번역",DISABLE_TRANSLATION:"원본 표시",SEARCH_PLACEHOLDER_TEXT:"검색...",SEARCH_SEARCHING:"검색 중...",SEARCH_NO_RESULTS:"검색 결과 없음",SEARCH_NO_MORE_RESULTS:"추가 검색 결과 없음",CHAT_NOT_FOUND:"대화를 찾지 못했습니다",DELETE_MESSAGE:"메시지 삭제",DELETION_EXPLANATION:"이 메시지를 삭제하면 모든 사람이 볼 수 없게 됩니다.",EDIT_MESSAGE:"메시지 편집하기",SAVE:"저장",EDITED_INDICATOR:"편집",REPLY_TO_MESSAGE:"회신",ADD_REACTION:"반응 추가",AUTH_EXPIRED_OVERLAY_TITLE:"채팅 세션이 만료되었습니다",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"계속하려면 페이지를 새로고침하세요",VOICE_MESSAGE:"음성 메시지",CONTACT_INFORMATION_HIDDEN:"숨겨진 정보",LEAVE_CONVERSATION:"대화 떠나기",MARK_CONVERSATION_AS_UNREAD:"읽지 않은 상태로 표시",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},wS={code:"nb-NO",name:"Norwegian (Bokmål)",translation:{YESTERDAY:"I går",TODAY:"I dag",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"Nå",LOCATION:"Plassering",CANCEL:"Avbryt",INBOX:"Innboks",DESKTOP_NOTIFICATIONS:"Nettleservarsler",DESKTOP_NOTIFICATIONS_ERROR:"Kan ikke aktivere Nettleservarsler fordi nettleseren din aktivt blokkerer dem. Prøv å se i innstillingene eller bruke en annen nettleser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo varslinger`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Hvis du holder nettleservinduet åpent, vil du se dette varsel når noen snakker til deg.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Kun 10.000 tegn er tillatt.",ENTRYBOX_PLACEHOLDER:"Si noe...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Denne samtale er ikke lengre aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan lese, men ikke sende meldinger.",MESSAGELIST_LOADING_OLDER:"Laster eldre meldinger...",MESSAGELIST_SHOW_OLDER:"Vis eldre meldinger",MESSAGELIST_NEW_MARKER:"Ny",MESSAGE_SENT_VIA_EMAIL:"Denne meldingen er sendt via e-post",YOU_MARKER:"deg",UPLOAD_IN_PROGRESS:"Laster opp...",UPLOAD_SEND_FILE:"Send fil",UPLOAD_SHARE_LOCATION:"Del din plassering",UPLOAD_ERROR:"Noe gikk galt i uplastingen. Det kan være filen ikke støttes eller for stor.",SHARE_LOCATION_ERROR:"Kan ikke dele plasseringen: ",LOADING:"Laster...",HUB_EMPTY:"Din chats historikk vil vises her",HUB_SHOW_EARLIER:"Vis tidligere chats",INBOX_NO_CHATS_TITLE:"Ingen chats enda!",INBOX_NO_CHATS_BODY:"Så snart du får en eller flere samtaler, vil de vises her.",ENABLE_TRANSLATION:"Oversett denne samtalen til norsk",DISABLE_TRANSLATION:"Vis original",SEARCH_PLACEHOLDER_TEXT:"Søk...",SEARCH_SEARCHING:"Søker...",SEARCH_NO_RESULTS:"Finner ingen resultater",SEARCH_NO_MORE_RESULTS:"Ingen flere resultater",CHAT_NOT_FOUND:"Chat ikke funnet",DELETE_MESSAGE:"Slett melding",DELETION_EXPLANATION:"Hvis du sletter denne meldingen, forsvinner den for alle.",EDIT_MESSAGE:"Rediger melding",SAVE:"Lagre",EDITED_INDICATOR:"redigert",REPLY_TO_MESSAGE:"Svar",ADD_REACTION:"Legg til reaksjon",AUTH_EXPIRED_OVERLAY_TITLE:"Chatøkten er utløpt",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Oppdater siden for å fortsette",VOICE_MESSAGE:"Lydmelding",CONTACT_INFORMATION_HIDDEN:"Skjult informasjon",LEAVE_CONVERSATION:"Forlat samtalen",MARK_CONVERSATION_AS_UNREAD:"Merk som ulest",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},RS={code:"nl-NL",name:"Dutch",translation:{YESTERDAY:"Gisteren",TODAY:"Vandaag",DAYS:"d",HOURS:"u",MINUTES:"m",JUST_NOW:"zojuist",LOCATION:"Locatie",CANCEL:"Annuleren",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browsermeldingen",DESKTOP_NOTIFICATIONS_ERROR:"Browsermeldingen kunnen niet geactiveerd worden omdat de browser het blokkeert. Check de instellingen van je browser of probeer een andere browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notificatie`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Als je je browser open houdt, zie je deze popup als iemand tegen je praat.",SEND_BUTTON_TEXT:"Verzenden",ENTRYBOX_TEXT_LIMIT:"Maximaal 10.000 tekens toegestaan.",ENTRYBOX_PLACEHOLDER:"Typ een bericht...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Dit gesprek is niet actief meer.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Je kunt geen berichten sturen.",MESSAGELIST_LOADING_OLDER:"Eerdere berichten laden...",MESSAGELIST_SHOW_OLDER:"Laad eerdere berichten",MESSAGELIST_NEW_MARKER:"Nieuw",MESSAGE_SENT_VIA_EMAIL:"Dit bericht is verstuurd via e-mail",YOU_MARKER:"jij",UPLOAD_IN_PROGRESS:"Uploaden...",UPLOAD_SEND_FILE:"Verzend bestand",UPLOAD_SHARE_LOCATION:"Deel locatie",UPLOAD_ERROR:"Er ging iets mis. Het bestand wordt niet ondersteund of is te groot.",SHARE_LOCATION_ERROR:"Locatie delen mislukt: ",LOADING:"Bezig met laden...",HUB_EMPTY:"Berichtengeschiedenis wordt hier weergegeven",HUB_SHOW_EARLIER:"Laat eerdere berichten zien",INBOX_NO_CHATS_TITLE:"Nog geen chats!",INBOX_NO_CHATS_BODY:"Zodra je een of meerdere conversaties hebt gehad, worden deze hier weergegeven.",ENABLE_TRANSLATION:"Vertaal dit gesprek naar het Nederlands",DISABLE_TRANSLATION:"Toon oorspronkelijk gesprek",SEARCH_PLACEHOLDER_TEXT:"Zoek...",SEARCH_SEARCHING:"Zoeken...",SEARCH_NO_RESULTS:"Geen resultaten gevonden",SEARCH_NO_MORE_RESULTS:"Niet meer resultaten",CHAT_NOT_FOUND:"Chat niet gevonden",DELETE_MESSAGE:"Bericht verwijderen",DELETION_EXPLANATION:"Als je dit bericht verwijdert, zal het voor iedereen verdwijnen.",EDIT_MESSAGE:"Bericht bewerken",SAVE:"Opslaan",EDITED_INDICATOR:"bewerkt",REPLY_TO_MESSAGE:"Beantwoorden",ADD_REACTION:"Reactie toevoegen",AUTH_EXPIRED_OVERLAY_TITLE:"Je chatsessie is verlopen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Ververs de pagina om door te gaan",VOICE_MESSAGE:"Spraakbericht",CONTACT_INFORMATION_HIDDEN:"verborgen informatie",LEAVE_CONVERSATION:"Gesprek verlaten",MARK_CONVERSATION_AS_UNREAD:"Markeren als ongelezen",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},DS={code:"pl-PL",name:"Polish",translation:{YESTERDAY:"Wczoraj",TODAY:"Dzisiaj",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"teraz",LOCATION:"Lokalizacja",CANCEL:"Anuluj",INBOX:"Skrzynka odbiorcza",DESKTOP_NOTIFICATIONS:"Powiadomienia",DESKTOP_NOTIFICATIONS_ERROR:"Nie można aktywować powiadomień, ponieważ twoja przeglądarka je blokuje. Proszę zmienić ustawienie lub spróbować innej przeglądarki.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} przykładowe powiadomienie`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jeśli zostawisz tę kartę otwartą, zobaczysz takie powiadomienie, gdy ktoś napisze do Ciebie.",SEND_BUTTON_TEXT:"Wyślij",ENTRYBOX_TEXT_LIMIT:"Nie można wysyłać więcej niż 10000 znaków.",ENTRYBOX_PLACEHOLDER:"Napisz coś...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ten czat nie jest aktywny.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Możesz czytać wiadomości, ale nie możesz ich wysyłać.",MESSAGELIST_LOADING_OLDER:"Wczytuję starsze wiadomości...",MESSAGELIST_SHOW_OLDER:"Zobacz starsze wiadomości",MESSAGELIST_NEW_MARKER:"Nowe",MESSAGE_SENT_VIA_EMAIL:"Ta wiadomość została wysłana przez email.",YOU_MARKER:"ty",UPLOAD_IN_PROGRESS:"Przesyłanie...",UPLOAD_SEND_FILE:"Prześlij plik",UPLOAD_SHARE_LOCATION:"Udostępnij lokalizację",UPLOAD_ERROR:"Coś poszło nie tak. Plik może być zbyt duży lub jest nieobsługiwany.",SHARE_LOCATION_ERROR:"Nie da się udostępnić lokalizacji: ",LOADING:"Ładowanie...",HUB_EMPTY:"Twoje czaty pojawią się tutaj",HUB_SHOW_EARLIER:"Zobacz starsze czaty",INBOX_NO_CHATS_TITLE:"Brak czatów!",INBOX_NO_CHATS_BODY:"Rozpoczęte konwersacje pojawią się tutaj.",ENABLE_TRANSLATION:"Przetłumacz tę konwersację na język polski",DISABLE_TRANSLATION:"Pokaż oryginał",SEARCH_PLACEHOLDER_TEXT:"Wyszukaj...",SEARCH_SEARCHING:"Wyszukiwanie...",SEARCH_NO_RESULTS:"Nie znaleziono wyników",SEARCH_NO_MORE_RESULTS:"Nie ma innych wyników",CHAT_NOT_FOUND:"Nie znaleziono konwersacji",DELETE_MESSAGE:"Usuń wiadomość",DELETION_EXPLANATION:"Jeśli usuniesz tę wiadomość, przestanie być widoczna dla wszystkich.",EDIT_MESSAGE:"Edytuj wiadomość",SAVE:"Zapisz",EDITED_INDICATOR:"edytowano",REPLY_TO_MESSAGE:"Odpowiedz",ADD_REACTION:"Dodaj reakcję",AUTH_EXPIRED_OVERLAY_TITLE:"Twoja sesja wygasła",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Odśwież stronę, aby kontynuować",VOICE_MESSAGE:"Wiadomość głosowa",CONTACT_INFORMATION_HIDDEN:"Ukryte informacje",LEAVE_CONVERSATION:"Opuść konwersację",MARK_CONVERSATION_AS_UNREAD:"Oznacz jako nieprzeczytane",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},kS={code:"pt-BR",name:"Portuguese (Brazil)",translation:{YESTERDAY:"Ontem",TODAY:"Hoje",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"agora mesmo",LOCATION:"Localização",CANCEL:"Cancelar",INBOX:"Caixa de entrada",DESKTOP_NOTIFICATIONS:"Notificações do navegador",DESKTOP_NOTIFICATIONS_ERROR:"Não é possível ativar as notificações da navegador porque seu navegador as bloqueia. Tente procurar nas configurações ou usar um navegador diferente.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} notificação de demonstração`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Se você mantiver a guia do navegador aberta, verá essa mensagem quando alguém falar com você.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Apenas 10.000 caracteres são permitidos.",ENTRYBOX_PLACEHOLDER:"Diga algo...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Esta conversa não está mais ativa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Você pode ler, mas não enviar mensagens.",MESSAGELIST_LOADING_OLDER:"Carregando mensagens antigas...",MESSAGELIST_SHOW_OLDER:"Mostrar mensagens mais antigas",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Esta mensagem foi enviada via email.",YOU_MARKER:"Você",UPLOAD_IN_PROGRESS:"Carregando...",UPLOAD_SEND_FILE:"Enviar arquivo",UPLOAD_SHARE_LOCATION:"Compartilhar localização",UPLOAD_ERROR:"Algo deu errado ao fazer o upload. O arquivo pode não ter suporte ou ser muito grande.",SHARE_LOCATION_ERROR:"Não é possível compartilhar o local: ",LOADING:"Carregando...",HUB_EMPTY:"Seu histórico de conversas será exibido aqui",HUB_SHOW_EARLIER:"Mostrar conversas anteriores",INBOX_NO_CHATS_TITLE:"Ainda não há chats!",INBOX_NO_CHATS_BODY:"Depois de ter uma ou mais conversas, elas serão exibidas aqui.",ENABLE_TRANSLATION:"Traduzir esta conversa para português",DISABLE_TRANSLATION:"Ver a conversa não traduzida",SEARCH_PLACEHOLDER_TEXT:"Busca...",SEARCH_SEARCHING:"Consultando...",SEARCH_NO_RESULTS:"Resultados nao encontrados",SEARCH_NO_MORE_RESULTS:"Não há mais resultados",CHAT_NOT_FOUND:"Conversa não encontrada",DELETE_MESSAGE:"Excluir mensagem",DELETION_EXPLANATION:"Se você excluir esta mensagem, ela desaparecerá para todos.",EDIT_MESSAGE:"Editar mensagem",SAVE:"Salvar",EDITED_INDICATOR:"editada",REPLY_TO_MESSAGE:"Responder",ADD_REACTION:"Adicionar reação",AUTH_EXPIRED_OVERLAY_TITLE:"Sua sessão de chat expirou",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Atualize a página para continuar",VOICE_MESSAGE:"Mensagem de voz",LEAVE_CONVERSATION:"Sair da conversa",MARK_CONVERSATION_AS_UNREAD:"Marcar como não lida",CONTACT_INFORMATION_HIDDEN:"Informação oculta",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},LS={code:"ro-RO",name:"Romanian (Romania)",translation:{YESTERDAY:"Ieri",TODAY:"Astăzi",DAYS:"z",HOURS:"o",MINUTES:"m",JUST_NOW:"chiar acum",LOCATION:"Locație",CANCEL:"Anulare",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Notificări browser",DESKTOP_NOTIFICATIONS_ERROR:"Nu se pot activa notificări browser deoarece browserul dvs. le blochează în mod activ. Încercați să căutați în setări sau utilizând un alt browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notificare de debit ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Dacă țineți fișa browserului deschis, veți vedea acest pop-up atunci când cineva vorbește cu dvs.",SEND_BUTTON_TEXT:"Trimiteți",ENTRYBOX_TEXT_LIMIT:"Sunt permise numai 10.000 de caractere.",ENTRYBOX_PLACEHOLDER:"Spune ceva...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Această conversație nu mai este activă.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puteți citi, dar nu puteți trimite mesaje.",MESSAGELIST_LOADING_OLDER:"Încărcarea mesajelor mai vechi...",MESSAGELIST_SHOW_OLDER:"Afișați mesaje mai vechi",MESSAGELIST_NEW_MARKER:"Nou",MESSAGE_SENT_VIA_EMAIL:"Acest mesaj a fost trimis prin e-mail",YOU_MARKER:"voi",UPLOAD_IN_PROGRESS:"Încărcarea...",UPLOAD_SEND_FILE:"Trimiteți fișierul",UPLOAD_SHARE_LOCATION:"Distribuiți locația",UPLOAD_ERROR:"Sa încărcat ceva în mod greșit. Fișierul ar putea fi neacceptat sau prea mare.",SHARE_LOCATION_ERROR:"Nu se poate partaja locația: ",LOADING:"Încărcare...",HUB_EMPTY:"Istoricul chat-ului dvs. va apărea aici",HUB_SHOW_EARLIER:"Afișați discuțiile anterioare",INBOX_NO_CHATS_TITLE:"Încă nu vorbești!",INBOX_NO_CHATS_BODY:"După ce ați avut una sau mai multe conversații, acestea vor apărea aici.",ENABLE_TRANSLATION:"Traduceți această conversație în română",DISABLE_TRANSLATION:"Arată originalul",SEARCH_PLACEHOLDER_TEXT:"Căutare...",SEARCH_SEARCHING:"Se caută...",SEARCH_NO_RESULTS:"Nu s-au găsit rezultate",SEARCH_NO_MORE_RESULTS:"Nu mai există rezultate",CHAT_NOT_FOUND:"Conversația nu a fost găsită",DELETE_MESSAGE:"Șterge mesajul",DELETION_EXPLANATION:"Dacă ștergi acest mesaj, acesta va dispărea pentru toată lumea.",EDIT_MESSAGE:"Redactează mesajul",SAVE:"Salvare",EDITED_INDICATOR:"editat",REPLY_TO_MESSAGE:"Răspundeți",ADD_REACTION:"Adaugă o reacție",AUTH_EXPIRED_OVERLAY_TITLE:"Sesiunea dumneavoastră de chat a expirat",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Reîmprospătați pagina pentru a continua",VOICE_MESSAGE:"Mesaj vocal",CONTACT_INFORMATION_HIDDEN:"Informații ascunse",LEAVE_CONVERSATION:"Părăsește conversația",MARK_CONVERSATION_AS_UNREAD:"Marcheaza ca necitit",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},xS={code:"ru-RU",name:"Russian",translation:{YESTERDAY:"Вчера",TODAY:"Сегодня",DAYS:"д",HOURS:"ч",MINUTES:"м",JUST_NOW:"только что",LOCATION:"Местоположение",CANCEL:"Отмена",INBOX:"Входящие",DESKTOP_NOTIFICATIONS:"Оповещения",DESKTOP_NOTIFICATIONS_ERROR:"Невозможно включить оповещения, потому что ваш браузер активно блокирует их. Проверьте ваши настройки или попробуйте другой браузер.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} демо-оповещение`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Если вкладка вашего браузера открыта, вы увидите всплывающее окошко оповещения когда кто-то отправит вам сообщение.",SEND_BUTTON_TEXT:"Отправить",ENTRYBOX_TEXT_LIMIT:"Разрешено использовать только 10 тысяч символов.",ENTRYBOX_PLACEHOLDER:"Напишите что-нибудь...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Этот разговор больше неактивен.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Вы можете читать, но не отправлять сообщения.",MESSAGELIST_LOADING_OLDER:"Загрузка старых сообщения...",MESSAGELIST_SHOW_OLDER:"Показать старые сообщения",MESSAGELIST_NEW_MARKER:"Новые",MESSAGE_SENT_VIA_EMAIL:"Это сообщение было отправлено по электронной почте",YOU_MARKER:"вы",UPLOAD_IN_PROGRESS:"Загрузка...",UPLOAD_SEND_FILE:"Отправить файл",UPLOAD_SHARE_LOCATION:"Поделиться местоположением",UPLOAD_ERROR:"Что-то пошло не так: такой файл не поддерживается или он слишком большой.",SHARE_LOCATION_ERROR:"Не удается поделиться местоположением: ",LOADING:"Загрузка...",HUB_EMPTY:"Здесь появится ваша история чата",HUB_SHOW_EARLIER:"Показать предыдущие чаты",INBOX_NO_CHATS_TITLE:"Пока нет чатов!",INBOX_NO_CHATS_BODY:"Как только у вас будет один или несколько разговоров, они появятся здесь.",ENABLE_TRANSLATION:"Переведите этот разговор на русский",DISABLE_TRANSLATION:"Show source",SEARCH_PLACEHOLDER_TEXT:"поиск...",SEARCH_SEARCHING:"Поиск...",SEARCH_NO_RESULTS:"Результаты не найдены",SEARCH_NO_MORE_RESULTS:"Больше результатов нет",CHAT_NOT_FOUND:"Чат не найден",DELETE_MESSAGE:"Удалить сообщение",DELETION_EXPLANATION:"Если вы удалите это сообщение, оно исчезнет для всех.",EDIT_MESSAGE:"Изменить сообщение",SAVE:"сохранить",EDITED_INDICATOR:"изменено",REPLY_TO_MESSAGE:"Ответить",ADD_REACTION:"Добавить реакцию",AUTH_EXPIRED_OVERLAY_TITLE:"Срок действия вашего сеанса чата истек",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Обновите страницу, чтобы продолжить",VOICE_MESSAGE:"Голосовое сообщение",CONTACT_INFORMATION_HIDDEN:"Информация скрыта",LEAVE_CONVERSATION:"Выйти из беседы",MARK_CONVERSATION_AS_UNREAD:"Отметить как непрочитанное",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},MS={code:"sq-AL",name:"Albanian",translation:{YESTERDAY:"Dje",TODAY:"Sot",DAYS:"d",HOURS:"o",MINUTES:"m",JUST_NOW:"Tani",LOCATION:"Pozicion",CANCEL:"Anulo",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Njoftimet e shfletuesit",DESKTOP_NOTIFICATIONS_ERROR:"Nuk mund të aktivizohen njoftimet në shfletues sepse shfletuesi juaj i bllokon ato në mënyrë aktive. Provoni të shikoni cilësimet ose përdorni një shfletues të ndryshëm.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} njoftime në desktop`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Lënia e skedës së shfletuesit tuaj të hapur do të pop-up kur dikush flet me ju.",SEND_BUTTON_TEXT:"Dërgo",ENTRYBOX_TEXT_LIMIT:"Lejohen vetëm 10,000 karaktere",ENTRYBOX_PLACEHOLDER:"Thuaj diçka...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Kjo bisedë nuk është më aktive.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Mund të lexoni por jo të dërgoni mesazhe.",MESSAGELIST_LOADING_OLDER:"Duke ngarkuar mesazhe më të vjetra...",MESSAGELIST_SHOW_OLDER:"Trego mesazhe më të vjetra",MESSAGELIST_NEW_MARKER:"E ri",MESSAGE_SENT_VIA_EMAIL:"Ky mesazh u dërgua si email",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Ngarkim...",UPLOAD_SEND_FILE:"Dërgo datotekën",UPLOAD_SHARE_LOCATION:"Ndani lokacionin",UPLOAD_ERROR:"Na vjen keq, diçka nuk shkoi si duhet. Dosja mund të mos ket mbështetje ose mund të jetë shumë e madhe.",SHARE_LOCATION_ERROR:"Nuk mund të ndahet lokacioni: ",LOADING:"Ngarkim...",HUB_EMPTY:"Këtu do të paraqitet/ shfaqet historia e bisedës tuaj",HUB_SHOW_EARLIER:"Shfaqi bisedat e mëparshme",INBOX_NO_CHATS_TITLE:"Nuk ka biseda!",INBOX_NO_CHATS_BODY:"Pasi të keni një ose më shumë biseda, ato do të paraqiten/shfaqen këtu.",ENABLE_TRANSLATION:"Përkthejeni këtë bisedë në shqiptare",DISABLE_TRANSLATION:"Shikoni origjinalin",SEARCH_PLACEHOLDER_TEXT:"Kërko...",SEARCH_SEARCHING:"Kërko...",SEARCH_NO_RESULTS:"Nuk ka rezultate",SEARCH_NO_MORE_RESULTS:"Nuk ka më rezultate",CHAT_NOT_FOUND:"Biseda nuk u gjet",DELETE_MESSAGE:"Fshi mesazhin",DELETION_EXPLANATION:"Nëse e fshini këtë mesazh, ai do të zhduket për të gjithë.",EDIT_MESSAGE:"Redakto mesazhin",SAVE:"Ruaj",EDITED_INDICATOR:"redaktuar",REPLY_TO_MESSAGE:"Përgjigj",ADD_REACTION:"Shtoni reagimin",AUTH_EXPIRED_OVERLAY_TITLE:"Sesioni juaj i bisedës ka skaduar",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Rifresko faqen për të vazhduar",VOICE_MESSAGE:"Mesazh zanor",CONTACT_INFORMATION_HIDDEN:"informacione të fshehura",LEAVE_CONVERSATION:"Largohu nga bashkëbisedimi",MARK_CONVERSATION_AS_UNREAD:"Shëno si të palexuar",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},PS={code:"sr-SP",name:"Serbian",translation:{YESTERDAY:"Juče",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Browser Notifikacija",DESKTOP_NOTIFICATIONS_ERROR:"Browser notifikacije nisu omogućene jer ih vaš pregledač aktivno blokira. Pokušajte pogledati postavke ili koristiti neki drugi pregledač.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu pregledača ostavite otvorenu, pojaviće se ovaj pop-up kada neko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Kaži nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možete da čitate, ali ne i da šaljete poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana imejlom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovde će biti prikazana istorija razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovde.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na srpski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Ćaskanje nije pronađeno",DELETE_MESSAGE:"Izbriši poruku",DELETION_EXPLANATION:"Ako obrišete ovu poruku, ona neće biti vidljiva ni za koga.",EDIT_MESSAGE:"Ispravi poruku",SAVE:"Sačuvaj",EDITED_INDICATOR:"ispravljeno",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodaj reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša sesija ćaskanja je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvežite stranicu da biste nastavili",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Sakrivene informacije",LEAVE_CONVERSATION:"Napusti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitanu",REPLY_TO_ARIA_LABEL:(n,t)=>`Odgovarate korisniku ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Izađi iz moda pisanja odgovora",STATUS_INDICATOR_ONLINE:"Aktivan",STATUS_INDICATOR_OFFLINE:"Neaktivan"}},BS={code:"sv-SE",name:"Swedish (Sweden)",translation:{YESTERDAY:"Igår",TODAY:"Idag",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"just nu",LOCATION:"Plats",CANCEL:"Avbryt",INBOX:"Inkorg",DESKTOP_NOTIFICATIONS:"Webbläsarnotiser",DESKTOP_NOTIFICATIONS_ERROR:"Kan inte aktivera webbläsarnotiser eftersom din webbläsare aktivt blockerar dem. Se över inställningarna eller använd en annan webbläsare.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demonotis`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Om du har fliken i webbläsaren öppen så kommer den här notisen visas när någon pratar med dig.",SEND_BUTTON_TEXT:"Skicka",ENTRYBOX_TEXT_LIMIT:"Max 10 000 tecken är tillåtet.",ENTRYBOX_PLACEHOLDER:"Skriv ett meddelande...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Den här konversationen är inte längre aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan läsa men inte skicka meddelanden.",MESSAGELIST_LOADING_OLDER:"Läser in tidigare meddelanden...",MESSAGELIST_SHOW_OLDER:"Visa tidigare meddelanden",MESSAGELIST_NEW_MARKER:"Nytt",MESSAGE_SENT_VIA_EMAIL:"Detta meddelande skickades via e-post",YOU_MARKER:"du",UPLOAD_IN_PROGRESS:"Laddar upp...",UPLOAD_SEND_FILE:"Skicka fil",UPLOAD_SHARE_LOCATION:"Dela plats",UPLOAD_ERROR:"Något gick fel vid uppladdningen. Filen kan vara av en typ som inte stöds eller är för stor.",SHARE_LOCATION_ERROR:"Kan inte dela plats: ",LOADING:"Laddar...",HUB_EMPTY:"Din chatthistorik kommer att visas här",HUB_SHOW_EARLIER:"Visa tidigare chattar",INBOX_NO_CHATS_TITLE:"Inga chattar ännu!",INBOX_NO_CHATS_BODY:"När du har haft en eller flera konversationer kommer de att visas här.",ENABLE_TRANSLATION:"Översätt den här konversationen till svenska",DISABLE_TRANSLATION:"Visa original",SEARCH_PLACEHOLDER_TEXT:"Sök...",SEARCH_SEARCHING:"Söker...",SEARCH_NO_RESULTS:"Inga resultat hittades",SEARCH_NO_MORE_RESULTS:"Inga fler resultat",CHAT_NOT_FOUND:"Chatten hittades inte",DELETE_MESSAGE:"Radera meddelandet",DELETION_EXPLANATION:"Om du raderar det här meddelandet försvinner det för alla.",EDIT_MESSAGE:"Redigera meddelandet",SAVE:"Spara",EDITED_INDICATOR:"redigerad",REPLY_TO_MESSAGE:"Svara",ADD_REACTION:"Lägg till reaktion",AUTH_EXPIRED_OVERLAY_TITLE:"Din chatsession har gått ut",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Uppdatera sidan för att fortsätta",VOICE_MESSAGE:"Röstmeddelande",CONTACT_INFORMATION_HIDDEN:"Dold information",LEAVE_CONVERSATION:"Lämna konversationen",MARK_CONVERSATION_AS_UNREAD:"Markera som oläst",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},FS={code:"tr-TR",name:"Turkish",translation:{YESTERDAY:"Dün",TODAY:"Bugün",DAYS:"g",HOURS:"s",MINUTES:"d",JUST_NOW:"az önce",LOCATION:"Konum",CANCEL:"İptal",INBOX:"Gelen Kutusu",SEND_BUTTON_TEXT:"Gönder",ENTRYBOX_TEXT_LIMIT:"En fazla 10.000 karaktere izin veriliyor.",ENTRYBOX_PLACEHOLDER:"Bir şeyler söyle...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Bu konuşma artık aktif değil.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Mesajları okuyabilirsiniz ancak mesaj gönderemezsiniz.",MESSAGELIST_LOADING_OLDER:"Eski mesajlar yükleniyor...",MESSAGELIST_SHOW_OLDER:"Eski mesajları göster",MESSAGELIST_NEW_MARKER:"Yeni",DESKTOP_NOTIFICATIONS:"Tarayıcı bildirimleri",DESKTOP_NOTIFICATIONS_ERROR:"Tarayıcınız aktif olarak engellediğinden tarayıcı bildirimlerini etkinleştiremiyoruz. Ayarları kontrol etmeyi veya farklı bir tarayıcı kullanmayı deneyebilirsiniz.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} test bildirimi`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Eğer tarayıcınızın penceresini açık tutarsanız biri mesaj yazdığında bu bildirimi göreceksiniz.",MESSAGE_SENT_VIA_EMAIL:"Bu mesaj e-posta ile gönderilmiştir.",YOU_MARKER:"siz",UPLOAD_IN_PROGRESS:"Yükleniyor...",UPLOAD_SEND_FILE:"Dosya gönder",UPLOAD_SHARE_LOCATION:"Konum paylaş",UPLOAD_ERROR:"Yükleme sırasında bir şeyler yanlış gitti. Dosya desteklenmiyor veya izin verilenden büyük olabilir.",SHARE_LOCATION_ERROR:"Konum paylaşılamadı: ",LOADING:"Yükleniyor...",HUB_EMPTY:"Konuşma geçmişiniz burada görünecek",HUB_SHOW_EARLIER:"Önceki konuşmaları göster",INBOX_NO_CHATS_TITLE:"Henüz konuşma yok!",INBOX_NO_CHATS_BODY:"Bir veya daha fazla konuşma başlattığınız konuşmalar burada belirecek.",ENABLE_TRANSLATION:"Bu konuşmayı Türkçe'ye çevir",DISABLE_TRANSLATION:"Orijinali göster",SEARCH_PLACEHOLDER_TEXT:"Ara...",SEARCH_SEARCHING:"Arıyor...",SEARCH_NO_RESULTS:"Sonuç bulunamadı",SEARCH_NO_MORE_RESULTS:"Başka sonuç bulunamadı.",CHAT_NOT_FOUND:"Sohbet bulunamadı",DELETE_MESSAGE:"Mesajı sil",DELETION_EXPLANATION:"Bu mesajı silerseniz herkes için görünmez olacaktır.",EDIT_MESSAGE:"Mesajı düzenle",SAVE:"Kaydet",EDITED_INDICATOR:"düzenlenmiş",REPLY_TO_MESSAGE:"Yanıtla",ADD_REACTION:"Tepki ekle",AUTH_EXPIRED_OVERLAY_TITLE:"Sohbet oturumunuz sona erdi",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Devam etmek için sayfayı yenileyin",VOICE_MESSAGE:"Sesli mesaj",CONTACT_INFORMATION_HIDDEN:"Gizli bilgi",LEAVE_CONVERSATION:"Konuşmadan ayrıl",MARK_CONVERSATION_AS_UNREAD:"Okunmamış olarak işaretle",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},US={code:"uk-UA",name:"Ukrainian (Ukraine)",translation:{YESTERDAY:"Вчора",TODAY:"Сьогодні",DAYS:"d",HOURS:"h",MINUTES:"м",JUST_NOW:"просто зараз",LOCATION:"Місцезнаходження",CANCEL:"Скасувати",INBOX:"Вхідні",DESKTOP_NOTIFICATIONS:"Сповіщення в браузері",DESKTOP_NOTIFICATIONS_ERROR:"Неможливо ввімкнути сповіщення в браузері, оскільки ваш веб-переглядач активно їх блокує. Спробуйте переглянути налаштування або використовувати інший браузер.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Демо-повідомлення про ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Якщо ви відкриєте вкладку веб-переглядача відкритою, ви побачите це спливаюче вікно, коли хтось спілкується з вами.",SEND_BUTTON_TEXT:"Надіслати",ENTRYBOX_TEXT_LIMIT:"Дозволено лише 10 000 символів.",ENTRYBOX_PLACEHOLDER:"Скажи щось...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ця розмова більше не активна.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Ви можете читати, але не надсилати повідомлення.",MESSAGELIST_LOADING_OLDER:"Завантаження старих повідомлень...",MESSAGELIST_SHOW_OLDER:"Показати старіші повідомлення",MESSAGELIST_NEW_MARKER:"Нові",MESSAGE_SENT_VIA_EMAIL:"Це повідомлення надіслано електронною поштою",YOU_MARKER:"ти",UPLOAD_IN_PROGRESS:"Завантаження...",UPLOAD_SEND_FILE:"Надіслати файл",UPLOAD_SHARE_LOCATION:"Поділитися місцезнаходженням",UPLOAD_ERROR:"На жаль, під час завантаження щось не вдалось. Файл може бути непідтримуваним або занадто великим.",SHARE_LOCATION_ERROR:"Неможливо поділити місцезнаходження: ",LOADING:"Завантаження...",HUB_EMPTY:"Тут відобразиться ваша історія чатів",HUB_SHOW_EARLIER:"Показати попередні чати",INBOX_NO_CHATS_TITLE:"Чатів ще немає!",INBOX_NO_CHATS_BODY:"Після того, як ви проведете одну чи кілька бесід, вони з’являться тут.",ENABLE_TRANSLATION:"Перекласти цю розмову англійською",DISABLE_TRANSLATION:"Показати оригінал",SEARCH_PLACEHOLDER_TEXT:"Пошук...",SEARCH_SEARCHING:"Пошук...",SEARCH_NO_RESULTS:"Не знайдено результатів",SEARCH_NO_MORE_RESULTS:"Більше немає результатів",CHAT_NOT_FOUND:"Чат не знайдено",DELETE_MESSAGE:"Видалити повідомлення",DELETION_EXPLANATION:"Якщо ви видалите це повідомлення, воно зникне для всіх.",EDIT_MESSAGE:"Редагувати повідомлення",SAVE:"Зберегти",EDITED_INDICATOR:"відредаговано",REPLY_TO_MESSAGE:"Відповісти",ADD_REACTION:"Додати реакцію",AUTH_EXPIRED_OVERLAY_TITLE:"Ваша сесія в чаті закінчилась",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Оновіть сторінку, щоб продовжити",VOICE_MESSAGE:"Голосове повідомлення",CONTACT_INFORMATION_HIDDEN:"Прихована інформація",LEAVE_CONVERSATION:"Залишити розмову",MARK_CONVERSATION_AS_UNREAD:"Відзначити як непрочитане",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},HS={code:"vi-VN",name:"Vietnamese",translation:{YESTERDAY:"Hôm qua",TODAY:"Hôm nay",DAYS:"ngày",HOURS:"giờ",MINUTES:"phút",JUST_NOW:"vừa xong",LOCATION:"Địa điểm",CANCEL:"Hủy",INBOX:"Hộp thư đến",DESKTOP_NOTIFICATIONS:"Thông báo trình duyệt",DESKTOP_NOTIFICATIONS_ERROR:"Không thể bật thông báo trên trình duyệt vì trình duyệt của bạn đang tắt chức năng này. Hãy thử tìm trong cài đặt trình duyệt hoặc sử dụng một trình duyệt khác.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} thông báo thử nghiệm`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Nếu bạn giữ tab trình duyệt của bạn mở, bạn sẽ thấy cửa sổ bật lên khi ai đó nói chuyện với bạn.",SEND_BUTTON_TEXT:"Gửi",ENTRYBOX_TEXT_LIMIT:"Tối đa 10.000 ký tự.",ENTRYBOX_PLACEHOLDER:"Nói gì đó...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Cuộc hội thoại này không còn hoạt động.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Bạn có thể đọc, nhưng không thể gửi tin nhắn.",MESSAGELIST_LOADING_OLDER:"Đang tải tin nhắn cũ...",MESSAGELIST_SHOW_OLDER:"Hiển thị tin nhắn trước đó",MESSAGELIST_NEW_MARKER:"Mới",MESSAGE_SENT_VIA_EMAIL:"Tin nhắn này đã được gửi qua email",YOU_MARKER:"bạn",UPLOAD_IN_PROGRESS:"Đang tải lên...",UPLOAD_SEND_FILE:"Gửi tệp",UPLOAD_SHARE_LOCATION:"Chia sẻ vị trí",UPLOAD_ERROR:"Thật không may, quá trình tải lên không thành công. Tệp không được hỗ trợ hoặc quá lớn.",SHARE_LOCATION_ERROR:"Không thể chia sẻ vị trí: ",LOADING:"Đang tải...",HUB_EMPTY:"Lịch sử trò chuyện của bạn sẽ hiển thị ở đây",HUB_SHOW_EARLIER:"Hiển thị các cuộc trò chuyện trước đó",INBOX_NO_CHATS_TITLE:"Chưa có cuộc trò chuyện nào!",INBOX_NO_CHATS_BODY:"Khi bạn đã có một hoặc nhiều cuộc trò chuyện, chúng sẽ hiển thị ở đây.",ENABLE_TRANSLATION:"Dịch cuộc hội thoại sang Tiếng Việt",DISABLE_TRANSLATION:"Hiển thị nội dung gốc",SEARCH_PLACEHOLDER_TEXT:"TÌm kiếm...",SEARCH_SEARCHING:"Đang tìm kiếm...",SEARCH_NO_RESULTS:"Không tìm thấy kết quả nào",SEARCH_NO_MORE_RESULTS:"Không có kết quả nào khác",CHAT_NOT_FOUND:"Không tìm thấy cuộc trò chuyện",DELETE_MESSAGE:"Xóa tin nhắn",DELETION_EXPLANATION:"Nếu bạn xóa tin nhắn này, tất cả mọi người sẽ không còn thấy nó.",EDIT_MESSAGE:"Chỉnh sửa tin nhắn",SAVE:"lưu",EDITED_INDICATOR:"đã chỉnh sửa",REPLY_TO_MESSAGE:"đáp lại",ADD_REACTION:"Thêm biểu tượng cảm xúc",AUTH_EXPIRED_OVERLAY_TITLE:"Phiên trò chuyện của bạn đã hết hạn",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Hãy làm mới trang để tiếp tục",VOICE_MESSAGE:"Tin nhắn thoại",CONTACT_INFORMATION_HIDDEN:"Thông tin ẩn",LEAVE_CONVERSATION:"Thoát khỏi cuộc trò chuyện",MARK_CONVERSATION_AS_UNREAD:"Đánh dấu là chưa đọc",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},$S={code:"zh-CN",name:"Chinese (Simplified)",translation:{YESTERDAY:"昨天",TODAY:"今天",DAYS:"天",HOURS:"小时",MINUTES:"分钟",JUST_NOW:"刚才",LOCATION:"地点",CANCEL:"取消",INBOX:"收件箱",DESKTOP_NOTIFICATIONS:"浏览器通知",DESKTOP_NOTIFICATIONS_ERROR:"因浏览器设置为阻止,所以无法激活浏览器提醒。请去设置里查看或者尝试其他的浏览器。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 演示提醒`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"只要保持浏览器开着,如果有人和你对话,将会自动弹出对话窗口。",SEND_BUTTON_TEXT:"发送",ENTRYBOX_TEXT_LIMIT:"不超过10,000个字符。",ENTRYBOX_PLACEHOLDER:"写点什么吧……",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"该对话已结束。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"你只能阅读信息,不能发送信息。",MESSAGELIST_LOADING_OLDER:"载入之前的信息……",MESSAGELIST_SHOW_OLDER:"显示之前的信息",MESSAGELIST_NEW_MARKER:"新消息",MESSAGE_SENT_VIA_EMAIL:"该信息已通过邮件发送。",YOU_MARKER:"你",UPLOAD_IN_PROGRESS:"上传中……",UPLOAD_SEND_FILE:"发送文件",UPLOAD_SHARE_LOCATION:"分享地址",UPLOAD_ERROR:"上传出错。文件格式不支持或者太大。",SHARE_LOCATION_ERROR:"无法分享地址: ",LOADING:"正在载入……",HUB_EMPTY:"你的聊天记录将在此显示。",HUB_SHOW_EARLIER:"显示之前的聊天记录。",INBOX_NO_CHATS_TITLE:"暂无任何聊天记录!",INBOX_NO_CHATS_BODY:"如果你有一个或多个对话窗口进行中,将显示在这里。",ENABLE_TRANSLATION:"翻译至简体中文",DISABLE_TRANSLATION:"查看原文",SEARCH_PLACEHOLDER_TEXT:"搜索...",SEARCH_SEARCHING:"正在搜索...",SEARCH_NO_RESULTS:"未找到结果",SEARCH_NO_MORE_RESULTS:"无更多结果",CHAT_NOT_FOUND:"未找到“聊天”",DELETE_MESSAGE:"删除消息",DELETION_EXPLANATION:"如果您删除此消息,那么所有人都将无法再看到它。",EDIT_MESSAGE:"编辑消息",SAVE:"保存",EDITED_INDICATOR:"本消息有改动",REPLY_TO_MESSAGE:"回复",ADD_REACTION:"添加反应",AUTH_EXPIRED_OVERLAY_TITLE:"您的聊天会话已过期",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"刷新页面以继续",VOICE_MESSAGE:"语音消息",CONTACT_INFORMATION_HIDDEN:"隐藏信息",LEAVE_CONVERSATION:"离开对话",MARK_CONVERSATION_AS_UNREAD:"标记为未读",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},jS={code:"zh-TW",name:"Chinese (Traditional)",translation:{YESTERDAY:"昨天",TODAY:"昨天",DAYS:"天",HOURS:"小時",MINUTES:"分",JUST_NOW:"現在",LOCATION:"地點",CANCEL:"取消",INBOX:"收件箱",DESKTOP_NOTIFICATIONS:"瀏覽器通知",DESKTOP_NOTIFICATIONS_ERROR:"無法啟用瀏覽器通知,因為您的瀏覽器主動阻止它們。 嘗試查看設置或使用其他瀏覽器。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 演示通知`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"如果您持續打開瀏覽器標籤頁,當有人與您通話時,您會看到此彈出窗口。",SEND_BUTTON_TEXT:"發送",ENTRYBOX_TEXT_LIMIT:"只允許10.000個字符。",ENTRYBOX_PLACEHOLDER:"說些什麼...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"此對話不再有效。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"您可以閱讀,但不能發送消息。",MESSAGELIST_LOADING_OLDER:"加載舊訊息...",MESSAGELIST_SHOW_OLDER:"顯示較舊的訊息",MESSAGELIST_NEW_MARKER:"新的",MESSAGE_SENT_VIA_EMAIL:"此訊息是通過電郵發送的",YOU_MARKER:"您",UPLOAD_IN_PROGRESS:"上傳中...",UPLOAD_SEND_FILE:"發送文件",UPLOAD_SHARE_LOCATION:"共享位置",UPLOAD_ERROR:"不幸的是,上傳出了問題。 該文件可能不受支持或太大。",SHARE_LOCATION_ERROR:"無法分享位置:",LOADING:"載入中...",HUB_EMPTY:"您的聊天記錄將顯示在此處",HUB_SHOW_EARLIER:"顯示早先的聊天記錄",INBOX_NO_CHATS_TITLE:"還沒聊天!",INBOX_NO_CHATS_BODY:"一旦您進行了一次或多次對話,他們就會顯示在此處。",ENABLE_TRANSLATION:"翻譯此對話至繁體中文",DISABLE_TRANSLATION:"顯示原文",SEARCH_PLACEHOLDER_TEXT:"搜尋...",SEARCH_SEARCHING:"正在搜尋...",SEARCH_NO_RESULTS:"找不到任何結果",SEARCH_NO_MORE_RESULTS:"沒有其他結果",CHAT_NOT_FOUND:"查無對話",DELETE_MESSAGE:"刪除訊息",DELETION_EXPLANATION:"您如果刪除這條訊息,所有人都將看不到它。",EDIT_MESSAGE:"編輯訊息",SAVE:"儲存",EDITED_INDICATOR:"已編輯",REPLY_TO_MESSAGE:"回覆",ADD_REACTION:"加入表情回應",AUTH_EXPIRED_OVERLAY_TITLE:"您的會話過程已過期",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"請刷新頁面以繼續",VOICE_MESSAGE:"語音訊息",CONTACT_INFORMATION_HIDDEN:"隱藏訊息",LEAVE_CONVERSATION:"離開對話",MARK_CONVERSATION_AS_UNREAD:"標記為未讀",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},Bm={ar:sS,bg:aS,bs:lS,ca:uS,cs:cS,da:dS,de:hS,el:pS,en:M,es:fS,et:mS,fa:gS,fi:ES,fr:AS,he:vS,hi:_S,hr:yS,hu:TS,id:OS,is:SS,it:NS,ja:CS,ka:bS,ko:IS,nb:wS,nl:RS,pl:DS,pt:kS,ro:LS,ru:xS,sq:MS,sr:PS,sv:BS,tr:FS,uk:US,vi:HS,zh:$S,zhTw:jS};function Fm(n){const t=n.replace(/_/g,"-").toLowerCase(),e=Bm[t];if(e)return{...e.translation,locale:t};const r=t.slice(0,2),i=Bm[r];return i?{...i.translation,locale:r}:(Jn.warn(`User locale '${n}' not supported; falling back to English.`),{...M.translation,locale:"en-US"})}const Um=()=>{const n=document.createElement("canvas");n.width=n.height=1;const t=n.getContext("2d");return t.textBaseline="top",t.font='100px "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Twemoji Mozilla","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',t.scale(.01,.01),t},Hm=(n,t)=>{const e=Um();return e.fillStyle=t,e.fillText(n,0,0),e.getImageData(0,0,1,1).data};function YS(n){const t=Hm(n,"#000"),e=Hm(n,"#fff"),r=(i=>!i.includes("‍")||Um().measureText(i).width<160)(n);return t&&e&&r&&((i,o)=>{const s=[...i].join(",");return s===[...o].join(",")&&!s.startsWith("0,0,0,")})(t,e)}function $m(n){try{return YS(n)}catch(t){return!0}}const jm=function(){if(typeof window=="undefined"||window.E2E)return 16;const n={"🫩":16,"🚶‍➡️":15.1,"🫨":15,"🫠":14,"😵‍💫":13.1,"🥲":13,"🧑‍🦰":12.1,"🥻":12,"🥰":11,"🤩":5,"👱‍♀️":4,"🤣":3,"👁️‍🗨️":2,"😀":1,"😐️":.7,"😃":.6};for(const[t,e]of Object.entries(n))if($m(t))return e}();class Ym{constructor(){this.currentUser$=Pt(null),this.app$=Pt(null),this.appId$=Pt(null),this.extUserId$=Pt(null),this.authTokenState$=Pt("idle"),this.themeCustom$=Pt(um({value:void 0})),this.device$=Pt({supportsEmojiPicker:!!jm,isMobile:typeof window!="undefined"&&/Mobi/i.test(window.navigator.userAgent)}),this.errors$=Pt({unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1}),this.t$=Pt(()=>{var i,o;const t=this.extUserId$.get(),e=this.app$.appMetadata.defaultLocale.get(),r=this.currentUser$.locale.get();return Fm((o=(i=t&&r)!=null?i:e)!=null?o:"en-US")})}resetState(t,e){ls(()=>{this.extUserId$.set(e),this.appId$.set(t),this.currentUser$.set(null)})}updateThemeCustom(t){this.themeCustom$.set(um({value:t}))}listenForErrors(t,e){this.errors$.assign({unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1});const r=t.onError(s=>{Jn.error(s.message),this.errors$.serverError.set(!0)}),i=t.currentUser.subscribe(s=>{this.errors$.unknownUser.set(s===null)}),o=e&&t.conversation(e).subscribe(s=>{this.errors$.unknownConversation.set(s===null)});return()=>{r.unsubscribe(),i.unsubscribe(),o==null||o.unsubscribe()}}listenForAuthChanges(t,e){let r=!0;this.authTokenState$.peek()!=="loading"&&this.authTokenState$.set("loading"),t._authProvider.getToken().then(()=>{r&&this.authTokenState$.set("valid")});const i=t._authProvider.onTokenRefreshFailed(()=>{r&&this.authTokenState$.set(e?"invalid":"expired")});return()=>{r=!1,i()}}listenForUserAndAppChanges(t,e){let r=!0,i=null;const o=t.currentUser.subscribe(async s=>{if(r&&s&&(this.currentUser$.set(s),s.role!==i)){i=s.role;const a=await e.getApp(s.role);if(!r)return;this.app$.set(a)}});return()=>{r=!1,o.unsubscribe()}}}const zS={canReplyToMessage:!1,canEditMessage:!1,canDeleteMessage:!1,canAddReaction:!1};class zm extends Ym{constructor(){super(),this.messageSubscription=null,this.readyForNewMessagesPromise=Promise.resolve(),this.participantSubscription=null,this.onlineSubscriptions={},this.state$=Pt({extCurrentConversationId:null,editor:{isEmpty:!0,isTyping:!1,atTextLimit:!1,characterCount:0,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0},referencedMessageId:null,editingMessageId:null,currentConversation:null,visibility:{isInView:!1,tabFocused:!0},messages:{},participants:{},typing:{},isUserConnected:{},ephemeralMessages:{},ephemeralMessageIdMapping:{},localFileBlobUrls:{},userPermissions:()=>{const t=this.app$.role.general.get(),e=this.app$.role.permissions.get();return St.defined(t),St.defined(e),{showTypingIndicator:t.showTypingIndicators,canShareFile:t.enableFileTransfers,canShareLocation:t.enableLocation,canMention:t.enableMentions,showOnlineStatus:t.enablePresence!==!1,canSendVoiceMessage:t.enableVoiceRecording,canLeaveConversation:e.conversations.leave==="all",canMarkConversationAsUnread:e.conversations.markAsUnread==="all"}},messagePermissions:()=>{const t=this.app$.role.permissions.get();St.defined(t);const e=this.state$.userPermissions.get(),r={...zS,...e},i={canReplyToMessage:Ar(t.messages.reply,!0),canEditMessage:Ar(t.messages.edit,!0),canDeleteMessage:Ar(t.messages.delete,!0),canAddReaction:Ar(t.messages.emojiReactions,!0),...e},o={...i,canEditMessage:!1},s={canReplyToMessage:Ar(t.messages.reply,!1),canEditMessage:Ar(t.messages.edit,!1),canDeleteMessage:Ar(t.messages.delete,!1),canAddReaction:Ar(t.messages.emojiReactions,!1),...e};return{system:r,own:i,ownWithoutEditing:o,other:s,otherWithoutEditing:{...s,canEditMessage:!1}}}}),this.locale$=Pt(()=>{var i,o;const t=this.extUserId$.get(),e=this.app$.appMetadata.defaultLocale.get(),r=this.currentUser$.locale.get();return(o=(i=t&&r)!=null?i:e)!=null?o:"en-US"}),this.t$=Pt(()=>Fm(this.locale$.get())),this.referencedMessage$=Pt(()=>{const t=this.state$.extCurrentConversationId.get(),e=this.state$.referencedMessageId.get();return t&&e?this.state$.messages.child(t).lookup.child(e).get():null}),this.chatItems$=Pt(()=>{var d,h;const t=this.state$.extCurrentConversationId.get();if(!t)return[];const e=this.state$.currentConversation.readUntil.get(),r=(d=this.state$.messages.child(t).state.get())!=null?d:[],i=Object.values((h=this.state$.ephemeralMessages.child(t).get())!=null?h:{}),o=i.length===0?r:i.concat(r).sort((p,f)=>f.createdAt-p.createdAt),s=o.map(p=>{const f=p.content[0],m=f==null?void 0:f.type;if(!f||m!=="file")return p;const g=f.size+","+f.filename,E=this.state$.localFileBlobUrls.child(t).child(g).url.get();return E?{...p,content:[{...f,url:E}]}:p});let a=null,l=0,u=!1;const c=[];for(const p of s){const f=new Date(p.createdAt),m=new Date(f).setHours(0,0,0,0),g=l&&m!==l,E=f.getTime()>e,A=!(!u||E||a!=null&&a.id.startsWith("ephemeral"));(A||g)&&c.push(new _c({id:"border-before-"+p.id,isDayMarker:!!g,isReadMarker:!!A,timestamp:g?l:void 0})),c.push(p),u=E,l=m,a=p}return function(p,f){const m=[];let g=[];const E=Symbol("NO_KEY");let A=E;for(const v of p){const _=f(v);A===E||A===_?g.push(v):(m.push(g),g=[v]),A=_}return g.length!==0&&m.push(g),m}(c,p=>{var f;return p instanceof _c?p.id:(f=p.sender)==null?void 0:f.id}).map(p=>(p.id=p.map(f=>f.id).join(","),p))}),this.mentionableUsers$=Pt(()=>{const t=this.state$.extCurrentConversationId.get(),e=this.extUserId$.get();if(!t||!e)return[];const r=this.state$.participants.child(t).get();if(!r||r.length===0)return[];const i=r.map(o=>o.user);return i.sort((o,s)=>o.name.localeCompare(s.name)),function(o,s){const a=s.findIndex(l=>l.id===o);if(a>-1){const l=s[a];s.splice(a,1),s.push(l)}return s}(e,i)})}resetState(t,e,r){ls(()=>{super.resetState(t,e),this.state$.assign({referencedMessageId:null,extCurrentConversationId:r!=null?r:null,currentConversation:null})})}storeTyping(t,e){this.state$.typing.child(t).set(e)}messagePermissions$(t){const e=this.currentUser$.get();if(!e)throw new Error("Unreachable");const r=t.content[0];return t.sender?e.id===t.sender.id?r.type==="text"?this.state$.messagePermissions.own:this.state$.messagePermissions.ownWithoutEditing:r.type==="text"?this.state$.messagePermissions.other:this.state$.messagePermissions.otherWithoutEditing:this.state$.messagePermissions.system}storeMessages(t,e,r){ls(()=>{var l;const i=e.reduce((u,c)=>(u[c.id]=c,u),{}),o=this.state$.extCurrentConversationId.peek(),s=this.extUserId$.peek();St(s&&o),this.state$.messages.child(t).set({state:e,lookup:i,loadedAll:r});const a=this.state$.ephemeralMessages.child(t);for(const u of e){const c=this.state$.ephemeralMessageIdMapping.child(t).child(u.id).peek();c&&a.child(c).delete();const d=u.content[0];if(((l=u.sender)==null?void 0:l.id)!==s||d.type!=="file")continue;const h=d.size+","+d.filename,p=this.state$.localFileBlobUrls.child(o).child(h);if(p.fetching.peek()!==!1)continue;const f=()=>p.delete();if(d.subtype==="image"){p.fetching.set(!0);const m=document.createElement("img");m.addEventListener("load",f,{once:!0}),m.src=d.url}else if(d.subtype==="video"){p.fetching.set(!0);const m=document.createElement("video");m.addEventListener("loaddata",f,{once:!0}),m.src=d.url}else if(d.subtype==="audio"){p.fetching.set(!0);const m=document.createElement("audio");m.addEventListener("loaddata",f,{once:!0}),m.src=d.url}}})}}function Ar(n,t){return n==="all"||n==="own"&&t||n==="other"&&!t}class _c{constructor({id:t,isDayMarker:e,isReadMarker:r,timestamp:i}){this.id=t,this.isDayMarker=e,this.isReadMarker=r,this.timestamp=e?i:void 0}}function Pa(n){return C(bt()instanceof zm?VS:WS,{...n})}function VS(n){const t=cn(),e=Qi();return C(t.Icon,{common:e,...n})}function WS(n){const t=cn(),e=Pm();return C(t.Icon,{common:e,...n})}function yc({src:n,onError:t,filename:e,className:r=""}){const i=q(null),o=q(),s=q(),[a,l]=et(!1),[u,c]=et(0),[d,h]=et(1),p=q(),[f,m]=et(!1);J(()=>{o.current=new Audio;const A={normalize:!0,height:50,container:i.current};function v(){const T=o.current;T&&(T.error.message==="PIPELINE_ERROR_READ: FFmpegDemuxer: demuxer seek failed"?(T.load(),l(!1)):(m(!0),l(!1),t==null||t()))}const _=e.slice(e.lastIndexOf(".")+1);if(function(T){return/(?:^|\/)talkjs_audio_message_[0-9]+_([0-9]+)[.](?:mp3|webm)$/.test(T)}(e)&&_==="webm"&&!o.current.canPlayType("audio/webm;codecs=opus"))A.backend="WebAudio",s.current=new Audio("data:audio/mp3;base64,//MkxAAHiAICWABElBeKPL/RANb2w+yiT1g/gTok//lP/W/l3h8QO/OCdCqCW2Cw//MkxAQHkAIWUAhEmAQXWUOFW2dxPu//9mr60ElY5sseQ+xxesmHKtZr7bsqqX2L//MkxAgFwAYiQAhEAC2hq22d3///9FTV6tA36JdgBJoOGgc+7qvqej5Zu7/7uI9l//MkxBQHAAYi8AhEAO193vt9KGOq+6qcT7hhfN5FTInmwk8RkqKImTM55pRQHQSq//MkxBsGkgoIAABHhTACIJLf99nVI///yuW1uBqWfEu7CgNPWGpUadBmZ////4sL//MkxCMHMAH9iABEmAsKioqKigsLCwtVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVV//MkxCkECAUYCAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),s.current.controls=!1;else{const T=o.current;T.addEventListener("error",v),T.src=n,T.preload="auto",T.preservesPitch=!0,A.media=T}p.current=function(T){var I,R,b,L,k,B,j,$;if(!T.container)return;const S=getComputedStyle(T.container),N=(I=cs.parse(S.color))!=null?I:new cs(255,255,255,1),y=N.withAlpha(N.alpha/2);return tc.create({...T,barGap:(R=T.barGap)!=null?R:2,barRadius:(b=T.barRadius)!=null?b:0,barWidth:(L=T.barWidth)!=null?L:2,barHeight:T.barHeight,hideScrollbar:!0,cursorWidth:(k=T.cursorWidth)!=null?k:0,cursorColor:T.cursorColor,height:(B=T.height)!=null?B:24,progressColor:(j=T.progressColor)!=null?j:y.toRgbaString(),waveColor:($=T.waveColor)!=null?$:y.toRgbaString()})}(A);const O=p.current;return O.on("finish",()=>{o.current.loop=!0,l(!1)}),O.on("ready",T=>c(Math.trunc(T))),O.on("timeupdate",T=>c(Math.trunc(T))),A.backend==="WebAudio"&&O.load(n).catch(()=>{m(!0),l(!1),t==null||t()}),()=>{var T;(T=o.current)==null||T.removeEventListener("error",v),o.current=void 0,O.destroy(),p.current=void 0}},[n,e,t]);const g=rt(()=>{var A;if(p.current.options.backend==="WebAudio")p.current.isPlaying()||s.current.play(),p.current.playPause(),l((A=p.current.isPlaying())!=null?A:!1);else{const v=o.current;v.paused?v.play():v.pause(),v.loop=!1,!v.paused&&v.ended&&(v.load(),v.play()),l(!v.paused)}},[]),E=rt(A=>{p.current.setPlaybackRate(A),h(A)},[]);return C("div",f?{}:{className:`t-audio-player ${r}`,children:[C("button",{onClick:g,children:C(Pa,{className:"t-play-pause-icon",type:a?"pause":"play","aria-label":a?"pause audio":"play audio"})}),C("div",{className:"t-waveform",ref:i}),C("div",{className:"t-duration",children:uy(u)}),C(ta,{type:"menu",popoverComponent:XS,popoverProps:{playbackSpeed:d,selectPlaybackSpeed:E},className:"t-playback-speed","aria-label":"set playback speed",children:[d,"x",C(Pa,{type:"updown",className:"t-up-down-icon","aria-hidden":!0})]})]})}const GS=[.25,.5,.75,1,1.25,1.5,2];function XS({playbackSpeed:n,selectPlaybackSpeed:t}){return C("div",{className:"t-playback-speed-menu",children:[C("div",{className:"t-playback-heading",children:"Playback Speed"}),GS.map(e=>C(_i,{className:"t-menu-item",onSelect:()=>t(e),children:[C("span",{className:"t-playback-checkmark",children:n===e?"✓ ":""}),e,"x"]},e))]})}const KS=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,qS=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/;class cs{constructor(t,e,r,i){this.red=t,this.green=e,this.blue=r,this.alpha=i}static parse(t){var r;const e=(r=t.match(KS))!=null?r:t.match(qS);if(e){const[i,o,s,a,l="1"]=e;return new cs(Number(o),Number(s),Number(a),Number(l))}return null}withAlpha(t){return new cs(this.red,this.green,this.blue,t)}toRgbaString(){const{red:t,green:e,blue:r,alpha:i}=this;return i!==1?`rgba(${t}, ${e}, ${r}, ${i})`:`rgb(${t}, ${e}, ${r})`}}function se(n){this.content=n}function Vm(n,t,e){for(let r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;let i=n.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return e;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)e++;return e}if(i.content.size||o.content.size){let s=Vm(i.content,o.content,e+1);if(s!=null)return s}e+=i.nodeSize}else e+=i.nodeSize}}function Wm(n,t,e,r){for(let i=n.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:e,b:r};let s=n.child(--i),a=t.child(--o),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,e--,r--;return{a:e,b:r}}if(s.content.size||a.content.size){let u=Wm(s.content,a.content,e-1,r-1);if(u)return u}e-=l,r-=l}else e-=l,r-=l}}se.prototype={constructor:se,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var r=e&&e!=n?this.remove(e):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(e||n,t):(o[i+1]=t,e&&(o[i]=e)),new se(o)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new se(e)},addToStart:function(n,t){return new se([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new se(e)},addBefore:function(n,t,e){var r=this.remove(t),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,t,e),new se(i)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return(n=se.from(n)).size?new se(n.content.concat(this.subtract(n).content)):this},append:function(n){return(n=se.from(n)).size?new se(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=se.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}},se.from=function(n){if(n instanceof se)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new se(t)};class K{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,e,r,i=0,o){for(let s=0,a=0;a<e;s++){let l=this.content[s],u=a+l.nodeSize;if(u>t&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,t-c),Math.min(l.content.size,e-c),r,i+c)}a=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let o="",s=!0;return this.nodesBetween(t,e,(a,l)=>{let u=a.isText?a.text.slice(Math.max(t,l)-l,e-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new K(i,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],i=0;if(e>t)for(let o=0,s=0;s<e;o++){let a=this.content[o],l=s+a.nodeSize;l>t&&((s<t||l>e)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),i+=a.nodeSize),s=l}return new K(r,i)}cutByIndex(t,e){return t==e?K.empty:t==0&&e==this.content.length?this:new K(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),o=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new K(i,o)}addToStart(t){return new K([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new K(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,e=0){return Vm(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return Wm(this,t,e,r)}findIndex(t,e=-1){if(t==0)return Ba(0,t);if(t==this.size)return Ba(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=i+this.child(r).nodeSize;if(o>=t)return o==t||e>0?Ba(r+1,o):Ba(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return K.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return K.empty;let e,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(e||(e=t.slice(0,i)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new K(e||t,r)}static from(t){if(!t)return K.empty;if(t instanceof K)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new K([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const Tc={index:0,offset:0};function Ba(n,t){return Tc.index=n,Tc.offset=t,Tc}function Fa(n,t){if(n===t)return!0;if(!n||typeof n!="object"||!t||typeof t!="object")return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(!Fa(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!Fa(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}class At{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(o)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Fa(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);return r.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return At.none;if(t instanceof At)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}}At.none=[];class to extends Error{}class G{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=Xm(this.content,t+this.openStart,e);return r&&new G(r,this.openStart,this.openEnd)}removeBetween(t,e){return new G(Gm(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return G.empty;let r=e.openStart||0,i=e.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new G(K.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.lastChild)i++;return new G(t,r,i)}}function Gm(n,t,e){let{index:r,offset:i}=n.findIndex(t),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(e);if(i==t||o.isText){if(a!=e&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Gm(o.content,t-i-1,e-i-1)))}function Xm(n,t,e,r){let{index:i,offset:o}=n.findIndex(t),s=n.maybeChild(i);if(o==t||s.isText)return n.cut(0,t).append(e).append(n.cut(t));let a=Xm(s.content,t-o-1,e);return a&&n.replaceChild(i,s.copy(a))}function JS(n,t,e){if(e.openStart>n.depth)throw new to("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new to("Inconsistent open depths");return Km(n,t,e,0)}function Km(n,t,e,r){let i=n.index(r),o=n.node(r);if(i==t.index(r)&&r<n.depth-e.openStart){let s=Km(n,t,e,r+1);return o.copy(o.content.replaceChild(i,s))}if(e.content.size){if(e.openStart||e.openEnd||n.depth!=r||t.depth!=r){let{start:s,end:a}=function(l,u){let c=u.depth-l.openStart,d=u.node(c).copy(l.content);for(let h=c-1;h>=0;h--)d=u.node(h).copy(K.from(d));return{start:d.resolveNoCache(l.openStart+c),end:d.resolveNoCache(d.content.size-l.openEnd-c)}}(e,n);return Kr(o,Jm(n,s,a,t,r))}{let s=n.parent,a=s.content;return Kr(s,a.cut(0,n.parentOffset).append(e.content).append(a.cut(t.parentOffset)))}}return Kr(o,Ua(n,t,r))}function qm(n,t){if(!t.type.compatibleContent(n.type))throw new to("Cannot join "+t.type.name+" onto "+n.type.name)}function Oc(n,t,e){let r=n.node(e);return qm(r,t.node(e)),r}function Xr(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function ds(n,t,e,r){let i=(t||n).node(e),o=0,s=t?t.index(e):i.childCount;n&&(o=n.index(e),n.depth>e?o++:n.textOffset&&(Xr(n.nodeAfter,r),o++));for(let a=o;a<s;a++)Xr(i.child(a),r);t&&t.depth==e&&t.textOffset&&Xr(t.nodeBefore,r)}function Kr(n,t){return n.type.checkContent(t),n.copy(t)}function Jm(n,t,e,r,i){let o=n.depth>i&&Oc(n,t,i+1),s=r.depth>i&&Oc(e,r,i+1),a=[];return ds(null,n,i,a),o&&s&&t.index(i)==e.index(i)?(qm(o,s),Xr(Kr(o,Jm(n,t,e,r,i+1)),a)):(o&&Xr(Kr(o,Ua(n,t,i+1)),a),ds(t,e,i,a),s&&Xr(Kr(s,Ua(e,r,i+1)),a)),ds(r,null,i,a),new K(a)}function Ua(n,t,e){let r=[];return ds(null,n,e,r),n.depth>e&&Xr(Kr(Oc(n,t,e+1),Ua(n,t,e+1)),r),ds(t,null,e,r),new K(r)}G.empty=new G(K.empty,0,0);class hs{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return(t=this.resolveDepth(t))==0?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[3*e],i=e==0?0:this.path[3*e-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return At.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive!==!1||i&&o[s].isInSet(i.marks)||(o=o[s--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive!==!1||i&&r[o].isInSet(i.marks)||(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new QS(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,o=e;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new hs(e,r,o)}static resolveCached(t,e){for(let i=0;i<Sc.length;i++){let o=Sc[i];if(o.pos==e&&o.doc==t)return o}let r=Sc[Nc]=hs.resolve(t,e);return Nc=(Nc+1)%ZS,r}}let Sc=[],Nc=0,ZS=12;class QS{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const t1=Object.create(null);let qr=class Lp{constructor(t,e,r,i=At.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||K.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&Fa(this.attrs,e||t.defaultAttrs||t1)&&At.sameSet(this.marks,r||At.none)}copy(t=null){return t==this.content?this:new Lp(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Lp(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return G.empty;let i=this.resolve(t),o=this.resolve(e),s=r?0:i.sharedDepth(e),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new G(l,i.depth-s,o.depth-s)}replace(t,e,r){return JS(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return hs.resolveCached(this,t)}resolveNoCache(t){return hs.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Zm(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=K.empty,i=0,o=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),s=o&&o.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=At.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!At.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=K.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,i,r)}};qr.prototype.text=void 0;class Ha extends qr{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Ha(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Ha(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Zm(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class Jr{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new e1(t,e);if(r.next==null)return Jr.empty;let i=Qm(r);r.next&&r.err("Unexpected trailing text");let o=function(s){let a=Object.create(null);return l(ng(s,0));function l(u){let c=[];u.forEach(h=>{s[h].forEach(({term:p,to:f})=>{if(!p)return;let m;for(let g=0;g<c.length;g++)c[g][0]==p&&(m=c[g][1]);ng(s,f).forEach(g=>{m||c.push([p,m=[]]),m.indexOf(g)==-1&&m.push(g)})})});let d=a[u.join(",")]=new Jr(u.indexOf(s.length-1)>-1);for(let h=0;h<c.length;h++){let p=c[h][1].sort(eg);d.next.push({type:c[h][0],next:a[p.join(",")]||l(p)})}return d}}(function(s){let a=[[]];return c(d(s,0),l()),a;function l(){return a.push([])-1}function u(h,p,f){let m={term:f,to:p};return a[h].push(m),m}function c(h,p){h.forEach(f=>f.to=p)}function d(h,p){if(h.type=="choice")return h.exprs.reduce((f,m)=>f.concat(d(m,p)),[]);if(h.type!="seq"){if(h.type=="star"){let f=l();return u(p,f),c(d(h.expr,f),f),[u(f)]}if(h.type=="plus"){let f=l();return c(d(h.expr,p),f),c(d(h.expr,f),f),[u(f)]}if(h.type=="opt")return[u(p)].concat(d(h.expr,p));if(h.type=="range"){let f=p;for(let m=0;m<h.min;m++){let g=l();c(d(h.expr,f),g),f=g}if(h.max==-1)c(d(h.expr,f),f);else for(let m=h.min;m<h.max;m++){let g=l();u(f,g),c(d(h.expr,f),g),f=g}return[u(f)]}if(h.type=="name")return[u(p,void 0,h.value)];throw new Error("Unknown expr type")}for(let f=0;;f++){let m=d(h.exprs[f],p);if(f==h.exprs.length-1)return m;c(m,p=l())}}}(i));return function(s,a){for(let l=0,u=[s];l<u.length;l++){let c=u[l],d=!c.validEnd,h=[];for(let p=0;p<c.next.length;p++){let{type:f,next:m}=c.next[p];h.push(f.name),!d||f.isText||f.hasRequiredAttrs()||(d=!1),u.indexOf(m)==-1&&u.push(m)}d&&a.err("Only non-generatable nodes ("+h.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,r),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let o=e;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];return function o(s,a){let l=s.matchFragment(t,r);if(l&&(!e||l.validEnd))return K.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!c.isText&&!c.hasRequiredAttrs()&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];a.isLeaf||a.hasRequiredAttrs()||a.name in e||i.type&&!l.validEnd||(r.push({match:a.contentMatch,type:a,via:i}),e[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&e(r.next[i].next)}(this),t.map((e,r)=>{let i=r+(e.validEnd?"*":" ")+" ";for(let o=0;o<e.next.length;o++)i+=(o?", ":"")+e.next[o].type.name+"->"+t.indexOf(e.next[o].next);return i}).join(`
75
- `)}}Jr.empty=new Jr(!0);class e1{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function Qm(n){let t=[];do t.push(n1(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function n1(n){let t=[];do t.push(r1(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function r1(n){let t=function(e){if(e.eat("(")){let r=Qm(e);return e.eat(")")||e.err("Missing closing paren"),r}if(!/\W/.test(e.next)){let r=function(i,o){let s=i.nodeTypes,a=s[o];if(a)return[a];let l=[];for(let u in s){let c=s[u];c.groups.indexOf(o)>-1&&l.push(c)}return l.length==0&&i.err("No node type or group '"+o+"' found"),l}(e,e.next).map(i=>(e.inline==null?e.inline=i.isInline:e.inline!=i.isInline&&e.err("Mixing inline and block content"),{type:"name",value:i}));return e.pos++,r.length==1?r[0]:{type:"choice",exprs:r}}e.err("Unexpected token '"+e.next+"'")}(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else{if(!n.eat("{"))break;t=i1(n,t)}return t}function tg(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function i1(n,t){let e=tg(n),r=e;return n.eat(",")&&(r=n.next!="}"?tg(n):-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function eg(n,t){return t-n}function ng(n,t){let e=[];return function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);e.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];a||e.indexOf(l)!=-1||r(l)}}(t),e.sort(eg)}function rg(n){let t=Object.create(null);for(let e in n){let r=n[e];if(!r.hasDefault)return null;t[e]=r.default}return t}function ig(n,t){let e=Object.create(null);for(let r in n){let i=t&&t[r];if(i===void 0){let o=n[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}e[r]=i}return e}function og(n){let t=Object.create(null);if(n)for(let e in n)t[e]=new o1(n[e]);return t}let sg=class jT{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=og(r.attrs),this.defaultAttrs=rg(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Jr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:ig(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new qr(this,this.computeAttrs(t),K.from(e),At.setFrom(r))}createChecked(t=null,e,r){return e=K.from(e),this.checkContent(e),new qr(this,this.computeAttrs(t),e,At.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),(e=K.from(e)).size){let s=this.contentMatch.fillBefore(e);if(!s)return null;e=s.append(e)}let i=this.contentMatch.matchFragment(e),o=i&&i.fillBefore(K.empty,!0);return o?new qr(this,t,e.append(o),At.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:At.none:t}static compile(t,e){let r=Object.create(null);t.forEach((o,s)=>r[o]=new jT(o,e,s));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class o1{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class $a{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=og(i.attrs),this.excluded=null;let o=rg(this.attrs);this.instance=o?new At(this,o):null}create(t=null){return!t&&this.instance?this.instance:new At(this,ig(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((o,s)=>r[o]=new $a(o,i++,e,s)),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}function ag(n,t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],o=n.marks[i],s=o;if(o)e.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&e.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}class ps{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=t.nodes[r.node];return i.contentMatch.matchType(i)})}parse(t,e={}){let r=new dg(this,e,!1);return r.addAll(t,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new dg(this,e,!0);return r.addAll(t,e.from,e.to),G.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(a1(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(t);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(t,e,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=e))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let e=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<e.length;s++){let a=e[s];if((a.priority==null?50:a.priority)<o)break}e.splice(s,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=hg(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=hg(s)),s.node||s.ignore||s.mark||(s.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new ps(t,ps.schemaRules(t)))}}const lg={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},s1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ug={ol:!0,ul:!0};function cg(n,t,e){return t!=null?(t?1:0)|(t==="full"?2:0):n&&n.whitespace=="pre"?3:-5&e}class Cc{constructor(t,e,r,i,o,s,a){this.type=t,this.attrs=e,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=a,this.content=[],this.activeMarks=At.none,this.stashMarks=[],this.match=s||(4&a?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(K.from(t));if(!e){let r,i=this.type.contentMatch;return(r=i.findWrapping(t.type))?(this.match=i,r):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let r,i=this.content[this.content.length-1];if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let o=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-r[0].length))}}let e=K.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,r=this.pendingMarks;e<r.length;e++){let i=r[e];(this.type?this.type.allowsMarkType(i.type):l1(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lg.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class dg{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0;let i,o=e.topNode,s=cg(null,e.preserveWhitespace,0)|(r?4:0);i=o?new Cc(o.type,o.attrs,At.none,At.none,!0,e.topMatch||o.type.contentMatch,s):new Cc(r?null:t.schema.topNodeType,null,At.none,At.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){t.nodeType==3?this.addTextNode(t):t.nodeType==1&&this.addElement(t)}withStyleRules(t,e){let r=t.getAttribute("style");if(!r)return e();let i=this.readStyles(function(l){let u,c=/\s*([\w-]+)\s*:\s*([^;]+)/g,d=[];for(;u=c.exec(l);)d.push(u[1],u[2].trim());return d}(r));if(!i)return;let[o,s]=i,a=this.top;for(let l=0;l<s.length;l++)this.removePendingMark(s[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l]);e();for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<s.length;l++)this.addPendingMark(s[l])}addTextNode(t){let e=t.nodeValue,r=this.top;if(2&r.options||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&r.options)e=2&r.options?e.replace(/\r\n?/g,`
74
+ `,[t,e]}setOptions(t){if(this.options.container!==t.container){const e=this.parentFromOptionsContainer(t.container);e.appendChild(this.container),this.parent=e}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,r=e*t;this.setScroll(r)}destroy(){var t,e;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.unsubscribeOnScroll)===null||e===void 0||e.call(this)}createDelay(t=10){let e,r;const i=()=>{e&&clearTimeout(e),r&&r()};return this.timeouts.push(i),()=>new Promise((o,s)=>{i(),r=s,e=setTimeout(()=>{e=void 0,r=void 0,o()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const e=document.createElement("canvas"),r=e.getContext("2d"),i=e.height*(window.devicePixelRatio||1),o=r.createLinearGradient(0,0,0,i),s=1/(t.length-1);return t.forEach((a,l)=>{const u=l*s;o.addColorStop(u,a)}),o}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,e,r,i){const o=t[0],s=t[1]||t[0],a=o.length,{width:l,height:u}=r.canvas,c=u/2,d=this.getPixelRatio(),h=e.barWidth?e.barWidth*d:1,p=e.barGap?e.barGap*d:e.barWidth?h/2:0,f=e.barRadius||0,m=l/(h+p)/a,g=f&&"roundRect"in r?"roundRect":"rect";r.beginPath();let E=0,A=0,v=0;for(let _=0;_<=a;_++){const O=Math.round(_*m);if(O>E){const N=Math.round(A*c*i),y=N+Math.round(v*c*i)||1;let w=c-N;e.barAlign==="top"?w=0:e.barAlign==="bottom"&&(w=u-y),r[g](E*(h+p),w,h,y,f),E=O,A=0,v=0}const T=Math.abs(o[_]||0),S=Math.abs(s[_]||0);T>A&&(A=T),S>v&&(v=S)}r.fill(),r.closePath()}renderLineWaveform(t,e,r,i){const o=s=>{const a=t[s]||t[0],l=a.length,{height:u}=r.canvas,c=u/2,d=r.canvas.width/l;r.moveTo(0,c);let h=0,p=0;for(let f=0;f<=l;f++){const m=Math.round(f*d);if(m>h){const E=c+(Math.round(p*c*i)||1)*(s===0?-1:1);r.lineTo(h,E),h=m,p=0}const g=Math.abs(a[f]||0);g>p&&(p=g)}r.lineTo(h,c)};r.beginPath(),o(0),o(1),r.fill(),r.closePath()}renderWaveform(t,e,r){if(r.fillStyle=this.convertColorValues(e.waveColor),e.renderFunction)return void e.renderFunction(t,r);let i=e.barHeight||1;if(e.normalize){const o=Array.from(t[0]).reduce((s,a)=>Math.max(s,Math.abs(a)),0);i=o?1/o:1}e.barWidth||e.barGap||e.barAlign?this.renderBarWaveform(t,e,r,i):this.renderLineWaveform(t,e,r,i)}renderSingleCanvas(t,e,r,i,o,s,a){const l=this.getPixelRatio(),u=document.createElement("canvas");u.width=Math.round(r*l),u.height=Math.round(i*l),u.style.width=`${r}px`,u.style.height=`${i}px`,u.style.left=`${Math.round(o)}px`,s.appendChild(u);const c=u.getContext("2d");if(this.renderWaveform(t,e,c),u.width>0&&u.height>0){const d=u.cloneNode(),h=d.getContext("2d");h.drawImage(u,0,0),h.globalCompositeOperation="source-in",h.fillStyle=this.convertColorValues(e.progressColor),h.fillRect(0,0,u.width,u.height),a.appendChild(d)}}renderMultiCanvas(t,e,r,i,o,s){const a=this.getPixelRatio(),{clientWidth:l}=this.scrollContainer;if(l*a>=r)return void this.renderSingleCanvas(t,e,l,i,0,o,s);const u=r/a;let c=Math.min(kp.MAX_CANVAS_WIDTH,l,u),d={};if(e.barWidth||e.barGap){const g=e.barWidth||.5,E=g+(e.barGap||g/2);c%E!=0&&(c=Math.floor(c/E)*E)}const h=g=>{if(g<0||g>=p||d[g])return;d[g]=!0;const E=g*c,A=Math.min(u-E,c);if(A<=0)return;const v=t.map(_=>{const O=Math.floor(E/u*_.length),T=Math.floor((E+A)/u*_.length);return _.slice(O,T)});this.renderSingleCanvas(v,e,A,i,E,o,s)},p=Math.ceil(u/c),f=this.scrollContainer.scrollLeft/u,m=Math.floor(f*p);h(m-1),h(m),h(m+1),p>1&&(this.unsubscribeOnScroll=this.on("scroll",()=>{const{scrollLeft:g}=this.scrollContainer,E=Math.floor(g/u*p);Object.keys(d).length>kp.MAX_NODES&&(o.innerHTML="",s.innerHTML="",d={}),h(E-1),h(E),h(E+1)}))}renderChannel(t,e,r,i){var{overlay:o}=e,s=function(c,d){var h={};for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&d.indexOf(p)<0&&(h[p]=c[p]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(p=Object.getOwnPropertySymbols(c);f<p.length;f++)d.indexOf(p[f])<0&&Object.prototype.propertyIsEnumerable.call(c,p[f])&&(h[p[f]]=c[p[f]])}return h}(e,["overlay"]);const a=document.createElement("div"),l=this.getHeight(s.height,s.splitChannels);a.style.height=`${l}px`,o&&i>0&&(a.style.marginTop=`-${l}px`),this.canvasWrapper.style.minHeight=`${l}px`,this.canvasWrapper.appendChild(a);const u=a.cloneNode();this.progressWrapper.appendChild(u),this.renderMultiCanvas(t,s,r,l,a,u)}render(t){return pe(this,void 0,void 0,function*(){var e;this.timeouts.forEach(l=>l()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),i=this.scrollContainer.clientWidth,o=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=o>i;const s=this.options.fillParent&&!this.isScrollable,a=(s?i:o)*r;if(this.wrapper.style.width=s?"100%":`${o}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let l=0;l<t.numberOfChannels;l++){const u=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[l]);this.renderChannel([t.getChannelData(l)],u,a,l)}else{const l=[t.getChannelData(0)];t.numberOfChannels>1&&l.push(t.getChannelData(1)),this.renderChannel(l,this.options,a,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){var t;if((t=this.unsubscribeOnScroll)===null||t===void 0||t.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:e}=this.scrollContainer,{right:r}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&e!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect();let o=i-r;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:r,scrollWidth:i,clientWidth:o}=this.scrollContainer,s=t*i,a=r,l=r+o,u=o/2;if(this.isDragging)s+30>l?this.scrollContainer.scrollLeft+=30:s-30<a&&(this.scrollContainer.scrollLeft-=30);else{(s<a||s>l)&&(this.scrollContainer.scrollLeft=s-(this.options.autoCenter?u:0));const c=s-r-u;e&&this.options.autoCenter&&c>0&&(this.scrollContainer.scrollLeft+=Math.min(c,10))}{const c=this.scrollContainer.scrollLeft,d=c/i,h=(c+o)/i;this.emit("scroll",d,h,c,c+o)}}renderProgress(t,e){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0, 100% 0, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,e)}exportImage(t,e,r){return pe(this,void 0,void 0,function*(){const i=this.canvasWrapper.querySelectorAll("canvas");if(!i.length)throw new Error("No waveform data");if(r==="dataURL"){const o=Array.from(i).map(s=>s.toDataURL(t,e));return Promise.resolve(o)}return Promise.all(Array.from(i).map(o=>new Promise((s,a)=>{o.toBlob(l=>{l?s(l):a(new Error("Could not export image"))},t,e)})))})}};Qu.MAX_CANVAS_WIDTH=8e3,Qu.MAX_NODES=10;let SO=class extends Qo{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}},zf=class extends Qo{constructor(n=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=n,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return pe(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(n){if(this.currentSrc=n,this._duration=void 0,!n)return this.buffer=null,void this.emit("emptied");fetch(n).then(t=>{if(t.status>=400)throw new Error(`Failed to fetch ${n}: ${t.status} (${t.statusText})`);return t.arrayBuffer()}).then(t=>this.currentSrc!==n?null:this.audioContext.decodeAudioData(t)).then(t=>{this.currentSrc===n&&(this.buffer=t,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var n;if(!this.paused)return;this.paused=!1,(n=this.bufferNode)===null||n===void 0||n.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playedDuration*this._playbackRate;t>=this.duration&&(t=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var n;this.paused=!0,(n=this.bufferNode)===null||n===void 0||n.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return pe(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(n){var t,e;const r=n-this.currentTime;(t=this.bufferNode)===null||t===void 0||t.stop(this.audioContext.currentTime+r),(e=this.bufferNode)===null||e===void 0||e.addEventListener("ended",()=>{this.bufferNode=null,this.pause()},{once:!0})}setSinkId(n){return pe(this,void 0,void 0,function*(){return this.audioContext.setSinkId(n)})}get playbackRate(){return this._playbackRate}set playbackRate(n){this._playbackRate=n,this.bufferNode&&(this.bufferNode.playbackRate.value=n)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(n){const t=!this.paused;t&&this._pause(),this.playedDuration=n/this._playbackRate,t&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var n,t;return(n=this._duration)!==null&&n!==void 0?n:((t=this.buffer)===null||t===void 0?void 0:t.duration)||0}set duration(n){this._duration=n}get volume(){return this.gainNode.gain.value}set volume(n){this.gainNode.gain.value=n,this.emit("volumechange")}get muted(){return this._muted}set muted(n){this._muted!==n&&(this._muted=n,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(n){return/^(audio|video)\//.test(n)}getGainNode(){return this.gainNode}getChannelData(){const n=[];if(!this.buffer)return n;const t=this.buffer.numberOfChannels;for(let e=0;e<t;e++)n.push(this.buffer.getChannelData(e));return n}};const NO={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};let tc=class $T extends OO{static create(t){return new $T(t)}constructor(t){const e=t.media||(t.backend==="WebAudio"?new zf:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},NO,t),this.timer=new SO;const r=e?void 0:this.getMediaElement();this.renderer=new Qu(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const i=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:o,duration:s}=this.options;(i||o&&s)&&this.load(i,o,s).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t)}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop()}),this.onMediaEvent("emptied",()=>{this.timer.stop()}),this.onMediaEvent("ended",()=>{this.emit("finish")}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",t=>{this.emit("error",t.error)}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))}),this.renderer.on("dblclick",(t,e)=>{this.emit("dblclick",t,e)}),this.renderer.on("scroll",(t,e,r,i)=>{const o=this.getDuration();this.emit("scroll",t*o,e*o,r,i)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",e=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(e),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(e)},r),this.emit("interaction",e*this.getDuration()),this.emit("drag",e)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(e=>{this.registerPlugin(e)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){return t._init(this),this.plugins.push(t),this.subscriptions.push(t.once("destroy",()=>{this.plugins=this.plugins.filter(e=>e!==t)})),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,r,i){return pe(this,void 0,void 0,function*(){var o;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!e&&!r){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=(o=this.abortController)===null||o===void 0?void 0:o.signal);const l=u=>this.emit("loading",u);e=yield TO.fetchBlob(t,l,a)}this.setSrc(t,e);const s=yield new Promise(a=>{const l=i||this.getDuration();l?a(l):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>a(this.getDuration()),{once:!0}))});if(!t&&!e){const a=this.getMediaElement();a instanceof zf&&(a.duration=s)}if(r)this.decodedData=$f.createBuffer(r,s||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield $f.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,e,r){return pe(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,e,r)}catch(i){throw this.emit("error",i),i}})}loadBlob(t,e,r){return pe(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,e,r)}catch(i){throw this.emit("error",i),i}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const i=Math.min(t,this.decodedData.numberOfChannels),o=[];for(let s=0;s<i;s++){const a=this.decodedData.getChannelData(s),l=[],u=a.length/e;for(let c=0;c<e;c++){const d=a.slice(Math.floor(c*u),Math.ceil((c+1)*u));let h=0;for(let p=0;p<d.length;p++){const f=d[p];Math.abs(f)>Math.abs(h)&&(h=f)}l.push(Math.round(h*r)/r)}o.push(l)}return o}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}playPause(){return pe(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return pe(this,arguments,void 0,function*(t="image/png",e=1,r="dataURL"){return this.renderer.exportImage(t,e,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(e=>e.destroy()),this.subscriptions.forEach(e=>e()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}};tc.BasePlugin=class extends Qo{constructor(n){super(),this.subscriptions=[],this.options=n}onInit(){}_init(n){this.wavesurfer=n,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(n=>n())}},tc.dom=yO;class Vf extends Error{}function Wf(n,t){if(!n)throw new Vf(t!=null?t:"Assertion failed")}const St=Object.assign(Wf,{is:function(n,t,e){return Wf(t,e)},unreachable:function(){throw new Error("Unreachable code")},never:function(n){throw new Error("Unreachable")},defined:function(n){if(n==null)throw new Vf("Value is not defined")}}),[Gf,cn]=Vr(),[Xf,ts]=Vr(),[Kf,VD]=Vr(),[qf,es]=Vr(),[CO,bO]=Vr(),ec=nn(void 0);function bt(){const n=Re(ec);return St(n!==void 0),n}const nc=nn(void 0);function $i(){const n=Re(nc);return St(n!==void 0),n}const[Jf,IO]=Vr(),[wO,RO]=Vr();function Vr(){const n=nn(void 0);return[n,()=>{const t=Re(n);return St(t!==void 0),t}]}var Zf=Object.prototype.hasOwnProperty;function qt(n){return Array.isArray(n)}function De(n){return!(!n||typeof n!="object"||n instanceof Date||qt(n))}function ft(n){return typeof n=="function"}function rn(n){const t=typeof n;return n!==void 0&&(rc(n)||t!=="object"&&t!=="function")}function rc(n){return n instanceof Date}function Qf(n){return typeof n=="boolean"}function ke(n){return n instanceof Promise}function Ue(n){return n instanceof Map}function ji(n){if(!n)return!1;if(qt(n))return n.length===0;for(const t in n)if(Zf.call(n,t))return!1;return!0}function tm(n){return n==null}var DO=new Set(["boolean","string","number"]);function Sa(n){return!!n.parent}var kO=Symbol.toPrimitive,Yi=Symbol("getNode"),ns=Symbol("delete"),zi=Symbol("opaque"),ic=Symbol("optimized"),rs=Symbol("linked"),It={isLoadingLocal:!1,isMerging:!1,isLoadingRemote:!1,activateSyncedNode:void 0,pendingNodes:new Map,dirtyNodes:new Set,replacer:void 0,reviver:void 0};function em(n){return qt(n)?"array":Ue(n)?"map":n instanceof Set?"set":"object"}function LO(n,t){return Ue(t)?{__LSType:"Map",value:Array.from(t.entries())}:t instanceof Set?{__LSType:"Set",value:Array.from(t)}:(It.replacer&&(t=It.replacer(n,t)),t)}var xO=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;function MO(n,t){if(t){if(typeof t=="string"&&xO.test(t))return new Date(t);if(typeof t=="object"){if(t.__LSType==="Map")return new Map(t.value);if(t.__LSType==="Set")return new Set(t.value)}It.reviver&&(t=It.reviver(n,t))}return t}function nm(n){return n&&JSON.stringify(n,LO)}function rm(n){return n&&JSON.parse(n,MO)}function im(n){return rm(nm(n))}function wt(n){return!!n&&!!n[Yi]}function Na(n){return n&&n[Yi]}function bn(n,t){var e,r,i;const o=(e=n.parent)!=null?e:n,s=n.parent?n.key:"_",a=t===ns;a&&(t=void 0);const l=n.parent?oc(o):o.root,u=l[s],c=ft(t);if(t=o.isAssigning||!c||ft(u)?t:t(u),!It.isMerging||tm(u)||ft(u)||!((i=(r=n.parent)==null?void 0:r.functions)!=null&&i.get(s)))try{o.isSetting=(o.isSetting||0)+1;const d=Ue(l);a?d?l.delete(s):delete l[s]:Ue(l)?l.set(s,t):l[s]=t}finally{o.isSetting--}return{prevValue:u,newValue:t}}var om=[];function kt(n){let t=0,e=n;for(;Sa(e);)om[t++]=e.key,e=e.parent;let r=n.root._;for(let i=t-1;r&&i>=0;i--){const o=om[i];r=o!=="size"&&(Ue(r)||r instanceof WeakMap)?r.get(o):r[o]}return r}function dn(n,t,e){var r,i;let o=(r=n.children)==null?void 0:r.get(t);return o||(o={root:n.root,parent:n,key:t,lazy:!0,numListenersRecursive:0},((i=n.lazyFn)==null?void 0:i.length)===1&&(e=n.lazyFn.bind(n,t)),ft(e)&&(o=Object.assign(()=>{},o),o.lazyFn=e),n.children||(n.children=new Map),n.children.set(t,o)),o}function oc(n){let t=kt(n);return(!t||ft(t))&&(Sa(n)?t=oc(n.parent)[n.key]={}:t=n.root._={}),t}function sm(n,t){var e,r;let i=wt(n)?void 0:De(n)?"id"in n?"id":"key"in n?"key":"_id"in n?"_id":"__id"in n?"__id":void 0:void 0;if(!i&&t.parent){const o=t.key+"_keyExtractor",s=(r=(e=t.functions)==null?void 0:e.get(o))!=null?r:kt(t.parent)[t.key+"_keyExtractor"];s&&ft(s)&&(i=s)}return i}function am(n,t,e){n.functions||(n.functions=new Map),n.functions.set(t,e)}function lm(n,t){return n===t||rc(n)&&rc(t)&&+n==+t}function is(n,t,e){let r=n;return!wt(r)&&ft(r)&&(r=t?r(t):r()),wt(r)&&!e?r.get():r}function um(n){return n&&(n[zi]=!0),n}var ss,PO=(n,t)=>n&&n[t];function cm(n,t,e,r,i,o,s){let a,l=n;if(t.length>0){let u=o;for(let c=0;c<t.length;c++){if(a=t[c],l[a]===ns)return u&&(l[a]=u[a],s==null||s(t.slice(0,c+1),l[a])),n;if(l[a]===void 0&&r===void 0&&c===t.length-1)return n;l[a]!==void 0&&l[a]!==null||(l[a]=dm(e[c])),c<t.length-1&&(l=l[a],u&&(u=u[a]))}}return a===void 0?n=i==="merge"?sc(n,r):r:i==="merge"?l[a]=sc(l[a],r):Ue(l)?l.set(a,r):l[a]=r,n}function sc(n,t,e){var r;wt(t)&&(t=t.peek());const i=wt(n),o=i?n.peek():n,s=qt(o);if(!s&&De(o)&&De(t)&&!ji(o)||s&&o.length>0){const a=Object.keys(t);for(let l=0;l<a.length;l++){const u=a[l],c=t[u];if(c===ns)i&&((r=n[u])!=null&&r.delete)?n[u].delete():delete n[u];else{const d=De(c),h=!d&&qt(c),p=n[u];if(!d&&!h||!p||!i&&ji(p))if(i)p.set(c);else{const f=De(c)?{...c}:qt(c)?[...c]:c;n[u]=f}else i||p&&(d?De(p):qt(p))?sc(p,c):n[u]=c}}}else t!==void 0&&(i?n.set(t):n=t);return n}function dm(n){switch(n){case"array":return[];case"object":return{};case"map":return new Map;case"set":return new Set}}function BO(n,t,e){const{path:r,valueAtPath:i,prevAtPath:o,pathTypes:s}=t;return cm(n,r,s,o)}var Ca=0,ac=!1,lc=!1,as=new Map;function FO(){as.size>0&&Wi(!0)}function hm(n,t){for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function UO(n,t){try{return function(e,r){for(let i=0;i<r.length;i++)e=BO(e,r[i]);return e}(n?im(n):{},t)}catch(e){return}}function uc(n,t){return function(){return UO(n,t)}}function ls(n,t,e,r,i){const o=new Map;ba(o,n,It.isLoadingLocal,It.isLoadingRemote,t,[],[],t,e,!0,r,i),o.size&&pm(o,!0);const s=as.get(n);s?s.value=t:as.set(n,{value:t,prev:e,level:r,whenOptimizedOnlyIf:i,remote:It.isLoadingRemote,loading:It.isLoadingLocal}),Ca<=0&&fm()}function ba(n,t,e,r,i,o,s,a,l,u,c,d){if(function(h,p,f,m,g,E,A,v,_,O,T,S){if(O?p.listenersImmediate:p.listeners){const N={path:E,pathTypes:A,valueAtPath:v,prevAtPath:_},y=h.get(p);if(y&&E.length>0){const{changes:w}=y;hm(w[0].path,N.path)||w.push(N)}else h.set(p,{level:T,value:g,remote:m,loading:f,whenOptimizedOnlyIf:S,changes:[N]})}}(n,t,e,r,i,o,s,a,l,u,c,d),t.linkedFromNodes)for(const h of t.linkedFromNodes)ba(n,HO(h,o),e,r,a,[],[],a,l,u,0,d);if(t.parent){const h=t.parent;h&&ba(n,h,e,r,kt(h),[t.key].concat(o),[em(i)].concat(s),a,l,u,c+1,d)}}function pm(n,t){const e=new Set;n.forEach(({changes:r,level:i,value:o,loading:s,remote:a,whenOptimizedOnlyIf:l},u)=>{const c=t?u.listenersImmediate:u.listeners;if(c){let d;const h=Array.from(c);for(let p=0;p<h.length;p++){const f=h[p],{track:m,noArgs:g,listener:E}=f;e.has(E)||(m===!0?i<=0:m!==ic||l&&i<=0)&&(g||d||(d={value:o,loading:s,remote:a,getPrevious:uc(o,r),changes:r}),m||e.add(E),E(d))}}})}function fm(){const n=Array.from(It.dirtyNodes);It.dirtyNodes.clear(),n.forEach(r=>{const i=r.dirtyFn;i&&(r.dirtyFn=void 0,i())});const t=as;as=new Map;const e=new Map;t.forEach(({value:r,prev:i,level:o,loading:s,remote:a,whenOptimizedOnlyIf:l},u)=>{ba(e,u,s,a,r,[],[],r,i,!1,o,l)}),e.size&&pm(e,!1)}function Vi(n){Ia();try{n()}finally{Wi()}}function Ia(){Ca++,ss||(ss=setTimeout(FO,0))}function Wi(n){(--Ca<=0||n)&&(ac?lc=!0:(ss&&(clearTimeout(ss),ss=void 0),Ca=0,ac=!0,fm(),ac=!1,lc&&(lc=!1,Wi(!0))))}function HO(n,t){let e=n;for(let r=0;r<t.length;r++)e=dn(e,t[r]);return e}function cc(n,t,e,r,i){if(wt(n))return n;const o=ke(n);let s={root:{_:n},lazy:!0,numListenersRecursive:0};ft(n)&&(s=Object.assign(()=>{},s),s.lazyFn=n);var a;const l=(a=n,DO.has(typeof a)?new i(s):r(s));return o&&(bn(s,void 0),e(s,n)),l}function gr(n,t,e={},r){var i;const{initial:o,immediate:s,noArgs:a}=e,{trackingType:l}=e;let u=s?n.listenersImmediate:n.listeners;u||(u=new Set,s?n.listenersImmediate=u:n.listeners=u);const c={listener:t,track:l,noArgs:a};if(u.add(c),o){const m=kt(n);t({value:m,loading:!0,remote:!1,changes:[{path:[],pathTypes:[],prevAtPath:m,valueAtPath:m}],getPrevious:()=>{}})}let d;function h(m,g=t,E){if(!(r!=null&&r.has(m))){r||(r=new Set),r.add(E||n),g||(g=t);const A={trackingType:!0,...e};d=[...d||[],gr(m,g,A,r)]}}n.linkedToNode&&h(n.linkedToNode),(i=n.linkedFromNodes)==null||i.forEach(m=>h(m)),n.numListenersRecursive++;let p=n.parent,f=[n.key];for(;p;){if(p.linkedFromNodes)for(const m of p.linkedFromNodes)r!=null&&r.has(m)||h(m,$O(m,f,t),p);p.numListenersRecursive++,f=[p.key,...f],p=p.parent}return()=>{u.delete(c),d==null||d.forEach(g=>g());let m=n;for(;m;)m.numListenersRecursive--,m=m.parent}}function $O(n,t,e){let{valueAtPath:r}=mm(kt(n),t);return function({value:i,loading:o,remote:s}){const{valueAtPath:a}=mm(i,t);a!==r&&e({value:a,loading:o,remote:s,changes:[{path:[],pathTypes:[],prevAtPath:r,valueAtPath:a}],getPrevious:()=>r}),r=a}}function mm(n,t){let e=n;const r=[];for(let i=0;e&&i<t.length;i++)r.push(qt(e)?"array":"object"),e=e[t[i]];return{valueAtPath:e,pathTypes:r}}var wa=0,gm=[],Gi={current:void 0};function dc(n,t){if(wa){const e=Gi.current;if(e){e.nodes||(e.nodes=new Map);const r=e.nodes.get(n);r?(r.track=r.track||t,r.num++):e.nodes.set(n,{node:n,track:t,num:1})}}}function Em(n,t,e,r,i){let o,s=t;gm.push(Gi.current),wa++,Gi.current={};const a=n&&is(n,e,r==null?void 0:r.fromComputed),l=Gi.current.nodes;return--wa<0&&(wa=0),Gi.current=gm.pop(),e!=null&&e.cancel||(o=function(u,c,d,h){let p=[];return u==null||u.forEach(f=>{const{node:m,track:g}=f;p.push(gr(m,c,{trackingType:g,immediate:h,noArgs:d}))}),()=>{if(p){for(let f=0;f<p.length;f++)p[f]();p=void 0}}}(l,s,!1,r==null?void 0:r.immediate)),{nodes:l,value:a,dispose:o,resubscribe:void 0}}function us(n,t,e){let r,i;ft(t)?r=t:e=t;const o={num:0},s=function(){o.onCleanup&&(o.onCleanup(),o.onCleanup=void 0),Ia(),delete o.value,i==null||i();const{dispose:a,value:l,nodes:u}=Em(n,s,o,e);i=a,o.value=l,o.nodes=u,o.refresh=s,o.onCleanupReaction&&(o.onCleanupReaction(),o.onCleanupReaction=void 0),Wi(),r&&(e!=null&&e.fromComputed||(o.num>0||!function(c){var d;return c&&((d=c[Yi])==null?void 0:d.isEvent)}(n))&&(o.previous!==o.value||typeof o.value=="object"))&&r(o),o.previous=o.value,o.num++};return s(),()=>{var a,l;(a=o.onCleanup)==null||a.call(o),o.onCleanup=void 0,(l=o.onCleanupReaction)==null||l.call(o),o.onCleanupReaction=void 0,i==null||i()}}function Am(n,t,e){if(ke(n))return t?n.then(t):n;let r,i;return us(function(o){const s=is(n);if(!ke(s))return!ke(s)&&(e?function(a){return!(!a||(De(a)||qt(a))&&ji(a))}(s):s)&&(r=s,o.cancel=!0),r;r=s},function(){i=t==null?void 0:t(r)}),ke(r)?t?r.then(t):r:r!==void 0?t?i:Promise.resolve(r):new Promise(o=>{if(t){const s=t;t=a=>{const l=s(a);o(ke(l)?l.then(u=>u):l)}}else t=o})}function vm(n,t){return Am(n,t,!1)}function _m(n,t){return Am(n,t,!0)}var ym=new Set(["copyWithin","fill","from","pop","push","reverse","shift","sort","splice","unshift"]),Tm=new Set(["every","filter","find","findIndex","forEach","join","map","reduce","some"]),jO=new Set(["filter","find"]),hc=new Map,Ra=new Map([["get",ka],["set",In],["peek",Ji],["onChange",gr],["assign",function(n,t){const e=He(n);if(Ia(),rn(n.root._)&&(n.root._={}),Ue(t)){const r=kt(n);Ue(r)&&t.forEach((i,o)=>r.set(o,i))}else{n.isAssigning=(n.isAssigning||0)+1;try{Object.assign(e,t)}finally{n.isAssigning--}}return Wi(),e}],["delete",function(n,t){t===void 0&&Sa(n)&&(t=n.key,n=n.parent);const e=kt(n);qt(e)?Om(n,e,"splice",t,1):Xi(n,t!=null?t:"_",ns,-1)}],["toggle",function(n){const t=kt(n);(t==null||Qf(t))&&In(n,!t)}]]);function Om(n,t,e,...r){var i;if(e!=="push"||r.length!==1){const o=t.slice(),s=t[e].apply(t,r);if(n){const a=Sa(n),l=a?n.key:"_";(a?kt(n.parent):n.root)[l]=o,Xi((i=n.parent)!=null?i:n,l,t)}return s}Xi(n,t.length+"",r[0])}function Sm(n,t,e){return t?void 0:n?e?Array.from(n.keys()):Object.keys(n):[]}function pc(n,t,e){var r,i,o;if(De(t)&&t[zi]||De(e)&&e[zi]){const v=t!==e;return v&&(n.listeners||n.listenersImmediate)&&ls(n,t,e,0),v}const s=qt(t);let a,l;const u=Ue(t),c=Ue(e),d=Sm(t,s,u),h=Sm(e,s,c),p=((r=d||t)==null?void 0:r.length)||0,f=((i=h||e)==null?void 0:i.length)||0;let m,g,E,A=!1;if(s&&qt(e)){if(e.length>0){const v=e[0];if(v!==void 0&&(m=sm(v,n),m&&(g=ft(m),a=new Map,l=[]),n.children))for(let _=0;_<e.length;_++){const O=e[_];if(O){const T=n.children.get(_+"");if(T&&(t[_]||Nm(T,O),m)){const S=g?m(O):O[m];a.set(S,T)}}}}}else if(e&&(!t||De(t))){const v=h.length;for(let _=0;_<v;_++){const O=h[_];if(!d.includes(O)){A=!0;const T=dn(n,O),S=c?e.get(O):e[O];S!==void 0&&Nm(T,S)}}}if(t&&!rn(t)){A=A||p!==f;const v=A;let _=!1;for(let O=0;O<p;O++){const T=s?O+"":d[O];let S=u?t.get(T):t[T];const N=c?e==null?void 0:e.get(T):e==null?void 0:e[T];let y=!lm(S,N);if(y){const w=m&&S?g?m(S):S[m]:void 0,b=(o=n.children)==null?void 0:o.get(T);if(wt(S)){const P=Na(S);if((b==null?void 0:b.linkedToNode)===P){const B=kt(P);u?t.set(T,B):t[T]=B;continue}const k=S;S=()=>k}let I=dn(n,T,S);if(I.lazy||!ft(S)&&!wt(S)||(YO(I,S),Wr(I)),s&&w!==void 0){const P=w!==void 0?a==null?void 0:a.get(w):void 0;if(P){if(P!==void 0&&P.key!==T){const k=e[P.key];v&&(I=P,n.children.delete(I.key),I.key=T,l.push([T,I])),_=!0,y=k!==S}}else A=!0}if(y)if(ft(S)||wt(S))qi(n,T,S);else if(rn(S))A=!0;else{const P=pc(I,S,N);A=A||P,y=P}(y||s&&!v)&&(I.listeners||I.listenersImmediate)&&ls(I,S,N,0,!v)}}if(l)for(let O=0;O<l.length;O++){const[T,S]=l[O];n.children.set(T,S)}E=A||_}else e!==void 0&&(E=!0);return E!=null&&E}function Nm(n,t){var e,r;(e=n.linkedToNodeDispose)==null||e.call(n),(r=n.activatedObserveDispose)==null||r.call(n),rn(t)||pc(n,void 0,t),(n.listeners||n.listenersImmediate)&&ls(n,void 0,t,0)}function He(n,t,e){return t!==void 0&&(n=dn(n,t,e)),n.proxy||(n.proxy=new Proxy(n,Cm))}function fc(){if(It.pendingNodes.size>0){const n=Array.from(It.pendingNodes.values());It.pendingNodes.clear(),n.forEach(t=>t())}}var Cm={get(n,t,e){var r,i;if(t===kO)throw new Error("[legend-state] observable is not a primitive.");if(t===Yi)return n;if(t==="apply"){const d=kt(n);if(ft(d))return d.apply}let o=Wr(n,t==="get"||t==="peek");const s=n.linkedToNode||(o==null?void 0:o[Yi]);if(s&&t!=="onChange")return Cm.get(s,t,e);if(Ue(o)||o instanceof WeakMap||o instanceof Set||o instanceof WeakSet){const d=function(h,p,f){const m=f==null?void 0:f[p];if(p==="size")return He(h,p);if(ft(m))return function(g,E,A){const v=arguments.length,_=f;if(p==="get"){if(v>0&&typeof g!="boolean"&&g!==ic)return He(h,g)}else if(p==="set"){if(v===2){const T=_.get(g),S=_.set(g,E);return T!==E&&Da(dn(h,g),E,T),S}v===1&&Ue(f)&&In(h,g)}else if(p==="delete"){if(v>0){const T=f.get?_.get(g):g,S=f.delete(g);return S&&Da(dn(h,g),void 0,T),S}}else{if(p==="clear"){const T=new Map(_),S=_.size;return _.clear(),void(S&&Da(h,f,T))}if(p==="add"){const T=new Set(f),S=f.add(g);return f.has(p)||ls(h,S,T,0),S}}const O=Ra.get(p);if(!O)return f[p](g,E);switch(v){case 0:return O(h);case 1:return O(h,g);case 2:return O(h,g,E);default:return O(h,g,E,A)}}}(n,t,o);if(d!==void 0)return d}const a=Ra.get(t);if(a)return t!=="get"&&t!=="peek"||fc(),function(d,h,p){switch(arguments.length){case 0:return a(n);case 1:return a(n,d);case 2:return a(n,d,h);default:return a(n,d,h,p)}};const l=hc.get(t);if(l)return l.get(n);let u=o==null?void 0:o[t];if(De(o)&&o[zi])return u;const c=(r=n.functions)==null?void 0:r.get(t);if(c)return wt(c)?c:He(n,t,c);if(u=function(d,h){if(d){const p=Object.getOwnPropertyDescriptor(d,h);return p!=null&&p.get&&(delete d[h],d[h]=p.set?function(f){ft(f)&&(f={get:f});const m=function(){return{[rs]:f}};return m.prototype[rs]=f,m}({get:p.get,set:({value:f})=>p.set(f)}):p.get),d[h]}}(o,t),tm(o)&&u===void 0&&(ym.has(t)||Tm.has(t))&&(o=[],bn(n,o),u=o[t]),ft(u)){if(qt(o)){if(ym.has(t))return(...h)=>Om(n,o,t,...h);if(Tm.has(t))return dc(n,!0),function(h,p){const f=t==="reduce",m=f?(A,v,_,O)=>h(A,He(n,_+"",v),_,O):(A,v,_)=>h(He(n,v+"",A),v,_);if(f||!jO.has(t))return o[t](m,p);const g=t==="find",E=[];for(let A=0;A<o.length;A++)if(m(o[A],A,o)){const v=He(n,A+"");if(g)return v;E.push(v)}return g?void 0:E}}qi(n,t,u);const d=(i=n.functions)==null?void 0:i.get(t);return d?He(n,t,d):u.bind(o)}return rn(u)&&qt(o)&&t==="length"?(dc(n,!0),u):He(n,t)},getPrototypeOf(n){const t=kt(n);return t!==null&&typeof t=="object"?Reflect.getPrototypeOf(t):null},ownKeys(n){Wr(n);const t=ka(n,!0);if(rn(t))return[];const e=t?Reflect.ownKeys(t):[];if(qt(t)&&e[e.length-1]==="length"&&e.splice(e.length-1,1),ft(n)){const r=Reflect.ownKeys(n);["caller","arguments","prototype"].forEach(i=>r.includes(i)&&e.push(i))}return e},getOwnPropertyDescriptor(n,t){if(t==="caller"||t==="arguments"||t==="prototype")return{configurable:!1,enumerable:!1};const e=kt(n);return rn(e)?void 0:Reflect.getOwnPropertyDescriptor(e,t)},set(n,t,e){if(n.isSetting)return Reflect.set(n,t,e);if(n.isAssigning)return Xi(n,t,e),!0;const r=hc.get(t);return!!r&&(r.set(n,e),!0)},deleteProperty:(n,t)=>!!n.isSetting&&Reflect.deleteProperty(n,t),has(n,t){const e=kt(n);return Reflect.has(e,t)},apply:(n,t,e)=>(wt(t)&&(t=t.peek()),Reflect.apply(n.lazyFn||n,t,e))};function In(n,t){n.parent?Xi(n.parent,n.key,t):Xi(n,"_",t)}function Xi(n,t,e,r){const i=!n.parent&&t==="_";!n.parent||kt(n)||ft(e)||In(n,{[t]:e});const o=i?n:dn(n,t,e);if(wt(e))mc(o,e);else{const{newValue:s,prevValue:a}=bn(o,e),l=rn(s)||s instanceof Date;lm(s,a)||Da(n,s,a,o,l,i,r),l||(o.needsExtract=!0),qi(n,t,s)}}function Da(n,t,e,r,i,o,s){r||(r=n),Ia(),i===void 0&&(i=rn(t));let a=i,l=!1;(!i||e&&!rn(e))&&(a=pc(r,t,e),qt(t)&&(l=(t==null?void 0:t.length)!==(e==null?void 0:e.length))),(i||!t||ji(t)&&!ji(e)?t!==e:a)&&ls(i&&o?n:r,t,e,(s!=null?s:e===void 0)?-1:a?0:1,l),Wi()}function Ki(n,t,e){n.state||(n.state=cc({isLoaded:!1},0,Ki,He)),t.then(r=>{e?e({value:r}):In(n,r),n.state.assign({isLoaded:!0,error:void 0})}).catch(r=>{n.state.error.set(r)})}function qi(n,t,e){if(ke(e)){const r=dn(n,t);return Ki(r,e),void bn(r,void 0)}if(wt(e)){const r=()=>e;am(n,t,r);const i=dn(n,t,r);return bn(i,Ji(Na(e))),kt(i)}if(typeof e=="function")return am(n,t,e),t}function ka(n,t){return dc(n,t?De(t)?t.shallow:t:void 0),Ji(n)}function Ji(n){return Wr(n,!0)}var La=!1;function Wr(n,t){var e;if(La=!0,t&&((e=n.dirtyChildren)==null?void 0:e.size)){const i=Array.from(n.dirtyChildren);n.dirtyChildren.clear(),i.forEach(o=>o.dirtyFn&&Wr(o))}if(n.dirtyFn){const i=n.dirtyFn;n.dirtyFn=void 0,It.dirtyNodes.delete(n),i()}La=!1;let r=kt(n);return r=function(i,o,s){const a=o,l=i.lazy;if(l){const u=i.lazyFn;if(delete i.lazy,ft(u))if(u.length===1)o={};else{if(i.parent){const c=kt(i.parent);c?delete c[i.key]:i.root._=void 0}o=function(c,d){let h,p,f,m=!0;const g=d;let E,A,v=[];function _(){c.dirtyFn=A,It.dirtyNodes.add(c)}return c.activatedObserveDispose=us(()=>{var O,T,S,N;if(m)m=!1,bn(c,void 0);else if(!La&&A&&function(I,P){if(!La&&!function(B){var $,U;let V=B,L=B.numListenersRecursive>0;for(;V&&!L;)(($=V.listeners)!=null&&$.size||(U=V.listenersImmediate)!=null&&U.size)&&(L=!0),V=V.parent;return L}(I)){P&&(I.dirtyFn=P);let B=I;for(;B;)B.dirtyChildren||(B.dirtyChildren=new Set),B.dirtyChildren.add(I),B=B.parent;return!0}}(c,A))return void(f=!0);let y=g(),w=!1;wt(y)&&(w=!0,y=mc(c,y)),ft(y)&&(y=y());const b=wt(y)||y==null?void 0:y[rs];if(b&&(c.activationState=b,y=void 0),f=!1,p=ke(y),c.activated){if(c.activationState){const I=c.activationState;(T=(O=c.state)==null?void 0:O.peek())!=null&&T.sync?(c.state.sync(),f=!0):y=(N=(S=I.get)==null?void 0:S.call(I))!=null?N:I.initial}}else{c.activated=!0;let I=zO;b!=null&&b.synced&&(I=It.activateSyncedNode,f=!0);const P=I(c,y);h=P.update;let k=P.value;!w&&wt(k)&&(k=mc(c,k)),y=k!=null?k:b==null?void 0:b.initial}return p=p||ke(y),y},O=>{const{value:T,nodes:S,refresh:N}=O;if(A=N,!f){if(!p||!It.isLoadingRemote)if(p)if(c.activationState){const{initial:y}=c.activationState;T&&ke(T)&&Ki(c,T,h),ft(kt(c))&&bn(c,y!=null?y:void 0)}else c.activated&&(Ki(c,T,h),ft(kt(c))&&bn(c,void 0));else E=T,c.state.isLoaded.peek()?(c.isComputing=!0,In(c,T),c.isComputing=!1):(bn(c,T),c.state.assign({isLoaded:!0,error:void 0}));v.forEach(y=>y()),v=[],S==null||S.forEach(({node:y,track:w})=>{v.push(gr(y,_,{immediate:!0,trackingType:w}))})}O.cancel=!0},{fromComputed:!0}),E}(i,u)}else wt(o)&&(o=qi(i.parent,i.key,o))}return!l&&!i.needsExtract||wt(o)||rn(o)||(s&&function(u,c){if((De(u)||qt(u))&&!u[zi]){const d=[];bm(u,d,()=>{var p;let f=c;for(let m=0;m<d.length;m++){const{key:g}=d[m],E=(p=kt(f))==null?void 0:p[g];f=dn(f,g,ft(E)?E:void 0),Wr(f)}return f})}}(o,i),i.parent&&qi(i.parent,i.key,a)),o}(n,r,!!t),r}function YO(n,t){var e,r;(e=n.activatedObserveDispose)==null||e.call(n),(r=n.linkedToNodeDispose)==null||r.call(n),n.activatedObserveDispose=n.linkedToNodeDispose=n.linkedToNode=void 0,n.lazyFn=t,n.lazy=!0}function zO(n,t){if(n.state||(n.state=cc({isLoaded:!1},0,Ki,He)),n.activationState){const{set:e,get:r,initial:i}=n.activationState;if((t=r==null?void 0:r())!=null&&t!==null||(t=i),e){let o,s=[],a=0;const l=u=>{if(s.length>0){let c,d,h,p=!1,f=!1;u?(c=u.changes,d=u.value,p=u.loading,f=u.remote,h=u.getPrevious):(c=s,d=o,h=uc(d,c)),s=[],o=void 0,It.pendingNodes.delete(n),a++;const m=a,g=()=>{m===a&&(n.isComputing=!0,e({value:d,changes:c,loading:p,remote:f,getPrevious:h}),n.isComputing=!1)};_m(n.state.isLoaded,g)}};gr(n,({value:u,changes:c})=>{n.isComputing||(c.length>1||!ft(c[0].prevAtPath))&&(o=u,s.length>0&&(c=c.filter(d=>!hm(s[0].path,d.path))),s.push(...c),It.pendingNodes.set(n,l))},{immediate:!0}),gr(n,l)}}return{update:({value:e})=>{n.isComputing||(n.isComputing=!0,In(n,e),n.isComputing=!1)},value:t}}function mc(n,t){var e;const r=Na(t);return r!==n&&(r==null?void 0:r.linkedToNode)!==n&&(n.linkedToNode=r,r.linkedFromNodes||(r.linkedFromNodes=new Set),r.linkedFromNodes.add(n),(e=n.linkedToNodeDispose)==null||e.call(n),n.linkedToNodeDispose=gr(r,()=>{t=Wr(r),In(n,t)},{initial:!0},new Set([n]))),t}function bm(n,t,e){var r;if((De(n)||qt(n))&&!n[zi]){for(const i in n)if(Zf.call(n,i)){const o=n[i];if(wt(o)){const s=e();qi(s,i,o),delete s.lazy}else{const s=ft(o)&&((r=o.prototype)==null?void 0:r[rs]);if(s){const a=s.activate;(!a||a==="auto")&&Ji(dn(e(),i,o))}}typeof o=="object"&&(t.push({key:i,value:o}),bm(o,t,e),t.pop())}}}var Im=["get","set","peek","onChange","toggle"];function Gr(n){this._node=n;for(let t=0;t<Im.length;t++){const e=Im[t];this[e]=this[e].bind(this)}}function xa(n,t){Gr.prototype[n]=function(...e){return t.call(this,this._node,...e)}}function Pt(n){return cc(n,0,Ki,He,Gr)}function VO(n,t,e){const r=function(i,o){const{backoff:s,delay:a=1e3,infinite:l,times:u=3,maxDelay:c=3e4}=i;return l||o<u?Math.min(a*(s==="constant"?1:2**o),c):null}(n,t);if(r)return setTimeout(e,r)}xa("peek",n=>(fc(),Ji(n))),xa("get",(n,t)=>(fc(),ka(n,t))),xa("set",In),xa("onChange",gr),Object.defineProperty(Gr.prototype,Yi,{configurable:!0,get(){return this._node}}),Gr.prototype.toggle=function(){const n=this.peek();(n==null||Qf(n))&&this.set(!n)},Gr.prototype.delete=function(){return this.set(void 0),this};var wm={createPreviousHandler:uc,clone:im,ensureNodeValue:oc,findIDKey:sm,get:ka,getNode:Na,getNodeValue:kt,getPathType:em,getProxy:He,getValueAtPath:function(n,t){return t.reduce(PO,n)},globalState:It,initializePathType:dm,observableFns:Ra,optimized:ic,peek:Ji,runWithRetry:function(n,t,e){const{waitFor:r}=n.activationState,{retry:i}=t,o={cancel:!1};let s;if(s=r?_m(r,()=>(n.activationState.waitFor=void 0,e(o))):e(o),ke(s)&&i){let a;return new Promise(l=>{const u=()=>{s.then(c=>{n.activationState.persistedRetry=!1,l(c)}).catch(()=>{t.attemptNum++,a&&clearTimeout(a),o.cancel||(a=VO(i,t.attemptNum,()=>{s=e(o),u()}))}).finally(()=>{n.activationState.persistedRetry=!1})};u()})}return s},safeParse:rm,safeStringify:nm,set:In,setAtPath:cm,setNodeValue:bn,symbolLinked:rs,symbolDelete:ns,tracking:Gi},Rm={exports:{}},Dm={},Zi=pO(qu),WO=typeof Object.is=="function"?Object.is:function(n,t){return n===t&&(n!==0||1/n==1/t)||n!=n&&t!=t},GO=Zi.useState,XO=Zi.useEffect,KO=Zi.useLayoutEffect,qO=Zi.useDebugValue;function gc(n){var t=n.getSnapshot;n=n.value;try{var e=t();return!WO(n,e)}catch(r){return!0}}var JO=typeof window=="undefined"||window.document===void 0||window.document.createElement===void 0?function(n,t){return t()}:function(n,t){var e=t(),r=GO({inst:{value:e,getSnapshot:t}}),i=r[0].inst,o=r[1];return KO(function(){i.value=e,i.getSnapshot=t,gc(i)&&o({inst:i})},[n,e,t]),XO(function(){return gc(i)&&o({inst:i}),n(function(){gc(i)&&o({inst:i})})},[n]),qO(e),e};Dm.useSyncExternalStore=Zi.useSyncExternalStore!==void 0?Zi.useSyncExternalStore:JO,Rm.exports=Dm;var ZO=Rm.exports,Ec={inObserver:!1},km=void 0;function Et(n,t){if(Ec.inObserver&&wt(n)&&!(t!=null&&t.suspense))return is(n);let e;try{const r=Re(km||(km=nn(null))),i=at(()=>function(l,u){let c,d,h,p,f,m=0;const g=()=>{d==null||d();const{value:A,dispose:v,resubscribe:_}=Em(h,E,void 0,void 0);return d=v,A},E=({value:A})=>{if(u!=null&&u.peek()){const v=f;f=A,v===void 0&&vm(()=>!u.get(),()=>{const _=f;f=void 0,E({value:_})})}else{let v=l==null?void 0:l.skipCheck;if(!v){const _=g();(_!==p||!rn(_)&&_===A)&&(v=!0)}v&&(m++,c==null||c())}};return{subscribe:A=>(c=A,()=>{d==null||d(),d=void 0}),getVersion:()=>m,run:A=>(h=A,p=g())}}(t,r),[]),{subscribe:o,getVersion:s,run:a}=i;e=a(n),ZO.useSyncExternalStore(o,s,s)}catch(r){throw r}if(t!=null&&t.suspense){const r=ke(e);if(ke(e)||!e&&wt(n)){const i=r?e:vm(n);if(!Ot.use)throw i;Ot.use(i)}}return e}var Lm=typeof Symbol=="function"&&Symbol.for;function xm(n,t,e,r){const i=Lm?Symbol.for("react.forward_ref"):et(h=>null).$$typeof,o=Lm?Symbol.for("react.memo"):Fi(h=>null).$$typeof;if(n.__legend_proxied)return n;let s=!1,a=!1,l=n;o&&l.$$typeof===o&&l.type&&(a=!0,l=l.type),i&&l.$$typeof===i&&(s=!0,l=l.render);const u={apply(h,p,f){if(e){const m=f[0],g={},E=Object.keys(m);for(let A=0;A<E.length;A++){const v=E[A],_=m[v];if(v==="children"&&(ft(_)||wt(_)))m[v]=Et(_,{skipCheck:!0});else if(v.startsWith("$")||v.endsWith("$")){const O=v.endsWith("$")?v.slice(0,-1):v.slice(1),T=r==null?void 0:r[O],S=T&&wt(_);if(g[O]=S&&(T!=null&&T.selector)?T.selector(g,_):Et(_),S&&(T.defaultValue!==void 0&&g[O]===void 0&&(g[O]=T.defaultValue),T.handler&&T.getValue)){const N=y=>{var w;_.set(T.getValue(y)),(w=m[T.handler])==null||w.call(m,y)};g[T.handler]=rt(N,[m[T.handler],r])}delete g[v]}else g[v]===void 0&&(g[v]=_)}f[0]=g}return t?Et(()=>{Ec.inObserver=!0;try{return Reflect.apply(h,p,f)}finally{Ec.inObserver=!1}},{skipCheck:!0}):Reflect.apply(h,p,f)}},c=new Proxy(l,u);let d;return s?(d=et(c),d.__legend_proxied=!0):d=c,t||a?Fi(d):d}var{findIDKey:QO,getNode:tS,optimized:eS}=wm,Mm=new Map;function Ac({each:n,optimized:t,item:e,itemProps:r,sortValues:i,children:o}){var s;if(!n)return null;const a=Et(()=>n.get(!t||eS));if(!e&&o){const u=X();u.current=o,e=at(()=>{return c=({item$:d,id:h})=>u.current(d,h),xm(c,!0);var c},[])}else if(e.$$typeof!==Symbol.for("react.memo")){let u=Mm.get(e);u||(u=Fi(e),Mm.set(e,u)),e=u}if(!a)return null;const l=[];if(qt(a)){const u=a[0],c=tS(n),d=a.length,h=d>0?c&&QO(u,c)||(u.id!==void 0?"id":u.key!==void 0?"key":void 0):void 0,p=ft(h);for(let f=0;f<d;f++)if(a[f]){const m=a[f],g=(s=p?h(m):m[h])!=null?s:f,E=n[f],A={key:g,id:g,item$:E,item:E};l.push(ht(e,r?Object.assign(A,r):A))}}else{const u=Ue(a),c=u?Array.from(a.keys()):Object.keys(a);i&&c.sort((d,h)=>i(u?a.get(d):a[d],u?a.get(h):a[h],d,h));for(let d=0;d<c.length;d++){const h=c[d];if(u?a.get(h):a[h]){const p=u?n.get(h):n[h],f={key:h,id:h,item$:p,item:p};l.push(ht(e,r?Object.assign(f,r):f))}}}return l}Fi(function({children:n}){return Et(()=>is(is(n)),{skipCheck:!0})},()=>!0);var nS=new Map,rS=new Map;function Er(n,t){var e;const r=X({});if(r.current.value=n,!((e=r.current)!=null&&e.obs$)){const i=n;r.current.obs$=Pt(i)}return r.current.obs$}new Proxy({},{get(n,t){if(!n[t]){const i=nS.get(t)||t,o=et((s,a)=>{const l={...s};return!a||!ft(a)&&ji(a)||(l.ref=a),ht(i,l)});n[t]=(e=o,r=rS.get(t),xm(e,!1,!0,r))}var e,r;return n[t]}});var iS=function(n){J(()=>{const t=n();if(!ke(t))return t},[])};function Qi(n,t,e){let r;ft(t)?r=t:e=t;const i=X({selector:n});i.current={selector:n,reaction:r},iS(()=>us(o=>{const{selector:s}=i.current;return ft(s)?s(o):s},o=>{var s,a;return(a=(s=i.current).reaction)==null?void 0:a.call(s,o)},e))}const oS=Symbol("no_render");function $e(n){const t=Er(!1),e=X({_value:typeof n=="function"?n():n.peek(),get value(){return setTimeout(()=>{t.set(!0)}),e.current._value},set value(r){e.current._value=r}});return Et(()=>{if(!t.get())return oS;const r=typeof n=="function"?n():n.get();return e.current.value=r,r}),e.current}function to(){const n=es(),t=bt(),e=$i(),r=cn(),i=$e(t.app$.appMetadata),o=$e(t.currentUser$),s=$e(t.state$.currentConversation),a=$e(t.t$),l=$e(t.device$),u=$e(t.themeCustom$),c=$e(()=>t.state$.typing.child(t.state$.extCurrentConversationId.get()).get()),d=$e(()=>t.state$.participants.child(t.state$.extCurrentConversationId.get()).get());return at(()=>({session:n,store:t,chatbox:e,theme:r,get app(){return i.value},get currentUser(){return o.value},get conversation(){return s.value},get t(){return a.value},get device(){return l.value},get themeCustom(){return u.value.value},get typing(){return c.value},get participants(){return d.value}}),[i,e,s,o,l,t,a,r,u,c,d,n])}function Pm(){const n=es(),t=bt(),e=cn(),r=$i(),i=$e(t.app$.appMetadata),o=$e(t.currentUser$),s=$e(t.t$),a=$e(t.device$),l=$e(t.themeCustom$);return at(()=>({session:n,store:t,theme:e,conversationList:r,get app(){return i.value},get currentUser(){return o.value},get t(){return s.value},get device(){return a.value},get themeCustom(){return l.value.value}}),[i,r,o,a,n,t,s,e,l])}class Ma{constructor(t={}){this._handlers=new Set,this._meta=t}meta(t){return new Ma(t)}_emit(t,e){for(const r of this._handlers)r({level:t,data:e,timestamp:Date.now(),meta:this._meta})}error(...t){return this._emit("error",t)}warn(...t){return this._emit("warn",t)}info(...t){return this._emit("info",t)}log(...t){return this._emit("log",t)}trace(...t){return this._emit("trace",t)}registerHandler(t){return this._handlers.add(t),()=>this._handlers.delete(t)}}const vc=new Ma,Jn=new Ma,M={code:"en-US",name:"English (US)",translation:{YESTERDAY:"Yesterday",TODAY:"Today",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"just now",LOCATION:"Location",CANCEL:"Cancel",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browser notifications",DESKTOP_NOTIFICATIONS_ERROR:"Can't enable browser notifications because your browser actively blocks them. Try looking in the settings or using a different browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notification`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"If you keep your browser tab open, you'll see this pop up when someone talks to you.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Only 10,000 characters are allowed.",ENTRYBOX_PLACEHOLDER:"Say something...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"This conversation is no longer active.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"You can read, but not send messages.",MESSAGELIST_LOADING_OLDER:"Loading older messages...",MESSAGELIST_SHOW_OLDER:"Show older messages",MESSAGELIST_NEW_MARKER:"New",MESSAGE_SENT_VIA_EMAIL:"This message was sent via email",YOU_MARKER:"you",UPLOAD_IN_PROGRESS:"Uploading...",UPLOAD_SEND_FILE:"Send file",UPLOAD_SHARE_LOCATION:"Share location",UPLOAD_ERROR:"Unfortunately, something went wrong uploading. The file might be unsupported or too large.",SHARE_LOCATION_ERROR:"Cannot share location: ",LOADING:"Loading...",HUB_EMPTY:"Your chat history will show up here",HUB_SHOW_EARLIER:"Show earlier chats",INBOX_NO_CHATS_TITLE:"No chats yet!",INBOX_NO_CHATS_BODY:"Once you've had one or more conversations, they will show up here.",ENABLE_TRANSLATION:"Translate this conversation to English",DISABLE_TRANSLATION:"Show original",SEARCH_PLACEHOLDER_TEXT:"Search...",SEARCH_SEARCHING:"Searching...",SEARCH_NO_RESULTS:"No results found",SEARCH_NO_MORE_RESULTS:"No more results",CHAT_NOT_FOUND:"Chat not found",DELETE_MESSAGE:"Delete message",DELETION_EXPLANATION:"If you delete this message, it will disappear for everybody.",EDIT_MESSAGE:"Edit message",SAVE:"Save",EDITED_INDICATOR:"edited",REPLY_TO_MESSAGE:"Reply",REPLY_TO_ARIA_LABEL:(n,t)=>`Replying to ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Exit reply mode",ADD_REACTION:"Add reaction",AUTH_EXPIRED_OVERLAY_TITLE:"Your chat session has expired",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Refresh the page to continue",VOICE_MESSAGE:"Voice message",LEAVE_CONVERSATION:"Leave conversation",MARK_CONVERSATION_AS_UNREAD:"Mark as unread",STATUS_INDICATOR_ONLINE:"Active",STATUS_INDICATOR_OFFLINE:"Away",CONTACT_INFORMATION_HIDDEN:"hidden information"}},sS={code:"ar",name:"Arabic",translation:{YESTERDAY:"الأمس",TODAY:"اليوم",DAYS:"يوم",HOURS:"ساعة",MINUTES:"دقيقة",JUST_NOW:"فقط الآن",LOCATION:"الموقع",CANCEL:"إلغاء",INBOX:"علبة الوارد",DESKTOP_NOTIFICATIONS:"إشعارات المتصفح",DESKTOP_NOTIFICATIONS_ERROR:"لا يمكن تمكين إشعارات المتصفح لأن متصفحك يمنعها بشكل نشط. جرّب البحث في الإعدادات أو استخدام متصفح آخر.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`إعلام ${n} التجريبي`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"إذا أبقيت علامة تبويب المتصفح مفتوحة ، فسترى هذا ينبثق عندما يتحدث شخص معك.",SEND_BUTTON_TEXT:"إرسال",ENTRYBOX_TEXT_LIMIT:"يُسمح فقط بـ 10.000 حرف.",ENTRYBOX_PLACEHOLDER:"قل شيئًا ...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"هذه المحادثة لم تعد نشطة.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"يمكنك القراءة ، لكن لا يمكنك إرسال الرسائل.",MESSAGELIST_LOADING_OLDER:"جارٍ تحميل الرسائل القديمة ...",MESSAGELIST_SHOW_OLDER:"عرض الرسائل الأقدم",MESSAGELIST_NEW_MARKER:"جديد",MESSAGE_SENT_VIA_EMAIL:"تم إرسال هذه الرسالة عبر البريد الإلكتروني",YOU_MARKER:"أنت",UPLOAD_IN_PROGRESS:"جارٍ التحميل ...",UPLOAD_SEND_FILE:"إرسال ملف",UPLOAD_SHARE_LOCATION:"مشاركة الموقع",UPLOAD_ERROR:"حدث خطأ ما في تحميل شيء. ربما يكون الملف غير متوافق أو كبير جدًا.",SHARE_LOCATION_ERROR:"لا يمكن مشاركة الموقع:",LOADING:"جارٍ التحميل ...",HUB_EMPTY:"سوف يظهر سجل الدردشات هنا",HUB_SHOW_EARLIER:"إظهار الدردشات السابقة",INBOX_NO_CHATS_TITLE:"لا توجد دردشات بعد!",INBOX_NO_CHATS_BODY:"بمجرد أن يكون لديك واحد أو أكثر من المحادثات ، سوف تظهر هنا.",ENABLE_TRANSLATION:"ترجم هذه المحادثة إلى العربية",DISABLE_TRANSLATION:"إظهار الأصلي",SEARCH_PLACEHOLDER_TEXT:"...بحث",SEARCH_SEARCHING:"...يتم الآن البحث",SEARCH_NO_RESULTS:"لم يتم العثور على نتائج",SEARCH_NO_MORE_RESULTS:"لا يوجد المزيد من النتائج",CHAT_NOT_FOUND:"لم يتم العثور على الدردشة",DELETE_MESSAGE:"احذف الرسالة",DELETION_EXPLANATION:"إذا قمت بحذف هذه الرسالة، فهي ستختفي للجميع.",EDIT_MESSAGE:"تعديل الرسالة",SAVE:"حفظ",EDITED_INDICATOR:"معدّلة",REPLY_TO_MESSAGE:"رد",ADD_REACTION:"أضف تفاعلاً",AUTH_EXPIRED_OVERLAY_TITLE:"انتهت جلسة الدردشة المخصصة لك",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"يُرجى إعادة تحميل الصفحة للمتابعة",VOICE_MESSAGE:"رسالة صوتية",CONTACT_INFORMATION_HIDDEN:"المعلومات المخفية",LEAVE_CONVERSATION:"الخروج من المحادثة",MARK_CONVERSATION_AS_UNREAD:"وضع علامة غير مقروءة",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},aS={code:"bg-BG",name:"Bulgarian",translation:{YESTERDAY:"Вчера",TODAY:"Днес",DAYS:"Ден",HOURS:"Час",MINUTES:"m",JUST_NOW:"Току-що",LOCATION:"местоположението",CANCEL:"Откажи",INBOX:"Кутия",DESKTOP_NOTIFICATIONS:"Известия на браузъра",DESKTOP_NOTIFICATIONS_ERROR:"Не можете да активирате известията на браузъра, защото браузърът ви ги блокира активно. Опитайте да погледнете в настройките или да използвате друг браузър.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} демо известие`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ако държите раздела на браузъра си отворен, ще видите този изскачащ прозорец, когато някой говори с вас.",SEND_BUTTON_TEXT:"Изпрати",ENTRYBOX_TEXT_LIMIT:"Разрешени са само до 10.000 знака.",ENTRYBOX_PLACEHOLDER:"Кажете нещо...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Този ​​разговор вече не е активен.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Можете да четете, но не и да изпращате съобщения.",MESSAGELIST_LOADING_OLDER:"Зареждане на по-стари съобщения...",MESSAGELIST_SHOW_OLDER:"Показване на по-стари съобщения",MESSAGELIST_NEW_MARKER:"Нови",MESSAGE_SENT_VIA_EMAIL:"Това съобщение беше изпратено по имейл",YOU_MARKER:"Вие",UPLOAD_IN_PROGRESS:"Качване...",UPLOAD_SEND_FILE:"Изпращане на файл",UPLOAD_SHARE_LOCATION:"Споделяне на местоположението",UPLOAD_ERROR:"За съжаление нещо се обърка при качването. Файлът може да не се поддържа или е твърде голям.",SHARE_LOCATION_ERROR:"Не може да се сподели местоположението: ",LOADING:"Зареждане...",HUB_EMPTY:"Историята на вашите разговори ще се покаже тук",HUB_SHOW_EARLIER:"Показване на по-ранни чатове",INBOX_NO_CHATS_TITLE:"Все още нямате разговори!",INBOX_NO_CHATS_BODY:"След като проведете един или повече разговори, те ще се покажат тук.",ENABLE_TRANSLATION:"Преведете този разговор на български",DISABLE_TRANSLATION:"Показване на оригинал",SEARCH_PLACEHOLDER_TEXT:"Търсене...",SEARCH_SEARCHING:"Търсене...",SEARCH_NO_RESULTS:"Няма намерени резултати",SEARCH_NO_MORE_RESULTS:"Няма повече резултати",CHAT_NOT_FOUND:"Чатът не е намерен",DELETE_MESSAGE:"Изтриване на съобщение",DELETION_EXPLANATION:"Ако изтриете това съобщение, то ще изчезне за всички.",EDIT_MESSAGE:"Редактиране на съобщението",SAVE:"Запиши",EDITED_INDICATOR:"редактирано",REPLY_TO_MESSAGE:"Отговори",ADD_REACTION:"Добави реакция",AUTH_EXPIRED_OVERLAY_TITLE:"Вашата чат сесия е изтекла",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Обновете страницата, за да продължите",VOICE_MESSAGE:"Гласово съобщение",CONTACT_INFORMATION_HIDDEN:"Скрита информация",LEAVE_CONVERSATION:"Напускане на разговора",MARK_CONVERSATION_AS_UNREAD:"Маркирай като непрочетено",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},lS={code:"bs-BA",name:"Bosnian",translation:{YESTERDAY:"Jučer",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Obavijesti preglednika",DESKTOP_NOTIFICATIONS_ERROR:"Notifikacije preglednika se ne mogu omogućiti jer ih vaš preglednik aktivno blokira. Pokušajte pregledati postavke ili koristiti drugi preglednik.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu preglednika ostavite otvorenu, pojavit će se ovaj pop-up kada netko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Reci nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možeš čitati, ali ne i slati poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana e-poštom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podijeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podijeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovdje će se prikazati vaša povijest razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovdje.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na bosanski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Ćaskanje nije pronađeno",DELETE_MESSAGE:"Obriši poruku",DELETION_EXPLANATION:"Ako izbrišete ovu poruku, ona će nestati za sve.",EDIT_MESSAGE:"Uredi poruku",SAVE:"Sačuvati",EDITED_INDICATOR:"uređeno",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodajte reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša chat sesija je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvježite stranicu da nastavite",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Skrivene informacije",LEAVE_CONVERSATION:"Napusti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitano",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},uS={code:"ca-ES",name:"Catalan (ES)",translation:{YESTERDAY:"Ahir",TODAY:"Avui",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"ara mateix",LOCATION:"Ubicació",CANCEL:"Cancel·lar",INBOX:"Safata d'entrada",DESKTOP_NOTIFICATIONS:"Notificacions d'escriptori",DESKTOP_NOTIFICATIONS_ERROR:"No es poden habilitar les notificacions del navegador perquè el teu navegador les bloqueja activament. Prova de buscar a la configuració o utilitza un altre navegador.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notificació de demostració de ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si mantens la pestanya del navegador oberta, veuràs aquesta notificació quan algú et parli.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Només es permeten 10.000 caràcters.",ENTRYBOX_PLACEHOLDER:"Digues alguna cosa...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Aquesta conversa ja no està activa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Pots llegir, però no enviar missatges.",MESSAGELIST_LOADING_OLDER:"Carregant missatges antics...",MESSAGELIST_SHOW_OLDER:"Mostrar missatges més antics",MESSAGELIST_NEW_MARKER:"Nou",MESSAGE_SENT_VIA_EMAIL:"Aquest missatge s'ha enviat per correu electrònic",YOU_MARKER:"tu",UPLOAD_IN_PROGRESS:"S'està pujant...",UPLOAD_SEND_FILE:"Enviar arxiu",UPLOAD_SHARE_LOCATION:"Compartir ubicació",UPLOAD_ERROR:"Desafortunadament, alguna cosa ha anat malament en pujar. L'arxiu pot ser no compatible o massa gran.",SHARE_LOCATION_ERROR:"No es pot compartir la ubicació: ",LOADING:"Carregant...",HUB_EMPTY:"El teu historial de xat apareixerà aquí",HUB_SHOW_EARLIER:"Mostra xats anteriors",INBOX_NO_CHATS_TITLE:"Encara no hi ha xats!",INBOX_NO_CHATS_BODY:"Un cop hagis tingut una o més converses, apareixeran aquí.",ENABLE_TRANSLATION:"Traduir aquesta conversa al català",DISABLE_TRANSLATION:"Mostrar original",SEARCH_PLACEHOLDER_TEXT:"Cerca...",SEARCH_SEARCHING:"Buscant...",SEARCH_NO_RESULTS:"No s'han trobat resultats",SEARCH_NO_MORE_RESULTS:"No hi ha més resultats",CHAT_NOT_FOUND:"Xat no trobat",DELETE_MESSAGE:"Esborrar missatge",DELETION_EXPLANATION:"Si esborres aquest missatge, desapareixerà per a tothom.",EDIT_MESSAGE:"Editar missatge",SAVE:"Desar",EDITED_INDICATOR:"editat",REPLY_TO_MESSAGE:"Respondre",REPLY_TO_ARIA_LABEL:(n,t)=>`Responent a ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Sortir del mode de resposta",ADD_REACTION:"Afegir reacció",VOICE_MESSAGE:"Missatge de veu",LEAVE_CONVERSATION:"Abandonar la conversa",MARK_CONVERSATION_AS_UNREAD:"marcar com no llegit",STATUS_INDICATOR_ONLINE:"Actiu",STATUS_INDICATOR_OFFLINE:"Absent",CONTACT_INFORMATION_HIDDEN:"informació oculta",AUTH_EXPIRED_OVERLAY_TITLE:"La teva sessió de xat ha caducat",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualitza la pàgina per continuar"}},cS={code:"cs-CZ",name:"Czech",translation:{YESTERDAY:"Včera",TODAY:"Dnes",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"právě teď",LOCATION:"Lokace",CANCEL:"Zrušit",INBOX:"Doručené",DESKTOP_NOTIFICATIONS:"Oznámení v prohlížeči",DESKTOP_NOTIFICATIONS_ERROR:"Nelze povolit notifikace prohlížeče, protože váš prohlížeč je aktivně blokuje. Zkuste se podívat na nastavení nebo zkuste použít jiný prohlížeč.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikace`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Pokud necháte kartu prohlížeče otevřenou, uvidíte tento popup jakmile s vámi bude někdo mluvit.",SEND_BUTTON_TEXT:"Odeslat",ENTRYBOX_TEXT_LIMIT:"Je povoleno Maximálně 10.000 znaků.",ENTRYBOX_PLACEHOLDER:"Napište něco...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Tato konverzace již není aktivní.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Můžete číst, ale nemůžete posílat zprávy.",MESSAGELIST_LOADING_OLDER:"Nahrávám starší zprávy...",MESSAGELIST_SHOW_OLDER:"Zobrazit starší zprávy",MESSAGELIST_NEW_MARKER:"Nové",MESSAGE_SENT_VIA_EMAIL:"Tato zpráva byla odeslána přes mail.",YOU_MARKER:"vy",UPLOAD_IN_PROGRESS:"Nahrávám...",UPLOAD_SEND_FILE:"Poslat soubor",UPLOAD_SHARE_LOCATION:"Sdílet pozici",UPLOAD_ERROR:"Nepodařilo se nahrát soubor. Ten je buď nepodporován a/nebo příliš velký.",SHARE_LOCATION_ERROR:"Není možné sdílet pozici: ",LOADING:"Nahrávám...",HUB_EMPTY:"Vaše historie se zde zobrazí",HUB_SHOW_EARLIER:"Zobrazit dřívější konverzace",INBOX_NO_CHATS_TITLE:"Zatím zde nejsou žádné konverzace!",INBOX_NO_CHATS_BODY:"Jakmile budete mít jednu nebo více konverzací, objeví se zde.",ENABLE_TRANSLATION:"Přeložit tuto konverzaci do češtiny",DISABLE_TRANSLATION:"Zobrazit původní",SEARCH_PLACEHOLDER_TEXT:"Hledat...",SEARCH_SEARCHING:"Hledání...",SEARCH_NO_RESULTS:"Nenašly se žádné výsledky",SEARCH_NO_MORE_RESULTS:"Žádné další výsledky",CHAT_NOT_FOUND:"Chat nenalezen",DELETE_MESSAGE:"Smazat zprávu",DELETION_EXPLANATION:"Pokud tuto zprávu smažete, zmizí pro všechny.",EDIT_MESSAGE:"Upravit zprávu",SAVE:"Uložit",EDITED_INDICATOR:"upraveno",REPLY_TO_MESSAGE:"Odpovědět",ADD_REACTION:"Reagovat",AUTH_EXPIRED_OVERLAY_TITLE:"Váš chat byl kvůli nečinnosti odpojen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Pro pokračování obnovte stránku",VOICE_MESSAGE:"Hlasová zpráva",CONTACT_INFORMATION_HIDDEN:"Skrytá informace",LEAVE_CONVERSATION:"Opustit konverzaci",MARK_CONVERSATION_AS_UNREAD:"Označit jako nepřečtené",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},dS={code:"da-DK",name:"Danish",translation:{YESTERDAY:"I går",TODAY:"I dag",DAYS:"d",HOURS:"t",MINUTES:"m",JUST_NOW:"lige nu",LOCATION:"Placering",CANCEL:"Annuller",INBOX:"Indbakke",DESKTOP_NOTIFICATIONS:"Browsermeddelelser",DESKTOP_NOTIFICATIONS_ERROR:"Kan ikke aktivere Browsermeddelelser, fordi din browser aktivt blokerer dem. Prøv at kigge i indstillingerne eller benyt en anden browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demomeddelelse`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Hvis du holder dit browser-faneblad åben, vil du se det her komme op, når nogen taler til dig.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Kun 10.000 tegn er tilladt.",ENTRYBOX_PLACEHOLDER:"Sig noget...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Denne samtale er ikke længere aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan læse, men ikke sende beskeder.",MESSAGELIST_LOADING_OLDER:"Indlæser ældre beskeder...",MESSAGELIST_SHOW_OLDER:"Vis ældre beskeder",MESSAGELIST_NEW_MARKER:"Ny",MESSAGE_SENT_VIA_EMAIL:"Denne besked blev sendt via e-mail",YOU_MARKER:"dig",UPLOAD_IN_PROGRESS:"Overfører...",UPLOAD_SEND_FILE:"Send fil",UPLOAD_SHARE_LOCATION:"Del placering",UPLOAD_ERROR:"Der er sket noget forkert ved upload. Filen kan ikke understøttes eller filen er for stor.",SHARE_LOCATION_ERROR:"Kan ikke dele placering: ",LOADING:"Indlæser...",HUB_EMPTY:"Dine samtaler vises her",HUB_SHOW_EARLIER:"Vis tidligere chats",INBOX_NO_CHATS_TITLE:"Ingen chats endnu!",INBOX_NO_CHATS_BODY:"Når du har haft en eller flere samtaler, vises de her.",ENABLE_TRANSLATION:"Oversæt denne konversation til dansk",DISABLE_TRANSLATION:"Vis den oprindelige",SEARCH_PLACEHOLDER_TEXT:"Søg...",SEARCH_SEARCHING:"Søger...",SEARCH_NO_RESULTS:"Ingen resultater fundet",SEARCH_NO_MORE_RESULTS:"Ikke flere resultater",CHAT_NOT_FOUND:"Chat ikke fundet",DELETE_MESSAGE:"Slet besked",DELETION_EXPLANATION:"Hvis du sletter denne besked, vil ingen kunne se den.",EDIT_MESSAGE:"Rediger besked",SAVE:"Gem",EDITED_INDICATOR:"redigeret",REPLY_TO_MESSAGE:"Svar",ADD_REACTION:"Tilføj reaktion",AUTH_EXPIRED_OVERLAY_TITLE:"Din chatsession er udløbet",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Opdater siden for at fortsætte",VOICE_MESSAGE:"Talebesked",CONTACT_INFORMATION_HIDDEN:"Skjulte oplysninger",LEAVE_CONVERSATION:"Forlad samtale",MARK_CONVERSATION_AS_UNREAD:"Marker som ulæst",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},hS={code:"de-DE",name:"German",translation:{YESTERDAY:"Gestern",TODAY:"Heute",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"gerade jetzt",LOCATION:"Standort",CANCEL:"Abbrechen",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browser-Benachrichtigungen",DESKTOP_NOTIFICATIONS_ERROR:"Browser-Benachrichtigungen können nicht aktiviert werden, da Ihr Browser sie aktiv blockiert. Versuchen Sie, in den Einstellungen nachzuschlagen oder einen anderen Browser zu verwenden.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} Demo-Benachrichtigung`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Wenn Sie Ihre Browser-Registerkarte geöffnet lassen, wird dies angezeigt, wenn jemand mit Ihnen spricht.",SEND_BUTTON_TEXT:"Senden",ENTRYBOX_TEXT_LIMIT:"Nur 10.000 Zeichen sind erlaubt.",ENTRYBOX_PLACEHOLDER:"Sag etwas...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Diese Konversation ist nicht mehr aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Sie können Nachrichten lesen, aber nicht senden.",MESSAGELIST_LOADING_OLDER:"Ältere Nachrichten werden geladen...",MESSAGELIST_SHOW_OLDER:"Zeige ältere Nachrichten",MESSAGELIST_NEW_MARKER:"Neu",MESSAGE_SENT_VIA_EMAIL:"Diese Nachricht wurde per E-Mail gesendet",YOU_MARKER:"du",UPLOAD_IN_PROGRESS:"Hochladen...",UPLOAD_SEND_FILE:"Datei senden",UPLOAD_SHARE_LOCATION:"Standort teilen",UPLOAD_ERROR:"Beim Hochladen ist ein Fehler aufgetreten. Die Datei ist möglicherweise nicht unterstützt oder zu groß.",SHARE_LOCATION_ERROR:"Standort kann nicht freigegeben werden: ",LOADING:"Laden...",HUB_EMPTY:"Ihr Chat-Verlauf wird hier angezeigt",HUB_SHOW_EARLIER:"Zeige frühere Chats",INBOX_NO_CHATS_TITLE:"Noch keine Chats!",INBOX_NO_CHATS_BODY:"Sobald Sie eine oder mehrere Unterhaltungen geführt haben, werden sie hier angezeigt.",ENABLE_TRANSLATION:"Dieses Gespräch auf Deutsch übersetzen",DISABLE_TRANSLATION:"Originaltext anzeigen",SEARCH_PLACEHOLDER_TEXT:"Suche...",SEARCH_SEARCHING:"Suchen...",SEARCH_NO_RESULTS:"Keine Suchergebnisse gefunden",SEARCH_NO_MORE_RESULTS:"Keine weiteren Suchergebnisse",CHAT_NOT_FOUND:"Chat nicht gefunden",DELETE_MESSAGE:"Nachricht löschen",DELETION_EXPLANATION:"Wenn Sie diese Nachricht löschen, wird sie für alle verschwinden.",EDIT_MESSAGE:"Nachricht bearbeiten",SAVE:"Speichern",EDITED_INDICATOR:"bearbeitet",REPLY_TO_MESSAGE:"Antworten",ADD_REACTION:"Reaktion hinzufügen",AUTH_EXPIRED_OVERLAY_TITLE:"Ihre Chatsitzung ist abgelaufen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Laden Sie zum Fortfahren die Seite neu",VOICE_MESSAGE:"Sprachnachricht",CONTACT_INFORMATION_HIDDEN:"Geschützte Angaben",LEAVE_CONVERSATION:"Unterhaltung verlassen",MARK_CONVERSATION_AS_UNREAD:"als ungelesen markieren",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},pS={code:"el-GR",name:"Greek (Greece)",translation:{YESTERDAY:"Χθές",TODAY:"Σήμερα",DAYS:"Ημέρες",HOURS:"'Ωρες",MINUTES:"Λεπτά",JUST_NOW:"Μόλις τώρα",LOCATION:"Τοποθεσία",CANCEL:"Ακύρωση",INBOX:"Εισερχόμενα",DESKTOP_NOTIFICATIONS:"Ειδοποιήσεις περιηγητή",DESKTOP_NOTIFICATIONS_ERROR:"Δεν είναι δυνατή η ενεργοποίηση των ειδοποιήσεων του προγράμματος περιήγησης, επειδή το πρόγραμμα περιήγησης τις αποκλείει ενεργά. Δοκιμάστε να τσεκάρετε τις ρυθμίσεις ή να χρησιμοποιήσετε διαφορετικό πρόγραμμα περιήγησης.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} Δοκιμαστική επίδειξη`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Αν διατηρήσετε ανοιχτή τη σελίδα του προγράμματος περιήγησης, θα δείτε αυτό το pop up (παράθυρο) όταν κάποιος σας μιλάει.",SEND_BUTTON_TEXT:"Αποστολή",ENTRYBOX_TEXT_LIMIT:"Επιτρέπονται μόνο 10.000 χαρακτήρες.",ENTRYBOX_PLACEHOLDER:"Πείτε κάτι...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Αυτή η συζήτηση δεν είναι πλέον ενεργή.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Μπορείτε να διαβάσετε αλλά δεν μπορείτε να στείλετε μηνύματα.",MESSAGELIST_LOADING_OLDER:"Φόρτωση παλαιοτέρων μηνυμάτων...",MESSAGELIST_SHOW_OLDER:"Εμφάνιση παλαιότερων μηνυμάτων",MESSAGELIST_NEW_MARKER:"Νέο",MESSAGE_SENT_VIA_EMAIL:"Αυτό το μήνυμα εστάλη μέσω ηλεκτρονικού ταχυδρομείου",YOU_MARKER:"Εσείς",UPLOAD_IN_PROGRESS:"Ανέβασμα...",UPLOAD_SEND_FILE:"Αποστολή αρχείου",UPLOAD_SHARE_LOCATION:"Κοινή χρήση τοποθεσίας",UPLOAD_ERROR:"Κάτι πήγε στραβά κατά τη φόρτωση. Το αρχείο ενδέχεται να μην υποστηρίζεται ή να είναι υπερβολικά μεγάλο.",SHARE_LOCATION_ERROR:"Δεν είναι δυνατή η χρήση κοινής τοποθεσίας: ",LOADING:"Φόρτωση...",HUB_EMPTY:"Το ιστορικό των συνομιλιών σας θα εμφανιστεί εδώ",HUB_SHOW_EARLIER:"Εμφάνιση προηγούμενων συνομιλιών",INBOX_NO_CHATS_TITLE:"Δεν υπάρχουν ακόμα συζητήσεις!",INBOX_NO_CHATS_BODY:"Μόλις έχετε μία ή περισσότερες συνομιλίες, θα εμφανιστούν εδώ.",ENABLE_TRANSLATION:"Μετάφραση αυτής της συνομιλίας στα ελληνικά",DISABLE_TRANSLATION:"Προβολή πρωτοτύπου",SEARCH_PLACEHOLDER_TEXT:"Αναζήτηση...",SEARCH_SEARCHING:"Αναζήτηση...",SEARCH_NO_RESULTS:"Δεν βρέθηκαν αποτελέσματα",SEARCH_NO_MORE_RESULTS:"Δεν υπάρχουν περισσότερα αποτελέσματα",CHAT_NOT_FOUND:"Η συνομιλία δεν βρέθηκε",DELETE_MESSAGE:"Διαγραφή μηνύματος",DELETION_EXPLANATION:"Εάν διαγράψετε αυτό το μήνυμα, θα εξαφανιστεί για όλους.",EDIT_MESSAGE:"Επεξεργασία μηνύματος",SAVE:"Αποθήκευση",EDITED_INDICATOR:"επεξεργασμένο",REPLY_TO_MESSAGE:"Απάντηση",ADD_REACTION:"Προσθήκη αντίδρασης",AUTH_EXPIRED_OVERLAY_TITLE:"Η συνεδρία της συνομιλίας σας έχει λήξει",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Ανανεώστε τη σελίδα για να συνεχίσετε",VOICE_MESSAGE:"Ηχητικό μήνυμα",CONTACT_INFORMATION_HIDDEN:"Κρυμμένες πληροφορίες",LEAVE_CONVERSATION:"Αποσυρθείτε από τη συζήτηση",MARK_CONVERSATION_AS_UNREAD:"Επισήμανση ως μη αναγνωσμένα",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},fS={code:"es-ES",name:"Spanish",translation:{YESTERDAY:"Ayer",TODAY:"Hoy",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"justo ahora",LOCATION:"Ubicación",CANCEL:"Cancelar",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Notificaciones del navigator",DESKTOP_NOTIFICATIONS_ERROR:"No se logró habilitar las notificaciones del navigador, comprueba que tu navegador no las esté bloqueando o intenta con otro navegador.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} notificación de prueba`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si dejas esta pestaña abierta, verás este pop up cuando alguien te hable.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Sólo 10.000 caracteres permitidos.",ENTRYBOX_PLACEHOLDER:"Escribe algo...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Esta conversación ya no está activa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puedes leer pero no enviar mensajes.",MESSAGELIST_LOADING_OLDER:"Cargando mensajes pasados...",MESSAGELIST_SHOW_OLDER:"Ver mensajes pasados",MESSAGELIST_NEW_MARKER:"Nuevo",MESSAGE_SENT_VIA_EMAIL:"Este mensaje ha sido enviado vía email",YOU_MARKER:"tú",UPLOAD_IN_PROGRESS:"Subir...",UPLOAD_SEND_FILE:"Enviar archivo",UPLOAD_SHARE_LOCATION:"Compartir ubicación",UPLOAD_ERROR:"Ocurrió un problema subiendo el archivo. Puede que el archivo esté en un formato no soportado o que sea demasiado grande.",SHARE_LOCATION_ERROR:"No se logró compartir la ubicación: ",LOADING:"Cargando...",HUB_EMPTY:"Tu historial de conversaciones se mostrará aquí",HUB_SHOW_EARLIER:"Ver conversaciones pasadas",INBOX_NO_CHATS_TITLE:"¡Aún sin conversaciones!",INBOX_NO_CHATS_BODY:"Una vez que tengas una o más conversaciones, se mostrarán aquí.",ENABLE_TRANSLATION:"Traducir esta conversación al español",DISABLE_TRANSLATION:"Mostrar la conversación original",SEARCH_PLACEHOLDER_TEXT:"Buscar...",SEARCH_SEARCHING:"Buscando...",SEARCH_NO_RESULTS:"No se encontraron resultados",SEARCH_NO_MORE_RESULTS:"No hay más resultados",CHAT_NOT_FOUND:"Chat no encontrado",DELETE_MESSAGE:"Eliminar mensaje",DELETION_EXPLANATION:"Este mensaje desaparecerá para todos si lo borras.",EDIT_MESSAGE:"Editar mensaje",SAVE:"Guardar",EDITED_INDICATOR:"editado",REPLY_TO_MESSAGE:"Responder",ADD_REACTION:"Añadir reacción",AUTH_EXPIRED_OVERLAY_TITLE:"Su sesión de chat ha expirado",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualice la página para continuar",VOICE_MESSAGE:"Mensaje de voz",CONTACT_INFORMATION_HIDDEN:"Información oculta",LEAVE_CONVERSATION:"Abandonar conversación",MARK_CONVERSATION_AS_UNREAD:"Marcar como no leída",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},mS={code:"et-EE",name:"Estonian",translation:{YESTERDAY:"Eile",TODAY:"Täna",DAYS:"p",HOURS:"t",MINUTES:"m",JUST_NOW:"Just nüüd",LOCATION:"Asukoht",CANCEL:"Katkesta",INBOX:"Postkast",DESKTOP_NOTIFICATIONS:"Veebibrauseri teated",DESKTOP_NOTIFICATIONS_ERROR:"Töölaua teatisi ei saa lubada, kuna Teie brauser blokeerib need aktiivselt. Proovige muuta seadeid või kasutada mõnda muud brauserit.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo teavitus`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Kui hoiate oma brauseri vahekaardi lahti ja näete seda hüpikakent, siis keegi soovib Teiega rääkida.",SEND_BUTTON_TEXT:"Saada",ENTRYBOX_TEXT_LIMIT:"Ainult kuni 10.000 tähemärki on lubatud.",ENTRYBOX_PLACEHOLDER:"Kirjuta midagi...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"See vestlus ei ole enam aktiivne.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Sa saad lugeda teateid, aga mitte kirjutada.",MESSAGELIST_LOADING_OLDER:"Laen vanemaid teateid...",MESSAGELIST_SHOW_OLDER:"Näita vanemaid teateid",MESSAGELIST_NEW_MARKER:"Uus",MESSAGE_SENT_VIA_EMAIL:"See teade on saadetud e-postiga",YOU_MARKER:"Sina",UPLOAD_IN_PROGRESS:"Laen...",UPLOAD_SEND_FILE:"Saada fail",UPLOAD_SHARE_LOCATION:"Jaga faili asukohta",UPLOAD_ERROR:"Nüüd läks midagi nihu, seoses faili ülesse laadimisega. Tundmatu fail või liiga suur.",SHARE_LOCATION_ERROR:"Ei suuda jagada faili asukohta: ",LOADING:"Laen...",HUB_EMPTY:"Siin on Sinu vestluste ajalugu",HUB_SHOW_EARLIER:"Näita vanemaid vestlusi",INBOX_NO_CHATS_TITLE:"Pole ühtegi vestlust!",INBOX_NO_CHATS_BODY:"Kui Sul tekib üks või rohkem vestlust, siis on need kuvatakse siin.",ENABLE_TRANSLATION:"Tõlgi see vestlus eesti keelde",DISABLE_TRANSLATION:"Näita algteksti",SEARCH_PLACEHOLDER_TEXT:"Otsi...",SEARCH_SEARCHING:"Otsin...",SEARCH_NO_RESULTS:"Otsingu tulemused puuduvad",SEARCH_NO_MORE_RESULTS:"Rohkem tulemusi ei ole ",CHAT_NOT_FOUND:"Vestlust ei leitud",DELETE_MESSAGE:"Kustuta sõnum",DELETION_EXPLANATION:"Kui kustutate selle sõnumi, kaob see kõigi jaoks.",EDIT_MESSAGE:"Redigeeri sõnumit",SAVE:"Salvesta",EDITED_INDICATOR:"muudetud",REPLY_TO_MESSAGE:"Vasta",ADD_REACTION:"Lisa reaktsioon",AUTH_EXPIRED_OVERLAY_TITLE:"Teie vestlussessioon on lõppenud",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Jätkamiseks värskendage lehte",VOICE_MESSAGE:"Häälsõnum",CONTACT_INFORMATION_HIDDEN:"Varjatud informatsioon",LEAVE_CONVERSATION:"Lahku vestlusest",MARK_CONVERSATION_AS_UNREAD:"Märgi mitteloetuks",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},gS={code:"fa",name:"Persian (Farsi)",translation:{YESTERDAY:"دیروز",TODAY:"امروز",DAYS:"روز",HOURS:"ساعت",MINUTES:"دقیقه",JUST_NOW:"هم اکنون",LOCATION:"مکان",CANCEL:"لغو",INBOX:"صندوق",DESKTOP_NOTIFICATIONS:"اطلاعیه‌های مرورگر",DESKTOP_NOTIFICATIONS_ERROR:"خطا در فعال سازی اعلان های مرورگر، مرورگر شما آنها را مسدود می کند سعی کنید تنظیمات مرورگر را تغییر دهید یا از یک مرورگر دیگر استفاده کنید.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`نوتیفیکیشن دمو ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"اگر صفحه ی مرورگر را باز نگهدارید این را موقعه ای که کسی با شما صحبت کند خواهید دید",SEND_BUTTON_TEXT:"بفرست",ENTRYBOX_TEXT_LIMIT:"فقط ۱۰،۰۰۰ حروف مجاز می باشد.",ENTRYBOX_PLACEHOLDER:"...چیزی بنویسید",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:".این مکالمه دیگر فعال نمی باشد",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"شما می توانید بخوانید اما نمی توانید پیام بفرستید",MESSAGELIST_LOADING_OLDER:"...در حال بارگذاری پیام های قدیمی تر",MESSAGELIST_SHOW_OLDER:"نشان دادن پیام های قدیمی",MESSAGELIST_NEW_MARKER:"جدید",MESSAGE_SENT_VIA_EMAIL:"پیام توسط ایمل ارسال شد",YOU_MARKER:"شما",UPLOAD_IN_PROGRESS:"...در حال بارگذاری",UPLOAD_SEND_FILE:"فرستادن پوشه",UPLOAD_SHARE_LOCATION:"اشتراک گذاری مکان",UPLOAD_ERROR:"متاسفانه بارگذاری با مشکل روبه رو شد. ممکن است فایل حجیم باشد یا ساپورت نشده باشد.",SHARE_LOCATION_ERROR:"خطا در اشتراک گذاری مکان: ",LOADING:"...بارگذاری",HUB_EMPTY:"تاریخچه گفتگو اینجا نمایان می شود",HUB_SHOW_EARLIER:"دیدن گفتگو های قبلی",INBOX_NO_CHATS_TITLE:"هنوز گفتگویی وجود ندارد",INBOX_NO_CHATS_BODY:"بعد از داشتن یک مکالمه یا بیشتر، آنها اینجا نمایان می شوند.",ENABLE_TRANSLATION:"این مکالمه را به فارسی ترجمه کن",DISABLE_TRANSLATION:"زبان اصلی را نشان بده",SEARCH_PLACEHOLDER_TEXT:"...جستجو",SEARCH_SEARCHING:"...در حال جستجو",SEARCH_NO_RESULTS:"نتیجه ای یافت نشد",SEARCH_NO_MORE_RESULTS:"نتیجه بیشتری وجود ندارد",CHAT_NOT_FOUND:"مکالمه پیدا نشد",DELETE_MESSAGE:"حذف پیام ",DELETION_EXPLANATION:"اگر این پیام را حذف کنید، برای همه ناپدید می شود.",EDIT_MESSAGE:"ویرایش پیام",SAVE:"ذخیره",EDITED_INDICATOR:"ویرایش‌شده",REPLY_TO_MESSAGE:"پاسخ دادن",ADD_REACTION:"واکنش را اضافه کنید",AUTH_EXPIRED_OVERLAY_TITLE:"جلسه چت شما منقضی شده است",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"برای ادامه صفحه را بازخوانی کنید",VOICE_MESSAGE:"پیام صوتی",CONTACT_INFORMATION_HIDDEN:"اطلاعات پنهان",LEAVE_CONVERSATION:"خروج از گفتگو",MARK_CONVERSATION_AS_UNREAD:"به عنوان خوانده نشده علامت گذاری کن",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},ES={code:"fi-FI",name:"Finnish",translation:{YESTERDAY:"Eilen",TODAY:"Tänään",DAYS:"p",HOURS:"t",MINUTES:"m",JUST_NOW:"juuri nyt",LOCATION:"Sijainti",CANCEL:"Peruuta",INBOX:"Saapuneet",DESKTOP_NOTIFICATIONS:"Selaimen ilmoitukset",DESKTOP_NOTIFICATIONS_ERROR:"Työpöydän ilmoituksia ei voitu kytkeä päälle, koska selaimesi estää ne aktiivisesti. Koeta tutkia sen asetuksia tai vaihda selainta.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo ilmoitus`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jos pidät tämän sivun auki, näet vastaavan ilmoituksen kun joku puhuu sinulle.",SEND_BUTTON_TEXT:"Lähetä",ENTRYBOX_TEXT_LIMIT:"Maksimissaan 10000 merkkiä.",ENTRYBOX_PLACEHOLDER:"Sano jotain...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Tämä keskustelu ei ole enää aktiivinen.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Voit lukea, mutta et lähettää viestejä.",MESSAGELIST_LOADING_OLDER:"Ladataan vanhoja viestejä..",MESSAGELIST_SHOW_OLDER:"Näytä vanhat viestit",MESSAGELIST_NEW_MARKER:"Uusi",MESSAGE_SENT_VIA_EMAIL:"Tämä viesti on lähetetty sähköpostin välityksellä",YOU_MARKER:"sinä",UPLOAD_IN_PROGRESS:"Ladataan...",UPLOAD_SEND_FILE:"Lähetä tiedosto",UPLOAD_SHARE_LOCATION:"Jaa sijainti",UPLOAD_ERROR:"Valitettavasti jokin meni vikaan. Tiedostotyyppiä ei ehkä tueta tai se saattaa olla liian suuri.",SHARE_LOCATION_ERROR:"Sijaintia ei pystytty jakamaan: ",LOADING:"Ladataan...",HUB_EMPTY:"Keskusteluhistoriasi näkyy tässä",HUB_SHOW_EARLIER:"Näytä aiemmat keskustelut",INBOX_NO_CHATS_TITLE:"Ei keskusteluja, vielä!",INBOX_NO_CHATS_BODY:"Kun olet käynyt yhden tai useamman keskustelun, ne näkyvät täällä.",ENABLE_TRANSLATION:"Käännä keskustelu kielelle suomi",DISABLE_TRANSLATION:"Näytä alkuperäinen",SEARCH_PLACEHOLDER_TEXT:"Etsi...",SEARCH_SEARCHING:"Etsiminen...",SEARCH_NO_RESULTS:"Tuloksia ei löytynyt",SEARCH_NO_MORE_RESULTS:"Ei enempää tuloksia",CHAT_NOT_FOUND:"Keskustelua ei löytynyt",DELETE_MESSAGE:"Poista viesti",DELETION_EXPLANATION:"Jos poistat tämän viestin, se häviää kaikilta.",EDIT_MESSAGE:"Muokkaa viestiä",SAVE:"Tallenna",EDITED_INDICATOR:"muokattu",REPLY_TO_MESSAGE:"Vastaa",ADD_REACTION:"Lisää reaktio",AUTH_EXPIRED_OVERLAY_TITLE:"Istuntosi on vanhentunut",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Päivitä sivu jatkaaksesi",VOICE_MESSAGE:"Ääniviesti",CONTACT_INFORMATION_HIDDEN:"Piilotetut tiedot",LEAVE_CONVERSATION:"Poistu keskustelusta",MARK_CONVERSATION_AS_UNREAD:"Merkitse lukemattomaksi",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},AS={code:"fr-FR",name:"French",translation:{YESTERDAY:"Hier",TODAY:"Aujourd'hui",DAYS:"j",HOURS:"h",MINUTES:"m",JUST_NOW:"maintenant",LOCATION:"Emplacement",CANCEL:"Annuler",INBOX:"Boîte de réception",DESKTOP_NOTIFICATIONS:"Notifications du navigateur",DESKTOP_NOTIFICATIONS_ERROR:"Impossible d'activer les notifications du navigateur car votre navigateur les bloque. Essayez de changer ses paramètres ou de changer de navigateur.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notification de démonstration ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Si vous maintenez l'onglet ouvert dans votre navigateur vous verrez apparaître une alerte lorsque quelqu'un vous parlera.",SEND_BUTTON_TEXT:"Envoyer",ENTRYBOX_TEXT_LIMIT:"Seuls 10.000 caractères sont autorisés.",ENTRYBOX_PLACEHOLDER:"Ecrivez quelque chose...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Cette conversation n'est plus active.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Vous pouvez lire, mais pas envoyer de messages.",MESSAGELIST_LOADING_OLDER:"Chargement des anciens messages ...",MESSAGELIST_SHOW_OLDER:"Afficher les anciens messages",MESSAGELIST_NEW_MARKER:"Nouveau",MESSAGE_SENT_VIA_EMAIL:"Ce message a été envoyé par e-mail",YOU_MARKER:"vous",UPLOAD_IN_PROGRESS:"Envoi en cours...",UPLOAD_SEND_FILE:"Envoyer un fichier",UPLOAD_SHARE_LOCATION:"Partager mon emplacement",UPLOAD_ERROR:"Un problème est survenu lors de l'envoi: le fichier est peut-être non pris en charge ou trop volumineux.",SHARE_LOCATION_ERROR:"Impossible de partager votre emplacement: ",LOADING:"Chargement en cours...",HUB_EMPTY:"Votre historique de discussion apparaîtra ici",HUB_SHOW_EARLIER:"Afficher les conversations précédentes",INBOX_NO_CHATS_TITLE:"Aucune conversation pour l'instant!",INBOX_NO_CHATS_BODY:"Une fois que vous aurez eu une ou plusieurs conversations, elles apparaîtront ici.",ENABLE_TRANSLATION:"Traduire cette conversation en français",DISABLE_TRANSLATION:"Remontrer la conversation originale",SEARCH_PLACEHOLDER_TEXT:"Rechercher...",SEARCH_SEARCHING:"Recherche...",SEARCH_NO_RESULTS:"Aucun résultat trouvé",SEARCH_NO_MORE_RESULTS:"Il n’y a plus de résultats",CHAT_NOT_FOUND:"Conversation introuvable",DELETE_MESSAGE:"Supprimer le message",DELETION_EXPLANATION:"Si vous supprimez ce message, il disparaîtra pour tout le monde.",EDIT_MESSAGE:"Modifier le message",SAVE:"Enregistrer",EDITED_INDICATOR:"modifié",REPLY_TO_MESSAGE:"Répondre",ADD_REACTION:"Ajouter une réaction",AUTH_EXPIRED_OVERLAY_TITLE:"Votre session de chat a expiré",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Actualisez la page pour continuer",VOICE_MESSAGE:"Message vocal",CONTACT_INFORMATION_HIDDEN:"Informations masquées",LEAVE_CONVERSATION:"Quitter la conversation",MARK_CONVERSATION_AS_UNREAD:"Marquer comme non lu",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},vS={code:"he-IL",name:"Hebrew",translation:{YESTERDAY:"אתמול",TODAY:"היום",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"עכשיו",LOCATION:"מיקום",CANCEL:"בטל",INBOX:"דואר נכנס",DESKTOP_NOTIFICATIONS:"התראות דפדפן",DESKTOP_NOTIFICATIONS_ERROR:"לא ניתן להפעיל התראות במרועה דפדפן מכיוון שהדפדפן שלך חוסם אותן באופן פעיל. נסה להסתכל בהגדרות או להשתמש בדפדפן אחר.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} הודעה על הדגמה`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"אם אתה שומר על כרטיסיית הדפדפן שלך פתוחה, תראה את זה צץ כשמישהו ידבר איתך.",SEND_BUTTON_TEXT:"שלח",ENTRYBOX_TEXT_LIMIT:"רק 10.000 תווים",ENTRYBOX_PLACEHOLDER:"תגיד משהו...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"שיחה זו אינה פעילה עוד.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"אתה יכול לקרוא, אך לא לשלוח הודעות.",MESSAGELIST_LOADING_OLDER:"טוען הודעות ישנות...",MESSAGELIST_SHOW_OLDER:"הצג הודעות ישנות",MESSAGELIST_NEW_MARKER:"חדש",MESSAGE_SENT_VIA_EMAIL:"הודעה זאת נשלחה דרך אימייל",YOU_MARKER:"אתה",UPLOAD_IN_PROGRESS:"מעלה ...",UPLOAD_SEND_FILE:"שלח קובץ",UPLOAD_SHARE_LOCATION:"שתף מיקום",UPLOAD_ERROR:"לרוע המזל משהו השתבש בהעלאה. ייתכן שהקובץ אינו נתמך או גדול מדי.",SHARE_LOCATION_ERROR:"לא ניתן לשתף מיקום: ",LOADING:"טוען...",HUB_EMPTY:"היסטוריית הצ'אט שלך תופיע כאן",HUB_SHOW_EARLIER:"הצג צ'אטים קודמים",INBOX_NO_CHATS_TITLE:"אין עדיין צ'אטים!",INBOX_NO_CHATS_BODY:"לאחר שניהלת שיחה אחת או יותר, הם יופיעו כאן.",ENABLE_TRANSLATION:"תרגם שיחה זו לעברית",DISABLE_TRANSLATION:"הצג מקור",SEARCH_PLACEHOLDER_TEXT:"...חפש",SEARCH_SEARCHING:"...מחפש",SEARCH_NO_RESULTS:"לא נמצאו תוצאות",SEARCH_NO_MORE_RESULTS:"אין תוצאות נוספות",CHAT_NOT_FOUND:"הצ'אט לא נמצא",DELETE_MESSAGE:"מחיקת הודעה",DELETION_EXPLANATION:"אם תמחק הודעה זו, היא תיעלם עבור כולם.",EDIT_MESSAGE:"עריכת הודעה",SAVE:"שמור",EDITED_INDICATOR:"ערוך",REPLY_TO_MESSAGE:"השב",ADD_REACTION:"הוספת תגובה",AUTH_EXPIRED_OVERLAY_TITLE:"הפעלת הצ׳אט שלכם פגה",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"רעננו את העמוד כדי להמשיך",VOICE_MESSAGE:"הודעה קולית",CONTACT_INFORMATION_HIDDEN:"מידע מוסתר",LEAVE_CONVERSATION:"צא מהשיחה",MARK_CONVERSATION_AS_UNREAD:"סמן כלא נקרא",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},_S={code:"hi-IN",name:"Hindi (IN)",translation:{YESTERDAY:"कल",TODAY:"आज",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"अभी",LOCATION:"जगह",CANCEL:"रद्द करें",INBOX:"इनबॉक्स",DESKTOP_NOTIFICATIONS:"ब्राउज़र सूचनाएं",DESKTOP_NOTIFICATIONS_ERROR:"ब्राउज़र सूचनाएं सक्षम नहीं कर सकता क्योंकि आपका ब्राउज़र सक्रिय रूप से उन्हें ब्लॉक करता है। सेटिंग्स में देखने या एक अलग ब्राउज़र का उपयोग करने का प्रयास करें।",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} डेमो अधिसूचना`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"यदि आप अपना ब्राउज़र टैब खुला रखते हैं, तो यह पॉप अप आपको तब दिखाई देगा जब कोई आपसे बात करेगा।",SEND_BUTTON_TEXT:"भेजें",ENTRYBOX_TEXT_LIMIT:"केवल 10,000 वर्णों की अनुमति है।",ENTRYBOX_PLACEHOLDER:"कुछ कहिए...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"यह चैट अब सक्रिय नहीं है।",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"आप पढ़ सकते हैं, लेकिन संदेश नहीं भेज सकते।",MESSAGELIST_LOADING_OLDER:"पुराने संदेश लोड हो रहे हैं ...",MESSAGELIST_SHOW_OLDER:"पुराने संदेश दिखाएं",MESSAGELIST_NEW_MARKER:"नया",MESSAGE_SENT_VIA_EMAIL:"यह संदेश ईमेल के माध्यम से भेजा गया था",YOU_MARKER:"आप",UPLOAD_IN_PROGRESS:"अपलोड हो रहा है...",UPLOAD_SEND_FILE:"फाइल भेजें",UPLOAD_SHARE_LOCATION:"जगह शेयर करें",UPLOAD_ERROR:"दुर्भाग्य से, अपलोड करते समय कुछ गलत हो गया। फ़ाइल असमर्थित या बहुत बड़ी हो सकती है।",SHARE_LOCATION_ERROR:"जगह शेयर नहीं हो पाया: ",LOADING:"लोड हो रहा है...",HUB_EMPTY:"आपका चैट इतिहास यहां दिखाई देगा",HUB_SHOW_EARLIER:"पहले की चैट दिखाओ",INBOX_NO_CHATS_TITLE:"अभी तक कोई चैट नहीं!",INBOX_NO_CHATS_BODY:"एक बार जब आप एक या अधिक चैट कर लेते हैं, तो वे यहां दिखाई देंगे।",ENABLE_TRANSLATION:"इस बातचीत का हिंदी में अनुवाद कीजिए",DISABLE_TRANSLATION:"मूल दिखाएँ",SEARCH_PLACEHOLDER_TEXT:"खोजें...",SEARCH_SEARCHING:"खोज जारी है...",SEARCH_NO_RESULTS:"कोई परिणाम नहीं मिला",SEARCH_NO_MORE_RESULTS:"और कोई परिणाम नहीं",CHAT_NOT_FOUND:"चैट नहीं मिली",DELETE_MESSAGE:"संदेश डिलीट करें",DELETION_EXPLANATION:"यदि आप इस संदेश को हटाते हैं, तो यह सभी के लिए गायब हो जाएगा.",EDIT_MESSAGE:"संदेश में बदलाव करें",SAVE:"सहेजें",EDITED_INDICATOR:"संपादित किया गया",REPLY_TO_MESSAGE:"जवाब दीजिए ।",ADD_REACTION:"प्रतिक्रिया जोड़ें",AUTH_EXPIRED_OVERLAY_TITLE:"आपका चैट सेशन समाप्त हो चुका है",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"आगे बढ़ने के लिए रिफ्रेश करें",VOICE_MESSAGE:"वॉयस मैसेज",CONTACT_INFORMATION_HIDDEN:"छुपी हुई जानकारी",LEAVE_CONVERSATION:"बातचीत को ख़त्म करें",MARK_CONVERSATION_AS_UNREAD:"अपठित के रूप में चिह्नित करें",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},yS={code:"hr-HR",name:"Croatian",translation:{YESTERDAY:"Jučer",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Obavijesti preglednika",DESKTOP_NOTIFICATIONS_ERROR:"Notifikacije preglednika nisu omogućene jer ih vaš preglednik aktivno blokira. Pokušajte pogledati postavke ili koristiti neki drugi preglednik.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu preglednika ostavite otvorenu, pojavit će se ovaj pop-up kada netko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Reci nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možeš čitati, ali ne i slati poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana e-poštom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podijeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podijeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovdje će se prikazati vaša povijest razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovdje.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na hrvatski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Razgovor nije pronađen",DELETE_MESSAGE:"Obriši poruku",DELETION_EXPLANATION:"Ako izbrišete ovu poruku, nestat će za sve.",EDIT_MESSAGE:"Uredi poruku",SAVE:"Spremi",EDITED_INDICATOR:"uređivao",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodajte reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša sesija razgovora je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvježite stranicu za nastavak",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Skrivene informacije",LEAVE_CONVERSATION:"Napustiti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitano",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},TS={code:"hu-HU",name:"Hungarian",translation:{YESTERDAY:"Tegnap",TODAY:"Ma",DAYS:"n",HOURS:"ó",MINUTES:"p",JUST_NOW:"éppen most",LOCATION:"Helyszín",CANCEL:"Visszavonás",INBOX:"Postaláda",DESKTOP_NOTIFICATIONS:"Böngésző értesítések",DESKTOP_NOTIFICATIONS_ERROR:"Azért nem tudja bekapcsolni a böngésző értesítések funkciót, mert böngészője aktívan blokkolja azt. Tekintse meg a beállításokat vagy használjon másik böngészőt.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo értesítés`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ha nyitva hagyja böngészőjét, felugró ablak fog megjelenni, ha valaki beszélni szeretne Önnel.",SEND_BUTTON_TEXT:"Küldés",ENTRYBOX_TEXT_LIMIT:"Mindőssze 10.000 karakter megengedett.",ENTRYBOX_PLACEHOLDER:"Mondjon valamit...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ez a beszélgetés már nem aktív.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Elolvashatja az üzeneteket, de nem küldhet újat.",MESSAGELIST_LOADING_OLDER:"Korábbi üzenetek betöltése...",MESSAGELIST_SHOW_OLDER:"Korábbi üzenetek megjelenítése",MESSAGELIST_NEW_MARKER:"Új",MESSAGE_SENT_VIA_EMAIL:"Ez az üzenet e-mailben került elküldésre",YOU_MARKER:"Ön",UPLOAD_IN_PROGRESS:"Feltöltés...",UPLOAD_SEND_FILE:"Fájl küldése",UPLOAD_SHARE_LOCATION:"Helyszín megosztása",UPLOAD_ERROR:"Sajnos hiba történt a feltöltés során. A fájl nem támogatott vagy túl nagy.",SHARE_LOCATION_ERROR:"Helyszín megosztása nem lehetséges: ",LOADING:"Betöltés...",HUB_EMPTY:"A beszélgetések előzményei itt láthatók",HUB_SHOW_EARLIER:"Korábbi beszélgetések megjelenítése",INBOX_NO_CHATS_TITLE:"Még nincs megjeleníthető beszélgetés!",INBOX_NO_CHATS_BODY:"Amint egy vagy több beszélgetéssel rendelkezik, azok itt fognak megjelenni.",ENABLE_TRANSLATION:"A beszélgetés lefordítása erre a nyelvre: magyar",DISABLE_TRANSLATION:"Eredeti megjelenítése",SEARCH_PLACEHOLDER_TEXT:"Keresés...",SEARCH_SEARCHING:"Keresés...",SEARCH_NO_RESULTS:"Nincs találat",SEARCH_NO_MORE_RESULTS:"Nincs több találat",CHAT_NOT_FOUND:"A csevegés nem található",DELETE_MESSAGE:"Üzenet törlése",DELETION_EXPLANATION:"Ha törlöd ezt az üzenetet, az mindenki számára eltűnik.",EDIT_MESSAGE:"Üzenet szerkesztése",SAVE:"Mentés",EDITED_INDICATOR:"szerkesztve",REPLY_TO_MESSAGE:"Válaszadás",ADD_REACTION:"Reagálás erre",AUTH_EXPIRED_OVERLAY_TITLE:"Chat munkamenete lejárt",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Folytatáshoz frissítse az oldalt",VOICE_MESSAGE:"Hangüzenet",CONTACT_INFORMATION_HIDDEN:"Rejtett információ",LEAVE_CONVERSATION:"Kilépés a beszélgetésből",MARK_CONVERSATION_AS_UNREAD:"Megjelölés olvasatlanként",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},OS={code:"id-ID",name:"Bahasa Indonesia",translation:{YESTERDAY:"Kemarin",TODAY:"Hari ini",DAYS:"h",HOURS:"j",MINUTES:"m",JUST_NOW:"sekarang",LOCATION:"Lokasi",CANCEL:"Batal",INBOX:"Kotak Masuk",DESKTOP_NOTIFICATIONS:"Notifikasi peramban",DESKTOP_NOTIFICATIONS_ERROR:"Tidak dapat mengaktifkan pemberitahuan browser karena browser Anda secara aktif memblokir mereka. Coba cari di pengaturan atau menggunakan browser yang berbeda.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`pemberitahuan demo ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jika Anda membiarkan tab browser tetap terbuka, Anda akan melihat ini muncul ketika seseorang berbicara kepada Anda.",SEND_BUTTON_TEXT:"Kirim",ENTRYBOX_TEXT_LIMIT:"Hanya 10.000 karakter yang diizinkan.",ENTRYBOX_PLACEHOLDER:"Katakan sesuatu...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Percakapan ini tidak lagi aktif.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Anda dapat membaca, tetapi tidak mengirim pesan.",MESSAGELIST_LOADING_OLDER:"Memuat pesan lama...",MESSAGELIST_SHOW_OLDER:"Tampilkan pesan yang lebih lama",MESSAGELIST_NEW_MARKER:"Baru",MESSAGE_SENT_VIA_EMAIL:"Pesan ini dikirim melalui email",YOU_MARKER:"Anda",UPLOAD_IN_PROGRESS:"Mengunggah...",UPLOAD_SEND_FILE:"Kirim mengajukan",UPLOAD_SHARE_LOCATION:"Bagikan lokasi",UPLOAD_ERROR:"Ada yang salah diunggah. File mungkin tidak didukung atau terlalu besar.",SHARE_LOCATION_ERROR:"Tidak dapat membagikan lokasi: ",LOADING:"Memuat...",HUB_EMPTY:"Riwayat obrolan Anda akan muncul di sini",HUB_SHOW_EARLIER:"Tampilkan obrolan sebelumnya",INBOX_NO_CHATS_TITLE:"Belum ada obrolan!",INBOX_NO_CHATS_BODY:"Setelah Anda melakukan satu atau lebih percakapan, mereka akan muncul di sini.",ENABLE_TRANSLATION:"Terjemahkan percakapan ini ke Indonesia",DISABLE_TRANSLATION:"Perlihatkan asli",SEARCH_PLACEHOLDER_TEXT:"Cari...",SEARCH_SEARCHING:"Mencari...",SEARCH_NO_RESULTS:"Tidak ditemukan hasil",SEARCH_NO_MORE_RESULTS:"Tidak ada hasil lainnya",CHAT_NOT_FOUND:"Obrolan tidak ditemukan",DELETE_MESSAGE:"Hapus pesan",DELETION_EXPLANATION:"Jika pesan ini Anda hapus, pesan ini akan tidak terlihat bagi siapa pun.",EDIT_MESSAGE:"Sunting pesan",SAVE:"Mentés",EDITED_INDICATOR:"diedit",REPLY_TO_MESSAGE:"Balas",ADD_REACTION:"Tambah reaksi",AUTH_EXPIRED_OVERLAY_TITLE:"Sesi obrolan Anda sudah lewat batas waktu",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Muat ulang halaman untuk melanjutkan",VOICE_MESSAGE:"Pesan suara",CONTACT_INFORMATION_HIDDEN:"Informasi tersembunyi",LEAVE_CONVERSATION:"Tinggalkan percakapan",MARK_CONVERSATION_AS_UNREAD:"Tandai sebagai Belum dibaca",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},SS={code:"is-IS",name:"Íslenska",translation:{YESTERDAY:"Í gær",TODAY:"Í dag",DAYS:"dagar",HOURS:"klst.",MINUTES:"mín.",JUST_NOW:"núna",LOCATION:"Staðsetning",CANCEL:"Hætta við",INBOX:"Pósthólf",DESKTOP_NOTIFICATIONS:"Tilkynningar í vafra",DESKTOP_NOTIFICATIONS_ERROR:"Ekki er hægt að birta tilkynningar í vafra vegna þess að vafrinn sem þú notar hindrar það. Reyndu að leita að stillingum eða að nota annan vafra.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} prufutilkynning`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ef flipinn í vafranum er opinn muntu sjá þessa tilkynningu birtast þegar einhver sendir þér skilaboð.",SEND_BUTTON_TEXT:"Senda",ENTRYBOX_TEXT_LIMIT:"Aðeins 10.000 stafir komast fyrir.",ENTRYBOX_PLACEHOLDER:"Segðu eitthvað...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Þessar samræður eru ekki lengar virkar.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Þú getur lesið, en ekki sent skilaboð.",MESSAGELIST_LOADING_OLDER:"Sæki eldri skilaboð...",MESSAGELIST_SHOW_OLDER:"Sýna eldri skilaboð",MESSAGELIST_NEW_MARKER:"Ný",MESSAGE_SENT_VIA_EMAIL:"Þessi skilaboð voru send með tölvupósti",YOU_MARKER:"þú",UPLOAD_IN_PROGRESS:"Hleð upp...",UPLOAD_SEND_FILE:"Senda skrá",UPLOAD_SHARE_LOCATION:"Deila staðsetningu",UPLOAD_ERROR:"Því miður fór eitthvað úrskeiðis við að hlaða upp. Skráin gæti verið af rangri tegund eð of stór.",SHARE_LOCATION_ERROR:"Ekki er hægt að deila staðsetningu: ",LOADING:"Hleð...",HUB_EMPTY:"Fyrri samtöl munu birtast hér",HUB_SHOW_EARLIER:"Sýna fyrri samtöl",INBOX_NO_CHATS_TITLE:"Engin samtöl enn!",INBOX_NO_CHATS_BODY:"Þegar þú hefur átt eitt eða fleiri samtöl, munu þau birtast hér.",ENABLE_TRANSLATION:"Þýða þetta samtal á ensku",DISABLE_TRANSLATION:"Sýna upprunalegt",SEARCH_PLACEHOLDER_TEXT:"Leita...",SEARCH_SEARCHING:"Leita...",SEARCH_NO_RESULTS:"Ekkert fannst",SEARCH_NO_MORE_RESULTS:"Engar fleiri niðurstöður",CHAT_NOT_FOUND:"Samtal fannst ekki",DELETE_MESSAGE:"Eyða skilaboðum",DELETION_EXPLANATION:"Ef þú eyðir þessum skilaboðum munu þau hverfa hjá öllum.",EDIT_MESSAGE:"Breyta skilaboðum",SAVE:"Vista",EDITED_INDICATOR:"breytt",REPLY_TO_MESSAGE:"Svara",REPLY_TO_ARIA_LABEL:(n,t)=>`Svara ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Fara úr svari",ADD_REACTION:"Setja inn viðbrögð",AUTH_EXPIRED_OVERLAY_TITLE:"Spjallið hefur runnið út",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Endurnýjaðu síðuna til að halda áfram",VOICE_MESSAGE:"Raddskilaboð",LEAVE_CONVERSATION:"Skilja eftir skilaboð",MARK_CONVERSATION_AS_UNREAD:"Merkja sem ólesið",STATUS_INDICATOR_ONLINE:"Virk",STATUS_INDICATOR_OFFLINE:"Ekki við",CONTACT_INFORMATION_HIDDEN:"faldar upplýsingar"}},NS={code:"it-IT",name:"Italian",translation:{YESTERDAY:"Ieri",TODAY:"Oggi",DAYS:"g",HOURS:"o",MINUTES:"m",JUST_NOW:"adesso",LOCATION:"Posizione",CANCEL:"Annulla",INBOX:"Posta in arrivo",DESKTOP_NOTIFICATIONS:"Notifiche browser",DESKTOP_NOTIFICATIONS_ERROR:"Impossibile abilitare le notifiche browser perché il browser le blocca attivamente. Prova a cercare le impostazioni o utilizzare un browser diverso.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notification`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Se si mantiene aperta la scheda del browser, questo verrà visualizzato quando qualcuno ti parla.",SEND_BUTTON_TEXT:"Invia",ENTRYBOX_TEXT_LIMIT:"Sono consentiti solo 10.000 caratteri.",ENTRYBOX_PLACEHOLDER:"Dì qualcosa...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Questa conversazione non è più attiva.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puoi leggere, ma non inviare messaggi.",MESSAGELIST_LOADING_OLDER:"Caricamento dei messaggi precedenti...",MESSAGELIST_SHOW_OLDER:"Mostra messaggi precedenti",MESSAGELIST_NEW_MARKER:"Nuovo",MESSAGE_SENT_VIA_EMAIL:"Questo messaggio è stato inviato via email",YOU_MARKER:"tu",UPLOAD_IN_PROGRESS:"Caricamento in corso...",UPLOAD_SEND_FILE:"Invia file",UPLOAD_SHARE_LOCATION:"Condividi posizione",UPLOAD_ERROR:"Qualcosa è andato storto durante il caricamento. Il file potrebbe non essere supportato o troppo grande.",SHARE_LOCATION_ERROR:"Impossibile condividere la posizione: ",LOADING:"Caricamento in corso...",HUB_EMPTY:"La cronologia della tua chat verrà mostrata qui",HUB_SHOW_EARLIER:"Mostra chat precedenti",INBOX_NO_CHATS_TITLE:"Non ci sono ancora chat!",INBOX_NO_CHATS_BODY:"Una volta che hai avuto una o più conversazioni, verranno visualizzate qui.",ENABLE_TRANSLATION:"Traduci questa conversazione in italiano",DISABLE_TRANSLATION:"Mostra l'originale",SEARCH_PLACEHOLDER_TEXT:"Cerca...",SEARCH_SEARCHING:"Cercando...",SEARCH_NO_RESULTS:"Nessun risultato trovato",SEARCH_NO_MORE_RESULTS:"Non ci sono più risultati",CHAT_NOT_FOUND:"Chat non trovata",DELETE_MESSAGE:"Elimina messaggio",DELETION_EXPLANATION:"Se elimini il messaggio, questo scomparirà per tutti.",EDIT_MESSAGE:"Modifica messaggio",SAVE:"Salva",EDITED_INDICATOR:"modificato",REPLY_TO_MESSAGE:"Rispondi",ADD_REACTION:"Aggiungi reazione",AUTH_EXPIRED_OVERLAY_TITLE:"La sessione di chat è scaduta",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Aggiorna la pagina per continuare",VOICE_MESSAGE:"Messaggio vocale",CONTACT_INFORMATION_HIDDEN:"Informazioni nascoste",LEAVE_CONVERSATION:"Abbandona la conversazione",MARK_CONVERSATION_AS_UNREAD:"Segna come non letto",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},CS={code:"ja-JP",name:"Japanese",translation:{YESTERDAY:"昨日",TODAY:"今日",DAYS:"日前",HOURS:"時間前",MINUTES:"分前",JUST_NOW:"たった今",LOCATION:"場所",CANCEL:"キャンセル",INBOX:"受信箱",DESKTOP_NOTIFICATIONS:"ブラウザの通知",DESKTOP_NOTIFICATIONS_ERROR:"ブラウザの通知はブロックされているため、ブラウザの通知を有効にできません。設定を確認するか、別のブラウザを使用してください。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} デモ通知`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"ブラウザのタブを開いたままにしておくと、誰かがあなたに話しかけたときにこのポップアップが表示されます。",SEND_BUTTON_TEXT:"送信",ENTRYBOX_TEXT_LIMIT:"許可されているのは10.000文字までです。",ENTRYBOX_PLACEHOLDER:"メッセージを入力してください",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"この会話はもうアクティブではありません。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"あなたは読むことはできますが、メッセージを送ることはできません。",MESSAGELIST_LOADING_OLDER:"古いメッセージを読み込んでいます...",MESSAGELIST_SHOW_OLDER:"古いメッセージを表示",MESSAGELIST_NEW_MARKER:"新着",MESSAGE_SENT_VIA_EMAIL:"このメッセージはメールで送信されました",YOU_MARKER:"あなたは",UPLOAD_IN_PROGRESS:"アップロード中...",UPLOAD_SEND_FILE:"ファイル送信",UPLOAD_SHARE_LOCATION:"共有場所",UPLOAD_ERROR:"アップロード中に問題が発生しました。ファイルがサポートされていないか、大きすぎる可能性があります。",SHARE_LOCATION_ERROR:"場所を共有できません: ",LOADING:"読み込み中...",HUB_EMPTY:"あなたのチャット履歴がここに表示されます",HUB_SHOW_EARLIER:"以前のチャットを表示",INBOX_NO_CHATS_TITLE:"まだチャットがありません!",INBOX_NO_CHATS_BODY:"会話が1つ以上あると、ここに表示されます",ENABLE_TRANSLATION:"この会話を日本語に翻訳する",DISABLE_TRANSLATION:"オリジナルを表示",SEARCH_PLACEHOLDER_TEXT:"検索...",SEARCH_SEARCHING:"検索中...",SEARCH_NO_RESULTS:"結果が見つかりません",SEARCH_NO_MORE_RESULTS:"これ以上結果はありません",CHAT_NOT_FOUND:"チャットが見つかりませんでした",DELETE_MESSAGE:"メッセージを削除する",DELETION_EXPLANATION:"このメッセージを削除すると、全ての人に表示されなくなります。",EDIT_MESSAGE:"メッセージを編集する",SAVE:"上書き保存",EDITED_INDICATOR:"編集",REPLY_TO_MESSAGE:"返信する",ADD_REACTION:"リアクションを追加",AUTH_EXPIRED_OVERLAY_TITLE:"チャットセッションの有効期限が切れました",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"続けるにはページを更新してください",VOICE_MESSAGE:"ボイスメッセージ",CONTACT_INFORMATION_HIDDEN:"機密情報",LEAVE_CONVERSATION:"会話をやめる",MARK_CONVERSATION_AS_UNREAD:"未読としてマーク",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},bS={code:"ka-GE",name:"Georgian",translation:{YESTERDAY:"გუშინ",TODAY:"დღეს",DAYS:"დღ",HOURS:"სთ",MINUTES:"წთ",JUST_NOW:"ახლა",LOCATION:"ადგილმდებარეობა",CANCEL:"გაუქმება",INBOX:"მიღებული შეტყობინება",DESKTOP_NOTIFICATIONS:"ბრაუზერის შეტყობინებები",DESKTOP_NOTIFICATIONS_ERROR:"შეუძლებელია ბრაუზერის შეტკობინებების ჩართვა. ეს ბრაუზერი ბლოკავს მათ. სცადე ცვლილება ოპციებიდან ან გამოიყენე სხვა ბრაუზერი.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} შეტყობინებების დემო ვერსია`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"თუ დატოვებ ბრაუზერის ფანჯარას გახსნილს, როცა ვიღაც მოგწერს საუბარი ამოვარდება დესკტოპზე.",SEND_BUTTON_TEXT:"გაგზავნა",ENTRYBOX_TEXT_LIMIT:"დაშვებულია მხოლოდ 10.000 სიმბოლო.",ENTRYBOX_PLACEHOLDER:"დაწერე რაღაც...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"ეს დიალოგი აღარ არის ხელმისაწვდომი.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"შეგიძლია წაიკითხო, მაგრამ ვერ გააგზავნი შეტყობინებას.",MESSAGELIST_LOADING_OLDER:"იტვირთება ძველი შეტყობინებები...",MESSAGELIST_SHOW_OLDER:"ძველი შეტყობინებების ჩვენება",MESSAGELIST_NEW_MARKER:"ახალი",MESSAGE_SENT_VIA_EMAIL:"ეს შეტყობინება გამოგზავნილია იმეილით",YOU_MARKER:"you",UPLOAD_IN_PROGRESS:"იტვირთება...",UPLOAD_SEND_FILE:"ფაილის გაგზავნა",UPLOAD_SHARE_LOCATION:"ადგილმდებარეობის გაზიარება",UPLOAD_ERROR:"პრობლემაა ატვირთვისას. ფაილის შესაძლოა არის არათავსებადი ან ძალიან დიდი.",SHARE_LOCATION_ERROR:"შეუძლებელია ადგილმდებარეობის გაზიარება: ",LOADING:"იტვირთება...",HUB_EMPTY:"საუბრების ისტორია გამოჩნდება აქ",HUB_SHOW_EARLIER:"წინა საუბრების ნახვა",INBOX_NO_CHATS_TITLE:"ჯერ-ჯერობით არ არის საუბრები!",INBOX_NO_CHATS_BODY:"უკვე დასრულებული საუბარები გამოჩნდება აქ",ENABLE_TRANSLATION:"თარგმნეთ ეს საუბარი ინგლისურად",DISABLE_TRANSLATION:"ორიგინალის ჩვენება",SEARCH_PLACEHOLDER_TEXT:"ძიება...",SEARCH_SEARCHING:"მიმდინარეობს ძიება...",SEARCH_NO_RESULTS:"შედეგები ვერ ქართველი",SEARCH_NO_MORE_RESULTS:"სხვა შედეგი ვერ მოიძებნა",CHAT_NOT_FOUND:"ჩატი ვერ მოიძებნა",DELETE_MESSAGE:"შეტყობინების წაშლა ",DELETION_EXPLANATION:"თუ ამ შეტყობინებას წაშლით, ის ყველასთვის გაქრება.",EDIT_MESSAGE:"შეტყობინების რედაქტირება",SAVE:"შენახვა",EDITED_INDICATOR:"რედაქტირებულია",REPLY_TO_MESSAGE:"პასუხის გაცემა",ADD_REACTION:"დაამატეთ რეაქცია",AUTH_EXPIRED_OVERLAY_TITLE:"თქვენი ჩეთის სესიის ვადა ამოიწურა",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"განაახლეთ გვერდი გასაგრძელებლად",VOICE_MESSAGE:"ხმოვანი შეტყობინება",CONTACT_INFORMATION_HIDDEN:"ფარული ინფორმაცია",LEAVE_CONVERSATION:"საუბრის დატოვება",MARK_CONVERSATION_AS_UNREAD:"წაუკითხავად მონიშვნა",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},IS={code:"ko-KR",name:"Korean (South Korea)",translation:{YESTERDAY:"어제",TODAY:"오늘",DAYS:"일 전",HOURS:"시간 전",MINUTES:"분 전",JUST_NOW:"방금",LOCATION:"위치",CANCEL:"취소",INBOX:"대화 목록",DESKTOP_NOTIFICATIONS:"브라우저 알림",DESKTOP_NOTIFICATIONS_ERROR:"브라우저 알림을 표시할 수 없습니다. 브라우저 설정을 확인하거나 다른 브라우저를 사용해주세요.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 데모 알림`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"브라우저 탭을 열어 둔 상태에서 누군가 대화 할 때 이 팝업이 표시됩니다.",SEND_BUTTON_TEXT:"전송",ENTRYBOX_TEXT_LIMIT:"최대 10,000자까지 입력할 수 있습니다.",ENTRYBOX_PLACEHOLDER:"메세지를 입력하세요...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"채팅이 종료되었습니다.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"읽기만 가능하며 메시지를 보낼 수 없습니다.",MESSAGELIST_LOADING_OLDER:"이전 메시지 로드 중...",MESSAGELIST_SHOW_OLDER:"이전 메시지 표시",MESSAGELIST_NEW_MARKER:"새 메시지",MESSAGE_SENT_VIA_EMAIL:"이 메시지는 이메일을 통해 전송되었습니다.",YOU_MARKER:"나",UPLOAD_IN_PROGRESS:"업로드 중...",UPLOAD_SEND_FILE:"파일 전송",UPLOAD_SHARE_LOCATION:"위치 공유",UPLOAD_ERROR:"업로드가 실패했습니다. 파일이 지원되지 않거나 너무 클 수 있습니다.",SHARE_LOCATION_ERROR:"위치를 공유 할 수 없습니다: ",LOADING:"로드 중...",HUB_EMPTY:"채팅 기록이 여기에 표시됩니다",HUB_SHOW_EARLIER:"이전 채팅보기",INBOX_NO_CHATS_TITLE:"아직 채팅이 없습니다!",INBOX_NO_CHATS_BODY:"대화가 하나 이상 있으면 여기에 표시됩니다.",ENABLE_TRANSLATION:"이 대화를 한국어로 번역",DISABLE_TRANSLATION:"원본 표시",SEARCH_PLACEHOLDER_TEXT:"검색...",SEARCH_SEARCHING:"검색 중...",SEARCH_NO_RESULTS:"검색 결과 없음",SEARCH_NO_MORE_RESULTS:"추가 검색 결과 없음",CHAT_NOT_FOUND:"대화를 찾지 못했습니다",DELETE_MESSAGE:"메시지 삭제",DELETION_EXPLANATION:"이 메시지를 삭제하면 모든 사람이 볼 수 없게 됩니다.",EDIT_MESSAGE:"메시지 편집하기",SAVE:"저장",EDITED_INDICATOR:"편집",REPLY_TO_MESSAGE:"회신",ADD_REACTION:"반응 추가",AUTH_EXPIRED_OVERLAY_TITLE:"채팅 세션이 만료되었습니다",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"계속하려면 페이지를 새로고침하세요",VOICE_MESSAGE:"음성 메시지",CONTACT_INFORMATION_HIDDEN:"숨겨진 정보",LEAVE_CONVERSATION:"대화 떠나기",MARK_CONVERSATION_AS_UNREAD:"읽지 않은 상태로 표시",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},wS={code:"nb-NO",name:"Norwegian (Bokmål)",translation:{YESTERDAY:"I går",TODAY:"I dag",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"Nå",LOCATION:"Plassering",CANCEL:"Avbryt",INBOX:"Innboks",DESKTOP_NOTIFICATIONS:"Nettleservarsler",DESKTOP_NOTIFICATIONS_ERROR:"Kan ikke aktivere Nettleservarsler fordi nettleseren din aktivt blokkerer dem. Prøv å se i innstillingene eller bruke en annen nettleser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo varslinger`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Hvis du holder nettleservinduet åpent, vil du se dette varsel når noen snakker til deg.",SEND_BUTTON_TEXT:"Send",ENTRYBOX_TEXT_LIMIT:"Kun 10.000 tegn er tillatt.",ENTRYBOX_PLACEHOLDER:"Si noe...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Denne samtale er ikke lengre aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan lese, men ikke sende meldinger.",MESSAGELIST_LOADING_OLDER:"Laster eldre meldinger...",MESSAGELIST_SHOW_OLDER:"Vis eldre meldinger",MESSAGELIST_NEW_MARKER:"Ny",MESSAGE_SENT_VIA_EMAIL:"Denne meldingen er sendt via e-post",YOU_MARKER:"deg",UPLOAD_IN_PROGRESS:"Laster opp...",UPLOAD_SEND_FILE:"Send fil",UPLOAD_SHARE_LOCATION:"Del din plassering",UPLOAD_ERROR:"Noe gikk galt i uplastingen. Det kan være filen ikke støttes eller for stor.",SHARE_LOCATION_ERROR:"Kan ikke dele plasseringen: ",LOADING:"Laster...",HUB_EMPTY:"Din chats historikk vil vises her",HUB_SHOW_EARLIER:"Vis tidligere chats",INBOX_NO_CHATS_TITLE:"Ingen chats enda!",INBOX_NO_CHATS_BODY:"Så snart du får en eller flere samtaler, vil de vises her.",ENABLE_TRANSLATION:"Oversett denne samtalen til norsk",DISABLE_TRANSLATION:"Vis original",SEARCH_PLACEHOLDER_TEXT:"Søk...",SEARCH_SEARCHING:"Søker...",SEARCH_NO_RESULTS:"Finner ingen resultater",SEARCH_NO_MORE_RESULTS:"Ingen flere resultater",CHAT_NOT_FOUND:"Chat ikke funnet",DELETE_MESSAGE:"Slett melding",DELETION_EXPLANATION:"Hvis du sletter denne meldingen, forsvinner den for alle.",EDIT_MESSAGE:"Rediger melding",SAVE:"Lagre",EDITED_INDICATOR:"redigert",REPLY_TO_MESSAGE:"Svar",ADD_REACTION:"Legg til reaksjon",AUTH_EXPIRED_OVERLAY_TITLE:"Chatøkten er utløpt",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Oppdater siden for å fortsette",VOICE_MESSAGE:"Lydmelding",CONTACT_INFORMATION_HIDDEN:"Skjult informasjon",LEAVE_CONVERSATION:"Forlat samtalen",MARK_CONVERSATION_AS_UNREAD:"Merk som ulest",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},RS={code:"nl-NL",name:"Dutch",translation:{YESTERDAY:"Gisteren",TODAY:"Vandaag",DAYS:"d",HOURS:"u",MINUTES:"m",JUST_NOW:"zojuist",LOCATION:"Locatie",CANCEL:"Annuleren",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Browsermeldingen",DESKTOP_NOTIFICATIONS_ERROR:"Browsermeldingen kunnen niet geactiveerd worden omdat de browser het blokkeert. Check de instellingen van je browser of probeer een andere browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notificatie`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Als je je browser open houdt, zie je deze popup als iemand tegen je praat.",SEND_BUTTON_TEXT:"Verzenden",ENTRYBOX_TEXT_LIMIT:"Maximaal 10.000 tekens toegestaan.",ENTRYBOX_PLACEHOLDER:"Typ een bericht...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Dit gesprek is niet actief meer.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Je kunt geen berichten sturen.",MESSAGELIST_LOADING_OLDER:"Eerdere berichten laden...",MESSAGELIST_SHOW_OLDER:"Laad eerdere berichten",MESSAGELIST_NEW_MARKER:"Nieuw",MESSAGE_SENT_VIA_EMAIL:"Dit bericht is verstuurd via e-mail",YOU_MARKER:"jij",UPLOAD_IN_PROGRESS:"Uploaden...",UPLOAD_SEND_FILE:"Verzend bestand",UPLOAD_SHARE_LOCATION:"Deel locatie",UPLOAD_ERROR:"Er ging iets mis. Het bestand wordt niet ondersteund of is te groot.",SHARE_LOCATION_ERROR:"Locatie delen mislukt: ",LOADING:"Bezig met laden...",HUB_EMPTY:"Berichtengeschiedenis wordt hier weergegeven",HUB_SHOW_EARLIER:"Laat eerdere berichten zien",INBOX_NO_CHATS_TITLE:"Nog geen chats!",INBOX_NO_CHATS_BODY:"Zodra je een of meerdere conversaties hebt gehad, worden deze hier weergegeven.",ENABLE_TRANSLATION:"Vertaal dit gesprek naar het Nederlands",DISABLE_TRANSLATION:"Toon oorspronkelijk gesprek",SEARCH_PLACEHOLDER_TEXT:"Zoek...",SEARCH_SEARCHING:"Zoeken...",SEARCH_NO_RESULTS:"Geen resultaten gevonden",SEARCH_NO_MORE_RESULTS:"Niet meer resultaten",CHAT_NOT_FOUND:"Chat niet gevonden",DELETE_MESSAGE:"Bericht verwijderen",DELETION_EXPLANATION:"Als je dit bericht verwijdert, zal het voor iedereen verdwijnen.",EDIT_MESSAGE:"Bericht bewerken",SAVE:"Opslaan",EDITED_INDICATOR:"bewerkt",REPLY_TO_MESSAGE:"Beantwoorden",ADD_REACTION:"Reactie toevoegen",AUTH_EXPIRED_OVERLAY_TITLE:"Je chatsessie is verlopen",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Ververs de pagina om door te gaan",VOICE_MESSAGE:"Spraakbericht",CONTACT_INFORMATION_HIDDEN:"verborgen informatie",LEAVE_CONVERSATION:"Gesprek verlaten",MARK_CONVERSATION_AS_UNREAD:"Markeren als ongelezen",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},DS={code:"pl-PL",name:"Polish",translation:{YESTERDAY:"Wczoraj",TODAY:"Dzisiaj",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"teraz",LOCATION:"Lokalizacja",CANCEL:"Anuluj",INBOX:"Skrzynka odbiorcza",DESKTOP_NOTIFICATIONS:"Powiadomienia",DESKTOP_NOTIFICATIONS_ERROR:"Nie można aktywować powiadomień, ponieważ twoja przeglądarka je blokuje. Proszę zmienić ustawienie lub spróbować innej przeglądarki.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} przykładowe powiadomienie`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Jeśli zostawisz tę kartę otwartą, zobaczysz takie powiadomienie, gdy ktoś napisze do Ciebie.",SEND_BUTTON_TEXT:"Wyślij",ENTRYBOX_TEXT_LIMIT:"Nie można wysyłać więcej niż 10000 znaków.",ENTRYBOX_PLACEHOLDER:"Napisz coś...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ten czat nie jest aktywny.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Możesz czytać wiadomości, ale nie możesz ich wysyłać.",MESSAGELIST_LOADING_OLDER:"Wczytuję starsze wiadomości...",MESSAGELIST_SHOW_OLDER:"Zobacz starsze wiadomości",MESSAGELIST_NEW_MARKER:"Nowe",MESSAGE_SENT_VIA_EMAIL:"Ta wiadomość została wysłana przez email.",YOU_MARKER:"ty",UPLOAD_IN_PROGRESS:"Przesyłanie...",UPLOAD_SEND_FILE:"Prześlij plik",UPLOAD_SHARE_LOCATION:"Udostępnij lokalizację",UPLOAD_ERROR:"Coś poszło nie tak. Plik może być zbyt duży lub jest nieobsługiwany.",SHARE_LOCATION_ERROR:"Nie da się udostępnić lokalizacji: ",LOADING:"Ładowanie...",HUB_EMPTY:"Twoje czaty pojawią się tutaj",HUB_SHOW_EARLIER:"Zobacz starsze czaty",INBOX_NO_CHATS_TITLE:"Brak czatów!",INBOX_NO_CHATS_BODY:"Rozpoczęte konwersacje pojawią się tutaj.",ENABLE_TRANSLATION:"Przetłumacz tę konwersację na język polski",DISABLE_TRANSLATION:"Pokaż oryginał",SEARCH_PLACEHOLDER_TEXT:"Wyszukaj...",SEARCH_SEARCHING:"Wyszukiwanie...",SEARCH_NO_RESULTS:"Nie znaleziono wyników",SEARCH_NO_MORE_RESULTS:"Nie ma innych wyników",CHAT_NOT_FOUND:"Nie znaleziono konwersacji",DELETE_MESSAGE:"Usuń wiadomość",DELETION_EXPLANATION:"Jeśli usuniesz tę wiadomość, przestanie być widoczna dla wszystkich.",EDIT_MESSAGE:"Edytuj wiadomość",SAVE:"Zapisz",EDITED_INDICATOR:"edytowano",REPLY_TO_MESSAGE:"Odpowiedz",ADD_REACTION:"Dodaj reakcję",AUTH_EXPIRED_OVERLAY_TITLE:"Twoja sesja wygasła",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Odśwież stronę, aby kontynuować",VOICE_MESSAGE:"Wiadomość głosowa",CONTACT_INFORMATION_HIDDEN:"Ukryte informacje",LEAVE_CONVERSATION:"Opuść konwersację",MARK_CONVERSATION_AS_UNREAD:"Oznacz jako nieprzeczytane",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},kS={code:"pt-BR",name:"Portuguese (Brazil)",translation:{YESTERDAY:"Ontem",TODAY:"Hoje",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"agora mesmo",LOCATION:"Localização",CANCEL:"Cancelar",INBOX:"Caixa de entrada",DESKTOP_NOTIFICATIONS:"Notificações do navegador",DESKTOP_NOTIFICATIONS_ERROR:"Não é possível ativar as notificações da navegador porque seu navegador as bloqueia. Tente procurar nas configurações ou usar um navegador diferente.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} notificação de demonstração`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Se você mantiver a guia do navegador aberta, verá essa mensagem quando alguém falar com você.",SEND_BUTTON_TEXT:"Enviar",ENTRYBOX_TEXT_LIMIT:"Apenas 10.000 caracteres são permitidos.",ENTRYBOX_PLACEHOLDER:"Diga algo...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Esta conversa não está mais ativa.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Você pode ler, mas não enviar mensagens.",MESSAGELIST_LOADING_OLDER:"Carregando mensagens antigas...",MESSAGELIST_SHOW_OLDER:"Mostrar mensagens mais antigas",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Esta mensagem foi enviada via email.",YOU_MARKER:"Você",UPLOAD_IN_PROGRESS:"Carregando...",UPLOAD_SEND_FILE:"Enviar arquivo",UPLOAD_SHARE_LOCATION:"Compartilhar localização",UPLOAD_ERROR:"Algo deu errado ao fazer o upload. O arquivo pode não ter suporte ou ser muito grande.",SHARE_LOCATION_ERROR:"Não é possível compartilhar o local: ",LOADING:"Carregando...",HUB_EMPTY:"Seu histórico de conversas será exibido aqui",HUB_SHOW_EARLIER:"Mostrar conversas anteriores",INBOX_NO_CHATS_TITLE:"Ainda não há chats!",INBOX_NO_CHATS_BODY:"Depois de ter uma ou mais conversas, elas serão exibidas aqui.",ENABLE_TRANSLATION:"Traduzir esta conversa para português",DISABLE_TRANSLATION:"Ver a conversa não traduzida",SEARCH_PLACEHOLDER_TEXT:"Busca...",SEARCH_SEARCHING:"Consultando...",SEARCH_NO_RESULTS:"Resultados nao encontrados",SEARCH_NO_MORE_RESULTS:"Não há mais resultados",CHAT_NOT_FOUND:"Conversa não encontrada",DELETE_MESSAGE:"Excluir mensagem",DELETION_EXPLANATION:"Se você excluir esta mensagem, ela desaparecerá para todos.",EDIT_MESSAGE:"Editar mensagem",SAVE:"Salvar",EDITED_INDICATOR:"editada",REPLY_TO_MESSAGE:"Responder",ADD_REACTION:"Adicionar reação",AUTH_EXPIRED_OVERLAY_TITLE:"Sua sessão de chat expirou",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Atualize a página para continuar",VOICE_MESSAGE:"Mensagem de voz",LEAVE_CONVERSATION:"Sair da conversa",MARK_CONVERSATION_AS_UNREAD:"Marcar como não lida",CONTACT_INFORMATION_HIDDEN:"Informação oculta",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},LS={code:"ro-RO",name:"Romanian (Romania)",translation:{YESTERDAY:"Ieri",TODAY:"Astăzi",DAYS:"z",HOURS:"o",MINUTES:"m",JUST_NOW:"chiar acum",LOCATION:"Locație",CANCEL:"Anulare",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Notificări browser",DESKTOP_NOTIFICATIONS_ERROR:"Nu se pot activa notificări browser deoarece browserul dvs. le blochează în mod activ. Încercați să căutați în setări sau utilizând un alt browser.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Notificare de debit ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Dacă țineți fișa browserului deschis, veți vedea acest pop-up atunci când cineva vorbește cu dvs.",SEND_BUTTON_TEXT:"Trimiteți",ENTRYBOX_TEXT_LIMIT:"Sunt permise numai 10.000 de caractere.",ENTRYBOX_PLACEHOLDER:"Spune ceva...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Această conversație nu mai este activă.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Puteți citi, dar nu puteți trimite mesaje.",MESSAGELIST_LOADING_OLDER:"Încărcarea mesajelor mai vechi...",MESSAGELIST_SHOW_OLDER:"Afișați mesaje mai vechi",MESSAGELIST_NEW_MARKER:"Nou",MESSAGE_SENT_VIA_EMAIL:"Acest mesaj a fost trimis prin e-mail",YOU_MARKER:"voi",UPLOAD_IN_PROGRESS:"Încărcarea...",UPLOAD_SEND_FILE:"Trimiteți fișierul",UPLOAD_SHARE_LOCATION:"Distribuiți locația",UPLOAD_ERROR:"Sa încărcat ceva în mod greșit. Fișierul ar putea fi neacceptat sau prea mare.",SHARE_LOCATION_ERROR:"Nu se poate partaja locația: ",LOADING:"Încărcare...",HUB_EMPTY:"Istoricul chat-ului dvs. va apărea aici",HUB_SHOW_EARLIER:"Afișați discuțiile anterioare",INBOX_NO_CHATS_TITLE:"Încă nu vorbești!",INBOX_NO_CHATS_BODY:"După ce ați avut una sau mai multe conversații, acestea vor apărea aici.",ENABLE_TRANSLATION:"Traduceți această conversație în română",DISABLE_TRANSLATION:"Arată originalul",SEARCH_PLACEHOLDER_TEXT:"Căutare...",SEARCH_SEARCHING:"Se caută...",SEARCH_NO_RESULTS:"Nu s-au găsit rezultate",SEARCH_NO_MORE_RESULTS:"Nu mai există rezultate",CHAT_NOT_FOUND:"Conversația nu a fost găsită",DELETE_MESSAGE:"Șterge mesajul",DELETION_EXPLANATION:"Dacă ștergi acest mesaj, acesta va dispărea pentru toată lumea.",EDIT_MESSAGE:"Redactează mesajul",SAVE:"Salvare",EDITED_INDICATOR:"editat",REPLY_TO_MESSAGE:"Răspundeți",ADD_REACTION:"Adaugă o reacție",AUTH_EXPIRED_OVERLAY_TITLE:"Sesiunea dumneavoastră de chat a expirat",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Reîmprospătați pagina pentru a continua",VOICE_MESSAGE:"Mesaj vocal",CONTACT_INFORMATION_HIDDEN:"Informații ascunse",LEAVE_CONVERSATION:"Părăsește conversația",MARK_CONVERSATION_AS_UNREAD:"Marcheaza ca necitit",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},xS={code:"ru-RU",name:"Russian",translation:{YESTERDAY:"Вчера",TODAY:"Сегодня",DAYS:"д",HOURS:"ч",MINUTES:"м",JUST_NOW:"только что",LOCATION:"Местоположение",CANCEL:"Отмена",INBOX:"Входящие",DESKTOP_NOTIFICATIONS:"Оповещения",DESKTOP_NOTIFICATIONS_ERROR:"Невозможно включить оповещения, потому что ваш браузер активно блокирует их. Проверьте ваши настройки или попробуйте другой браузер.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} демо-оповещение`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Если вкладка вашего браузера открыта, вы увидите всплывающее окошко оповещения когда кто-то отправит вам сообщение.",SEND_BUTTON_TEXT:"Отправить",ENTRYBOX_TEXT_LIMIT:"Разрешено использовать только 10 тысяч символов.",ENTRYBOX_PLACEHOLDER:"Напишите что-нибудь...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Этот разговор больше неактивен.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Вы можете читать, но не отправлять сообщения.",MESSAGELIST_LOADING_OLDER:"Загрузка старых сообщения...",MESSAGELIST_SHOW_OLDER:"Показать старые сообщения",MESSAGELIST_NEW_MARKER:"Новые",MESSAGE_SENT_VIA_EMAIL:"Это сообщение было отправлено по электронной почте",YOU_MARKER:"вы",UPLOAD_IN_PROGRESS:"Загрузка...",UPLOAD_SEND_FILE:"Отправить файл",UPLOAD_SHARE_LOCATION:"Поделиться местоположением",UPLOAD_ERROR:"Что-то пошло не так: такой файл не поддерживается или он слишком большой.",SHARE_LOCATION_ERROR:"Не удается поделиться местоположением: ",LOADING:"Загрузка...",HUB_EMPTY:"Здесь появится ваша история чата",HUB_SHOW_EARLIER:"Показать предыдущие чаты",INBOX_NO_CHATS_TITLE:"Пока нет чатов!",INBOX_NO_CHATS_BODY:"Как только у вас будет один или несколько разговоров, они появятся здесь.",ENABLE_TRANSLATION:"Переведите этот разговор на русский",DISABLE_TRANSLATION:"Show source",SEARCH_PLACEHOLDER_TEXT:"поиск...",SEARCH_SEARCHING:"Поиск...",SEARCH_NO_RESULTS:"Результаты не найдены",SEARCH_NO_MORE_RESULTS:"Больше результатов нет",CHAT_NOT_FOUND:"Чат не найден",DELETE_MESSAGE:"Удалить сообщение",DELETION_EXPLANATION:"Если вы удалите это сообщение, оно исчезнет для всех.",EDIT_MESSAGE:"Изменить сообщение",SAVE:"сохранить",EDITED_INDICATOR:"изменено",REPLY_TO_MESSAGE:"Ответить",ADD_REACTION:"Добавить реакцию",AUTH_EXPIRED_OVERLAY_TITLE:"Срок действия вашего сеанса чата истек",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Обновите страницу, чтобы продолжить",VOICE_MESSAGE:"Голосовое сообщение",CONTACT_INFORMATION_HIDDEN:"Информация скрыта",LEAVE_CONVERSATION:"Выйти из беседы",MARK_CONVERSATION_AS_UNREAD:"Отметить как непрочитанное",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},MS={code:"sq-AL",name:"Albanian",translation:{YESTERDAY:"Dje",TODAY:"Sot",DAYS:"d",HOURS:"o",MINUTES:"m",JUST_NOW:"Tani",LOCATION:"Pozicion",CANCEL:"Anulo",INBOX:"Inbox",DESKTOP_NOTIFICATIONS:"Njoftimet e shfletuesit",DESKTOP_NOTIFICATIONS_ERROR:"Nuk mund të aktivizohen njoftimet në shfletues sepse shfletuesi juaj i bllokon ato në mënyrë aktive. Provoni të shikoni cilësimet ose përdorni një shfletues të ndryshëm.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} njoftime në desktop`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Lënia e skedës së shfletuesit tuaj të hapur do të pop-up kur dikush flet me ju.",SEND_BUTTON_TEXT:"Dërgo",ENTRYBOX_TEXT_LIMIT:"Lejohen vetëm 10,000 karaktere",ENTRYBOX_PLACEHOLDER:"Thuaj diçka...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Kjo bisedë nuk është më aktive.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Mund të lexoni por jo të dërgoni mesazhe.",MESSAGELIST_LOADING_OLDER:"Duke ngarkuar mesazhe më të vjetra...",MESSAGELIST_SHOW_OLDER:"Trego mesazhe më të vjetra",MESSAGELIST_NEW_MARKER:"E ri",MESSAGE_SENT_VIA_EMAIL:"Ky mesazh u dërgua si email",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Ngarkim...",UPLOAD_SEND_FILE:"Dërgo datotekën",UPLOAD_SHARE_LOCATION:"Ndani lokacionin",UPLOAD_ERROR:"Na vjen keq, diçka nuk shkoi si duhet. Dosja mund të mos ket mbështetje ose mund të jetë shumë e madhe.",SHARE_LOCATION_ERROR:"Nuk mund të ndahet lokacioni: ",LOADING:"Ngarkim...",HUB_EMPTY:"Këtu do të paraqitet/ shfaqet historia e bisedës tuaj",HUB_SHOW_EARLIER:"Shfaqi bisedat e mëparshme",INBOX_NO_CHATS_TITLE:"Nuk ka biseda!",INBOX_NO_CHATS_BODY:"Pasi të keni një ose më shumë biseda, ato do të paraqiten/shfaqen këtu.",ENABLE_TRANSLATION:"Përkthejeni këtë bisedë në shqiptare",DISABLE_TRANSLATION:"Shikoni origjinalin",SEARCH_PLACEHOLDER_TEXT:"Kërko...",SEARCH_SEARCHING:"Kërko...",SEARCH_NO_RESULTS:"Nuk ka rezultate",SEARCH_NO_MORE_RESULTS:"Nuk ka më rezultate",CHAT_NOT_FOUND:"Biseda nuk u gjet",DELETE_MESSAGE:"Fshi mesazhin",DELETION_EXPLANATION:"Nëse e fshini këtë mesazh, ai do të zhduket për të gjithë.",EDIT_MESSAGE:"Redakto mesazhin",SAVE:"Ruaj",EDITED_INDICATOR:"redaktuar",REPLY_TO_MESSAGE:"Përgjigj",ADD_REACTION:"Shtoni reagimin",AUTH_EXPIRED_OVERLAY_TITLE:"Sesioni juaj i bisedës ka skaduar",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Rifresko faqen për të vazhduar",VOICE_MESSAGE:"Mesazh zanor",CONTACT_INFORMATION_HIDDEN:"informacione të fshehura",LEAVE_CONVERSATION:"Largohu nga bashkëbisedimi",MARK_CONVERSATION_AS_UNREAD:"Shëno si të palexuar",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},PS={code:"sr-SP",name:"Serbian",translation:{YESTERDAY:"Juče",TODAY:"Danas",DAYS:"d",HOURS:"s",MINUTES:"m",JUST_NOW:"Upravo sad",LOCATION:"Lokacija",CANCEL:"Otkaži",INBOX:"Pretinac",DESKTOP_NOTIFICATIONS:"Browser Notifikacija",DESKTOP_NOTIFICATIONS_ERROR:"Browser notifikacije nisu omogućene jer ih vaš pregledač aktivno blokira. Pokušajte pogledati postavke ili koristiti neki drugi pregledač.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demo notifikacija`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Ako karticu pregledača ostavite otvorenu, pojaviće se ovaj pop-up kada neko razgovara s vama.",SEND_BUTTON_TEXT:"Pošalji",ENTRYBOX_TEXT_LIMIT:"Dozvoljeno je samo 10.000 znakova.",ENTRYBOX_PLACEHOLDER:"Kaži nešto...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ovaj razgovor više nije aktivan.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Možete da čitate, ali ne i da šaljete poruke.",MESSAGELIST_LOADING_OLDER:"Učitavam starije poruke...",MESSAGELIST_SHOW_OLDER:"Prikaži starije poruke",MESSAGELIST_NEW_MARKER:"Novo",MESSAGE_SENT_VIA_EMAIL:"Ova poruka je poslana imejlom",YOU_MARKER:"ti",UPLOAD_IN_PROGRESS:"Učitavam...",UPLOAD_SEND_FILE:"Pošalji datoteku",UPLOAD_SHARE_LOCATION:"Podeli lokaciju",UPLOAD_ERROR:"Nažalost, nešto je pošlo krivo. Datoteka možda nije podržana ili je prevelika.",SHARE_LOCATION_ERROR:"Nije moguće podeliti lokaciju: ",LOADING:"Učitavam...",HUB_EMPTY:"Ovde će biti prikazana istorija razgovora",HUB_SHOW_EARLIER:"Prikaži ranije razgovore",INBOX_NO_CHATS_TITLE:"Nema razgovora!",INBOX_NO_CHATS_BODY:"Nakon što vodite jedan ili više razgovora, oni će se pojaviti ovde.",ENABLE_TRANSLATION:"Prevedi ovaj razgovor na srpski jezik",DISABLE_TRANSLATION:"Prikaži original",SEARCH_PLACEHOLDER_TEXT:"Pretraži...",SEARCH_SEARCHING:"Pretraživanje...",SEARCH_NO_RESULTS:"Nema rezultata",SEARCH_NO_MORE_RESULTS:"Nema više rezultata",CHAT_NOT_FOUND:"Ćaskanje nije pronađeno",DELETE_MESSAGE:"Izbriši poruku",DELETION_EXPLANATION:"Ako obrišete ovu poruku, ona neće biti vidljiva ni za koga.",EDIT_MESSAGE:"Ispravi poruku",SAVE:"Sačuvaj",EDITED_INDICATOR:"ispravljeno",REPLY_TO_MESSAGE:"Odgovorite",ADD_REACTION:"Dodaj reakciju",AUTH_EXPIRED_OVERLAY_TITLE:"Vaša sesija ćaskanja je istekla",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Osvežite stranicu da biste nastavili",VOICE_MESSAGE:"Glasovna poruka",CONTACT_INFORMATION_HIDDEN:"Sakrivene informacije",LEAVE_CONVERSATION:"Napusti razgovor",MARK_CONVERSATION_AS_UNREAD:"Označi kao nepročitanu",REPLY_TO_ARIA_LABEL:(n,t)=>`Odgovarate korisniku ${n}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Izađi iz moda pisanja odgovora",STATUS_INDICATOR_ONLINE:"Aktivan",STATUS_INDICATOR_OFFLINE:"Neaktivan"}},BS={code:"sv-SE",name:"Swedish (Sweden)",translation:{YESTERDAY:"Igår",TODAY:"Idag",DAYS:"d",HOURS:"h",MINUTES:"m",JUST_NOW:"just nu",LOCATION:"Plats",CANCEL:"Avbryt",INBOX:"Inkorg",DESKTOP_NOTIFICATIONS:"Webbläsarnotiser",DESKTOP_NOTIFICATIONS_ERROR:"Kan inte aktivera webbläsarnotiser eftersom din webbläsare aktivt blockerar dem. Se över inställningarna eller använd en annan webbläsare.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} demonotis`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Om du har fliken i webbläsaren öppen så kommer den här notisen visas när någon pratar med dig.",SEND_BUTTON_TEXT:"Skicka",ENTRYBOX_TEXT_LIMIT:"Max 10 000 tecken är tillåtet.",ENTRYBOX_PLACEHOLDER:"Skriv ett meddelande...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Den här konversationen är inte längre aktiv.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Du kan läsa men inte skicka meddelanden.",MESSAGELIST_LOADING_OLDER:"Läser in tidigare meddelanden...",MESSAGELIST_SHOW_OLDER:"Visa tidigare meddelanden",MESSAGELIST_NEW_MARKER:"Nytt",MESSAGE_SENT_VIA_EMAIL:"Detta meddelande skickades via e-post",YOU_MARKER:"du",UPLOAD_IN_PROGRESS:"Laddar upp...",UPLOAD_SEND_FILE:"Skicka fil",UPLOAD_SHARE_LOCATION:"Dela plats",UPLOAD_ERROR:"Något gick fel vid uppladdningen. Filen kan vara av en typ som inte stöds eller är för stor.",SHARE_LOCATION_ERROR:"Kan inte dela plats: ",LOADING:"Laddar...",HUB_EMPTY:"Din chatthistorik kommer att visas här",HUB_SHOW_EARLIER:"Visa tidigare chattar",INBOX_NO_CHATS_TITLE:"Inga chattar ännu!",INBOX_NO_CHATS_BODY:"När du har haft en eller flera konversationer kommer de att visas här.",ENABLE_TRANSLATION:"Översätt den här konversationen till svenska",DISABLE_TRANSLATION:"Visa original",SEARCH_PLACEHOLDER_TEXT:"Sök...",SEARCH_SEARCHING:"Söker...",SEARCH_NO_RESULTS:"Inga resultat hittades",SEARCH_NO_MORE_RESULTS:"Inga fler resultat",CHAT_NOT_FOUND:"Chatten hittades inte",DELETE_MESSAGE:"Radera meddelandet",DELETION_EXPLANATION:"Om du raderar det här meddelandet försvinner det för alla.",EDIT_MESSAGE:"Redigera meddelandet",SAVE:"Spara",EDITED_INDICATOR:"redigerad",REPLY_TO_MESSAGE:"Svara",ADD_REACTION:"Lägg till reaktion",AUTH_EXPIRED_OVERLAY_TITLE:"Din chatsession har gått ut",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Uppdatera sidan för att fortsätta",VOICE_MESSAGE:"Röstmeddelande",CONTACT_INFORMATION_HIDDEN:"Dold information",LEAVE_CONVERSATION:"Lämna konversationen",MARK_CONVERSATION_AS_UNREAD:"Markera som oläst",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},FS={code:"tr-TR",name:"Turkish",translation:{YESTERDAY:"Dün",TODAY:"Bugün",DAYS:"g",HOURS:"s",MINUTES:"d",JUST_NOW:"az önce",LOCATION:"Konum",CANCEL:"İptal",INBOX:"Gelen Kutusu",SEND_BUTTON_TEXT:"Gönder",ENTRYBOX_TEXT_LIMIT:"En fazla 10.000 karaktere izin veriliyor.",ENTRYBOX_PLACEHOLDER:"Bir şeyler söyle...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Bu konuşma artık aktif değil.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Mesajları okuyabilirsiniz ancak mesaj gönderemezsiniz.",MESSAGELIST_LOADING_OLDER:"Eski mesajlar yükleniyor...",MESSAGELIST_SHOW_OLDER:"Eski mesajları göster",MESSAGELIST_NEW_MARKER:"Yeni",DESKTOP_NOTIFICATIONS:"Tarayıcı bildirimleri",DESKTOP_NOTIFICATIONS_ERROR:"Tarayıcınız aktif olarak engellediğinden tarayıcı bildirimlerini etkinleştiremiyoruz. Ayarları kontrol etmeyi veya farklı bir tarayıcı kullanmayı deneyebilirsiniz.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} test bildirimi`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Eğer tarayıcınızın penceresini açık tutarsanız biri mesaj yazdığında bu bildirimi göreceksiniz.",MESSAGE_SENT_VIA_EMAIL:"Bu mesaj e-posta ile gönderilmiştir.",YOU_MARKER:"siz",UPLOAD_IN_PROGRESS:"Yükleniyor...",UPLOAD_SEND_FILE:"Dosya gönder",UPLOAD_SHARE_LOCATION:"Konum paylaş",UPLOAD_ERROR:"Yükleme sırasında bir şeyler yanlış gitti. Dosya desteklenmiyor veya izin verilenden büyük olabilir.",SHARE_LOCATION_ERROR:"Konum paylaşılamadı: ",LOADING:"Yükleniyor...",HUB_EMPTY:"Konuşma geçmişiniz burada görünecek",HUB_SHOW_EARLIER:"Önceki konuşmaları göster",INBOX_NO_CHATS_TITLE:"Henüz konuşma yok!",INBOX_NO_CHATS_BODY:"Bir veya daha fazla konuşma başlattığınız konuşmalar burada belirecek.",ENABLE_TRANSLATION:"Bu konuşmayı Türkçe'ye çevir",DISABLE_TRANSLATION:"Orijinali göster",SEARCH_PLACEHOLDER_TEXT:"Ara...",SEARCH_SEARCHING:"Arıyor...",SEARCH_NO_RESULTS:"Sonuç bulunamadı",SEARCH_NO_MORE_RESULTS:"Başka sonuç bulunamadı.",CHAT_NOT_FOUND:"Sohbet bulunamadı",DELETE_MESSAGE:"Mesajı sil",DELETION_EXPLANATION:"Bu mesajı silerseniz herkes için görünmez olacaktır.",EDIT_MESSAGE:"Mesajı düzenle",SAVE:"Kaydet",EDITED_INDICATOR:"düzenlenmiş",REPLY_TO_MESSAGE:"Yanıtla",ADD_REACTION:"Tepki ekle",AUTH_EXPIRED_OVERLAY_TITLE:"Sohbet oturumunuz sona erdi",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Devam etmek için sayfayı yenileyin",VOICE_MESSAGE:"Sesli mesaj",CONTACT_INFORMATION_HIDDEN:"Gizli bilgi",LEAVE_CONVERSATION:"Konuşmadan ayrıl",MARK_CONVERSATION_AS_UNREAD:"Okunmamış olarak işaretle",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},US={code:"uk-UA",name:"Ukrainian (Ukraine)",translation:{YESTERDAY:"Вчора",TODAY:"Сьогодні",DAYS:"d",HOURS:"h",MINUTES:"м",JUST_NOW:"просто зараз",LOCATION:"Місцезнаходження",CANCEL:"Скасувати",INBOX:"Вхідні",DESKTOP_NOTIFICATIONS:"Сповіщення в браузері",DESKTOP_NOTIFICATIONS_ERROR:"Неможливо ввімкнути сповіщення в браузері, оскільки ваш веб-переглядач активно їх блокує. Спробуйте переглянути налаштування або використовувати інший браузер.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`Демо-повідомлення про ${n}`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Якщо ви відкриєте вкладку веб-переглядача відкритою, ви побачите це спливаюче вікно, коли хтось спілкується з вами.",SEND_BUTTON_TEXT:"Надіслати",ENTRYBOX_TEXT_LIMIT:"Дозволено лише 10 000 символів.",ENTRYBOX_PLACEHOLDER:"Скажи щось...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Ця розмова більше не активна.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Ви можете читати, але не надсилати повідомлення.",MESSAGELIST_LOADING_OLDER:"Завантаження старих повідомлень...",MESSAGELIST_SHOW_OLDER:"Показати старіші повідомлення",MESSAGELIST_NEW_MARKER:"Нові",MESSAGE_SENT_VIA_EMAIL:"Це повідомлення надіслано електронною поштою",YOU_MARKER:"ти",UPLOAD_IN_PROGRESS:"Завантаження...",UPLOAD_SEND_FILE:"Надіслати файл",UPLOAD_SHARE_LOCATION:"Поділитися місцезнаходженням",UPLOAD_ERROR:"На жаль, під час завантаження щось не вдалось. Файл може бути непідтримуваним або занадто великим.",SHARE_LOCATION_ERROR:"Неможливо поділити місцезнаходження: ",LOADING:"Завантаження...",HUB_EMPTY:"Тут відобразиться ваша історія чатів",HUB_SHOW_EARLIER:"Показати попередні чати",INBOX_NO_CHATS_TITLE:"Чатів ще немає!",INBOX_NO_CHATS_BODY:"Після того, як ви проведете одну чи кілька бесід, вони з’являться тут.",ENABLE_TRANSLATION:"Перекласти цю розмову англійською",DISABLE_TRANSLATION:"Показати оригінал",SEARCH_PLACEHOLDER_TEXT:"Пошук...",SEARCH_SEARCHING:"Пошук...",SEARCH_NO_RESULTS:"Не знайдено результатів",SEARCH_NO_MORE_RESULTS:"Більше немає результатів",CHAT_NOT_FOUND:"Чат не знайдено",DELETE_MESSAGE:"Видалити повідомлення",DELETION_EXPLANATION:"Якщо ви видалите це повідомлення, воно зникне для всіх.",EDIT_MESSAGE:"Редагувати повідомлення",SAVE:"Зберегти",EDITED_INDICATOR:"відредаговано",REPLY_TO_MESSAGE:"Відповісти",ADD_REACTION:"Додати реакцію",AUTH_EXPIRED_OVERLAY_TITLE:"Ваша сесія в чаті закінчилась",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Оновіть сторінку, щоб продовжити",VOICE_MESSAGE:"Голосове повідомлення",CONTACT_INFORMATION_HIDDEN:"Прихована інформація",LEAVE_CONVERSATION:"Залишити розмову",MARK_CONVERSATION_AS_UNREAD:"Відзначити як непрочитане",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},HS={code:"vi-VN",name:"Vietnamese",translation:{YESTERDAY:"Hôm qua",TODAY:"Hôm nay",DAYS:"ngày",HOURS:"giờ",MINUTES:"phút",JUST_NOW:"vừa xong",LOCATION:"Địa điểm",CANCEL:"Hủy",INBOX:"Hộp thư đến",DESKTOP_NOTIFICATIONS:"Thông báo trình duyệt",DESKTOP_NOTIFICATIONS_ERROR:"Không thể bật thông báo trên trình duyệt vì trình duyệt của bạn đang tắt chức năng này. Hãy thử tìm trong cài đặt trình duyệt hoặc sử dụng một trình duyệt khác.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} thông báo thử nghiệm`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"Nếu bạn giữ tab trình duyệt của bạn mở, bạn sẽ thấy cửa sổ bật lên khi ai đó nói chuyện với bạn.",SEND_BUTTON_TEXT:"Gửi",ENTRYBOX_TEXT_LIMIT:"Tối đa 10.000 ký tự.",ENTRYBOX_PLACEHOLDER:"Nói gì đó...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"Cuộc hội thoại này không còn hoạt động.",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"Bạn có thể đọc, nhưng không thể gửi tin nhắn.",MESSAGELIST_LOADING_OLDER:"Đang tải tin nhắn cũ...",MESSAGELIST_SHOW_OLDER:"Hiển thị tin nhắn trước đó",MESSAGELIST_NEW_MARKER:"Mới",MESSAGE_SENT_VIA_EMAIL:"Tin nhắn này đã được gửi qua email",YOU_MARKER:"bạn",UPLOAD_IN_PROGRESS:"Đang tải lên...",UPLOAD_SEND_FILE:"Gửi tệp",UPLOAD_SHARE_LOCATION:"Chia sẻ vị trí",UPLOAD_ERROR:"Thật không may, quá trình tải lên không thành công. Tệp không được hỗ trợ hoặc quá lớn.",SHARE_LOCATION_ERROR:"Không thể chia sẻ vị trí: ",LOADING:"Đang tải...",HUB_EMPTY:"Lịch sử trò chuyện của bạn sẽ hiển thị ở đây",HUB_SHOW_EARLIER:"Hiển thị các cuộc trò chuyện trước đó",INBOX_NO_CHATS_TITLE:"Chưa có cuộc trò chuyện nào!",INBOX_NO_CHATS_BODY:"Khi bạn đã có một hoặc nhiều cuộc trò chuyện, chúng sẽ hiển thị ở đây.",ENABLE_TRANSLATION:"Dịch cuộc hội thoại sang Tiếng Việt",DISABLE_TRANSLATION:"Hiển thị nội dung gốc",SEARCH_PLACEHOLDER_TEXT:"TÌm kiếm...",SEARCH_SEARCHING:"Đang tìm kiếm...",SEARCH_NO_RESULTS:"Không tìm thấy kết quả nào",SEARCH_NO_MORE_RESULTS:"Không có kết quả nào khác",CHAT_NOT_FOUND:"Không tìm thấy cuộc trò chuyện",DELETE_MESSAGE:"Xóa tin nhắn",DELETION_EXPLANATION:"Nếu bạn xóa tin nhắn này, tất cả mọi người sẽ không còn thấy nó.",EDIT_MESSAGE:"Chỉnh sửa tin nhắn",SAVE:"lưu",EDITED_INDICATOR:"đã chỉnh sửa",REPLY_TO_MESSAGE:"đáp lại",ADD_REACTION:"Thêm biểu tượng cảm xúc",AUTH_EXPIRED_OVERLAY_TITLE:"Phiên trò chuyện của bạn đã hết hạn",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"Hãy làm mới trang để tiếp tục",VOICE_MESSAGE:"Tin nhắn thoại",CONTACT_INFORMATION_HIDDEN:"Thông tin ẩn",LEAVE_CONVERSATION:"Thoát khỏi cuộc trò chuyện",MARK_CONVERSATION_AS_UNREAD:"Đánh dấu là chưa đọc",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},$S={code:"zh-CN",name:"Chinese (Simplified)",translation:{YESTERDAY:"昨天",TODAY:"今天",DAYS:"天",HOURS:"小时",MINUTES:"分钟",JUST_NOW:"刚才",LOCATION:"地点",CANCEL:"取消",INBOX:"收件箱",DESKTOP_NOTIFICATIONS:"浏览器通知",DESKTOP_NOTIFICATIONS_ERROR:"因浏览器设置为阻止,所以无法激活浏览器提醒。请去设置里查看或者尝试其他的浏览器。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 演示提醒`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"只要保持浏览器开着,如果有人和你对话,将会自动弹出对话窗口。",SEND_BUTTON_TEXT:"发送",ENTRYBOX_TEXT_LIMIT:"不超过10,000个字符。",ENTRYBOX_PLACEHOLDER:"写点什么吧……",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"该对话已结束。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"你只能阅读信息,不能发送信息。",MESSAGELIST_LOADING_OLDER:"载入之前的信息……",MESSAGELIST_SHOW_OLDER:"显示之前的信息",MESSAGELIST_NEW_MARKER:"新消息",MESSAGE_SENT_VIA_EMAIL:"该信息已通过邮件发送。",YOU_MARKER:"你",UPLOAD_IN_PROGRESS:"上传中……",UPLOAD_SEND_FILE:"发送文件",UPLOAD_SHARE_LOCATION:"分享地址",UPLOAD_ERROR:"上传出错。文件格式不支持或者太大。",SHARE_LOCATION_ERROR:"无法分享地址: ",LOADING:"正在载入……",HUB_EMPTY:"你的聊天记录将在此显示。",HUB_SHOW_EARLIER:"显示之前的聊天记录。",INBOX_NO_CHATS_TITLE:"暂无任何聊天记录!",INBOX_NO_CHATS_BODY:"如果你有一个或多个对话窗口进行中,将显示在这里。",ENABLE_TRANSLATION:"翻译至简体中文",DISABLE_TRANSLATION:"查看原文",SEARCH_PLACEHOLDER_TEXT:"搜索...",SEARCH_SEARCHING:"正在搜索...",SEARCH_NO_RESULTS:"未找到结果",SEARCH_NO_MORE_RESULTS:"无更多结果",CHAT_NOT_FOUND:"未找到“聊天”",DELETE_MESSAGE:"删除消息",DELETION_EXPLANATION:"如果您删除此消息,那么所有人都将无法再看到它。",EDIT_MESSAGE:"编辑消息",SAVE:"保存",EDITED_INDICATOR:"本消息有改动",REPLY_TO_MESSAGE:"回复",ADD_REACTION:"添加反应",AUTH_EXPIRED_OVERLAY_TITLE:"您的聊天会话已过期",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"刷新页面以继续",VOICE_MESSAGE:"语音消息",CONTACT_INFORMATION_HIDDEN:"隐藏信息",LEAVE_CONVERSATION:"离开对话",MARK_CONVERSATION_AS_UNREAD:"标记为未读",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},jS={code:"zh-TW",name:"Chinese (Traditional)",translation:{YESTERDAY:"昨天",TODAY:"昨天",DAYS:"天",HOURS:"小時",MINUTES:"分",JUST_NOW:"現在",LOCATION:"地點",CANCEL:"取消",INBOX:"收件箱",DESKTOP_NOTIFICATIONS:"瀏覽器通知",DESKTOP_NOTIFICATIONS_ERROR:"無法啟用瀏覽器通知,因為您的瀏覽器主動阻止它們。 嘗試查看設置或使用其他瀏覽器。",DESKTOP_NOTIFICATIONS_DEMO_TITLE:n=>`${n} 演示通知`,DESKTOP_NOTIFICATIONS_DEMO_BODY:"如果您持續打開瀏覽器標籤頁,當有人與您通話時,您會看到此彈出窗口。",SEND_BUTTON_TEXT:"發送",ENTRYBOX_TEXT_LIMIT:"只允許10.000個字符。",ENTRYBOX_PLACEHOLDER:"說些什麼...",ENTRYBOX_PLACEHOLDER_CHAT_CLOSED:"此對話不再有效。",ENTRYBOX_PLACEHOLDER_CHAT_READONLY:"您可以閱讀,但不能發送消息。",MESSAGELIST_LOADING_OLDER:"加載舊訊息...",MESSAGELIST_SHOW_OLDER:"顯示較舊的訊息",MESSAGELIST_NEW_MARKER:"新的",MESSAGE_SENT_VIA_EMAIL:"此訊息是通過電郵發送的",YOU_MARKER:"您",UPLOAD_IN_PROGRESS:"上傳中...",UPLOAD_SEND_FILE:"發送文件",UPLOAD_SHARE_LOCATION:"共享位置",UPLOAD_ERROR:"不幸的是,上傳出了問題。 該文件可能不受支持或太大。",SHARE_LOCATION_ERROR:"無法分享位置:",LOADING:"載入中...",HUB_EMPTY:"您的聊天記錄將顯示在此處",HUB_SHOW_EARLIER:"顯示早先的聊天記錄",INBOX_NO_CHATS_TITLE:"還沒聊天!",INBOX_NO_CHATS_BODY:"一旦您進行了一次或多次對話,他們就會顯示在此處。",ENABLE_TRANSLATION:"翻譯此對話至繁體中文",DISABLE_TRANSLATION:"顯示原文",SEARCH_PLACEHOLDER_TEXT:"搜尋...",SEARCH_SEARCHING:"正在搜尋...",SEARCH_NO_RESULTS:"找不到任何結果",SEARCH_NO_MORE_RESULTS:"沒有其他結果",CHAT_NOT_FOUND:"查無對話",DELETE_MESSAGE:"刪除訊息",DELETION_EXPLANATION:"您如果刪除這條訊息,所有人都將看不到它。",EDIT_MESSAGE:"編輯訊息",SAVE:"儲存",EDITED_INDICATOR:"已編輯",REPLY_TO_MESSAGE:"回覆",ADD_REACTION:"加入表情回應",AUTH_EXPIRED_OVERLAY_TITLE:"您的會話過程已過期",AUTH_EXPIRED_OVERLAY_DESCRIPTION:"請刷新頁面以繼續",VOICE_MESSAGE:"語音訊息",CONTACT_INFORMATION_HIDDEN:"隱藏訊息",LEAVE_CONVERSATION:"離開對話",MARK_CONVERSATION_AS_UNREAD:"標記為未讀",REPLY_TO_ARIA_LABEL:M.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:M.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:M.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:M.translation.STATUS_INDICATOR_OFFLINE}},Bm={ar:sS,bg:aS,bs:lS,ca:uS,cs:cS,da:dS,de:hS,el:pS,en:M,es:fS,et:mS,fa:gS,fi:ES,fr:AS,he:vS,hi:_S,hr:yS,hu:TS,id:OS,is:SS,it:NS,ja:CS,ka:bS,ko:IS,nb:wS,nl:RS,pl:DS,pt:kS,ro:LS,ru:xS,sq:MS,sr:PS,sv:BS,tr:FS,uk:US,vi:HS,zh:$S,zhTw:jS};function Fm(n){const t=n.replace(/_/g,"-").toLowerCase(),e=Bm[t];if(e)return{...e.translation,locale:t};const r=t.slice(0,2),i=Bm[r];return i?{...i.translation,locale:r}:(Jn.warn(`User locale '${n}' not supported; falling back to English.`),{...M.translation,locale:"en-US"})}const Um=()=>{const n=document.createElement("canvas");n.width=n.height=1;const t=n.getContext("2d");return t.textBaseline="top",t.font='100px "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Twemoji Mozilla","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',t.scale(.01,.01),t},Hm=(n,t)=>{const e=Um();return e.fillStyle=t,e.fillText(n,0,0),e.getImageData(0,0,1,1).data};function YS(n){const t=Hm(n,"#000"),e=Hm(n,"#fff"),r=(i=>!i.includes("‍")||Um().measureText(i).width<160)(n);return t&&e&&r&&((i,o)=>{const s=[...i].join(",");return s===[...o].join(",")&&!s.startsWith("0,0,0,")})(t,e)}function $m(n){try{return YS(n)}catch(t){return!0}}const jm=function(){if(typeof window=="undefined"||window.E2E)return 16;const n={"🫩":16,"🚶‍➡️":15.1,"🫨":15,"🫠":14,"😵‍💫":13.1,"🥲":13,"🧑‍🦰":12.1,"🥻":12,"🥰":11,"🤩":5,"👱‍♀️":4,"🤣":3,"👁️‍🗨️":2,"😀":1,"😐️":.7,"😃":.6};for(const[t,e]of Object.entries(n))if($m(t))return e}();class Ym{constructor(t,e){this.currentUser$=Pt(null),this.app$=Pt(null),this.appId$=Pt(null),this.extUserId$=Pt(null),this.authTokenState$=Pt("idle"),this.themeCustom$=Pt(um({value:void 0})),this.device$=Pt({supportsEmojiPicker:!!jm,isMobile:typeof window!="undefined"&&/Mobi/i.test(window.navigator.userAgent)}),this.errors$=Pt({unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1}),this.t$=Pt(()=>{var s,a;const r=this.extUserId$.get(),i=this.app$.appMetadata.defaultLocale.get(),o=this.currentUser$.locale.get();return Fm((a=(s=r&&o)!=null?s:i)!=null?a:"en-US")}),Vi(()=>{this.appId$.set(t),this.extUserId$.set(e)})}updateThemeCustom(t){this.themeCustom$.set(um({value:t}))}listenForErrors(t,e){this.errors$.assign({unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1});const r=t.onError(s=>{Jn.error(s.message),this.errors$.serverError.set(!0)}),i=t.currentUser.subscribe(s=>{this.errors$.unknownUser.set(s===null)}),o=e&&t.conversation(e).subscribe(s=>{this.errors$.unknownConversation.set(s===null)});return()=>{r.unsubscribe(),i.unsubscribe(),o==null||o.unsubscribe()}}listenForAuthChanges(t,e){let r=!0;this.authTokenState$.peek()!=="loading"&&this.authTokenState$.set("loading"),t._authProvider.getToken().then(()=>{r&&this.authTokenState$.set("valid")});const i=t._authProvider.onTokenRefreshFailed(()=>{r&&this.authTokenState$.set(e?"invalid":"expired")});return()=>{r=!1,i()}}listenForUserAndAppChanges(t,e){let r=!0,i=null;const o=t.currentUser.subscribe(async s=>{if(r&&s&&(this.currentUser$.set(s),s.role!==i)){i=s.role;const a=await e.getApp(s.role);if(!r)return;this.app$.set(a)}});return()=>{r=!1,o.unsubscribe()}}}const zS={canReplyToMessage:!1,canEditMessage:!1,canDeleteMessage:!1,canAddReaction:!1};class zm extends Ym{constructor(t,e){super(t,e),this.messageSubscription=null,this.readyForNewMessagesPromise=Promise.resolve(),this.participantSubscription=null,this.onlineSubscriptions={},this.state$=Pt({extCurrentConversationId:null,editor:{isEmpty:!0,isTyping:!1,atTextLimit:!1,characterCount:0,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0},referencedMessageId:null,editingMessageId:null,currentConversation:null,visibility:{isInView:!1,tabFocused:!0},messages:{},participants:{},typing:{},isUserConnected:{},ephemeralMessages:{},ephemeralMessageIdMapping:{},localFileBlobUrls:{},userPermissions:()=>{const r=this.app$.role.general.get(),i=this.app$.role.permissions.get();return St.defined(r),St.defined(i),{showTypingIndicator:r.showTypingIndicators,canShareFile:r.enableFileTransfers,canShareLocation:r.enableLocation,canMention:r.enableMentions,showOnlineStatus:r.enablePresence!==!1,canSendVoiceMessage:r.enableVoiceRecording,canLeaveConversation:i.conversations.leave==="all",canMarkConversationAsUnread:i.conversations.markAsUnread==="all"}},messagePermissions:()=>{const r=this.app$.role.permissions.get();St.defined(r);const i=this.state$.userPermissions.get(),o={...zS,...i},s={canReplyToMessage:Ar(r.messages.reply,!0),canEditMessage:Ar(r.messages.edit,!0),canDeleteMessage:Ar(r.messages.delete,!0),canAddReaction:Ar(r.messages.emojiReactions,!0),...i},a={...s,canEditMessage:!1},l={canReplyToMessage:Ar(r.messages.reply,!1),canEditMessage:Ar(r.messages.edit,!1),canDeleteMessage:Ar(r.messages.delete,!1),canAddReaction:Ar(r.messages.emojiReactions,!1),...i};return{system:o,own:s,ownWithoutEditing:a,other:l,otherWithoutEditing:{...l,canEditMessage:!1}}}}),this.locale$=Pt(()=>{var s,a;const r=this.extUserId$.get(),i=this.app$.appMetadata.defaultLocale.get(),o=this.currentUser$.locale.get();return(a=(s=r&&o)!=null?s:i)!=null?a:"en-US"}),this.t$=Pt(()=>Fm(this.locale$.get())),this.referencedMessage$=Pt(()=>{const r=this.state$.extCurrentConversationId.get(),i=this.state$.referencedMessageId.get();return r&&i?this.state$.messages.child(r).lookup.child(i).get():null}),this.chatItems$=Pt(()=>{var p,f;const r=this.state$.extCurrentConversationId.get();if(!r)return[];const i=this.state$.currentConversation.readUntil.get(),o=(p=this.state$.messages.child(r).state.get())!=null?p:[],s=Object.values((f=this.state$.ephemeralMessages.child(r).get())!=null?f:{}),a=s.length===0?o:s.concat(o).sort((m,g)=>g.createdAt-m.createdAt),l=a.map(m=>{const g=m.content[0],E=g==null?void 0:g.type;if(!g||E!=="file")return m;const A=g.size+","+g.filename,v=this.state$.localFileBlobUrls.child(r).child(A).url.get();return v?{...m,content:[{...g,url:v}]}:m});let u=null,c=0,d=!1;const h=[];for(const m of l){const g=new Date(m.createdAt),E=new Date(g).setHours(0,0,0,0),A=c&&E!==c,v=g.getTime()>i,_=!(!d||v||u!=null&&u.id.startsWith("ephemeral"));(_||A)&&h.push(new _c({id:"border-before-"+m.id,isDayMarker:!!A,isReadMarker:!!_,timestamp:A?c:void 0})),h.push(m),d=v,c=E,u=m}return function(m,g){const E=[];let A=[];const v=Symbol("NO_KEY");let _=v;for(const O of m){const T=g(O);_===v||_===T?A.push(O):(E.push(A),A=[O]),_=T}return A.length!==0&&E.push(A),E}(h,m=>{var g;return m instanceof _c?m.id:(g=m.sender)==null?void 0:g.id}).map(m=>(m.id=m.map(g=>g.id).join(","),m))}),this.mentionableUsers$=Pt(()=>{const r=this.state$.extCurrentConversationId.get(),i=this.extUserId$.get();if(!r||!i)return[];const o=this.state$.participants.child(r).get();if(!o||o.length===0)return[];const s=o.map(a=>a.user);return s.sort((a,l)=>a.name.localeCompare(l.name)),function(a,l){const u=l.findIndex(c=>c.id===a);if(u>-1){const c=l[u];l.splice(u,1),l.push(c)}return l}(i,s)})}storeTyping(t,e){this.state$.typing.child(t).set(e)}messagePermissions$(t){const e=this.currentUser$.get();if(!e)throw new Error("Unreachable");const r=t.content[0];return t.sender?e.id===t.sender.id?r.type==="text"?this.state$.messagePermissions.own:this.state$.messagePermissions.ownWithoutEditing:r.type==="text"?this.state$.messagePermissions.other:this.state$.messagePermissions.otherWithoutEditing:this.state$.messagePermissions.system}storeMessages(t,e,r){Vi(()=>{var l;const i=e.reduce((u,c)=>(u[c.id]=c,u),{}),o=this.state$.extCurrentConversationId.peek(),s=this.extUserId$.peek();St(s&&o),this.state$.messages.child(t).set({state:e,lookup:i,loadedAll:r});const a=this.state$.ephemeralMessages.child(t);for(const u of e){const c=this.state$.ephemeralMessageIdMapping.child(t).child(u.id).peek();c&&a.child(c).delete();const d=u.content[0];if(((l=u.sender)==null?void 0:l.id)!==s||d.type!=="file")continue;const h=d.size+","+d.filename,p=this.state$.localFileBlobUrls.child(o).child(h);if(p.fetching.peek()!==!1)continue;const f=()=>p.delete();if(d.subtype==="image"){p.fetching.set(!0);const m=document.createElement("img");m.addEventListener("load",f,{once:!0}),m.src=d.url}else if(d.subtype==="video"){p.fetching.set(!0);const m=document.createElement("video");m.addEventListener("loaddata",f,{once:!0}),m.src=d.url}else if(d.subtype==="audio"){p.fetching.set(!0);const m=document.createElement("audio");m.addEventListener("loaddata",f,{once:!0}),m.src=d.url}}})}}function Ar(n,t){return n==="all"||n==="own"&&t||n==="other"&&!t}class _c{constructor({id:t,isDayMarker:e,isReadMarker:r,timestamp:i}){this.id=t,this.isDayMarker=e,this.isReadMarker=r,this.timestamp=e?i:void 0}}function Pa(n){return C(bt()instanceof zm?VS:WS,{...n})}function VS(n){const t=cn(),e=to();return C(t.Icon,{common:e,...n})}function WS(n){const t=cn(),e=Pm();return C(t.Icon,{common:e,...n})}function yc({src:n,onError:t,filename:e,className:r=""}){const i=X(null),o=X(),s=X(),[a,l]=nt(!1),[u,c]=nt(0),[d,h]=nt(1),p=X(),[f,m]=nt(!1);J(()=>{o.current=new Audio;const A={normalize:!0,height:50,container:i.current};function v(){const T=o.current;T&&(T.error.message==="PIPELINE_ERROR_READ: FFmpegDemuxer: demuxer seek failed"?(T.load(),l(!1)):(m(!0),l(!1),t==null||t()))}const _=e.slice(e.lastIndexOf(".")+1);if(function(T){return/(?:^|\/)talkjs_audio_message_[0-9]+_([0-9]+)[.](?:mp3|webm)$/.test(T)}(e)&&_==="webm"&&!o.current.canPlayType("audio/webm;codecs=opus"))A.backend="WebAudio",s.current=new Audio("data:audio/mp3;base64,//MkxAAHiAICWABElBeKPL/RANb2w+yiT1g/gTok//lP/W/l3h8QO/OCdCqCW2Cw//MkxAQHkAIWUAhEmAQXWUOFW2dxPu//9mr60ElY5sseQ+xxesmHKtZr7bsqqX2L//MkxAgFwAYiQAhEAC2hq22d3///9FTV6tA36JdgBJoOGgc+7qvqej5Zu7/7uI9l//MkxBQHAAYi8AhEAO193vt9KGOq+6qcT7hhfN5FTInmwk8RkqKImTM55pRQHQSq//MkxBsGkgoIAABHhTACIJLf99nVI///yuW1uBqWfEu7CgNPWGpUadBmZ////4sL//MkxCMHMAH9iABEmAsKioqKigsLCwtVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVV//MkxCkECAUYCAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),s.current.controls=!1;else{const T=o.current;T.addEventListener("error",v),T.src=n,T.preload="auto",T.preservesPitch=!0,A.media=T}p.current=function(T){var w,b,I,P,k,B,$,U;if(!T.container)return;const S=getComputedStyle(T.container),N=(w=cs.parse(S.color))!=null?w:new cs(255,255,255,1),y=N.withAlpha(N.alpha/2);return tc.create({...T,barGap:(b=T.barGap)!=null?b:2,barRadius:(I=T.barRadius)!=null?I:0,barWidth:(P=T.barWidth)!=null?P:2,barHeight:T.barHeight,hideScrollbar:!0,cursorWidth:(k=T.cursorWidth)!=null?k:0,cursorColor:T.cursorColor,height:(B=T.height)!=null?B:24,progressColor:($=T.progressColor)!=null?$:y.toRgbaString(),waveColor:(U=T.waveColor)!=null?U:y.toRgbaString()})}(A);const O=p.current;return O.on("finish",()=>{o.current.loop=!0,l(!1)}),O.on("ready",T=>c(Math.trunc(T))),O.on("timeupdate",T=>c(Math.trunc(T))),A.backend==="WebAudio"&&O.load(n).catch(()=>{m(!0),l(!1),t==null||t()}),()=>{var T;(T=o.current)==null||T.removeEventListener("error",v),o.current=void 0,O.destroy(),p.current=void 0}},[n,e,t]);const g=rt(()=>{var A;if(p.current.options.backend==="WebAudio")p.current.isPlaying()||s.current.play(),p.current.playPause(),l((A=p.current.isPlaying())!=null?A:!1);else{const v=o.current;v.paused?v.play():v.pause(),v.loop=!1,!v.paused&&v.ended&&(v.load(),v.play()),l(!v.paused)}},[]),E=rt(A=>{p.current.setPlaybackRate(A),h(A)},[]);return C("div",f?{}:{className:`t-audio-player ${r}`,children:[C("button",{onClick:g,children:C(Pa,{className:"t-play-pause-icon",type:a?"pause":"play","aria-label":a?"pause audio":"play audio"})}),C("div",{className:"t-waveform",ref:i}),C("div",{className:"t-duration",children:uy(u)}),C(ta,{type:"menu",popoverComponent:XS,popoverProps:{playbackSpeed:d,selectPlaybackSpeed:E},className:"t-playback-speed","aria-label":"set playback speed",children:[d,"x",C(Pa,{type:"updown",className:"t-up-down-icon","aria-hidden":!0})]})]})}const GS=[.25,.5,.75,1,1.25,1.5,2];function XS({playbackSpeed:n,selectPlaybackSpeed:t}){return C("div",{className:"t-playback-speed-menu",children:[C("div",{className:"t-playback-heading",children:"Playback Speed"}),GS.map(e=>C(_i,{className:"t-menu-item",onSelect:()=>t(e),children:[C("span",{className:"t-playback-checkmark",children:n===e?"✓ ":""}),e,"x"]},e))]})}const KS=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,qS=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/;class cs{constructor(t,e,r,i){this.red=t,this.green=e,this.blue=r,this.alpha=i}static parse(t){var r;const e=(r=t.match(KS))!=null?r:t.match(qS);if(e){const[i,o,s,a,l="1"]=e;return new cs(Number(o),Number(s),Number(a),Number(l))}return null}withAlpha(t){return new cs(this.red,this.green,this.blue,t)}toRgbaString(){const{red:t,green:e,blue:r,alpha:i}=this;return i!==1?`rgba(${t}, ${e}, ${r}, ${i})`:`rgb(${t}, ${e}, ${r})`}}function ae(n){this.content=n}function Vm(n,t,e){for(let r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;let i=n.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return e;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)e++;return e}if(i.content.size||o.content.size){let s=Vm(i.content,o.content,e+1);if(s!=null)return s}e+=i.nodeSize}else e+=i.nodeSize}}function Wm(n,t,e,r){for(let i=n.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:e,b:r};let s=n.child(--i),a=t.child(--o),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,e--,r--;return{a:e,b:r}}if(s.content.size||a.content.size){let u=Wm(s.content,a.content,e-1,r-1);if(u)return u}e-=l,r-=l}else e-=l,r-=l}}ae.prototype={constructor:ae,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var r=e&&e!=n?this.remove(e):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(e||n,t):(o[i+1]=t,e&&(o[i]=e)),new ae(o)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new ae(e)},addToStart:function(n,t){return new ae([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new ae(e)},addBefore:function(n,t,e){var r=this.remove(t),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,t,e),new ae(i)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return(n=ae.from(n)).size?new ae(n.content.concat(this.subtract(n).content)):this},append:function(n){return(n=ae.from(n)).size?new ae(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=ae.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}},ae.from=function(n){if(n instanceof ae)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new ae(t)};class K{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,e,r,i=0,o){for(let s=0,a=0;a<e;s++){let l=this.content[s],u=a+l.nodeSize;if(u>t&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,t-c),Math.min(l.content.size,e-c),r,i+c)}a=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let o="",s=!0;return this.nodesBetween(t,e,(a,l)=>{let u=a.isText?a.text.slice(Math.max(t,l)-l,e-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new K(i,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],i=0;if(e>t)for(let o=0,s=0;s<e;o++){let a=this.content[o],l=s+a.nodeSize;l>t&&((s<t||l>e)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),i+=a.nodeSize),s=l}return new K(r,i)}cutByIndex(t,e){return t==e?K.empty:t==0&&e==this.content.length?this:new K(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),o=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new K(i,o)}addToStart(t){return new K([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new K(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,e=0){return Vm(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return Wm(this,t,e,r)}findIndex(t,e=-1){if(t==0)return Ba(0,t);if(t==this.size)return Ba(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=i+this.child(r).nodeSize;if(o>=t)return o==t||e>0?Ba(r+1,o):Ba(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return K.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return K.empty;let e,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(e||(e=t.slice(0,i)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new K(e||t,r)}static from(t){if(!t)return K.empty;if(t instanceof K)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new K([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const Tc={index:0,offset:0};function Ba(n,t){return Tc.index=n,Tc.offset=t,Tc}function Fa(n,t){if(n===t)return!0;if(!n||typeof n!="object"||!t||typeof t!="object")return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(!Fa(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!Fa(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}class At{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(o)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Fa(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);return r.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return At.none;if(t instanceof At)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}}At.none=[];class eo extends Error{}class W{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=Xm(this.content,t+this.openStart,e);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(t,e){return new W(Gm(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return W.empty;let r=e.openStart||0,i=e.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(K.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.lastChild)i++;return new W(t,r,i)}}function Gm(n,t,e){let{index:r,offset:i}=n.findIndex(t),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(e);if(i==t||o.isText){if(a!=e&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Gm(o.content,t-i-1,e-i-1)))}function Xm(n,t,e,r){let{index:i,offset:o}=n.findIndex(t),s=n.maybeChild(i);if(o==t||s.isText)return n.cut(0,t).append(e).append(n.cut(t));let a=Xm(s.content,t-o-1,e);return a&&n.replaceChild(i,s.copy(a))}function JS(n,t,e){if(e.openStart>n.depth)throw new eo("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new eo("Inconsistent open depths");return Km(n,t,e,0)}function Km(n,t,e,r){let i=n.index(r),o=n.node(r);if(i==t.index(r)&&r<n.depth-e.openStart){let s=Km(n,t,e,r+1);return o.copy(o.content.replaceChild(i,s))}if(e.content.size){if(e.openStart||e.openEnd||n.depth!=r||t.depth!=r){let{start:s,end:a}=function(l,u){let c=u.depth-l.openStart,d=u.node(c).copy(l.content);for(let h=c-1;h>=0;h--)d=u.node(h).copy(K.from(d));return{start:d.resolveNoCache(l.openStart+c),end:d.resolveNoCache(d.content.size-l.openEnd-c)}}(e,n);return Kr(o,Jm(n,s,a,t,r))}{let s=n.parent,a=s.content;return Kr(s,a.cut(0,n.parentOffset).append(e.content).append(a.cut(t.parentOffset)))}}return Kr(o,Ua(n,t,r))}function qm(n,t){if(!t.type.compatibleContent(n.type))throw new eo("Cannot join "+t.type.name+" onto "+n.type.name)}function Oc(n,t,e){let r=n.node(e);return qm(r,t.node(e)),r}function Xr(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function ds(n,t,e,r){let i=(t||n).node(e),o=0,s=t?t.index(e):i.childCount;n&&(o=n.index(e),n.depth>e?o++:n.textOffset&&(Xr(n.nodeAfter,r),o++));for(let a=o;a<s;a++)Xr(i.child(a),r);t&&t.depth==e&&t.textOffset&&Xr(t.nodeBefore,r)}function Kr(n,t){return n.type.checkContent(t),n.copy(t)}function Jm(n,t,e,r,i){let o=n.depth>i&&Oc(n,t,i+1),s=r.depth>i&&Oc(e,r,i+1),a=[];return ds(null,n,i,a),o&&s&&t.index(i)==e.index(i)?(qm(o,s),Xr(Kr(o,Jm(n,t,e,r,i+1)),a)):(o&&Xr(Kr(o,Ua(n,t,i+1)),a),ds(t,e,i,a),s&&Xr(Kr(s,Ua(e,r,i+1)),a)),ds(r,null,i,a),new K(a)}function Ua(n,t,e){let r=[];return ds(null,n,e,r),n.depth>e&&Xr(Kr(Oc(n,t,e+1),Ua(n,t,e+1)),r),ds(t,null,e,r),new K(r)}W.empty=new W(K.empty,0,0);class hs{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return(t=this.resolveDepth(t))==0?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[3*e],i=e==0?0:this.path[3*e-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return At.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive!==!1||i&&o[s].isInSet(i.marks)||(o=o[s--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive!==!1||i&&r[o].isInSet(i.marks)||(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new QS(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,o=e;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new hs(e,r,o)}static resolveCached(t,e){for(let i=0;i<Sc.length;i++){let o=Sc[i];if(o.pos==e&&o.doc==t)return o}let r=Sc[Nc]=hs.resolve(t,e);return Nc=(Nc+1)%ZS,r}}let Sc=[],Nc=0,ZS=12;class QS{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const t1=Object.create(null);let qr=class Lp{constructor(t,e,r,i=At.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||K.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&Fa(this.attrs,e||t.defaultAttrs||t1)&&At.sameSet(this.marks,r||At.none)}copy(t=null){return t==this.content?this:new Lp(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Lp(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return W.empty;let i=this.resolve(t),o=this.resolve(e),s=r?0:i.sharedDepth(e),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new W(l,i.depth-s,o.depth-s)}replace(t,e,r){return JS(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return hs.resolveCached(this,t)}resolveNoCache(t){return hs.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Zm(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=K.empty,i=0,o=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),s=o&&o.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=At.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!At.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=K.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,i,r)}};qr.prototype.text=void 0;class Ha extends qr{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Ha(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Ha(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Zm(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}class Jr{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new e1(t,e);if(r.next==null)return Jr.empty;let i=Qm(r);r.next&&r.err("Unexpected trailing text");let o=function(s){let a=Object.create(null);return l(ng(s,0));function l(u){let c=[];u.forEach(h=>{s[h].forEach(({term:p,to:f})=>{if(!p)return;let m;for(let g=0;g<c.length;g++)c[g][0]==p&&(m=c[g][1]);ng(s,f).forEach(g=>{m||c.push([p,m=[]]),m.indexOf(g)==-1&&m.push(g)})})});let d=a[u.join(",")]=new Jr(u.indexOf(s.length-1)>-1);for(let h=0;h<c.length;h++){let p=c[h][1].sort(eg);d.next.push({type:c[h][0],next:a[p.join(",")]||l(p)})}return d}}(function(s){let a=[[]];return c(d(s,0),l()),a;function l(){return a.push([])-1}function u(h,p,f){let m={term:f,to:p};return a[h].push(m),m}function c(h,p){h.forEach(f=>f.to=p)}function d(h,p){if(h.type=="choice")return h.exprs.reduce((f,m)=>f.concat(d(m,p)),[]);if(h.type!="seq"){if(h.type=="star"){let f=l();return u(p,f),c(d(h.expr,f),f),[u(f)]}if(h.type=="plus"){let f=l();return c(d(h.expr,p),f),c(d(h.expr,f),f),[u(f)]}if(h.type=="opt")return[u(p)].concat(d(h.expr,p));if(h.type=="range"){let f=p;for(let m=0;m<h.min;m++){let g=l();c(d(h.expr,f),g),f=g}if(h.max==-1)c(d(h.expr,f),f);else for(let m=h.min;m<h.max;m++){let g=l();u(f,g),c(d(h.expr,f),g),f=g}return[u(f)]}if(h.type=="name")return[u(p,void 0,h.value)];throw new Error("Unknown expr type")}for(let f=0;;f++){let m=d(h.exprs[f],p);if(f==h.exprs.length-1)return m;c(m,p=l())}}}(i));return function(s,a){for(let l=0,u=[s];l<u.length;l++){let c=u[l],d=!c.validEnd,h=[];for(let p=0;p<c.next.length;p++){let{type:f,next:m}=c.next[p];h.push(f.name),!d||f.isText||f.hasRequiredAttrs()||(d=!1),u.indexOf(m)==-1&&u.push(m)}d&&a.err("Only non-generatable nodes ("+h.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,r),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let o=e;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];return function o(s,a){let l=s.matchFragment(t,r);if(l&&(!e||l.validEnd))return K.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!c.isText&&!c.hasRequiredAttrs()&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];a.isLeaf||a.hasRequiredAttrs()||a.name in e||i.type&&!l.validEnd||(r.push({match:a.contentMatch,type:a,via:i}),e[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&e(r.next[i].next)}(this),t.map((e,r)=>{let i=r+(e.validEnd?"*":" ")+" ";for(let o=0;o<e.next.length;o++)i+=(o?", ":"")+e.next[o].type.name+"->"+t.indexOf(e.next[o].next);return i}).join(`
75
+ `)}}Jr.empty=new Jr(!0);class e1{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function Qm(n){let t=[];do t.push(n1(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function n1(n){let t=[];do t.push(r1(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function r1(n){let t=function(e){if(e.eat("(")){let r=Qm(e);return e.eat(")")||e.err("Missing closing paren"),r}if(!/\W/.test(e.next)){let r=function(i,o){let s=i.nodeTypes,a=s[o];if(a)return[a];let l=[];for(let u in s){let c=s[u];c.groups.indexOf(o)>-1&&l.push(c)}return l.length==0&&i.err("No node type or group '"+o+"' found"),l}(e,e.next).map(i=>(e.inline==null?e.inline=i.isInline:e.inline!=i.isInline&&e.err("Mixing inline and block content"),{type:"name",value:i}));return e.pos++,r.length==1?r[0]:{type:"choice",exprs:r}}e.err("Unexpected token '"+e.next+"'")}(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else{if(!n.eat("{"))break;t=i1(n,t)}return t}function tg(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function i1(n,t){let e=tg(n),r=e;return n.eat(",")&&(r=n.next!="}"?tg(n):-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function eg(n,t){return t-n}function ng(n,t){let e=[];return function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);e.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];a||e.indexOf(l)!=-1||r(l)}}(t),e.sort(eg)}function rg(n){let t=Object.create(null);for(let e in n){let r=n[e];if(!r.hasDefault)return null;t[e]=r.default}return t}function ig(n,t){let e=Object.create(null);for(let r in n){let i=t&&t[r];if(i===void 0){let o=n[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}e[r]=i}return e}function og(n){let t=Object.create(null);if(n)for(let e in n)t[e]=new o1(n[e]);return t}let sg=class jT{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=og(r.attrs),this.defaultAttrs=rg(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Jr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:ig(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new qr(this,this.computeAttrs(t),K.from(e),At.setFrom(r))}createChecked(t=null,e,r){return e=K.from(e),this.checkContent(e),new qr(this,this.computeAttrs(t),e,At.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),(e=K.from(e)).size){let s=this.contentMatch.fillBefore(e);if(!s)return null;e=s.append(e)}let i=this.contentMatch.matchFragment(e),o=i&&i.fillBefore(K.empty,!0);return o?new qr(this,t,e.append(o),At.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:At.none:t}static compile(t,e){let r=Object.create(null);t.forEach((o,s)=>r[o]=new jT(o,e,s));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class o1{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class $a{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=og(i.attrs),this.excluded=null;let o=rg(this.attrs);this.instance=o?new At(this,o):null}create(t=null){return!t&&this.instance?this.instance:new At(this,ig(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((o,s)=>r[o]=new $a(o,i++,e,s)),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}function ag(n,t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],o=n.marks[i],s=o;if(o)e.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&e.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}class ps{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=t.nodes[r.node];return i.contentMatch.matchType(i)})}parse(t,e={}){let r=new dg(this,e,!1);return r.addAll(t,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new dg(this,e,!0);return r.addAll(t,e.from,e.to),W.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(a1(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(t);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(t,e,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=e))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let e=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<e.length;s++){let a=e[s];if((a.priority==null?50:a.priority)<o)break}e.splice(s,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=hg(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=hg(s)),s.node||s.ignore||s.mark||(s.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new ps(t,ps.schemaRules(t)))}}const lg={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},s1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ug={ol:!0,ul:!0};function cg(n,t,e){return t!=null?(t?1:0)|(t==="full"?2:0):n&&n.whitespace=="pre"?3:-5&e}class Cc{constructor(t,e,r,i,o,s,a){this.type=t,this.attrs=e,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=a,this.content=[],this.activeMarks=At.none,this.stashMarks=[],this.match=s||(4&a?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(K.from(t));if(!e){let r,i=this.type.contentMatch;return(r=i.findWrapping(t.type))?(this.match=i,r):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let r,i=this.content[this.content.length-1];if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let o=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-r[0].length))}}let e=K.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,r=this.pendingMarks;e<r.length;e++){let i=r[e];(this.type?this.type.allowsMarkType(i.type):l1(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lg.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class dg{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0;let i,o=e.topNode,s=cg(null,e.preserveWhitespace,0)|(r?4:0);i=o?new Cc(o.type,o.attrs,At.none,At.none,!0,e.topMatch||o.type.contentMatch,s):new Cc(r?null:t.schema.topNodeType,null,At.none,At.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){t.nodeType==3?this.addTextNode(t):t.nodeType==1&&this.addElement(t)}withStyleRules(t,e){let r=t.getAttribute("style");if(!r)return e();let i=this.readStyles(function(l){let u,c=/\s*([\w-]+)\s*:\s*([^;]+)/g,d=[];for(;u=c.exec(l);)d.push(u[1],u[2].trim());return d}(r));if(!i)return;let[o,s]=i,a=this.top;for(let l=0;l<s.length;l++)this.removePendingMark(s[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l]);e();for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<s.length;l++)this.addPendingMark(s[l])}addTextNode(t){let e=t.nodeValue,r=this.top;if(2&r.options||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&r.options)e=2&r.options?e.replace(/\r\n?/g,`
76
76
  `):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=t.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)}addElement(t,e){let r,i=t.nodeName.toLowerCase();ug.hasOwnProperty(i)&&this.parser.normalizeLists&&function(s){for(let a=s.firstChild,l=null;a;a=a.nextSibling){let u=a.nodeType==1?a.nodeName.toLowerCase():null;u&&ug.hasOwnProperty(u)&&l?(l.appendChild(a),a=l):u=="li"?l=a:u&&(l=null)}}(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(r=this.parser.matchTag(t,this,e));if(o?o.ignore:s1.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let s,a=this.top,l=this.needsBlock;if(lg.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),s=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);o&&o.skip?this.addAll(t):this.withStyleRules(t,()=>this.addAll(t)),s&&this.sync(a),this.needsBlock=l}else this.withStyleRules(t,()=>{this.addElementByRule(t,o,o.consuming===!1?r:void 0)})}leafFallback(t){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
77
- `))}ignoreFallback(t){t.nodeName!="BR"||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=At.none,r=At.none;for(let i=0;i<t.length;i+=2)for(let o;;){let s=this.parser.matchStyle(t[i],t[i+1],this,o);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(a=>{s.clearMark(a)&&(r=a.addToSet(r))}):e=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(e),s.consuming!==!1)break;o=s}return[e,r]}addElementByRule(t,e,r){let i,o,s;e.node?(o=this.parser.schema.nodes[e.node],o.isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):i=this.enter(o,e.attrs||null,e.preserveWhitespace)):(s=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(s));let a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=t;typeof e.contentElement=="string"?l=t.querySelector(e.contentElement):typeof e.contentElement=="function"?l=e.contentElement(t):e.contentElement&&(l=e.contentElement),this.findAround(t,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}addAll(t,e,r){let i=e||0;for(let o=e?t.childNodes[e]:t.firstChild,s=r==null?null:t.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o);this.findAtPoint(t,i)}findPlace(t){let e,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=o,!s.length)||o.solid)break}if(!e)return!1;this.sync(r);for(let i=0;i<e.length;i++)this.enterInner(e[i],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let r=e.activeMarks;for(let i=0;i<t.marks.length;i++)e.type&&!e.type.allowsMarkType(t.marks[i].type)||(r=t.marks[i].addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,r){let i=this.findPlace(t.create(e));return i&&this.enterInner(t,e,!0,r),i}enterInner(t,e=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let s=cg(t,i,o.options);4&o.options&&o.content.length==0&&(s|=4),this.nodes.push(new Cc(t,e,o.activeMarks,o.pendingMarks,r,null,s)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=e[a];if(u==""){if(a==e.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let r=this.parser.schema.nodes[e];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(t){let e=function(r,i){for(let o=0;o<i.length;o++)if(r.eq(i[o]))return i[o]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let o=i.popFromStashMark(t);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==e)break}}}function a1(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function hg(n){let t={};for(let e in n)t[e]=n[e];return t}function l1(n,t){let e=t.schema.nodes;for(let r in e){let i=e[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==t||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class Zn{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=bc(e).createDocumentFragment());let i=r,o=[];return t.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(this.marks[u.type.name]){if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}else l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,e);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,e))}),r}serializeNodeInner(t,e){let{dom:r,contentDOM:i}=Zn.renderSpec(bc(e),this.nodes[t.type.name](t));if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&Zn.renderSpec(bc(r),i(t,e))}static renderSpec(t,e,r=null){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i,o=e[0],s=o.indexOf(" ");s>0&&(r=o.slice(0,s),o=o.slice(s+1));let a=r?t.createElementNS(r,o):t.createElement(o),l=e[1],u=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let c in l)if(l[c]!=null){let d=c.indexOf(" ");d>0?a.setAttributeNS(c.slice(0,d),c.slice(d+1),l[c]):a.setAttribute(c,l[c])}}for(let c=u;c<e.length;c++){let d=e[c];if(d===0){if(c<e.length-1||c>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}{let{dom:h,contentDOM:p}=Zn.renderSpec(t,d,r);if(a.appendChild(h),p){if(i)throw new RangeError("Multiple content holes");i=p}}}return{dom:a,contentDOM:i}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Zn(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=pg(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return pg(t.marks)}}function pg(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function bc(n){return n.document||window.document}const fg=Math.pow(2,16);function u1(n,t){return n+t*fg}function mg(n){return 65535&n}let Ic=class{constructor(n,t,e){this.pos=n,this.delInfo=t,this.recover=e}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}},Zr=class jo{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&jo.empty)return jo.empty}recover(t){let e=0,r=mg(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/fg}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:u1(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new Ic(h,f,p)}i+=c-u}return r?t+i:new Ic(t+i,0,null)}touches(t,e){let r=0,i=mg(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new jo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?jo.empty:new jo(t<0?[0,-t,0]:[0,0,t])}};Zr.empty=new Zr([]);let c1=class Ou{constructor(t=[],e,r=0,i=t.length){this.maps=t,this.mirror=e,this.from=r,this.to=i}slice(t=0,e=this.maps.length){return new Ou(this.maps,this.mirror,t,e)}copy(){return new Ou(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),e!=null&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,r=this.maps.length;e<t.maps.length;e++){let i=t.getMirror(e);this.appendMap(t.maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this.maps.length+t.maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t.maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new Ou;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o].mapResult(t,e);if(s.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,t=this.maps[a].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new Ic(t,i,null)}};const wc=Object.create(null);let fe=class{getMap(){return Zr.empty}merge(n){return null}static fromJSON(n,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let e=wc[t.stepType];if(!e)throw new RangeError(`No step type ${t.stepType} defined`);return e.fromJSON(n,t)}static jsonID(n,t){if(n in wc)throw new RangeError("Duplicate use of step JSON ID "+n);return wc[n]=t,t.prototype.jsonID=n,t}},ye=class ca{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new ca(t,null)}static fail(t){return new ca(null,t)}static fromReplace(t,e,r,i){try{return ca.ok(t.replace(e,r,i))}catch(o){if(o instanceof to)return ca.fail(o.message);throw o}}};function Rc(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Rc(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}let Dc=class da extends fe{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new G(Rc(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return ye.fromReplace(t,this.from,this.to,o)}invert(){return new fs(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new da(e.pos,r.pos,this.mark)}merge(t){return t instanceof da&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new da(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new da(e.from,e.to,t.markFromJSON(e.mark))}};fe.jsonID("addMark",Dc);let fs=class ha extends fe{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new G(Rc(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return ye.fromReplace(t,this.from,this.to,r)}invert(){return new Dc(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ha(e.pos,r.pos,this.mark)}merge(t){return t instanceof ha&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ha(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ha(e.from,e.to,t.markFromJSON(e.mark))}};fe.jsonID("removeMark",fs);let kc=class pa extends fe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return ye.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new pa(this.pos,e.marks[i]);return new pa(this.pos,this.mark)}}return new Lc(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new pa(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pa(e.pos,t.markFromJSON(e.mark))}};fe.jsonID("addNodeMark",kc);let Lc=class xp extends fe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return ye.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new kc(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new xp(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xp(e.pos,t.markFromJSON(e.mark))}};fe.jsonID("removeNodeMark",Lc);let Qn=class Li extends fe{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&xc(t,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Zr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Li(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new Li(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Li)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?G.empty:new G(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Li(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?G.empty:new G(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Li(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Li(e.from,e.to,G.fromJSON(t,e.slice),!!e.structure)}};fe.jsonID("replace",Qn);let Qr=class Su extends fe{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(xc(t,this.from,this.gapFrom)||xc(t,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?ye.fromReplace(t,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new Zr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Su(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Su(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Su(e.from,e.to,e.gapFrom,e.gapTo,G.fromJSON(t,e.slice),e.insert,!!e.structure)}};function xc(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function gg(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}fe.jsonID("replaceAround",Qr);let d1=class{constructor(n,t,e){this.$from=n,this.$to=t,this.unplaced=e,this.frontier=[],this.placed=K.empty;for(let r=0;r<=n.depth;r++){let i=n.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(n.indexAfter(r))})}for(let r=n.depth;r>0;r--)this.placed=K.from(n.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let n=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,e=this.$from,r=this.close(n<0?this.$to:e.doc.resolve(n));if(!r)return null;let i=this.placed,o=e.depth,s=r.depth;for(;o&&s&&i.childCount==1;)i=i.firstChild.content,o--,s--;let a=new G(i,o,s);return n>-1?new Qr(e.pos,n,this.$to.pos,this.$to.end(),a,t):a.size||e.pos!=this.$to.pos?new Qn(e.pos,r.pos,a):null}findFittable(){let n=this.unplaced.openStart;for(let t=this.unplaced.content,e=0,r=this.unplaced.openEnd;e<n;e++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=e){n=e;break}t=i.content}for(let t=1;t<=2;t++)for(let e=t==1?n:this.unplaced.openStart;e>=0;e--){let r,i=null;e?(i=Mc(this.unplaced.content,e-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let s=this.depth;s>=0;s--){let a,{type:l,match:u}=this.frontier[s],c=null;if(t==1&&(o?u.matchType(o.type)||(c=u.fillBefore(K.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:e,frontierDepth:s,parent:i,inject:c};if(t==2&&o&&(a=u.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:s,parent:i,wrap:a};if(i&&u.matchType(i.type))break}}}openMore(){let{content:n,openStart:t,openEnd:e}=this.unplaced,r=Mc(n,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new G(n,t+1,Math.max(e,r.size+t>=n.size-e?t+1:0)),!0)}dropNode(){let{content:n,openStart:t,openEnd:e}=this.unplaced,r=Mc(n,t);if(r.childCount<=1&&t>0){let i=n.size-t<=t+r.size;this.unplaced=new G(ms(n,t-1,1),t-1,i?t-1:e)}else this.unplaced=new G(ms(n,t,1),t,e)}placeNodes({sliceDepth:n,frontierDepth:t,parent:e,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let f=0;f<i.length;f++)this.openFrontierNode(i[f]);let o=this.unplaced,s=e?e.content:o.content,a=o.openStart-n,l=0,u=[],{match:c,type:d}=this.frontier[t];if(r){for(let f=0;f<r.childCount;f++)u.push(r.child(f));c=c.matchFragment(r)}let h=s.size+n-(o.content.size-o.openEnd);for(;l<s.childCount;){let f=s.child(l),m=c.matchType(f.type);if(!m)break;l++,(l>1||a==0||f.content.size)&&(c=m,u.push(Eg(f.mark(d.allowedMarks(f.marks)),l==1?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=gs(this.placed,t,K.from(u)),this.frontier[t].match=c,p&&h<0&&e&&e.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<h;f++){let g=m.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),m=g.content}this.unplaced=p?n==0?G.empty:new G(ms(o.content,n-1,1),n-1,h<0?o.openEnd:n-1):new G(ms(o.content,n,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let n,t=this.frontier[this.depth];if(!t.type.isTextblock||!Pc(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:e}=this.$to,r=this.$to.after(e);for(;e>1&&r==this.$to.end(--e);)++r;return r}findCloseLevel(n){t:for(let t=Math.min(this.depth,n.depth);t>=0;t--){let{match:e,type:r}=this.frontier[t],i=t<n.depth&&n.end(t+1)==n.pos+(n.depth-(t+1)),o=Pc(n,t,r,e,i);if(o){for(let s=t-1;s>=0;s--){let{match:a,type:l}=this.frontier[s],u=Pc(n,s,l,a,!0);if(!u||u.childCount)continue t}return{depth:t,fit:o,move:i?n.doc.resolve(n.after(t+1)):n}}}}close(n){let t=this.findCloseLevel(n);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gs(this.placed,t.depth,t.fit)),n=t.move;for(let e=t.depth+1;e<=n.depth;e++){let r=n.node(e),i=r.type.contentMatch.fillBefore(r.content,!0,n.index(e));this.openFrontierNode(r.type,r.attrs,i)}return n}openFrontierNode(n,t=null,e){let r=this.frontier[this.depth];r.match=r.match.matchType(n),this.placed=gs(this.placed,this.depth,K.from(n.create(t,e))),this.frontier.push({type:n,match:n.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=gs(this.placed,this.frontier.length,n))}};function ms(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(ms(n.firstChild.content,t-1,e)))}function gs(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(gs(n.lastChild.content,t-1,e)))}function Mc(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function Eg(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,Eg(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),n.copy(r)}function Pc(n,t,e,r,i){let o=n.node(t),s=i?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(l,u,c){for(let d=c;d<u.childCount;d++)if(!l.allowsMarks(u.child(d).marks))return!0;return!1}(e,o.content,s)?a:null}function Ag(n,t,e,r,i){if(t<e){let o=n.firstChild;n=n.replaceChild(0,o.copy(Ag(o.content,t+1,e,r,o)))}if(t>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(K.empty,!0))}return n}function vg(n,t){let e=[];for(let r=Math.min(n.depth,t.depth);r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||t.end(r)>t.pos+(t.depth-r)||n.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==n.depth&&r==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&e.push(r)}return e}let _g=class Nu extends fe{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return ye.fromReplace(t,this.pos,this.pos+1,new G(K.from(i),0,e.isLeaf?0:1))}getMap(){return Zr.empty}invert(t){return new Nu(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Nu(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Nu(e.pos,e.attr,e.value)}};fe.jsonID("attr",_g);let yg=class Mp extends fe{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return ye.ok(r)}getMap(){return Zr.empty}invert(t){return new Mp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Mp(e.attr,e.value)}};fe.jsonID("docAttr",yg);let Es=class extends Error{};Es=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(Es.prototype=Object.create(Error.prototype)).constructor=Es,Es.prototype.name="TransformError";class h1{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new c1}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Es(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=G.empty){let i=function(o,s,a=s,l=G.empty){if(s==a&&!l.size)return null;let u=o.resolve(s),c=o.resolve(a);return gg(u,c,l)?new Qn(s,a,l):new d1(u,c,l).fit()}(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new G(K.from(r),0,0))}delete(t,e){return this.replace(t,e,G.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return function(i,o,s,a){if(!a.size)return i.deleteRange(o,s);let l=i.doc.resolve(o),u=i.doc.resolve(s);if(gg(l,u,a))return i.step(new Qn(o,s,a));let c=vg(l,i.doc.resolve(s));c[c.length-1]==0&&c.pop();let d=-(l.depth+1);c.unshift(d);for(let E=l.depth,A=l.pos-1;E>0;E--,A--){let v=l.node(E).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;c.indexOf(E)>-1?d=E:l.before(E)==A&&c.splice(1,0,-E)}let h=c.indexOf(d),p=[],f=a.openStart;for(let E=a.content,A=0;;A++){let v=E.firstChild;if(p.push(v),A==a.openStart)break;E=v.content}for(let E=f-1;E>=0;E--){let A=p[E],v=(m=A.type).spec.defining||m.spec.definingForContent;if(v&&!A.sameMarkup(l.node(Math.abs(d)-1)))f=E;else if(v||!A.type.isTextblock)break}var m;for(let E=a.openStart;E>=0;E--){let A=(E+f+1)%(a.openStart+1),v=p[A];if(v)for(let _=0;_<c.length;_++){let O=c[(_+h)%c.length],T=!0;O<0&&(T=!1,O=-O);let S=l.node(O-1),N=l.index(O-1);if(S.canReplaceWith(N,N,v.type,v.marks))return i.replace(l.before(O),T?u.after(O):s,new G(Ag(a.content,0,a.openStart,A),A,a.openEnd))}}let g=i.steps.length;for(let E=c.length-1;E>=0&&(i.replace(o,s,a),!(i.steps.length>g));E--){let A=c[E];A<0||(o=l.before(A),s=u.after(A))}}(this,t,e,r),this}replaceRangeWith(t,e,r){return function(i,o,s,a){if(!a.isInline&&o==s&&i.doc.resolve(o).parent.content.size){let l=function(u,c,d){let h=u.resolve(c);if(h.parent.canReplaceWith(h.index(),h.index(),d))return c;if(h.parentOffset==0)for(let p=h.depth-1;p>=0;p--){let f=h.index(p);if(h.node(p).canReplaceWith(f,f,d))return h.before(p+1);if(f>0)return null}if(h.parentOffset==h.parent.content.size)for(let p=h.depth-1;p>=0;p--){let f=h.indexAfter(p);if(h.node(p).canReplaceWith(f,f,d))return h.after(p+1);if(f<h.node(p).childCount)return null}return null}(i.doc,o,a.type);l!=null&&(o=s=l)}i.replaceRange(o,s,new G(K.from(a),0,0))}(this,t,e,r),this}deleteRange(t,e){return function(r,i,o){let s=r.doc.resolve(i),a=r.doc.resolve(o),l=vg(s,a);for(let u=0;u<l.length;u++){let c=l[u],d=u==l.length-1;if(d&&c==0||s.node(c).type.contentMatch.validEnd)return r.delete(s.start(c),a.end(c));if(c>0&&(d||s.node(c-1).canReplace(s.index(c-1),a.indexAfter(c-1))))return r.delete(s.before(c),a.after(c))}for(let u=1;u<=s.depth&&u<=a.depth;u++)if(i-s.start(u)==s.depth-u&&o>s.end(u)&&a.end(u)-o!=a.depth-u)return r.delete(s.before(u),o);r.delete(i,o)}(this,t,e),this}lift(t,e){return function(r,i,o){let{$from:s,$to:a,depth:l}=i,u=s.before(l+1),c=a.after(l+1),d=u,h=c,p=K.empty,f=0;for(let E=l,A=!1;E>o;E--)A||s.index(E)>0?(A=!0,p=K.from(s.node(E).copy(p)),f++):d--;let m=K.empty,g=0;for(let E=l,A=!1;E>o;E--)A||a.after(E+1)<a.end(E)?(A=!0,m=K.from(a.node(E).copy(m)),g++):h++;r.step(new Qr(d,h,u,c,new G(p.append(m),f,g),p.size-f,!0))}(this,t,e),this}join(t,e=1){return function(r,i,o){let s=new Qn(i-o,i+o,G.empty,!0);r.step(s)}(this,t,e),this}wrap(t,e){return function(r,i,o){let s=K.empty;for(let u=o.length-1;u>=0;u--){if(s.size){let c=o[u].type.contentMatch.matchFragment(s);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=K.from(o[u].type.create(o[u].attrs,s))}let a=i.start,l=i.end;r.step(new Qr(a,l,a,l,new G(s,0,0),o.length,!0))}(this,t,e),this}setBlockType(t,e=t,r,i=null){return function(o,s,a,l,u){if(!l.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let c=o.steps.length;o.doc.nodesBetween(s,a,(d,h)=>{if(d.isTextblock&&!d.hasMarkup(l,u)&&function(p,f,m){let g=p.resolve(f),E=g.index();return g.parent.canReplaceWith(E,E+1,m)}(o.doc,o.mapping.slice(c).map(h),l)){o.clearIncompatible(o.mapping.slice(c).map(h,1),l);let p=o.mapping.slice(c),f=p.map(h,1),m=p.map(h+d.nodeSize,1);return o.step(new Qr(f,m,f+1,m-1,new G(K.from(l.create(u,null,d.marks)),0,0),1,!0)),!1}})}(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return function(o,s,a,l,u){let c=o.doc.nodeAt(s);if(!c)throw new RangeError("No node at given position");a||(a=c.type);let d=a.create(l,null,u||c.marks);if(c.isLeaf)return o.replaceWith(s,s+c.nodeSize,d);if(!a.validContent(c.content))throw new RangeError("Invalid content for node type "+a.name);o.step(new Qr(s,s+c.nodeSize,s+1,s+c.nodeSize-1,new G(K.from(d),0,0),1,!0))}(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new _g(t,e,r)),this}setDocAttribute(t,e){return this.step(new yg(t,e)),this}addNodeMark(t,e){return this.step(new kc(t,e)),this}removeNodeMark(t,e){if(!(e instanceof At)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(r.marks)))return this}return this.step(new Lc(t,e)),this}split(t,e=1,r){return function(i,o,s=1,a){let l=i.doc.resolve(o),u=K.empty,c=K.empty;for(let d=l.depth,h=l.depth-s,p=s-1;d>h;d--,p--){u=K.from(l.node(d).copy(u));let f=a&&a[p];c=K.from(f?f.type.create(f.attrs,c):l.node(d).copy(c))}i.step(new Qn(o,o,new G(u.append(c),s,s),!0))}(this,t,e,r),this}addMark(t,e,r){return function(i,o,s,a){let l,u,c=[],d=[];i.doc.nodesBetween(o,s,(h,p,f)=>{if(!h.isInline)return;let m=h.marks;if(!a.isInSet(m)&&f.type.allowsMarkType(a.type)){let g=Math.max(p,o),E=Math.min(p+h.nodeSize,s),A=a.addToSet(m);for(let v=0;v<m.length;v++)m[v].isInSet(A)||(l&&l.to==g&&l.mark.eq(m[v])?l.to=E:c.push(l=new fs(g,E,m[v])));u&&u.to==g?u.to=E:d.push(u=new Dc(g,E,a))}}),c.forEach(h=>i.step(h)),d.forEach(h=>i.step(h))}(this,t,e,r),this}removeMark(t,e,r){return function(i,o,s,a){let l=[],u=0;i.doc.nodesBetween(o,s,(c,d)=>{if(!c.isInline)return;u++;let h=null;if(a instanceof $a){let p,f=c.marks;for(;p=a.isInSet(f);)(h||(h=[])).push(p),f=p.removeFromSet(f)}else a?a.isInSet(c.marks)&&(h=[a]):h=c.marks;if(h&&h.length){let p=Math.min(d+c.nodeSize,s);for(let f=0;f<h.length;f++){let m,g=h[f];for(let E=0;E<l.length;E++){let A=l[E];A.step==u-1&&g.eq(l[E].style)&&(m=A)}m?(m.to=p,m.step=u):l.push({style:g,from:Math.max(d,o),to:p,step:u})}}}),l.forEach(c=>i.step(new fs(c.from,c.to,c.style)))}(this,t,e,r),this}clearIncompatible(t,e,r){return function(i,o,s,a=s.contentMatch){let l=i.doc.nodeAt(o),u=[],c=o+1;for(let d=0;d<l.childCount;d++){let h=l.child(d),p=c+h.nodeSize,f=a.matchType(h.type);if(f){a=f;for(let m=0;m<h.marks.length;m++)s.allowsMarkType(h.marks[m].type)||i.step(new fs(c,p,h.marks[m]));if(h.isText&&!s.spec.code){let m,g,E=/\r?\n|\r/g;for(;m=E.exec(h.text);)g||(g=new G(K.from(s.schema.text(" ",s.allowedMarks(h.marks))),0,0)),u.push(new Qn(c+m.index,c+m.index+m[0].length,g))}}else u.push(new Qn(c,p,G.empty));c=p}if(!a.validEnd){let d=a.fillBefore(K.empty,!0);i.replace(c,c,new G(d,0,0))}for(let d=u.length-1;d>=0;d--)i.step(u[d])}(this,t,e,r),this}}const Bc=Object.create(null);class mt{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new p1(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=G.empty){let r=e.content.lastChild,i=null;for(let a=0;a<e.openEnd;a++)i=r,r=r.lastChild;let o=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=t.mapping.slice(o);t.replaceRange(c.map(l.pos),c.map(u.pos),a?G.empty:e),a==0&&Sg(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=t.mapping.slice(r),u=l.map(s.pos),c=l.map(a.pos);o?t.deleteRange(u,c):(t.replaceRangeWith(u,c,e),Sg(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new vt(t):eo(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let s=e<0?eo(t.node(0),t.node(o),t.before(o+1),t.index(o),e,r):eo(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,r);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new je(t.node(0))}static atStart(t){return eo(t,t,0,0,1)||new je(t)}static atEnd(t){return eo(t,t,t.content.size,t.childCount,-1)||new je(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bc[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Bc)throw new RangeError("Duplicate use of selection JSON ID "+t);return Bc[t]=e,e.prototype.jsonID=t,e}getBookmark(){return vt.between(this.$anchor,this.$head).getBookmark()}}mt.prototype.visible=!0;class p1{constructor(t,e){this.$from=t,this.$to=e}}let Tg=!1;function Og(n){Tg||n.parent.inlineContent||(Tg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class vt extends mt{constructor(t,e=t){Og(t),Og(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return mt.near(r);let i=t.resolve(e.map(this.anchor));return new vt(i.parent.inlineContent?i:r,r)}replace(t,e=G.empty){if(super.replace(t,e),e==G.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof vt&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ja(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new vt(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if(r&&!i||(r=i>=0?1:-1),!e.parent.inlineContent){let o=mt.findFrom(e,r,!0)||mt.findFrom(e,-r,!0);if(!o)return mt.near(e,r);e=o.$head}return t.parent.inlineContent||(i==0||(t=(mt.findFrom(t,-r,!0)||mt.findFrom(t,r,!0)).$anchor).pos<e.pos!=i<0)&&(t=e),new vt(t,e)}}mt.jsonID("text",vt);class ja{constructor(t,e){this.anchor=t,this.head=e}map(t){return new ja(t.map(this.anchor),t.map(this.head))}resolve(t){return vt.between(t.resolve(this.anchor),t.resolve(this.head))}}class st extends mt{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),o=t.resolve(i);return r?mt.near(o):new st(o)}content(){return new G(K.from(this.node),0,0)}eq(t){return t instanceof st&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Fc(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new st(t.resolve(e.anchor))}static create(t,e){return new st(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}st.prototype.visible=!1,mt.jsonID("node",st);class Fc{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new ja(r,r):new Fc(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&st.isSelectable(r)?new st(e):mt.near(e)}}class je extends mt{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=G.empty){if(e==G.empty){t.delete(0,t.doc.content.size);let r=mt.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new je(t)}map(t){return new je(t)}eq(t){return t instanceof je}getBookmark(){return f1}}mt.jsonID("all",je);const f1={map(){return this},resolve:n=>new je(n)};function eo(n,t,e,r,i,o=!1){if(t.inlineContent)return vt.create(n,e);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let a=t.child(s);if(a.isAtom){if(!o&&st.isSelectable(a))return st.create(n,e-(i<0?a.nodeSize:0))}else{let l=eo(n,a,e+i,i<0?a.childCount:0,i,o);if(l)return l}e+=a.nodeSize*i}return null}function Sg(n,t,e){let r=n.steps.length-1;if(r<t)return;let i,o=n.steps[r];(o instanceof Qn||o instanceof Qr)&&(n.mapping.maps[r].forEach((s,a,l,u)=>{i==null&&(i=u)}),n.setSelection(mt.near(n.doc.resolve(i),e)))}class m1 extends h1{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return At.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||At.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=e),r=r==null?e:r,!t)return this.deleteRange(e,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(e);o=r==e?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,o)),this.selection.empty||this.setSelection(mt.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Ng(n,t){return t&&n?n.bind(t):n}class As{constructor(t,e,r){this.name=t,this.init=Ng(e.init,r),this.apply=Ng(e.apply,r)}}const g1=[new As("doc",{init:n=>n.doc||n.schema.topNodeType.createAndFill(),apply:n=>n.doc}),new As("selection",{init:(n,t)=>n.selection||mt.atStart(t.doc),apply:n=>n.selection}),new As("storedMarks",{init:n=>n.storedMarks||null,apply:(n,t,e,r)=>r.selection.$cursor?n.storedMarks:null}),new As("scrollToSelection",{init:()=>0,apply:(n,t)=>n.scrolledIntoView?t+1:t})];class Uc{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=g1.slice(),e&&e.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new As(r.key,r.spec.state,r))})}}class no{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,c=l<e.length&&a.spec.appendTransaction.call(a,l?e.slice(l):e,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",t),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:e.length}:{state:this,n:0})}e.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:e.length})}}if(!o)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new no(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];e[o.name]=o.apply(t,this[o.name],this,e)}return e}get tr(){return new m1(this)}static create(t){let e=new Uc(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new no(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new Uc(this.schema,t.plugins),r=e.fields,i=new no(e);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(t,i)}return i}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(e[r]=o.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Uc(t.schema,t.plugins),o=new no(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=qr.fromJSON(t.schema,e.doc);else if(s.name=="selection")o.selection=mt.fromJSON(o.doc,e.selection);else if(s.name=="storedMarks")e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(e,a))return void(o[s.name]=u.fromJSON.call(l,t,e[a],o))}o[s.name]=s.init(t,o)}}),o}}function Cg(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=Cg(i,t,{})),e[r]=i}return e}class Ya{constructor(t){this.spec=t,this.props={},t.props&&Cg(t.props,this,this.props),this.key=t.key?t.key.key:bg("plugin")}getState(t){return t[this.key]}}const Hc=Object.create(null);function bg(n){return n in Hc?n+"$"+ ++Hc[n]:(Hc[n]=0,n+"$")}class za{constructor(t="key"){this.key=bg(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Te=function(n){for(var t=0;;t++)if(!(n=n.previousSibling))return t},vs=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let Ig=null;const tr=function(n,t,e){let r=Ig||(Ig=document.createRange());return r.setEnd(n,e==null?n.nodeValue.length:e),r.setStart(n,t||0),r},ti=function(n,t,e,r){return e&&(wg(n,t,e,r,-1)||wg(n,t,e,r,1))},E1=/^(img|br|input|textarea|hr)$/i;function wg(n,t,e,r,i){for(;;){if(n==e&&t==r)return!0;if(t==(i<0?0:wn(n))){let o=n.parentNode;if(!o||o.nodeType!=1||$c(n)||E1.test(n.nodeName)||n.contentEditable=="false")return!1;t=Te(n)+(i<0?0:1),n=o}else{if(n.nodeType!=1||(n=n.childNodes[t+(i<0?-1:0)]).contentEditable=="false")return!1;t=i<0?wn(n):0}}}function wn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $c(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const Va=function(n){return n.focusNode&&ti(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ei(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}const Rn=typeof navigator!="undefined"?navigator:null,Rg=typeof document!="undefined"?document:null,vr=Rn&&Rn.userAgent||"",jc=/Edge\/(\d+)/.exec(vr),Dg=/MSIE \d/.exec(vr),Yc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr),Le=!!(Dg||Yc||jc),_r=Dg?document.documentMode:Yc?+Yc[1]:jc?+jc[1]:0,hn=!Le&&/gecko\/(\d+)/i.test(vr);hn&&(/Firefox\/(\d+)/.exec(vr)||[0,0])[1];const zc=!Le&&/Chrome\/(\d+)/.exec(vr),me=!!zc,A1=zc?+zc[1]:0,Oe=!Le&&!!Rn&&/Apple Computer/.test(Rn.vendor),ro=Oe&&(/Mobile\/\w+/.test(vr)||!!Rn&&Rn.maxTouchPoints>2),on=ro||!!Rn&&/Mac/.test(Rn.platform),v1=!!Rn&&/Win/.test(Rn.platform),pn=/Android \d/.test(vr),_s=!!Rg&&"webkitFontSmoothing"in Rg.documentElement.style,_1=_s?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y1(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function er(n,t){return typeof n=="number"?n:n[t]}function T1(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function kg(n,t,e){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=e||n.dom;s;s=vs(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,u=l?y1(o):T1(a),c=0,d=0;if(t.top<u.top+er(r,"top")?d=-(u.top-t.top+er(i,"top")):t.bottom>u.bottom-er(r,"bottom")&&(d=t.bottom-t.top>u.bottom-u.top?t.top+er(i,"top")-u.top:t.bottom-u.bottom+er(i,"bottom")),t.left<u.left+er(r,"left")?c=-(u.left-t.left+er(i,"left")):t.right>u.right-er(r,"right")&&(c=t.right-u.right+er(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let f=a.scrollLeft-h,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Lg(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=vs(r));return t}function xg(n,t){for(let e=0;e<n.length;e++){let{dom:r,top:i,left:o}=n[e];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let io=null;function Mg(n,t){let e,r,i,o,s=2e8,a=0,l=t.top,u=t.top;for(let c=n.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else{if(c.nodeType!=3)continue;h=tr(c).getClientRects()}for(let p=0;p<h.length;p++){let f=h[p];if(f.top<=l&&f.bottom>=u){l=Math.max(f.bottom,l),u=Math.min(f.top,u);let m=f.left>t.left?f.left-t.left:f.right<t.left?t.left-f.right:0;if(m<s){e=c,s=m,r=m&&e.nodeType==3?{left:f.right<t.left?f.right:f.left,top:t.top}:t,c.nodeType==1&&m&&(a=d+(t.left>=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!i&&f.left<=t.left&&f.right>=t.left&&(i=c,o={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!e&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.bottom)&&(a=d+1)}}return!e&&i&&(e=i,r=o,s=0),e&&e.nodeType==3?function(c,d){let h=c.nodeValue.length,p=document.createRange();for(let f=0;f<h;f++){p.setEnd(c,f+1),p.setStart(c,f);let m=yr(p,1);if(m.top!=m.bottom&&Vc(d,m))return{node:c,offset:f+(d.left>=(m.left+m.right)/2?1:0)}}return{node:c,offset:0}}(e,r):!e||s&&e.nodeType==1?{node:n,offset:a}:Mg(e,r)}function Vc(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function Pg(n,t,e){let r=n.childNodes.length;if(r&&e.top<e.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-e.top)/(e.bottom-e.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Vc(t,u))return Pg(s,t,u)}}if((o=(o+1)%r)==i)break}return n}function O1(n,t){let e,r=n.dom.ownerDocument,i=0,o=function(u,c,d){if(u.caretPositionFromPoint)try{let h=u.caretPositionFromPoint(c,d);if(h)return{node:h.offsetNode,offset:h.offset}}catch(h){}if(u.caretRangeFromPoint){let h=u.caretRangeFromPoint(c,d);if(h)return{node:h.startContainer,offset:h.startOffset}}}(r,t.left,t.top);o&&({node:e,offset:i}=o);let s,a=(n.root.elementFromPoint?n.root:r).elementFromPoint(t.left,t.top);if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let u=n.dom.getBoundingClientRect();if(!Vc(t,u)||(a=Pg(n.dom,t,u),!a))return null}if(Oe)for(let u=a;e&&u;u=vs(u))u.draggable&&(e=void 0);if(a=function(u,c){let d=u.parentNode;return d&&/^li$/i.test(d.nodeName)&&c.left<u.getBoundingClientRect().left?d:u}(a,t),e){if(hn&&e.nodeType==1&&(i=Math.min(i,e.childNodes.length),i<e.childNodes.length)){let c,d=e.childNodes[i];d.nodeName=="IMG"&&(c=d.getBoundingClientRect()).right<=t.left&&c.bottom>t.top&&i++}let u;_s&&i&&e.nodeType==1&&(u=e.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,e==n.dom&&i==e.childNodes.length-1&&e.lastChild.nodeType==1&&t.top>e.lastChild.getBoundingClientRect().bottom?s=n.state.doc.content.size:i!=0&&e.nodeType==1&&e.childNodes[i-1].nodeName=="BR"||(s=function(c,d,h,p){let f=-1;for(let m=d,g=!1;m!=c.dom;){let E=c.docView.nearestDesc(m,!0);if(!E)return null;if(E.dom.nodeType==1&&(E.node.isBlock&&E.parent&&!g||!E.contentDOM)){let A=E.dom.getBoundingClientRect();if(E.node.isBlock&&E.parent&&!g&&(g=!0,A.left>p.left||A.top>p.top?f=E.posBefore:(A.right<p.left||A.bottom<p.top)&&(f=E.posAfter)),!E.contentDOM&&f<0&&!E.node.isText)return(E.node.isBlock?p.top<(A.top+A.bottom)/2:p.left<(A.left+A.right)/2)?E.posBefore:E.posAfter}m=E.dom.parentNode}return f>-1?f:c.docView.posFromDOM(d,h,-1)}(n,e,i,t))}s==null&&(s=function(u,c,d){let{node:h,offset:p}=Mg(c,d),f=-1;if(h.nodeType==1&&!h.firstChild){let m=h.getBoundingClientRect();f=m.left!=m.right&&d.left>(m.left+m.right)/2?1:-1}return u.docView.posFromDOM(h,p,f)}(n,a,t));let l=n.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Bg(n){return n.top<n.bottom||n.left<n.right}function yr(n,t){let e=n.getClientRects();if(e.length){let r=e[t<0?0:e.length-1];if(Bg(r))return r}return Array.prototype.find.call(e,Bg)||n.getBoundingClientRect()}const S1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Fg(n,t,e){let{node:r,offset:i,atom:o}=n.docView.domFromPos(t,e<0?-1:1),s=_s||hn;if(r.nodeType==3){if(!s||!S1.test(r.nodeValue)&&(e<0?i:i!=r.nodeValue.length)){let a=i,l=i,u=e<0?1:-1;return e<0&&!i?(l++,u=-1):e>=0&&i==r.nodeValue.length?(a--,u=1):e<0?a--:l++,ys(yr(tr(r,a,l),u),u<0)}{let a=yr(tr(r,i,i),e);if(hn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=yr(tr(r,i-1,i-1),-1);if(l.top==a.top){let u=yr(tr(r,i,i+1),-1);if(u.top!=a.top)return ys(u,u.left<l.left)}}return a}}if(!n.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(e<0||i==wn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Wc(a.getBoundingClientRect(),!1)}if(o==null&&i<wn(r)){let a=r.childNodes[i];if(a.nodeType==1)return Wc(a.getBoundingClientRect(),!0)}return Wc(r.getBoundingClientRect(),e>=0)}if(o==null&&i&&(e<0||i==wn(r))){let a=r.childNodes[i-1],l=a.nodeType==3?tr(a,wn(a)-(s?0:1)):a.nodeType!=1||a.nodeName=="BR"&&a.nextSibling?null:a;if(l)return ys(yr(l,1),!1)}if(o==null&&i<wn(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?tr(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return ys(yr(l,-1),!0)}return ys(yr(r.nodeType==3?tr(r):r,-e),e>=0)}function ys(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function Wc(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function Ug(n,t,e){let r=n.state,i=n.root.activeElement;r!=t&&n.updateState(t),i!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),i!=n.dom&&i&&i.focus()}}const N1=/[\u0590-\u08ac]/;let Hg=null,$g=null,jg=!1;function C1(n,t,e){return Hg==t&&$g==e?jg:(Hg=t,$g=e,jg=e=="up"||e=="down"?function(r,i,o){let s=i.selection,a=o=="up"?s.$from:s.$to;return Ug(r,i,()=>{let{node:l}=r.docView.domFromPos(a.pos,o=="up"?-1:1);for(;;){let c=r.docView.nearestDesc(l,!0);if(!c)break;if(c.node.isBlock){l=c.contentDOM||c.dom;break}l=c.dom.parentNode}let u=Fg(r,a.pos,1);for(let c=l.firstChild;c;c=c.nextSibling){let d;if(c.nodeType==1)d=c.getClientRects();else{if(c.nodeType!=3)continue;d=tr(c,0,c.nodeValue.length).getClientRects()}for(let h=0;h<d.length;h++){let p=d[h];if(p.bottom>p.top+1&&(o=="up"?u.top-p.top>2*(p.bottom-u.top):p.bottom-u.bottom>2*(u.bottom-p.top)))return!1}}return!0})}(n,t,e):function(r,i,o){let{$head:s}=i.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,l=!a,u=a==s.parent.content.size,c=r.domSelection();return N1.test(s.parent.textContent)&&c.modify?Ug(r,i,()=>{let{focusNode:d,focusOffset:h,anchorNode:p,anchorOffset:f}=r.domSelectionRange(),m=c.caretBidiLevel;c.modify("move",o,"character");let g=s.depth?r.docView.domAfterPos(s.before()):r.dom,{focusNode:E,focusOffset:A}=r.domSelectionRange(),v=E&&!g.contains(E.nodeType==1?E:E.parentNode)||d==E&&h==A;try{c.collapse(p,f),d&&(d!=p||h!=f)&&c.extend&&c.extend(d,h)}catch(_){}return m!=null&&(c.caretBidiLevel=m),v}):o=="left"||o=="backward"?l:u}(n,t,e))}class Ts{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=0,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,r=this.posAtStart;;e++){let i=this.children[e];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode)){if(r<0){let o,s;if(t==this.contentDOM)o=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&(!(s=o.pmViewDesc)||s.parent!=this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}{let o,s;if(t==this.contentDOM)o=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&(!(s=o.pmViewDesc)||s.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}}let i;if(t==this.dom&&this.contentDOM)i=e>Te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(e==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&e==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return(i==null?r>0:i)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let r=!0,i=t;i;i=i.parentNode){let o,s=this.getDesc(i);if(s&&(!e||s.node)){if(!r||!(o=s.nodeDOM)||(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))return s;r=!1}}}getDesc(t){let e=t.pmViewDesc;for(let r=e;r;r=r.parent)if(r==this)return e}posFromDOM(t,e,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let i=this.children[e],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>t||s instanceof Vg){i=t-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,e);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Yg&&o.side>=0;r--);if(e<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,o&&o.dom.parentNode!=this.contentDOM;r--,s=!1);return o&&e&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,e):{node:this.contentDOM,offset:o?Te(o.dom)+1:0}}{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,o&&o.dom.parentNode!=this.contentDOM;r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,e):{node:this.contentDOM,offset:o?Te(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],u=s+l.size;if(i==-1&&t<=u){let c=s+l.border;if(t>=c&&e<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,c);t=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Te(h.dom)+1;break}t-=h.size}i==-1&&(i=0)}if(i>-1&&(u>e||a==this.children.length-1)){e=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Te(d.dom);break}e+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:e,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,i=!1){let o=Math.min(t,e),s=Math.max(t,e);for(let h=0,p=0;h<this.children.length;h++){let f=this.children[h],m=p+f.size;if(o>p&&s<m)return f.setSelection(t-p-f.border,e-p-f.border,r,i);p=m}let a=this.domFromPos(t,t?-1:1),l=e==t?a:this.domFromPos(e,e?-1:1),u=r.getSelection(),c=!1;if((hn||Oe)&&t==e){let{node:h,offset:p}=a;if(h.nodeType==3){if(c=!(!p||h.nodeValue[p-1]!=`
78
- `),c&&p==h.nodeValue.length)for(let f,m=h;m;m=m.parentNode){if(f=m.nextSibling){f.nodeName=="BR"&&(a=l={node:f.parentNode,offset:Te(f)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let f=h.childNodes[p-1];c=f&&(f.nodeName=="BR"||f.contentEditable=="false")}}if(hn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||c&&Oe)&&ti(a.node,a.offset,u.anchorNode,u.anchorOffset)&&ti(l.node,l.offset,u.focusNode,u.focusOffset))return;let d=!1;if((u.extend||t==e)&&!c){u.collapse(a.node,a.offset);try{t!=e&&u.extend(l.node,l.offset),d=!0}catch(h){}}if(!d){if(t>e){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?t<=s&&e>=r:t<s&&e>r){let a=r+o.border,l=s-o.border;if(t>=a&&e<=l)return this.dirty=t==r||e==s?2:1,void(t!=a||e!=l||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-a,e-a):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}r=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?2:1;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Yg extends Ts{constructor(t,e,r,i){let o,s=e.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:i)),!e.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,o=this}matchesWidget(t){return this.dirty==0&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class b1 extends Ts{constructor(t,e,r,i){super(t,[],e,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ni extends Ts{constructor(t,e,r,i){super(t,[],r,i),this.mark=e}static create(t,e,r,i){let o=i.nodeViews[e.type.name],s=o&&o(e,i,r);return s&&s.dom||(s=Zn.renderSpec(document,e.type.spec.toDOM(e,r))),new ni(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=3&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=0){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}}slice(t,e,r){let i=ni.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;e<s&&(o=Kc(o,e,s,r)),t>0&&(o=Kc(o,0,t,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}}class Tr extends Ts{constructor(t,e,r,i,o,s,a,l,u){super(t,[],o,s),this.node=e,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(t,e,r,i,o,s){let a,l=o.nodeViews[e.type.name],u=l&&l(e,o,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,r,i),c=u&&u.dom,d=u&&u.contentDOM;if(e.isText)if(c){if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(e.text);else c||({dom:c,contentDOM:d}=Zn.renderSpec(document,e.type.spec.toDOM(e)));d||e.isText||c.nodeName=="BR"||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),e.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Xg(c,r,e),u?a=new I1(t,e,r,i,c,d||null,h,u,o,s+1):e.isText?new Wa(t,e,r,i,c,h,o):new Tr(t,e,r,i,c,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let r=this.children[e];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>K.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,r){return this.dirty==0&&t.eq(this.node)&&Xc(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,i=e,o=t.composing?this.localCompositionInfo(t,e):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new R1(this,s&&s.node,t);(function(u,c,d,h){let p=c.locals(u),f=0;if(p.length==0){for(let A=0;A<u.childCount;A++){let v=u.child(A);h(v,p,c.forChild(f,v),A),f+=v.nodeSize}return}let m=0,g=[],E=null;for(let A=0;;){let v,_,O,T;for(;m<p.length&&p[m].to==f;){let y=p[m++];y.widget&&(v?(_||(_=[v])).push(y):v=y)}if(v)if(_){_.sort(D1);for(let y=0;y<_.length;y++)d(_[y],A,!!E)}else d(v,A,!!E);if(E)T=-1,O=E,E=null;else{if(!(A<u.childCount))break;T=A,O=u.child(A++)}for(let y=0;y<g.length;y++)g[y].to<=f&&g.splice(y--,1);for(;m<p.length&&p[m].from<=f&&p[m].to>f;)g.push(p[m++]);let S=f+O.nodeSize;if(O.isText){let y=S;m<p.length&&p[m].from<y&&(y=p[m].from);for(let I=0;I<g.length;I++)g[I].to<y&&(y=g[I].to);y<S&&(E=O.cut(y-f),O=O.cut(0,y-f),S=y,T=-1)}else for(;m<p.length&&p[m].to<=S;)m++;let N=O.isInline&&!O.isLeaf?g.filter(y=>!y.inline):g.slice();h(O,N,c.forChild(f,O),T),f=S}})(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,t):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?At.none:this.node.child(c).marks,r,t),l.placeWidget(u,t,i)},(u,c,d,h)=>{let p;l.syncToMarks(u.marks,r,t),l.findNodeMatch(u,c,d,h)||a&&t.state.selection.from>i&&t.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(u,c,d,p,t)||l.updateNextNode(u,c,d,t,h,i)||l.addNode(u,c,d,t,i),i+=u.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==2)&&(s&&this.protectLocalComposition(t,s),Wg(this.contentDOM,this.children,t),ro&&function(u){if(u.nodeName=="UL"||u.nodeName=="OL"){let c=u.style.cssText;u.style.cssText=c+"; list-style: square !important",window.getComputedStyle(u).listStyle,u.style.cssText=c}}(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof vt)||r<e||i>e+this.node.content.size)return null;let o=t.domSelectionRange(),s=function(a,l){for(;;){if(a.nodeType==3)return a;if(a.nodeType==1&&l>0){if(a.childNodes.length>l&&a.childNodes[l].nodeType==3)return a.childNodes[l];l=wn(a=a.childNodes[l-1])}else{if(!(a.nodeType==1&&l<a.childNodes.length))return null;a=a.childNodes[l],l=0}}}(o.focusNode,o.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=function(u,c,d,h){for(let p=0,f=0;p<u.childCount&&f<=h;){let m=u.child(p++),g=f;if(f+=m.nodeSize,!m.isText)continue;let E=m.text;for(;p<u.childCount;){let A=u.child(p++);if(f+=A.nodeSize,!A.isText)break;E+=A.text}if(f>=d){if(f>=h&&E.slice(h-c.length-g,h-g)==c)return h-c.length;let A=g<h?E.lastIndexOf(c,h-g-1):-1;if(A>=0&&A+c.length+g>=d)return g+A;if(d==h&&E.length>=h+c.length-g&&E.slice(h-g,h-g+c.length)==c)return h}}return-1}(this.node.content,a,r-e,i-e);return l<0?null:{node:s,pos:l,text:a}}return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:r,text:i}){if(this.getDesc(e))return;let o=e;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new b1(this,o,e,i);t.input.compositionNodes.push(s),this.children=Kc(this.children,r,r+i.length,t,s)}update(t,e,r,i){return!(this.dirty==3||!t.sameMarkup(this.node))&&(this.updateInner(t,e,r,i),!0)}updateInner(t,e,r,i){this.updateOuterDeco(e),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Xc(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Gg(this.dom,this.nodeDOM,Gc(this.outerDeco,this.node,e),Gc(t,this.node,e)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function zg(n,t,e,r,i){Xg(r,t,n);let o=new Tr(void 0,n,t,e,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Wa extends Tr{constructor(t,e,r,i,o,s,a){super(t,e,r,i,o,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,r,i){return!(this.dirty==3||this.dirty!=0&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),this.dirty==0&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=0,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let i=this.node.cut(t,e),o=document.createTextNode(i.text);return new Wa(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||t!=0&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class Vg extends Ts{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==0&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class I1 extends Tr{constructor(t,e,r,i,o,s,a,l,u,c){super(t,e,r,i,o,s,a,u,c),this.spec=l}update(t,e,r,i){if(this.dirty==3)return!1;if(this.spec.update){let o=this.spec.update(t,e,r);return o&&this.updateInner(t,e,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,i){this.spec.setSelection?this.spec.setSelection(t,e,r):super.setSelection(t,e,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Wg(n,t,e){let r=n.firstChild,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=Kg(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof ni){let l=r?r.previousSibling:n.lastChild;Wg(s.contentDOM,s.children,e),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Kg(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}const Os=function(n){n&&(this.nodeName=n)};Os.prototype=Object.create(null);const ri=[new Os];function Gc(n,t,e){if(n.length==0)return ri;let r=e?ri[0]:new Os,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Os(s.nodeName));for(let a in s){let l=s[a];l!=null&&(e&&i.length==1&&i.push(r=new Os(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Gg(n,t,e,r){if(e==ri&&r==ri)return t;let i=t;for(let o=0;o<r.length;o++){let s=r[o],a=e[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=ri[0]),i=l}w1(i,a||ri[0],s)}return i}function w1(n,t,e){for(let r in t)r=="class"||r=="style"||r=="nodeName"||r in e||n.removeAttribute(r);for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&e[r]!=t[r]&&n.setAttribute(r,e[r]);if(t.class!=e.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=e.class?e.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let r,i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=i.exec(t.style);)n.style.removeProperty(r[1])}e.style&&(n.style.cssText+=e.style)}}function Xg(n,t,e){return Gg(n,n,ri,Gc(t,e,n.nodeType!=1))}function Xc(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function Kg(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class R1{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(i,o){let s=o,a=s.children.length,l=i.childCount,u=new Map,c=[];t:for(;l>0;){let d;for(;;)if(a){let p=s.children[a-1];if(!(p instanceof ni)){d=p,a--;break}s=p,a=p.children.length}else{if(s==o)break t;a=s.parent.children.indexOf(s),s=s.parent}let h=d.node;if(h){if(h!=i.child(l-1))break;--l,u.set(d,l),c.push(d)}}return{index:l,matched:u,matches:c.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,r){let i=0,o=this.stack.length>>1,s=Math.min(o,t.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(t[o])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ni.create(this.top,t[o],e,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(t,e,r,i){let o,s=-1;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(t,e,r)&&!this.preMatch.matched.has(u)){s=a;break}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,r,i,o){let s=this.top.children[i];return s.dirty==3&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,r,o)&&(this.destroyBetween(this.index,i),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=e}}updateNextNode(t,e,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Tr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=o)return!1;let c,d=l.dom,h=this.isLocked(d)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=3&&Xc(e,l.outerDeco));if(!h&&l.update(t,e,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,t,e,r,i,s)))return this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(i,s+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,r,i,o,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content))return null;let a=Tr.create(this.top,e,r,i,o,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,e,r,i,o){let s=Tr.create(this.top,t,e,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(!i||!i.matchesWidget(t)||t!=i.widget&&i.widget.type.toDOM.parentNode){let o=new Yg(this.top,t,e,r);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof ni;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Wa)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Oe||me)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Vg(this.top,[],r,null);e!=this.top?e.children.push(i):e.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function D1(n,t){return n.type.side-t.type.side}function Kc(n,t,e,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],u=a,c=a+=l.size;u>=e||c<=t?o.push(l):(u<t&&o.push(l.slice(0,t-u,r)),i&&(o.push(i),i=void 0),c>e&&o.push(l.slice(e-u,l.size,r)))}return o}function qc(n,t=null){let e=n.domSelectionRange(),r=n.state.doc;if(!e.focusNode)return null;let i=n.docView.nearestDesc(e.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let a,l,u=r.resolve(s);if(Va(e)){for(a=u;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&st.isSelectable(c)&&i.parent&&(!c.isInline||!function(d,h,p){for(let f=h==0,m=h==wn(d);f||m;){if(d==p)return!0;let g=Te(d);if(!(d=d.parentNode))return!1;f=f&&g==0,m=m&&g==wn(d)}}(e.focusNode,e.focusOffset,i.dom))){let d=i.posBefore;l=new st(s==d?u:r.resolve(d))}}else{let c=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(c<0)return null;a=r.resolve(c)}return l||(l=Zc(n,a,u,t=="pointer"||n.state.selection.head<u.pos&&!o?1:-1)),l}function qg(n){return n.editable?n.hasFocus():rE(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function nr(n,t=!1){let e=n.state.selection;if(tE(n,e),qg(n)){if(!t&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&me){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ti(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset))return n.input.mouseDown.delayedSelectionSync=!0,void n.domObserver.setCurSelection()}if(n.domObserver.disconnectSelection(),n.cursorWrapper)(function(r){let i=r.domSelection(),o=document.createRange(),s=r.cursorWrapper.dom,a=s.nodeName=="IMG";a?o.setEnd(s.parentNode,Te(s)+1):o.setEnd(s,0),o.collapse(!1),i.removeAllRanges(),i.addRange(o),!a&&!r.state.selection.visible&&Le&&_r<=11&&(s.disabled=!0,s.disabled=!1)})(n);else{let r,i,{anchor:o,head:s}=e;!Jg||e instanceof vt||(e.$from.parent.inlineContent||(r=Zg(n,e.from)),e.empty||e.$from.parent.inlineContent||(i=Zg(n,e.to))),n.docView.setSelection(o,s,n.root,t),Jg&&(r&&Qg(r),i&&Qg(i)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(a){let l=a.dom.ownerDocument;l.removeEventListener("selectionchange",a.input.hideSelectionGuard);let u=a.domSelectionRange(),c=u.anchorNode,d=u.anchorOffset;l.addEventListener("selectionchange",a.input.hideSelectionGuard=()=>{u.anchorNode==c&&u.anchorOffset==d||(l.removeEventListener("selectionchange",a.input.hideSelectionGuard),setTimeout(()=>{qg(a)&&!a.state.selection.visible||a.dom.classList.remove("ProseMirror-hideselection")},20))})}(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Jg=Oe||me&&A1<63;function Zg(n,t){let{node:e,offset:r}=n.docView.domFromPos(t,0),i=r<e.childNodes.length?e.childNodes[r]:null,o=r?e.childNodes[r-1]:null;if(Oe&&i&&i.contentEditable=="false")return Jc(i);if(!(i&&i.contentEditable!="false"||o&&o.contentEditable!="false")){if(i)return Jc(i);if(o)return Jc(o)}}function Jc(n){return n.contentEditable="true",Oe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Qg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function tE(n,t){if(t instanceof st){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(eE(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else eE(n)}function eE(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Zc(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||vt.between(t,e,r)}function nE(n){return!(n.editable&&!n.hasFocus())&&rE(n)}function rE(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Qc(n,t){let{$anchor:e,$head:r}=n.selection,i=t>0?e.max(r):e.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return o&&mt.findFrom(o,t)}function Or(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function iE(n,t,e){let r=n.state.selection;if(!(r instanceof vt)){if(r instanceof st&&r.node.isInline)return Or(n,new vt(t>0?r.$to:r.$from));{let i=Qc(n.state,t);return!!i&&Or(n,i)}}if(e.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return Or(n,new vt(r.$anchor,s))}if(!r.empty)return!1;if(n.endOfTextblock(t>0?"forward":"backward")){let i=Qc(n.state,t);return!!(i&&i instanceof st)&&Or(n,i)}if(!(on&&e.indexOf("m")>-1)){let i,o=r.$head,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText)return!1;let a=t<0?o.pos-s.nodeSize:o.pos;return!!(s.isAtom||(i=n.docView.descAt(a))&&!i.contentDOM)&&(st.isSelectable(s)?Or(n,new st(t<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):!!_s&&Or(n,new vt(n.state.doc.resolve(t<0?a:a+s.nodeSize))))}}function Ga(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ss(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function oo(n,t){return t<0?function(e){let r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s,a,l=!1;for(hn&&i.nodeType==1&&o<Ga(i)&&Ss(i.childNodes[o],-1)&&(l=!0);;)if(o>0){if(i.nodeType!=1)break;{let u=i.childNodes[o-1];if(Ss(u,-1))s=i,a=--o;else{if(u.nodeType!=3)break;i=u,o=i.nodeValue.length}}}else{if(oE(i))break;{let u=i.previousSibling;for(;u&&Ss(u,-1);)s=i.parentNode,a=Te(u),u=u.previousSibling;if(u)i=u,o=Ga(i);else{if(i=i.parentNode,i==e.dom)break;o=0}}}l?td(e,i,o):s&&td(e,s,a)}(n):function(e){let r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s,a,l=Ga(i);for(;;)if(o<l){if(i.nodeType!=1||!Ss(i.childNodes[o],1))break;s=i,a=++o}else{if(oE(i))break;{let u=i.nextSibling;for(;u&&Ss(u,1);)s=u.parentNode,a=Te(u)+1,u=u.nextSibling;if(u)i=u,o=0,l=Ga(i);else{if(i=i.parentNode,i==e.dom)break;o=l=0}}}s&&td(e,s,a)}(n)}function oE(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function td(n,t,e){if(t.nodeType!=3){let o,s;(s=function(a,l){for(;a&&l==a.childNodes.length&&!$c(a);)l=Te(a)+1,a=a.parentNode;for(;a&&l<a.childNodes.length;){let u=a.childNodes[l];if(u.nodeType==3)return u;if(u.nodeType==1&&u.contentEditable=="false")break;a=u,l=0}}(t,e))?(t=s,e=0):(o=function(a,l){for(;a&&!l&&!$c(a);)l=Te(a),a=a.parentNode;for(;a&&l;){let u=a.childNodes[l-1];if(u.nodeType==3)return u;if(u.nodeType==1&&u.contentEditable=="false")break;l=(a=u).childNodes.length}}(t,e))&&(t=o,e=o.nodeValue.length)}let r=n.domSelection();if(Va(r)){let o=document.createRange();o.setEnd(t,e),o.setStart(t,e),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,e);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&nr(n)},50)}function sE(n,t){let e=n.state.doc.resolve(t);if(!me&&!v1&&e.parent.inlineContent){let r=n.coordsAtPos(t);if(t>e.start()){let i=n.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(t<e.end()){let i=n.coordsAtPos(t+1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function aE(n,t,e){let r=n.state.selection;if(r instanceof vt&&!r.empty||e.indexOf("s")>-1||on&&e.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let s=Qc(n.state,t);if(s&&s instanceof st)return Or(n,s)}if(!i.parent.inlineContent){let s=t<0?i:o,a=r instanceof je?mt.near(s,t):mt.findFrom(s,t);return!!a&&Or(n,a)}return!1}function lE(n,t){if(!(n.state.selection instanceof vt))return!0;let{$head:e,$anchor:r,empty:i}=n.state.selection;if(!e.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return t<0?s.delete(e.pos-o.nodeSize,e.pos):s.delete(e.pos,e.pos+o.nodeSize),n.dispatch(s),!0}return!1}function uE(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function k1(n,t){let e=t.keyCode,r=function(i){let o="";return i.ctrlKey&&(o+="c"),i.metaKey&&(o+="m"),i.altKey&&(o+="a"),i.shiftKey&&(o+="s"),o}(t);if(e==8||on&&e==72&&r=="c")return lE(n,-1)||oo(n,-1);if(e==46&&!t.shiftKey||on&&e==68&&r=="c")return lE(n,1)||oo(n,1);if(e==13||e==27)return!0;if(e==37||on&&e==66&&r=="c"){let i=e==37?sE(n,n.state.selection.from)=="ltr"?-1:1:-1;return iE(n,i,r)||oo(n,i)}if(e==39||on&&e==70&&r=="c"){let i=e==39?sE(n,n.state.selection.from)=="ltr"?1:-1:1;return iE(n,i,r)||oo(n,i)}return e==38||on&&e==80&&r=="c"?aE(n,-1,r)||oo(n,-1):e==40||on&&e==78&&r=="c"?function(i){if(!Oe||i.state.selection.$head.parentOffset>0)return!1;let{focusNode:o,focusOffset:s}=i.domSelectionRange();if(o&&o.nodeType==1&&s==0&&o.firstChild&&o.firstChild.contentEditable=="false"){let a=o.firstChild;uE(i,a,"true"),setTimeout(()=>uE(i,a,"false"),20)}return!1}(n)||aE(n,1,r)||oo(n,1):r==(on?"m":"c")&&(e==66||e==73||e==89||e==90)}function cE(n,t){n.someProp("transformCopied",p=>{t=p(t,n)});let e=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;e.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Zn.fromSchema(n.state.schema),a=AE(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u,c=l.firstChild,d=0;for(;c&&c.nodeType==1&&(u=gE[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let f=a.createElement(u[p]);for(;l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(e)}`);let h=n.someProp("clipboardTextSerializer",p=>p(t,n))||t.content.textBetween(0,t.content.size,`
77
+ `))}ignoreFallback(t){t.nodeName!="BR"||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=At.none,r=At.none;for(let i=0;i<t.length;i+=2)for(let o;;){let s=this.parser.matchStyle(t[i],t[i+1],this,o);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(a=>{s.clearMark(a)&&(r=a.addToSet(r))}):e=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(e),s.consuming!==!1)break;o=s}return[e,r]}addElementByRule(t,e,r){let i,o,s;e.node?(o=this.parser.schema.nodes[e.node],o.isLeaf?this.insertNode(o.create(e.attrs))||this.leafFallback(t):i=this.enter(o,e.attrs||null,e.preserveWhitespace)):(s=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(s));let a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=t;typeof e.contentElement=="string"?l=t.querySelector(e.contentElement):typeof e.contentElement=="function"?l=e.contentElement(t):e.contentElement&&(l=e.contentElement),this.findAround(t,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}addAll(t,e,r){let i=e||0;for(let o=e?t.childNodes[e]:t.firstChild,s=r==null?null:t.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o);this.findAtPoint(t,i)}findPlace(t){let e,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(t);if(s&&(!e||e.length>s.length)&&(e=s,r=o,!s.length)||o.solid)break}if(!e)return!1;this.sync(r);for(let i=0;i<e.length;i++)this.enterInner(e[i],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let r=e.activeMarks;for(let i=0;i<t.marks.length;i++)e.type&&!e.type.allowsMarkType(t.marks[i].type)||(r=t.marks[i].addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,r){let i=this.findPlace(t.create(e));return i&&this.enterInner(t,e,!0,r),i}enterInner(t,e=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let s=cg(t,i,o.options);4&o.options&&o.content.length==0&&(s|=4),this.nodes.push(new Cc(t,e,o.activeMarks,o.pendingMarks,r,null,s)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=e[a];if(u==""){if(a==e.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let r=this.parser.schema.nodes[e];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(t){let e=function(r,i){for(let o=0;o<i.length;o++)if(r.eq(i[o]))return i[o]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let o=i.popFromStashMark(t);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==e)break}}}function a1(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function hg(n){let t={};for(let e in n)t[e]=n[e];return t}function l1(n,t){let e=t.schema.nodes;for(let r in e){let i=e[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==t||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class Zn{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=bc(e).createDocumentFragment());let i=r,o=[];return t.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(this.marks[u.type.name]){if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}else l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,e);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,e))}),r}serializeNodeInner(t,e){let{dom:r,contentDOM:i}=Zn.renderSpec(bc(e),this.nodes[t.type.name](t));if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&Zn.renderSpec(bc(r),i(t,e))}static renderSpec(t,e,r=null){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i,o=e[0],s=o.indexOf(" ");s>0&&(r=o.slice(0,s),o=o.slice(s+1));let a=r?t.createElementNS(r,o):t.createElement(o),l=e[1],u=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let c in l)if(l[c]!=null){let d=c.indexOf(" ");d>0?a.setAttributeNS(c.slice(0,d),c.slice(d+1),l[c]):a.setAttribute(c,l[c])}}for(let c=u;c<e.length;c++){let d=e[c];if(d===0){if(c<e.length-1||c>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}{let{dom:h,contentDOM:p}=Zn.renderSpec(t,d,r);if(a.appendChild(h),p){if(i)throw new RangeError("Multiple content holes");i=p}}}return{dom:a,contentDOM:i}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Zn(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=pg(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return pg(t.marks)}}function pg(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function bc(n){return n.document||window.document}const fg=Math.pow(2,16);function u1(n,t){return n+t*fg}function mg(n){return 65535&n}let Ic=class{constructor(n,t,e){this.pos=n,this.delInfo=t,this.recover=e}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}},Zr=class Yo{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Yo.empty)return Yo.empty}recover(t){let e=0,r=mg(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/fg}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:u1(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new Ic(h,f,p)}i+=c-u}return r?t+i:new Ic(t+i,0,null)}touches(t,e){let r=0,i=mg(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new Yo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Yo.empty:new Yo(t<0?[0,-t,0]:[0,0,t])}};Zr.empty=new Zr([]);let c1=class Ou{constructor(t=[],e,r=0,i=t.length){this.maps=t,this.mirror=e,this.from=r,this.to=i}slice(t=0,e=this.maps.length){return new Ou(this.maps,this.mirror,t,e)}copy(){return new Ou(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),e!=null&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,r=this.maps.length;e<t.maps.length;e++){let i=t.getMirror(e);this.appendMap(t.maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this.maps.length+t.maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t.maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new Ou;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o].mapResult(t,e);if(s.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,t=this.maps[a].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new Ic(t,i,null)}};const wc=Object.create(null);let fe=class{getMap(){return Zr.empty}merge(n){return null}static fromJSON(n,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let e=wc[t.stepType];if(!e)throw new RangeError(`No step type ${t.stepType} defined`);return e.fromJSON(n,t)}static jsonID(n,t){if(n in wc)throw new RangeError("Duplicate use of step JSON ID "+n);return wc[n]=t,t.prototype.jsonID=n,t}},ye=class ca{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new ca(t,null)}static fail(t){return new ca(null,t)}static fromReplace(t,e,r,i){try{return ca.ok(t.replace(e,r,i))}catch(o){if(o instanceof eo)return ca.fail(o.message);throw o}}};function Rc(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Rc(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}let Dc=class da extends fe{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(Rc(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return ye.fromReplace(t,this.from,this.to,o)}invert(){return new fs(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new da(e.pos,r.pos,this.mark)}merge(t){return t instanceof da&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new da(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new da(e.from,e.to,t.markFromJSON(e.mark))}};fe.jsonID("addMark",Dc);let fs=class ha extends fe{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new W(Rc(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return ye.fromReplace(t,this.from,this.to,r)}invert(){return new Dc(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ha(e.pos,r.pos,this.mark)}merge(t){return t instanceof ha&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ha(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ha(e.from,e.to,t.markFromJSON(e.mark))}};fe.jsonID("removeMark",fs);let kc=class pa extends fe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return ye.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new pa(this.pos,e.marks[i]);return new pa(this.pos,this.mark)}}return new Lc(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new pa(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pa(e.pos,t.markFromJSON(e.mark))}};fe.jsonID("addNodeMark",kc);let Lc=class xp extends fe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return ye.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new kc(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new xp(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xp(e.pos,t.markFromJSON(e.mark))}};fe.jsonID("removeNodeMark",Lc);let Qn=class Li extends fe{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&xc(t,this.from,this.to)?ye.fail("Structure replace would overwrite content"):ye.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Zr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Li(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new Li(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Li)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Li(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Li(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Li(e.from,e.to,W.fromJSON(t,e.slice),!!e.structure)}};fe.jsonID("replace",Qn);let Qr=class Su extends fe{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(xc(t,this.from,this.gapFrom)||xc(t,this.gapTo,this.to)))return ye.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return ye.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?ye.fromReplace(t,this.from,this.to,r):ye.fail("Content does not fit in gap")}getMap(){return new Zr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Su(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Su(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Su(e.from,e.to,e.gapFrom,e.gapTo,W.fromJSON(t,e.slice),e.insert,!!e.structure)}};function xc(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function gg(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}fe.jsonID("replaceAround",Qr);let d1=class{constructor(n,t,e){this.$from=n,this.$to=t,this.unplaced=e,this.frontier=[],this.placed=K.empty;for(let r=0;r<=n.depth;r++){let i=n.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(n.indexAfter(r))})}for(let r=n.depth;r>0;r--)this.placed=K.from(n.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let n=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,e=this.$from,r=this.close(n<0?this.$to:e.doc.resolve(n));if(!r)return null;let i=this.placed,o=e.depth,s=r.depth;for(;o&&s&&i.childCount==1;)i=i.firstChild.content,o--,s--;let a=new W(i,o,s);return n>-1?new Qr(e.pos,n,this.$to.pos,this.$to.end(),a,t):a.size||e.pos!=this.$to.pos?new Qn(e.pos,r.pos,a):null}findFittable(){let n=this.unplaced.openStart;for(let t=this.unplaced.content,e=0,r=this.unplaced.openEnd;e<n;e++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=e){n=e;break}t=i.content}for(let t=1;t<=2;t++)for(let e=t==1?n:this.unplaced.openStart;e>=0;e--){let r,i=null;e?(i=Mc(this.unplaced.content,e-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let s=this.depth;s>=0;s--){let a,{type:l,match:u}=this.frontier[s],c=null;if(t==1&&(o?u.matchType(o.type)||(c=u.fillBefore(K.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:e,frontierDepth:s,parent:i,inject:c};if(t==2&&o&&(a=u.findWrapping(o.type)))return{sliceDepth:e,frontierDepth:s,parent:i,wrap:a};if(i&&u.matchType(i.type))break}}}openMore(){let{content:n,openStart:t,openEnd:e}=this.unplaced,r=Mc(n,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new W(n,t+1,Math.max(e,r.size+t>=n.size-e?t+1:0)),!0)}dropNode(){let{content:n,openStart:t,openEnd:e}=this.unplaced,r=Mc(n,t);if(r.childCount<=1&&t>0){let i=n.size-t<=t+r.size;this.unplaced=new W(ms(n,t-1,1),t-1,i?t-1:e)}else this.unplaced=new W(ms(n,t,1),t,e)}placeNodes({sliceDepth:n,frontierDepth:t,parent:e,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let f=0;f<i.length;f++)this.openFrontierNode(i[f]);let o=this.unplaced,s=e?e.content:o.content,a=o.openStart-n,l=0,u=[],{match:c,type:d}=this.frontier[t];if(r){for(let f=0;f<r.childCount;f++)u.push(r.child(f));c=c.matchFragment(r)}let h=s.size+n-(o.content.size-o.openEnd);for(;l<s.childCount;){let f=s.child(l),m=c.matchType(f.type);if(!m)break;l++,(l>1||a==0||f.content.size)&&(c=m,u.push(Eg(f.mark(d.allowedMarks(f.marks)),l==1?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=gs(this.placed,t,K.from(u)),this.frontier[t].match=c,p&&h<0&&e&&e.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<h;f++){let g=m.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),m=g.content}this.unplaced=p?n==0?W.empty:new W(ms(o.content,n-1,1),n-1,h<0?o.openEnd:n-1):new W(ms(o.content,n,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let n,t=this.frontier[this.depth];if(!t.type.isTextblock||!Pc(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:e}=this.$to,r=this.$to.after(e);for(;e>1&&r==this.$to.end(--e);)++r;return r}findCloseLevel(n){t:for(let t=Math.min(this.depth,n.depth);t>=0;t--){let{match:e,type:r}=this.frontier[t],i=t<n.depth&&n.end(t+1)==n.pos+(n.depth-(t+1)),o=Pc(n,t,r,e,i);if(o){for(let s=t-1;s>=0;s--){let{match:a,type:l}=this.frontier[s],u=Pc(n,s,l,a,!0);if(!u||u.childCount)continue t}return{depth:t,fit:o,move:i?n.doc.resolve(n.after(t+1)):n}}}}close(n){let t=this.findCloseLevel(n);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=gs(this.placed,t.depth,t.fit)),n=t.move;for(let e=t.depth+1;e<=n.depth;e++){let r=n.node(e),i=r.type.contentMatch.fillBefore(r.content,!0,n.index(e));this.openFrontierNode(r.type,r.attrs,i)}return n}openFrontierNode(n,t=null,e){let r=this.frontier[this.depth];r.match=r.match.matchType(n),this.placed=gs(this.placed,this.depth,K.from(n.create(t,e))),this.frontier.push({type:n,match:n.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=gs(this.placed,this.frontier.length,n))}};function ms(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(ms(n.firstChild.content,t-1,e)))}function gs(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(gs(n.lastChild.content,t-1,e)))}function Mc(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function Eg(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,Eg(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),n.copy(r)}function Pc(n,t,e,r,i){let o=n.node(t),s=i?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(l,u,c){for(let d=c;d<u.childCount;d++)if(!l.allowsMarks(u.child(d).marks))return!0;return!1}(e,o.content,s)?a:null}function Ag(n,t,e,r,i){if(t<e){let o=n.firstChild;n=n.replaceChild(0,o.copy(Ag(o.content,t+1,e,r,o)))}if(t>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(K.empty,!0))}return n}function vg(n,t){let e=[];for(let r=Math.min(n.depth,t.depth);r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||t.end(r)>t.pos+(t.depth-r)||n.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==n.depth&&r==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&e.push(r)}return e}let _g=class Nu extends fe{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return ye.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return ye.fromReplace(t,this.pos,this.pos+1,new W(K.from(i),0,e.isLeaf?0:1))}getMap(){return Zr.empty}invert(t){return new Nu(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Nu(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Nu(e.pos,e.attr,e.value)}};fe.jsonID("attr",_g);let yg=class Mp extends fe{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return ye.ok(r)}getMap(){return Zr.empty}invert(t){return new Mp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Mp(e.attr,e.value)}};fe.jsonID("docAttr",yg);let Es=class extends Error{};Es=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(Es.prototype=Object.create(Error.prototype)).constructor=Es,Es.prototype.name="TransformError";class h1{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new c1}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Es(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=W.empty){let i=function(o,s,a=s,l=W.empty){if(s==a&&!l.size)return null;let u=o.resolve(s),c=o.resolve(a);return gg(u,c,l)?new Qn(s,a,l):new d1(u,c,l).fit()}(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new W(K.from(r),0,0))}delete(t,e){return this.replace(t,e,W.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return function(i,o,s,a){if(!a.size)return i.deleteRange(o,s);let l=i.doc.resolve(o),u=i.doc.resolve(s);if(gg(l,u,a))return i.step(new Qn(o,s,a));let c=vg(l,i.doc.resolve(s));c[c.length-1]==0&&c.pop();let d=-(l.depth+1);c.unshift(d);for(let E=l.depth,A=l.pos-1;E>0;E--,A--){let v=l.node(E).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;c.indexOf(E)>-1?d=E:l.before(E)==A&&c.splice(1,0,-E)}let h=c.indexOf(d),p=[],f=a.openStart;for(let E=a.content,A=0;;A++){let v=E.firstChild;if(p.push(v),A==a.openStart)break;E=v.content}for(let E=f-1;E>=0;E--){let A=p[E],v=(m=A.type).spec.defining||m.spec.definingForContent;if(v&&!A.sameMarkup(l.node(Math.abs(d)-1)))f=E;else if(v||!A.type.isTextblock)break}var m;for(let E=a.openStart;E>=0;E--){let A=(E+f+1)%(a.openStart+1),v=p[A];if(v)for(let _=0;_<c.length;_++){let O=c[(_+h)%c.length],T=!0;O<0&&(T=!1,O=-O);let S=l.node(O-1),N=l.index(O-1);if(S.canReplaceWith(N,N,v.type,v.marks))return i.replace(l.before(O),T?u.after(O):s,new W(Ag(a.content,0,a.openStart,A),A,a.openEnd))}}let g=i.steps.length;for(let E=c.length-1;E>=0&&(i.replace(o,s,a),!(i.steps.length>g));E--){let A=c[E];A<0||(o=l.before(A),s=u.after(A))}}(this,t,e,r),this}replaceRangeWith(t,e,r){return function(i,o,s,a){if(!a.isInline&&o==s&&i.doc.resolve(o).parent.content.size){let l=function(u,c,d){let h=u.resolve(c);if(h.parent.canReplaceWith(h.index(),h.index(),d))return c;if(h.parentOffset==0)for(let p=h.depth-1;p>=0;p--){let f=h.index(p);if(h.node(p).canReplaceWith(f,f,d))return h.before(p+1);if(f>0)return null}if(h.parentOffset==h.parent.content.size)for(let p=h.depth-1;p>=0;p--){let f=h.indexAfter(p);if(h.node(p).canReplaceWith(f,f,d))return h.after(p+1);if(f<h.node(p).childCount)return null}return null}(i.doc,o,a.type);l!=null&&(o=s=l)}i.replaceRange(o,s,new W(K.from(a),0,0))}(this,t,e,r),this}deleteRange(t,e){return function(r,i,o){let s=r.doc.resolve(i),a=r.doc.resolve(o),l=vg(s,a);for(let u=0;u<l.length;u++){let c=l[u],d=u==l.length-1;if(d&&c==0||s.node(c).type.contentMatch.validEnd)return r.delete(s.start(c),a.end(c));if(c>0&&(d||s.node(c-1).canReplace(s.index(c-1),a.indexAfter(c-1))))return r.delete(s.before(c),a.after(c))}for(let u=1;u<=s.depth&&u<=a.depth;u++)if(i-s.start(u)==s.depth-u&&o>s.end(u)&&a.end(u)-o!=a.depth-u)return r.delete(s.before(u),o);r.delete(i,o)}(this,t,e),this}lift(t,e){return function(r,i,o){let{$from:s,$to:a,depth:l}=i,u=s.before(l+1),c=a.after(l+1),d=u,h=c,p=K.empty,f=0;for(let E=l,A=!1;E>o;E--)A||s.index(E)>0?(A=!0,p=K.from(s.node(E).copy(p)),f++):d--;let m=K.empty,g=0;for(let E=l,A=!1;E>o;E--)A||a.after(E+1)<a.end(E)?(A=!0,m=K.from(a.node(E).copy(m)),g++):h++;r.step(new Qr(d,h,u,c,new W(p.append(m),f,g),p.size-f,!0))}(this,t,e),this}join(t,e=1){return function(r,i,o){let s=new Qn(i-o,i+o,W.empty,!0);r.step(s)}(this,t,e),this}wrap(t,e){return function(r,i,o){let s=K.empty;for(let u=o.length-1;u>=0;u--){if(s.size){let c=o[u].type.contentMatch.matchFragment(s);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=K.from(o[u].type.create(o[u].attrs,s))}let a=i.start,l=i.end;r.step(new Qr(a,l,a,l,new W(s,0,0),o.length,!0))}(this,t,e),this}setBlockType(t,e=t,r,i=null){return function(o,s,a,l,u){if(!l.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let c=o.steps.length;o.doc.nodesBetween(s,a,(d,h)=>{if(d.isTextblock&&!d.hasMarkup(l,u)&&function(p,f,m){let g=p.resolve(f),E=g.index();return g.parent.canReplaceWith(E,E+1,m)}(o.doc,o.mapping.slice(c).map(h),l)){o.clearIncompatible(o.mapping.slice(c).map(h,1),l);let p=o.mapping.slice(c),f=p.map(h,1),m=p.map(h+d.nodeSize,1);return o.step(new Qr(f,m,f+1,m-1,new W(K.from(l.create(u,null,d.marks)),0,0),1,!0)),!1}})}(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return function(o,s,a,l,u){let c=o.doc.nodeAt(s);if(!c)throw new RangeError("No node at given position");a||(a=c.type);let d=a.create(l,null,u||c.marks);if(c.isLeaf)return o.replaceWith(s,s+c.nodeSize,d);if(!a.validContent(c.content))throw new RangeError("Invalid content for node type "+a.name);o.step(new Qr(s,s+c.nodeSize,s+1,s+c.nodeSize-1,new W(K.from(d),0,0),1,!0))}(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new _g(t,e,r)),this}setDocAttribute(t,e){return this.step(new yg(t,e)),this}addNodeMark(t,e){return this.step(new kc(t,e)),this}removeNodeMark(t,e){if(!(e instanceof At)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(r.marks)))return this}return this.step(new Lc(t,e)),this}split(t,e=1,r){return function(i,o,s=1,a){let l=i.doc.resolve(o),u=K.empty,c=K.empty;for(let d=l.depth,h=l.depth-s,p=s-1;d>h;d--,p--){u=K.from(l.node(d).copy(u));let f=a&&a[p];c=K.from(f?f.type.create(f.attrs,c):l.node(d).copy(c))}i.step(new Qn(o,o,new W(u.append(c),s,s),!0))}(this,t,e,r),this}addMark(t,e,r){return function(i,o,s,a){let l,u,c=[],d=[];i.doc.nodesBetween(o,s,(h,p,f)=>{if(!h.isInline)return;let m=h.marks;if(!a.isInSet(m)&&f.type.allowsMarkType(a.type)){let g=Math.max(p,o),E=Math.min(p+h.nodeSize,s),A=a.addToSet(m);for(let v=0;v<m.length;v++)m[v].isInSet(A)||(l&&l.to==g&&l.mark.eq(m[v])?l.to=E:c.push(l=new fs(g,E,m[v])));u&&u.to==g?u.to=E:d.push(u=new Dc(g,E,a))}}),c.forEach(h=>i.step(h)),d.forEach(h=>i.step(h))}(this,t,e,r),this}removeMark(t,e,r){return function(i,o,s,a){let l=[],u=0;i.doc.nodesBetween(o,s,(c,d)=>{if(!c.isInline)return;u++;let h=null;if(a instanceof $a){let p,f=c.marks;for(;p=a.isInSet(f);)(h||(h=[])).push(p),f=p.removeFromSet(f)}else a?a.isInSet(c.marks)&&(h=[a]):h=c.marks;if(h&&h.length){let p=Math.min(d+c.nodeSize,s);for(let f=0;f<h.length;f++){let m,g=h[f];for(let E=0;E<l.length;E++){let A=l[E];A.step==u-1&&g.eq(l[E].style)&&(m=A)}m?(m.to=p,m.step=u):l.push({style:g,from:Math.max(d,o),to:p,step:u})}}}),l.forEach(c=>i.step(new fs(c.from,c.to,c.style)))}(this,t,e,r),this}clearIncompatible(t,e,r){return function(i,o,s,a=s.contentMatch){let l=i.doc.nodeAt(o),u=[],c=o+1;for(let d=0;d<l.childCount;d++){let h=l.child(d),p=c+h.nodeSize,f=a.matchType(h.type);if(f){a=f;for(let m=0;m<h.marks.length;m++)s.allowsMarkType(h.marks[m].type)||i.step(new fs(c,p,h.marks[m]));if(h.isText&&!s.spec.code){let m,g,E=/\r?\n|\r/g;for(;m=E.exec(h.text);)g||(g=new W(K.from(s.schema.text(" ",s.allowedMarks(h.marks))),0,0)),u.push(new Qn(c+m.index,c+m.index+m[0].length,g))}}else u.push(new Qn(c,p,W.empty));c=p}if(!a.validEnd){let d=a.fillBefore(K.empty,!0);i.replace(c,c,new W(d,0,0))}for(let d=u.length-1;d>=0;d--)i.step(u[d])}(this,t,e,r),this}}const Bc=Object.create(null);class mt{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new p1(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=W.empty){let r=e.content.lastChild,i=null;for(let a=0;a<e.openEnd;a++)i=r,r=r.lastChild;let o=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=t.mapping.slice(o);t.replaceRange(c.map(l.pos),c.map(u.pos),a?W.empty:e),a==0&&Sg(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=t.mapping.slice(r),u=l.map(s.pos),c=l.map(a.pos);o?t.deleteRange(u,c):(t.replaceRangeWith(u,c,e),Sg(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new vt(t):no(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let s=e<0?no(t.node(0),t.node(o),t.before(o+1),t.index(o),e,r):no(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,r);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new je(t.node(0))}static atStart(t){return no(t,t,0,0,1)||new je(t)}static atEnd(t){return no(t,t,t.content.size,t.childCount,-1)||new je(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bc[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Bc)throw new RangeError("Duplicate use of selection JSON ID "+t);return Bc[t]=e,e.prototype.jsonID=t,e}getBookmark(){return vt.between(this.$anchor,this.$head).getBookmark()}}mt.prototype.visible=!0;class p1{constructor(t,e){this.$from=t,this.$to=e}}let Tg=!1;function Og(n){Tg||n.parent.inlineContent||(Tg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class vt extends mt{constructor(t,e=t){Og(t),Og(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return mt.near(r);let i=t.resolve(e.map(this.anchor));return new vt(i.parent.inlineContent?i:r,r)}replace(t,e=W.empty){if(super.replace(t,e),e==W.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof vt&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ja(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new vt(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if(r&&!i||(r=i>=0?1:-1),!e.parent.inlineContent){let o=mt.findFrom(e,r,!0)||mt.findFrom(e,-r,!0);if(!o)return mt.near(e,r);e=o.$head}return t.parent.inlineContent||(i==0||(t=(mt.findFrom(t,-r,!0)||mt.findFrom(t,r,!0)).$anchor).pos<e.pos!=i<0)&&(t=e),new vt(t,e)}}mt.jsonID("text",vt);class ja{constructor(t,e){this.anchor=t,this.head=e}map(t){return new ja(t.map(this.anchor),t.map(this.head))}resolve(t){return vt.between(t.resolve(this.anchor),t.resolve(this.head))}}class st extends mt{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),o=t.resolve(i);return r?mt.near(o):new st(o)}content(){return new W(K.from(this.node),0,0)}eq(t){return t instanceof st&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Fc(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new st(t.resolve(e.anchor))}static create(t,e){return new st(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}st.prototype.visible=!1,mt.jsonID("node",st);class Fc{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new ja(r,r):new Fc(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&st.isSelectable(r)?new st(e):mt.near(e)}}class je extends mt{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=W.empty){if(e==W.empty){t.delete(0,t.doc.content.size);let r=mt.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new je(t)}map(t){return new je(t)}eq(t){return t instanceof je}getBookmark(){return f1}}mt.jsonID("all",je);const f1={map(){return this},resolve:n=>new je(n)};function no(n,t,e,r,i,o=!1){if(t.inlineContent)return vt.create(n,e);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let a=t.child(s);if(a.isAtom){if(!o&&st.isSelectable(a))return st.create(n,e-(i<0?a.nodeSize:0))}else{let l=no(n,a,e+i,i<0?a.childCount:0,i,o);if(l)return l}e+=a.nodeSize*i}return null}function Sg(n,t,e){let r=n.steps.length-1;if(r<t)return;let i,o=n.steps[r];(o instanceof Qn||o instanceof Qr)&&(n.mapping.maps[r].forEach((s,a,l,u)=>{i==null&&(i=u)}),n.setSelection(mt.near(n.doc.resolve(i),e)))}class m1 extends h1{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return At.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||At.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=e),r=r==null?e:r,!t)return this.deleteRange(e,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(e);o=r==e?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,o)),this.selection.empty||this.setSelection(mt.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Ng(n,t){return t&&n?n.bind(t):n}class As{constructor(t,e,r){this.name=t,this.init=Ng(e.init,r),this.apply=Ng(e.apply,r)}}const g1=[new As("doc",{init:n=>n.doc||n.schema.topNodeType.createAndFill(),apply:n=>n.doc}),new As("selection",{init:(n,t)=>n.selection||mt.atStart(t.doc),apply:n=>n.selection}),new As("storedMarks",{init:n=>n.storedMarks||null,apply:(n,t,e,r)=>r.selection.$cursor?n.storedMarks:null}),new As("scrollToSelection",{init:()=>0,apply:(n,t)=>n.scrolledIntoView?t+1:t})];class Uc{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=g1.slice(),e&&e.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new As(r.key,r.spec.state,r))})}}class ro{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,u=i?i[s].state:this,c=l<e.length&&a.spec.appendTransaction.call(a,l?e.slice(l):e,u,r);if(c&&r.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",t),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:e.length}:{state:this,n:0})}e.push(c),r=r.applyInner(c),o=!0}i&&(i[s]={state:r,n:e.length})}}if(!o)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new ro(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];e[o.name]=o.apply(t,this[o.name],this,e)}return e}get tr(){return new m1(this)}static create(t){let e=new Uc(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new ro(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new Uc(this.schema,t.plugins),r=e.fields,i=new ro(e);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(t,i)}return i}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(e[r]=o.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Uc(t.schema,t.plugins),o=new ro(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=qr.fromJSON(t.schema,e.doc);else if(s.name=="selection")o.selection=mt.fromJSON(o.doc,e.selection);else if(s.name=="storedMarks")e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(e,a))return void(o[s.name]=u.fromJSON.call(l,t,e[a],o))}o[s.name]=s.init(t,o)}}),o}}function Cg(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=Cg(i,t,{})),e[r]=i}return e}class Ya{constructor(t){this.spec=t,this.props={},t.props&&Cg(t.props,this,this.props),this.key=t.key?t.key.key:bg("plugin")}getState(t){return t[this.key]}}const Hc=Object.create(null);function bg(n){return n in Hc?n+"$"+ ++Hc[n]:(Hc[n]=0,n+"$")}class za{constructor(t="key"){this.key=bg(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Te=function(n){for(var t=0;;t++)if(!(n=n.previousSibling))return t},vs=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t};let Ig=null;const tr=function(n,t,e){let r=Ig||(Ig=document.createRange());return r.setEnd(n,e==null?n.nodeValue.length:e),r.setStart(n,t||0),r},ti=function(n,t,e,r){return e&&(wg(n,t,e,r,-1)||wg(n,t,e,r,1))},E1=/^(img|br|input|textarea|hr)$/i;function wg(n,t,e,r,i){for(;;){if(n==e&&t==r)return!0;if(t==(i<0?0:wn(n))){let o=n.parentNode;if(!o||o.nodeType!=1||$c(n)||E1.test(n.nodeName)||n.contentEditable=="false")return!1;t=Te(n)+(i<0?0:1),n=o}else{if(n.nodeType!=1||(n=n.childNodes[t+(i<0?-1:0)]).contentEditable=="false")return!1;t=i<0?wn(n):0}}}function wn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $c(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const Va=function(n){return n.focusNode&&ti(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ei(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}const Rn=typeof navigator!="undefined"?navigator:null,Rg=typeof document!="undefined"?document:null,vr=Rn&&Rn.userAgent||"",jc=/Edge\/(\d+)/.exec(vr),Dg=/MSIE \d/.exec(vr),Yc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr),Le=!!(Dg||Yc||jc),_r=Dg?document.documentMode:Yc?+Yc[1]:jc?+jc[1]:0,hn=!Le&&/gecko\/(\d+)/i.test(vr);hn&&(/Firefox\/(\d+)/.exec(vr)||[0,0])[1];const zc=!Le&&/Chrome\/(\d+)/.exec(vr),me=!!zc,A1=zc?+zc[1]:0,Oe=!Le&&!!Rn&&/Apple Computer/.test(Rn.vendor),io=Oe&&(/Mobile\/\w+/.test(vr)||!!Rn&&Rn.maxTouchPoints>2),on=io||!!Rn&&/Mac/.test(Rn.platform),v1=!!Rn&&/Win/.test(Rn.platform),pn=/Android \d/.test(vr),_s=!!Rg&&"webkitFontSmoothing"in Rg.documentElement.style,_1=_s?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y1(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function er(n,t){return typeof n=="number"?n:n[t]}function T1(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function kg(n,t,e){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=e||n.dom;s;s=vs(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,u=l?y1(o):T1(a),c=0,d=0;if(t.top<u.top+er(r,"top")?d=-(u.top-t.top+er(i,"top")):t.bottom>u.bottom-er(r,"bottom")&&(d=t.bottom-t.top>u.bottom-u.top?t.top+er(i,"top")-u.top:t.bottom-u.bottom+er(i,"bottom")),t.left<u.left+er(r,"left")?c=-(u.left-t.left+er(i,"left")):t.right>u.right-er(r,"right")&&(c=t.right-u.right+er(i,"right")),c||d)if(l)o.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let f=a.scrollLeft-h,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Lg(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=vs(r));return t}function xg(n,t){for(let e=0;e<n.length;e++){let{dom:r,top:i,left:o}=n[e];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let oo=null;function Mg(n,t){let e,r,i,o,s=2e8,a=0,l=t.top,u=t.top;for(let c=n.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else{if(c.nodeType!=3)continue;h=tr(c).getClientRects()}for(let p=0;p<h.length;p++){let f=h[p];if(f.top<=l&&f.bottom>=u){l=Math.max(f.bottom,l),u=Math.min(f.top,u);let m=f.left>t.left?f.left-t.left:f.right<t.left?t.left-f.right:0;if(m<s){e=c,s=m,r=m&&e.nodeType==3?{left:f.right<t.left?f.right:f.left,top:t.top}:t,c.nodeType==1&&m&&(a=d+(t.left>=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!i&&f.left<=t.left&&f.right>=t.left&&(i=c,o={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!e&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.bottom)&&(a=d+1)}}return!e&&i&&(e=i,r=o,s=0),e&&e.nodeType==3?function(c,d){let h=c.nodeValue.length,p=document.createRange();for(let f=0;f<h;f++){p.setEnd(c,f+1),p.setStart(c,f);let m=yr(p,1);if(m.top!=m.bottom&&Vc(d,m))return{node:c,offset:f+(d.left>=(m.left+m.right)/2?1:0)}}return{node:c,offset:0}}(e,r):!e||s&&e.nodeType==1?{node:n,offset:a}:Mg(e,r)}function Vc(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function Pg(n,t,e){let r=n.childNodes.length;if(r&&e.top<e.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-e.top)/(e.bottom-e.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Vc(t,u))return Pg(s,t,u)}}if((o=(o+1)%r)==i)break}return n}function O1(n,t){let e,r=n.dom.ownerDocument,i=0,o=function(u,c,d){if(u.caretPositionFromPoint)try{let h=u.caretPositionFromPoint(c,d);if(h)return{node:h.offsetNode,offset:h.offset}}catch(h){}if(u.caretRangeFromPoint){let h=u.caretRangeFromPoint(c,d);if(h)return{node:h.startContainer,offset:h.startOffset}}}(r,t.left,t.top);o&&({node:e,offset:i}=o);let s,a=(n.root.elementFromPoint?n.root:r).elementFromPoint(t.left,t.top);if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let u=n.dom.getBoundingClientRect();if(!Vc(t,u)||(a=Pg(n.dom,t,u),!a))return null}if(Oe)for(let u=a;e&&u;u=vs(u))u.draggable&&(e=void 0);if(a=function(u,c){let d=u.parentNode;return d&&/^li$/i.test(d.nodeName)&&c.left<u.getBoundingClientRect().left?d:u}(a,t),e){if(hn&&e.nodeType==1&&(i=Math.min(i,e.childNodes.length),i<e.childNodes.length)){let c,d=e.childNodes[i];d.nodeName=="IMG"&&(c=d.getBoundingClientRect()).right<=t.left&&c.bottom>t.top&&i++}let u;_s&&i&&e.nodeType==1&&(u=e.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,e==n.dom&&i==e.childNodes.length-1&&e.lastChild.nodeType==1&&t.top>e.lastChild.getBoundingClientRect().bottom?s=n.state.doc.content.size:i!=0&&e.nodeType==1&&e.childNodes[i-1].nodeName=="BR"||(s=function(c,d,h,p){let f=-1;for(let m=d,g=!1;m!=c.dom;){let E=c.docView.nearestDesc(m,!0);if(!E)return null;if(E.dom.nodeType==1&&(E.node.isBlock&&E.parent&&!g||!E.contentDOM)){let A=E.dom.getBoundingClientRect();if(E.node.isBlock&&E.parent&&!g&&(g=!0,A.left>p.left||A.top>p.top?f=E.posBefore:(A.right<p.left||A.bottom<p.top)&&(f=E.posAfter)),!E.contentDOM&&f<0&&!E.node.isText)return(E.node.isBlock?p.top<(A.top+A.bottom)/2:p.left<(A.left+A.right)/2)?E.posBefore:E.posAfter}m=E.dom.parentNode}return f>-1?f:c.docView.posFromDOM(d,h,-1)}(n,e,i,t))}s==null&&(s=function(u,c,d){let{node:h,offset:p}=Mg(c,d),f=-1;if(h.nodeType==1&&!h.firstChild){let m=h.getBoundingClientRect();f=m.left!=m.right&&d.left>(m.left+m.right)/2?1:-1}return u.docView.posFromDOM(h,p,f)}(n,a,t));let l=n.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Bg(n){return n.top<n.bottom||n.left<n.right}function yr(n,t){let e=n.getClientRects();if(e.length){let r=e[t<0?0:e.length-1];if(Bg(r))return r}return Array.prototype.find.call(e,Bg)||n.getBoundingClientRect()}const S1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Fg(n,t,e){let{node:r,offset:i,atom:o}=n.docView.domFromPos(t,e<0?-1:1),s=_s||hn;if(r.nodeType==3){if(!s||!S1.test(r.nodeValue)&&(e<0?i:i!=r.nodeValue.length)){let a=i,l=i,u=e<0?1:-1;return e<0&&!i?(l++,u=-1):e>=0&&i==r.nodeValue.length?(a--,u=1):e<0?a--:l++,ys(yr(tr(r,a,l),u),u<0)}{let a=yr(tr(r,i,i),e);if(hn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=yr(tr(r,i-1,i-1),-1);if(l.top==a.top){let u=yr(tr(r,i,i+1),-1);if(u.top!=a.top)return ys(u,u.left<l.left)}}return a}}if(!n.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(e<0||i==wn(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Wc(a.getBoundingClientRect(),!1)}if(o==null&&i<wn(r)){let a=r.childNodes[i];if(a.nodeType==1)return Wc(a.getBoundingClientRect(),!0)}return Wc(r.getBoundingClientRect(),e>=0)}if(o==null&&i&&(e<0||i==wn(r))){let a=r.childNodes[i-1],l=a.nodeType==3?tr(a,wn(a)-(s?0:1)):a.nodeType!=1||a.nodeName=="BR"&&a.nextSibling?null:a;if(l)return ys(yr(l,1),!1)}if(o==null&&i<wn(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?tr(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return ys(yr(l,-1),!0)}return ys(yr(r.nodeType==3?tr(r):r,-e),e>=0)}function ys(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function Wc(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function Ug(n,t,e){let r=n.state,i=n.root.activeElement;r!=t&&n.updateState(t),i!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),i!=n.dom&&i&&i.focus()}}const N1=/[\u0590-\u08ac]/;let Hg=null,$g=null,jg=!1;function C1(n,t,e){return Hg==t&&$g==e?jg:(Hg=t,$g=e,jg=e=="up"||e=="down"?function(r,i,o){let s=i.selection,a=o=="up"?s.$from:s.$to;return Ug(r,i,()=>{let{node:l}=r.docView.domFromPos(a.pos,o=="up"?-1:1);for(;;){let c=r.docView.nearestDesc(l,!0);if(!c)break;if(c.node.isBlock){l=c.contentDOM||c.dom;break}l=c.dom.parentNode}let u=Fg(r,a.pos,1);for(let c=l.firstChild;c;c=c.nextSibling){let d;if(c.nodeType==1)d=c.getClientRects();else{if(c.nodeType!=3)continue;d=tr(c,0,c.nodeValue.length).getClientRects()}for(let h=0;h<d.length;h++){let p=d[h];if(p.bottom>p.top+1&&(o=="up"?u.top-p.top>2*(p.bottom-u.top):p.bottom-u.bottom>2*(u.bottom-p.top)))return!1}}return!0})}(n,t,e):function(r,i,o){let{$head:s}=i.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,l=!a,u=a==s.parent.content.size,c=r.domSelection();return N1.test(s.parent.textContent)&&c.modify?Ug(r,i,()=>{let{focusNode:d,focusOffset:h,anchorNode:p,anchorOffset:f}=r.domSelectionRange(),m=c.caretBidiLevel;c.modify("move",o,"character");let g=s.depth?r.docView.domAfterPos(s.before()):r.dom,{focusNode:E,focusOffset:A}=r.domSelectionRange(),v=E&&!g.contains(E.nodeType==1?E:E.parentNode)||d==E&&h==A;try{c.collapse(p,f),d&&(d!=p||h!=f)&&c.extend&&c.extend(d,h)}catch(_){}return m!=null&&(c.caretBidiLevel=m),v}):o=="left"||o=="backward"?l:u}(n,t,e))}class Ts{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=0,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,r=this.posAtStart;;e++){let i=this.children[e];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode)){if(r<0){let o,s;if(t==this.contentDOM)o=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&(!(s=o.pmViewDesc)||s.parent!=this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}{let o,s;if(t==this.contentDOM)o=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&(!(s=o.pmViewDesc)||s.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}}let i;if(t==this.dom&&this.contentDOM)i=e>Te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(e==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&e==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return(i==null?r>0:i)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let r=!0,i=t;i;i=i.parentNode){let o,s=this.getDesc(i);if(s&&(!e||s.node)){if(!r||!(o=s.nodeDOM)||(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))return s;r=!1}}}getDesc(t){let e=t.pmViewDesc;for(let r=e;r;r=r.parent)if(r==this)return e}posFromDOM(t,e,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let i=this.children[e],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>t||s instanceof Vg){i=t-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,e);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Yg&&o.side>=0;r--);if(e<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,o&&o.dom.parentNode!=this.contentDOM;r--,s=!1);return o&&e&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,e):{node:this.contentDOM,offset:o?Te(o.dom)+1:0}}{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,o&&o.dom.parentNode!=this.contentDOM;r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,e):{node:this.contentDOM,offset:o?Te(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],u=s+l.size;if(i==-1&&t<=u){let c=s+l.border;if(t>=c&&e<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,c);t=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Te(h.dom)+1;break}t-=h.size}i==-1&&(i=0)}if(i>-1&&(u>e||a==this.children.length-1)){e=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Te(d.dom);break}e+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:t,to:e,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,i=!1){let o=Math.min(t,e),s=Math.max(t,e);for(let h=0,p=0;h<this.children.length;h++){let f=this.children[h],m=p+f.size;if(o>p&&s<m)return f.setSelection(t-p-f.border,e-p-f.border,r,i);p=m}let a=this.domFromPos(t,t?-1:1),l=e==t?a:this.domFromPos(e,e?-1:1),u=r.getSelection(),c=!1;if((hn||Oe)&&t==e){let{node:h,offset:p}=a;if(h.nodeType==3){if(c=!(!p||h.nodeValue[p-1]!=`
78
+ `),c&&p==h.nodeValue.length)for(let f,m=h;m;m=m.parentNode){if(f=m.nextSibling){f.nodeName=="BR"&&(a=l={node:f.parentNode,offset:Te(f)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let f=h.childNodes[p-1];c=f&&(f.nodeName=="BR"||f.contentEditable=="false")}}if(hn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||c&&Oe)&&ti(a.node,a.offset,u.anchorNode,u.anchorOffset)&&ti(l.node,l.offset,u.focusNode,u.focusOffset))return;let d=!1;if((u.extend||t==e)&&!c){u.collapse(a.node,a.offset);try{t!=e&&u.extend(l.node,l.offset),d=!0}catch(h){}}if(!d){if(t>e){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?t<=s&&e>=r:t<s&&e>r){let a=r+o.border,l=s-o.border;if(t>=a&&e<=l)return this.dirty=t==r||e==s?2:1,void(t!=a||e!=l||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-a,e-a):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}r=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?2:1;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Yg extends Ts{constructor(t,e,r,i){let o,s=e.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:i)),!e.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,o=this}matchesWidget(t){return this.dirty==0&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class b1 extends Ts{constructor(t,e,r,i){super(t,[],e,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ni extends Ts{constructor(t,e,r,i){super(t,[],r,i),this.mark=e}static create(t,e,r,i){let o=i.nodeViews[e.type.name],s=o&&o(e,i,r);return s&&s.dom||(s=Zn.renderSpec(document,e.type.spec.toDOM(e,r))),new ni(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=3&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=0){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}}slice(t,e,r){let i=ni.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;e<s&&(o=Kc(o,e,s,r)),t>0&&(o=Kc(o,0,t,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}}class Tr extends Ts{constructor(t,e,r,i,o,s,a,l,u){super(t,[],o,s),this.node=e,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(t,e,r,i,o,s){let a,l=o.nodeViews[e.type.name],u=l&&l(e,o,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,r,i),c=u&&u.dom,d=u&&u.contentDOM;if(e.isText)if(c){if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(e.text);else c||({dom:c,contentDOM:d}=Zn.renderSpec(document,e.type.spec.toDOM(e)));d||e.isText||c.nodeName=="BR"||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),e.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Xg(c,r,e),u?a=new I1(t,e,r,i,c,d||null,h,u,o,s+1):e.isText?new Wa(t,e,r,i,c,h,o):new Tr(t,e,r,i,c,d||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let r=this.children[e];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>K.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,r){return this.dirty==0&&t.eq(this.node)&&Xc(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,i=e,o=t.composing?this.localCompositionInfo(t,e):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new R1(this,s&&s.node,t);(function(u,c,d,h){let p=c.locals(u),f=0;if(p.length==0){for(let A=0;A<u.childCount;A++){let v=u.child(A);h(v,p,c.forChild(f,v),A),f+=v.nodeSize}return}let m=0,g=[],E=null;for(let A=0;;){let v,_,O,T;for(;m<p.length&&p[m].to==f;){let y=p[m++];y.widget&&(v?(_||(_=[v])).push(y):v=y)}if(v)if(_){_.sort(D1);for(let y=0;y<_.length;y++)d(_[y],A,!!E)}else d(v,A,!!E);if(E)T=-1,O=E,E=null;else{if(!(A<u.childCount))break;T=A,O=u.child(A++)}for(let y=0;y<g.length;y++)g[y].to<=f&&g.splice(y--,1);for(;m<p.length&&p[m].from<=f&&p[m].to>f;)g.push(p[m++]);let S=f+O.nodeSize;if(O.isText){let y=S;m<p.length&&p[m].from<y&&(y=p[m].from);for(let w=0;w<g.length;w++)g[w].to<y&&(y=g[w].to);y<S&&(E=O.cut(y-f),O=O.cut(0,y-f),S=y,T=-1)}else for(;m<p.length&&p[m].to<=S;)m++;let N=O.isInline&&!O.isLeaf?g.filter(y=>!y.inline):g.slice();h(O,N,c.forChild(f,O),T),f=S}})(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,t):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?At.none:this.node.child(c).marks,r,t),l.placeWidget(u,t,i)},(u,c,d,h)=>{let p;l.syncToMarks(u.marks,r,t),l.findNodeMatch(u,c,d,h)||a&&t.state.selection.from>i&&t.state.selection.to<i+u.nodeSize&&(p=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(u,c,d,p,t)||l.updateNextNode(u,c,d,t,h,i)||l.addNode(u,c,d,t,i),i+=u.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==2)&&(s&&this.protectLocalComposition(t,s),Wg(this.contentDOM,this.children,t),io&&function(u){if(u.nodeName=="UL"||u.nodeName=="OL"){let c=u.style.cssText;u.style.cssText=c+"; list-style: square !important",window.getComputedStyle(u).listStyle,u.style.cssText=c}}(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof vt)||r<e||i>e+this.node.content.size)return null;let o=t.domSelectionRange(),s=function(a,l){for(;;){if(a.nodeType==3)return a;if(a.nodeType==1&&l>0){if(a.childNodes.length>l&&a.childNodes[l].nodeType==3)return a.childNodes[l];l=wn(a=a.childNodes[l-1])}else{if(!(a.nodeType==1&&l<a.childNodes.length))return null;a=a.childNodes[l],l=0}}}(o.focusNode,o.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=function(u,c,d,h){for(let p=0,f=0;p<u.childCount&&f<=h;){let m=u.child(p++),g=f;if(f+=m.nodeSize,!m.isText)continue;let E=m.text;for(;p<u.childCount;){let A=u.child(p++);if(f+=A.nodeSize,!A.isText)break;E+=A.text}if(f>=d){if(f>=h&&E.slice(h-c.length-g,h-g)==c)return h-c.length;let A=g<h?E.lastIndexOf(c,h-g-1):-1;if(A>=0&&A+c.length+g>=d)return g+A;if(d==h&&E.length>=h+c.length-g&&E.slice(h-g,h-g+c.length)==c)return h}}return-1}(this.node.content,a,r-e,i-e);return l<0?null:{node:s,pos:l,text:a}}return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:r,text:i}){if(this.getDesc(e))return;let o=e;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new b1(this,o,e,i);t.input.compositionNodes.push(s),this.children=Kc(this.children,r,r+i.length,t,s)}update(t,e,r,i){return!(this.dirty==3||!t.sameMarkup(this.node))&&(this.updateInner(t,e,r,i),!0)}updateInner(t,e,r,i){this.updateOuterDeco(e),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Xc(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Gg(this.dom,this.nodeDOM,Gc(this.outerDeco,this.node,e),Gc(t,this.node,e)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function zg(n,t,e,r,i){Xg(r,t,n);let o=new Tr(void 0,n,t,e,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Wa extends Tr{constructor(t,e,r,i,o,s,a){super(t,e,r,i,o,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,r,i){return!(this.dirty==3||this.dirty!=0&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),this.dirty==0&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=0,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let i=this.node.cut(t,e),o=document.createTextNode(i.text);return new Wa(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||t!=0&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class Vg extends Ts{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==0&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class I1 extends Tr{constructor(t,e,r,i,o,s,a,l,u,c){super(t,e,r,i,o,s,a,u,c),this.spec=l}update(t,e,r,i){if(this.dirty==3)return!1;if(this.spec.update){let o=this.spec.update(t,e,r);return o&&this.updateInner(t,e,r,i),o}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,i){this.spec.setSelection?this.spec.setSelection(t,e,r):super.setSelection(t,e,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Wg(n,t,e){let r=n.firstChild,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=Kg(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof ni){let l=r?r.previousSibling:n.lastChild;Wg(s.contentDOM,s.children,e),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Kg(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}const Os=function(n){n&&(this.nodeName=n)};Os.prototype=Object.create(null);const ri=[new Os];function Gc(n,t,e){if(n.length==0)return ri;let r=e?ri[0]:new Os,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Os(s.nodeName));for(let a in s){let l=s[a];l!=null&&(e&&i.length==1&&i.push(r=new Os(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function Gg(n,t,e,r){if(e==ri&&r==ri)return t;let i=t;for(let o=0;o<r.length;o++){let s=r[o],a=e[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=ri[0]),i=l}w1(i,a||ri[0],s)}return i}function w1(n,t,e){for(let r in t)r=="class"||r=="style"||r=="nodeName"||r in e||n.removeAttribute(r);for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&e[r]!=t[r]&&n.setAttribute(r,e[r]);if(t.class!=e.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=e.class?e.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let r,i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=i.exec(t.style);)n.style.removeProperty(r[1])}e.style&&(n.style.cssText+=e.style)}}function Xg(n,t,e){return Gg(n,n,ri,Gc(t,e,n.nodeType!=1))}function Xc(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function Kg(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}class R1{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(i,o){let s=o,a=s.children.length,l=i.childCount,u=new Map,c=[];t:for(;l>0;){let d;for(;;)if(a){let p=s.children[a-1];if(!(p instanceof ni)){d=p,a--;break}s=p,a=p.children.length}else{if(s==o)break t;a=s.parent.children.indexOf(s),s=s.parent}let h=d.node;if(h){if(h!=i.child(l-1))break;--l,u.set(d,l),c.push(d)}}return{index:l,matched:u,matches:c.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,r){let i=0,o=this.stack.length>>1,s=Math.min(o,t.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(t[o])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ni.create(this.top,t[o],e,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(t,e,r,i){let o,s=-1;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(t,e,r)&&!this.preMatch.matched.has(u)){s=a;break}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,r,i,o){let s=this.top.children[i];return s.dirty==3&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,r,o)&&(this.destroyBetween(this.index,i),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=e}}updateNextNode(t,e,r,i,o,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Tr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=o)return!1;let c,d=l.dom,h=this.isLocked(d)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=3&&Xc(e,l.outerDeco));if(!h&&l.update(t,e,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,t,e,r,i,s)))return this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(i,s+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,r,i,o,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content))return null;let a=Tr.create(this.top,e,r,i,o,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,e,r,i,o){let s=Tr.create(this.top,t,e,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(!i||!i.matchesWidget(t)||t!=i.widget&&i.widget.type.toDOM.parentNode){let o=new Yg(this.top,t,e,r);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof ni;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Wa)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Oe||me)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Vg(this.top,[],r,null);e!=this.top?e.children.push(i):e.children.splice(this.index++,0,i),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function D1(n,t){return n.type.side-t.type.side}function Kc(n,t,e,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],u=a,c=a+=l.size;u>=e||c<=t?o.push(l):(u<t&&o.push(l.slice(0,t-u,r)),i&&(o.push(i),i=void 0),c>e&&o.push(l.slice(e-u,l.size,r)))}return o}function qc(n,t=null){let e=n.domSelectionRange(),r=n.state.doc;if(!e.focusNode)return null;let i=n.docView.nearestDesc(e.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let a,l,u=r.resolve(s);if(Va(e)){for(a=u;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&st.isSelectable(c)&&i.parent&&(!c.isInline||!function(d,h,p){for(let f=h==0,m=h==wn(d);f||m;){if(d==p)return!0;let g=Te(d);if(!(d=d.parentNode))return!1;f=f&&g==0,m=m&&g==wn(d)}}(e.focusNode,e.focusOffset,i.dom))){let d=i.posBefore;l=new st(s==d?u:r.resolve(d))}}else{let c=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(c<0)return null;a=r.resolve(c)}return l||(l=Zc(n,a,u,t=="pointer"||n.state.selection.head<u.pos&&!o?1:-1)),l}function qg(n){return n.editable?n.hasFocus():rE(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function nr(n,t=!1){let e=n.state.selection;if(tE(n,e),qg(n)){if(!t&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&me){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ti(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset))return n.input.mouseDown.delayedSelectionSync=!0,void n.domObserver.setCurSelection()}if(n.domObserver.disconnectSelection(),n.cursorWrapper)(function(r){let i=r.domSelection(),o=document.createRange(),s=r.cursorWrapper.dom,a=s.nodeName=="IMG";a?o.setEnd(s.parentNode,Te(s)+1):o.setEnd(s,0),o.collapse(!1),i.removeAllRanges(),i.addRange(o),!a&&!r.state.selection.visible&&Le&&_r<=11&&(s.disabled=!0,s.disabled=!1)})(n);else{let r,i,{anchor:o,head:s}=e;!Jg||e instanceof vt||(e.$from.parent.inlineContent||(r=Zg(n,e.from)),e.empty||e.$from.parent.inlineContent||(i=Zg(n,e.to))),n.docView.setSelection(o,s,n.root,t),Jg&&(r&&Qg(r),i&&Qg(i)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(a){let l=a.dom.ownerDocument;l.removeEventListener("selectionchange",a.input.hideSelectionGuard);let u=a.domSelectionRange(),c=u.anchorNode,d=u.anchorOffset;l.addEventListener("selectionchange",a.input.hideSelectionGuard=()=>{u.anchorNode==c&&u.anchorOffset==d||(l.removeEventListener("selectionchange",a.input.hideSelectionGuard),setTimeout(()=>{qg(a)&&!a.state.selection.visible||a.dom.classList.remove("ProseMirror-hideselection")},20))})}(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Jg=Oe||me&&A1<63;function Zg(n,t){let{node:e,offset:r}=n.docView.domFromPos(t,0),i=r<e.childNodes.length?e.childNodes[r]:null,o=r?e.childNodes[r-1]:null;if(Oe&&i&&i.contentEditable=="false")return Jc(i);if(!(i&&i.contentEditable!="false"||o&&o.contentEditable!="false")){if(i)return Jc(i);if(o)return Jc(o)}}function Jc(n){return n.contentEditable="true",Oe&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Qg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function tE(n,t){if(t instanceof st){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(eE(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else eE(n)}function eE(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Zc(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||vt.between(t,e,r)}function nE(n){return!(n.editable&&!n.hasFocus())&&rE(n)}function rE(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Qc(n,t){let{$anchor:e,$head:r}=n.selection,i=t>0?e.max(r):e.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return o&&mt.findFrom(o,t)}function Or(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function iE(n,t,e){let r=n.state.selection;if(!(r instanceof vt)){if(r instanceof st&&r.node.isInline)return Or(n,new vt(t>0?r.$to:r.$from));{let i=Qc(n.state,t);return!!i&&Or(n,i)}}if(e.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return Or(n,new vt(r.$anchor,s))}if(!r.empty)return!1;if(n.endOfTextblock(t>0?"forward":"backward")){let i=Qc(n.state,t);return!!(i&&i instanceof st)&&Or(n,i)}if(!(on&&e.indexOf("m")>-1)){let i,o=r.$head,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText)return!1;let a=t<0?o.pos-s.nodeSize:o.pos;return!!(s.isAtom||(i=n.docView.descAt(a))&&!i.contentDOM)&&(st.isSelectable(s)?Or(n,new st(t<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):!!_s&&Or(n,new vt(n.state.doc.resolve(t<0?a:a+s.nodeSize))))}}function Ga(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ss(n,t){let e=n.pmViewDesc;return e&&e.size==0&&(t<0||n.nextSibling||n.nodeName!="BR")}function so(n,t){return t<0?function(e){let r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s,a,l=!1;for(hn&&i.nodeType==1&&o<Ga(i)&&Ss(i.childNodes[o],-1)&&(l=!0);;)if(o>0){if(i.nodeType!=1)break;{let u=i.childNodes[o-1];if(Ss(u,-1))s=i,a=--o;else{if(u.nodeType!=3)break;i=u,o=i.nodeValue.length}}}else{if(oE(i))break;{let u=i.previousSibling;for(;u&&Ss(u,-1);)s=i.parentNode,a=Te(u),u=u.previousSibling;if(u)i=u,o=Ga(i);else{if(i=i.parentNode,i==e.dom)break;o=0}}}l?td(e,i,o):s&&td(e,s,a)}(n):function(e){let r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s,a,l=Ga(i);for(;;)if(o<l){if(i.nodeType!=1||!Ss(i.childNodes[o],1))break;s=i,a=++o}else{if(oE(i))break;{let u=i.nextSibling;for(;u&&Ss(u,1);)s=u.parentNode,a=Te(u)+1,u=u.nextSibling;if(u)i=u,o=0,l=Ga(i);else{if(i=i.parentNode,i==e.dom)break;o=l=0}}}s&&td(e,s,a)}(n)}function oE(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function td(n,t,e){if(t.nodeType!=3){let o,s;(s=function(a,l){for(;a&&l==a.childNodes.length&&!$c(a);)l=Te(a)+1,a=a.parentNode;for(;a&&l<a.childNodes.length;){let u=a.childNodes[l];if(u.nodeType==3)return u;if(u.nodeType==1&&u.contentEditable=="false")break;a=u,l=0}}(t,e))?(t=s,e=0):(o=function(a,l){for(;a&&!l&&!$c(a);)l=Te(a),a=a.parentNode;for(;a&&l;){let u=a.childNodes[l-1];if(u.nodeType==3)return u;if(u.nodeType==1&&u.contentEditable=="false")break;l=(a=u).childNodes.length}}(t,e))&&(t=o,e=o.nodeValue.length)}let r=n.domSelection();if(Va(r)){let o=document.createRange();o.setEnd(t,e),o.setStart(t,e),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,e);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&nr(n)},50)}function sE(n,t){let e=n.state.doc.resolve(t);if(!me&&!v1&&e.parent.inlineContent){let r=n.coordsAtPos(t);if(t>e.start()){let i=n.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(t<e.end()){let i=n.coordsAtPos(t+1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function aE(n,t,e){let r=n.state.selection;if(r instanceof vt&&!r.empty||e.indexOf("s")>-1||on&&e.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let s=Qc(n.state,t);if(s&&s instanceof st)return Or(n,s)}if(!i.parent.inlineContent){let s=t<0?i:o,a=r instanceof je?mt.near(s,t):mt.findFrom(s,t);return!!a&&Or(n,a)}return!1}function lE(n,t){if(!(n.state.selection instanceof vt))return!0;let{$head:e,$anchor:r,empty:i}=n.state.selection;if(!e.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return t<0?s.delete(e.pos-o.nodeSize,e.pos):s.delete(e.pos,e.pos+o.nodeSize),n.dispatch(s),!0}return!1}function uE(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function k1(n,t){let e=t.keyCode,r=function(i){let o="";return i.ctrlKey&&(o+="c"),i.metaKey&&(o+="m"),i.altKey&&(o+="a"),i.shiftKey&&(o+="s"),o}(t);if(e==8||on&&e==72&&r=="c")return lE(n,-1)||so(n,-1);if(e==46&&!t.shiftKey||on&&e==68&&r=="c")return lE(n,1)||so(n,1);if(e==13||e==27)return!0;if(e==37||on&&e==66&&r=="c"){let i=e==37?sE(n,n.state.selection.from)=="ltr"?-1:1:-1;return iE(n,i,r)||so(n,i)}if(e==39||on&&e==70&&r=="c"){let i=e==39?sE(n,n.state.selection.from)=="ltr"?1:-1:1;return iE(n,i,r)||so(n,i)}return e==38||on&&e==80&&r=="c"?aE(n,-1,r)||so(n,-1):e==40||on&&e==78&&r=="c"?function(i){if(!Oe||i.state.selection.$head.parentOffset>0)return!1;let{focusNode:o,focusOffset:s}=i.domSelectionRange();if(o&&o.nodeType==1&&s==0&&o.firstChild&&o.firstChild.contentEditable=="false"){let a=o.firstChild;uE(i,a,"true"),setTimeout(()=>uE(i,a,"false"),20)}return!1}(n)||aE(n,1,r)||so(n,1):r==(on?"m":"c")&&(e==66||e==73||e==89||e==90)}function cE(n,t){n.someProp("transformCopied",p=>{t=p(t,n)});let e=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let p=r.firstChild;e.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=n.someProp("clipboardSerializer")||Zn.fromSchema(n.state.schema),a=AE(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u,c=l.firstChild,d=0;for(;c&&c.nodeType==1&&(u=gE[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let f=a.createElement(u[p]);for(;l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(e)}`);let h=n.someProp("clipboardTextSerializer",p=>p(t,n))||t.content.textBetween(0,t.content.size,`
79
79
 
80
- `);return{dom:l,text:h}}function dE(n,t,e,r,i){let o,s,a=i.parent.type.spec.code;if(!e&&!t)return null;let l=t&&(r||a||!e);if(l){if(n.someProp("transformPastedText",h=>{t=h(t,a||r,n)}),a)return t?new G(K.from(n.state.schema.text(t.replace(/\r\n?/g,`
81
- `))),0,0):G.empty;let d=n.someProp("clipboardTextParser",h=>h(t,i,r,n));if(d)s=d;else{let h=i.marks(),{schema:p}=n.state,f=Zn.fromSchema(p);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",d=>{e=d(e,n)}),o=function(d){let h=/^(\s*<meta [^>]*>)*/.exec(d);h&&(d=d.slice(h[0].length));let p,f=AE().createElement("div"),m=/<([a-z][^>\s]+)/i.exec(d);if((p=m&&gE[m[1].toLowerCase()])&&(d=p.map(g=>"<"+g+">").join("")+d+p.map(g=>"</"+g+">").reverse().join("")),f.innerHTML=d,p)for(let g=0;g<p.length;g++)f=f.querySelector(p[g])||f;return f}(e),_s&&function(d){let h=d.querySelectorAll(me?"span:not([class]):not([style])":"span.Apple-converted-space");for(let p=0;p<h.length;p++){let f=h[p];f.childNodes.length==1&&f.textContent==" "&&f.parentNode&&f.parentNode.replaceChild(d.ownerDocument.createTextNode(" "),f)}}(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(s||(s=(n.someProp("clipboardParser")||n.someProp("domParser")||ps.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!(!l&&!c),context:i,ruleFromNode:h=>h.nodeName!="BR"||h.nextSibling||!h.parentNode||L1.test(h.parentNode.nodeName)?null:{ignore:!0}})),c)s=function(d,h){if(!d.size)return d;let p,f=d.content.firstChild.type.schema;try{p=JSON.parse(h)}catch(A){return d}let{content:m,openStart:g,openEnd:E}=d;for(let A=p.length-2;A>=0;A-=2){let v=f.nodes[p[A]];if(!v||v.hasRequiredAttrs())break;m=K.from(v.create(p[A+1],m)),g++,E++}return new G(m,g,E)}(mE(s,+c[1],+c[2]),c[4]);else if(s=G.maxOpen(function(d,h){if(d.childCount<2)return d;for(let p=h.depth;p>=0;p--){let f,m=h.node(p).contentMatchAt(h.index(p)),g=[];if(d.forEach(E=>{if(!g)return;let A,v=m.findWrapping(E.type);if(!v)return g=null;if(A=g.length&&f.length&&pE(v,f,E,g[g.length-1],0))g[g.length-1]=A;else{g.length&&(g[g.length-1]=fE(g[g.length-1],f.length));let _=hE(E,v);g.push(_),m=m.matchType(_.type),f=v}}),g)return K.from(g)}return d}(s.content,i),!0),s.openStart||s.openEnd){let d=0,h=0;for(let p=s.content.firstChild;d<s.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=s.content.lastChild;h<s.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);s=mE(s,d,h)}return n.someProp("transformPasted",d=>{s=d(s,n)}),s}const L1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function hE(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,K.from(n));return n}function pE(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let o=pE(n,t,e,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?e.type:n[i+1]))return r.copy(r.content.append(K.from(hE(e,n,i+1))))}}function fE(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,fE(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(K.empty,!0);return n.copy(e.append(r))}function ed(n,t,e,r,i,o){let s=t<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(o=0),i<r-1&&(a=ed(a,t,e,r,i+1,o)),i>=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(K.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function mE(n,t,e){return t<n.openStart&&(n=new G(ed(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new G(ed(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const gE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let EE=null;function AE(){return EE||(EE=document.implementation.createHTMLDocument("title"))}const Se={},Ne={},x1={touchstart:!0,touchmove:!0};class M1{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Sr(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function nd(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>rd(n,r))})}function rd(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return!!r&&(r(n,t)||t.defaultPrevented)})}function P1(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function Xa(n){return{left:n.clientX,top:n.clientY}}function id(n,t,e,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(t,a=>s>o.depth?a(n,e,o.nodeAfter,o.before(s),i,!0):a(n,e,o.node(s),o.before(s),i,!1)))return!0;return!1}function so(n,t,e){n.focused||n.focus();let r=n.state.tr.setSelection(t);r.setMeta("pointer",!0),n.dispatch(r)}function B1(n,t,e,r,i){return id(n,"handleClickOn",t,e,r)||n.someProp("handleClick",o=>o(n,t,r))||(i?function(o,s){if(s==-1)return!1;let a,l,u=o.state.selection;u instanceof st&&(a=u.node);let c=o.state.doc.resolve(s);for(let d=c.depth+1;d>0;d--){let h=d>c.depth?c.nodeAfter:c.node(d);if(st.isSelectable(h)){l=a&&u.$from.depth>0&&d>=u.$from.depth&&c.before(u.$from.depth+1)==u.$from.pos?c.before(u.$from.depth):c.before(d);break}}return l!=null&&(so(o,st.create(o.state.doc,l)),!0)}(n,e):function(o,s){if(s==-1)return!1;let a=o.state.doc.resolve(s),l=a.nodeAfter;return!!(l&&l.isAtom&&st.isSelectable(l))&&(so(o,new st(a)),!0)}(n,e))}function F1(n,t,e,r){return id(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function U1(n,t,e,r){return id(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||function(i,o,s){if(s.button!=0)return!1;let a=i.state.doc;if(o==-1)return!!a.inlineContent&&(so(i,vt.create(a,0,a.content.size)),!0);let l=a.resolve(o);for(let u=l.depth+1;u>0;u--){let c=u>l.depth?l.nodeAfter:l.node(u),d=l.before(u);if(c.inlineContent)so(i,vt.create(a,d+1,d+1+c.content.size));else{if(!st.isSelectable(c))continue;so(i,st.create(a,d))}return!0}}(n,e,r)}function od(n){return Ka(n)}Ne.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!_E(n,e)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!pn||!me||e.keyCode!=13))if(e.keyCode!=229&&n.domObserver.forceFlush(),!ro||e.keyCode!=13||e.ctrlKey||e.altKey||e.metaKey)n.someProp("handleKeyDown",r=>r(n,e))||k1(n,e)?e.preventDefault():Sr(n,"key");else{let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,ei(13,"Enter"))),n.input.lastIOSEnter=0)},200)}},Ne.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)},Ne.keypress=(n,t)=>{let e=t;if(_E(n,e)||!e.charCode||e.ctrlKey&&!e.altKey||on&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e)))return void e.preventDefault();let r=n.state.selection;if(!(r instanceof vt&&r.$from.sameParent(r.$to))){let i=String.fromCharCode(e.charCode);/[\r\n]/.test(i)||n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),e.preventDefault()}};const vE=on?"metaKey":"ctrlKey";Se.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=od(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&function(a,l){let u=l.x-a.clientX,c=l.y-a.clientY;return u*u+c*c<100}(e,n.input.lastClick)&&!e[vE]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:e.clientX,y:e.clientY,type:o};let s=n.posAtCoords(Xa(e));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new H1(n,s,e,!!r)):(o=="doubleClick"?F1:U1)(n,s.pos,s.inside,e)?e.preventDefault():Sr(n,"pointer"))};class H1{constructor(t,e,r,i){let o,s;if(this.view=t,this.pos=e,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[vE],this.allowDefault=r.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),s=e.inside;else{let c=t.state.doc.resolve(e.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:u}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof st&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!hn||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Sr(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nr(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Xa(t))),this.updateAllowDefault(t),this.allowDefault||!e?Sr(this.view,"pointer"):B1(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Oe&&this.mightDrag&&!this.mightDrag.node.isAtom||me&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(so(this.view,mt.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Sr(this.view,"pointer")}move(t){this.updateAllowDefault(t),Sr(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function _E(n,t){return!!n.composing||!!(Oe&&Math.abs(t.timeStamp-n.input.compositionEndedAt)<500)&&(n.input.compositionEndedAt=-2e8,!0)}Se.touchstart=n=>{n.input.lastTouch=Date.now(),od(n),Sr(n,"pointer")},Se.touchmove=n=>{n.input.lastTouch=Date.now(),Sr(n,"pointer")},Se.contextmenu=n=>od(n);const $1=pn?5e3:-1;function yE(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Ka(n),t))}function TE(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ka(n,t=!1){if(!(pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),TE(n),t||n.docView&&n.docView.dirty){let e=qc(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}}Ne.compositionstart=Ne.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||e.marks(),Ka(n,!0),n.markCursor=null;else if(Ka(n),hn&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){n.domSelection().collapse(s,s.nodeValue.length);break}i=s,o=-1}}n.input.composing=!0}yE(n,$1)},Ne.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,yE(n,20))};const Ns=Le&&_r<15||ro&&_1<604;function Cs(n,t,e,r,i){let o=dE(n,t,e,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,o||G.empty)))return!0;if(!o)return!1;let s=function(l){return l.openStart==0&&l.openEnd==0&&l.content.childCount==1?l.content.firstChild:null}(o),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function OE(n){let t=n.getData("text/plain")||n.getData("Text");if(t)return t;let e=n.getData("text/uri-list");return e?e.replace(/\r?\n/g," "):""}Se.copy=Ne.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let o=Ns?null:e.clipboardData,s=r.content(),{dom:a,text:l}=cE(n,s);o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function(u,c){if(!u.dom.parentNode)return;let d=u.dom.parentNode.appendChild(document.createElement("div"));d.appendChild(c),d.style.cssText="position: fixed; left: -10000px; top: 10px";let h=getSelection(),p=document.createRange();p.selectNodeContents(c),u.dom.blur(),h.removeAllRanges(),h.addRange(p),setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d),u.focus()},50)}(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ne.paste=(n,t)=>{let e=t;if(n.composing&&!pn)return;let r=Ns?null:e.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Cs(n,OE(r),r.getData("text/html"),i,e)?e.preventDefault():function(o,s){if(!o.dom.parentNode)return;let a=o.input.shiftKey||o.state.selection.$from.parent.type.spec.code,l=o.dom.parentNode.appendChild(document.createElement(a?"textarea":"div"));a||(l.contentEditable="true"),l.style.cssText="position: fixed; left: -10000px; top: 10px",l.focus();let u=o.input.shiftKey&&o.input.lastKeyCode!=45;setTimeout(()=>{o.focus(),l.parentNode&&l.parentNode.removeChild(l),a?Cs(o,l.value,null,u,s):Cs(o,l.textContent,l.innerHTML,u,s)},50)}(n,e)};class SE{constructor(t,e,r){this.slice=t,this.move=e,this.node=r}}const NE=on?"altKey":"ctrlKey";Se.dragstart=(n,t)=>{let e=t,r=n.input.mouseDown;if(r&&r.done(),!e.dataTransfer)return;let i,o=n.state.selection,s=o.empty?null:n.posAtCoords(Xa(e));if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof st?o.to-1:o.to))){if(r&&r.mightDrag)i=st.create(n.state.doc,r.mightDrag.pos);else if(e.target&&e.target.nodeType==1){let c=n.docView.nearestDesc(e.target,!0);c&&c.node.type.spec.draggable&&c!=n.docView&&(i=st.create(n.state.doc,c.posBefore))}}let a=(i||n.state.selection).content(),{dom:l,text:u}=cE(n,a);e.dataTransfer.clearData(),e.dataTransfer.setData(Ns?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",Ns||e.dataTransfer.setData("text/plain",u),n.dragging=new SE(a,!e[NE],i)},Se.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)},Ne.dragover=Ne.dragenter=(n,t)=>t.preventDefault(),Ne.drop=(n,t)=>{let e=t,r=n.dragging;if(n.dragging=null,!e.dataTransfer)return;let i=n.posAtCoords(Xa(e));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",f=>{s=f(s,n)}):s=dE(n,OE(e.dataTransfer),Ns?null:e.dataTransfer.getData("text/html"),!1,o);let a=!(!r||e[NE]);if(n.someProp("handleDrop",f=>f(n,e,s||G.empty,a)))return void e.preventDefault();if(!s)return;e.preventDefault();let l=s?function(f,m,g){let E=f.resolve(m);if(!g.content.size)return m;let A=g.content;for(let v=0;v<g.openStart;v++)A=A.firstChild.content;for(let v=1;v<=(g.openStart==0&&g.size?2:1);v++)for(let _=E.depth;_>=0;_--){let O=_==E.depth?0:E.pos<=(E.start(_+1)+E.end(_+1))/2?-1:1,T=E.index(_)+(O>0?1:0),S=E.node(_),N=!1;if(v==1)N=S.canReplace(T,T,A);else{let y=S.contentMatchAt(T).findWrapping(A.firstChild.type);N=y&&S.canReplaceWith(T,T,y[0])}if(N)return O==0?E.pos:O<0?E.before(_+1):E.after(_+1)}return null}(n.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let u=n.state.tr;if(a){let{node:f}=r;f?f.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=u.doc;if(d?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(h))return;let p=u.doc.resolve(c);if(d&&st.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new st(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,E,A)=>f=A),u.setSelection(Zc(n,p,u.doc.resolve(f)))}n.focus(),n.dispatch(u.setMeta("uiEvent","drop"))},Se.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&nr(n)},20))},Se.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Se.beforeinput=(n,t)=>{if(me&&pn&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:e}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=e||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,ei(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in Ne)Se[n]=Ne[n];function bs(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class qa{constructor(t,e){this.toDOM=t,this.spec=e||ii,this.side=this.spec.side||0}map(t,e,r,i){let{pos:o,deleted:s}=t.mapResult(e.from+i,this.side<0?-1:1);return s?null:new Ye(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof qa&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&bs(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Nr{constructor(t,e){this.attrs=t,this.spec=e||ii}map(t,e,r,i){let o=t.map(e.from+i,this.spec.inclusiveStart?-1:1)-r,s=t.map(e.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ye(o,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Nr&&bs(this.attrs,t.attrs)&&bs(this.spec,t.spec)}static is(t){return t.type instanceof Nr}destroy(){}}class sd{constructor(t,e){this.attrs=t,this.spec=e||ii}map(t,e,r,i){let o=t.mapResult(e.from+i,1);if(o.deleted)return null;let s=t.mapResult(e.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ye(o.pos-r,s.pos-r,this)}valid(t,e){let r,{index:i,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(r=t.child(i)).isText&&o+r.nodeSize==e.to}eq(t){return this==t||t instanceof sd&&bs(this.attrs,t.attrs)&&bs(this.spec,t.spec)}destroy(){}}class Ye{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new Ye(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new Ye(t,t,new qa(e,r))}static inline(t,e,r,i){return new Ye(t,e,new Nr(r,i))}static node(t,e,r,i){return new Ye(t,e,new sd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Nr}get widget(){return this.type instanceof qa}}const ao=[],ii={};class Wt{constructor(t,e){this.local=t.length?t:ao,this.children=e.length?e:ao}static create(t,e){return e.length?Ja(e,t,0,ii):ge}find(t,e,r){let i=[];return this.findInner(t==null?0:t,e==null?1e9:e,i,0,r),i}findInner(t,e,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=e&&a.to>=t&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,e-a,r,i+a,o)}}map(t,e,r){return this==ge||t.maps.length==0?this:this.mapInner(t,e,0,0,r||ii)}mapInner(t,e,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,i);l&&l.type.valid(e,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?function(a,l,u,c,d,h,p){let f=a.slice();for(let g=0,E=h;g<u.maps.length;g++){let A=0;u.maps[g].forEach((v,_,O,T)=>{let S=T-O-(_-v);for(let N=0;N<f.length;N+=3){let y=f[N+1];if(y<0||v>y+E-A)continue;let I=f[N]+E-A;_>=I?f[N+1]=v<=I?-2:-1:v>=E&&S&&(f[N]+=S,f[N+1]+=S)}A+=S}),E=u.maps[g].map(E,-1)}let m=!1;for(let g=0;g<f.length;g+=3)if(f[g+1]<0){if(f[g+1]==-2){m=!0,f[g+1]=-1;continue}let E=u.map(a[g]+h),A=E-d;if(A<0||A>=c.content.size){m=!0;continue}let v=u.map(a[g+1]+h,-1)-d,{index:_,offset:O}=c.content.findIndex(A),T=c.maybeChild(_);if(T&&O==A&&O+T.nodeSize==v){let S=f[g+2].mapInner(u,T,E+1,a[g]+h+1,p);S!=ge?(f[g]=A,f[g+1]=v,f[g+2]=S):(f[g+1]=-2,m=!0)}else m=!0}if(m){let g=function(A,v,_,O,T,S,N){function y(I,R){for(let b=0;b<I.local.length;b++){let L=I.local[b].map(O,T,R);L?_.push(L):N.onRemove&&N.onRemove(I.local[b].spec)}for(let b=0;b<I.children.length;b+=3)y(I.children[b+2],I.children[b]+R+1)}for(let I=0;I<A.length;I+=3)A[I+1]==-1&&y(A[I+2],v[I]+S+1);return _}(f,a,l,u,d,h,p),E=Ja(g,c,0,p);l=E.local;for(let A=0;A<f.length;A+=3)f[A+1]<0&&(f.splice(A,3),A-=3);for(let A=0,v=0;A<E.children.length;A+=3){let _=E.children[A];for(;v<f.length&&f[v]<_;)v+=3;f.splice(v,0,E.children[A],E.children[A+1],E.children[A+2])}}return new Wt(l.sort(oi),f)}(this.children,s||[],t,e,r,i,o):s?new Wt(s.sort(oi),ao):ge}add(t,e){return e.length?this==ge?Wt.create(t,e):this.addInner(t,e,0):this}addInner(t,e,r){let i,o=0;t.forEach((a,l)=>{let u,c=l+r;if(u=bE(e,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,Ja(u,a,c+1,ii)),o+=3}});let s=CE(o?IE(e):e,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Wt(s.length?this.local.concat(s).sort(oi):this.local,i||this.children)}remove(t){return t.length==0||this==ge?this:this.removeInner(t,0)}removeInner(t,e){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+e,l=r[o+1]+e;for(let c,d=0;d<t.length;d++)(c=t[d])&&c.from>a&&c.to<l&&(t[d]=null,(s||(s=[])).push(c));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=ge?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o,s=0;s<t.length;s++)if(o=t[s])for(let a=0;a<i.length;a++)i[a].eq(o,e)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Wt(i,r):ge}forChild(t,e){if(this==ge)return this;if(e.isLeaf)return Wt.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let o=t+1,s=o+e.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Nr){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Wt(i.sort(oi),ao);return r?new Cr([a,r]):a}return r||ge}eq(t){if(this==t)return!0;if(!(t instanceof Wt)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return ad(this.localsInner(t))}localsInner(t){if(this==ge)return ao;if(t.inlineContent||!this.local.some(Nr.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Nr||e.push(this.local[r]);return e}}Wt.empty=new Wt([],[]),Wt.removeOverlap=ad;const ge=Wt.empty;class Cr{constructor(t){this.members=t}map(t,e){const r=this.members.map(i=>i.map(t,e,ii));return Cr.from(r)}forChild(t,e){if(e.isLeaf)return Wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,e);o!=ge&&(o instanceof Cr?r=r.concat(o.members):r.push(o))}return Cr.from(r)}eq(t){if(!(t instanceof Cr)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(e){r&&(e=e.slice(),r=!1);for(let s=0;s<o.length;s++)e.push(o[s])}else e=o}return e?ad(r?e:e.sort(oi)):ao}static from(t){switch(t.length){case 0:return ge;case 1:return t[0];default:return new Cr(t.every(e=>e instanceof Wt)?t:t.reduce((e,r)=>e.concat(r instanceof Wt?r:r.members),[]))}}}function CE(n,t){if(!t||!n.length)return n;let e=[];for(let r=0;r<n.length;r++){let i=n[r];e.push(new Ye(i.from+t,i.to+t,i.type))}return e}function bE(n,t,e){if(t.isLeaf)return null;let r=e+t.nodeSize,i=null;for(let o,s=0;s<n.length;s++)(o=n[s])&&o.from>e&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function IE(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Ja(n,t,e,r){let i=[],o=!1;t.forEach((a,l)=>{let u=bE(n,a,l+e);if(u){o=!0;let c=Ja(u,a,e+l+1,r);c!=ge&&i.push(l,l+a.nodeSize,c)}});let s=CE(o?IE(n):n,-e).sort(oi);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Wt(s,i):ge}function oi(n,t){return n.from-t.from||n.to-t.to}function ad(n){let t=n;for(let e=0;e<t.length-1;e++){let r=t[e];if(r.from!=r.to)for(let i=e+1;i<t.length;i++){let o=t[i];if(o.from!=r.from){o.from<r.to&&(t==n&&(t=n.slice()),t[e]=r.copy(r.from,o.from),wE(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==n&&(t=n.slice()),t[i]=o.copy(o.from,r.to),wE(t,i+1,o.copy(r.to,o.to)))}}return t}function wE(n,t,e){for(;t<n.length&&oi(e,n[t])>0;)t++;n.splice(t,0,e)}function ld(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=ge&&t.push(r)}),n.cursorWrapper&&t.push(Wt.create(n.state.doc,[n.cursorWrapper.deco])),Cr.from(t)}const j1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Y1=Le&&_r<=11;class z1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class V1{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new z1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Le&&_r<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Y1&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,j1)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nE(this.view)){if(this.suppressingSelectionUpdates)return nr(this.view);if(Le&&_r<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ti(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,r=new Set;for(let o=t.focusNode;o;o=vs(o))r.add(o);for(let o=t.anchorNode;o;o=vs(o))if(r.has(o)){e=o;break}let i=e&&this.view.docView.nearestDesc(e);return i&&i.ignoreMutation({type:"selection",target:e.nodeType==3?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nE(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let c=0;c<e.length;c++){let d=this.registerMutation(e[c],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(hn&&l.length>1){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let d=c[0],h=c[1];d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}}let u=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Va(r)&&(u=qc(t))&&u.eq(mt.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nr(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),function(c){if(!RE.has(c)&&(RE.set(c,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(c.dom).whiteSpace)!==-1)){if(c.requiresGeckoHackNode=hn,DE)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),DE=!0}}(t)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nr(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++)e.push(t.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,o=t.nextSibling;if(Le&&_r<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:c,nextSibling:d}=t.addedNodes[u];(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(i=c),(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==t.target?Te(i)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=o&&o.parentNode==t.target?Te(o):t.target.childNodes.length;return{from:a,to:r.localPosFromDOM(t.target,l,1)}}return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let RE=new WeakMap,DE=!1;function W1(n){let t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Oe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(n.parentNode.lastChild==n||Oe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const G1=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function X1(n,t,e,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let y=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,I=qc(n,y);if(I&&!n.state.selection.eq(I)){if(me&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",b=>b(n,ei(13,"Enter"))))return;let R=n.state.tr.setSelection(I);y=="pointer"?R.setMeta("pointer",!0):y=="key"&&R.scrollIntoView(),o&&R.setMeta("composition",o),n.dispatch(R)}return}let s=n.state.doc.resolve(t),a=s.sharedDepth(e);t=s.before(a+1),e=n.state.doc.resolve(e).after(a+1);let l,u,c=n.state.selection,d=function(y,I,R){let b,{node:L,fromOffset:k,toOffset:B,from:j,to:$}=y.docView.parseRange(I,R),W=y.domSelectionRange(),x=W.anchorNode;if(x&&y.dom.contains(x.nodeType==1?x:x.parentNode)&&(b=[{node:x,offset:W.anchorOffset}],Va(W)||b.push({node:W.focusNode,offset:W.focusOffset})),me&&y.input.lastKeyCode===8)for(let V=B;V>k;V--){let it=L.childNodes[V-1],ut=it.pmViewDesc;if(it.nodeName=="BR"&&!ut){B=V;break}if(!ut||ut.size)break}let Q=y.state.doc,H=y.someProp("domParser")||ps.fromSchema(y.state.schema),nt=Q.resolve(j),ot=null,P=H.parse(L,{topNode:nt.parent,topMatch:nt.parent.contentMatchAt(nt.index()),topOpen:!0,from:k,to:B,preserveWhitespace:nt.parent.type.whitespace!="pre"||"full",findPositions:b,ruleFromNode:W1,context:nt});if(b&&b[0].pos!=null){let V=b[0].pos,it=b[1]&&b[1].pos;it==null&&(it=V),ot={anchor:V+j,head:it+j}}return{doc:P,sel:ot,from:j,to:$}}(n,t,e),h=n.state.doc,p=h.slice(d.from,d.to);n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(l=n.state.selection.to,u="end"):(l=n.state.selection.from,u="start"),n.input.lastKeyCode=null;let f=function(y,I,R,b,L){let k=y.findDiffStart(I,R);if(k==null)return null;let{a:B,b:j}=y.findDiffEnd(I,R+y.size,R+I.size);if(L=="end"&&(b-=B+Math.max(0,k-Math.min(B,j))-k),B<k&&y.size<I.size){let $=b<=k&&b>=B?k-b:0;k-=$,k&&k<I.size&&LE(I.textBetween(k-1,k+1))&&(k+=$?1:-1),j=k+(j-B),B=k}else if(j<k){let $=b<=k&&b>=j?k-b:0;k-=$,k&&k<y.size&&LE(y.textBetween(k-1,k+1))&&(k+=$?1:-1),B=k+(B-j),j=k}return{start:k,endA:B,endB:j}}(p.content,d.doc.content,d.from,l,u);if((ro&&n.input.lastIOSEnter>Date.now()-225||pn)&&i.some(y=>y.nodeType==1&&!G1.test(y.nodeName))&&(!f||f.endA>=f.endB)&&n.someProp("handleKeyDown",y=>y(n,ei(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof vt&&!c.empty&&c.$head.sameParent(c.$anchor))||n.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let y=kE(n,n.state.doc,d.sel);if(y&&!y.eq(n.state.selection)){let I=n.state.tr.setSelection(y);o&&I.setMeta("composition",o),n.dispatch(I)}}return}f={start:c.from,endA:c.to,endB:c.to}}if(me&&n.cursorWrapper&&d.sel&&d.sel.anchor==n.cursorWrapper.deco.from&&d.sel.head==d.sel.anchor){let y=f.endB-f.start;d.sel={anchor:d.sel.anchor+y,head:d.sel.anchor+y}}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&f.start==f.endB&&n.state.selection instanceof vt&&(f.start>n.state.selection.from&&f.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?f.start=n.state.selection.from:f.endA<n.state.selection.to&&f.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(f.endB+=n.state.selection.to-f.endA,f.endA=n.state.selection.to)),Le&&_r<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>d.from&&d.doc.textBetween(f.start-d.from-1,f.start-d.from+1)=="  "&&(f.start--,f.endA--,f.endB--);let m,g=d.doc.resolveNoCache(f.start-d.from),E=d.doc.resolveNoCache(f.endB-d.from),A=h.resolve(f.start),v=g.sameParent(E)&&g.parent.inlineContent&&A.end()>=f.endA;if((ro&&n.input.lastIOSEnter>Date.now()-225&&(!v||i.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&g.pos<d.doc.content.size&&!g.sameParent(E)&&(m=mt.findFrom(d.doc.resolve(g.pos+1),1,!0))&&m.head==E.pos)&&n.someProp("handleKeyDown",y=>y(n,ei(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(n.state.selection.anchor>f.start&&function(y,I,R,b,L){if(!b.parent.isTextblock||R-I<=L.pos-b.pos||ud(b,!0,!1)<L.pos)return!1;let k=y.resolve(I);if(k.parentOffset<k.parent.content.size||!k.parent.isTextblock)return!1;let B=y.resolve(ud(k,!0,!0));return!(!B.parent.isTextblock||B.pos>R||ud(B,!0,!1)<R)&&b.parent.content.cut(b.parentOffset).eq(B.parent.content)}(h,f.start,f.endA,g,E)&&n.someProp("handleKeyDown",y=>y(n,ei(8,"Backspace"))))return void(pn&&me&&n.domObserver.suppressSelectionUpdates());me&&pn&&f.endB==f.start&&(n.input.lastAndroidDelete=Date.now()),pn&&!v&&g.start()!=E.start()&&E.parentOffset==0&&g.depth==E.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==f.endA&&(f.endB-=2,E=d.doc.resolveNoCache(f.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(y){return y(n,ei(13,"Enter"))})},20));let _,O,T,S=f.start,N=f.endA;if(v){if(g.pos==E.pos)Le&&_r<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>nr(n),20)),_=n.state.tr.delete(S,N),O=h.resolve(f.start).marksAcross(h.resolve(f.endA));else if(f.endA==f.endB&&(T=function(y,I){let R,b,L,k=y.firstChild.marks,B=I.firstChild.marks,j=k,$=B;for(let x=0;x<B.length;x++)j=B[x].removeFromSet(j);for(let x=0;x<k.length;x++)$=k[x].removeFromSet($);if(j.length==1&&$.length==0)b=j[0],R="add",L=x=>x.mark(b.addToSet(x.marks));else{if(j.length!=0||$.length!=1)return null;b=$[0],R="remove",L=x=>x.mark(b.removeFromSet(x.marks))}let W=[];for(let x=0;x<I.childCount;x++)W.push(L(I.child(x)));if(K.from(W).eq(y))return{mark:b,type:R}}(g.parent.content.cut(g.parentOffset,E.parentOffset),A.parent.content.cut(A.parentOffset,f.endA-A.start()))))_=n.state.tr,T.type=="add"?_.addMark(S,N,T.mark):_.removeMark(S,N,T.mark);else if(g.parent.child(g.index()).isText&&g.index()==E.index()-(E.textOffset?0:1)){let y=g.parent.textBetween(g.parentOffset,E.parentOffset);if(n.someProp("handleTextInput",I=>I(n,S,N,y)))return;_=n.state.tr.insertText(y,S,N)}}if(_||(_=n.state.tr.replace(S,N,d.doc.slice(f.start-d.from,f.endB-d.from))),d.sel){let y=kE(n,_.doc,d.sel);y&&!(me&&pn&&n.composing&&y.empty&&(f.start!=f.endB||n.input.lastAndroidDelete<Date.now()-100)&&(y.head==S||y.head==_.mapping.map(N)-1)||Le&&y.empty&&y.head==S)&&_.setSelection(y)}O&&_.ensureMarks(O),o&&_.setMeta("composition",o),n.dispatch(_.scrollIntoView())}function kE(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:Zc(n,t.resolve(e.anchor),t.resolve(e.head))}function ud(n,t,e){let r=n.depth,i=t?n.end():n.pos;for(;r>0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,i++,t=!1;if(e){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function LE(n){if(n.length!=2)return!1;let t=n.charCodeAt(0),e=n.charCodeAt(1);return t>=56320&&t<=57343&&e>=55296&&e<=56319}class K1{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new M1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(FE),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=PE(this),ME(this),this.nodeViews=BE(this),this.docView=zg(this.state.doc,xE(this),ld(this),this.dom,this),this.domObserver=new V1(this,(r,i,o,s)=>X1(this,r,i,o,s)),this.domObserver.start(),function(r){for(let i in Se){let o=Se[i];r.dom.addEventListener(i,r.input.eventHandlers[i]=s=>{!P1(r,s)||rd(r,s)||!r.editable&&s.type in Ne||o(r,s)},x1[i]?{passive:!0}:void 0)}Oe&&r.dom.addEventListener("input",()=>null),nd(r)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&nd(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(FE),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let r in this._props)e[r]=this._props[r];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var r;let i=this.state,o=!1,s=!1;t.storedMarks&&this.composing&&(TE(this),s=!0),this.state=t;let a=i.plugins!=t.plugins||this._props.plugins!=e.plugins;if(a||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let p=BE(this);(function(f,m){let g=0,E=0;for(let A in f){if(f[A]!=m[A])return!0;g++}for(let A in m)E++;return g!=E})(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||e.handleDOMEvents!=this._props.handleDOMEvents)&&nd(this),this.editable=PE(this),ME(this);let l=ld(this),u=xE(this),c=i.plugins==t.plugins||i.doc.eq(t.doc)?t.scrollToSelection>i.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(t.doc,u,l);!d&&t.selection.eq(i.selection)||(s=!0);let h=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&function(p){let f,m,g=p.dom.getBoundingClientRect(),E=Math.max(0,g.top);for(let A=(g.left+g.right)/2,v=E+1;v<Math.min(innerHeight,g.bottom);v+=5){let _=p.root.elementFromPoint(A,v);if(!_||_==p.dom||!p.dom.contains(_))continue;let O=_.getBoundingClientRect();if(O.top>=E-20){f=_,m=O.top;break}}return{refDOM:f,refTop:m,stack:Lg(p.dom)}}(this);if(s){this.domObserver.stop();let p=d&&(Le||me)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&function(f,m){let g=Math.min(f.$anchor.sharedDepth(f.head),m.$anchor.sharedDepth(m.head));return f.$anchor.start(g)!=m.$anchor.start(g)}(i.selection,t.selection);if(d){let f=me?this.trackWrites=this.domSelectionRange().focusNode:null;!o&&this.docView.update(t.doc,u,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=zg(t.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(f){let m=f.docView.domFromPos(f.state.selection.anchor,0),g=f.domSelectionRange();return ti(m.node,m.offset,g.anchorNode,g.anchorOffset)}(this))?nr(this,p):(tE(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&function({refDOM:p,refTop:f,stack:m}){let g=p?p.getBoundingClientRect().top:0;xg(m,g==0?0:g-f)}(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof st){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&kg(this,e.getBoundingClientRect(),t)}else kg(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];r.update&&r.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let r=this.directPlugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let r=this.state.plugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}}updateDraggedNode(t,e){let r=t.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-e.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new SE(t.slice,t.move,i<0?void 0:st.create(this.state.doc,i))}someProp(t,e){let r,i=this._props&&this._props[t];if(i!=null&&(r=e?e(i):i))return r;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(r=e?e(a):a))return r}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[t];if(a!=null&&(r=e?e(a):a))return r}}hasFocus(){if(Le){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(io)return t.focus(io);let e=Lg(t);t.focus(io==null?{get preventScroll(){return io={preventScroll:!0},!0}}:void 0),io||(io=!1,xg(e,0))}(this.dom),nr(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}updateRoot(){this._root=null}posAtCoords(t){return O1(this,t)}coordsAtPos(t,e=1){return Fg(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let i=this.docView.posFromDOM(t,e,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,e){return C1(this,e||this.state,t)}pasteHTML(t,e){return Cs(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Cs(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ld(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(t){return function(e,r){rd(e,r)||!Se[r.type]||!e.editable&&r.type in Ne||Se[r.type](e,r)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return Oe&&this.root.nodeType===11&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom?function(t){let e;function r(u){u.preventDefault(),u.stopImmediatePropagation(),e=u.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0);let i=e.startContainer,o=e.startOffset,s=e.endContainer,a=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ti(l.node,l.offset,s,a)&&([i,o,s,a]=[s,a,i,o]),{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:a}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function xE(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let r in e)r=="class"?t.class+=" "+e[r]:r=="style"?t.style=(t.style?t.style+";":"")+e[r]:t[r]||r=="contenteditable"||r=="nodeName"||(t[r]=String(e[r]))}),t.translate||(t.translate="no"),[Ye.node(0,n.state.doc.content.size,t)]}function ME(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:Ye.widget(n.state.selection.head,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function PE(n){return!n.someProp("editable",t=>t(n.state)===!1)}function BE(n){let t=Object.create(null);function e(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function FE(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Jt=new class{constructor(n){this.cached=Object.create(null);let t=this.spec={};for(let r in n)t[r]=n[r];t.nodes=se.from(n.nodes),t.marks=se.from(n.marks||{}),this.nodes=sg.compile(this.spec.nodes,this),this.marks=$a.compile(this.spec.marks,this);let e=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],o=i.spec.content||"",s=i.spec.marks;i.contentMatch=e[o]||(e[o]=Jr.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=s=="_"?null:s?ag(this,s.split(" ")):s!=""&&i.inlineContent?null:[]}for(let r in this.marks){let i=this.marks[r],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ag(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(n,t=null,e,r){if(typeof n=="string")n=this.nodeType(n);else{if(!(n instanceof sg))throw new RangeError("Invalid node type: "+n);if(n.schema!=this)throw new RangeError("Node type from different schema used ("+n.name+")")}return n.createChecked(t,e,r)}text(n,t){let e=this.nodes.text;return new Ha(e,e.defaultAttrs,n,At.setFrom(t))}mark(n,t){return typeof n=="string"&&(n=this.marks[n]),n.create(t)}nodeFromJSON(n){return qr.fromJSON(this,n)}markFromJSON(n){return At.fromJSON(this,n)}nodeType(n){let t=this.nodes[n];if(!t)throw new RangeError("Unknown node type: "+n);return t}}({nodes:{doc:{content:"paragraph+"},paragraph:{code:!0,content:"inline*",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"},mention:{group:"inline",inline:!0,attrs:{id:{},name:{}},content:"text*",toDOM:n=>["span",{"data-mention-id":n.attrs.id,class:"t-mention"},`@${n.attrs.name}`],parseDOM:[{tag:"span[data-mention-id]",getAttrs:n=>({id:n.dataset["mention-id"]})}]},customemoji:{group:"inline",inline:!0,attrs:{name:{},url:{}},content:"text*",selectable:!1,toDOM:n=>["img",{src:n.attrs.url,alt:n.attrs.name,"data-custom-emoji":n.attrs.name}],parseDOM:[{tag:"img[data-custom-emoji]",getAttrs:n=>{const t=n;return{name:t.dataset.customEmoji,url:t.src}}}]}},marks:{literal:{toDOM:()=>["span",{"data-literal":""}],parseDOM:[{tag:"span[data-literal]"}]},bold:{toDOM:()=>["b"],parseDOM:[{tag:"b"}]},italic:{toDOM:()=>["i"],parseDOM:[{tag:"i"}]},strikethrough:{toDOM:()=>["del"],parseDOM:[{tag:"del"}]},emoji:{attrs:{emoji:{}},toDOM:n=>["span",{"data-emoji":n.attrs.emoji},n.attrs.emoji],parseDOM:[{tag:"span[data-emoji]",getAttrs:n=>({emoji:n.dataset.emoji})}]}}}),cd=new za("placeholder"),UE=new Ya({key:cd,props:{decorations(n){if(HE(n.doc))return;const t=n.doc.firstChild,e=Ye.node(0,t.nodeSize,{class:"empty-node","data-placeholder":cd.getState(n)});return Wt.create(n.doc,[e])}},state:{init:()=>"",apply:(n,t)=>{var e;return(e=n.getMeta(cd))!=null?e:t}}});function HE(n){return n.childCount!==1||n.firstChild.childCount!==0}for(var br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},Za={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},$E=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),q1=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),J1=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),jE=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Z1=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Q1=$E&&(jE||+$E[1]<57)||J1&&jE,ae=0;ae<10;ae++)br[48+ae]=br[96+ae]=String(ae);for(ae=1;ae<=24;ae++)br[ae+111]="F"+ae;for(ae=65;ae<=90;ae++)br[ae]=String.fromCharCode(ae+32),Za[ae]=String.fromCharCode(ae);for(var dd in br)Za.hasOwnProperty(dd)||(Za[dd]=br[dd]);const tN=typeof navigator!="undefined"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function eN(n){let t,e,r,i,o=n.split(/-(?!$)/),s=o[o.length-1];s=="Space"&&(s=" ");for(let a=0;a<o.length-1;a++){let l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))e=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);tN?i=!0:e=!0}}return t&&(s="Alt-"+s),e&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function hd(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function YE(n){return new Ya({props:{handleKeyDown:nN(n)}})}function nN(n){let t=function(e){let r=Object.create(null);for(let i in e)r[eN(i)]=e[i];return r}(n);return function(e,r){let i,o=function(a){var l=!(Q1&&(a.ctrlKey||a.altKey||a.metaKey)||(q1||Z1)&&a.shiftKey&&a.key&&a.key.length==1)&&a.key||(a.shiftKey?Za:br)[a.keyCode]||a.key||"Unidentified";return l=="Esc"&&(l="Escape"),l=="Del"&&(l="Delete"),l=="Left"&&(l="ArrowLeft"),l=="Up"&&(l="ArrowUp"),l=="Right"&&(l="ArrowRight"),l=="Down"&&(l="ArrowDown"),l}(r),s=t[hd(o,r)];if(s&&s(e.state,e.dispatch,e))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[hd(o,r,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=br[r.keyCode])&&i!=o){let a=t[hd(i,r)];if(a&&a(e.state,e.dispatch,e))return!0}}return!1}}var Qa=200,le=function(){};le.prototype.append=function(n){return n.length?(n=le.from(n),!this.length&&n||n.length<Qa&&this.leafAppend(n)||this.length<Qa&&n.leafPrepend(this)||this.appendInner(n)):this},le.prototype.prepend=function(n){return n.length?le.from(n).append(this):this},le.prototype.appendInner=function(n){return new rN(this,n)},le.prototype.slice=function(n,t){return n===void 0&&(n=0),t===void 0&&(t=this.length),n>=t?le.empty:this.sliceInner(Math.max(0,n),Math.min(this.length,t))},le.prototype.get=function(n){if(!(n<0||n>=this.length))return this.getInner(n)},le.prototype.forEach=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length),t<=e?this.forEachInner(n,t,e,0):this.forEachInvertedInner(n,t,e,0)},le.prototype.map=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length);var r=[];return this.forEach(function(i,o){return r.push(n(i,o))},t,e),r},le.from=function(n){return n instanceof le?n:n&&n.length?new zE(n):le.empty};var zE=function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new t(this.values.slice(r,i))},t.prototype.getInner=function(r){return this.values[r]},t.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},t.prototype.leafAppend=function(r){if(this.length+r.length<=Qa)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=Qa)return new t(r.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(le);le.empty=new zE([]);var rN=function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,r,i,o){var s=this.left.length;return!(r<s&&this.left.forEachInner(e,r,Math.min(i,s),o)===!1)&&!(i>s&&this.right.forEachInner(e,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)&&void 0},t.prototype.forEachInvertedInner=function(e,r,i,o){var s=this.left.length;return!(r>s&&this.right.forEachInvertedInner(e,r-s,Math.max(i,s)-s,o+s)===!1)&&!(i<s&&this.left.forEachInvertedInner(e,Math.min(r,s),i,o)===!1)&&void 0},t.prototype.sliceInner=function(e,r){if(e==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(e,r):e>=i?this.right.slice(e-i,r-i):this.left.slice(e,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new t(r,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(le),VE=le;const WE=Math.pow(2,16);function iN(n,t){return n+t*WE}function GE(n){return 65535&n}let pd=class{constructor(n,t,e){this.pos=n,this.delInfo=t,this.recover=e}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}},si=class Yo{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&Yo.empty)return Yo.empty}recover(t){let e=0,r=GE(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/WE}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:iN(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new pd(h,f,p)}i+=c-u}return r?t+i:new pd(t+i,0,null)}touches(t,e){let r=0,i=GE(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new Yo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Yo.empty:new Yo(t<0?[0,-t,0]:[0,0,t])}};si.empty=new si([]);class Is{constructor(t=[],e,r=0,i=t.length){this.maps=t,this.mirror=e,this.from=r,this.to=i}slice(t=0,e=this.maps.length){return new Is(this.maps,this.mirror,t,e)}copy(){return new Is(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),e!=null&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,r=this.maps.length;e<t.maps.length;e++){let i=t.getMirror(e);this.appendMap(t.maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this.maps.length+t.maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t.maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new Is;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o].mapResult(t,e);if(s.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,t=this.maps[a].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new pd(t,i,null)}}const fd=Object.create(null);let Ee=class{getMap(){return si.empty}merge(n){return null}static fromJSON(n,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let e=fd[t.stepType];if(!e)throw new RangeError(`No step type ${t.stepType} defined`);return e.fromJSON(n,t)}static jsonID(n,t){if(n in fd)throw new RangeError("Duplicate use of step JSON ID "+n);return fd[n]=t,t.prototype.jsonID=n,t}},Ce=class fa{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new fa(t,null)}static fail(t){return new fa(null,t)}static fromReplace(t,e,r,i){try{return fa.ok(t.replace(e,r,i))}catch(o){if(o instanceof to)return fa.fail(o.message);throw o}}};function md(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(md(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}let XE=class ma extends Ee{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new G(md(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return Ce.fromReplace(t,this.from,this.to,o)}invert(){return new KE(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ma(e.pos,r.pos,this.mark)}merge(t){return t instanceof ma&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ma(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ma(e.from,e.to,t.markFromJSON(e.mark))}};Ee.jsonID("addMark",XE);let KE=class ga extends Ee{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new G(md(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Ce.fromReplace(t,this.from,this.to,r)}invert(){return new XE(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ga(e.pos,r.pos,this.mark)}merge(t){return t instanceof ga&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ga(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ga(e.from,e.to,t.markFromJSON(e.mark))}};Ee.jsonID("removeMark",KE);let qE=class Ea extends Ee{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Ce.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new Ea(this.pos,e.marks[i]);return new Ea(this.pos,this.mark)}}return new JE(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ea(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ea(e.pos,t.markFromJSON(e.mark))}};Ee.jsonID("addNodeMark",qE);let JE=class Pp extends Ee{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Ce.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new qE(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Pp(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Pp(e.pos,t.markFromJSON(e.mark))}};Ee.jsonID("removeNodeMark",JE),Ee.jsonID("replace",class xi extends Ee{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&gd(t,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new si([this.from,this.to-this.from,this.slice.size])}invert(t){return new xi(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new xi(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof xi)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?G.empty:new G(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new xi(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?G.empty:new G(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new xi(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new xi(e.from,e.to,G.fromJSON(t,e.slice),!!e.structure)}});function gd(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}Ee.jsonID("replaceAround",class Cu extends Ee{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(gd(t,this.from,this.gapFrom)||gd(t,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Ce.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Ce.fromReplace(t,this.from,this.to,r):Ce.fail("Content does not fit in gap")}getMap(){return new si([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Cu(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Cu(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Cu(e.from,e.to,e.gapFrom,e.gapTo,G.fromJSON(t,e.slice),e.insert,!!e.structure)}}),Ee.jsonID("attr",class bu extends Ee{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Ce.fromReplace(t,this.pos,this.pos+1,new G(K.from(i),0,e.isLeaf?0:1))}getMap(){return si.empty}invert(t){return new bu(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new bu(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new bu(e.pos,e.attr,e.value)}}),Ee.jsonID("docAttr",class Bp extends Ee{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Ce.ok(r)}getMap(){return si.empty}invert(t){return new Bp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bp(e.attr,e.value)}});let tl=class extends Error{};tl=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(tl.prototype=Object.create(Error.prototype)).constructor=tl,tl.prototype.name="TransformError";class fn{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let r,i,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}e&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s,a,l=t.tr,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step)return r||(r=this.remapping(o,h+1),i=r.maps.length),i--,void c.push(d);if(r){c.push(new Ir(d.map));let p,f=d.step.map(r.slice(i));f&&l.maybeStep(f).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],u.push(new Ir(p,void 0,void 0,u.length+c.length))),i--,p&&r.appendMap(p,i)}else l.maybeStep(d.step);return d.selection?(s=r?d.selection.map(r.slice(i)):d.selection,a=new fn(this.items.slice(0,o).append(c.reverse().concat(u)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:a,transform:l,selection:s}}addTransform(t,e,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<t.steps.length;c++){let d,h=t.steps[c].invert(t.docs[c]),p=new Ir(t.mapping.maps[c],h,e);(d=l&&l.merge(p))&&(p=d,c?o.pop():a=a.slice(0,a.length-1)),o.push(p),e&&(s++,e=void 0),i||(l=p)}let u=s-r.depth;return u>oN&&(a=function(c,d){let h;return c.forEach((p,f)=>{if(p.selection&&d--==0)return h=f,!1}),c.slice(h)}(a,u),s-=u),new fn(a.append(o),s)}remapping(t,e){let r=new Is;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},t,e),r}addMaps(t){return this.eventCount==0?this:new fn(this.items.append(t.map(e=>new Ir(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-e),o=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=e;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=t.steps[p].invert(t.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new Ir(f,m,g))}else r.push(new Ir(f))},i);let u=[];for(let h=e;h<s;h++)u.push(new Ir(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new fn(c,a);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(e.slice(r)),u=l&&l.getMap();if(r--,u&&e.appendMap(u,r),l){let c=s.selection&&s.selection.map(e.slice(r));c&&o++;let d,h=new Ir(u.invert(),l,c),p=i.length-1;(d=i.length&&i[p].merge(h))?i[p]=d:i.push(h)}}else s.map&&r--},this.items.length,0),new fn(VE.from(i.reverse()),o)}}fn.empty=new fn(VE.empty,0);let Ir=class YT{constructor(t,e,r,i){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new YT(e.getMap().invert(),e,this.selection)}}};class wr{constructor(t,e,r,i,o){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const oN=20;function ZE(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((r,i,o,s)=>t.push(o,s));return t}function Ed(n,t){if(!n)return null;let e=[];for(let r=0;r<n.length;r+=2){let i=t.map(n[r],1),o=t.map(n[r+1],-1);i<=o&&e.push(i,o)}return e}let Ad=!1,QE=null;function el(n){let t=n.plugins;if(QE!=t){Ad=!1,QE=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ad=!0;break}}return Ad}const ai=new za("history"),sN=new za("closeHistory");function aN(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ya({key:ai,state:{init:()=>new wr(fn.empty,fn.empty,null,0,-1),apply:(t,e,r)=>function(i,o,s,a){let l,u=s.getMeta(ai);if(u)return u.historyState;s.getMeta(sN)&&(i=new wr(i.done,i.undone,null,0,-1));let c=s.getMeta("appendedTransaction");if(s.steps.length==0)return i;if(c&&c.getMeta(ai))return c.getMeta(ai).redo?new wr(i.done.addTransform(s,void 0,a,el(o)),i.undone,ZE(s.mapping.maps),i.prevTime,i.prevComposition):new wr(i.done,i.undone.addTransform(s,void 0,a,el(o)),null,i.prevTime,i.prevComposition);if(s.getMeta("addToHistory")===!1||c&&c.getMeta("addToHistory")===!1)return(l=s.getMeta("rebased"))?new wr(i.done.rebased(s,l),i.undone.rebased(s,l),Ed(i.prevRanges,s.mapping),i.prevTime,i.prevComposition):new wr(i.done.addMaps(s.mapping.maps),i.undone.addMaps(s.mapping.maps),Ed(i.prevRanges,s.mapping),i.prevTime,i.prevComposition);{let d=s.getMeta("composition"),h=i.prevTime==0||!c&&i.prevComposition!=d&&(i.prevTime<(s.time||0)-a.newGroupDelay||!function(f,m){if(!m)return!1;if(!f.docChanged)return!0;let g=!1;return f.mapping.maps[0].forEach((E,A)=>{for(let v=0;v<m.length;v+=2)E<=m[v+1]&&A>=m[v]&&(g=!0)}),g}(s,i.prevRanges)),p=c?Ed(i.prevRanges,s.mapping):ZE(s.mapping.maps);return new wr(i.done.addTransform(s,h?o.selection.getBookmark():void 0,a,el(o)),fn.empty,p,s.time,d==null?i.prevComposition:d)}}(e,r,t,n)},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?e0:r=="historyRedo"?n0:null;return!!i&&(e.preventDefault(),i(t.state,t.dispatch))}}}})}function t0(n,t){return(e,r)=>{let i=ai.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=function(s,a,l){let u=el(a),c=ai.get(a).spec.config,d=(l?s.undone:s.done).popEvent(a,u);if(!d)return null;let h=d.selection.resolve(d.transform.doc),p=(l?s.done:s.undone).addTransform(d.transform,a.selection.getBookmark(),c,u),f=new wr(l?p:d.remaining,l?d.remaining:p,null,0,-1);return d.transform.setSelection(h).setMeta(ai,{redo:l,historyState:f})}(i,e,n);o&&r(t?o.scrollIntoView():o)}return!0}}const e0=t0(!1,!0),n0=t0(!0,!0),r0=Math.pow(2,16);function lN(n,t){return n+t*r0}function i0(n){return 65535&n}class o0{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class ze{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&ze.empty)return ze.empty}recover(t){let e=0,r=i0(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/r0}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:lN(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new o0(h,f,p)}i+=c-u}return r?t+i:new o0(t+i,0,null)}touches(t,e){let r=0,i=i0(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new ze(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?ze.empty:new ze(t<0?[0,-t,0]:[0,0,t])}}ze.empty=new ze([]);const vd=Object.create(null);class Ae{getMap(){return ze.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=vd[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in vd)throw new RangeError("Duplicate use of step JSON ID "+t);return vd[t]=e,e.prototype.jsonID=t,e}}class Gt{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Gt(t,null)}static fail(t){return new Gt(null,t)}static fromReplace(t,e,r,i){try{return Gt.ok(t.replace(e,r,i))}catch(o){if(o instanceof to)return Gt.fail(o.message);throw o}}}function _d(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(_d(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}class li extends Ae{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new G(_d(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return Gt.fromReplace(t,this.from,this.to,o)}invert(){return new ui(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new li(e.pos,r.pos,this.mark)}merge(t){return t instanceof li&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new li(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new li(e.from,e.to,t.markFromJSON(e.mark))}}Ae.jsonID("addMark",li);class ui extends Ae{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new G(_d(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Gt.fromReplace(t,this.from,this.to,r)}invert(){return new li(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ui(e.pos,r.pos,this.mark)}merge(t){return t instanceof ui&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ui(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ui(e.from,e.to,t.markFromJSON(e.mark))}}Ae.jsonID("removeMark",ui);class ci extends Ae{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Gt.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new ci(this.pos,e.marks[i]);return new ci(this.pos,this.mark)}}return new ws(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ci(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ci(e.pos,t.markFromJSON(e.mark))}}Ae.jsonID("addNodeMark",ci);class ws extends Ae{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Gt.fromReplace(t,this.pos,this.pos+1,new G(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new ci(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ws(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ws(e.pos,t.markFromJSON(e.mark))}}Ae.jsonID("removeNodeMark",ws);class mn extends Ae{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&yd(t,this.from,this.to)?Gt.fail("Structure replace would overwrite content"):Gt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new ze([this.from,this.to-this.from,this.slice.size])}invert(t){return new mn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new mn(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof mn)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?G.empty:new G(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new mn(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?G.empty:new G(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new mn(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new mn(e.from,e.to,G.fromJSON(t,e.slice),!!e.structure)}}Ae.jsonID("replace",mn);class Rr extends Ae{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(yd(t,this.from,this.gapFrom)||yd(t,this.gapTo,this.to)))return Gt.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Gt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Gt.fromReplace(t,this.from,this.to,r):Gt.fail("Content does not fit in gap")}getMap(){return new ze([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Rr(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Rr(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Rr(e.from,e.to,e.gapFrom,e.gapTo,G.fromJSON(t,e.slice),e.insert,!!e.structure)}}function yd(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function uN(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function Td(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let e=n.depth;;--e){let r=n.$from.node(e),i=n.$from.index(e),o=n.$to.indexAfter(e);if(e<n.depth&&r.canReplace(i,o,t))return e;if(e==0||r.type.spec.isolating||!uN(r,i,o))break}return null}function nl(n,t,e=1,r){let i=n.resolve(t),o=i.depth-e,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=e-2;u>o;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),f=r&&r[c+1];f&&(p=p.replaceChild(0,f.type.create(f.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function s0(n,t){let e=n.resolve(t),r=e.index();return function(i,o){return!(!i||!o||i.isLeaf||!function(s,a){a.content.size||s.type.compatibleContent(a.type);let l=s.contentMatchAt(s.childCount),{linebreakReplacement:u}=s.type.schema;for(let c=0;c<a.childCount;c++){let d=a.child(c),h=d.type==u?s.type.schema.nodes.text:d.type;if(l=l.matchType(h),!l||!s.type.allowsMarks(d.marks))return!1}return l.validEnd}(i,o))}(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function a0(n,t,e=t,r=G.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),o=n.resolve(e);return function(s,a,l){return!l.openStart&&!l.openEnd&&s.start()==a.start()&&s.parent.canReplace(s.index(),a.index(),l.content)}(i,o,r)?new mn(t,e,r):new cN(i,o,r).fit()}Ae.jsonID("replaceAround",Rr);class cN{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=K.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new G(o,s,a);return t>-1?new Rr(r.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||r.pos!=this.$to.pos?new mn(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=e.firstChild;if(e.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}e=o.content}for(let e=1;e<=2;e++)for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Od(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let l,{type:u,match:c}=this.frontier[a],d=null;if(e==1&&(s?c.matchType(s.type)||(d=c.fillBefore(K.from(s),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(e==2&&s&&(l=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:l};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Od(t,e);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new G(t,e+1,Math.max(r,i.size+e>=t.size-r?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Od(t,e);if(i.childCount<=1&&e>0){let o=t.size-e<=e+i.size;this.unplaced=new G(Rs(t,e-1,1),e-1,o?e-1:r)}else this.unplaced=new G(Rs(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:o}){for(;this.depth>e;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,u=0,c=[],{match:d,type:h}=this.frontier[e];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let p=a.size+t-(s.content.size-s.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(l0(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?p:-1)))}let f=u==a.childCount;f||(p=-1),this.placed=Ds(this.placed,e,K.from(c)),this.frontier[e].match=d,f&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let E=g.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),g=E.content}this.unplaced=f?t==0?G.empty:new G(Rs(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new G(Rs(s.content,t,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Sd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Sd(t,e,i,r,o);if(s){for(let a=e-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Sd(t,a,u,l,!0);if(!c||c.childCount)continue t}return{depth:e,fit:s,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Ds(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Ds(this.placed,this.depth,K.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(K.empty,!0);t.childCount&&(this.placed=Ds(this.placed,this.frontier.length,t))}}function Rs(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(Rs(n.firstChild.content,t-1,e)))}function Ds(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Ds(n.lastChild.content,t-1,e)))}function Od(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function l0(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,l0(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),n.copy(r)}function Sd(n,t,e,r,i){let o=n.node(t),s=i?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(l,u,c){for(let d=c;d<u.childCount;d++)if(!l.allowsMarks(u.child(d).marks))return!0;return!1}(e,o.content,s)?a:null}class ks extends Ae{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Gt.fromReplace(t,this.pos,this.pos+1,new G(K.from(i),0,e.isLeaf?0:1))}getMap(){return ze.empty}invert(t){return new ks(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ks(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ks(e.pos,e.attr,e.value)}}Ae.jsonID("attr",ks);class rl extends Ae{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Gt.ok(r)}getMap(){return ze.empty}invert(t){return new rl(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rl(e.attr,e.value)}}Ae.jsonID("docAttr",rl);let il=class extends Error{};il=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(il.prototype=Object.create(Error.prototype)).constructor=il,il.prototype.name="TransformError";const u0=(n,t)=>!n.selection.empty&&(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function lo(n,t,e=!1){for(let r=n;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(e&&r.childCount!=1)return!1}return!1}function c0(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function d0(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}function Nd(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const dN=(n,t)=>{let{$from:e,$to:r}=n.selection;if(n.selection instanceof st&&n.selection.node.isBlock)return!(!e.parentOffset||!nl(n.doc,e.pos)||(t&&t(n.tr.split(e.pos).scrollIntoView()),0));if(!e.depth)return!1;let i,o,s=[],a=!1,l=!1;for(let h=e.depth;;h--){if(e.node(h).isBlock){a=e.end(h)==e.pos+(e.depth-h),l=e.start(h)==e.pos-(e.depth-h),o=Nd(e.node(h-1).contentMatchAt(e.indexAfter(h-1))),s.unshift(a&&o?{type:o}:null),i=h;break}if(h==1)return!1;s.unshift(null)}let u=n.tr;(n.selection instanceof vt||n.selection instanceof je)&&u.deleteSelection();let c=u.mapping.map(e.pos),d=nl(u.doc,c,s.length,s);if(d||(s[0]=o?{type:o}:null,d=nl(u.doc,c,s.length,s)),u.split(c,s.length,s),!a&&l&&e.node(i).type!=o){let h=u.mapping.map(e.before(i)),p=u.doc.resolve(h);o&&e.node(i-1).canReplaceWith(p.index(),p.index()+1,o)&&u.setNodeMarkup(u.mapping.map(e.before(i)),o)}return t&&t(u.scrollIntoView()),!0};function h0(n,t,e,r){let i,o,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(p,f,m){let g=f.nodeBefore,E=f.nodeAfter,A=f.index();return!(!(g&&E&&g.type.compatibleContent(E.type))||(!g.content.size&&f.parent.canReplace(A-1,A)?(m&&m(p.tr.delete(f.pos-g.nodeSize,f.pos).scrollIntoView()),0):!f.parent.canReplace(A,A+1)||!E.isTextblock&&!s0(p.doc,f.pos)||(m&&m(p.tr.join(f.pos).scrollIntoView()),0)))}(n,t,e))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(i=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(i[0]||a.type).validEnd){if(e){let p=t.pos+a.nodeSize,f=K.empty;for(let E=i.length-1;E>=0;E--)f=K.from(i[E].create(null,f));f=K.from(s.copy(f));let m=n.tr.step(new Rr(t.pos-1,p,t.pos,p,new G(f,1,0),i.length,!0)),g=m.doc.resolve(p+2*i.length);g.nodeAfter&&g.nodeAfter.type==s.type&&s0(m.doc,g.pos)&&m.join(g.pos),e(m.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:mt.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),h=d&&Td(d);if(h!=null&&h>=t.depth)return e&&e(n.tr.lift(d,h).scrollIntoView()),!0;if(u&&lo(a,"start",!0)&&lo(s,"end")){let p=s,f=[];for(;f.push(p),!p.isTextblock;)p=p.lastChild;let m=a,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(e){let E=K.empty;for(let A=f.length-1;A>=0;A--)E=K.from(f[A].copy(E));e(n.tr.step(new Rr(t.pos-f.length,t.pos+a.nodeSize,t.pos+g,t.pos+a.nodeSize-g,new G(E,f.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function p0(n){return function(t,e){let r=t.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(e&&e(t.tr.setSelection(vt.create(t.doc,n<0?i.start(o):i.end(o)))),!0)}}const hN=p0(-1),pN=p0(1);function Cd(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}let bd=Cd(u0,(n,t,e)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("backward",s):l.parentOffset>0)?null:l}(n,e);if(!r)return!1;let i=c0(r);if(!i){let s=r.blockRange(),a=s&&Td(s);return a!=null&&(t&&t(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(h0(n,i,t,-1))return!0;if(r.parent.content.size==0&&(lo(o,"end")||st.isSelectable(o)))for(let s=r.depth;;s--){let a=a0(n.doc,r.before(s),r.after(s),G.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=n.tr.step(a);l.setSelection(lo(o,"end")?mt.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):st.create(l.doc,i.pos-o.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=c0(r)}let s=o&&o.nodeBefore;return!(!s||!st.isSelectable(s))&&(t&&t(n.tr.setSelection(st.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)}),f0=Cd(u0,(n,t,e)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("forward",s):l.parentOffset<l.parent.content.size)?null:l}(n,e);if(!r)return!1;let i=d0(r);if(!i)return!1;let o=i.nodeAfter;if(h0(n,i,t,1))return!0;if(r.parent.content.size==0&&(lo(o,"start")||st.isSelectable(o))){let s=a0(n.doc,r.before(),r.after(),G.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=n.tr.step(s);a.setSelection(lo(o,"start")?mt.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):st.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=d0(r)}let s=o&&o.nodeAfter;return!(!s||!st.isSelectable(s))&&(t&&t(n.tr.setSelection(st.create(n.doc,o.pos)).scrollIntoView()),!0)});const rr={Enter:Cd((n,t)=>{let{$head:e,$anchor:r}=n.selection;return!(!e.parent.type.spec.code||!e.sameParent(r))&&(t&&t(n.tr.insertText(`
82
- `).scrollIntoView()),!0)},(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof je||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Nd(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(vt.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let o=e.before();if(nl(n.doc,o))return t&&t(n.tr.split(o).scrollIntoView()),!0}let r=e.blockRange(),i=r&&Td(r);return i!=null&&(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)},dN),"Mod-Enter":(n,t)=>{let{$head:e,$anchor:r}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(r))return!1;let i=e.node(-1),o=e.indexAfter(-1),s=Nd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let a=e.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(mt.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Backspace:bd,"Mod-Backspace":bd,"Shift-Backspace":bd,Delete:f0,"Mod-Delete":f0,"Mod-a":(n,t)=>(t&&t(n.tr.setSelection(new je(n.doc))),!0)},m0={"Ctrl-h":rr.Backspace,"Alt-Backspace":rr["Mod-Backspace"],"Ctrl-d":rr.Delete,"Ctrl-Alt-Backspace":rr["Mod-Delete"],"Alt-Delete":rr["Mod-Delete"],"Alt-d":rr["Mod-Delete"],"Ctrl-a":hN,"Ctrl-e":pN};for(let n in rr)m0[n]=rr[n];const ol=(typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!(typeof os=="undefined"||!os.platform)&&os.platform()=="darwin")?m0:rr,Ls=(n,t,e=void 0)=>function(r,i){return r.reduce((o,s,a)=>o.concat(i(s,a)),[])}(n,r=>{if(typeof r=="string")return t(r,e);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:r.type,children:Ls(r.children,t,r.type)}];case"link":return[{type:r.type,url:r.url,children:Ls(r.children,t,r.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:r.type,action:r.action,params:r.params,children:Ls(r.children,t,r.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[r]}});function ir(n,t){return e=>{const r=e;let i=0;const o=[];for(const s of Zu(e,n)){s.index-i>0&&o.push(r.substring(i,s.index));const a=t(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<e.length&&o.push(e.substring(i)),o}}function g0(n){return n.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1").replace(/<!!customemoji:(.*?)>/gim,"$1")}const E0="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Id=(n=>(n[n.italic=1]="italic",n[n.strikethrough=2]="strikethrough",n[n.bold=4]="bold",n))(Id||{});const fN=[0,1,2,3,4,5,6].map(n=>{const t=[];return 1&n||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&n||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&n||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map(e=>e.source).join("|"),"g")}),mN={_:1,"*":4,"~":2};function gN(n){return A0(n,0)}function A0(n,t=0){const e=fN[t],r=e?function(i){const o=EN.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${E0}])(?:${i.source})(?=[\\s${E0}]|$)`,"g")),s=ir(o,a=>{const l=a[0][1],u=a[1]||a[2]||a[3]||a[4]||a[5]||a[6];return[" ",{type:Id[mN[l]],children:[u]}]});return a=>{const[l,...u]=s(" "+a);return l.length>1&&u.unshift(l.substring(1)),u}}(e):()=>[n];return Ls(r(n),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?A0(i,t|Id[o]):[i])}const EN=function(){const n=function(){try{return new WeakMap}catch(t){const e={has:()=>!1,get:()=>{},set:()=>e};return e}}();return{getOrCompute(t,e){if(n.has(t))return n.get(t);const r=e();return n.set(t,r),r}}}();function v0(n,t){if(Array.prototype.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function di(n,t){for(var e=n.length-1;e>=0;e--)t(n[e])===!0&&n.splice(e,1)}function _0(n){throw new Error("Unhandled case for value: '"+n+"'")}var wd=function(){function n(t){t===void 0&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return n.prototype.setTagName=function(t){return this.tagName=t,this},n.prototype.getTagName=function(){return this.tagName||""},n.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},n.prototype.getAttr=function(t){return this.getAttrs()[t]},n.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},n.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},n.prototype.setClass=function(t){return this.setAttr("class",t)},n.prototype.addClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);e=s.shift();)v0(o,e)===-1&&o.push(e);return this.getAttrs().class=o.join(" "),this},n.prototype.removeClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);o.length&&(e=s.shift());){var a=v0(o,e);a!==-1&&o.splice(a,1)}return this.getAttrs().class=o.join(" "),this},n.prototype.getClass=function(){return this.getAttrs().class||""},n.prototype.hasClass=function(t){return(" "+this.getClass()+" ").indexOf(" "+t+" ")!==-1},n.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},n.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},n.prototype.getInnerHTML=function(){return this.innerHTML||""},n.prototype.getInnerHtml=function(){return this.getInnerHTML()},n.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},n.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r+'="'+t[r]+'"');return e.join(" ")},n}(),y0=function(){function n(t){t===void 0&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return n.prototype.build=function(t){return new wd({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},n.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},r=this.createCssClass(t);return r&&(e.class=r),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},n.prototype.createCssClass=function(t){var e=this.className;if(e){for(var r=[e],i=t.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(e+"-"+i[o]);return r.join(" ")}return""},n.prototype.processAnchorText=function(t){return t=this.doTruncate(t)},n.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var r=e.length,i=e.location;return i==="smart"?function(o,s,a){var l,u;a==null?(a="&hellip;",u=3,l=8):(u=a.length,l=a.length);var c=function(_){var O="";return _.scheme&&_.host&&(O+=_.scheme+"://"),_.host&&(O+=_.host),_.path&&(O+="/"+_.path),_.query&&(O+="?"+_.query),_.fragment&&(O+="#"+_.fragment),O},d=function(_,O){var T=O/2,S=Math.ceil(T),N=-1*Math.floor(T),y="";return N<0&&(y=_.substr(N)),_.substr(0,S)+a+y};if(o.length<=s)return o;var h=s-u,p=function(_){var O={},T=_,S=T.match(/^([a-z]+):\/\//i);return S&&(O.scheme=S[1],T=T.substr(S[0].length)),(S=T.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(O.host=S[1],T=T.substr(S[0].length)),(S=T.match(/^\/(.*?)(?=(\?|#|$))/i))&&(O.path=S[1],T=T.substr(S[0].length)),(S=T.match(/^\?(.*?)(?=(#|$))/i))&&(O.query=S[1],T=T.substr(S[0].length)),(S=T.match(/^#(.*?)$/i))&&(O.fragment=S[1]),O}(o);if(p.query){var f=p.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);f&&(p.query=p.query.substr(0,f[1].length),o=c(p))}if(o.length<=s||(p.host&&(p.host=p.host.replace(/^www\./,""),o=c(p)),o.length<=s))return o;var m="";if(p.host&&(m+=p.host),m.length>=h)return p.host.length==s?(p.host.substr(0,s-u)+a).substr(0,h+l):d(m,h).substr(0,h+l);var g="";if(p.path&&(g+="/"+p.path),p.query&&(g+="?"+p.query),g){if((m+g).length>=h)return(m+g).length==s?(m+g).substr(0,s):(m+d(g,h-m.length)).substr(0,h+l);m+=g}if(p.fragment){var E="#"+p.fragment;if((m+E).length>=h)return(m+E).length==s?(m+E).substr(0,s):(m+d(E,h-m.length)).substr(0,h+l);m+=E}if(p.scheme&&p.host){var A=p.scheme+"://";if((m+A).length<h)return(A+m).substr(0,s)}if(m.length<=s)return m;var v="";return h>0&&(v=m.substr(-1*Math.floor(h/2))),(m.substr(0,Math.ceil(h/2))+a+v).substr(0,h+l)}(t,r):i==="middle"?function(o,s,a){if(o.length<=s)return o;var l,u;a==null?(a="&hellip;",l=8,u=3):(l=a.length,u=a.length);var c=s-u,d="";return c>0&&(d=o.substr(-1*Math.floor(c/2))),(o.substr(0,Math.ceil(c/2))+a+d).substr(0,c+l)}(t,r):function(o,s,a){return function(l,u,c){var d;return l.length>u&&(c==null?(c="&hellip;",d=3):d=c.length,l=l.substring(0,u-d)+c),l}(o,s,a)}(t,r)},n}(),uo=function(){function n(t){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return n.prototype.getMatchedText=function(){return this.matchedText},n.prototype.setOffset=function(t){this.offset=t},n.prototype.getOffset=function(){return this.offset},n.prototype.getCssClassSuffixes=function(){return[this.getType()]},n.prototype.buildTag=function(){return this.tagBuilder.build(this)},n}(),Rd=function(n,t){return Rd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])},Rd(n,t)};function Dn(n,t){function e(){this.constructor=n}Rd(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var T0,Lt=function(){return Lt=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Lt.apply(this,arguments)},Dd=function(n){function t(e){var r=n.call(this,e)||this;return r.email="",r.email=e.email,r}return Dn(t,n),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(uo),O0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="",r.hashtag="",r.serviceName=e.serviceName,r.hashtag=e.hashtag,r}return Dn(t,n),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,r=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(uo),S0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.mention="",r.mention=e.mention,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var e=n.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&e.push(r),e},t}(uo),N0=function(n){function t(e){var r=n.call(this,e)||this;return r.number="",r.plusSign=!1,r.number=e.number,r.plusSign=e.plusSign,r}return Dn(t,n),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(uo),kd=function(n){function t(e){var r=n.call(this,e)||this;return r.url="",r.urlMatchType="scheme",r.protocolUrlMatch=!1,r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.schemePrefixRegex=/^(https?:\/\/)?/i,r.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,r.protocolRelativeRegex=/^\/\//,r.protocolPrepended=!1,r.urlMatchType=e.urlMatchType,r.url=e.url,r.protocolUrlMatch=e.protocolUrlMatch,r.protocolRelativeMatch=e.protocolRelativeMatch,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return Dn(t,n),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var r=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(r)}catch(i){return r}},t}(uo),co=function(n){this.__jsduckDummyDocProp=null,this.tagBuilder=n.tagBuilder},Ld=/[A-Za-z]/,AN=/[\d]/,vN=/[\D]/,hi=/\s/,xd=/['"]/,_N=/[\x00-\x1F\x7F]/,C0=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,b0=C0+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,sl=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,yN=b0+sl,Bt=b0+sl,TN="(?:["+sl+"]{1,3}\\.){3}["+sl+"]{1,3}",ON="["+Bt+"](?:["+Bt+"\\-]{0,61}["+Bt+"])?",I0=function(n){return"(?=("+ON+"))\\"+n},Md=function(n){return"(?:"+I0(n)+"(?:\\."+I0(n+1)+"){0,126}|"+TN+")"},al=new RegExp("["+Bt+"]"),w0=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,SN=new RegExp("["+Bt+"!#$%&'*+/=?^_`{|}~-]"),NN=new RegExp("^"+w0.source+"$"),R0=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.localPartCharRegex=SN,e.strictTldRegex=NN,e}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r=this.tagBuilder,i=this.localPartCharRegex,o=this.strictTldRegex,s=[],a=e.length,l=new ll,u={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,d=0,h=l;c<a;){var p=e.charAt(c);switch(d){case 0:f(p);break;case 1:m(e.charAt(c-1),p);break;case 2:g(p);break;case 3:E(p);break;case 4:A(p);break;case 5:v(p);break;case 6:_(p);break;case 7:O(p);break;default:_0(d)}c++}return N(),s;function f(y){y==="m"?T(1):i.test(y)&&T()}function m(y,I){y===":"?i.test(I)?(d=2,h=new ll(Lt(Lt({},h),{hasMailtoPrefix:!0}))):S():u[y]===I||(i.test(I)?d=2:I==="."?d=3:I==="@"?d=4:S())}function g(y){y==="."?d=3:y==="@"?d=4:i.test(y)||S()}function E(y){y==="."||y==="@"?S():i.test(y)?d=2:S()}function A(y){al.test(y)?d=5:S()}function v(y){y==="."?d=7:y==="-"?d=6:al.test(y)||N()}function _(y){y==="-"||y==="."?N():al.test(y)?d=5:N()}function O(y){y==="."||y==="-"?N():al.test(y)?(d=5,h=new ll(Lt(Lt({},h),{hasDomainDot:!0}))):N()}function T(y){y===void 0&&(y=2),d=y,h=new ll({idx:c})}function S(){d=0,h=l}function N(){if(h.hasDomainDot){var y=e.slice(h.idx,c);/[-.]$/.test(y)&&(y=y.slice(0,-1));var I=h.hasMailtoPrefix?y.slice(7):y;(function(R){var b=R.split(".").pop()||"",L=b.toLowerCase();return o.test(L)})(I)&&s.push(new Dd({tagBuilder:r,matchedText:y,offset:h.idx,email:I}))}S()}},t}(co),ll=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.hasMailtoPrefix=!!n.hasMailtoPrefix,this.hasDomainDot=!!n.hasDomainDot},CN=function(){function n(){}return n.isValid=function(t,e){return!(e&&!this.isValidUriScheme(e)||this.urlMatchDoesNotHaveProtocolOrDot(t,e)||this.urlMatchDoesNotHaveAtLeastOneWordChar(t,e)&&!this.isValidIpAddress(t)||this.containsMultipleDots(t))},n.isValidIpAddress=function(t){var e=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return t.match(e)!==null},n.containsMultipleDots=function(t){var e=t;return this.hasFullProtocolRegex.test(t)&&(e=t.split("://")[1]),e.split("/")[0].indexOf("..")>-1},n.isValidUriScheme=function(t){var e=t.match(this.uriSchemeRegex),r=e&&e[0].toLowerCase();return r!=="javascript:"&&r!=="vbscript:"},n.urlMatchDoesNotHaveProtocolOrDot=function(t,e){return!(!t||e&&this.hasFullProtocolRegex.test(e)||t.indexOf(".")!==-1)},n.urlMatchDoesNotHaveAtLeastOneWordChar=function(t,e){return!(!t||!e)&&!this.hasFullProtocolRegex.test(e)&&!this.hasWordCharAfterProtocolRegex.test(t)},n.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,n.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,n.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+C0+"]"),n.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,n}(),bN=(T0=new RegExp("[/?#](?:["+Bt+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Bt+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Md(2),")","|","(","(//)?",/(?:www\.)/.source,Md(6),")","|","(","(//)?",Md(10)+"\\.",w0.source,"(?![-"+yN+"])",")",")","(?::[0-9]+)?","(?:"+T0.source+")?"].join(""),"gi")),IN=new RegExp("["+Bt+"]"),D0=function(n){function t(e){var r=n.call(this,e)||this;return r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.matcherRegex=bN,r.wordCharRegExp=IN,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.stripPrefix,s=this.stripTrailingSlash,a=this.decodePercentEncoding,l=this.tagBuilder,u=[],c=function(){var h=r[0],p=r[1],f=r[4],m=r[5],g=r[9],E=r.index,A=m||g,v=e.charAt(E-1);if(!CN.isValid(h,p)||E>0&&v==="@"||E>0&&A&&d.wordCharRegExp.test(v))return"continue";if(/\?$/.test(h)&&(h=h.substr(0,h.length-1)),d.matchHasUnbalancedClosingParen(h))h=h.substr(0,h.length-1);else{var _=d.matchHasInvalidCharAfterTld(h,p);_>-1&&(h=h.substr(0,_))}var O=["http://","https://"].find(function(y){return!!p&&p.indexOf(y)!==-1});if(O){var T=h.indexOf(O);h=h.substr(T),p=p.substr(T),E+=T}var S=p?"scheme":f?"www":"tld",N=!!p;u.push(new kd({tagBuilder:l,matchedText:h,offset:E,urlMatchType:S,url:h,protocolUrlMatch:N,protocolRelativeMatch:!!A,stripPrefix:o,stripTrailingSlash:s,decodePercentEncoding:a}))},d=this;(r=i.exec(e))!==null;)c();return u},t.prototype.matchHasUnbalancedClosingParen=function(e){var r,i=e.charAt(e.length-1);if(i===")")r="(";else if(i==="]")r="[";else{if(i!=="}")return!1;r="{"}for(var o=0,s=0,a=e.length-1;s<a;s++){var l=e.charAt(s);l===r?o++:l===i&&(o=Math.max(o-1,0))}return o===0},t.prototype.matchHasInvalidCharAfterTld=function(e,r){if(!e)return-1;var i=0;r&&(i=e.indexOf(":"),e=e.slice(i));var o=new RegExp("^((.?//)?[-."+Bt+"]*[-"+Bt+"]\\.[-"+Bt+"]+)").exec(e);return o===null?-1:(i+=o[1].length,e=e.slice(o[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(co),wN=new RegExp("#[_"+Bt+"]{1,139}(?![_"+Bt+"])","g"),RN=new RegExp("[^"+Bt+"]"),k0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegex=wN,r.nonWordCharRegex=RN,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.nonWordCharRegex,s=this.serviceName,a=this.tagBuilder,l=[];(r=i.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||o.test(c)){var d=r[0],h=r[0].slice(1);l.push(new O0({tagBuilder:a,matchedText:d,offset:u,serviceName:s,hashtag:h}))}}return l},t}(co),DN=new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source+"|"+/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source,"g"),L0=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.matcherRegex=DN,e}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.tagBuilder,s=[];(r=i.exec(e))!==null;){var a=r[0],l=a.replace(/[^0-9,;#]/g,""),u=!(!r[1]&&!r[2]),c=r.index==0?"":e.substr(r.index-1,1),d=e.substr(r.index+a.length,1),h=!c.match(/\d/)&&!d.match(/\d/);this.testMatch(r[3])&&this.testMatch(a)&&h&&s.push(new N0({tagBuilder:o,matchedText:a,offset:r.index,number:l,plusSign:u}))}return s},t.prototype.testMatch=function(e){return vN.test(e)},t}(co),kN=new RegExp("@[_"+Bt+"]{1,50}(?![_"+Bt+"])","g"),LN=new RegExp("@[_."+Bt+"]{1,30}(?![_"+Bt+"])","g"),xN=new RegExp("@[-_."+Bt+"]{1,50}(?![-_"+Bt+"])","g"),MN=new RegExp("[^"+Bt+"]"),x0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegexes={twitter:kN,instagram:LN,soundcloud:xN},r.nonWordCharRegex=MN,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.parseMatches=function(e){var r,i=this.serviceName,o=this.matcherRegexes[this.serviceName],s=this.nonWordCharRegex,a=this.tagBuilder,l=[];if(!o)return l;for(;(r=o.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||s.test(c)){var d=r[0].replace(/\.+$/g,""),h=d.slice(1);l.push(new S0({tagBuilder:a,matchedText:d,offset:u,serviceName:i,mention:h}))}}return l},t}(co);function PN(n,t){for(var e,r=t.onOpenTag,i=t.onCloseTag,o=t.onText,s=t.onComment,a=t.onDoctype,l=new kn,u=0,c=n.length,d=0,h=0,p=l;u<c;){var f=n.charAt(u);switch(d){case 0:m(f);break;case 1:g(f);break;case 2:A(f);break;case 3:E(f);break;case 4:v(f);break;case 5:_(f);break;case 6:O(f);break;case 7:T(f);break;case 8:S(f);break;case 9:N(f);break;case 10:y(f);break;case 11:I(f);break;case 12:R(f);break;case 13:b();break;case 14:L(f);break;case 15:k(f);break;case 16:B(f);break;case 17:j(f);break;case 18:$(f);break;case 19:W(f);break;case 20:x(f);break;default:_0(d)}u++}function m(P){P==="<"&&H()}function g(P){P==="!"?d=13:P==="/"?(d=2,p=new kn(Lt(Lt({},p),{isClosing:!0}))):P==="<"?H():Ld.test(P)?(d=3,p=new kn(Lt(Lt({},p),{isOpening:!0}))):(d=0,p=l)}function E(P){hi.test(P)?(p=new kn(Lt(Lt({},p),{name:ot()})),d=4):P==="<"?H():P==="/"?(p=new kn(Lt(Lt({},p),{name:ot()})),d=12):P===">"?(p=new kn(Lt(Lt({},p),{name:ot()})),nt()):Ld.test(P)||AN.test(P)||P===":"||Q()}function A(P){P===">"?Q():Ld.test(P)?d=3:Q()}function v(P){hi.test(P)||(P==="/"?d=12:P===">"?nt():P==="<"?H():P==="="||xd.test(P)||_N.test(P)?Q():d=5)}function _(P){hi.test(P)?d=6:P==="/"?d=12:P==="="?d=7:P===">"?nt():P==="<"?H():xd.test(P)&&Q()}function O(P){hi.test(P)||(P==="/"?d=12:P==="="?d=7:P===">"?nt():P==="<"?H():xd.test(P)?Q():d=5)}function T(P){hi.test(P)||(P==='"'?d=8:P==="'"?d=9:/[>=`]/.test(P)?Q():P==="<"?H():d=10)}function S(P){P==='"'&&(d=11)}function N(P){P==="'"&&(d=11)}function y(P){hi.test(P)?d=4:P===">"?nt():P==="<"&&H()}function I(P){hi.test(P)?d=4:P==="/"?d=12:P===">"?nt():P==="<"?H():(d=4,u--)}function R(P){P===">"?(p=new kn(Lt(Lt({},p),{isClosing:!0})),nt()):d=4}function b(P){n.substr(u,2)==="--"?(u+=2,p=new kn(Lt(Lt({},p),{type:"comment"})),d=14):n.substr(u,7).toUpperCase()==="DOCTYPE"?(u+=7,p=new kn(Lt(Lt({},p),{type:"doctype"})),d=20):Q()}function L(P){P==="-"?d=15:P===">"?Q():d=16}function k(P){P==="-"?d=18:P===">"?Q():d=16}function B(P){P==="-"&&(d=17)}function j(P){d=P==="-"?18:16}function $(P){P===">"?nt():P==="!"?d=19:P==="-"||(d=16)}function W(P){P==="-"?d=17:P===">"?nt():d=16}function x(P){P===">"?nt():P==="<"&&H()}function Q(){d=0,p=l}function H(){d=1,p=new kn({idx:u})}function nt(){var P=n.slice(h,p.idx);P&&o(P,h),p.type==="comment"?s(p.idx):p.type==="doctype"?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),Q(),h=u+1}function ot(){var P=p.idx+(p.isClosing?2:1);return n.slice(P,u).toLowerCase()}h<u&&(e=n.slice(h,u),o(e,h),h=u+1)}var kn=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.type=n.type||"tag",this.name=n.name||"",this.isOpening=!!n.isOpening,this.isClosing=!!n.isClosing},BN=function(){function n(t){t===void 0&&(t={}),this.version=n.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email=typeof t.email=="boolean"?t.email:this.email,this.phone=typeof t.phone=="boolean"?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=typeof t.newWindow=="boolean"?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash=typeof t.stripTrailingSlash=="boolean"?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=typeof t.decodePercentEncoding=="boolean"?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var e=this.mention;if(e!==!1&&e!=="twitter"&&e!=="instagram"&&e!=="soundcloud")throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(r!==!1&&r!=="twitter"&&r!=="facebook"&&r!=="instagram")throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return n.link=function(t,e){return new n(e).link(t)},n.parse=function(t,e){return new n(e).parse(t)},n.prototype.normalizeUrlsCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:typeof t.schemeMatches!="boolean"||t.schemeMatches,wwwMatches:typeof t.wwwMatches!="boolean"||t.wwwMatches,tldMatches:typeof t.tldMatches!="boolean"||t.tldMatches}},n.prototype.normalizeStripPrefixCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{scheme:t,www:t}:{scheme:typeof t.scheme!="boolean"||t.scheme,www:typeof t.www!="boolean"||t.www}},n.prototype.normalizeTruncateCfg=function(t){return typeof t=="number"?{length:t,location:"end"}:function(e,r){for(var i in r)r.hasOwnProperty(i)&&e[i]===void 0&&(e[i]=r[i]);return e}(t||{},{length:Number.POSITIVE_INFINITY,location:"end"})},n.prototype.parse=function(t){var e=this,r=["a","style","script"],i=0,o=[];return PN(t,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=function(c,d){if(!d.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var h,p=[],f=0;h=d.exec(c);)p.push(c.substring(f,h.index)),p.push(h[0]),f=h.index+h[0].length;return p.push(c.substring(f)),p}(s,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),u=a;l.forEach(function(c,d){if(d%2==0){var h=e.parseText(c,u);o.push.apply(o,h)}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(s){},onDoctype:function(s){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},n.prototype.compactMatches=function(t){t.sort(function(l,u){return l.getOffset()-u.getOffset()});for(var e=0;e<t.length-1;e++){var r=t[e],i=r.getOffset(),o=r.getMatchedText().length,s=i+o;if(e+1<t.length){if(t[e+1].getOffset()===i){var a=t[e+1].getMatchedText().length>o?e:e+1;t.splice(a,1);continue}t[e+1].getOffset()<s&&t.splice(e+1,1)}}return t},n.prototype.removeUnwantedMatches=function(t){return this.hashtag||di(t,function(e){return e.getType()==="hashtag"}),this.email||di(t,function(e){return e.getType()==="email"}),this.phone||di(t,function(e){return e.getType()==="phone"}),this.mention||di(t,function(e){return e.getType()==="mention"}),this.urls.schemeMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="scheme"}),this.urls.wwwMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="www"}),this.urls.tldMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="tld"}),t},n.prototype.parseText=function(t,e){e===void 0&&(e=0),e=e||0;for(var r=this.getMatchers(),i=[],o=0,s=r.length;o<s;o++){for(var a=r[o].parseMatches(t),l=0,u=a.length;l<u;l++)a[l].setOffset(e+a[l].getOffset());i.push.apply(i,a)}return i},n.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),r=[],i=0,o=0,s=e.length;o<s;o++){var a=e[o];r.push(t.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(t.substring(i)),r.join("")},n.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),typeof e=="string"?e:e===!1?t.getMatchedText():e instanceof wd?e.toAnchorString():t.buildTag().toAnchorString()},n.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var t=this.getTagBuilder(),e=[new k0({tagBuilder:t,serviceName:this.hashtag}),new R0({tagBuilder:t}),new L0({tagBuilder:t}),new x0({tagBuilder:t,serviceName:this.mention}),new D0({tagBuilder:t,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=e},n.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new y0({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},n.version="3.14.3",n.AnchorTagBuilder=y0,n.HtmlTag=wd,n.matcher={Email:R0,Hashtag:k0,Matcher:co,Mention:x0,Phone:L0,Url:D0},n.match={Email:Dd,Hashtag:O0,Match:uo,Mention:S0,Phone:N0,Url:kd},n}();function M0(n,t=n){return{type:"autolink",url:n,text:t}}const FN=ir(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([n,t,e])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(t),e)),UN=ir(/<!!customemoji:(.*?)>/gm,([n,t])=>function(e){return{type:"customemoji",text:e}}(t)),P0=ir(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([n,t,e])=>function(r,i=[]){return{type:"link",url:r,children:i}}(t,[e])),HN=ir(/<actionlink:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=B0(t);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[e])}),$N=ir(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=B0(t);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[e])});function B0(n){const t=n.indexOf("?");return t===-1?{action:n,params:{}}:{action:n.slice(0,t),params:Object.fromEntries(new URLSearchParams(n.slice(t)))}}const jN=ir(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([n])=>function(t=[]){return{type:"bulletlist",children:t}}([n.startsWith(`
80
+ `);return{dom:l,text:h}}function dE(n,t,e,r,i){let o,s,a=i.parent.type.spec.code;if(!e&&!t)return null;let l=t&&(r||a||!e);if(l){if(n.someProp("transformPastedText",h=>{t=h(t,a||r,n)}),a)return t?new W(K.from(n.state.schema.text(t.replace(/\r\n?/g,`
81
+ `))),0,0):W.empty;let d=n.someProp("clipboardTextParser",h=>h(t,i,r,n));if(d)s=d;else{let h=i.marks(),{schema:p}=n.state,f=Zn.fromSchema(p);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(f.serializeNode(p.text(m,h)))})}}else n.someProp("transformPastedHTML",d=>{e=d(e,n)}),o=function(d){let h=/^(\s*<meta [^>]*>)*/.exec(d);h&&(d=d.slice(h[0].length));let p,f=AE().createElement("div"),m=/<([a-z][^>\s]+)/i.exec(d);if((p=m&&gE[m[1].toLowerCase()])&&(d=p.map(g=>"<"+g+">").join("")+d+p.map(g=>"</"+g+">").reverse().join("")),f.innerHTML=d,p)for(let g=0;g<p.length;g++)f=f.querySelector(p[g])||f;return f}(e),_s&&function(d){let h=d.querySelectorAll(me?"span:not([class]):not([style])":"span.Apple-converted-space");for(let p=0;p<h.length;p++){let f=h[p];f.childNodes.length==1&&f.textContent==" "&&f.parentNode&&f.parentNode.replaceChild(d.ownerDocument.createTextNode(" "),f)}}(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(s||(s=(n.someProp("clipboardParser")||n.someProp("domParser")||ps.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!(!l&&!c),context:i,ruleFromNode:h=>h.nodeName!="BR"||h.nextSibling||!h.parentNode||L1.test(h.parentNode.nodeName)?null:{ignore:!0}})),c)s=function(d,h){if(!d.size)return d;let p,f=d.content.firstChild.type.schema;try{p=JSON.parse(h)}catch(A){return d}let{content:m,openStart:g,openEnd:E}=d;for(let A=p.length-2;A>=0;A-=2){let v=f.nodes[p[A]];if(!v||v.hasRequiredAttrs())break;m=K.from(v.create(p[A+1],m)),g++,E++}return new W(m,g,E)}(mE(s,+c[1],+c[2]),c[4]);else if(s=W.maxOpen(function(d,h){if(d.childCount<2)return d;for(let p=h.depth;p>=0;p--){let f,m=h.node(p).contentMatchAt(h.index(p)),g=[];if(d.forEach(E=>{if(!g)return;let A,v=m.findWrapping(E.type);if(!v)return g=null;if(A=g.length&&f.length&&pE(v,f,E,g[g.length-1],0))g[g.length-1]=A;else{g.length&&(g[g.length-1]=fE(g[g.length-1],f.length));let _=hE(E,v);g.push(_),m=m.matchType(_.type),f=v}}),g)return K.from(g)}return d}(s.content,i),!0),s.openStart||s.openEnd){let d=0,h=0;for(let p=s.content.firstChild;d<s.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=s.content.lastChild;h<s.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);s=mE(s,d,h)}return n.someProp("transformPasted",d=>{s=d(s,n)}),s}const L1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function hE(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,K.from(n));return n}function pE(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let o=pE(n,t,e,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?e.type:n[i+1]))return r.copy(r.content.append(K.from(hE(e,n,i+1))))}}function fE(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,fE(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(K.empty,!0);return n.copy(e.append(r))}function ed(n,t,e,r,i,o){let s=t<0?n.firstChild:n.lastChild,a=s.content;return n.childCount>1&&(o=0),i<r-1&&(a=ed(a,t,e,r,i+1,o)),i>=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(K.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function mE(n,t,e){return t<n.openStart&&(n=new W(ed(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new W(ed(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}const gE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let EE=null;function AE(){return EE||(EE=document.implementation.createHTMLDocument("title"))}const Se={},Ne={},x1={touchstart:!0,touchmove:!0};class M1{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Sr(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function nd(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>rd(n,r))})}function rd(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return!!r&&(r(n,t)||t.defaultPrevented)})}function P1(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function Xa(n){return{left:n.clientX,top:n.clientY}}function id(n,t,e,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(t,a=>s>o.depth?a(n,e,o.nodeAfter,o.before(s),i,!0):a(n,e,o.node(s),o.before(s),i,!1)))return!0;return!1}function ao(n,t,e){n.focused||n.focus();let r=n.state.tr.setSelection(t);r.setMeta("pointer",!0),n.dispatch(r)}function B1(n,t,e,r,i){return id(n,"handleClickOn",t,e,r)||n.someProp("handleClick",o=>o(n,t,r))||(i?function(o,s){if(s==-1)return!1;let a,l,u=o.state.selection;u instanceof st&&(a=u.node);let c=o.state.doc.resolve(s);for(let d=c.depth+1;d>0;d--){let h=d>c.depth?c.nodeAfter:c.node(d);if(st.isSelectable(h)){l=a&&u.$from.depth>0&&d>=u.$from.depth&&c.before(u.$from.depth+1)==u.$from.pos?c.before(u.$from.depth):c.before(d);break}}return l!=null&&(ao(o,st.create(o.state.doc,l)),!0)}(n,e):function(o,s){if(s==-1)return!1;let a=o.state.doc.resolve(s),l=a.nodeAfter;return!!(l&&l.isAtom&&st.isSelectable(l))&&(ao(o,new st(a)),!0)}(n,e))}function F1(n,t,e,r){return id(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function U1(n,t,e,r){return id(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||function(i,o,s){if(s.button!=0)return!1;let a=i.state.doc;if(o==-1)return!!a.inlineContent&&(ao(i,vt.create(a,0,a.content.size)),!0);let l=a.resolve(o);for(let u=l.depth+1;u>0;u--){let c=u>l.depth?l.nodeAfter:l.node(u),d=l.before(u);if(c.inlineContent)ao(i,vt.create(a,d+1,d+1+c.content.size));else{if(!st.isSelectable(c))continue;ao(i,st.create(a,d))}return!0}}(n,e,r)}function od(n){return Ka(n)}Ne.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!_E(n,e)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!pn||!me||e.keyCode!=13))if(e.keyCode!=229&&n.domObserver.forceFlush(),!io||e.keyCode!=13||e.ctrlKey||e.altKey||e.metaKey)n.someProp("handleKeyDown",r=>r(n,e))||k1(n,e)?e.preventDefault():Sr(n,"key");else{let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,ei(13,"Enter"))),n.input.lastIOSEnter=0)},200)}},Ne.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)},Ne.keypress=(n,t)=>{let e=t;if(_E(n,e)||!e.charCode||e.ctrlKey&&!e.altKey||on&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e)))return void e.preventDefault();let r=n.state.selection;if(!(r instanceof vt&&r.$from.sameParent(r.$to))){let i=String.fromCharCode(e.charCode);/[\r\n]/.test(i)||n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),e.preventDefault()}};const vE=on?"metaKey":"ctrlKey";Se.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=od(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&function(a,l){let u=l.x-a.clientX,c=l.y-a.clientY;return u*u+c*c<100}(e,n.input.lastClick)&&!e[vE]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:e.clientX,y:e.clientY,type:o};let s=n.posAtCoords(Xa(e));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new H1(n,s,e,!!r)):(o=="doubleClick"?F1:U1)(n,s.pos,s.inside,e)?e.preventDefault():Sr(n,"pointer"))};class H1{constructor(t,e,r,i){let o,s;if(this.view=t,this.pos=e,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[vE],this.allowDefault=r.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),s=e.inside;else{let c=t.state.doc.resolve(e.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:u}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof st&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!hn||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Sr(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>nr(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Xa(t))),this.updateAllowDefault(t),this.allowDefault||!e?Sr(this.view,"pointer"):B1(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Oe&&this.mightDrag&&!this.mightDrag.node.isAtom||me&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ao(this.view,mt.near(this.view.state.doc.resolve(e.pos))),t.preventDefault()):Sr(this.view,"pointer")}move(t){this.updateAllowDefault(t),Sr(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function _E(n,t){return!!n.composing||!!(Oe&&Math.abs(t.timeStamp-n.input.compositionEndedAt)<500)&&(n.input.compositionEndedAt=-2e8,!0)}Se.touchstart=n=>{n.input.lastTouch=Date.now(),od(n),Sr(n,"pointer")},Se.touchmove=n=>{n.input.lastTouch=Date.now(),Sr(n,"pointer")},Se.contextmenu=n=>od(n);const $1=pn?5e3:-1;function yE(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Ka(n),t))}function TE(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ka(n,t=!1){if(!(pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),TE(n),t||n.docView&&n.docView.dirty){let e=qc(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}}Ne.compositionstart=Ne.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||e.marks(),Ka(n,!0),n.markCursor=null;else if(Ka(n),hn&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){n.domSelection().collapse(s,s.nodeValue.length);break}i=s,o=-1}}n.input.composing=!0}yE(n,$1)},Ne.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,yE(n,20))};const Ns=Le&&_r<15||io&&_1<604;function Cs(n,t,e,r,i){let o=dE(n,t,e,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,o||W.empty)))return!0;if(!o)return!1;let s=function(l){return l.openStart==0&&l.openEnd==0&&l.content.childCount==1?l.content.firstChild:null}(o),a=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function OE(n){let t=n.getData("text/plain")||n.getData("Text");if(t)return t;let e=n.getData("text/uri-list");return e?e.replace(/\r?\n/g," "):""}Se.copy=Ne.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let o=Ns?null:e.clipboardData,s=r.content(),{dom:a,text:l}=cE(n,s);o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function(u,c){if(!u.dom.parentNode)return;let d=u.dom.parentNode.appendChild(document.createElement("div"));d.appendChild(c),d.style.cssText="position: fixed; left: -10000px; top: 10px";let h=getSelection(),p=document.createRange();p.selectNodeContents(c),u.dom.blur(),h.removeAllRanges(),h.addRange(p),setTimeout(()=>{d.parentNode&&d.parentNode.removeChild(d),u.focus()},50)}(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ne.paste=(n,t)=>{let e=t;if(n.composing&&!pn)return;let r=Ns?null:e.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Cs(n,OE(r),r.getData("text/html"),i,e)?e.preventDefault():function(o,s){if(!o.dom.parentNode)return;let a=o.input.shiftKey||o.state.selection.$from.parent.type.spec.code,l=o.dom.parentNode.appendChild(document.createElement(a?"textarea":"div"));a||(l.contentEditable="true"),l.style.cssText="position: fixed; left: -10000px; top: 10px",l.focus();let u=o.input.shiftKey&&o.input.lastKeyCode!=45;setTimeout(()=>{o.focus(),l.parentNode&&l.parentNode.removeChild(l),a?Cs(o,l.value,null,u,s):Cs(o,l.textContent,l.innerHTML,u,s)},50)}(n,e)};class SE{constructor(t,e,r){this.slice=t,this.move=e,this.node=r}}const NE=on?"altKey":"ctrlKey";Se.dragstart=(n,t)=>{let e=t,r=n.input.mouseDown;if(r&&r.done(),!e.dataTransfer)return;let i,o=n.state.selection,s=o.empty?null:n.posAtCoords(Xa(e));if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof st?o.to-1:o.to))){if(r&&r.mightDrag)i=st.create(n.state.doc,r.mightDrag.pos);else if(e.target&&e.target.nodeType==1){let c=n.docView.nearestDesc(e.target,!0);c&&c.node.type.spec.draggable&&c!=n.docView&&(i=st.create(n.state.doc,c.posBefore))}}let a=(i||n.state.selection).content(),{dom:l,text:u}=cE(n,a);e.dataTransfer.clearData(),e.dataTransfer.setData(Ns?"Text":"text/html",l.innerHTML),e.dataTransfer.effectAllowed="copyMove",Ns||e.dataTransfer.setData("text/plain",u),n.dragging=new SE(a,!e[NE],i)},Se.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)},Ne.dragover=Ne.dragenter=(n,t)=>t.preventDefault(),Ne.drop=(n,t)=>{let e=t,r=n.dragging;if(n.dragging=null,!e.dataTransfer)return;let i=n.posAtCoords(Xa(e));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",f=>{s=f(s,n)}):s=dE(n,OE(e.dataTransfer),Ns?null:e.dataTransfer.getData("text/html"),!1,o);let a=!(!r||e[NE]);if(n.someProp("handleDrop",f=>f(n,e,s||W.empty,a)))return void e.preventDefault();if(!s)return;e.preventDefault();let l=s?function(f,m,g){let E=f.resolve(m);if(!g.content.size)return m;let A=g.content;for(let v=0;v<g.openStart;v++)A=A.firstChild.content;for(let v=1;v<=(g.openStart==0&&g.size?2:1);v++)for(let _=E.depth;_>=0;_--){let O=_==E.depth?0:E.pos<=(E.start(_+1)+E.end(_+1))/2?-1:1,T=E.index(_)+(O>0?1:0),S=E.node(_),N=!1;if(v==1)N=S.canReplace(T,T,A);else{let y=S.contentMatchAt(T).findWrapping(A.firstChild.type);N=y&&S.canReplaceWith(T,T,y[0])}if(N)return O==0?E.pos:O<0?E.before(_+1):E.after(_+1)}return null}(n.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let u=n.state.tr;if(a){let{node:f}=r;f?f.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=u.doc;if(d?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(h))return;let p=u.doc.resolve(c);if(d&&st.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new st(p));else{let f=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,E,A)=>f=A),u.setSelection(Zc(n,p,u.doc.resolve(f)))}n.focus(),n.dispatch(u.setMeta("uiEvent","drop"))},Se.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&nr(n)},20))},Se.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},Se.beforeinput=(n,t)=>{if(me&&pn&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:e}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=e||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,ei(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in Ne)Se[n]=Ne[n];function bs(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class qa{constructor(t,e){this.toDOM=t,this.spec=e||ii,this.side=this.spec.side||0}map(t,e,r,i){let{pos:o,deleted:s}=t.mapResult(e.from+i,this.side<0?-1:1);return s?null:new Ye(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof qa&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&bs(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Nr{constructor(t,e){this.attrs=t,this.spec=e||ii}map(t,e,r,i){let o=t.map(e.from+i,this.spec.inclusiveStart?-1:1)-r,s=t.map(e.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ye(o,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Nr&&bs(this.attrs,t.attrs)&&bs(this.spec,t.spec)}static is(t){return t.type instanceof Nr}destroy(){}}class sd{constructor(t,e){this.attrs=t,this.spec=e||ii}map(t,e,r,i){let o=t.mapResult(e.from+i,1);if(o.deleted)return null;let s=t.mapResult(e.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ye(o.pos-r,s.pos-r,this)}valid(t,e){let r,{index:i,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(r=t.child(i)).isText&&o+r.nodeSize==e.to}eq(t){return this==t||t instanceof sd&&bs(this.attrs,t.attrs)&&bs(this.spec,t.spec)}destroy(){}}class Ye{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new Ye(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new Ye(t,t,new qa(e,r))}static inline(t,e,r,i){return new Ye(t,e,new Nr(r,i))}static node(t,e,r,i){return new Ye(t,e,new sd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Nr}get widget(){return this.type instanceof qa}}const lo=[],ii={};class Wt{constructor(t,e){this.local=t.length?t:lo,this.children=e.length?e:lo}static create(t,e){return e.length?Ja(e,t,0,ii):ge}find(t,e,r){let i=[];return this.findInner(t==null?0:t,e==null?1e9:e,i,0,r),i}findInner(t,e,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=e&&a.to>=t&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,e-a,r,i+a,o)}}map(t,e,r){return this==ge||t.maps.length==0?this:this.mapInner(t,e,0,0,r||ii)}mapInner(t,e,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,i);l&&l.type.valid(e,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?function(a,l,u,c,d,h,p){let f=a.slice();for(let g=0,E=h;g<u.maps.length;g++){let A=0;u.maps[g].forEach((v,_,O,T)=>{let S=T-O-(_-v);for(let N=0;N<f.length;N+=3){let y=f[N+1];if(y<0||v>y+E-A)continue;let w=f[N]+E-A;_>=w?f[N+1]=v<=w?-2:-1:v>=E&&S&&(f[N]+=S,f[N+1]+=S)}A+=S}),E=u.maps[g].map(E,-1)}let m=!1;for(let g=0;g<f.length;g+=3)if(f[g+1]<0){if(f[g+1]==-2){m=!0,f[g+1]=-1;continue}let E=u.map(a[g]+h),A=E-d;if(A<0||A>=c.content.size){m=!0;continue}let v=u.map(a[g+1]+h,-1)-d,{index:_,offset:O}=c.content.findIndex(A),T=c.maybeChild(_);if(T&&O==A&&O+T.nodeSize==v){let S=f[g+2].mapInner(u,T,E+1,a[g]+h+1,p);S!=ge?(f[g]=A,f[g+1]=v,f[g+2]=S):(f[g+1]=-2,m=!0)}else m=!0}if(m){let g=function(A,v,_,O,T,S,N){function y(w,b){for(let I=0;I<w.local.length;I++){let P=w.local[I].map(O,T,b);P?_.push(P):N.onRemove&&N.onRemove(w.local[I].spec)}for(let I=0;I<w.children.length;I+=3)y(w.children[I+2],w.children[I]+b+1)}for(let w=0;w<A.length;w+=3)A[w+1]==-1&&y(A[w+2],v[w]+S+1);return _}(f,a,l,u,d,h,p),E=Ja(g,c,0,p);l=E.local;for(let A=0;A<f.length;A+=3)f[A+1]<0&&(f.splice(A,3),A-=3);for(let A=0,v=0;A<E.children.length;A+=3){let _=E.children[A];for(;v<f.length&&f[v]<_;)v+=3;f.splice(v,0,E.children[A],E.children[A+1],E.children[A+2])}}return new Wt(l.sort(oi),f)}(this.children,s||[],t,e,r,i,o):s?new Wt(s.sort(oi),lo):ge}add(t,e){return e.length?this==ge?Wt.create(t,e):this.addInner(t,e,0):this}addInner(t,e,r){let i,o=0;t.forEach((a,l)=>{let u,c=l+r;if(u=bE(e,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,Ja(u,a,c+1,ii)),o+=3}});let s=CE(o?IE(e):e,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new Wt(s.length?this.local.concat(s).sort(oi):this.local,i||this.children)}remove(t){return t.length==0||this==ge?this:this.removeInner(t,0)}removeInner(t,e){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+e,l=r[o+1]+e;for(let c,d=0;d<t.length;d++)(c=t[d])&&c.from>a&&c.to<l&&(t[d]=null,(s||(s=[])).push(c));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=ge?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o,s=0;s<t.length;s++)if(o=t[s])for(let a=0;a<i.length;a++)i[a].eq(o,e)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Wt(i,r):ge}forChild(t,e){if(this==ge)return this;if(e.isLeaf)return Wt.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let o=t+1,s=o+e.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof Nr){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Wt(i.sort(oi),lo);return r?new Cr([a,r]):a}return r||ge}eq(t){if(this==t)return!0;if(!(t instanceof Wt)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return ad(this.localsInner(t))}localsInner(t){if(this==ge)return lo;if(t.inlineContent||!this.local.some(Nr.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Nr||e.push(this.local[r]);return e}}Wt.empty=new Wt([],[]),Wt.removeOverlap=ad;const ge=Wt.empty;class Cr{constructor(t){this.members=t}map(t,e){const r=this.members.map(i=>i.map(t,e,ii));return Cr.from(r)}forChild(t,e){if(e.isLeaf)return Wt.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,e);o!=ge&&(o instanceof Cr?r=r.concat(o.members):r.push(o))}return Cr.from(r)}eq(t){if(!(t instanceof Cr)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(e){r&&(e=e.slice(),r=!1);for(let s=0;s<o.length;s++)e.push(o[s])}else e=o}return e?ad(r?e:e.sort(oi)):lo}static from(t){switch(t.length){case 0:return ge;case 1:return t[0];default:return new Cr(t.every(e=>e instanceof Wt)?t:t.reduce((e,r)=>e.concat(r instanceof Wt?r:r.members),[]))}}}function CE(n,t){if(!t||!n.length)return n;let e=[];for(let r=0;r<n.length;r++){let i=n[r];e.push(new Ye(i.from+t,i.to+t,i.type))}return e}function bE(n,t,e){if(t.isLeaf)return null;let r=e+t.nodeSize,i=null;for(let o,s=0;s<n.length;s++)(o=n[s])&&o.from>e&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function IE(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Ja(n,t,e,r){let i=[],o=!1;t.forEach((a,l)=>{let u=bE(n,a,l+e);if(u){o=!0;let c=Ja(u,a,e+l+1,r);c!=ge&&i.push(l,l+a.nodeSize,c)}});let s=CE(o?IE(n):n,-e).sort(oi);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new Wt(s,i):ge}function oi(n,t){return n.from-t.from||n.to-t.to}function ad(n){let t=n;for(let e=0;e<t.length-1;e++){let r=t[e];if(r.from!=r.to)for(let i=e+1;i<t.length;i++){let o=t[i];if(o.from!=r.from){o.from<r.to&&(t==n&&(t=n.slice()),t[e]=r.copy(r.from,o.from),wE(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==n&&(t=n.slice()),t[i]=o.copy(o.from,r.to),wE(t,i+1,o.copy(r.to,o.to)))}}return t}function wE(n,t,e){for(;t<n.length&&oi(e,n[t])>0;)t++;n.splice(t,0,e)}function ld(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=ge&&t.push(r)}),n.cursorWrapper&&t.push(Wt.create(n.state.doc,[n.cursorWrapper.deco])),Cr.from(t)}const j1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Y1=Le&&_r<=11;class z1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class V1{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new z1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Le&&_r<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Y1&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,j1)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nE(this.view)){if(this.suppressingSelectionUpdates)return nr(this.view);if(Le&&_r<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ti(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,r=new Set;for(let o=t.focusNode;o;o=vs(o))r.add(o);for(let o=t.anchorNode;o;o=vs(o))if(r.has(o)){e=o;break}let i=e&&this.view.docView.nearestDesc(e);return i&&i.ignoreMutation({type:"selection",target:e.nodeType==3?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nE(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let c=0;c<e.length;c++){let d=this.registerMutation(e[c],l);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(hn&&l.length>1){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let d=c[0],h=c[1];d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}}let u=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Va(r)&&(u=qc(t))&&u.eq(mt.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nr(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),function(c){if(!RE.has(c)&&(RE.set(c,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(c.dom).whiteSpace)!==-1)){if(c.requiresGeckoHackNode=hn,DE)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),DE=!0}}(t)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nr(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++)e.push(t.addedNodes[u]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,o=t.nextSibling;if(Le&&_r<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:c,nextSibling:d}=t.addedNodes[u];(!c||Array.prototype.indexOf.call(t.addedNodes,c)<0)&&(i=c),(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d)}let s=i&&i.parentNode==t.target?Te(i)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=o&&o.parentNode==t.target?Te(o):t.target.childNodes.length;return{from:a,to:r.localPosFromDOM(t.target,l,1)}}return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let RE=new WeakMap,DE=!1;function W1(n){let t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Oe&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(n.parentNode.lastChild==n||Oe&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const G1=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function X1(n,t,e,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,t<0){let y=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,w=qc(n,y);if(w&&!n.state.selection.eq(w)){if(me&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",I=>I(n,ei(13,"Enter"))))return;let b=n.state.tr.setSelection(w);y=="pointer"?b.setMeta("pointer",!0):y=="key"&&b.scrollIntoView(),o&&b.setMeta("composition",o),n.dispatch(b)}return}let s=n.state.doc.resolve(t),a=s.sharedDepth(e);t=s.before(a+1),e=n.state.doc.resolve(e).after(a+1);let l,u,c=n.state.selection,d=function(y,w,b){let I,{node:P,fromOffset:k,toOffset:B,from:$,to:U}=y.docView.parseRange(w,b),V=y.domSelectionRange(),L=V.anchorNode;if(L&&y.dom.contains(L.nodeType==1?L:L.parentNode)&&(I=[{node:L,offset:V.anchorOffset}],Va(V)||I.push({node:V.focusNode,offset:V.focusOffset})),me&&y.input.lastKeyCode===8)for(let q=B;q>k;q--){let ot=P.childNodes[q-1],ut=ot.pmViewDesc;if(ot.nodeName=="BR"&&!ut){B=q;break}if(!ut||ut.size)break}let Q=y.state.doc,j=y.someProp("domParser")||ps.fromSchema(y.state.schema),tt=Q.resolve($),it=null,x=j.parse(P,{topNode:tt.parent,topMatch:tt.parent.contentMatchAt(tt.index()),topOpen:!0,from:k,to:B,preserveWhitespace:tt.parent.type.whitespace!="pre"||"full",findPositions:I,ruleFromNode:W1,context:tt});if(I&&I[0].pos!=null){let q=I[0].pos,ot=I[1]&&I[1].pos;ot==null&&(ot=q),it={anchor:q+$,head:ot+$}}return{doc:x,sel:it,from:$,to:U}}(n,t,e),h=n.state.doc,p=h.slice(d.from,d.to);n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(l=n.state.selection.to,u="end"):(l=n.state.selection.from,u="start"),n.input.lastKeyCode=null;let f=function(y,w,b,I,P){let k=y.findDiffStart(w,b);if(k==null)return null;let{a:B,b:$}=y.findDiffEnd(w,b+y.size,b+w.size);if(P=="end"&&(I-=B+Math.max(0,k-Math.min(B,$))-k),B<k&&y.size<w.size){let U=I<=k&&I>=B?k-I:0;k-=U,k&&k<w.size&&LE(w.textBetween(k-1,k+1))&&(k+=U?1:-1),$=k+($-B),B=k}else if($<k){let U=I<=k&&I>=$?k-I:0;k-=U,k&&k<y.size&&LE(y.textBetween(k-1,k+1))&&(k+=U?1:-1),B=k+(B-$),$=k}return{start:k,endA:B,endB:$}}(p.content,d.doc.content,d.from,l,u);if((io&&n.input.lastIOSEnter>Date.now()-225||pn)&&i.some(y=>y.nodeType==1&&!G1.test(y.nodeName))&&(!f||f.endA>=f.endB)&&n.someProp("handleKeyDown",y=>y(n,ei(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof vt&&!c.empty&&c.$head.sameParent(c.$anchor))||n.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let y=kE(n,n.state.doc,d.sel);if(y&&!y.eq(n.state.selection)){let w=n.state.tr.setSelection(y);o&&w.setMeta("composition",o),n.dispatch(w)}}return}f={start:c.from,endA:c.to,endB:c.to}}if(me&&n.cursorWrapper&&d.sel&&d.sel.anchor==n.cursorWrapper.deco.from&&d.sel.head==d.sel.anchor){let y=f.endB-f.start;d.sel={anchor:d.sel.anchor+y,head:d.sel.anchor+y}}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&f.start==f.endB&&n.state.selection instanceof vt&&(f.start>n.state.selection.from&&f.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?f.start=n.state.selection.from:f.endA<n.state.selection.to&&f.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(f.endB+=n.state.selection.to-f.endA,f.endA=n.state.selection.to)),Le&&_r<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>d.from&&d.doc.textBetween(f.start-d.from-1,f.start-d.from+1)=="  "&&(f.start--,f.endA--,f.endB--);let m,g=d.doc.resolveNoCache(f.start-d.from),E=d.doc.resolveNoCache(f.endB-d.from),A=h.resolve(f.start),v=g.sameParent(E)&&g.parent.inlineContent&&A.end()>=f.endA;if((io&&n.input.lastIOSEnter>Date.now()-225&&(!v||i.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&g.pos<d.doc.content.size&&!g.sameParent(E)&&(m=mt.findFrom(d.doc.resolve(g.pos+1),1,!0))&&m.head==E.pos)&&n.someProp("handleKeyDown",y=>y(n,ei(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(n.state.selection.anchor>f.start&&function(y,w,b,I,P){if(!I.parent.isTextblock||b-w<=P.pos-I.pos||ud(I,!0,!1)<P.pos)return!1;let k=y.resolve(w);if(k.parentOffset<k.parent.content.size||!k.parent.isTextblock)return!1;let B=y.resolve(ud(k,!0,!0));return!(!B.parent.isTextblock||B.pos>b||ud(B,!0,!1)<b)&&I.parent.content.cut(I.parentOffset).eq(B.parent.content)}(h,f.start,f.endA,g,E)&&n.someProp("handleKeyDown",y=>y(n,ei(8,"Backspace"))))return void(pn&&me&&n.domObserver.suppressSelectionUpdates());me&&pn&&f.endB==f.start&&(n.input.lastAndroidDelete=Date.now()),pn&&!v&&g.start()!=E.start()&&E.parentOffset==0&&g.depth==E.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==f.endA&&(f.endB-=2,E=d.doc.resolveNoCache(f.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(y){return y(n,ei(13,"Enter"))})},20));let _,O,T,S=f.start,N=f.endA;if(v){if(g.pos==E.pos)Le&&_r<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>nr(n),20)),_=n.state.tr.delete(S,N),O=h.resolve(f.start).marksAcross(h.resolve(f.endA));else if(f.endA==f.endB&&(T=function(y,w){let b,I,P,k=y.firstChild.marks,B=w.firstChild.marks,$=k,U=B;for(let L=0;L<B.length;L++)$=B[L].removeFromSet($);for(let L=0;L<k.length;L++)U=k[L].removeFromSet(U);if($.length==1&&U.length==0)I=$[0],b="add",P=L=>L.mark(I.addToSet(L.marks));else{if($.length!=0||U.length!=1)return null;I=U[0],b="remove",P=L=>L.mark(I.removeFromSet(L.marks))}let V=[];for(let L=0;L<w.childCount;L++)V.push(P(w.child(L)));if(K.from(V).eq(y))return{mark:I,type:b}}(g.parent.content.cut(g.parentOffset,E.parentOffset),A.parent.content.cut(A.parentOffset,f.endA-A.start()))))_=n.state.tr,T.type=="add"?_.addMark(S,N,T.mark):_.removeMark(S,N,T.mark);else if(g.parent.child(g.index()).isText&&g.index()==E.index()-(E.textOffset?0:1)){let y=g.parent.textBetween(g.parentOffset,E.parentOffset);if(n.someProp("handleTextInput",w=>w(n,S,N,y)))return;_=n.state.tr.insertText(y,S,N)}}if(_||(_=n.state.tr.replace(S,N,d.doc.slice(f.start-d.from,f.endB-d.from))),d.sel){let y=kE(n,_.doc,d.sel);y&&!(me&&pn&&n.composing&&y.empty&&(f.start!=f.endB||n.input.lastAndroidDelete<Date.now()-100)&&(y.head==S||y.head==_.mapping.map(N)-1)||Le&&y.empty&&y.head==S)&&_.setSelection(y)}O&&_.ensureMarks(O),o&&_.setMeta("composition",o),n.dispatch(_.scrollIntoView())}function kE(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:Zc(n,t.resolve(e.anchor),t.resolve(e.head))}function ud(n,t,e){let r=n.depth,i=t?n.end():n.pos;for(;r>0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,i++,t=!1;if(e){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function LE(n){if(n.length!=2)return!1;let t=n.charCodeAt(0),e=n.charCodeAt(1);return t>=56320&&t<=57343&&e>=55296&&e<=56319}class K1{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new M1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(FE),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=PE(this),ME(this),this.nodeViews=BE(this),this.docView=zg(this.state.doc,xE(this),ld(this),this.dom,this),this.domObserver=new V1(this,(r,i,o,s)=>X1(this,r,i,o,s)),this.domObserver.start(),function(r){for(let i in Se){let o=Se[i];r.dom.addEventListener(i,r.input.eventHandlers[i]=s=>{!P1(r,s)||rd(r,s)||!r.editable&&s.type in Ne||o(r,s)},x1[i]?{passive:!0}:void 0)}Oe&&r.dom.addEventListener("input",()=>null),nd(r)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&nd(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(FE),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let r in this._props)e[r]=this._props[r];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var r;let i=this.state,o=!1,s=!1;t.storedMarks&&this.composing&&(TE(this),s=!0),this.state=t;let a=i.plugins!=t.plugins||this._props.plugins!=e.plugins;if(a||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let p=BE(this);(function(f,m){let g=0,E=0;for(let A in f){if(f[A]!=m[A])return!0;g++}for(let A in m)E++;return g!=E})(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||e.handleDOMEvents!=this._props.handleDOMEvents)&&nd(this),this.editable=PE(this),ME(this);let l=ld(this),u=xE(this),c=i.plugins==t.plugins||i.doc.eq(t.doc)?t.scrollToSelection>i.scrollToSelection?"to selection":"preserve":"reset",d=o||!this.docView.matchesNode(t.doc,u,l);!d&&t.selection.eq(i.selection)||(s=!0);let h=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&function(p){let f,m,g=p.dom.getBoundingClientRect(),E=Math.max(0,g.top);for(let A=(g.left+g.right)/2,v=E+1;v<Math.min(innerHeight,g.bottom);v+=5){let _=p.root.elementFromPoint(A,v);if(!_||_==p.dom||!p.dom.contains(_))continue;let O=_.getBoundingClientRect();if(O.top>=E-20){f=_,m=O.top;break}}return{refDOM:f,refTop:m,stack:Lg(p.dom)}}(this);if(s){this.domObserver.stop();let p=d&&(Le||me)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&function(f,m){let g=Math.min(f.$anchor.sharedDepth(f.head),m.$anchor.sharedDepth(m.head));return f.$anchor.start(g)!=m.$anchor.start(g)}(i.selection,t.selection);if(d){let f=me?this.trackWrites=this.domSelectionRange().focusNode:null;!o&&this.docView.update(t.doc,u,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=zg(t.doc,u,l,this.dom,this)),f&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(f){let m=f.docView.domFromPos(f.state.selection.anchor,0),g=f.domSelectionRange();return ti(m.node,m.offset,g.anchorNode,g.anchorOffset)}(this))?nr(this,p):(tE(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&function({refDOM:p,refTop:f,stack:m}){let g=p?p.getBoundingClientRect().top:0;xg(m,g==0?0:g-f)}(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof st){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&kg(this,e.getBoundingClientRect(),t)}else kg(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];r.update&&r.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let r=this.directPlugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let r=this.state.plugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}}updateDraggedNode(t,e){let r=t.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-e.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new SE(t.slice,t.move,i<0?void 0:st.create(this.state.doc,i))}someProp(t,e){let r,i=this._props&&this._props[t];if(i!=null&&(r=e?e(i):i))return r;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(r=e?e(a):a))return r}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[t];if(a!=null&&(r=e?e(a):a))return r}}hasFocus(){if(Le){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(oo)return t.focus(oo);let e=Lg(t);t.focus(oo==null?{get preventScroll(){return oo={preventScroll:!0},!0}}:void 0),oo||(oo=!1,xg(e,0))}(this.dom),nr(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}updateRoot(){this._root=null}posAtCoords(t){return O1(this,t)}coordsAtPos(t,e=1){return Fg(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let i=this.docView.posFromDOM(t,e,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,e){return C1(this,e||this.state,t)}pasteHTML(t,e){return Cs(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Cs(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ld(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(t){return function(e,r){rd(e,r)||!Se[r.type]||!e.editable&&r.type in Ne||Se[r.type](e,r)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return Oe&&this.root.nodeType===11&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom?function(t){let e;function r(u){u.preventDefault(),u.stopImmediatePropagation(),e=u.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0);let i=e.startContainer,o=e.startOffset,s=e.endContainer,a=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ti(l.node,l.offset,s,a)&&([i,o,s,a]=[s,a,i,o]),{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:a}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function xE(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let r in e)r=="class"?t.class+=" "+e[r]:r=="style"?t.style=(t.style?t.style+";":"")+e[r]:t[r]||r=="contenteditable"||r=="nodeName"||(t[r]=String(e[r]))}),t.translate||(t.translate="no"),[Ye.node(0,n.state.doc.content.size,t)]}function ME(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:Ye.widget(n.state.selection.head,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function PE(n){return!n.someProp("editable",t=>t(n.state)===!1)}function BE(n){let t=Object.create(null);function e(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function FE(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const Jt=new class{constructor(n){this.cached=Object.create(null);let t=this.spec={};for(let r in n)t[r]=n[r];t.nodes=ae.from(n.nodes),t.marks=ae.from(n.marks||{}),this.nodes=sg.compile(this.spec.nodes,this),this.marks=$a.compile(this.spec.marks,this);let e=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],o=i.spec.content||"",s=i.spec.marks;i.contentMatch=e[o]||(e[o]=Jr.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=s=="_"?null:s?ag(this,s.split(" ")):s!=""&&i.inlineContent?null:[]}for(let r in this.marks){let i=this.marks[r],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ag(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(n,t=null,e,r){if(typeof n=="string")n=this.nodeType(n);else{if(!(n instanceof sg))throw new RangeError("Invalid node type: "+n);if(n.schema!=this)throw new RangeError("Node type from different schema used ("+n.name+")")}return n.createChecked(t,e,r)}text(n,t){let e=this.nodes.text;return new Ha(e,e.defaultAttrs,n,At.setFrom(t))}mark(n,t){return typeof n=="string"&&(n=this.marks[n]),n.create(t)}nodeFromJSON(n){return qr.fromJSON(this,n)}markFromJSON(n){return At.fromJSON(this,n)}nodeType(n){let t=this.nodes[n];if(!t)throw new RangeError("Unknown node type: "+n);return t}}({nodes:{doc:{content:"paragraph+"},paragraph:{code:!0,content:"inline*",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},text:{group:"inline"},mention:{group:"inline",inline:!0,attrs:{id:{},name:{}},content:"text*",toDOM:n=>["span",{"data-mention-id":n.attrs.id,class:"t-mention"},`@${n.attrs.name}`],parseDOM:[{tag:"span[data-mention-id]",getAttrs:n=>({id:n.dataset["mention-id"]})}]},customemoji:{group:"inline",inline:!0,attrs:{name:{},url:{}},content:"text*",selectable:!1,toDOM:n=>["img",{src:n.attrs.url,alt:n.attrs.name,"data-custom-emoji":n.attrs.name}],parseDOM:[{tag:"img[data-custom-emoji]",getAttrs:n=>{const t=n;return{name:t.dataset.customEmoji,url:t.src}}}]}},marks:{literal:{toDOM:()=>["span",{"data-literal":""}],parseDOM:[{tag:"span[data-literal]"}]},bold:{toDOM:()=>["b"],parseDOM:[{tag:"b"}]},italic:{toDOM:()=>["i"],parseDOM:[{tag:"i"}]},strikethrough:{toDOM:()=>["del"],parseDOM:[{tag:"del"}]},emoji:{attrs:{emoji:{}},toDOM:n=>["span",{"data-emoji":n.attrs.emoji},n.attrs.emoji],parseDOM:[{tag:"span[data-emoji]",getAttrs:n=>({emoji:n.dataset.emoji})}]}}}),cd=new za("placeholder"),UE=new Ya({key:cd,props:{decorations(n){if(HE(n.doc))return;const t=n.doc.firstChild,e=Ye.node(0,t.nodeSize,{class:"empty-node","data-placeholder":cd.getState(n)});return Wt.create(n.doc,[e])}},state:{init:()=>"",apply:(n,t)=>{var e;return(e=n.getMeta(cd))!=null?e:t}}});function HE(n){return n.childCount!==1||n.firstChild.childCount!==0}for(var br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},Za={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},$E=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),q1=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),J1=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),jE=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Z1=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Q1=$E&&(jE||+$E[1]<57)||J1&&jE,le=0;le<10;le++)br[48+le]=br[96+le]=String(le);for(le=1;le<=24;le++)br[le+111]="F"+le;for(le=65;le<=90;le++)br[le]=String.fromCharCode(le+32),Za[le]=String.fromCharCode(le);for(var dd in br)Za.hasOwnProperty(dd)||(Za[dd]=br[dd]);const tN=typeof navigator!="undefined"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function eN(n){let t,e,r,i,o=n.split(/-(?!$)/),s=o[o.length-1];s=="Space"&&(s=" ");for(let a=0;a<o.length-1;a++){let l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))e=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);tN?i=!0:e=!0}}return t&&(s="Alt-"+s),e&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function hd(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function YE(n){return new Ya({props:{handleKeyDown:nN(n)}})}function nN(n){let t=function(e){let r=Object.create(null);for(let i in e)r[eN(i)]=e[i];return r}(n);return function(e,r){let i,o=function(a){var l=!(Q1&&(a.ctrlKey||a.altKey||a.metaKey)||(q1||Z1)&&a.shiftKey&&a.key&&a.key.length==1)&&a.key||(a.shiftKey?Za:br)[a.keyCode]||a.key||"Unidentified";return l=="Esc"&&(l="Escape"),l=="Del"&&(l="Delete"),l=="Left"&&(l="ArrowLeft"),l=="Up"&&(l="ArrowUp"),l=="Right"&&(l="ArrowRight"),l=="Down"&&(l="ArrowDown"),l}(r),s=t[hd(o,r)];if(s&&s(e.state,e.dispatch,e))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[hd(o,r,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=br[r.keyCode])&&i!=o){let a=t[hd(i,r)];if(a&&a(e.state,e.dispatch,e))return!0}}return!1}}var Qa=200,ue=function(){};ue.prototype.append=function(n){return n.length?(n=ue.from(n),!this.length&&n||n.length<Qa&&this.leafAppend(n)||this.length<Qa&&n.leafPrepend(this)||this.appendInner(n)):this},ue.prototype.prepend=function(n){return n.length?ue.from(n).append(this):this},ue.prototype.appendInner=function(n){return new rN(this,n)},ue.prototype.slice=function(n,t){return n===void 0&&(n=0),t===void 0&&(t=this.length),n>=t?ue.empty:this.sliceInner(Math.max(0,n),Math.min(this.length,t))},ue.prototype.get=function(n){if(!(n<0||n>=this.length))return this.getInner(n)},ue.prototype.forEach=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length),t<=e?this.forEachInner(n,t,e,0):this.forEachInvertedInner(n,t,e,0)},ue.prototype.map=function(n,t,e){t===void 0&&(t=0),e===void 0&&(e=this.length);var r=[];return this.forEach(function(i,o){return r.push(n(i,o))},t,e),r},ue.from=function(n){return n instanceof ue?n:n&&n.length?new zE(n):ue.empty};var zE=function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new t(this.values.slice(r,i))},t.prototype.getInner=function(r){return this.values[r]},t.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},t.prototype.leafAppend=function(r){if(this.length+r.length<=Qa)return new t(this.values.concat(r.flatten()))},t.prototype.leafPrepend=function(r){if(this.length+r.length<=Qa)return new t(r.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(ue);ue.empty=new zE([]);var rN=function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,r,i,o){var s=this.left.length;return!(r<s&&this.left.forEachInner(e,r,Math.min(i,s),o)===!1)&&!(i>s&&this.right.forEachInner(e,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)&&void 0},t.prototype.forEachInvertedInner=function(e,r,i,o){var s=this.left.length;return!(r>s&&this.right.forEachInvertedInner(e,r-s,Math.max(i,s)-s,o+s)===!1)&&!(i<s&&this.left.forEachInvertedInner(e,Math.min(r,s),i,o)===!1)&&void 0},t.prototype.sliceInner=function(e,r){if(e==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(e,r):e>=i?this.right.slice(e-i,r-i):this.left.slice(e,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new t(r,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(ue),VE=ue;const WE=Math.pow(2,16);function iN(n,t){return n+t*WE}function GE(n){return 65535&n}let pd=class{constructor(n,t,e){this.pos=n,this.delInfo=t,this.recover=e}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}},si=class zo{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&zo.empty)return zo.empty}recover(t){let e=0,r=GE(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/WE}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:iN(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new pd(h,f,p)}i+=c-u}return r?t+i:new pd(t+i,0,null)}touches(t,e){let r=0,i=GE(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new zo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?zo.empty:new zo(t<0?[0,-t,0]:[0,0,t])}};si.empty=new si([]);class Is{constructor(t=[],e,r=0,i=t.length){this.maps=t,this.mirror=e,this.from=r,this.to=i}slice(t=0,e=this.maps.length){return new Is(this.maps,this.mirror,t,e)}copy(){return new Is(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),e!=null&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,r=this.maps.length;e<t.maps.length;e++){let i=t.getMirror(e);this.appendMap(t.maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this.maps.length+t.maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t.maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new Is;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o].mapResult(t,e);if(s.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,t=this.maps[a].recover(s.recover);continue}}i|=s.delInfo,t=s.pos}return r?t:new pd(t,i,null)}}const fd=Object.create(null);let Ee=class{getMap(){return si.empty}merge(n){return null}static fromJSON(n,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let e=fd[t.stepType];if(!e)throw new RangeError(`No step type ${t.stepType} defined`);return e.fromJSON(n,t)}static jsonID(n,t){if(n in fd)throw new RangeError("Duplicate use of step JSON ID "+n);return fd[n]=t,t.prototype.jsonID=n,t}},Ce=class fa{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new fa(t,null)}static fail(t){return new fa(null,t)}static fromReplace(t,e,r,i){try{return fa.ok(t.replace(e,r,i))}catch(o){if(o instanceof eo)return fa.fail(o.message);throw o}}};function md(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(md(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}let XE=class ma extends Ee{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(md(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return Ce.fromReplace(t,this.from,this.to,o)}invert(){return new KE(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ma(e.pos,r.pos,this.mark)}merge(t){return t instanceof ma&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ma(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ma(e.from,e.to,t.markFromJSON(e.mark))}};Ee.jsonID("addMark",XE);let KE=class ga extends Ee{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new W(md(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Ce.fromReplace(t,this.from,this.to,r)}invert(){return new XE(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ga(e.pos,r.pos,this.mark)}merge(t){return t instanceof ga&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ga(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ga(e.from,e.to,t.markFromJSON(e.mark))}};Ee.jsonID("removeMark",KE);let qE=class Ea extends Ee{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Ce.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new Ea(this.pos,e.marks[i]);return new Ea(this.pos,this.mark)}}return new JE(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ea(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ea(e.pos,t.markFromJSON(e.mark))}};Ee.jsonID("addNodeMark",qE);let JE=class Pp extends Ee{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Ce.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new qE(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Pp(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Pp(e.pos,t.markFromJSON(e.mark))}};Ee.jsonID("removeNodeMark",JE),Ee.jsonID("replace",class xi extends Ee{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&gd(t,this.from,this.to)?Ce.fail("Structure replace would overwrite content"):Ce.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new si([this.from,this.to-this.from,this.slice.size])}invert(t){return new xi(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new xi(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof xi)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new xi(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new xi(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new xi(e.from,e.to,W.fromJSON(t,e.slice),!!e.structure)}});function gd(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}Ee.jsonID("replaceAround",class Cu extends Ee{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(gd(t,this.from,this.gapFrom)||gd(t,this.gapTo,this.to)))return Ce.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Ce.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Ce.fromReplace(t,this.from,this.to,r):Ce.fail("Content does not fit in gap")}getMap(){return new si([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Cu(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Cu(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Cu(e.from,e.to,e.gapFrom,e.gapTo,W.fromJSON(t,e.slice),e.insert,!!e.structure)}}),Ee.jsonID("attr",class bu extends Ee{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Ce.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Ce.fromReplace(t,this.pos,this.pos+1,new W(K.from(i),0,e.isLeaf?0:1))}getMap(){return si.empty}invert(t){return new bu(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new bu(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new bu(e.pos,e.attr,e.value)}}),Ee.jsonID("docAttr",class Bp extends Ee{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Ce.ok(r)}getMap(){return si.empty}invert(t){return new Bp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bp(e.attr,e.value)}});let tl=class extends Error{};tl=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(tl.prototype=Object.create(Error.prototype)).constructor=tl,tl.prototype.name="TransformError";class fn{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let r,i,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}e&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s,a,l=t.tr,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step)return r||(r=this.remapping(o,h+1),i=r.maps.length),i--,void c.push(d);if(r){c.push(new Ir(d.map));let p,f=d.step.map(r.slice(i));f&&l.maybeStep(f).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],u.push(new Ir(p,void 0,void 0,u.length+c.length))),i--,p&&r.appendMap(p,i)}else l.maybeStep(d.step);return d.selection?(s=r?d.selection.map(r.slice(i)):d.selection,a=new fn(this.items.slice(0,o).append(c.reverse().concat(u)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:a,transform:l,selection:s}}addTransform(t,e,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<t.steps.length;c++){let d,h=t.steps[c].invert(t.docs[c]),p=new Ir(t.mapping.maps[c],h,e);(d=l&&l.merge(p))&&(p=d,c?o.pop():a=a.slice(0,a.length-1)),o.push(p),e&&(s++,e=void 0),i||(l=p)}let u=s-r.depth;return u>oN&&(a=function(c,d){let h;return c.forEach((p,f)=>{if(p.selection&&d--==0)return h=f,!1}),c.slice(h)}(a,u),s-=u),new fn(a.append(o),s)}remapping(t,e){let r=new Is;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},t,e),r}addMaps(t){return this.eventCount==0?this:new fn(this.items.append(t.map(e=>new Ir(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-e),o=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=e;this.items.forEach(h=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(h.step){let m=t.steps[p].invert(t.docs[p]),g=h.selection&&h.selection.map(o.slice(l+1,p));g&&a++,r.push(new Ir(f,m,g))}else r.push(new Ir(f))},i);let u=[];for(let h=e;h<s;h++)u.push(new Ir(o.maps[h]));let c=this.items.slice(0,i).append(u).append(r),d=new fn(c,a);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(e.slice(r)),u=l&&l.getMap();if(r--,u&&e.appendMap(u,r),l){let c=s.selection&&s.selection.map(e.slice(r));c&&o++;let d,h=new Ir(u.invert(),l,c),p=i.length-1;(d=i.length&&i[p].merge(h))?i[p]=d:i.push(h)}}else s.map&&r--},this.items.length,0),new fn(VE.from(i.reverse()),o)}}fn.empty=new fn(VE.empty,0);let Ir=class YT{constructor(t,e,r,i){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new YT(e.getMap().invert(),e,this.selection)}}};class wr{constructor(t,e,r,i,o){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const oN=20;function ZE(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((r,i,o,s)=>t.push(o,s));return t}function Ed(n,t){if(!n)return null;let e=[];for(let r=0;r<n.length;r+=2){let i=t.map(n[r],1),o=t.map(n[r+1],-1);i<=o&&e.push(i,o)}return e}let Ad=!1,QE=null;function el(n){let t=n.plugins;if(QE!=t){Ad=!1,QE=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Ad=!0;break}}return Ad}const ai=new za("history"),sN=new za("closeHistory");function aN(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ya({key:ai,state:{init:()=>new wr(fn.empty,fn.empty,null,0,-1),apply:(t,e,r)=>function(i,o,s,a){let l,u=s.getMeta(ai);if(u)return u.historyState;s.getMeta(sN)&&(i=new wr(i.done,i.undone,null,0,-1));let c=s.getMeta("appendedTransaction");if(s.steps.length==0)return i;if(c&&c.getMeta(ai))return c.getMeta(ai).redo?new wr(i.done.addTransform(s,void 0,a,el(o)),i.undone,ZE(s.mapping.maps),i.prevTime,i.prevComposition):new wr(i.done,i.undone.addTransform(s,void 0,a,el(o)),null,i.prevTime,i.prevComposition);if(s.getMeta("addToHistory")===!1||c&&c.getMeta("addToHistory")===!1)return(l=s.getMeta("rebased"))?new wr(i.done.rebased(s,l),i.undone.rebased(s,l),Ed(i.prevRanges,s.mapping),i.prevTime,i.prevComposition):new wr(i.done.addMaps(s.mapping.maps),i.undone.addMaps(s.mapping.maps),Ed(i.prevRanges,s.mapping),i.prevTime,i.prevComposition);{let d=s.getMeta("composition"),h=i.prevTime==0||!c&&i.prevComposition!=d&&(i.prevTime<(s.time||0)-a.newGroupDelay||!function(f,m){if(!m)return!1;if(!f.docChanged)return!0;let g=!1;return f.mapping.maps[0].forEach((E,A)=>{for(let v=0;v<m.length;v+=2)E<=m[v+1]&&A>=m[v]&&(g=!0)}),g}(s,i.prevRanges)),p=c?Ed(i.prevRanges,s.mapping):ZE(s.mapping.maps);return new wr(i.done.addTransform(s,h?o.selection.getBookmark():void 0,a,el(o)),fn.empty,p,s.time,d==null?i.prevComposition:d)}}(e,r,t,n)},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?e0:r=="historyRedo"?n0:null;return!!i&&(e.preventDefault(),i(t.state,t.dispatch))}}}})}function t0(n,t){return(e,r)=>{let i=ai.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=function(s,a,l){let u=el(a),c=ai.get(a).spec.config,d=(l?s.undone:s.done).popEvent(a,u);if(!d)return null;let h=d.selection.resolve(d.transform.doc),p=(l?s.done:s.undone).addTransform(d.transform,a.selection.getBookmark(),c,u),f=new wr(l?p:d.remaining,l?d.remaining:p,null,0,-1);return d.transform.setSelection(h).setMeta(ai,{redo:l,historyState:f})}(i,e,n);o&&r(t?o.scrollIntoView():o)}return!0}}const e0=t0(!1,!0),n0=t0(!0,!0),r0=Math.pow(2,16);function lN(n,t){return n+t*r0}function i0(n){return 65535&n}class o0{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class ze{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&ze.empty)return ze.empty}recover(t){let e=0,r=i0(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*r]+e+function(i){return(i-(65535&i))/r0}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(t<=d){let h=l+i+((u?t==l?-1:t==d?1:e:e)<0?0:c);if(r)return h;let p=t==(e<0?l:d)?null:lN(a/3,t-l),f=t==l?2:t==d?1:4;return(e<0?t!=l:t!=d)&&(f|=8),new o0(h,f,p)}i+=c-u}return r?t+i:new o0(t+i,0,null)}touches(t,e){let r=0,i=i0(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let u=this.ranges[a+o];if(t<=l+u&&a==3*i)return!0;r+=this.ranges[a+s]-u}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+e],c=this.ranges[i+r];t(a,a+u,l,l+c),o+=c-u}}invert(){return new ze(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?ze.empty:new ze(t<0?[0,-t,0]:[0,0,t])}}ze.empty=new ze([]);const vd=Object.create(null);class Ae{getMap(){return ze.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=vd[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in vd)throw new RangeError("Duplicate use of step JSON ID "+t);return vd[t]=e,e.prototype.jsonID=t,e}}class Gt{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Gt(t,null)}static fail(t){return new Gt(null,t)}static fromReplace(t,e,r,i){try{return Gt.ok(t.replace(e,r,i))}catch(o){if(o instanceof eo)return Gt.fail(o.message);throw o}}}function _d(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(_d(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return K.fromArray(r)}class li extends Ae{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new W(_d(e.content,(s,a)=>s.isAtom&&a.type.allowsMarkType(this.mark.type)?s.mark(this.mark.addToSet(s.marks)):s,i),e.openStart,e.openEnd);return Gt.fromReplace(t,this.from,this.to,o)}invert(){return new ui(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new li(e.pos,r.pos,this.mark)}merge(t){return t instanceof li&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new li(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new li(e.from,e.to,t.markFromJSON(e.mark))}}Ae.jsonID("addMark",li);class ui extends Ae{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new W(_d(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return Gt.fromReplace(t,this.from,this.to,r)}invert(){return new li(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new ui(e.pos,r.pos,this.mark)}merge(t){return t instanceof ui&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new ui(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ui(e.from,e.to,t.markFromJSON(e.mark))}}Ae.jsonID("removeMark",ui);class ci extends Ae{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Gt.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new ci(this.pos,e.marks[i]);return new ci(this.pos,this.mark)}}return new ws(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ci(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ci(e.pos,t.markFromJSON(e.mark))}}Ae.jsonID("addNodeMark",ci);class ws extends Ae{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Gt.fromReplace(t,this.pos,this.pos+1,new W(K.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new ci(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ws(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ws(e.pos,t.markFromJSON(e.mark))}}Ae.jsonID("removeNodeMark",ws);class mn extends Ae{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&yd(t,this.from,this.to)?Gt.fail("Structure replace would overwrite content"):Gt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new ze([this.from,this.to-this.from,this.slice.size])}invert(t){return new mn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new mn(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof mn)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new mn(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new mn(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new mn(e.from,e.to,W.fromJSON(t,e.slice),!!e.structure)}}Ae.jsonID("replace",mn);class Rr extends Ae{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(yd(t,this.from,this.gapFrom)||yd(t,this.gapTo,this.to)))return Gt.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Gt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?Gt.fromReplace(t,this.from,this.to,r):Gt.fail("Content does not fit in gap")}getMap(){return new ze([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Rr(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new Rr(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Rr(e.from,e.to,e.gapFrom,e.gapTo,W.fromJSON(t,e.slice),e.insert,!!e.structure)}}function yd(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function uN(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function Td(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let e=n.depth;;--e){let r=n.$from.node(e),i=n.$from.index(e),o=n.$to.indexAfter(e);if(e<n.depth&&r.canReplace(i,o,t))return e;if(e==0||r.type.spec.isolating||!uN(r,i,o))break}return null}function nl(n,t,e=1,r){let i=n.resolve(t),o=i.depth-e,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=e-2;u>o;u--,c--){let d=i.node(u),h=i.index(u);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),f=r&&r[c+1];f&&(p=p.replaceChild(0,f.type.create(f.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(p))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function s0(n,t){let e=n.resolve(t),r=e.index();return function(i,o){return!(!i||!o||i.isLeaf||!function(s,a){a.content.size||s.type.compatibleContent(a.type);let l=s.contentMatchAt(s.childCount),{linebreakReplacement:u}=s.type.schema;for(let c=0;c<a.childCount;c++){let d=a.child(c),h=d.type==u?s.type.schema.nodes.text:d.type;if(l=l.matchType(h),!l||!s.type.allowsMarks(d.marks))return!1}return l.validEnd}(i,o))}(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function a0(n,t,e=t,r=W.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),o=n.resolve(e);return function(s,a,l){return!l.openStart&&!l.openEnd&&s.start()==a.start()&&s.parent.canReplace(s.index(),a.index(),l.content)}(i,o,r)?new mn(t,e,r):new cN(i,o,r).fit()}Ae.jsonID("replaceAround",Rr);class cN{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=K.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new W(o,s,a);return t>-1?new Rr(r.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||r.pos!=this.$to.pos?new mn(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=e.firstChild;if(e.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}e=o.content}for(let e=1;e<=2;e++)for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Od(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let l,{type:u,match:c}=this.frontier[a],d=null;if(e==1&&(s?c.matchType(s.type)||(d=c.fillBefore(K.from(s),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:d};if(e==2&&s&&(l=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:l};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Od(t,e);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new W(t,e+1,Math.max(r,i.size+e>=t.size-r?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Od(t,e);if(i.childCount<=1&&e>0){let o=t.size-e<=e+i.size;this.unplaced=new W(Rs(t,e-1,1),e-1,o?e-1:r)}else this.unplaced=new W(Rs(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:o}){for(;this.depth>e;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,u=0,c=[],{match:d,type:h}=this.frontier[e];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let p=a.size+t-(s.content.size-s.openEnd);for(;u<a.childCount;){let m=a.child(u),g=d.matchType(m.type);if(!g)break;u++,(u>1||l==0||m.content.size)&&(d=g,c.push(l0(m.mark(h.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?p:-1)))}let f=u==a.childCount;f||(p=-1),this.placed=Ds(this.placed,e,K.from(c)),this.frontier[e].match=d,f&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let E=g.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),g=E.content}this.unplaced=f?t==0?W.empty:new W(Rs(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new W(Rs(s.content,t,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Sd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Sd(t,e,i,r,o);if(s){for(let a=e-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Sd(t,a,u,l,!0);if(!c||c.childCount)continue t}return{depth:e,fit:s,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Ds(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Ds(this.placed,this.depth,K.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(K.empty,!0);t.childCount&&(this.placed=Ds(this.placed,this.frontier.length,t))}}function Rs(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(Rs(n.firstChild.content,t-1,e)))}function Ds(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Ds(n.lastChild.content,t-1,e)))}function Od(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function l0(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,l0(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),n.copy(r)}function Sd(n,t,e,r,i){let o=n.node(t),s=i?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!function(l,u,c){for(let d=c;d<u.childCount;d++)if(!l.allowsMarks(u.child(d).marks))return!0;return!1}(e,o.content,s)?a:null}class ks extends Ae{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return Gt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return Gt.fromReplace(t,this.pos,this.pos+1,new W(K.from(i),0,e.isLeaf?0:1))}getMap(){return ze.empty}invert(t){return new ks(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new ks(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ks(e.pos,e.attr,e.value)}}Ae.jsonID("attr",ks);class rl extends Ae{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return Gt.ok(r)}getMap(){return ze.empty}invert(t){return new rl(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rl(e.attr,e.value)}}Ae.jsonID("docAttr",rl);let il=class extends Error{};il=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(il.prototype=Object.create(Error.prototype)).constructor=il,il.prototype.name="TransformError";const u0=(n,t)=>!n.selection.empty&&(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function uo(n,t,e=!1){for(let r=n;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(e&&r.childCount!=1)return!1}return!1}function c0(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function d0(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}function Nd(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}const dN=(n,t)=>{let{$from:e,$to:r}=n.selection;if(n.selection instanceof st&&n.selection.node.isBlock)return!(!e.parentOffset||!nl(n.doc,e.pos)||(t&&t(n.tr.split(e.pos).scrollIntoView()),0));if(!e.depth)return!1;let i,o,s=[],a=!1,l=!1;for(let h=e.depth;;h--){if(e.node(h).isBlock){a=e.end(h)==e.pos+(e.depth-h),l=e.start(h)==e.pos-(e.depth-h),o=Nd(e.node(h-1).contentMatchAt(e.indexAfter(h-1))),s.unshift(a&&o?{type:o}:null),i=h;break}if(h==1)return!1;s.unshift(null)}let u=n.tr;(n.selection instanceof vt||n.selection instanceof je)&&u.deleteSelection();let c=u.mapping.map(e.pos),d=nl(u.doc,c,s.length,s);if(d||(s[0]=o?{type:o}:null,d=nl(u.doc,c,s.length,s)),u.split(c,s.length,s),!a&&l&&e.node(i).type!=o){let h=u.mapping.map(e.before(i)),p=u.doc.resolve(h);o&&e.node(i-1).canReplaceWith(p.index(),p.index()+1,o)&&u.setNodeMarkup(u.mapping.map(e.before(i)),o)}return t&&t(u.scrollIntoView()),!0};function h0(n,t,e,r){let i,o,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(p,f,m){let g=f.nodeBefore,E=f.nodeAfter,A=f.index();return!(!(g&&E&&g.type.compatibleContent(E.type))||(!g.content.size&&f.parent.canReplace(A-1,A)?(m&&m(p.tr.delete(f.pos-g.nodeSize,f.pos).scrollIntoView()),0):!f.parent.canReplace(A,A+1)||!E.isTextblock&&!s0(p.doc,f.pos)||(m&&m(p.tr.join(f.pos).scrollIntoView()),0)))}(n,t,e))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(i=(o=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&o.matchType(i[0]||a.type).validEnd){if(e){let p=t.pos+a.nodeSize,f=K.empty;for(let E=i.length-1;E>=0;E--)f=K.from(i[E].create(null,f));f=K.from(s.copy(f));let m=n.tr.step(new Rr(t.pos-1,p,t.pos,p,new W(f,1,0),i.length,!0)),g=m.doc.resolve(p+2*i.length);g.nodeAfter&&g.nodeAfter.type==s.type&&s0(m.doc,g.pos)&&m.join(g.pos),e(m.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:mt.findFrom(t,1),d=c&&c.$from.blockRange(c.$to),h=d&&Td(d);if(h!=null&&h>=t.depth)return e&&e(n.tr.lift(d,h).scrollIntoView()),!0;if(u&&uo(a,"start",!0)&&uo(s,"end")){let p=s,f=[];for(;f.push(p),!p.isTextblock;)p=p.lastChild;let m=a,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(e){let E=K.empty;for(let A=f.length-1;A>=0;A--)E=K.from(f[A].copy(E));e(n.tr.step(new Rr(t.pos-f.length,t.pos+a.nodeSize,t.pos+g,t.pos+a.nodeSize-g,new W(E,f.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function p0(n){return function(t,e){let r=t.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(e&&e(t.tr.setSelection(vt.create(t.doc,n<0?i.start(o):i.end(o)))),!0)}}const hN=p0(-1),pN=p0(1);function Cd(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}let bd=Cd(u0,(n,t,e)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("backward",s):l.parentOffset>0)?null:l}(n,e);if(!r)return!1;let i=c0(r);if(!i){let s=r.blockRange(),a=s&&Td(s);return a!=null&&(t&&t(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(h0(n,i,t,-1))return!0;if(r.parent.content.size==0&&(uo(o,"end")||st.isSelectable(o)))for(let s=r.depth;;s--){let a=a0(n.doc,r.before(s),r.after(s),W.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=n.tr.step(a);l.setSelection(uo(o,"end")?mt.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):st.create(l.doc,i.pos-o.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=c0(r)}let s=o&&o.nodeBefore;return!(!s||!st.isSelectable(s))&&(t&&t(n.tr.setSelection(st.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)}),f0=Cd(u0,(n,t,e)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("forward",s):l.parentOffset<l.parent.content.size)?null:l}(n,e);if(!r)return!1;let i=d0(r);if(!i)return!1;let o=i.nodeAfter;if(h0(n,i,t,1))return!0;if(r.parent.content.size==0&&(uo(o,"start")||st.isSelectable(o))){let s=a0(n.doc,r.before(),r.after(),W.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=n.tr.step(s);a.setSelection(uo(o,"start")?mt.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):st.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(t&&t(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=d0(r)}let s=o&&o.nodeAfter;return!(!s||!st.isSelectable(s))&&(t&&t(n.tr.setSelection(st.create(n.doc,o.pos)).scrollIntoView()),!0)});const rr={Enter:Cd((n,t)=>{let{$head:e,$anchor:r}=n.selection;return!(!e.parent.type.spec.code||!e.sameParent(r))&&(t&&t(n.tr.insertText(`
82
+ `).scrollIntoView()),!0)},(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof je||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Nd(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(vt.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let o=e.before();if(nl(n.doc,o))return t&&t(n.tr.split(o).scrollIntoView()),!0}let r=e.blockRange(),i=r&&Td(r);return i!=null&&(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)},dN),"Mod-Enter":(n,t)=>{let{$head:e,$anchor:r}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(r))return!1;let i=e.node(-1),o=e.indexAfter(-1),s=Nd(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let a=e.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(mt.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Backspace:bd,"Mod-Backspace":bd,"Shift-Backspace":bd,Delete:f0,"Mod-Delete":f0,"Mod-a":(n,t)=>(t&&t(n.tr.setSelection(new je(n.doc))),!0)},m0={"Ctrl-h":rr.Backspace,"Alt-Backspace":rr["Mod-Backspace"],"Ctrl-d":rr.Delete,"Ctrl-Alt-Backspace":rr["Mod-Delete"],"Alt-Delete":rr["Mod-Delete"],"Alt-d":rr["Mod-Delete"],"Ctrl-a":hN,"Ctrl-e":pN};for(let n in rr)m0[n]=rr[n];const ol=(typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!(typeof os=="undefined"||!os.platform)&&os.platform()=="darwin")?m0:rr,Ls=(n,t,e=void 0)=>function(r,i){return r.reduce((o,s,a)=>o.concat(i(s,a)),[])}(n,r=>{if(typeof r=="string")return t(r,e);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:r.type,children:Ls(r.children,t,r.type)}];case"link":return[{type:r.type,url:r.url,children:Ls(r.children,t,r.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:r.type,action:r.action,params:r.params,children:Ls(r.children,t,r.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[r]}});function ir(n,t){return e=>{const r=e;let i=0;const o=[];for(const s of Zu(e,n)){s.index-i>0&&o.push(r.substring(i,s.index));const a=t(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<e.length&&o.push(e.substring(i)),o}}function g0(n){return n.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1").replace(/<!!customemoji:(.*?)>/gim,"$1")}const E0="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Id=(n=>(n[n.italic=1]="italic",n[n.strikethrough=2]="strikethrough",n[n.bold=4]="bold",n))(Id||{});const fN=[0,1,2,3,4,5,6].map(n=>{const t=[];return 1&n||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&n||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&n||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map(e=>e.source).join("|"),"g")}),mN={_:1,"*":4,"~":2};function gN(n){return A0(n,0)}function A0(n,t=0){const e=fN[t],r=e?function(i){const o=EN.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${E0}])(?:${i.source})(?=[\\s${E0}]|$)`,"g")),s=ir(o,a=>{const l=a[0][1],u=a[1]||a[2]||a[3]||a[4]||a[5]||a[6];return[" ",{type:Id[mN[l]],children:[u]}]});return a=>{const[l,...u]=s(" "+a);return l.length>1&&u.unshift(l.substring(1)),u}}(e):()=>[n];return Ls(r(n),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?A0(i,t|Id[o]):[i])}const EN=function(){const n=function(){try{return new WeakMap}catch(t){const e={has:()=>!1,get:()=>{},set:()=>e};return e}}();return{getOrCompute(t,e){if(n.has(t))return n.get(t);const r=e();return n.set(t,r),r}}}();function v0(n,t){if(Array.prototype.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function di(n,t){for(var e=n.length-1;e>=0;e--)t(n[e])===!0&&n.splice(e,1)}function _0(n){throw new Error("Unhandled case for value: '"+n+"'")}var wd=function(){function n(t){t===void 0&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return n.prototype.setTagName=function(t){return this.tagName=t,this},n.prototype.getTagName=function(){return this.tagName||""},n.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},n.prototype.getAttr=function(t){return this.getAttrs()[t]},n.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},n.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},n.prototype.setClass=function(t){return this.setAttr("class",t)},n.prototype.addClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);e=s.shift();)v0(o,e)===-1&&o.push(e);return this.getAttrs().class=o.join(" "),this},n.prototype.removeClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);o.length&&(e=s.shift());){var a=v0(o,e);a!==-1&&o.splice(a,1)}return this.getAttrs().class=o.join(" "),this},n.prototype.getClass=function(){return this.getAttrs().class||""},n.prototype.hasClass=function(t){return(" "+this.getClass()+" ").indexOf(" "+t+" ")!==-1},n.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},n.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},n.prototype.getInnerHTML=function(){return this.innerHTML||""},n.prototype.getInnerHtml=function(){return this.getInnerHTML()},n.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},n.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r+'="'+t[r]+'"');return e.join(" ")},n}(),y0=function(){function n(t){t===void 0&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return n.prototype.build=function(t){return new wd({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},n.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},r=this.createCssClass(t);return r&&(e.class=r),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},n.prototype.createCssClass=function(t){var e=this.className;if(e){for(var r=[e],i=t.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(e+"-"+i[o]);return r.join(" ")}return""},n.prototype.processAnchorText=function(t){return t=this.doTruncate(t)},n.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var r=e.length,i=e.location;return i==="smart"?function(o,s,a){var l,u;a==null?(a="&hellip;",u=3,l=8):(u=a.length,l=a.length);var c=function(_){var O="";return _.scheme&&_.host&&(O+=_.scheme+"://"),_.host&&(O+=_.host),_.path&&(O+="/"+_.path),_.query&&(O+="?"+_.query),_.fragment&&(O+="#"+_.fragment),O},d=function(_,O){var T=O/2,S=Math.ceil(T),N=-1*Math.floor(T),y="";return N<0&&(y=_.substr(N)),_.substr(0,S)+a+y};if(o.length<=s)return o;var h=s-u,p=function(_){var O={},T=_,S=T.match(/^([a-z]+):\/\//i);return S&&(O.scheme=S[1],T=T.substr(S[0].length)),(S=T.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(O.host=S[1],T=T.substr(S[0].length)),(S=T.match(/^\/(.*?)(?=(\?|#|$))/i))&&(O.path=S[1],T=T.substr(S[0].length)),(S=T.match(/^\?(.*?)(?=(#|$))/i))&&(O.query=S[1],T=T.substr(S[0].length)),(S=T.match(/^#(.*?)$/i))&&(O.fragment=S[1]),O}(o);if(p.query){var f=p.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);f&&(p.query=p.query.substr(0,f[1].length),o=c(p))}if(o.length<=s||(p.host&&(p.host=p.host.replace(/^www\./,""),o=c(p)),o.length<=s))return o;var m="";if(p.host&&(m+=p.host),m.length>=h)return p.host.length==s?(p.host.substr(0,s-u)+a).substr(0,h+l):d(m,h).substr(0,h+l);var g="";if(p.path&&(g+="/"+p.path),p.query&&(g+="?"+p.query),g){if((m+g).length>=h)return(m+g).length==s?(m+g).substr(0,s):(m+d(g,h-m.length)).substr(0,h+l);m+=g}if(p.fragment){var E="#"+p.fragment;if((m+E).length>=h)return(m+E).length==s?(m+E).substr(0,s):(m+d(E,h-m.length)).substr(0,h+l);m+=E}if(p.scheme&&p.host){var A=p.scheme+"://";if((m+A).length<h)return(A+m).substr(0,s)}if(m.length<=s)return m;var v="";return h>0&&(v=m.substr(-1*Math.floor(h/2))),(m.substr(0,Math.ceil(h/2))+a+v).substr(0,h+l)}(t,r):i==="middle"?function(o,s,a){if(o.length<=s)return o;var l,u;a==null?(a="&hellip;",l=8,u=3):(l=a.length,u=a.length);var c=s-u,d="";return c>0&&(d=o.substr(-1*Math.floor(c/2))),(o.substr(0,Math.ceil(c/2))+a+d).substr(0,c+l)}(t,r):function(o,s,a){return function(l,u,c){var d;return l.length>u&&(c==null?(c="&hellip;",d=3):d=c.length,l=l.substring(0,u-d)+c),l}(o,s,a)}(t,r)},n}(),co=function(){function n(t){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return n.prototype.getMatchedText=function(){return this.matchedText},n.prototype.setOffset=function(t){this.offset=t},n.prototype.getOffset=function(){return this.offset},n.prototype.getCssClassSuffixes=function(){return[this.getType()]},n.prototype.buildTag=function(){return this.tagBuilder.build(this)},n}(),Rd=function(n,t){return Rd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])},Rd(n,t)};function Dn(n,t){function e(){this.constructor=n}Rd(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var T0,Lt=function(){return Lt=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Lt.apply(this,arguments)},Dd=function(n){function t(e){var r=n.call(this,e)||this;return r.email="",r.email=e.email,r}return Dn(t,n),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(co),O0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="",r.hashtag="",r.serviceName=e.serviceName,r.hashtag=e.hashtag,r}return Dn(t,n),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,r=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(co),S0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.mention="",r.mention=e.mention,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var e=n.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&e.push(r),e},t}(co),N0=function(n){function t(e){var r=n.call(this,e)||this;return r.number="",r.plusSign=!1,r.number=e.number,r.plusSign=e.plusSign,r}return Dn(t,n),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(co),kd=function(n){function t(e){var r=n.call(this,e)||this;return r.url="",r.urlMatchType="scheme",r.protocolUrlMatch=!1,r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.schemePrefixRegex=/^(https?:\/\/)?/i,r.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,r.protocolRelativeRegex=/^\/\//,r.protocolPrepended=!1,r.urlMatchType=e.urlMatchType,r.url=e.url,r.protocolUrlMatch=e.protocolUrlMatch,r.protocolRelativeMatch=e.protocolRelativeMatch,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return Dn(t,n),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var r=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(r)}catch(i){return r}},t}(co),ho=function(n){this.__jsduckDummyDocProp=null,this.tagBuilder=n.tagBuilder},Ld=/[A-Za-z]/,AN=/[\d]/,vN=/[\D]/,hi=/\s/,xd=/['"]/,_N=/[\x00-\x1F\x7F]/,C0=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,b0=C0+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,sl=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,yN=b0+sl,Bt=b0+sl,TN="(?:["+sl+"]{1,3}\\.){3}["+sl+"]{1,3}",ON="["+Bt+"](?:["+Bt+"\\-]{0,61}["+Bt+"])?",I0=function(n){return"(?=("+ON+"))\\"+n},Md=function(n){return"(?:"+I0(n)+"(?:\\."+I0(n+1)+"){0,126}|"+TN+")"},al=new RegExp("["+Bt+"]"),w0=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,SN=new RegExp("["+Bt+"!#$%&'*+/=?^_`{|}~-]"),NN=new RegExp("^"+w0.source+"$"),R0=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.localPartCharRegex=SN,e.strictTldRegex=NN,e}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r=this.tagBuilder,i=this.localPartCharRegex,o=this.strictTldRegex,s=[],a=e.length,l=new ll,u={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,d=0,h=l;c<a;){var p=e.charAt(c);switch(d){case 0:f(p);break;case 1:m(e.charAt(c-1),p);break;case 2:g(p);break;case 3:E(p);break;case 4:A(p);break;case 5:v(p);break;case 6:_(p);break;case 7:O(p);break;default:_0(d)}c++}return N(),s;function f(y){y==="m"?T(1):i.test(y)&&T()}function m(y,w){y===":"?i.test(w)?(d=2,h=new ll(Lt(Lt({},h),{hasMailtoPrefix:!0}))):S():u[y]===w||(i.test(w)?d=2:w==="."?d=3:w==="@"?d=4:S())}function g(y){y==="."?d=3:y==="@"?d=4:i.test(y)||S()}function E(y){y==="."||y==="@"?S():i.test(y)?d=2:S()}function A(y){al.test(y)?d=5:S()}function v(y){y==="."?d=7:y==="-"?d=6:al.test(y)||N()}function _(y){y==="-"||y==="."?N():al.test(y)?d=5:N()}function O(y){y==="."||y==="-"?N():al.test(y)?(d=5,h=new ll(Lt(Lt({},h),{hasDomainDot:!0}))):N()}function T(y){y===void 0&&(y=2),d=y,h=new ll({idx:c})}function S(){d=0,h=l}function N(){if(h.hasDomainDot){var y=e.slice(h.idx,c);/[-.]$/.test(y)&&(y=y.slice(0,-1));var w=h.hasMailtoPrefix?y.slice(7):y;(function(b){var I=b.split(".").pop()||"",P=I.toLowerCase();return o.test(P)})(w)&&s.push(new Dd({tagBuilder:r,matchedText:y,offset:h.idx,email:w}))}S()}},t}(ho),ll=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.hasMailtoPrefix=!!n.hasMailtoPrefix,this.hasDomainDot=!!n.hasDomainDot},CN=function(){function n(){}return n.isValid=function(t,e){return!(e&&!this.isValidUriScheme(e)||this.urlMatchDoesNotHaveProtocolOrDot(t,e)||this.urlMatchDoesNotHaveAtLeastOneWordChar(t,e)&&!this.isValidIpAddress(t)||this.containsMultipleDots(t))},n.isValidIpAddress=function(t){var e=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return t.match(e)!==null},n.containsMultipleDots=function(t){var e=t;return this.hasFullProtocolRegex.test(t)&&(e=t.split("://")[1]),e.split("/")[0].indexOf("..")>-1},n.isValidUriScheme=function(t){var e=t.match(this.uriSchemeRegex),r=e&&e[0].toLowerCase();return r!=="javascript:"&&r!=="vbscript:"},n.urlMatchDoesNotHaveProtocolOrDot=function(t,e){return!(!t||e&&this.hasFullProtocolRegex.test(e)||t.indexOf(".")!==-1)},n.urlMatchDoesNotHaveAtLeastOneWordChar=function(t,e){return!(!t||!e)&&!this.hasFullProtocolRegex.test(e)&&!this.hasWordCharAfterProtocolRegex.test(t)},n.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,n.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,n.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+C0+"]"),n.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,n}(),bN=(T0=new RegExp("[/?#](?:["+Bt+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Bt+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Md(2),")","|","(","(//)?",/(?:www\.)/.source,Md(6),")","|","(","(//)?",Md(10)+"\\.",w0.source,"(?![-"+yN+"])",")",")","(?::[0-9]+)?","(?:"+T0.source+")?"].join(""),"gi")),IN=new RegExp("["+Bt+"]"),D0=function(n){function t(e){var r=n.call(this,e)||this;return r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.matcherRegex=bN,r.wordCharRegExp=IN,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.stripPrefix,s=this.stripTrailingSlash,a=this.decodePercentEncoding,l=this.tagBuilder,u=[],c=function(){var h=r[0],p=r[1],f=r[4],m=r[5],g=r[9],E=r.index,A=m||g,v=e.charAt(E-1);if(!CN.isValid(h,p)||E>0&&v==="@"||E>0&&A&&d.wordCharRegExp.test(v))return"continue";if(/\?$/.test(h)&&(h=h.substr(0,h.length-1)),d.matchHasUnbalancedClosingParen(h))h=h.substr(0,h.length-1);else{var _=d.matchHasInvalidCharAfterTld(h,p);_>-1&&(h=h.substr(0,_))}var O=["http://","https://"].find(function(y){return!!p&&p.indexOf(y)!==-1});if(O){var T=h.indexOf(O);h=h.substr(T),p=p.substr(T),E+=T}var S=p?"scheme":f?"www":"tld",N=!!p;u.push(new kd({tagBuilder:l,matchedText:h,offset:E,urlMatchType:S,url:h,protocolUrlMatch:N,protocolRelativeMatch:!!A,stripPrefix:o,stripTrailingSlash:s,decodePercentEncoding:a}))},d=this;(r=i.exec(e))!==null;)c();return u},t.prototype.matchHasUnbalancedClosingParen=function(e){var r,i=e.charAt(e.length-1);if(i===")")r="(";else if(i==="]")r="[";else{if(i!=="}")return!1;r="{"}for(var o=0,s=0,a=e.length-1;s<a;s++){var l=e.charAt(s);l===r?o++:l===i&&(o=Math.max(o-1,0))}return o===0},t.prototype.matchHasInvalidCharAfterTld=function(e,r){if(!e)return-1;var i=0;r&&(i=e.indexOf(":"),e=e.slice(i));var o=new RegExp("^((.?//)?[-."+Bt+"]*[-"+Bt+"]\\.[-"+Bt+"]+)").exec(e);return o===null?-1:(i+=o[1].length,e=e.slice(o[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(ho),wN=new RegExp("#[_"+Bt+"]{1,139}(?![_"+Bt+"])","g"),RN=new RegExp("[^"+Bt+"]"),k0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegex=wN,r.nonWordCharRegex=RN,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.nonWordCharRegex,s=this.serviceName,a=this.tagBuilder,l=[];(r=i.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||o.test(c)){var d=r[0],h=r[0].slice(1);l.push(new O0({tagBuilder:a,matchedText:d,offset:u,serviceName:s,hashtag:h}))}}return l},t}(ho),DN=new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source+"|"+/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source,"g"),L0=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.matcherRegex=DN,e}return Dn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.tagBuilder,s=[];(r=i.exec(e))!==null;){var a=r[0],l=a.replace(/[^0-9,;#]/g,""),u=!(!r[1]&&!r[2]),c=r.index==0?"":e.substr(r.index-1,1),d=e.substr(r.index+a.length,1),h=!c.match(/\d/)&&!d.match(/\d/);this.testMatch(r[3])&&this.testMatch(a)&&h&&s.push(new N0({tagBuilder:o,matchedText:a,offset:r.index,number:l,plusSign:u}))}return s},t.prototype.testMatch=function(e){return vN.test(e)},t}(ho),kN=new RegExp("@[_"+Bt+"]{1,50}(?![_"+Bt+"])","g"),LN=new RegExp("@[_."+Bt+"]{1,30}(?![_"+Bt+"])","g"),xN=new RegExp("@[-_."+Bt+"]{1,50}(?![-_"+Bt+"])","g"),MN=new RegExp("[^"+Bt+"]"),x0=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegexes={twitter:kN,instagram:LN,soundcloud:xN},r.nonWordCharRegex=MN,r.serviceName=e.serviceName,r}return Dn(t,n),t.prototype.parseMatches=function(e){var r,i=this.serviceName,o=this.matcherRegexes[this.serviceName],s=this.nonWordCharRegex,a=this.tagBuilder,l=[];if(!o)return l;for(;(r=o.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||s.test(c)){var d=r[0].replace(/\.+$/g,""),h=d.slice(1);l.push(new S0({tagBuilder:a,matchedText:d,offset:u,serviceName:i,mention:h}))}}return l},t}(ho);function PN(n,t){for(var e,r=t.onOpenTag,i=t.onCloseTag,o=t.onText,s=t.onComment,a=t.onDoctype,l=new kn,u=0,c=n.length,d=0,h=0,p=l;u<c;){var f=n.charAt(u);switch(d){case 0:m(f);break;case 1:g(f);break;case 2:A(f);break;case 3:E(f);break;case 4:v(f);break;case 5:_(f);break;case 6:O(f);break;case 7:T(f);break;case 8:S(f);break;case 9:N(f);break;case 10:y(f);break;case 11:w(f);break;case 12:b(f);break;case 13:I();break;case 14:P(f);break;case 15:k(f);break;case 16:B(f);break;case 17:$(f);break;case 18:U(f);break;case 19:V(f);break;case 20:L(f);break;default:_0(d)}u++}function m(x){x==="<"&&j()}function g(x){x==="!"?d=13:x==="/"?(d=2,p=new kn(Lt(Lt({},p),{isClosing:!0}))):x==="<"?j():Ld.test(x)?(d=3,p=new kn(Lt(Lt({},p),{isOpening:!0}))):(d=0,p=l)}function E(x){hi.test(x)?(p=new kn(Lt(Lt({},p),{name:it()})),d=4):x==="<"?j():x==="/"?(p=new kn(Lt(Lt({},p),{name:it()})),d=12):x===">"?(p=new kn(Lt(Lt({},p),{name:it()})),tt()):Ld.test(x)||AN.test(x)||x===":"||Q()}function A(x){x===">"?Q():Ld.test(x)?d=3:Q()}function v(x){hi.test(x)||(x==="/"?d=12:x===">"?tt():x==="<"?j():x==="="||xd.test(x)||_N.test(x)?Q():d=5)}function _(x){hi.test(x)?d=6:x==="/"?d=12:x==="="?d=7:x===">"?tt():x==="<"?j():xd.test(x)&&Q()}function O(x){hi.test(x)||(x==="/"?d=12:x==="="?d=7:x===">"?tt():x==="<"?j():xd.test(x)?Q():d=5)}function T(x){hi.test(x)||(x==='"'?d=8:x==="'"?d=9:/[>=`]/.test(x)?Q():x==="<"?j():d=10)}function S(x){x==='"'&&(d=11)}function N(x){x==="'"&&(d=11)}function y(x){hi.test(x)?d=4:x===">"?tt():x==="<"&&j()}function w(x){hi.test(x)?d=4:x==="/"?d=12:x===">"?tt():x==="<"?j():(d=4,u--)}function b(x){x===">"?(p=new kn(Lt(Lt({},p),{isClosing:!0})),tt()):d=4}function I(x){n.substr(u,2)==="--"?(u+=2,p=new kn(Lt(Lt({},p),{type:"comment"})),d=14):n.substr(u,7).toUpperCase()==="DOCTYPE"?(u+=7,p=new kn(Lt(Lt({},p),{type:"doctype"})),d=20):Q()}function P(x){x==="-"?d=15:x===">"?Q():d=16}function k(x){x==="-"?d=18:x===">"?Q():d=16}function B(x){x==="-"&&(d=17)}function $(x){d=x==="-"?18:16}function U(x){x===">"?tt():x==="!"?d=19:x==="-"||(d=16)}function V(x){x==="-"?d=17:x===">"?tt():d=16}function L(x){x===">"?tt():x==="<"&&j()}function Q(){d=0,p=l}function j(){d=1,p=new kn({idx:u})}function tt(){var x=n.slice(h,p.idx);x&&o(x,h),p.type==="comment"?s(p.idx):p.type==="doctype"?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),Q(),h=u+1}function it(){var x=p.idx+(p.isClosing?2:1);return n.slice(x,u).toLowerCase()}h<u&&(e=n.slice(h,u),o(e,h),h=u+1)}var kn=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.type=n.type||"tag",this.name=n.name||"",this.isOpening=!!n.isOpening,this.isClosing=!!n.isClosing},BN=function(){function n(t){t===void 0&&(t={}),this.version=n.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email=typeof t.email=="boolean"?t.email:this.email,this.phone=typeof t.phone=="boolean"?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=typeof t.newWindow=="boolean"?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash=typeof t.stripTrailingSlash=="boolean"?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=typeof t.decodePercentEncoding=="boolean"?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var e=this.mention;if(e!==!1&&e!=="twitter"&&e!=="instagram"&&e!=="soundcloud")throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(r!==!1&&r!=="twitter"&&r!=="facebook"&&r!=="instagram")throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return n.link=function(t,e){return new n(e).link(t)},n.parse=function(t,e){return new n(e).parse(t)},n.prototype.normalizeUrlsCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:typeof t.schemeMatches!="boolean"||t.schemeMatches,wwwMatches:typeof t.wwwMatches!="boolean"||t.wwwMatches,tldMatches:typeof t.tldMatches!="boolean"||t.tldMatches}},n.prototype.normalizeStripPrefixCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{scheme:t,www:t}:{scheme:typeof t.scheme!="boolean"||t.scheme,www:typeof t.www!="boolean"||t.www}},n.prototype.normalizeTruncateCfg=function(t){return typeof t=="number"?{length:t,location:"end"}:function(e,r){for(var i in r)r.hasOwnProperty(i)&&e[i]===void 0&&(e[i]=r[i]);return e}(t||{},{length:Number.POSITIVE_INFINITY,location:"end"})},n.prototype.parse=function(t){var e=this,r=["a","style","script"],i=0,o=[];return PN(t,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=function(c,d){if(!d.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var h,p=[],f=0;h=d.exec(c);)p.push(c.substring(f,h.index)),p.push(h[0]),f=h.index+h[0].length;return p.push(c.substring(f)),p}(s,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),u=a;l.forEach(function(c,d){if(d%2==0){var h=e.parseText(c,u);o.push.apply(o,h)}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(s){},onDoctype:function(s){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},n.prototype.compactMatches=function(t){t.sort(function(l,u){return l.getOffset()-u.getOffset()});for(var e=0;e<t.length-1;e++){var r=t[e],i=r.getOffset(),o=r.getMatchedText().length,s=i+o;if(e+1<t.length){if(t[e+1].getOffset()===i){var a=t[e+1].getMatchedText().length>o?e:e+1;t.splice(a,1);continue}t[e+1].getOffset()<s&&t.splice(e+1,1)}}return t},n.prototype.removeUnwantedMatches=function(t){return this.hashtag||di(t,function(e){return e.getType()==="hashtag"}),this.email||di(t,function(e){return e.getType()==="email"}),this.phone||di(t,function(e){return e.getType()==="phone"}),this.mention||di(t,function(e){return e.getType()==="mention"}),this.urls.schemeMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="scheme"}),this.urls.wwwMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="www"}),this.urls.tldMatches||di(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="tld"}),t},n.prototype.parseText=function(t,e){e===void 0&&(e=0),e=e||0;for(var r=this.getMatchers(),i=[],o=0,s=r.length;o<s;o++){for(var a=r[o].parseMatches(t),l=0,u=a.length;l<u;l++)a[l].setOffset(e+a[l].getOffset());i.push.apply(i,a)}return i},n.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),r=[],i=0,o=0,s=e.length;o<s;o++){var a=e[o];r.push(t.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(t.substring(i)),r.join("")},n.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),typeof e=="string"?e:e===!1?t.getMatchedText():e instanceof wd?e.toAnchorString():t.buildTag().toAnchorString()},n.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var t=this.getTagBuilder(),e=[new k0({tagBuilder:t,serviceName:this.hashtag}),new R0({tagBuilder:t}),new L0({tagBuilder:t}),new x0({tagBuilder:t,serviceName:this.mention}),new D0({tagBuilder:t,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=e},n.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new y0({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},n.version="3.14.3",n.AnchorTagBuilder=y0,n.HtmlTag=wd,n.matcher={Email:R0,Hashtag:k0,Matcher:ho,Mention:x0,Phone:L0,Url:D0},n.match={Email:Dd,Hashtag:O0,Match:co,Mention:S0,Phone:N0,Url:kd},n}();function M0(n,t=n){return{type:"autolink",url:n,text:t}}const FN=ir(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([n,t,e])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(t),e)),UN=ir(/<!!customemoji:(.*?)>/gm,([n,t])=>function(e){return{type:"customemoji",text:e}}(t)),P0=ir(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([n,t,e])=>function(r,i=[]){return{type:"link",url:r,children:i}}(t,[e])),HN=ir(/<actionlink:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=B0(t);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[e])}),$N=ir(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=B0(t);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[e])});function B0(n){const t=n.indexOf("?");return t===-1?{action:n,params:{}}:{action:n.slice(0,t),params:Object.fromEntries(new URLSearchParams(n.slice(t)))}}const jN=ir(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([n])=>function(t=[]){return{type:"bulletlist",children:t}}([n.startsWith(`
83
83
  `)?n.slice(1):n])),YN=ir(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,([n,t])=>({type:"bulletpoint",children:[t]})),zN=n=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let e=0;const r=[];for(const i of Zu(n,t)){const o=i[0],s=i[1],a=o.startsWith(s)?i.index:i.index+1;a-e>0&&r.push(n.substring(e,a));const l=M0("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(l),e=a+s.length}return e<n.length&&r.push(n.substring(e)),r},VN=n=>P0(n).flatMap(t=>typeof t=="string"?Pd(t):["<",...Pd(t.url),...Pd("|"+t.children[0]+">")]),Pd=n=>{const t=BN.parse(n,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),e=[];let r=0;for(const i of t){const o=i.getOffset(),s=i.getMatchedText(),a=s.length;let l=s;i instanceof Dd?l="mailto:"+i.getEmail():i instanceof kd&&(l=i.getUrl()),o>r&&e.push(n.substring(r,o)),e.push(M0(l,s)),r=o+a}return r<n.length&&e.push(n.substring(r)),e},WN=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"];function GN(n={except:[]}){var r;const t={multilineSteps:[],singlelineSteps:[]},e=(r=n.except)!=null?r:WN.filter(i=>!n.only.includes(i));return e.includes("BulletPoint")||t.multilineSteps.push(jN,YN),e.includes("Mention")||t.singlelineSteps.push(FN),e.includes("CustomEmoji")||t.singlelineSteps.push(UN),e.includes("Codespan")||t.multilineSteps.push(ir(/```([^]+?)```/g,([i,o])=>({type:"codespan",text:g0(o)}))),e.includes("FormattedLink")||t.singlelineSteps.push(P0),e.includes("Actions")||(t.singlelineSteps.push(HN),t.singlelineSteps.push($N)),e.includes("Wikitext")||t.singlelineSteps.push(gN),e.includes("Autolink")||t.singlelineSteps.push(VN,zN),t}const XN=function(n){const t=RegExp(`[^${n}]+${n}?|${n}`,"g");return e=>Array.from(e.match(t)||[])}(`
84
- `);function F0(n,t={except:[]}){let e=function(r,i){let o=[r];return o=Bd(o,i.multilineSteps),o=Bd(o,[XN]),o=Bd(o,i.singlelineSteps),o=U0(o),o}(n,GN(t));return e=H0(e,!1),e}function Bd(n,t){return t.reduce((e,r)=>Ls(e,r),n)}function U0(n){const t=[];let e=-1;for(const r of n)typeof r=="string"?typeof t[e]=="string"?t[e]+=r:t[++e]=r:t[++e]="children"in r?{...r,children:U0(r.children)}:r;return t}function H0(n,t){const e=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i];typeof o=="string"?r.push(o):"children"in o?(r.length>0&&(e.push(r.join("")),r=[]),o.children=H0(o.children,t||o.type==="link"||o.type==="actionbutton"||o.type==="actionlink"),e.push(o)):o.type==="autolink"&&t?r.push(o.text):(r.length>0&&(e.push(r.join("")),r=[]),e.push(o))}return r.length>0&&(e.push(r.join("")),r=[]),e}function KN(){let n,t=0;return e=>{const r=(o=Date.now())=>{window.clearTimeout(n),n=void 0,t=o;const s=function(a){a=a.removeMark(0,a.doc.content.size,Jt.marks.bold),a=a.removeMark(0,a.doc.content.size,Jt.marks.italic),a=a.removeMark(0,a.doc.content.size,Jt.marks.strikethrough),a.doc.firstChild;const l=function(u){const c=[];let d,h="";return u.descendants((p,f)=>(p.isText?(h+=p.text,d!=null||(d=f)):h&&d!==void 0&&(c.push({text:h,pos:d}),h="",d=void 0),p.type!==Jt.nodes.mention)),h&&d!==void 0&&c.push({text:h,pos:d}),c}(a.doc);for(const{text:u,pos:c}of l){const d=F0(u,{only:["Wikitext"]});[a]=$0(a,c,d)}return a}(e.state.tr);e.dispatch(s)},i=Date.now();i-t<300?n||(n=window.setTimeout(r,300)):r(i)}}function $0(n,t,e,r=0,i=[]){for(const o of e)if(typeof o=="string"){for(const s of i)n.addMark(t+r,t+r+o.length,s.create());r+=o.length}else if(o.type==="bold"||o.type==="italic"||o.type==="strikethrough"){r+=1;const s=Jt.marks[o.type],a=[...i,s];[n,r]=$0(n,t,o.children,r,a),r+=1}else St.unreachable();return[n,r]}function j0(n){return(t,e)=>{if(!e)return!0;let r=t.tr;const i=vt.between(t.selection.$from,t.selection.$to);return r=r.replaceRangeWith(i.from,i.from,Jt.text(n,r.storedMarks)),r=r.replaceRangeWith(i.to+1,i.to+1,Jt.text(n,r.storedMarks)),r=r.setSelection(vt.near(r.doc.resolve(i.to+1))),e(r),!0}}function qN(n,t,e){const r=t.clipboardData;if(!r)return!1;const i=function(o){const s=o.items||[],a={"image/gif":"gif","image/png":"png","image/jpeg":"jpg","image/svg+xml":"svg"},l=Array.from(s).filter(d=>d.kind==="file"&&a[d.type]);if(l.length===0||o.types.includes("text/rtf"))return;const u=l[0];let c=u.getAsFile();if(!c.name){const d="image."+a[u.type];c=new File([c],d,{type:u.type,lastModified:Date.now()})}return c}(r);return i?e(i):function(o,s){const a=o.state.tr.insertText(s).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");o.dispatch(a)}(n,r.getData("text/plain")),!0}function JN(n,{allowSpaces:t=!1}){return e=>{const r=new RegExp(`\\s${n}$`),i=t?new RegExp(`${n}.*?(?=\\s${n}|$)`,"g"):new RegExp(`(?:^)?${n}[^\\s${n}]*`,"g"),o=e.before(),s=e.end(),a=e.doc.textBetween(o,s,"\0","\0");let l;for(;l=i.exec(a);){const u=l.input.slice(Math.max(0,l.index-1),l.index);if(!/^[\s\0]?$/.test(u))continue;const c=l.index+e.start();let d=c+l[0].length;if(t&&r.test(a.slice(d-1,d+1))&&(l[0]+=" ",d++),c<e.pos&&d>=e.pos)return{range:{from:c,to:d},text:l[0]}}}}function Y0({matcher:n=JN("#"),suggestionClass:t="ProseMirror-suggestion",onEnter:e=()=>!1,onChange:r=()=>!1,onExit:i=()=>!1,onKeyDown:o=()=>!1,debug:s=!1}){return new Ya({key:new za("suggestions"),view(){return{update:(a,l)=>{const u=this.key.getState(l),c=this.key.getState(a.state),d=u.active&&c.active&&u.range.from!==c.range.from,h=!u.active&&c.active,p=u.active&&!c.active,f=!h&&!p&&u.text!==c.text;(p||d)&&i({view:a,range:u.range,text:u.text}),f&&!d&&r({view:a,range:c.range,text:c.text}),(h||d)&&e({view:a,range:c.range,text:c.text})}}},state:{init:()=>({active:!1,range:{},text:null}),apply(a,l){const{selection:u}=a,c={...l};if(u.from===u.to){(u.from<l.range.from||u.from>l.range.to)&&(c.active=!1);const d=u.$from,h=n(d);h?(c.active=!0,c.range=h.range,c.text=h.text):c.active=!1}else c.active=!1;return c.active||(c.range={},c.text=null),c}},props:{handleKeyDown(a,l){const{active:u}=this.getState(a.state);return!!u&&o({view:a,event:l})},decorations(a){const{active:l,range:u}=this.getState(a);return l?Wt.create(a.doc,[Ye.inline(u.from,u.to,{nodeName:"span",class:t,style:s?"background: rgba(0, 0, 255, 0.05); color: blue; border: 2px solid blue;":null})]):null}}})}function ZN({placeholder:n,disabled:t,className:e="",characterLimit:r,spellcheck:i}){const o=Qo(),s=q(),a=q(null);return J(()=>(s.current=function(l,u,c,d,h){const p=no.create({schema:Jt,plugins:[...h.filter(QN),aN(),YE({...ol,"Mod-z":e0,"Mod-y":n0,"Mod-b":j0("*"),"Mod-i":j0("_"),"Mod-Enter":ol.Enter,"Shift-Enter":ol.Enter,Enter:c}),YE({Enter:ol.Enter}),UE]}),f=KN(),m=new K1(l,{handlePaste:(g,E,A)=>qN(g,E,d),clipboardTextSerializer(g){const E=[];return g.content.forEach(A=>{A&&E.push(g0(A.textContent))}),E.join()},state:p,dispatchTransaction(g){g=(g=g.removeStoredMark(Jt.marks.literal)).removeStoredMark(Jt.marks.emoji);const E=m.state.apply(g);m.state.doc.eq(E.doc)||u(new ul(E.doc)),m.updateState(E),g.steps.some(A=>A instanceof mn)&&setTimeout(()=>f(m),0)}});return m}(a.current,l=>o.onChange(l),()=>!!o.onEnter&&(o.onEnter(),!0),l=>o.onPasteImage(l),[o.emojiSuggesterPlugin(),o.mentionsPlugin()]),o.setEditorView(s.current),()=>{var l;o.setEditorView(void 0),(l=s.current)==null||l.destroy()}),[o]),J(()=>{var l;(l=s.current)==null||l.setProps({editable:()=>!t})},[t]),J(()=>us(()=>{var l,u,c;return(c=s.current)==null?void 0:c.setProps({attributes:{spellcheck:String((u=(l=o.spellcheck$.get())!=null?l:i)!=null?u:!1),class:"t-text-input","aria-label":"Message Field",role:"textbox"}})}),[o,i]),J(()=>us(()=>{var u;const l=s.current;l==null||l.dispatch(l.state.tr.setMeta(UE,(u=o.placeholder$.get())!=null?u:n))}),[o,n]),J(()=>{r&&Number.isInteger(r)&&o.setMaxLength(r)},[r,o]),C("div",{className:`t-editor ${e}`,ref:a})}function z0(n){if(n.startsWith(":"))throw new Error("Not implemented");{const t=Jt.marks.emoji.create({emoji:n});return Jt.text(n,[t])}}function V0(n,t){const e=encodeURIComponent(n);return Jt.nodes.mention.create({id:n,name:t},Jt.text(`<!!mention:${e}|${t}>`))}const yu=class yu{constructor(t){this.doc=t,this.size=this.doc.content.size,this.hasContent=HE(this.doc)}asText(){return this.doc.textContent.replace(/\xa0/g," ")}};yu.EMPTY=new yu(Jt.topNodeType.create());let ul=yu;function QN(n){return n!=null}const W0=/^\/.*[^\\]\/[im]*$/;function G0(n){return W0.test(n)?!cl(n).test(""):!1}function cl(n){const t=n.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${n} to be a (non-empty) regex`);let e=t[2]||"";return e=e.replace(/[^im]/g,"")+"g",new RegExp(t[1],e)}function tC(n,t){const e=function(i){{const o=document.createElement("a");return o.href=i,o.hostname}}(t),r=function(i){const o=i.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp("^"+o+"$","i")}(n);return e!==void 0&&r.test(e)}const eC=/^[]/g;function nC(n){return n.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function Fd(n,t){!n()&&!t&&(t=n.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}(n=>{function t(r){}function e(r,i){(function(o,s){switch(s){case"undefined":return o===void 0;case String:return typeof o=="string"||o instanceof String;case Boolean:return typeof o=="boolean"||o instanceof Boolean;case Number:return typeof o=="number"||o instanceof Number;default:return o instanceof s}})(r,i)||(i.name,String(r))}n.defined=t,n.has=function(r,i){r[i]},n.is=e,n.equals=function(r,i){},n.oneOf=function(r,i){i.includes(r)||JSON.stringify(i)},n.isArray=function(r,i){e(r,Array),r&&r.length>0&&e(r[0],i)},n.optional=function(r,i){r!==void 0&&e(r,i)},n.falsy=function(r){},n.never=function(r){}})(Fd||(Fd={}));const ho=Fd,rC=/\uFE0F/g,iC="‍";function oC(n){if(n===":arslan:")return"https://cdn.talkjs.com/__assets/5461191341cea882b3f227c085d5772c.gif";const t=function(r){const i=[];let o=0,s=0,a=0;for(;a<r.length;)o=r.charCodeAt(a++),s?(i.push((65536+(s-55296<<10)+(o-56320)).toString(16)),s=0):55296<=o&&o<=56319?s=o:i.push(o.toString(16));return i.join("-")}((e=n).indexOf(iC)<0?e.replace(rC,""):e);var e;return`https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/${t}.svg`}class sC{constructor({mode:t,allowedHostnames:e,allowedPhoneNrs:r,allowedMatches:i,forbiddenMatches:o,suppressLinks:s,suppressEmailAddresses:a,suppressPhoneNumbers:l,replacement:u}){ho.oneOf(t,["all","otherOnly","off"]),this.mode=t,this.suppressLinks=s!==!1,this.suppressEmailAddresses=a!==!1,this.suppressPhoneNumbers=l!==!1,this.allowedHostnames=e||[],this.allowedPhoneNrs=(r||[]).filter(c=>c).map(c=>c.replace(/[^0-9]/g,"")),this.allowedMatches=(i||[]).filter(G0).map(c=>cl(c)),this.forbiddenMatches=(o||[]).filter(G0).map(c=>cl(c)),ho(()=>this.allowedMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),ho(()=>this.forbiddenMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u==null?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:t}){return this.mode==="all"||this.mode==="otherOnly"&&!t}}function X0(n){var e,r,i,o,s,a,l,u,c,d,h,p,f;let t="";return n.t&&(t=`(${n.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:(e=n.formattedLinks)!=null?e:"plaintext",markup:(r=n.markup)!=null?r:!1,useFallbackMentions:(i=n.useFallbackMentions)!=null?i:!1,sameTabLinkRules:(o=n.sameTabLinkRules)!=null?o:[],enableEmojiImageFallback:(s=n.enableEmojiImageFallback)!=null?s:!1,highlight:(a=n.highlight)!=null?a:[],contactInfo:(l=n.contactInfo)!=null?l:!1,suppression:(u=n.suppression)!=null?u:new sC({mode:"off"}),contactInfoHiddenText:(h=(d=n.contactInfoHiddenText)!=null?d:(c=n.suppression)==null?void 0:c.replacement)!=null?h:t,customEmojiUrls:(p=n.customEmojiUrls)!=null?p:{},enableActions:(f=n.enableActions)!=null?f:!0}}class K0 extends Ym{constructor(){super(...arguments),this.conversationListSubscription=null,this.extCurrentConversationId$=Pt(null),this.conversationsArray$=Pt([]),this.conversationsMap$=Pt({})}listenForConversations(t){const e=t.subscribeConversations(r=>{ls(()=>{this.conversationsArray$.set(r);const i={};for(const o of r)i[o.id]=o;this.conversationsMap$.set(i)})});return this.conversationListSubscription=e,()=>{e.unsubscribe(),this.conversationListSubscription=null}}}function aC({id:n,text:t}){var i;const e=bt(),r=Et(()=>{var a;if(e instanceof K0)return;const o=e.state$.extCurrentConversationId.get(),s=o&&e.state$.participants.child(o).get();return(a=s==null?void 0:s.find(l=>l.user.id===n))==null?void 0:a.user});return C("span",{className:"t-mention","t-is-current-user":Et(e.extUserId$)===n?"":void 0,children:`@${(i=r==null?void 0:r.name)!=null?i:t}`})}function po(n,t){const e=n.flatMap(r=>{if(typeof r=="string")return Ud(r,t.highlight);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletpoint":case"bulletPoint":return lC(r,t);case"bulletlist":case"bulletList":return[pt("ul",null,...po(r.children,t))];case"autolink":case"autoLink":case"link":return cC(r,t);case"codeblock":case"codeBlock":return[C("code",{"data-language":r.language,children:Ud(r.text,t.highlight)})];case"codespan":case"codeSpan":return C("code",{children:Ud((i=r.text,i.replace(/^\s*\n/m,"").replace(/\n\s*$/m,"")),t.highlight)});case"mention":return ho.falsy(t.useFallbackMentions),C(aC,{id:r.id,text:r.text},r.id);case"suppressed":return[C("i",{children:t.contactInfoHiddenText})];case"emoji":return t.enableEmojiImageFallback?[C(uC,{unicode:r.text})]:[r.text];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return dC(r,t);case"customemoji":case"customEmoji":return r.text;default:ho.never(r)}var i});return e.every(r=>typeof r=="string")?[e.join("")]:e}function Ud(n,t){if(t.length===0)return[n];const e=function(i){const o=i.map(a=>a.trim()).filter(a=>a);if(o.length===0)return eC;const s=o.map(nC).join("|");return new RegExp(s,"gi")}(t),r=Zu(n,e).map(i=>({offset:i.index,matchedText:i[0]}));return function(i,o,s){let a=0;const l=[];for(const u of o)u.offset<a||(u.offset>a&&l.push(i.substring(a,u.offset)),l.push(...s(u)),a=u.offset+u.matchedText.length);return a<i.length&&l.push(i.substring(a)),l}(n,r,({matchedText:i})=>[C("span",{className:"highlighted-text",children:i})])}const lC=(n,t)=>[pt({bold:"strong",italic:"em",strikethrough:"del",blockquote:"blockquote",bulletpoint:"li",bulletPoint:"li"}[n.type],null,...po(n.children,t))];function uC({unicode:n}){const[t,e]=et(()=>n!==":arslan:");return J(()=>{t&&!$m(n)&&e(!1)},[]),t?C("span",{className:"t-emoji",children:n}):C("img",{className:"t-emoji",src:oC(n),alt:n})}const cC=(n,t)=>{const e="children"in n?n.children:[n.text];switch(t.formattedLinks){case"link":return[pt("a",{target:function(r,i){for(const o of r)if(W0.test(o)){if(cl(o).test(i))return"_top"}else if(tC(o,i))return"_top";return"_blank"}(t.sameTabLinkRules,n.url),href:n.url,rel:"noreferrer"},...po(e,t))];case"plaintext":case!1:return"children"in n&&n.children.every(r=>typeof r=="string")?[n.children.join("")]:[pt(Vt,null,...po(e,t))];default:ho.never(t.formattedLinks)}},dC=(n,t)=>t.enableActions?[pt("button",{"data-type":n.type,"data-action":n.action,"data-params":JSON.stringify(n.params),disabled:!0},...po(n.children,t))]:[null];function q0({block:n,nonInteractive:t,className:e=""}){const r=!t,i=function(o,s={}){return po(o,X0(s))}(n.children,{enableEmojiImageFallback:!0,formattedLinks:r?"link":"plaintext",enableActions:r});return pt("span",{className:`t-text ${e}`},...i)}function hC(n){const t=cn(),e=bt(),{className:r="",...i}=n,o=Et(()=>e.state$.messages.child(e.state$.extCurrentConversationId.get()).lookup.child(n.message.id).content.child(0).url.get());return C("div",{className:`t-message-content ${r}`,children:n.message.content.map(s=>{var a;return C(pC,{block:s,theme:t,downloadUrl:o,...i},n.message.createdAt+((a=n.message.editedAt)!=null?a:0))})})}function pC({common:n,block:t,message:e,theme:r,downloadUrl:i}){const o=function(s,a){switch(a.type){case"text":return s.TextBlock;case"location":return s.LocationBlock;case"file":switch(a.subtype){case"image":return s.ImageBlock;case"video":return s.VideoBlock;case"voice":return s.VoiceBlock;case"audio":return s.AudioBlock;default:return s.FileBlock}default:St.never(a)}}(r,t);return C(o,{block:t,common:n,message:e,downloadUrl:i})}function dl(n,t,e=!0){const r=rt(o=>{o.keyCode===27&&n()},[n]),i=rt(o=>{o.target instanceof HTMLElement&&o.target.closest(t)===null&&n()},[t,n]);J(()=>{if(e)return window.addEventListener("keydown",r,!0),document.addEventListener("mousedown",i,!0),()=>{window.removeEventListener("keydown",r,!0),document.removeEventListener("mousedown",i,!0)}},[r,i,e])}function J0(n){const[t,e]=et();return J(()=>{let r=!0;return n().then(i=>{r&&e({value:i})}),()=>{r=!1}},[n]),t}function Hd(){return C(Pa,{type:"spinner","aria-label":Et(bt().t$).LOADING,className:"t-loading-icon"})}const fC="https://cdn.jsdelivr.net/npm/emoji-picker-element@1.26.3/+esm",$d=function(n){let t;return()=>(t===void 0&&(t={value:n()}),t.value)}(async function(){if(typeof window=="undefined"||window.document===void 0)return new Promise(()=>{});try{const n=await import(fC);return await new n.Database().ready(),n}catch(n){return vc.error("Failed to load emoji picker:",n),new Promise(()=>{})}});function Z0(n){const{onClose:t,onEmojiSelected:e}=IO(),r=q(null),i=J0($d);return J(()=>{if(!i)return;St.defined(r.current);const o=r.current,s=o.shadowRoot;(function(u,c){const d=document.createElement("style");d.textContent=c,u.appendChild(d)})(s,".search-row{margin-right:var(--emoji-padding)}.emoji-menu{grid-template-columns:repeat(auto-fill,var(--total-emoji-size));padding:var(--emoji-padding)}.emoji,button.emoji{border-radius:8px}.favorites{border-top-width:1px}input.search:focus{border-color:var(--input-focused-border-color);outline:0}.picker{container-type:size}@container (height < 300px){.favorites{display:none}}#skintone-button{margin:0 -3px 0 4px}.custom-emoji{padding:0}#emo-🏻,#emo-🏼,#emo-🏽,#emo-🏾,#emo-🏿{display:none}[data-has-mouse] .emoji:hover{background-color:var(--button-hover-background)}");const a=u=>{var d;const c=(d=u.detail.unicode)!=null?d:u.detail.name;e(c)};function l(u){u.pointerType==="mouse"&&(s.querySelector("section").dataset.hasMouse="true")}return o.addEventListener("emoji-click",a),o.addEventListener("pointermove",l,{once:!0}),()=>{o.removeEventListener("emoji-click",a),o.removeEventListener("pointermove",l)}},[i,e]),J(()=>{var o;i&&r.current&&((o=r.current.shadowRoot.getElementById("search"))==null||o.focus())},[i]),dl(()=>t(),".t-emoji-picker"),C("div",i?{className:"t-emoji-picker",children:C("emoji-picker",{ref:r,class:n.colorScheme})}:{className:"t-emoji-picker","t-loading":"",children:C(Hd,{})})}function mC(n){const{messageId:t,colorScheme:e,...r}=n,{closePopover:i}=RO(),o=$i();return C("div",{...r,children:C(Jf.Provider,{value:{onClose:i,onEmojiSelected:s=>{o.addReaction(t,s),i()}},children:C(Z0,{colorScheme:e})})})}function jd(){return jd=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},jd.apply(this,arguments)}function Q0(n,t){if(n==null)return{};var e,r,i={},o=Object.keys(n);for(r=0;r<o.length;r++)e=o[r],t.indexOf(e)>=0||(i[e]=n[e]);return i}function Yd(n,t){return Yd=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},Yd(n,t)}function tA(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n,Yd(n,t)}function eA(){}function nA(){}nA.resetWarningCache=eA;function rA(n,t){return n.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}(function(){function n(r,i,o,s,a,l){if(l!=="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return n}n.isRequired=n;var e={array:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:t,element:n,elementType:n,instanceOf:t,node:n,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:nA,resetWarningCache:eA};e.PropTypes=e})();const iA=!1,oA=Ot.createContext(null);var xs="unmounted",pi="exited",fi="entering",fo="entered",zd="exiting",or=function(n){function t(r,i){var o;o=n.call(this,r,i)||this;var s,a=i&&!i.isMounting?r.enter:r.appear;return o.appearStatus=null,r.in?a?(s=pi,o.appearStatus=fi):s=fo:s=r.unmountOnExit||r.mountOnEnter?xs:pi,o.state={status:s},o.nextCallback=null,o}tA(t,n),t.getDerivedStateFromProps=function(r,i){return r.in&&i.status===xs?{status:pi}:null};var e=t.prototype;return e.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},e.componentDidUpdate=function(r){var i=null;if(r!==this.props){var o=this.state.status;this.props.in?o!==fi&&o!==fo&&(i=fi):o!==fi&&o!==fo||(i=zd)}this.updateStatus(!1,i)},e.componentWillUnmount=function(){this.cancelNextCallback()},e.getTimeouts=function(){var r,i,o,s=this.props.timeout;return r=i=o=s,s!=null&&typeof s!="number"&&(r=s.exit,i=s.enter,o=s.appear!==void 0?s.appear:i),{exit:r,enter:i,appear:o}},e.updateStatus=function(r,i){r===void 0&&(r=!1),i!==null?(this.cancelNextCallback(),i===fi?this.performEnter(r):this.performExit()):this.props.unmountOnExit&&this.state.status===pi&&this.setState({status:xs})},e.performEnter=function(r){var i=this,o=this.props.enter,s=this.context?this.context.isMounting:r,a=this.props.nodeRef?[s]:[Ot.findDOMNode(this),s],l=a[0],u=a[1],c=this.getTimeouts(),d=s?c.appear:c.enter;!r&&!o||iA?this.safeSetState({status:fo},function(){i.props.onEntered(l)}):(this.props.onEnter(l,u),this.safeSetState({status:fi},function(){i.props.onEntering(l,u),i.onTransitionEnd(d,function(){i.safeSetState({status:fo},function(){i.props.onEntered(l,u)})})}))},e.performExit=function(){var r=this,i=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:Ot.findDOMNode(this);i&&!iA?(this.props.onExit(s),this.safeSetState({status:zd},function(){r.props.onExiting(s),r.onTransitionEnd(o.exit,function(){r.safeSetState({status:pi},function(){r.props.onExited(s)})})})):this.safeSetState({status:pi},function(){r.props.onExited(s)})},e.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},e.safeSetState=function(r,i){i=this.setNextCallback(i),this.setState(r,i)},e.setNextCallback=function(r){var i=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,i.nextCallback=null,r(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},e.onTransitionEnd=function(r,i){this.setNextCallback(i);var o=this.props.nodeRef?this.props.nodeRef.current:Ot.findDOMNode(this),s=r==null&&!this.props.addEndListener;if(o&&!s){if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],l=a[0],u=a[1];this.props.addEndListener(l,u)}r!=null&&setTimeout(this.nextCallback,r)}else setTimeout(this.nextCallback,0)},e.render=function(){var r=this.state.status;if(r===xs)return null;var i=this.props,o=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var s=Q0(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ot.createElement(oA.Provider,{value:null},typeof o=="function"?o(r,s):Ot.cloneElement(Ot.Children.only(o),s))},t}(Ot.Component);function mo(){}or.contextType=oA,or.propTypes={},or.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:mo,onEntering:mo,onEntered:mo,onExit:mo,onExiting:mo,onExited:mo},or.UNMOUNTED=xs,or.EXITED=pi,or.ENTERING=fi,or.ENTERED=fo,or.EXITING=zd;var Vd=function(n,t){return n&&t&&t.split(" ").forEach(function(e){return i=e,void((r=n).classList?r.classList.remove(i):typeof r.className=="string"?r.className=rA(r.className,i):r.setAttribute("class",rA(r.className&&r.className.baseVal||"",i)));var r,i})},Wd=function(n){function t(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return(r=n.call.apply(n,[this].concat(o))||this).appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1];r.removeClasses(c,"exit"),r.addClass(c,d?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(a,l)},r.onEntering=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1]?"appear":"enter";r.addClass(c,d,"active"),r.props.onEntering&&r.props.onEntering(a,l)},r.onEntered=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1]?"appear":"enter";r.removeClasses(c,d),r.addClass(c,d,"done"),r.props.onEntered&&r.props.onEntered(a,l)},r.onExit=function(a){var l=r.resolveArguments(a)[0];r.removeClasses(l,"appear"),r.removeClasses(l,"enter"),r.addClass(l,"exit","base"),r.props.onExit&&r.props.onExit(a)},r.onExiting=function(a){var l=r.resolveArguments(a)[0];r.addClass(l,"exit","active"),r.props.onExiting&&r.props.onExiting(a)},r.onExited=function(a){var l=r.resolveArguments(a)[0];r.removeClasses(l,"exit"),r.addClass(l,"exit","done"),r.props.onExited&&r.props.onExited(a)},r.resolveArguments=function(a,l){return r.props.nodeRef?[r.props.nodeRef.current,a]:[a,l]},r.getClassNames=function(a){var l=r.props.classNames,u=typeof l=="string",c=u?(u&&l?l+"-":"")+a:l[a];return{baseClassName:c,activeClassName:u?c+"-active":l[a+"Active"],doneClassName:u?c+"-done":l[a+"Done"]}},r}tA(t,n);var e=t.prototype;return e.addClass=function(r,i,o){var s=this.getClassNames(i)[o+"ClassName"],a=this.getClassNames("enter").doneClassName;i==="appear"&&o==="done"&&a&&(s+=" "+a),o==="active"&&r&&r.scrollTop,s&&(this.appliedClasses[i][o]=s,function(l,u){l&&u&&u.split(" ").forEach(function(c){return h=c,void((d=l).classList?d.classList.add(h):function(p,f){return p.classList?!!f&&p.classList.contains(f):(" "+(p.className.baseVal||p.className)+" ").indexOf(" "+f+" ")!==-1}(d,h)||(typeof d.className=="string"?d.className=d.className+" "+h:d.setAttribute("class",(d.className&&d.className.baseVal||"")+" "+h)));var d,h})}(r,s))},e.removeClasses=function(r,i){var o=this.appliedClasses[i],s=o.base,a=o.active,l=o.done;this.appliedClasses[i]={},s&&Vd(r,s),a&&Vd(r,a),l&&Vd(r,l)},e.render=function(){var r=this.props;r.classNames;var i=Q0(r,["classNames"]);return Ot.createElement(or,jd({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(Ot.Component);Wd.defaultProps={classNames:""},Wd.propTypes={};const gC={ltr:["ArrowLeft","ArrowRight"],rtl:["ArrowRight","ArrowLeft"],ttb:["ArrowUp","ArrowDown"]};function sA(n,{focused:t,setFocused:e,itemCount:r,dir:i,onConfirm:o,onSpace:s}){if(r===0)return!1;const a=c=>{var d,h,p;d=0,h=c,p=r-1,c=Math.max(d,Math.min(h,p)),e(c)},[l,u]=gC[i];switch(n){case l:return a(t-1),!0;case u:return a(t+1),!0;case" ":return!!s&&s();case"Enter":case"Tab":return o(),!0}return!1}function aA({focused:n,setFocused:t,buttonId:e}){he(()=>{var a;const s=e(n);s&&((a=document.getElementById(s))==null||a.scrollIntoView({block:"nearest"}))},[n,e]);const r=rt(s=>{const a=s.currentTarget.dataset.index;t(+a)},[t]),i=lt(()=>({role:"menu","aria-activedescendant":e(n)}),[n,e]),o=rt(s=>({onMouseMove:r,id:e(s),"data-index":s}),[r,e]);return{containerProps:i,itemProps:o}}function EC(n){const[t,e]=et([]),[r,i]=et([]),[o,s]=et(0),[a,l]=et(0),u=J0($d),c=lt(()=>u&&new u.value.Database({}),[u]),d=Qo(),h=Et(d.state$.suggestEmojiQuery);J(()=>{c&&(h?async function(){const A=await c.getPreferredSkinTone();l(A);let v=await c.getEmojiBySearchQuery(h);if(v=v.filter(_=>_.url||function(O){return O.version<=jm&&!vC.includes(O.unicode)}(_)),function(_,O){O.sort((T,S)=>{var I,R;const N=(I=T.shortcodes)==null?void 0:I.find(b=>b.startsWith(_)),y=(R=S.shortcodes)==null?void 0:R.find(b=>b.startsWith(_));return N&&!y?-1:!N&&y?1:N&&y?N.length-y.length:0})}(h.substring(1),v),s(0),e(v),v.length>0&&i(v),h.endsWith(":")){const _=h.slice(1,-1),O=v.find(T=>{var S;return(S=T.shortcodes)==null?void 0:S.includes(_)});O&&d.selectEmoji(Ms(O,A))}}():e([]))},[h,d,c]);const p=rt(A=>{const v=t[A];return v&&"emoji-button-"+Ms(v,a)},[t,a]),{containerProps:f,itemProps:m}=aA({focused:o,setFocused:s,buttonId:p}),g=t.length>0;dl(()=>d.closeSuggester(),".t-emoji-suggest-bar",g),J(()=>{if(g)return d.listenKeydown("emoji",A=>sA(A,{dir:"ltr",focused:o,setFocused:s,itemCount:t.length,onConfirm(){const v=t[o];St.defined(v),d.selectEmoji(Ms(v,a))}})),()=>{d.listenKeydown("emoji",void 0)};d.listenKeydown("emoji",void 0)},[d,t,o,g,a]);const E=q(null);return C(Wd,{in:g,timeout:100,classNames:"slide",mountOnEnter:!0,unmountOnExit:!0,nodeRef:E,children:C("div",{className:"t-emoji-suggest-bar",ref:E,...f,children:r.map((A,v)=>C(AC,{emoji:A,skinTone:a,focused:v===o,onSelect:_=>d.selectEmoji(_),...m(v)},Ms(A,a)))})})}function Ms(n,t){return Gd(n)?lA(n,t):n.name}function Gd(n){return!!n.unicode}function AC(n){var l;const{emoji:t,focused:e,skinTone:r,onSelect:i,...o}=n,s=((l=t.shortcodes)!=null?l:[]).join(", "),a=Gd(t)?[t.unicode,s].join(", "):s;return C("button",{"t-focused":e?"":void 0,title:s,"aria-label":a,onClick:()=>i(Ms(t,r)),...o,children:Gd(t)?lA(t,r):null})}function lA(n,t){var r,i;const e=(r=n.skins)==null?void 0:r.find(o=>o.tone===t);return(i=e==null?void 0:e.unicode)!=null?i:n.unicode}const vC=["🏻","🏼","🏽","🏾","🏿"],uA=Math.min,Ps=Math.max,hl=Math.round,Ln=n=>({x:n,y:n});function cA(n){return n.split("-")[0]}const _C=new Set(["top","bottom"]);function dA(n){return _C.has(cA(n))?"y":"x"}function hA(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function pA(n,t,e){let{reference:r,floating:i}=n;const o=dA(t),s=function(f){return dA(f)==="x"?"y":"x"}(t),a=s==="y"?"height":"width",l=cA(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(function(f){return f.split("-")[1]}(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}function pl(){return typeof window!="undefined"}function go(n){return fA(n)?(n.nodeName||"").toLowerCase():"#document"}function Ve(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function sr(n){var t;return(t=(fA(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function fA(n){return!!pl()&&(n instanceof Node||n instanceof Ve(n).Node)}function gn(n){return!!pl()&&(n instanceof Element||n instanceof Ve(n).Element)}function xn(n){return!!pl()&&(n instanceof HTMLElement||n instanceof Ve(n).HTMLElement)}function mA(n){return!(!pl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ve(n).ShadowRoot)}const yC=new Set(["inline","contents"]);function Bs(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=En(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!yC.has(i)}const TC=new Set(["table","td","th"]);function OC(n){return TC.has(go(n))}const SC=[":popover-open",":modal"];function fl(n){return SC.some(t=>{try{return n.matches(t)}catch(e){return!1}})}const NC=["transform","translate","scale","rotate","perspective"],CC=["transform","translate","scale","rotate","perspective","filter"],bC=["paint","layout","strict","content"];function Xd(n){const t=Kd(),e=gn(n)?En(n):n;return NC.some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||CC.some(r=>(e.willChange||"").includes(r))||bC.some(r=>(e.contain||"").includes(r))}function Kd(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const IC=new Set(["html","body","#document"]);function Eo(n){return IC.has(go(n))}function En(n){return Ve(n).getComputedStyle(n)}function ml(n){return gn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Dr(n){if(go(n)==="html")return n;const t=n.assignedSlot||n.parentNode||mA(n)&&n.host||sr(n);return mA(t)?t.host:t}function gA(n){const t=Dr(n);return Eo(t)?n.ownerDocument?n.ownerDocument.body:n.body:xn(t)&&Bs(t)?t:gA(t)}function qd(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=gA(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ve(i);if(o){const a=Jd(s);return t.concat(s,s.visualViewport||[],Bs(i)?i:[],a&&e?qd(a):[])}return t.concat(i,qd(i,[],e))}function Jd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function EA(n){const t=En(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=xn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=hl(e)!==o||hl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function AA(n){return gn(n)?n:n.contextElement}function Ao(n){const t=AA(n);if(!xn(t))return Ln(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=EA(t);let s=(o?hl(e.width):e.width)/r,a=(o?hl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const wC=Ln(0);function vA(n){const t=Ve(n);return Kd()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:wC}function Fs(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=AA(n);let s=Ln(1);t&&(r?gn(r)&&(s=Ao(r)):s=Ao(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ve(h))&&p}(o,e,r)?vA(o):Ln(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ve(o),p=r&&gn(r)?Ve(r):r;let f=h,m=Jd(f);for(;m&&r&&p!==f;){const g=Ao(m),E=m.getBoundingClientRect(),A=En(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ve(m),m=Jd(f)}}return hA({width:c,height:d,x:l,y:u})}function gl(n,t){const e=ml(n).scrollLeft;return t?t.left+e:Fs(sr(n)).left+e}function _A(n,t){const e=n.getBoundingClientRect();return{x:e.left+t.scrollLeft-gl(n,e),y:e.top+t.scrollTop}}const RC=new Set(["absolute","fixed"]);function yA(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ve(i),a=sr(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const f=Kd();(!f||f&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}const p=gl(a);if(p<=0){const f=a.ownerDocument,m=f.body,g=getComputedStyle(m),E=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,A=Math.abs(a.clientWidth-m.clientWidth-E);A<=25&&(u-=A)}else p<=25&&(u+=p);return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=sr(i),s=ml(i),a=i.ownerDocument.body,l=Ps(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=Ps(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+gl(i);const d=-s.scrollTop;return En(a).direction==="rtl"&&(c+=Ps(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}(sr(n));else if(gn(t))r=function(i,o){const s=Fs(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=xn(i)?Ao(i):Ln(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=vA(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return hA(r)}function TA(n,t){const e=Dr(n);return!(e===t||!gn(e)||Eo(e))&&(En(e).position==="fixed"||TA(e,t))}function DC(n,t,e){const r=xn(t),i=sr(t),o=e==="fixed",s=Fs(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ln(0);function u(){l.x=gl(i)}if(r||!r&&!o)if((go(t)!=="body"||Bs(i))&&(a=ml(t)),r){const d=Fs(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Ln(0):_A(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Zd(n){return En(n).position==="static"}function OA(n,t){if(!xn(n)||En(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return sr(n)===e&&(e=e.ownerDocument.body),e}function SA(n,t){const e=Ve(n);if(fl(n))return e;if(!xn(n)){let i=Dr(n);for(;i&&!Eo(i);){if(gn(i)&&!Zd(i))return i;i=Dr(i)}return e}let r=OA(n,t);for(;r&&OC(r)&&Zd(r);)r=OA(r,t);return r&&Eo(r)&&Zd(r)&&!Xd(r)?e:r||function(i){let o=Dr(i);for(;xn(o)&&!Eo(o);){if(Xd(o))return o;if(fl(o))return null;o=Dr(o)}return null}(n)||e}const kC={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=sr(r),a=!!t&&fl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Ln(1);const c=Ln(0),d=xn(r);if((d||!d&&!o)&&((go(r)!=="body"||Bs(s))&&(l=ml(r)),xn(r))){const p=Fs(r);u=Ao(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Ln(0):_A(s,l);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:sr,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?fl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=qd(u,[],!1).filter(g=>gn(g)&&go(g)!=="body"),p=null;const f=En(u).position==="fixed";let m=f?Dr(u):u;for(;gn(m)&&!Eo(m);){const g=En(m),E=Xd(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&RC.has(p.position)||Bs(m)&&!E&&TA(u,m))?h=h.filter(A=>A!==m):p=g,m=Dr(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=yA(t,c,i);return u.top=Ps(d.top,u.top),u.right=uA(d.right,u.right),u.bottom=uA(d.bottom,u.bottom),u.left=Ps(d.left,u.left),u},yA(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:SA,getElementRects:async function(n){const t=this.getOffsetParent||SA,e=this.getDimensions,r=await e(n.floating);return{reference:DC(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=EA(n);return{width:t,height:e}},getScale:Ao,isElement:gn,isRTL:function(n){return En(n).direction==="rtl"}},LC=(n,t,e)=>{const r=new Map,i={platform:kC,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=pA(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:I,reset:R}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...I}},R&&_<=50&&(_++,typeof R=="object"&&(R.placement&&(A=R.placement),R.rects&&(m=R.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):R.rects),{x:g,y:E}=pA(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var El=typeof document!="undefined"?he:function(){};function Al(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!Al(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!Al(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function NA(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function CA(n,t){const e=NA(n);return Math.round(t*e)/e}function Qd(n){const t=q(n);return El(()=>{t.current=n}),t}function xC(n){const{anchorSelector:t,children:e,...r}=n,i=lt(()=>document.querySelector(t),[t]),{refs:o,floatingStyles:s}=function(a){a===void 0&&(a={});const{placement:l="bottom",strategy:u="absolute",middleware:c=[],platform:d,elements:{reference:h,floating:p}={},transform:f=!0,whileElementsMounted:m,open:g}=a,[E,A]=et({x:0,y:0,strategy:u,placement:l,middlewareData:{},isPositioned:!1}),[v,_]=et(c);Al(v,c)||_(c);const[O,T]=et(null),[S,N]=et(null),y=rt(V=>{V!==L.current&&(L.current=V,T(V))},[]),I=rt(V=>{V!==k.current&&(k.current=V,N(V))},[]),R=h||O,b=p||S,L=q(null),k=q(null),B=q(E),j=m!=null,$=Qd(m),W=Qd(d),x=Qd(g),Q=rt(()=>{if(!L.current||!k.current)return;const V={placement:l,strategy:u,middleware:v};W.current&&(V.platform=W.current),LC(L.current,k.current,V).then(it=>{const ut={...it,isPositioned:x.current!==!1};H.current&&!Al(B.current,ut)&&(B.current=ut,Hi(()=>{A(ut)}))})},[v,l,u,W,x]);El(()=>{g===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,A(V=>({...V,isPositioned:!1})))},[g]);const H=q(!1);El(()=>(H.current=!0,()=>{H.current=!1}),[]),El(()=>{if(R&&(L.current=R),b&&(k.current=b),R&&b){if($.current)return $.current(R,b,Q);Q()}},[R,b,Q,$,j]);const nt=lt(()=>({reference:L,floating:k,setReference:y,setFloating:I}),[y,I]),ot=lt(()=>({reference:R,floating:b}),[R,b]),P=lt(()=>{const V={position:u,left:0,top:0};if(!ot.floating)return V;const it=CA(ot.floating,E.x),ut=CA(ot.floating,E.y);return f?{...V,transform:"translate("+it+"px, "+ut+"px)",...NA(ot.floating)>=1.5&&{willChange:"transform"}}:{position:u,left:it,top:ut}},[u,f,ot.floating,E.x,E.y]);return lt(()=>({...E,update:Q,refs:nt,elements:ot,floatingStyles:P}),[E,Q,nt,ot,P])}({placement:"top-start"});return he(()=>{i&&o.setReference(i)},[o,i]),C("div",{ref:o.setFloating,style:{...s,zIndex:1e3},...r,children:e})}function MC(n){const t=bt(),e=Et(()=>t.mentionableUsers$.get()),[r,i]=et(0),o=Qo(),s=Et(o.state$.suggestMentionQuery),a=lt(()=>Object.fromEntries(e.map(p=>[p.id,vO(p.name)])),[e]),l=lt(()=>{if(!s)return[];const p=bA(s);return p===""?e:e.filter(f=>a[f.id].some(m=>function(g,E){return Uf(g.substring(0,E.length),E)}(m,p)))},[s,e,a]),u=q(void 0);J(()=>{if(u.current){const p=l.findIndex(f=>f.id===u.current);i(p===-1?0:p)}},[l]),J(()=>{var p;u.current=(p=l[r])==null?void 0:p.id},[r,l]);const c=rt(p=>{var m;const f=(m=l[p])==null?void 0:m.id;return f&&"mention-button-"+f},[l]),{containerProps:d,itemProps:h}=aA({focused:r,setFocused:i,buttonId:c});return J(()=>{if(l.length!==0)return o.listenKeydown("mention",p=>sA(p,{dir:"ttb",focused:r,setFocused:i,itemCount:l.length,onSpace(){if(s){const f=l[r];if(Uf(f.name,bA(s)))return o.selectMention(f),!0}return!1},onConfirm(){const f=l[r];o.selectMention(f)}})),()=>{o.listenKeydown("mention",void 0)}},[o,r,l,s]),dl(()=>o.closeSuggester(),".t-mention-suggest-list",l.length>0),l.length===0?null:C(xC,{className:"t-mention-suggest-list",...d,anchorSelector:".ProseMirror-suggestion",children:l.map((p,f)=>C(PC,{user:p,isFocused:f===r,onSelect:()=>o.selectMention(p),...h(f)},p.id))})}const PC=Ot.memo(function(n){const{user:t,isFocused:e,onSelect:r,...i}=n;return C("button",{className:e?"focused":"",onClick:()=>r(t.id),...i,children:t.name})});function bA(n){return St(n[0]==="@"),n.substring(1)}function Us(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function IA(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function vl(...n){return t=>{let e=!1;const r=n.map(i=>{const o=IA(i,t);return e||typeof o!="function"||(e=!0),o});if(e)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():IA(n[i],null)}}}}function Ft(...n){return rt(vl(...n),n)}function mi(n,t=[]){let e=[];const r=()=>{const i=e.map(o=>nn(o));return function(o){const s=(o==null?void 0:o[n])||i;return lt(()=>({[`__scope${n}`]:{...o,[n]:s}}),[o,s])}};return r.scopeName=n,[function(i,o){const s=nn(o),a=e.length;e=[...e,o];const l=u=>{var m;const{scope:c,children:d,...h}=u,p=((m=c==null?void 0:c[n])==null?void 0:m[a])||s,f=lt(()=>h,Object.values(h));return C(p.Provider,{value:f,children:d})};return l.displayName=i+"Provider",[l,function(u,c){var h;const d=Re(((h=c==null?void 0:c[n])==null?void 0:h[a])||s);if(d)return d;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}]},BC(r,...t)]}function BC(...n){const t=n[0];if(n.length===1)return t;const e=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(i){const o=r.reduce((s,{useScope:a,scopeName:l})=>({...s,...a(i)[`__scope${l}`]}),{});return lt(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return e.scopeName=t.scopeName,e}function th(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Hs(n){const t=FC(n),e=tt((r,i)=>{const{children:o,...s}=r,a=Cn.toArray(o),l=a.find(HC);if(l){const u=l.props.children,c=a.map(d=>d===l?Cn.count(u)>1?Cn.only(null):qn(u)?u.props.children:null:d);return C(t,{...s,ref:i,children:qn(u)?zr(u,void 0,c):null})}return C(t,{...s,ref:i,children:o})});return e.displayName=`${n}.Slot`,e}function FC(n){const t=tt((e,r)=>{const{children:i,...o}=e;if(qn(i)){const s=function(l){var d,h;let u=(d=Object.getOwnPropertyDescriptor(l.props,"ref"))==null?void 0:d.get,c=u&&"isReactWarning"in u&&u.isReactWarning;return c?l.ref:(u=(h=Object.getOwnPropertyDescriptor(l,"ref"))==null?void 0:h.get,c=u&&"isReactWarning"in u&&u.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}(i),a=function(l,u){const c={...u};for(const d in u){const h=l[d],p=u[d];/^on[A-Z]/.test(d)?h&&p?c[d]=(...f)=>{const m=p(...f);return h(...f),m}:h&&(c[d]=h):d==="style"?c[d]={...h,...p}:d==="className"&&(c[d]=[h,p].filter(Boolean).join(" "))}return{...l,...c}}(o,i.props);return i.type!==Vt&&(a.ref=r?vl(r,s):s),zr(i,a)}return Cn.count(i)>1?Cn.only(null):null});return t.displayName=`${n}.SlotClone`,t}var UC=Symbol("radix.slottable");function HC(n){return qn(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===UC}var Xt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((n,t)=>{const e=Hs(`Primitive.${t}`),r=tt((i,o)=>{const{asChild:s,...a}=i,l=s?e:t;return typeof window!="undefined"&&(window[Symbol.for("radix-ui")]=!0),C(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...n,[t]:r}},{});function eh(n,t){n&&Hi(()=>n.dispatchEvent(t))}function sn(n){const t=q(n);return J(()=>{t.current=n}),lt(()=>(...e)=>{var r;return(r=t.current)==null?void 0:r.call(t,...e)},[])}function wA(n,t=globalThis==null?void 0:globalThis.document){const e=sn(n);J(()=>{const r=i=>{i.key==="Escape"&&e(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[e,t])}var RA,nh="dismissableLayer.update",$C="dismissableLayer.pointerDownOutside",jC="dismissableLayer.focusOutside",DA=nn({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kA=tt((n,t)=>{var S;const{disableOutsidePointerEvents:e=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=n,u=Re(DA),[c,d]=et(null),h=(S=c==null?void 0:c.ownerDocument)!=null?S:globalThis==null?void 0:globalThis.document,[,p]=et({}),f=Ft(t,N=>d(N)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(g),A=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,_=A>=E,O=function(N,y=globalThis==null?void 0:globalThis.document){const I=sn(N),R=q(!1),b=q(()=>{});return J(()=>{const L=B=>{if(B.target&&!R.current){let j=function(){xA($C,I,$,{discrete:!0})};const $={originalEvent:B};B.pointerType==="touch"?(y.removeEventListener("click",b.current),b.current=j,y.addEventListener("click",b.current,{once:!0})):j()}else y.removeEventListener("click",b.current);R.current=!1},k=window.setTimeout(()=>{y.addEventListener("pointerdown",L)},0);return()=>{window.clearTimeout(k),y.removeEventListener("pointerdown",L),y.removeEventListener("click",b.current)}},[y,I]),{onPointerDownCapture:()=>R.current=!0}}(N=>{const y=N.target,I=[...u.branches].some(R=>R.contains(y));_&&!I&&(i==null||i(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h),T=function(N,y=globalThis==null?void 0:globalThis.document){const I=sn(N),R=q(!1);return J(()=>{const b=L=>{L.target&&!R.current&&xA(jC,I,{originalEvent:L},{discrete:!1})};return y.addEventListener("focusin",b),()=>y.removeEventListener("focusin",b)},[y,I]),{onFocusCapture:()=>R.current=!0,onBlurCapture:()=>R.current=!1}}(N=>{const y=N.target;[...u.branches].some(I=>I.contains(y))||(o==null||o(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h);return wA(N=>{A===u.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),J(()=>{if(c)return e&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(RA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),LA(),()=>{e&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=RA)}},[c,h,e,u]),J(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),LA())},[c,u]),J(()=>{const N=()=>p({});return document.addEventListener(nh,N),()=>document.removeEventListener(nh,N)},[]),C(Xt.div,{...l,ref:f,style:{pointerEvents:v?_?"auto":"none":void 0,...n.style},onFocusCapture:th(n.onFocusCapture,T.onFocusCapture),onBlurCapture:th(n.onBlurCapture,T.onBlurCapture),onPointerDownCapture:th(n.onPointerDownCapture,O.onPointerDownCapture)})});kA.displayName="DismissableLayer";var YC=tt((n,t)=>{const e=Re(DA),r=q(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return e.branches.add(o),()=>{e.branches.delete(o)}},[e.branches]),C(Xt.div,{...n,ref:i})});function LA(){const n=new CustomEvent(nh);document.dispatchEvent(n)}function xA(n,t,e,{discrete:r}){const i=e.originalEvent.target,o=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:e});t&&i.addEventListener(n,t,{once:!0}),r?eh(i,o):i.dispatchEvent(o)}YC.displayName="DismissableLayerBranch";var rh=0;function MA(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var ih="focusScope.autoFocusOnMount",oh="focusScope.autoFocusOnUnmount",PA={bubbles:!1,cancelable:!0},sh=tt((n,t)=>{const{loop:e=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=n,[a,l]=et(null),u=sn(i),c=sn(o),d=q(null),h=Ft(t,m=>l(m)),p=q({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;J(()=>{if(r){let m=function(v){if(p.paused||!a)return;const _=v.target;a.contains(_)?d.current=_:kr(d.current,{select:!0})},g=function(v){if(p.paused||!a)return;const _=v.relatedTarget;_!==null&&(a.contains(_)||kr(d.current,{select:!0}))},E=function(v){if(document.activeElement===document.body)for(const _ of v)_.removedNodes.length>0&&kr(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),A.disconnect()}}},[r,a,p.paused]),J(()=>{if(a){UA.add(p);const g=document.activeElement;if(!a.contains(g)){const E=new CustomEvent(ih,PA);a.addEventListener(ih,u),a.dispatchEvent(E),E.defaultPrevented||(function(A,{select:v=!1}={}){const _=document.activeElement;for(const O of A)if(kr(O,{select:v}),document.activeElement!==_)return}((m=BA(a),m.filter(A=>A.tagName!=="A")),{select:!0}),document.activeElement===g&&kr(a))}return()=>{a.removeEventListener(ih,u),setTimeout(()=>{const E=new CustomEvent(oh,PA);a.addEventListener(oh,c),a.dispatchEvent(E),E.defaultPrevented||kr(g!=null?g:document.body,{select:!0}),a.removeEventListener(oh,c),UA.remove(p)},0)}}var m},[a,u,c,p]);const f=rt(m=>{if(!e&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(g&&E){const A=m.currentTarget,[v,_]=function(O){const T=BA(O),S=FA(T,O),N=FA(T.reverse(),O);return[S,N]}(A);v&&_?m.shiftKey||E!==_?m.shiftKey&&E===v&&(m.preventDefault(),e&&kr(_,{select:!0})):(m.preventDefault(),e&&kr(v,{select:!0})):E===A&&m.preventDefault()}},[e,r,p.paused]);return C(Xt.div,{tabIndex:-1,...s,ref:h,onKeyDown:f})});function BA(n){const t=[],e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;e.nextNode();)t.push(e.currentNode);return t}function FA(n,t){for(const e of n)if(!zC(e,{upTo:t}))return e}function zC(n,{upTo:t}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(t!==void 0&&n===t)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function kr(n,{select:t=!1}={}){if(n&&n.focus){const e=document.activeElement;n.focus({preventScroll:!0}),n!==e&&function(r){return r instanceof HTMLInputElement&&"select"in r}(n)&&t&&n.select()}}sh.displayName="FocusScope";var UA=function(){let n=[];return{add(t){const e=n[0];t!==e&&(e==null||e.pause()),n=HA(n,t),n.unshift(t)},remove(t){var e;n=HA(n,t),(e=n[0])==null||e.resume()}}}();function HA(n,t){const e=[...n],r=e.indexOf(t);return r!==-1&&e.splice(r,1),e}var An=globalThis!=null&&globalThis.document?he:()=>{},VC=qu[" useId ".trim().toString()]||(()=>{}),WC=0;function _l(n){const[t,e]=et(VC());return An(()=>{n||e(r=>r!=null?r:String(WC++))},[n]),n||(t?`radix-${t}`:"")}const GC=["top","right","bottom","left"],Lr=Math.min,We=Math.max,yl=Math.round,Tl=Math.floor,Mn=n=>({x:n,y:n}),XC={left:"right",right:"left",bottom:"top",top:"bottom"},KC={start:"end",end:"start"};function ah(n,t,e){return We(n,Lr(t,e))}function ar(n,t){return typeof n=="function"?n(t):n}function lr(n){return n.split("-")[0]}function vo(n){return n.split("-")[1]}function lh(n){return n==="x"?"y":"x"}function uh(n){return n==="y"?"height":"width"}function Pn(n){return["top","bottom"].includes(lr(n))?"y":"x"}function ch(n){return lh(Pn(n))}function dh(n){return n.replace(/start|end/g,t=>KC[t])}function Ol(n){return n.replace(/left|right|bottom|top/g,t=>XC[t])}function $A(n){return typeof n!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(n):{top:n,right:n,bottom:n,left:n}}function Sl(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function jA(n,t,e){let{reference:r,floating:i}=n;const o=Pn(t),s=ch(t),a=uh(s),l=lr(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(vo(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}async function $s(n,t){var e;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ar(t,n),f=$A(p),m=a[h?d==="floating"?"reference":"floating":d],g=Sl(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(m)))==null||e?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),E=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(A))&&await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1},_=Sl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:A,strategy:l}):E);return{top:(g.top-_.top+f.top)/v.y,bottom:(_.bottom-g.bottom+f.bottom)/v.y,left:(g.left-_.left+f.left)/v.x,right:(_.right-g.right+f.right)/v.x}}function YA(n,t){return{top:n.top-t.height,right:n.right-t.width,bottom:n.bottom-t.height,left:n.left-t.width}}function zA(n){return GC.some(t=>n[t]>=0)}function Nl(){return typeof window!="undefined"}function _o(n){return VA(n)?(n.nodeName||"").toLowerCase():"#document"}function Ge(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function Bn(n){var t;return(t=(VA(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function VA(n){return!!Nl()&&(n instanceof Node||n instanceof Ge(n).Node)}function vn(n){return!!Nl()&&(n instanceof Element||n instanceof Ge(n).Element)}function Fn(n){return!!Nl()&&(n instanceof HTMLElement||n instanceof Ge(n).HTMLElement)}function WA(n){return!(!Nl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ge(n).ShadowRoot)}function js(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=_n(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!["inline","contents"].includes(i)}function qC(n){return["table","td","th"].includes(_o(n))}function Cl(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch(e){return!1}})}function hh(n){const t=ph(),e=vn(n)?_n(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||["transform","translate","scale","rotate","perspective","filter"].some(r=>(e.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(e.contain||"").includes(r))}function ph(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function yo(n){return["html","body","#document"].includes(_o(n))}function _n(n){return Ge(n).getComputedStyle(n)}function bl(n){return vn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function xr(n){if(_o(n)==="html")return n;const t=n.assignedSlot||n.parentNode||WA(n)&&n.host||Bn(n);return WA(t)?t.host:t}function GA(n){const t=xr(n);return yo(t)?n.ownerDocument?n.ownerDocument.body:n.body:Fn(t)&&js(t)?t:GA(t)}function Ys(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=GA(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ge(i);if(o){const a=fh(s);return t.concat(s,s.visualViewport||[],js(i)?i:[],a&&e?Ys(a):[])}return t.concat(i,Ys(i,[],e))}function fh(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function XA(n){const t=_n(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=yl(e)!==o||yl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function mh(n){return vn(n)?n:n.contextElement}function To(n){const t=mh(n);if(!Fn(t))return Mn(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=XA(t);let s=(o?yl(e.width):e.width)/r,a=(o?yl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const JC=Mn(0);function KA(n){const t=Ge(n);return ph()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:JC}function gi(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=mh(n);let s=Mn(1);t&&(r?vn(r)&&(s=To(r)):s=To(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ge(h))&&p}(o,e,r)?KA(o):Mn(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ge(o),p=r&&vn(r)?Ge(r):r;let f=h,m=fh(f);for(;m&&r&&p!==f;){const g=To(m),E=m.getBoundingClientRect(),A=_n(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ge(m),m=fh(f)}}return Sl({width:c,height:d,x:l,y:u})}function gh(n,t){const e=bl(n).scrollLeft;return t?t.left+e:gi(Bn(n)).left+e}function qA(n,t,e){e===void 0&&(e=!1);const r=n.getBoundingClientRect();return{x:r.left+t.scrollLeft-(e?0:gh(n,r)),y:r.top+t.scrollTop}}function JA(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ge(i),a=Bn(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const p=ph();(!p||p&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=Bn(i),s=bl(i),a=i.ownerDocument.body,l=We(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=We(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+gh(i);const d=-s.scrollTop;return _n(a).direction==="rtl"&&(c+=We(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}(Bn(n));else if(vn(t))r=function(i,o){const s=gi(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=Fn(i)?To(i):Mn(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=KA(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Sl(r)}function ZA(n,t){const e=xr(n);return!(e===t||!vn(e)||yo(e))&&(_n(e).position==="fixed"||ZA(e,t))}function ZC(n,t,e){const r=Fn(t),i=Bn(t),o=e==="fixed",s=gi(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Mn(0);function u(){l.x=gh(i)}if(r||!r&&!o)if((_o(t)!=="body"||js(i))&&(a=bl(t)),r){const d=gi(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Mn(0):qA(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Eh(n){return _n(n).position==="static"}function QA(n,t){if(!Fn(n)||_n(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return Bn(n)===e&&(e=e.ownerDocument.body),e}function tv(n,t){const e=Ge(n);if(Cl(n))return e;if(!Fn(n)){let i=xr(n);for(;i&&!yo(i);){if(vn(i)&&!Eh(i))return i;i=xr(i)}return e}let r=QA(n,t);for(;r&&qC(r)&&Eh(r);)r=QA(r,t);return r&&yo(r)&&Eh(r)&&!hh(r)?e:r||function(i){let o=xr(i);for(;Fn(o)&&!yo(o);){if(hh(o))return o;if(Cl(o))return null;o=xr(o)}return null}(n)||e}const QC={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=Bn(r),a=!!t&&Cl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Mn(1);const c=Mn(0),d=Fn(r);if((d||!d&&!o)&&((_o(r)!=="body"||js(s))&&(l=bl(r)),Fn(r))){const p=gi(r);u=To(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Mn(0):qA(s,l,!0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:Bn,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?Cl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=Ys(u,[],!1).filter(g=>vn(g)&&_o(g)!=="body"),p=null;const f=_n(u).position==="fixed";let m=f?xr(u):u;for(;vn(m)&&!yo(m);){const g=_n(m),E=hh(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&["absolute","fixed"].includes(p.position)||js(m)&&!E&&ZA(u,m))?h=h.filter(A=>A!==m):p=g,m=xr(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=JA(t,c,i);return u.top=We(d.top,u.top),u.right=Lr(d.right,u.right),u.bottom=Lr(d.bottom,u.bottom),u.left=We(d.left,u.left),u},JA(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:tv,getElementRects:async function(n){const t=this.getOffsetParent||tv,e=this.getDimensions,r=await e(n.floating);return{reference:ZC(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=XA(n);return{width:t,height:e}},getScale:To,isElement:vn,isRTL:function(n){return _n(n).direction==="rtl"}};function ev(n,t){return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function tb(n,t,e,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=mh(n),c=i||o?[...u?Ys(u):[],...Ys(t)]:[];c.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),o&&g.addEventListener("resize",e)});const d=u&&a?function(g,E){let A,v=null;const _=Bn(g);function O(){var T;clearTimeout(A),(T=v)==null||T.disconnect(),v=null}return function T(S,N){S===void 0&&(S=!1),N===void 0&&(N=1),O();const y=g.getBoundingClientRect(),{left:I,top:R,width:b,height:L}=y;if(S||E(),!b||!L)return;const k={rootMargin:-Tl(R)+"px "+-Tl(_.clientWidth-(I+b))+"px "+-Tl(_.clientHeight-(R+L))+"px "+-Tl(I)+"px",threshold:We(0,Lr(1,N))||1};let B=!0;function j($){const W=$[0].intersectionRatio;if(W!==N){if(!B)return T();W?T(!1,W):A=setTimeout(()=>{T(!1,1e-7)},1e3)}W!==1||ev(y,g.getBoundingClientRect())||T(),B=!1}try{v=new IntersectionObserver(j,{...k,root:_.ownerDocument})}catch($){v=new IntersectionObserver(j,k)}v.observe(g)}(!0),O}(u,e):null;let h,p=-1,f=null;s&&(f=new ResizeObserver(g=>{let[E]=g;E&&E.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=f)==null||A.observe(t)})),e()}),u&&!l&&f.observe(u),f.observe(t));let m=l?gi(n):null;return l&&function g(){const E=gi(n);m&&!ev(m,E)&&e(),m=E,h=requestAnimationFrame(g)}(),e(),()=>{var g;c.forEach(E=>{i&&E.removeEventListener("scroll",e),o&&E.removeEventListener("resize",e)}),d==null||d(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const eb=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(u,c){const{placement:d,platform:h,elements:p}=u,f=await(h.isRTL==null?void 0:h.isRTL(p.floating)),m=lr(d),g=vo(d),E=Pn(d)==="y",A=["left","top"].includes(m)?-1:1,v=f&&E?-1:1,_=ar(c,u);let{mainAxis:O,crossAxis:T,alignmentAxis:S}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return g&&typeof S=="number"&&(T=g==="end"?-1*S:S),E?{x:T*v,y:O*A}:{x:O*A,y:T*v}}(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},nb=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:E,y:A}=g;return{x:E,y:A}}},...l}=ar(n,t),u={x:e,y:r},c=await $s(t,l),d=Pn(lr(i)),h=lh(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"bottom":"right";p=ah(p+c[h==="y"?"top":"left"],p,p-c[g])}if(s){const g=d==="y"?"bottom":"right";f=ah(f+c[d==="y"?"top":"left"],f,f-c[g])}const m=a.fn({...t,[h]:p,[d]:f});return{...m,data:{x:m.x-e,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}},rb=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=ar(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};const E=lr(i),A=Pn(a),v=lr(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=h||(v||!m?[Ol(a)]:function(k){const B=Ol(k);return[dh(k),B,dh(B)]}(a)),T=f!=="none";!h&&T&&O.push(...function(k,B,j,$){const W=vo(k);let x=function(Q,H,nt){const ot=["left","right"],P=["right","left"],V=["top","bottom"],it=["bottom","top"];switch(Q){case"top":case"bottom":return nt?H?P:ot:H?ot:P;case"left":case"right":return H?V:it;default:return[]}}(lr(k),j==="start",$);return W&&(x=x.map(Q=>Q+"-"+W),B&&(x=x.concat(x.map(dh)))),x}(a,m,f,_));const S=[a,...O],N=await $s(t,g),y=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&y.push(N[E]),d){const k=function(B,j,$){$===void 0&&($=!1);const W=vo(B),x=ch(B),Q=uh(x);let H=x==="x"?W===($?"end":"start")?"right":"left":W==="start"?"bottom":"top";return j.reference[Q]>j.floating[Q]&&(H=Ol(H)),[H,Ol(H)]}(i,s,_);y.push(N[k[0]],N[k[1]])}if(I=[...I,{placement:i,overflows:y}],!y.every(k=>k<=0)){var R,b;const k=(((R=o.flip)==null?void 0:R.index)||0)+1,B=S[k];if(B&&(!(d==="alignment"&&A!==Pn(B))||I.every($=>$.overflows[0]>0&&Pn($.placement)===A)))return{data:{index:k,overflows:I},reset:{placement:B}};let j=(b=I.filter($=>$.overflows[0]<=0).sort(($,W)=>$.overflows[1]-W.overflows[1])[0])==null?void 0:b.placement;if(!j)switch(p){case"bestFit":{var L;const $=(L=I.filter(W=>{if(T){const x=Pn(W.placement);return x===A||x==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(x=>x>0).reduce((x,Q)=>x+Q,0)]).sort((W,x)=>W[1]-x[1])[0])==null?void 0:L[0];$&&(j=$);break}case"initialPlacement":j=a}if(i!==j)return{reset:{placement:j}}}return{}}}},ib=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var e,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ar(n,t),c=await $s(t,u),d=lr(i),h=vo(i),p=Pn(i)==="y",{width:f,height:m}=o.floating;let g,E;d==="top"||d==="bottom"?(g=d,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=d,g=h==="end"?"top":"bottom");const A=m-c.top-c.bottom,v=f-c.left-c.right,_=Lr(m-c[g],A),O=Lr(f-c[E],v),T=!t.middlewareData.shift;let S=_,N=O;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=A),T&&!h){const I=We(c.left,0),R=We(c.right,0),b=We(c.top,0),L=We(c.bottom,0);p?N=f-2*(I!==0||R!==0?I+R:We(c.left,c.right)):S=m-2*(b!==0||L!==0?b+L:We(c.top,c.bottom))}await l({...t,availableWidth:N,availableHeight:S});const y=await s.getDimensions(a.floating);return f!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}},ob=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(t){const{rects:e}=t,{strategy:r="referenceHidden",...i}=ar(n,t);switch(r){case"referenceHidden":{const o=YA(await $s(t,{...i,elementContext:"reference"}),e.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:zA(o)}}}case"escaped":{const o=YA(await $s(t,{...i,altBoundary:!0}),e.floating);return{data:{escapedOffsets:o,escaped:zA(o)}}}default:return{}}}}},nv=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ar(n,t)||{};if(u==null)return{};const d=$A(c),h={x:e,y:r},p=ch(i),f=uh(p),m=await s.getDimensions(u),g=p==="y",E=g?"top":"left",A=g?"bottom":"right",v=g?"clientHeight":"clientWidth",_=o.reference[f]+o.reference[p]-h[p]-o.floating[f],O=h[p]-o.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[v]:0;S&&await(s.isElement==null?void 0:s.isElement(T))||(S=a.floating[v]||o.floating[f]);const N=_/2-O/2,y=S/2-m[f]/2-1,I=Lr(d[E],y),R=Lr(d[A],y),b=I,L=S-m[f]-R,k=S/2-m[f]/2+N,B=ah(b,k,L),j=!l.arrow&&vo(i)!=null&&k!==B&&o.reference[f]/2-(k<b?I:R)-m[f]/2<0,$=j?k<b?k-b:k-L:0;return{[p]:h[p]+$,data:{[p]:B,centerOffset:k-B-$,...j&&{alignmentOffset:$}},reset:j}}}),sb=function(n){return n===void 0&&(n={}),{options:n,fn(t){const{x:e,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ar(n,t),c={x:e,y:r},d=Pn(i),h=lh(d);let p=c[h],f=c[d];const m=ar(a,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const v=h==="y"?"height":"width",_=o.reference[h]-o.floating[v]+g.mainAxis,O=o.reference[h]+o.reference[v]-g.mainAxis;p<_?p=_:p>O&&(p=O)}if(u){var E,A;const v=h==="y"?"width":"height",_=["top","left"].includes(lr(i)),O=o.reference[d]-o.floating[v]+(_&&((E=s.offset)==null?void 0:E[d])||0)+(_?0:g.crossAxis),T=o.reference[d]+o.reference[v]+(_?0:((A=s.offset)==null?void 0:A[d])||0)-(_?g.crossAxis:0);f<O?f=O:f>T&&(f=T)}return{[h]:p,[d]:f}}}},ab=(n,t,e)=>{const r=new Map,i={platform:QC,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=jA(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:I,reset:R}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...I}},R&&_<=50&&(_++,typeof R=="object"&&(R.placement&&(A=R.placement),R.rects&&(m=R.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):R.rects),{x:g,y:E}=jA(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var Il=typeof document!="undefined"?he:function(){};function wl(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!wl(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!wl(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function rv(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function iv(n,t){const e=rv(n);return Math.round(t*e)/e}function Ah(n){const t=q(n);return Il(()=>{t.current=n}),t}const lb=n=>({name:"arrow",options:n,fn(t){const{element:e,padding:r}=typeof n=="function"?n(t):n;return e&&(i=e,{}.hasOwnProperty.call(i,"current"))?e.current!=null?nv({element:e.current,padding:r}).fn(t):{}:e?nv({element:e,padding:r}).fn(t):{};var i}}),ub=(n,t)=>({...eb(n),options:[n,t]}),cb=(n,t)=>({...nb(n),options:[n,t]}),db=(n,t)=>({...sb(n),options:[n,t]}),hb=(n,t)=>({...rb(n),options:[n,t]}),pb=(n,t)=>({...ib(n),options:[n,t]}),fb=(n,t)=>({...ob(n),options:[n,t]}),mb=(n,t)=>({...lb(n),options:[n,t]});var ov=tt((n,t)=>{const{children:e,width:r=10,height:i=5,...o}=n;return C(Xt.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?e:C("polygon",{points:"0,0 30,0 15,10"})})});ov.displayName="Arrow";var sv=ov;function av(n){const[t,e]=et(void 0);return An(()=>{if(n){e({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=n.offsetWidth,a=n.offsetHeight;e({width:s,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}e(void 0)},[n]),t}var vh="Popper",[lv,uv]=mi(vh),[gb,cv]=lv(vh),dv=n=>{const{__scopePopper:t,children:e}=n,[r,i]=et(null);return C(gb,{scope:t,anchor:r,onAnchorChange:i,children:e})};dv.displayName=vh;var hv="PopperAnchor",pv=tt((n,t)=>{const{__scopePopper:e,virtualRef:r,...i}=n,o=cv(hv,e),s=q(null),a=Ft(t,s),l=q(null);return J(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||s.current,u!==l.current&&o.onAnchorChange(l.current)}),r?null:C(Xt.div,{...i,ref:a})});pv.displayName=hv;var _h="PopperContent",[Eb,Ab]=lv(_h),fv=tt((n,t)=>{var ut,F,ct,yt,ee,jt,ue,Zt;const{__scopePopper:e,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=n,g=cv(_h,e),[E,A]=et(null),v=Ft(t,gt=>A(gt)),[_,O]=et(null),T=av(_),S=(ut=T==null?void 0:T.width)!=null?ut:0,N=(F=T==null?void 0:T.height)!=null?F:0,y=r+(o!=="center"?"-"+o:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},R=Array.isArray(u)?u:[u],b=R.length>0,L={padding:I,boundary:R.filter(_b),altBoundary:b},{refs:k,floatingStyles:B,placement:j,isPositioned:$,middlewareData:W}=function(gt){gt===void 0&&(gt={});const{placement:Kt="bottom",strategy:Nt="absolute",middleware:Rt=[],platform:qe,elements:{reference:hr,floating:ne}={},transform:Ur=!0,whileElementsMounted:bi,open:pr}=gt,[re,Ii]=et({x:0,y:0,strategy:Nt,placement:Kt,middlewareData:{},isPositioned:!1}),[fr,Hr]=et(Rt);wl(fr,Rt)||Hr(Rt);const[wi,Fo]=et(null),[Uo,Ri]=et(null),Di=rt(D=>{D!==ce.current&&(ce.current=D,Fo(D))},[]),Wn=rt(D=>{D!==ve.current&&(ve.current=D,Ri(D))},[]),Qt=hr||wi,te=ne||Uo,ce=q(null),ve=q(null),Je=q(re),Ho=bi!=null,Ie=Ah(bi),Ze=Ah(qe),$r=Ah(pr),Me=rt(()=>{if(!ce.current||!ve.current)return;const D={placement:Kt,strategy:Nt,middleware:fr};Ze.current&&(D.platform=Ze.current),ab(ce.current,ve.current,D).then(Y=>{const Z={...Y,isPositioned:$r.current!==!1};Sn.current&&!wl(Je.current,Z)&&(Je.current=Z,Hi(()=>{Ii(Z)}))})},[fr,Kt,Nt,Ze,$r]);Il(()=>{pr===!1&&Je.current.isPositioned&&(Je.current.isPositioned=!1,Ii(D=>({...D,isPositioned:!1})))},[pr]);const Sn=q(!1);Il(()=>(Sn.current=!0,()=>{Sn.current=!1}),[]),Il(()=>{if(Qt&&(ce.current=Qt),te&&(ve.current=te),Qt&&te){if(Ie.current)return Ie.current(Qt,te,Me);Me()}},[Qt,te,Me,Ie,Ho]);const ki=lt(()=>({reference:ce,floating:ve,setReference:Di,setFloating:Wn}),[Di,Wn]),ie=lt(()=>({reference:Qt,floating:te}),[Qt,te]),w=lt(()=>{const D={position:Nt,left:0,top:0};if(!ie.floating)return D;const Y=iv(ie.floating,re.x),Z=iv(ie.floating,re.y);return Ur?{...D,transform:"translate("+Y+"px, "+Z+"px)",...rv(ie.floating)>=1.5&&{willChange:"transform"}}:{position:Nt,left:Y,top:Z}},[Nt,Ur,ie.floating,re.x,re.y]);return lt(()=>({...re,update:Me,refs:ki,elements:ie,floatingStyles:w}),[re,Me,ki,ie,w])}({strategy:"fixed",placement:y,whileElementsMounted:(...gt)=>tb(...gt,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[ub({mainAxis:i+N,alignmentAxis:s}),l&&cb({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?db():void 0,...L}),l&&hb({...L}),pb({...L,apply:({elements:gt,rects:Kt,availableWidth:Nt,availableHeight:Rt})=>{const{width:qe,height:hr}=Kt.reference,ne=gt.floating.style;ne.setProperty("--radix-popper-available-width",`${Nt}px`),ne.setProperty("--radix-popper-available-height",`${Rt}px`),ne.setProperty("--radix-popper-anchor-width",`${qe}px`),ne.setProperty("--radix-popper-anchor-height",`${hr}px`)}}),_&&mb({element:_,padding:a}),yb({arrowWidth:S,arrowHeight:N}),h&&fb({strategy:"referenceHidden",...L})]}),[x,Q]=Ev(j),H=sn(f);An(()=>{$&&(H==null||H())},[$,H]);const nt=(ct=W.arrow)==null?void 0:ct.x,ot=(yt=W.arrow)==null?void 0:yt.y,P=((ee=W.arrow)==null?void 0:ee.centerOffset)!==0,[V,it]=et();return An(()=>{E&&it(window.getComputedStyle(E).zIndex)},[E]),C("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:$?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(jt=W.transformOrigin)==null?void 0:jt.x,(ue=W.transformOrigin)==null?void 0:ue.y].join(" "),...((Zt=W.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:C(Eb,{scope:e,placedSide:x,onArrowChange:O,arrowX:nt,arrowY:ot,shouldHideArrow:P,children:C(Xt.div,{"data-side":x,"data-align":Q,...m,ref:v,style:{...m.style,animation:$?void 0:"none"}})})})});fv.displayName=_h;var mv="PopperArrow",vb={top:"bottom",right:"left",bottom:"top",left:"right"},gv=tt(function(n,t){const{__scopePopper:e,...r}=n,i=Ab(mv,e),o=vb[i.placedSide];return C("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C(sv,{...r,ref:t,style:{...r.style,display:"block"}})})});function _b(n){return n!==null}gv.displayName=mv;var yb=n=>({name:"transformOrigin",options:n,fn(t){var m,g,E,A,v;const{placement:e,rects:r,middlewareData:i}=t,o=((m=i.arrow)==null?void 0:m.centerOffset)!==0,s=o?0:n.arrowWidth,a=o?0:n.arrowHeight,[l,u]=Ev(e),c={start:"0%",center:"50%",end:"100%"}[u],d=((E=(g=i.arrow)==null?void 0:g.x)!=null?E:0)+s/2,h=((v=(A=i.arrow)==null?void 0:A.y)!=null?v:0)+a/2;let p="",f="";return l==="bottom"?(p=o?c:`${d}px`,f=-a+"px"):l==="top"?(p=o?c:`${d}px`,f=`${r.floating.height+a}px`):l==="right"?(p=-a+"px",f=o?c:`${h}px`):l==="left"&&(p=`${r.floating.width+a}px`,f=o?c:`${h}px`),{data:{x:p,y:f}}}});function Ev(n){const[t,e="center"]=n.split("-");return[t,e]}var Tb=dv,Av=pv,Ob=fv,Sb=gv,vv=n=>{const{present:t,children:e}=n,r=function(s){const[a,l]=et(),u=q(null),c=q(s),d=q("none"),h=s?"mounted":"unmounted",[p,f]=function(m,g){return Bi((E,A)=>{var v;return(v=g[E][A])!=null?v:E},m)}(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J(()=>{const m=Rl(u.current);d.current=p==="mounted"?m:"none"},[p]),An(()=>{const m=u.current,g=c.current;if(g!==s){const E=d.current,A=Rl(m);s?f("MOUNT"):A==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(g&&E!==A?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,f]),An(()=>{var m;if(a){let g;const E=(m=a.ownerDocument.defaultView)!=null?m:window,A=_=>{const O=Rl(u.current).includes(CSS.escape(_.animationName));if(_.target===a&&O&&(f("ANIMATION_END"),!c.current)){const T=a.style.animationFillMode;a.style.animationFillMode="forwards",g=E.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=T)})}},v=_=>{_.target===a&&(d.current=Rl(u.current))};return a.addEventListener("animationstart",v),a.addEventListener("animationcancel",A),a.addEventListener("animationend",A),()=>{E.clearTimeout(g),a.removeEventListener("animationstart",v),a.removeEventListener("animationcancel",A),a.removeEventListener("animationend",A)}}f("ANIMATION_END")},[a,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:rt(m=>{u.current=m?getComputedStyle(m):null,l(m)},[])}}(t),i=typeof e=="function"?e({present:r.isPresent}):Cn.only(e),o=Ft(r.ref,function(s){var u,c;let a=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?s.ref:(a=(c=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?s.props.ref:s.props.ref||s.ref)}(i));return typeof e=="function"||r.isPresent?zr(i,{ref:o}):null};function Rl(n){return(n==null?void 0:n.animationName)||"none"}vv.displayName="Presence";var Nb=qu[" useInsertionEffect ".trim().toString()]||An;function yh({prop:n,defaultProp:t,onChange:e=()=>{},caller:r}){const[i,o,s]=function({defaultProp:c,onChange:d}){const[h,p]=et(c),f=q(h),m=q(d);return Nb(()=>{m.current=d},[d]),J(()=>{var g;f.current!==h&&((g=m.current)==null||g.call(m,h),f.current=h)},[h,f]),[h,p,m]}({defaultProp:t,onChange:e}),a=n!==void 0,l=a?n:i;{const c=q(n!==void 0);J(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=rt(c=>{var d;if(a){const h=function(p){return typeof p=="function"}(c)?c(n):c;h!==n&&((d=s.current)==null||d.call(s,h))}else o(c)},[a,n,o,s]);return[l,u]}var Oo=new WeakMap,Dl=new WeakMap,kl={},_v=0,yv=function(n){return n&&(n.host||yv(n.parentNode))},Cb=function(n,t,e,r){var i=function(d,h){return h.map(function(p){if(d.contains(p))return p;var f=yv(p);return f&&d.contains(f)?f:(console.error("aria-hidden",p,"in not contained inside",d,". Doing nothing"),null)}).filter(function(p){return!!p})}(t,Array.isArray(n)?n:[n]);kl[e]||(kl[e]=new WeakMap);var o=kl[e],s=[],a=new Set,l=new Set(i),u=function(d){d&&!a.has(d)&&(a.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){d&&!l.has(d)&&Array.prototype.forEach.call(d.children,function(h){if(a.has(h))c(h);else try{var p=h.getAttribute(r),f=p!==null&&p!=="false",m=(Oo.get(h)||0)+1,g=(o.get(h)||0)+1;Oo.set(h,m),o.set(h,g),s.push(h),m===1&&f&&Dl.set(h,!0),g===1&&h.setAttribute(e,"true"),f||h.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return c(t),a.clear(),_v++,function(){s.forEach(function(d){var h=Oo.get(d)-1,p=o.get(d)-1;Oo.set(d,h),o.set(d,p),h||(Dl.has(d)||d.removeAttribute(r),Dl.delete(d)),p||d.removeAttribute(e)}),--_v||(Oo=new WeakMap,Oo=new WeakMap,Dl=new WeakMap,kl={})}},Tv=function(n,t,e){e===void 0&&(e="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),i=function(o){return typeof document=="undefined"?null:(Array.isArray(o)?o[0]:o).ownerDocument.body}(n);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Cb(r,i,e,"aria-hidden")):function(){return null}},Mr=function(){return Mr=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Mr.apply(this,arguments)},Ll="right-scroll-bar-position",xl="width-before-scroll-bar";function Th(n,t){return typeof n=="function"?n(t):n&&(n.current=t),n}var bb=typeof window!="undefined"?he:J,Ov=new WeakMap;function Ib(n,t){var e,r,i,o=(e=null,r=function(s){return n.forEach(function(a){return Th(a,s)})},(i=et(function(){return{value:e,callback:r,facade:{get current(){return i.value},set current(s){var a=i.value;a!==s&&(i.value=s,i.callback(s,a))}}}})[0]).callback=r,i.facade);return bb(function(){var s=Ov.get(o);if(s){var a=new Set(s),l=new Set(n),u=o.current;a.forEach(function(c){l.has(c)||Th(c,null)}),l.forEach(function(c){a.has(c)||Th(c,u)})}Ov.set(o,n)},[n]),o}var Ml=function(){return Ml=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Ml.apply(this,arguments)};function wb(n){return n}typeof SuppressedError=="function"&&SuppressedError;var Sv=function(n){var t=n.sideCar,e=function(i,o){var s={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.indexOf(a)<0&&(s[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(a=Object.getOwnPropertySymbols(i);l<a.length;l++)o.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(i,a[l])&&(s[a[l]]=i[a[l]])}return s}(n,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return pt(r,Ml({},e))};Sv.isSideCarExport=!0;var Nv=function(n){n===void 0&&(n={});var t=function(e,r){r===void 0&&(r=wb);var i=[],o=!1,s={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:e},useMedium:function(a){var l=r(a,o);return i.push(l),function(){i=i.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(o=!0;i.length;){var l=i;i=[],l.forEach(a)}i={push:function(u){return a(u)},filter:function(){return i}}},assignMedium:function(a){o=!0;var l=[];if(i.length){var u=i;i=[],u.forEach(a),l=i}var c=function(){var h=l;l=[],h.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),i={push:function(h){l.push(h),d()},filter:function(h){return l=l.filter(h),i}}}};return s}(null);return t.options=Ml({async:!0,ssr:!1},n),t}(),Oh=function(){},Pl=tt(function(n,t){var e=q(null),r=et({onScrollCapture:Oh,onWheelCapture:Oh,onTouchMoveCapture:Oh}),i=r[0],o=r[1],s=n.forwardProps,a=n.children,l=n.className,u=n.removeScrollBar,c=n.enabled,d=n.shards,h=n.sideCar,p=n.noRelative,f=n.noIsolation,m=n.inert,g=n.allowPinchZoom,E=n.as,A=E===void 0?"div":E,v=n.gapMode,_=function(N,y){var I={};for(var R in N)Object.prototype.hasOwnProperty.call(N,R)&&y.indexOf(R)<0&&(I[R]=N[R]);if(N!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(R=Object.getOwnPropertySymbols(N);b<R.length;b++)y.indexOf(R[b])<0&&Object.prototype.propertyIsEnumerable.call(N,R[b])&&(I[R[b]]=N[R[b]])}return I}(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=h,T=Ib([e,t]),S=Mr(Mr({},_),i);return pt(Vt,null,c&&pt(O,{sideCar:Nv,removeScrollBar:u,shards:d,noRelative:p,noIsolation:f,inert:m,setCallbacks:o,allowPinchZoom:!!g,lockRef:e,gapMode:v}),s?zr(Cn.only(a),Mr(Mr({},S),{ref:T})):pt(A,Mr({},S,{className:l,ref:T}),a))});Pl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Pl.classNames={fullWidth:xl,zeroRight:Ll};function Rb(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var t=function(){if(typeof __webpack_nonce__!="undefined")return __webpack_nonce__}();return t&&n.setAttribute("nonce",t),n}var Db=function(){var n=0,t=null;return{add:function(e){var r;n==0&&(t=Rb())&&(function(i,o){i.styleSheet?i.styleSheet.cssText=o:i.appendChild(document.createTextNode(o))}(t,e),r=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(r)),n++},remove:function(){!--n&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Cv=function(){var n,t=(n=Db(),function(e,r){J(function(){return n.add(e),function(){n.remove()}},[e&&r])});return function(e){var r=e.styles,i=e.dynamic;return t(r,i),null}},kb={left:0,top:0,right:0,gap:0},Sh=function(n){return parseInt(n||"",10)||0},Lb=function(n){if(n===void 0&&(n="margin"),typeof window=="undefined")return kb;var t=function(i){var o=window.getComputedStyle(document.body),s=o[i==="padding"?"paddingLeft":"marginLeft"],a=o[i==="padding"?"paddingTop":"marginTop"],l=o[i==="padding"?"paddingRight":"marginRight"];return[Sh(s),Sh(a),Sh(l)]}(n),e=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-e+t[2]-t[0])}},xb=Cv(),So="data-scroll-locked",Mb=function(n,t,e,r){var i=n.left,o=n.top,s=n.right,a=n.gap;return e===void 0&&(e="margin"),`
84
+ `);function F0(n,t={except:[]}){let e=function(r,i){let o=[r];return o=Bd(o,i.multilineSteps),o=Bd(o,[XN]),o=Bd(o,i.singlelineSteps),o=U0(o),o}(n,GN(t));return e=H0(e,!1),e}function Bd(n,t){return t.reduce((e,r)=>Ls(e,r),n)}function U0(n){const t=[];let e=-1;for(const r of n)typeof r=="string"?typeof t[e]=="string"?t[e]+=r:t[++e]=r:t[++e]="children"in r?{...r,children:U0(r.children)}:r;return t}function H0(n,t){const e=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i];typeof o=="string"?r.push(o):"children"in o?(r.length>0&&(e.push(r.join("")),r=[]),o.children=H0(o.children,t||o.type==="link"||o.type==="actionbutton"||o.type==="actionlink"),e.push(o)):o.type==="autolink"&&t?r.push(o.text):(r.length>0&&(e.push(r.join("")),r=[]),e.push(o))}return r.length>0&&(e.push(r.join("")),r=[]),e}function KN(){let n,t=0;return e=>{const r=(o=Date.now())=>{window.clearTimeout(n),n=void 0,t=o;const s=function(a){a=a.removeMark(0,a.doc.content.size,Jt.marks.bold),a=a.removeMark(0,a.doc.content.size,Jt.marks.italic),a=a.removeMark(0,a.doc.content.size,Jt.marks.strikethrough),a.doc.firstChild;const l=function(u){const c=[];let d,h="";return u.descendants((p,f)=>(p.isText?(h+=p.text,d!=null||(d=f)):h&&d!==void 0&&(c.push({text:h,pos:d}),h="",d=void 0),p.type!==Jt.nodes.mention)),h&&d!==void 0&&c.push({text:h,pos:d}),c}(a.doc);for(const{text:u,pos:c}of l){const d=F0(u,{only:["Wikitext"]});[a]=$0(a,c,d)}return a}(e.state.tr);e.dispatch(s)},i=Date.now();i-t<300?n||(n=window.setTimeout(r,300)):r(i)}}function $0(n,t,e,r=0,i=[]){for(const o of e)if(typeof o=="string"){for(const s of i)n.addMark(t+r,t+r+o.length,s.create());r+=o.length}else if(o.type==="bold"||o.type==="italic"||o.type==="strikethrough"){r+=1;const s=Jt.marks[o.type],a=[...i,s];[n,r]=$0(n,t,o.children,r,a),r+=1}else St.unreachable();return[n,r]}function j0(n){return(t,e)=>{if(!e)return!0;let r=t.tr;const i=vt.between(t.selection.$from,t.selection.$to);return r=r.replaceRangeWith(i.from,i.from,Jt.text(n,r.storedMarks)),r=r.replaceRangeWith(i.to+1,i.to+1,Jt.text(n,r.storedMarks)),r=r.setSelection(vt.near(r.doc.resolve(i.to+1))),e(r),!0}}function qN(n,t,e){const r=t.clipboardData;if(!r)return!1;const i=function(o){const s=o.items||[],a={"image/gif":"gif","image/png":"png","image/jpeg":"jpg","image/svg+xml":"svg"},l=Array.from(s).filter(d=>d.kind==="file"&&a[d.type]);if(l.length===0||o.types.includes("text/rtf"))return;const u=l[0];let c=u.getAsFile();if(!c.name){const d="image."+a[u.type];c=new File([c],d,{type:u.type,lastModified:Date.now()})}return c}(r);return i?e(i):function(o,s){const a=o.state.tr.insertText(s).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");o.dispatch(a)}(n,r.getData("text/plain")),!0}function JN(n,{allowSpaces:t=!1}){return e=>{const r=new RegExp(`\\s${n}$`),i=t?new RegExp(`${n}.*?(?=\\s${n}|$)`,"g"):new RegExp(`(?:^)?${n}[^\\s${n}]*`,"g"),o=e.before(),s=e.end(),a=e.doc.textBetween(o,s,"\0","\0");let l;for(;l=i.exec(a);){const u=l.input.slice(Math.max(0,l.index-1),l.index);if(!/^[\s\0]?$/.test(u))continue;const c=l.index+e.start();let d=c+l[0].length;if(t&&r.test(a.slice(d-1,d+1))&&(l[0]+=" ",d++),c<e.pos&&d>=e.pos)return{range:{from:c,to:d},text:l[0]}}}}function Y0({matcher:n=JN("#"),suggestionClass:t="ProseMirror-suggestion",onEnter:e=()=>!1,onChange:r=()=>!1,onExit:i=()=>!1,onKeyDown:o=()=>!1,debug:s=!1}){return new Ya({key:new za("suggestions"),view(){return{update:(a,l)=>{const u=this.key.getState(l),c=this.key.getState(a.state),d=u.active&&c.active&&u.range.from!==c.range.from,h=!u.active&&c.active,p=u.active&&!c.active,f=!h&&!p&&u.text!==c.text;(p||d)&&i({view:a,range:u.range,text:u.text}),f&&!d&&r({view:a,range:c.range,text:c.text}),(h||d)&&e({view:a,range:c.range,text:c.text})}}},state:{init:()=>({active:!1,range:{},text:null}),apply(a,l){const{selection:u}=a,c={...l};if(u.from===u.to){(u.from<l.range.from||u.from>l.range.to)&&(c.active=!1);const d=u.$from,h=n(d);h?(c.active=!0,c.range=h.range,c.text=h.text):c.active=!1}else c.active=!1;return c.active||(c.range={},c.text=null),c}},props:{handleKeyDown(a,l){const{active:u}=this.getState(a.state);return!!u&&o({view:a,event:l})},decorations(a){const{active:l,range:u}=this.getState(a);return l?Wt.create(a.doc,[Ye.inline(u.from,u.to,{nodeName:"span",class:t,style:s?"background: rgba(0, 0, 255, 0.05); color: blue; border: 2px solid blue;":null})]):null}}})}function ZN({placeholder:n,disabled:t,className:e="",characterLimit:r,spellcheck:i}){const o=ts(),s=X(),a=X(null);return J(()=>(s.current=function(l,u,c,d,h){const p=ro.create({schema:Jt,plugins:[...h.filter(QN),aN(),YE({...ol,"Mod-z":e0,"Mod-y":n0,"Mod-b":j0("*"),"Mod-i":j0("_"),"Mod-Enter":ol.Enter,"Shift-Enter":ol.Enter,Enter:c}),YE({Enter:ol.Enter}),UE]}),f=KN(),m=new K1(l,{handlePaste:(g,E,A)=>qN(g,E,d),clipboardTextSerializer(g){const E=[];return g.content.forEach(A=>{A&&E.push(g0(A.textContent))}),E.join()},state:p,dispatchTransaction(g){g=(g=g.removeStoredMark(Jt.marks.literal)).removeStoredMark(Jt.marks.emoji);const E=m.state.apply(g);m.state.doc.eq(E.doc)||u(new ul(E.doc)),m.updateState(E),g.steps.some(A=>A instanceof mn)&&setTimeout(()=>f(m),0)}});return m}(a.current,l=>o.onChange(l),()=>!!o.onEnter&&(o.onEnter(),!0),l=>o.onPasteImage(l),[o.emojiSuggesterPlugin(),o.mentionsPlugin()]),o.setEditorView(s.current),()=>{var l;o.setEditorView(void 0),(l=s.current)==null||l.destroy()}),[o]),J(()=>{var l;(l=s.current)==null||l.setProps({editable:()=>!t})},[t]),J(()=>us(()=>{var l,u,c;return(c=s.current)==null?void 0:c.setProps({attributes:{spellcheck:String((u=(l=o.spellcheck$.get())!=null?l:i)!=null?u:!1),class:"t-text-input","aria-label":"Message Field",role:"textbox"}})}),[o,i]),J(()=>us(()=>{var u;const l=s.current;l==null||l.dispatch(l.state.tr.setMeta(UE,(u=o.placeholder$.get())!=null?u:n))}),[o,n]),J(()=>{r&&Number.isInteger(r)&&o.setMaxLength(r)},[r,o]),C("div",{className:`t-editor ${e}`,ref:a})}function z0(n){if(n.startsWith(":"))throw new Error("Not implemented");{const t=Jt.marks.emoji.create({emoji:n});return Jt.text(n,[t])}}function V0(n,t){const e=encodeURIComponent(n);return Jt.nodes.mention.create({id:n,name:t},Jt.text(`<!!mention:${e}|${t}>`))}const yu=class yu{constructor(t){this.doc=t,this.size=this.doc.content.size,this.hasContent=HE(this.doc)}asText(){return this.doc.textContent.replace(/\xa0/g," ")}};yu.EMPTY=new yu(Jt.topNodeType.create());let ul=yu;function QN(n){return n!=null}const W0=/^\/.*[^\\]\/[im]*$/;function G0(n){return W0.test(n)?!cl(n).test(""):!1}function cl(n){const t=n.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${n} to be a (non-empty) regex`);let e=t[2]||"";return e=e.replace(/[^im]/g,"")+"g",new RegExp(t[1],e)}function tC(n,t){const e=function(i){{const o=document.createElement("a");return o.href=i,o.hostname}}(t),r=function(i){const o=i.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp("^"+o+"$","i")}(n);return e!==void 0&&r.test(e)}const eC=/^[]/g;function nC(n){return n.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}function Fd(n,t){!n()&&!t&&(t=n.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}(n=>{function t(r){}function e(r,i){(function(o,s){switch(s){case"undefined":return o===void 0;case String:return typeof o=="string"||o instanceof String;case Boolean:return typeof o=="boolean"||o instanceof Boolean;case Number:return typeof o=="number"||o instanceof Number;default:return o instanceof s}})(r,i)||(i.name,String(r))}n.defined=t,n.has=function(r,i){r[i]},n.is=e,n.equals=function(r,i){},n.oneOf=function(r,i){i.includes(r)||JSON.stringify(i)},n.isArray=function(r,i){e(r,Array),r&&r.length>0&&e(r[0],i)},n.optional=function(r,i){r!==void 0&&e(r,i)},n.falsy=function(r){},n.never=function(r){}})(Fd||(Fd={}));const po=Fd,rC=/\uFE0F/g,iC="‍";function oC(n){if(n===":arslan:")return"https://cdn.talkjs.com/__assets/5461191341cea882b3f227c085d5772c.gif";const t=function(r){const i=[];let o=0,s=0,a=0;for(;a<r.length;)o=r.charCodeAt(a++),s?(i.push((65536+(s-55296<<10)+(o-56320)).toString(16)),s=0):55296<=o&&o<=56319?s=o:i.push(o.toString(16));return i.join("-")}((e=n).indexOf(iC)<0?e.replace(rC,""):e);var e;return`https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/${t}.svg`}class sC{constructor({mode:t,allowedHostnames:e,allowedPhoneNrs:r,allowedMatches:i,forbiddenMatches:o,suppressLinks:s,suppressEmailAddresses:a,suppressPhoneNumbers:l,replacement:u}){po.oneOf(t,["all","otherOnly","off"]),this.mode=t,this.suppressLinks=s!==!1,this.suppressEmailAddresses=a!==!1,this.suppressPhoneNumbers=l!==!1,this.allowedHostnames=e||[],this.allowedPhoneNrs=(r||[]).filter(c=>c).map(c=>c.replace(/[^0-9]/g,"")),this.allowedMatches=(i||[]).filter(G0).map(c=>cl(c)),this.forbiddenMatches=(o||[]).filter(G0).map(c=>cl(c)),po(()=>this.allowedMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),po(()=>this.forbiddenMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u==null?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:t}){return this.mode==="all"||this.mode==="otherOnly"&&!t}}function X0(n){var e,r,i,o,s,a,l,u,c,d,h,p,f;let t="";return n.t&&(t=`(${n.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:(e=n.formattedLinks)!=null?e:"plaintext",markup:(r=n.markup)!=null?r:!1,useFallbackMentions:(i=n.useFallbackMentions)!=null?i:!1,sameTabLinkRules:(o=n.sameTabLinkRules)!=null?o:[],enableEmojiImageFallback:(s=n.enableEmojiImageFallback)!=null?s:!1,highlight:(a=n.highlight)!=null?a:[],contactInfo:(l=n.contactInfo)!=null?l:!1,suppression:(u=n.suppression)!=null?u:new sC({mode:"off"}),contactInfoHiddenText:(h=(d=n.contactInfoHiddenText)!=null?d:(c=n.suppression)==null?void 0:c.replacement)!=null?h:t,customEmojiUrls:(p=n.customEmojiUrls)!=null?p:{},enableActions:(f=n.enableActions)!=null?f:!0}}class K0 extends Ym{constructor(){super(...arguments),this.conversationListSubscription=null,this.extCurrentConversationId$=Pt(null),this.conversationsArray$=Pt([]),this.conversationsMap$=Pt({})}listenForConversations(t){const e=t.subscribeConversations(r=>{Vi(()=>{this.conversationsArray$.set(r);const i={};for(const o of r)i[o.id]=o;this.conversationsMap$.set(i)})});return this.conversationListSubscription=e,()=>{e.unsubscribe(),this.conversationListSubscription=null}}}function aC({id:n,text:t}){var i;const e=bt(),r=Et(()=>{var a;if(e instanceof K0)return;const o=e.state$.extCurrentConversationId.get(),s=o&&e.state$.participants.child(o).get();return(a=s==null?void 0:s.find(l=>l.user.id===n))==null?void 0:a.user});return C("span",{className:"t-mention","t-is-current-user":Et(e.extUserId$)===n?"":void 0,children:`@${(i=r==null?void 0:r.name)!=null?i:t}`})}function fo(n,t){const e=n.flatMap(r=>{if(typeof r=="string")return Ud(r,t.highlight);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletpoint":case"bulletPoint":return lC(r,t);case"bulletlist":case"bulletList":return[ht("ul",null,...fo(r.children,t))];case"autolink":case"autoLink":case"link":return cC(r,t);case"codeblock":case"codeBlock":return[C("code",{"data-language":r.language,children:Ud(r.text,t.highlight)})];case"codespan":case"codeSpan":return C("code",{children:Ud((i=r.text,i.replace(/^\s*\n/m,"").replace(/\n\s*$/m,"")),t.highlight)});case"mention":return po.falsy(t.useFallbackMentions),C(aC,{id:r.id,text:r.text},r.id);case"suppressed":return[C("i",{children:t.contactInfoHiddenText})];case"emoji":return t.enableEmojiImageFallback?[C(uC,{unicode:r.text})]:[r.text];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return dC(r,t);case"customemoji":case"customEmoji":return r.text;default:po.never(r)}var i});return e.every(r=>typeof r=="string")?[e.join("")]:e}function Ud(n,t){if(t.length===0)return[n];const e=function(i){const o=i.map(a=>a.trim()).filter(a=>a);if(o.length===0)return eC;const s=o.map(nC).join("|");return new RegExp(s,"gi")}(t),r=Zu(n,e).map(i=>({offset:i.index,matchedText:i[0]}));return function(i,o,s){let a=0;const l=[];for(const u of o)u.offset<a||(u.offset>a&&l.push(i.substring(a,u.offset)),l.push(...s(u)),a=u.offset+u.matchedText.length);return a<i.length&&l.push(i.substring(a)),l}(n,r,({matchedText:i})=>[C("span",{className:"highlighted-text",children:i})])}const lC=(n,t)=>[ht({bold:"strong",italic:"em",strikethrough:"del",blockquote:"blockquote",bulletpoint:"li",bulletPoint:"li"}[n.type],null,...fo(n.children,t))];function uC({unicode:n}){const[t,e]=nt(()=>n!==":arslan:");return J(()=>{t&&!$m(n)&&e(!1)},[]),t?C("span",{className:"t-emoji",children:n}):C("img",{className:"t-emoji",src:oC(n),alt:n})}const cC=(n,t)=>{const e="children"in n?n.children:[n.text];switch(t.formattedLinks){case"link":return[ht("a",{target:function(r,i){for(const o of r)if(W0.test(o)){if(cl(o).test(i))return"_top"}else if(tC(o,i))return"_top";return"_blank"}(t.sameTabLinkRules,n.url),href:n.url,rel:"noreferrer"},...fo(e,t))];case"plaintext":case!1:return"children"in n&&n.children.every(r=>typeof r=="string")?[n.children.join("")]:[ht(Vt,null,...fo(e,t))];default:po.never(t.formattedLinks)}},dC=(n,t)=>t.enableActions?[ht("button",{"data-type":n.type,"data-action":n.action,"data-params":JSON.stringify(n.params),disabled:!0},...fo(n.children,t))]:[null];function q0({block:n,nonInteractive:t,className:e=""}){const r=!t,i=function(o,s={}){return fo(o,X0(s))}(n.children,{enableEmojiImageFallback:!0,formattedLinks:r?"link":"plaintext",enableActions:r});return ht("span",{className:`t-text ${e}`},...i)}function hC(n){const t=cn(),e=bt(),{className:r="",...i}=n,o=Et(()=>e.state$.messages.child(e.state$.extCurrentConversationId.get()).lookup.child(n.message.id).content.child(0).url.get());return C("div",{className:`t-message-content ${r}`,children:n.message.content.map(s=>{var a;return C(pC,{block:s,theme:t,downloadUrl:o,...i},n.message.createdAt+((a=n.message.editedAt)!=null?a:0))})})}function pC({common:n,block:t,message:e,theme:r,downloadUrl:i}){const o=function(s,a){switch(a.type){case"text":return s.TextBlock;case"location":return s.LocationBlock;case"file":switch(a.subtype){case"image":return s.ImageBlock;case"video":return s.VideoBlock;case"voice":return s.VoiceBlock;case"audio":return s.AudioBlock;default:return s.FileBlock}default:St.never(a)}}(r,t);return C(o,{block:t,common:n,message:e,downloadUrl:i})}function dl(n,t,e=!0){const r=rt(o=>{o.keyCode===27&&n()},[n]),i=rt(o=>{o.target instanceof HTMLElement&&o.target.closest(t)===null&&n()},[t,n]);J(()=>{if(e)return window.addEventListener("keydown",r,!0),document.addEventListener("mousedown",i,!0),()=>{window.removeEventListener("keydown",r,!0),document.removeEventListener("mousedown",i,!0)}},[r,i,e])}function J0(n){const[t,e]=nt();return J(()=>{let r=!0;return n().then(i=>{r&&e({value:i})}),()=>{r=!1}},[n]),t}function Hd(){return C(Pa,{type:"spinner","aria-label":Et(bt().t$).LOADING,className:"t-loading-icon"})}const fC="https://cdn.jsdelivr.net/npm/emoji-picker-element@1.26.3/+esm",$d=function(n){let t;return()=>(t===void 0&&(t={value:n()}),t.value)}(async function(){if(typeof window=="undefined"||window.document===void 0)return new Promise(()=>{});try{const n=await import(fC);return await new n.Database().ready(),n}catch(n){return vc.error("Failed to load emoji picker:",n),new Promise(()=>{})}});function Z0(n){const{onClose:t,onEmojiSelected:e}=IO(),r=X(null),i=J0($d);return J(()=>{if(!i)return;St.defined(r.current);const o=r.current,s=o.shadowRoot;(function(u,c){const d=document.createElement("style");d.textContent=c,u.appendChild(d)})(s,".search-row{margin-right:var(--emoji-padding)}.emoji-menu{grid-template-columns:repeat(auto-fill,var(--total-emoji-size));padding:var(--emoji-padding)}.emoji,button.emoji{border-radius:8px}.favorites{border-top-width:1px}input.search:focus{border-color:var(--input-focused-border-color);outline:0}.picker{container-type:size}@container (height < 300px){.favorites{display:none}}#skintone-button{margin:0 -3px 0 4px}.custom-emoji{padding:0}#emo-🏻,#emo-🏼,#emo-🏽,#emo-🏾,#emo-🏿{display:none}[data-has-mouse] .emoji:hover{background-color:var(--button-hover-background)}");const a=u=>{var d;const c=(d=u.detail.unicode)!=null?d:u.detail.name;e(c)};function l(u){u.pointerType==="mouse"&&(s.querySelector("section").dataset.hasMouse="true")}return o.addEventListener("emoji-click",a),o.addEventListener("pointermove",l,{once:!0}),()=>{o.removeEventListener("emoji-click",a),o.removeEventListener("pointermove",l)}},[i,e]),J(()=>{var o;i&&r.current&&((o=r.current.shadowRoot.getElementById("search"))==null||o.focus())},[i]),dl(()=>t(),".t-emoji-picker"),C("div",i?{className:"t-emoji-picker",children:C("emoji-picker",{ref:r,class:n.colorScheme})}:{className:"t-emoji-picker","t-loading":"",children:C(Hd,{})})}function mC(n){const{messageId:t,colorScheme:e,...r}=n,{closePopover:i}=RO(),o=$i();return C("div",{...r,children:C(Jf.Provider,{value:{onClose:i,onEmojiSelected:s=>{o.addReaction(t,s),i()}},children:C(Z0,{colorScheme:e})})})}function jd(){return jd=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},jd.apply(this,arguments)}function Q0(n,t){if(n==null)return{};var e,r,i={},o=Object.keys(n);for(r=0;r<o.length;r++)e=o[r],t.indexOf(e)>=0||(i[e]=n[e]);return i}function Yd(n,t){return Yd=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},Yd(n,t)}function tA(n,t){n.prototype=Object.create(t.prototype),n.prototype.constructor=n,Yd(n,t)}function eA(){}function nA(){}nA.resetWarningCache=eA;function rA(n,t){return n.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}(function(){function n(r,i,o,s,a,l){if(l!=="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return n}n.isRequired=n;var e={array:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:t,element:n,elementType:n,instanceOf:t,node:n,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:nA,resetWarningCache:eA};e.PropTypes=e})();const iA=!1,oA=Ot.createContext(null);var xs="unmounted",pi="exited",fi="entering",mo="entered",zd="exiting",or=function(n){function t(r,i){var o;o=n.call(this,r,i)||this;var s,a=i&&!i.isMounting?r.enter:r.appear;return o.appearStatus=null,r.in?a?(s=pi,o.appearStatus=fi):s=mo:s=r.unmountOnExit||r.mountOnEnter?xs:pi,o.state={status:s},o.nextCallback=null,o}tA(t,n),t.getDerivedStateFromProps=function(r,i){return r.in&&i.status===xs?{status:pi}:null};var e=t.prototype;return e.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},e.componentDidUpdate=function(r){var i=null;if(r!==this.props){var o=this.state.status;this.props.in?o!==fi&&o!==mo&&(i=fi):o!==fi&&o!==mo||(i=zd)}this.updateStatus(!1,i)},e.componentWillUnmount=function(){this.cancelNextCallback()},e.getTimeouts=function(){var r,i,o,s=this.props.timeout;return r=i=o=s,s!=null&&typeof s!="number"&&(r=s.exit,i=s.enter,o=s.appear!==void 0?s.appear:i),{exit:r,enter:i,appear:o}},e.updateStatus=function(r,i){r===void 0&&(r=!1),i!==null?(this.cancelNextCallback(),i===fi?this.performEnter(r):this.performExit()):this.props.unmountOnExit&&this.state.status===pi&&this.setState({status:xs})},e.performEnter=function(r){var i=this,o=this.props.enter,s=this.context?this.context.isMounting:r,a=this.props.nodeRef?[s]:[Ot.findDOMNode(this),s],l=a[0],u=a[1],c=this.getTimeouts(),d=s?c.appear:c.enter;!r&&!o||iA?this.safeSetState({status:mo},function(){i.props.onEntered(l)}):(this.props.onEnter(l,u),this.safeSetState({status:fi},function(){i.props.onEntering(l,u),i.onTransitionEnd(d,function(){i.safeSetState({status:mo},function(){i.props.onEntered(l,u)})})}))},e.performExit=function(){var r=this,i=this.props.exit,o=this.getTimeouts(),s=this.props.nodeRef?void 0:Ot.findDOMNode(this);i&&!iA?(this.props.onExit(s),this.safeSetState({status:zd},function(){r.props.onExiting(s),r.onTransitionEnd(o.exit,function(){r.safeSetState({status:pi},function(){r.props.onExited(s)})})})):this.safeSetState({status:pi},function(){r.props.onExited(s)})},e.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},e.safeSetState=function(r,i){i=this.setNextCallback(i),this.setState(r,i)},e.setNextCallback=function(r){var i=this,o=!0;return this.nextCallback=function(s){o&&(o=!1,i.nextCallback=null,r(s))},this.nextCallback.cancel=function(){o=!1},this.nextCallback},e.onTransitionEnd=function(r,i){this.setNextCallback(i);var o=this.props.nodeRef?this.props.nodeRef.current:Ot.findDOMNode(this),s=r==null&&!this.props.addEndListener;if(o&&!s){if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],l=a[0],u=a[1];this.props.addEndListener(l,u)}r!=null&&setTimeout(this.nextCallback,r)}else setTimeout(this.nextCallback,0)},e.render=function(){var r=this.state.status;if(r===xs)return null;var i=this.props,o=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var s=Q0(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ot.createElement(oA.Provider,{value:null},typeof o=="function"?o(r,s):Ot.cloneElement(Ot.Children.only(o),s))},t}(Ot.Component);function go(){}or.contextType=oA,or.propTypes={},or.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:go,onEntering:go,onEntered:go,onExit:go,onExiting:go,onExited:go},or.UNMOUNTED=xs,or.EXITED=pi,or.ENTERING=fi,or.ENTERED=mo,or.EXITING=zd;var Vd=function(n,t){return n&&t&&t.split(" ").forEach(function(e){return i=e,void((r=n).classList?r.classList.remove(i):typeof r.className=="string"?r.className=rA(r.className,i):r.setAttribute("class",rA(r.className&&r.className.baseVal||"",i)));var r,i})},Wd=function(n){function t(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return(r=n.call.apply(n,[this].concat(o))||this).appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1];r.removeClasses(c,"exit"),r.addClass(c,d?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(a,l)},r.onEntering=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1]?"appear":"enter";r.addClass(c,d,"active"),r.props.onEntering&&r.props.onEntering(a,l)},r.onEntered=function(a,l){var u=r.resolveArguments(a,l),c=u[0],d=u[1]?"appear":"enter";r.removeClasses(c,d),r.addClass(c,d,"done"),r.props.onEntered&&r.props.onEntered(a,l)},r.onExit=function(a){var l=r.resolveArguments(a)[0];r.removeClasses(l,"appear"),r.removeClasses(l,"enter"),r.addClass(l,"exit","base"),r.props.onExit&&r.props.onExit(a)},r.onExiting=function(a){var l=r.resolveArguments(a)[0];r.addClass(l,"exit","active"),r.props.onExiting&&r.props.onExiting(a)},r.onExited=function(a){var l=r.resolveArguments(a)[0];r.removeClasses(l,"exit"),r.addClass(l,"exit","done"),r.props.onExited&&r.props.onExited(a)},r.resolveArguments=function(a,l){return r.props.nodeRef?[r.props.nodeRef.current,a]:[a,l]},r.getClassNames=function(a){var l=r.props.classNames,u=typeof l=="string",c=u?(u&&l?l+"-":"")+a:l[a];return{baseClassName:c,activeClassName:u?c+"-active":l[a+"Active"],doneClassName:u?c+"-done":l[a+"Done"]}},r}tA(t,n);var e=t.prototype;return e.addClass=function(r,i,o){var s=this.getClassNames(i)[o+"ClassName"],a=this.getClassNames("enter").doneClassName;i==="appear"&&o==="done"&&a&&(s+=" "+a),o==="active"&&r&&r.scrollTop,s&&(this.appliedClasses[i][o]=s,function(l,u){l&&u&&u.split(" ").forEach(function(c){return h=c,void((d=l).classList?d.classList.add(h):function(p,f){return p.classList?!!f&&p.classList.contains(f):(" "+(p.className.baseVal||p.className)+" ").indexOf(" "+f+" ")!==-1}(d,h)||(typeof d.className=="string"?d.className=d.className+" "+h:d.setAttribute("class",(d.className&&d.className.baseVal||"")+" "+h)));var d,h})}(r,s))},e.removeClasses=function(r,i){var o=this.appliedClasses[i],s=o.base,a=o.active,l=o.done;this.appliedClasses[i]={},s&&Vd(r,s),a&&Vd(r,a),l&&Vd(r,l)},e.render=function(){var r=this.props;r.classNames;var i=Q0(r,["classNames"]);return Ot.createElement(or,jd({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(Ot.Component);Wd.defaultProps={classNames:""},Wd.propTypes={};const gC={ltr:["ArrowLeft","ArrowRight"],rtl:["ArrowRight","ArrowLeft"],ttb:["ArrowUp","ArrowDown"]};function sA(n,{focused:t,setFocused:e,itemCount:r,dir:i,onConfirm:o,onSpace:s}){if(r===0)return!1;const a=c=>{var d,h,p;d=0,h=c,p=r-1,c=Math.max(d,Math.min(h,p)),e(c)},[l,u]=gC[i];switch(n){case l:return a(t-1),!0;case u:return a(t+1),!0;case" ":return!!s&&s();case"Enter":case"Tab":return o(),!0}return!1}function aA({focused:n,setFocused:t,buttonId:e}){se(()=>{var a;const s=e(n);s&&((a=document.getElementById(s))==null||a.scrollIntoView({block:"nearest"}))},[n,e]);const r=rt(s=>{const a=s.currentTarget.dataset.index;t(+a)},[t]),i=at(()=>({role:"menu","aria-activedescendant":e(n)}),[n,e]),o=rt(s=>({onMouseMove:r,id:e(s),"data-index":s}),[r,e]);return{containerProps:i,itemProps:o}}function EC(n){const[t,e]=nt([]),[r,i]=nt([]),[o,s]=nt(0),[a,l]=nt(0),u=J0($d),c=at(()=>u&&new u.value.Database({}),[u]),d=ts(),h=Et(d.state$.suggestEmojiQuery);J(()=>{c&&(h?async function(){const A=await c.getPreferredSkinTone();l(A);let v=await c.getEmojiBySearchQuery(h);if(v=v.filter(_=>_.url||function(O){return O.version<=jm&&!vC.includes(O.unicode)}(_)),function(_,O){O.sort((T,S)=>{var w,b;const N=(w=T.shortcodes)==null?void 0:w.find(I=>I.startsWith(_)),y=(b=S.shortcodes)==null?void 0:b.find(I=>I.startsWith(_));return N&&!y?-1:!N&&y?1:N&&y?N.length-y.length:0})}(h.substring(1),v),s(0),e(v),v.length>0&&i(v),h.endsWith(":")){const _=h.slice(1,-1),O=v.find(T=>{var S;return(S=T.shortcodes)==null?void 0:S.includes(_)});O&&d.selectEmoji(Ms(O,A))}}():e([]))},[h,d,c]);const p=rt(A=>{const v=t[A];return v&&"emoji-button-"+Ms(v,a)},[t,a]),{containerProps:f,itemProps:m}=aA({focused:o,setFocused:s,buttonId:p}),g=t.length>0;dl(()=>d.closeSuggester(),".t-emoji-suggest-bar",g),J(()=>{if(g)return d.listenKeydown("emoji",A=>sA(A,{dir:"ltr",focused:o,setFocused:s,itemCount:t.length,onConfirm(){const v=t[o];St.defined(v),d.selectEmoji(Ms(v,a))}})),()=>{d.listenKeydown("emoji",void 0)};d.listenKeydown("emoji",void 0)},[d,t,o,g,a]);const E=X(null);return C(Wd,{in:g,timeout:100,classNames:"slide",mountOnEnter:!0,unmountOnExit:!0,nodeRef:E,children:C("div",{className:"t-emoji-suggest-bar",ref:E,...f,children:r.map((A,v)=>C(AC,{emoji:A,skinTone:a,focused:v===o,onSelect:_=>d.selectEmoji(_),...m(v)},Ms(A,a)))})})}function Ms(n,t){return Gd(n)?lA(n,t):n.name}function Gd(n){return!!n.unicode}function AC(n){var l;const{emoji:t,focused:e,skinTone:r,onSelect:i,...o}=n,s=((l=t.shortcodes)!=null?l:[]).join(", "),a=Gd(t)?[t.unicode,s].join(", "):s;return C("button",{"t-focused":e?"":void 0,title:s,"aria-label":a,onClick:()=>i(Ms(t,r)),...o,children:Gd(t)?lA(t,r):null})}function lA(n,t){var r,i;const e=(r=n.skins)==null?void 0:r.find(o=>o.tone===t);return(i=e==null?void 0:e.unicode)!=null?i:n.unicode}const vC=["🏻","🏼","🏽","🏾","🏿"],uA=Math.min,Ps=Math.max,hl=Math.round,Ln=n=>({x:n,y:n});function cA(n){return n.split("-")[0]}const _C=new Set(["top","bottom"]);function dA(n){return _C.has(cA(n))?"y":"x"}function hA(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function pA(n,t,e){let{reference:r,floating:i}=n;const o=dA(t),s=function(f){return dA(f)==="x"?"y":"x"}(t),a=s==="y"?"height":"width",l=cA(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(function(f){return f.split("-")[1]}(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}function pl(){return typeof window!="undefined"}function Eo(n){return fA(n)?(n.nodeName||"").toLowerCase():"#document"}function Ve(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function sr(n){var t;return(t=(fA(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function fA(n){return!!pl()&&(n instanceof Node||n instanceof Ve(n).Node)}function gn(n){return!!pl()&&(n instanceof Element||n instanceof Ve(n).Element)}function xn(n){return!!pl()&&(n instanceof HTMLElement||n instanceof Ve(n).HTMLElement)}function mA(n){return!(!pl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ve(n).ShadowRoot)}const yC=new Set(["inline","contents"]);function Bs(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=En(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!yC.has(i)}const TC=new Set(["table","td","th"]);function OC(n){return TC.has(Eo(n))}const SC=[":popover-open",":modal"];function fl(n){return SC.some(t=>{try{return n.matches(t)}catch(e){return!1}})}const NC=["transform","translate","scale","rotate","perspective"],CC=["transform","translate","scale","rotate","perspective","filter"],bC=["paint","layout","strict","content"];function Xd(n){const t=Kd(),e=gn(n)?En(n):n;return NC.some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||CC.some(r=>(e.willChange||"").includes(r))||bC.some(r=>(e.contain||"").includes(r))}function Kd(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const IC=new Set(["html","body","#document"]);function Ao(n){return IC.has(Eo(n))}function En(n){return Ve(n).getComputedStyle(n)}function ml(n){return gn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Dr(n){if(Eo(n)==="html")return n;const t=n.assignedSlot||n.parentNode||mA(n)&&n.host||sr(n);return mA(t)?t.host:t}function gA(n){const t=Dr(n);return Ao(t)?n.ownerDocument?n.ownerDocument.body:n.body:xn(t)&&Bs(t)?t:gA(t)}function qd(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=gA(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ve(i);if(o){const a=Jd(s);return t.concat(s,s.visualViewport||[],Bs(i)?i:[],a&&e?qd(a):[])}return t.concat(i,qd(i,[],e))}function Jd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function EA(n){const t=En(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=xn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=hl(e)!==o||hl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function AA(n){return gn(n)?n:n.contextElement}function vo(n){const t=AA(n);if(!xn(t))return Ln(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=EA(t);let s=(o?hl(e.width):e.width)/r,a=(o?hl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const wC=Ln(0);function vA(n){const t=Ve(n);return Kd()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:wC}function Fs(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=AA(n);let s=Ln(1);t&&(r?gn(r)&&(s=vo(r)):s=vo(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ve(h))&&p}(o,e,r)?vA(o):Ln(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ve(o),p=r&&gn(r)?Ve(r):r;let f=h,m=Jd(f);for(;m&&r&&p!==f;){const g=vo(m),E=m.getBoundingClientRect(),A=En(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ve(m),m=Jd(f)}}return hA({width:c,height:d,x:l,y:u})}function gl(n,t){const e=ml(n).scrollLeft;return t?t.left+e:Fs(sr(n)).left+e}function _A(n,t){const e=n.getBoundingClientRect();return{x:e.left+t.scrollLeft-gl(n,e),y:e.top+t.scrollTop}}const RC=new Set(["absolute","fixed"]);function yA(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ve(i),a=sr(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const f=Kd();(!f||f&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}const p=gl(a);if(p<=0){const f=a.ownerDocument,m=f.body,g=getComputedStyle(m),E=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,A=Math.abs(a.clientWidth-m.clientWidth-E);A<=25&&(u-=A)}else p<=25&&(u+=p);return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=sr(i),s=ml(i),a=i.ownerDocument.body,l=Ps(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=Ps(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+gl(i);const d=-s.scrollTop;return En(a).direction==="rtl"&&(c+=Ps(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}(sr(n));else if(gn(t))r=function(i,o){const s=Fs(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=xn(i)?vo(i):Ln(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=vA(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return hA(r)}function TA(n,t){const e=Dr(n);return!(e===t||!gn(e)||Ao(e))&&(En(e).position==="fixed"||TA(e,t))}function DC(n,t,e){const r=xn(t),i=sr(t),o=e==="fixed",s=Fs(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Ln(0);function u(){l.x=gl(i)}if(r||!r&&!o)if((Eo(t)!=="body"||Bs(i))&&(a=ml(t)),r){const d=Fs(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Ln(0):_A(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Zd(n){return En(n).position==="static"}function OA(n,t){if(!xn(n)||En(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return sr(n)===e&&(e=e.ownerDocument.body),e}function SA(n,t){const e=Ve(n);if(fl(n))return e;if(!xn(n)){let i=Dr(n);for(;i&&!Ao(i);){if(gn(i)&&!Zd(i))return i;i=Dr(i)}return e}let r=OA(n,t);for(;r&&OC(r)&&Zd(r);)r=OA(r,t);return r&&Ao(r)&&Zd(r)&&!Xd(r)?e:r||function(i){let o=Dr(i);for(;xn(o)&&!Ao(o);){if(Xd(o))return o;if(fl(o))return null;o=Dr(o)}return null}(n)||e}const kC={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=sr(r),a=!!t&&fl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Ln(1);const c=Ln(0),d=xn(r);if((d||!d&&!o)&&((Eo(r)!=="body"||Bs(s))&&(l=ml(r)),xn(r))){const p=Fs(r);u=vo(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Ln(0):_A(s,l);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:sr,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?fl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=qd(u,[],!1).filter(g=>gn(g)&&Eo(g)!=="body"),p=null;const f=En(u).position==="fixed";let m=f?Dr(u):u;for(;gn(m)&&!Ao(m);){const g=En(m),E=Xd(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&RC.has(p.position)||Bs(m)&&!E&&TA(u,m))?h=h.filter(A=>A!==m):p=g,m=Dr(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=yA(t,c,i);return u.top=Ps(d.top,u.top),u.right=uA(d.right,u.right),u.bottom=uA(d.bottom,u.bottom),u.left=Ps(d.left,u.left),u},yA(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:SA,getElementRects:async function(n){const t=this.getOffsetParent||SA,e=this.getDimensions,r=await e(n.floating);return{reference:DC(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=EA(n);return{width:t,height:e}},getScale:vo,isElement:gn,isRTL:function(n){return En(n).direction==="rtl"}},LC=(n,t,e)=>{const r=new Map,i={platform:kC,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=pA(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:w,reset:b}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...w}},b&&_<=50&&(_++,typeof b=="object"&&(b.placement&&(A=b.placement),b.rects&&(m=b.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):b.rects),{x:g,y:E}=pA(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var El=typeof document!="undefined"?se:function(){};function Al(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!Al(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!Al(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function NA(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function CA(n,t){const e=NA(n);return Math.round(t*e)/e}function Qd(n){const t=X(n);return El(()=>{t.current=n}),t}function xC(n){const{anchorSelector:t,children:e,...r}=n,i=at(()=>document.querySelector(t),[t]),{refs:o,floatingStyles:s}=function(a){a===void 0&&(a={});const{placement:l="bottom",strategy:u="absolute",middleware:c=[],platform:d,elements:{reference:h,floating:p}={},transform:f=!0,whileElementsMounted:m,open:g}=a,[E,A]=nt({x:0,y:0,strategy:u,placement:l,middlewareData:{},isPositioned:!1}),[v,_]=nt(c);Al(v,c)||_(c);const[O,T]=nt(null),[S,N]=nt(null),y=rt(q=>{q!==P.current&&(P.current=q,T(q))},[]),w=rt(q=>{q!==k.current&&(k.current=q,N(q))},[]),b=h||O,I=p||S,P=X(null),k=X(null),B=X(E),$=m!=null,U=Qd(m),V=Qd(d),L=Qd(g),Q=rt(()=>{if(!P.current||!k.current)return;const q={placement:l,strategy:u,middleware:v};V.current&&(q.platform=V.current),LC(P.current,k.current,q).then(ot=>{const ut={...ot,isPositioned:L.current!==!1};j.current&&!Al(B.current,ut)&&(B.current=ut,Hi(()=>{A(ut)}))})},[v,l,u,V,L]);El(()=>{g===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,A(q=>({...q,isPositioned:!1})))},[g]);const j=X(!1);El(()=>(j.current=!0,()=>{j.current=!1}),[]),El(()=>{if(b&&(P.current=b),I&&(k.current=I),b&&I){if(U.current)return U.current(b,I,Q);Q()}},[b,I,Q,U,$]);const tt=at(()=>({reference:P,floating:k,setReference:y,setFloating:w}),[y,w]),it=at(()=>({reference:b,floating:I}),[b,I]),x=at(()=>{const q={position:u,left:0,top:0};if(!it.floating)return q;const ot=CA(it.floating,E.x),ut=CA(it.floating,E.y);return f?{...q,transform:"translate("+ot+"px, "+ut+"px)",...NA(it.floating)>=1.5&&{willChange:"transform"}}:{position:u,left:ot,top:ut}},[u,f,it.floating,E.x,E.y]);return at(()=>({...E,update:Q,refs:tt,elements:it,floatingStyles:x}),[E,Q,tt,it,x])}({placement:"top-start"});return se(()=>{i&&o.setReference(i)},[o,i]),C("div",{ref:o.setFloating,style:{...s,zIndex:1e3},...r,children:e})}function MC(n){const t=bt(),e=Et(()=>t.mentionableUsers$.get()),[r,i]=nt(0),o=ts(),s=Et(o.state$.suggestMentionQuery),a=at(()=>Object.fromEntries(e.map(p=>[p.id,vO(p.name)])),[e]),l=at(()=>{if(!s)return[];const p=bA(s);return p===""?e:e.filter(f=>a[f.id].some(m=>function(g,E){return Uf(g.substring(0,E.length),E)}(m,p)))},[s,e,a]),u=X(void 0);J(()=>{if(u.current){const p=l.findIndex(f=>f.id===u.current);i(p===-1?0:p)}},[l]),J(()=>{var p;u.current=(p=l[r])==null?void 0:p.id},[r,l]);const c=rt(p=>{var m;const f=(m=l[p])==null?void 0:m.id;return f&&"mention-button-"+f},[l]),{containerProps:d,itemProps:h}=aA({focused:r,setFocused:i,buttonId:c});return J(()=>{if(l.length!==0)return o.listenKeydown("mention",p=>sA(p,{dir:"ttb",focused:r,setFocused:i,itemCount:l.length,onSpace(){if(s){const f=l[r];if(Uf(f.name,bA(s)))return o.selectMention(f),!0}return!1},onConfirm(){const f=l[r];o.selectMention(f)}})),()=>{o.listenKeydown("mention",void 0)}},[o,r,l,s]),dl(()=>o.closeSuggester(),".t-mention-suggest-list",l.length>0),l.length===0?null:C(xC,{className:"t-mention-suggest-list",...d,anchorSelector:".ProseMirror-suggestion",children:l.map((p,f)=>C(PC,{user:p,isFocused:f===r,onSelect:()=>o.selectMention(p),...h(f)},p.id))})}const PC=Ot.memo(function(n){const{user:t,isFocused:e,onSelect:r,...i}=n;return C("button",{className:e?"focused":"",onClick:()=>r(t.id),...i,children:t.name})});function bA(n){return St(n[0]==="@"),n.substring(1)}function Us(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function IA(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function vl(...n){return t=>{let e=!1;const r=n.map(i=>{const o=IA(i,t);return e||typeof o!="function"||(e=!0),o});if(e)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():IA(n[i],null)}}}}function Ft(...n){return rt(vl(...n),n)}function mi(n,t=[]){let e=[];const r=()=>{const i=e.map(o=>nn(o));return function(o){const s=(o==null?void 0:o[n])||i;return at(()=>({[`__scope${n}`]:{...o,[n]:s}}),[o,s])}};return r.scopeName=n,[function(i,o){const s=nn(o),a=e.length;e=[...e,o];const l=u=>{var m;const{scope:c,children:d,...h}=u,p=((m=c==null?void 0:c[n])==null?void 0:m[a])||s,f=at(()=>h,Object.values(h));return C(p.Provider,{value:f,children:d})};return l.displayName=i+"Provider",[l,function(u,c){var h;const d=Re(((h=c==null?void 0:c[n])==null?void 0:h[a])||s);if(d)return d;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}]},BC(r,...t)]}function BC(...n){const t=n[0];if(n.length===1)return t;const e=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(i){const o=r.reduce((s,{useScope:a,scopeName:l})=>({...s,...a(i)[`__scope${l}`]}),{});return at(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return e.scopeName=t.scopeName,e}function th(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Hs(n){const t=FC(n),e=et((r,i)=>{const{children:o,...s}=r,a=Cn.toArray(o),l=a.find(HC);if(l){const u=l.props.children,c=a.map(d=>d===l?Cn.count(u)>1?Cn.only(null):qn(u)?u.props.children:null:d);return C(t,{...s,ref:i,children:qn(u)?zr(u,void 0,c):null})}return C(t,{...s,ref:i,children:o})});return e.displayName=`${n}.Slot`,e}function FC(n){const t=et((e,r)=>{const{children:i,...o}=e;if(qn(i)){const s=function(l){var d,h;let u=(d=Object.getOwnPropertyDescriptor(l.props,"ref"))==null?void 0:d.get,c=u&&"isReactWarning"in u&&u.isReactWarning;return c?l.ref:(u=(h=Object.getOwnPropertyDescriptor(l,"ref"))==null?void 0:h.get,c=u&&"isReactWarning"in u&&u.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}(i),a=function(l,u){const c={...u};for(const d in u){const h=l[d],p=u[d];/^on[A-Z]/.test(d)?h&&p?c[d]=(...f)=>{const m=p(...f);return h(...f),m}:h&&(c[d]=h):d==="style"?c[d]={...h,...p}:d==="className"&&(c[d]=[h,p].filter(Boolean).join(" "))}return{...l,...c}}(o,i.props);return i.type!==Vt&&(a.ref=r?vl(r,s):s),zr(i,a)}return Cn.count(i)>1?Cn.only(null):null});return t.displayName=`${n}.SlotClone`,t}var UC=Symbol("radix.slottable");function HC(n){return qn(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===UC}var Xt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((n,t)=>{const e=Hs(`Primitive.${t}`),r=et((i,o)=>{const{asChild:s,...a}=i,l=s?e:t;return typeof window!="undefined"&&(window[Symbol.for("radix-ui")]=!0),C(l,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...n,[t]:r}},{});function eh(n,t){n&&Hi(()=>n.dispatchEvent(t))}function sn(n){const t=X(n);return J(()=>{t.current=n}),at(()=>(...e)=>{var r;return(r=t.current)==null?void 0:r.call(t,...e)},[])}function wA(n,t=globalThis==null?void 0:globalThis.document){const e=sn(n);J(()=>{const r=i=>{i.key==="Escape"&&e(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[e,t])}var RA,nh="dismissableLayer.update",$C="dismissableLayer.pointerDownOutside",jC="dismissableLayer.focusOutside",DA=nn({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kA=et((n,t)=>{var S;const{disableOutsidePointerEvents:e=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=n,u=Re(DA),[c,d]=nt(null),h=(S=c==null?void 0:c.ownerDocument)!=null?S:globalThis==null?void 0:globalThis.document,[,p]=nt({}),f=Ft(t,N=>d(N)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(g),A=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,_=A>=E,O=function(N,y=globalThis==null?void 0:globalThis.document){const w=sn(N),b=X(!1),I=X(()=>{});return J(()=>{const P=B=>{if(B.target&&!b.current){let $=function(){xA($C,w,U,{discrete:!0})};const U={originalEvent:B};B.pointerType==="touch"?(y.removeEventListener("click",I.current),I.current=$,y.addEventListener("click",I.current,{once:!0})):$()}else y.removeEventListener("click",I.current);b.current=!1},k=window.setTimeout(()=>{y.addEventListener("pointerdown",P)},0);return()=>{window.clearTimeout(k),y.removeEventListener("pointerdown",P),y.removeEventListener("click",I.current)}},[y,w]),{onPointerDownCapture:()=>b.current=!0}}(N=>{const y=N.target,w=[...u.branches].some(b=>b.contains(y));_&&!w&&(i==null||i(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h),T=function(N,y=globalThis==null?void 0:globalThis.document){const w=sn(N),b=X(!1);return J(()=>{const I=P=>{P.target&&!b.current&&xA(jC,w,{originalEvent:P},{discrete:!1})};return y.addEventListener("focusin",I),()=>y.removeEventListener("focusin",I)},[y,w]),{onFocusCapture:()=>b.current=!0,onBlurCapture:()=>b.current=!1}}(N=>{const y=N.target;[...u.branches].some(w=>w.contains(y))||(o==null||o(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h);return wA(N=>{A===u.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),J(()=>{if(c)return e&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(RA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),LA(),()=>{e&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=RA)}},[c,h,e,u]),J(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),LA())},[c,u]),J(()=>{const N=()=>p({});return document.addEventListener(nh,N),()=>document.removeEventListener(nh,N)},[]),C(Xt.div,{...l,ref:f,style:{pointerEvents:v?_?"auto":"none":void 0,...n.style},onFocusCapture:th(n.onFocusCapture,T.onFocusCapture),onBlurCapture:th(n.onBlurCapture,T.onBlurCapture),onPointerDownCapture:th(n.onPointerDownCapture,O.onPointerDownCapture)})});kA.displayName="DismissableLayer";var YC=et((n,t)=>{const e=Re(DA),r=X(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return e.branches.add(o),()=>{e.branches.delete(o)}},[e.branches]),C(Xt.div,{...n,ref:i})});function LA(){const n=new CustomEvent(nh);document.dispatchEvent(n)}function xA(n,t,e,{discrete:r}){const i=e.originalEvent.target,o=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:e});t&&i.addEventListener(n,t,{once:!0}),r?eh(i,o):i.dispatchEvent(o)}YC.displayName="DismissableLayerBranch";var rh=0;function MA(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var ih="focusScope.autoFocusOnMount",oh="focusScope.autoFocusOnUnmount",PA={bubbles:!1,cancelable:!0},sh=et((n,t)=>{const{loop:e=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=n,[a,l]=nt(null),u=sn(i),c=sn(o),d=X(null),h=Ft(t,m=>l(m)),p=X({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;J(()=>{if(r){let m=function(v){if(p.paused||!a)return;const _=v.target;a.contains(_)?d.current=_:kr(d.current,{select:!0})},g=function(v){if(p.paused||!a)return;const _=v.relatedTarget;_!==null&&(a.contains(_)||kr(d.current,{select:!0}))},E=function(v){if(document.activeElement===document.body)for(const _ of v)_.removedNodes.length>0&&kr(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const A=new MutationObserver(E);return a&&A.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),A.disconnect()}}},[r,a,p.paused]),J(()=>{if(a){UA.add(p);const g=document.activeElement;if(!a.contains(g)){const E=new CustomEvent(ih,PA);a.addEventListener(ih,u),a.dispatchEvent(E),E.defaultPrevented||(function(A,{select:v=!1}={}){const _=document.activeElement;for(const O of A)if(kr(O,{select:v}),document.activeElement!==_)return}((m=BA(a),m.filter(A=>A.tagName!=="A")),{select:!0}),document.activeElement===g&&kr(a))}return()=>{a.removeEventListener(ih,u),setTimeout(()=>{const E=new CustomEvent(oh,PA);a.addEventListener(oh,c),a.dispatchEvent(E),E.defaultPrevented||kr(g!=null?g:document.body,{select:!0}),a.removeEventListener(oh,c),UA.remove(p)},0)}}var m},[a,u,c,p]);const f=rt(m=>{if(!e&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,E=document.activeElement;if(g&&E){const A=m.currentTarget,[v,_]=function(O){const T=BA(O),S=FA(T,O),N=FA(T.reverse(),O);return[S,N]}(A);v&&_?m.shiftKey||E!==_?m.shiftKey&&E===v&&(m.preventDefault(),e&&kr(_,{select:!0})):(m.preventDefault(),e&&kr(v,{select:!0})):E===A&&m.preventDefault()}},[e,r,p.paused]);return C(Xt.div,{tabIndex:-1,...s,ref:h,onKeyDown:f})});function BA(n){const t=[],e=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;e.nextNode();)t.push(e.currentNode);return t}function FA(n,t){for(const e of n)if(!zC(e,{upTo:t}))return e}function zC(n,{upTo:t}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(t!==void 0&&n===t)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function kr(n,{select:t=!1}={}){if(n&&n.focus){const e=document.activeElement;n.focus({preventScroll:!0}),n!==e&&function(r){return r instanceof HTMLInputElement&&"select"in r}(n)&&t&&n.select()}}sh.displayName="FocusScope";var UA=function(){let n=[];return{add(t){const e=n[0];t!==e&&(e==null||e.pause()),n=HA(n,t),n.unshift(t)},remove(t){var e;n=HA(n,t),(e=n[0])==null||e.resume()}}}();function HA(n,t){const e=[...n],r=e.indexOf(t);return r!==-1&&e.splice(r,1),e}var An=globalThis!=null&&globalThis.document?se:()=>{},VC=qu[" useId ".trim().toString()]||(()=>{}),WC=0;function _l(n){const[t,e]=nt(VC());return An(()=>{n||e(r=>r!=null?r:String(WC++))},[n]),n||(t?`radix-${t}`:"")}const GC=["top","right","bottom","left"],Lr=Math.min,We=Math.max,yl=Math.round,Tl=Math.floor,Mn=n=>({x:n,y:n}),XC={left:"right",right:"left",bottom:"top",top:"bottom"},KC={start:"end",end:"start"};function ah(n,t,e){return We(n,Lr(t,e))}function ar(n,t){return typeof n=="function"?n(t):n}function lr(n){return n.split("-")[0]}function _o(n){return n.split("-")[1]}function lh(n){return n==="x"?"y":"x"}function uh(n){return n==="y"?"height":"width"}function Pn(n){return["top","bottom"].includes(lr(n))?"y":"x"}function ch(n){return lh(Pn(n))}function dh(n){return n.replace(/start|end/g,t=>KC[t])}function Ol(n){return n.replace(/left|right|bottom|top/g,t=>XC[t])}function $A(n){return typeof n!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(n):{top:n,right:n,bottom:n,left:n}}function Sl(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function jA(n,t,e){let{reference:r,floating:i}=n;const o=Pn(t),s=ch(t),a=uh(s),l=lr(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(_o(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}async function $s(n,t){var e;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ar(t,n),f=$A(p),m=a[h?d==="floating"?"reference":"floating":d],g=Sl(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(m)))==null||e?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),E=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(A))&&await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1},_=Sl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:A,strategy:l}):E);return{top:(g.top-_.top+f.top)/v.y,bottom:(_.bottom-g.bottom+f.bottom)/v.y,left:(g.left-_.left+f.left)/v.x,right:(_.right-g.right+f.right)/v.x}}function YA(n,t){return{top:n.top-t.height,right:n.right-t.width,bottom:n.bottom-t.height,left:n.left-t.width}}function zA(n){return GC.some(t=>n[t]>=0)}function Nl(){return typeof window!="undefined"}function yo(n){return VA(n)?(n.nodeName||"").toLowerCase():"#document"}function Ge(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function Bn(n){var t;return(t=(VA(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function VA(n){return!!Nl()&&(n instanceof Node||n instanceof Ge(n).Node)}function vn(n){return!!Nl()&&(n instanceof Element||n instanceof Ge(n).Element)}function Fn(n){return!!Nl()&&(n instanceof HTMLElement||n instanceof Ge(n).HTMLElement)}function WA(n){return!(!Nl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ge(n).ShadowRoot)}function js(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=_n(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!["inline","contents"].includes(i)}function qC(n){return["table","td","th"].includes(yo(n))}function Cl(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch(e){return!1}})}function hh(n){const t=ph(),e=vn(n)?_n(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||["transform","translate","scale","rotate","perspective","filter"].some(r=>(e.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(e.contain||"").includes(r))}function ph(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function To(n){return["html","body","#document"].includes(yo(n))}function _n(n){return Ge(n).getComputedStyle(n)}function bl(n){return vn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function xr(n){if(yo(n)==="html")return n;const t=n.assignedSlot||n.parentNode||WA(n)&&n.host||Bn(n);return WA(t)?t.host:t}function GA(n){const t=xr(n);return To(t)?n.ownerDocument?n.ownerDocument.body:n.body:Fn(t)&&js(t)?t:GA(t)}function Ys(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=GA(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ge(i);if(o){const a=fh(s);return t.concat(s,s.visualViewport||[],js(i)?i:[],a&&e?Ys(a):[])}return t.concat(i,Ys(i,[],e))}function fh(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function XA(n){const t=_n(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=yl(e)!==o||yl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function mh(n){return vn(n)?n:n.contextElement}function Oo(n){const t=mh(n);if(!Fn(t))return Mn(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=XA(t);let s=(o?yl(e.width):e.width)/r,a=(o?yl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const JC=Mn(0);function KA(n){const t=Ge(n);return ph()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:JC}function gi(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=mh(n);let s=Mn(1);t&&(r?vn(r)&&(s=Oo(r)):s=Oo(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ge(h))&&p}(o,e,r)?KA(o):Mn(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ge(o),p=r&&vn(r)?Ge(r):r;let f=h,m=fh(f);for(;m&&r&&p!==f;){const g=Oo(m),E=m.getBoundingClientRect(),A=_n(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ge(m),m=fh(f)}}return Sl({width:c,height:d,x:l,y:u})}function gh(n,t){const e=bl(n).scrollLeft;return t?t.left+e:gi(Bn(n)).left+e}function qA(n,t,e){e===void 0&&(e=!1);const r=n.getBoundingClientRect();return{x:r.left+t.scrollLeft-(e?0:gh(n,r)),y:r.top+t.scrollTop}}function JA(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ge(i),a=Bn(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const p=ph();(!p||p&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=Bn(i),s=bl(i),a=i.ownerDocument.body,l=We(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=We(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+gh(i);const d=-s.scrollTop;return _n(a).direction==="rtl"&&(c+=We(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}(Bn(n));else if(vn(t))r=function(i,o){const s=gi(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=Fn(i)?Oo(i):Mn(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=KA(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Sl(r)}function ZA(n,t){const e=xr(n);return!(e===t||!vn(e)||To(e))&&(_n(e).position==="fixed"||ZA(e,t))}function ZC(n,t,e){const r=Fn(t),i=Bn(t),o=e==="fixed",s=gi(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Mn(0);function u(){l.x=gh(i)}if(r||!r&&!o)if((yo(t)!=="body"||js(i))&&(a=bl(t)),r){const d=gi(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Mn(0):qA(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Eh(n){return _n(n).position==="static"}function QA(n,t){if(!Fn(n)||_n(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return Bn(n)===e&&(e=e.ownerDocument.body),e}function tv(n,t){const e=Ge(n);if(Cl(n))return e;if(!Fn(n)){let i=xr(n);for(;i&&!To(i);){if(vn(i)&&!Eh(i))return i;i=xr(i)}return e}let r=QA(n,t);for(;r&&qC(r)&&Eh(r);)r=QA(r,t);return r&&To(r)&&Eh(r)&&!hh(r)?e:r||function(i){let o=xr(i);for(;Fn(o)&&!To(o);){if(hh(o))return o;if(Cl(o))return null;o=xr(o)}return null}(n)||e}const QC={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=Bn(r),a=!!t&&Cl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Mn(1);const c=Mn(0),d=Fn(r);if((d||!d&&!o)&&((yo(r)!=="body"||js(s))&&(l=bl(r)),Fn(r))){const p=gi(r);u=Oo(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Mn(0):qA(s,l,!0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:Bn,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?Cl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=Ys(u,[],!1).filter(g=>vn(g)&&yo(g)!=="body"),p=null;const f=_n(u).position==="fixed";let m=f?xr(u):u;for(;vn(m)&&!To(m);){const g=_n(m),E=hh(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&["absolute","fixed"].includes(p.position)||js(m)&&!E&&ZA(u,m))?h=h.filter(A=>A!==m):p=g,m=xr(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=JA(t,c,i);return u.top=We(d.top,u.top),u.right=Lr(d.right,u.right),u.bottom=Lr(d.bottom,u.bottom),u.left=We(d.left,u.left),u},JA(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:tv,getElementRects:async function(n){const t=this.getOffsetParent||tv,e=this.getDimensions,r=await e(n.floating);return{reference:ZC(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=XA(n);return{width:t,height:e}},getScale:Oo,isElement:vn,isRTL:function(n){return _n(n).direction==="rtl"}};function ev(n,t){return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function tb(n,t,e,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=mh(n),c=i||o?[...u?Ys(u):[],...Ys(t)]:[];c.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),o&&g.addEventListener("resize",e)});const d=u&&a?function(g,E){let A,v=null;const _=Bn(g);function O(){var T;clearTimeout(A),(T=v)==null||T.disconnect(),v=null}return function T(S,N){S===void 0&&(S=!1),N===void 0&&(N=1),O();const y=g.getBoundingClientRect(),{left:w,top:b,width:I,height:P}=y;if(S||E(),!I||!P)return;const k={rootMargin:-Tl(b)+"px "+-Tl(_.clientWidth-(w+I))+"px "+-Tl(_.clientHeight-(b+P))+"px "+-Tl(w)+"px",threshold:We(0,Lr(1,N))||1};let B=!0;function $(U){const V=U[0].intersectionRatio;if(V!==N){if(!B)return T();V?T(!1,V):A=setTimeout(()=>{T(!1,1e-7)},1e3)}V!==1||ev(y,g.getBoundingClientRect())||T(),B=!1}try{v=new IntersectionObserver($,{...k,root:_.ownerDocument})}catch(U){v=new IntersectionObserver($,k)}v.observe(g)}(!0),O}(u,e):null;let h,p=-1,f=null;s&&(f=new ResizeObserver(g=>{let[E]=g;E&&E.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=f)==null||A.observe(t)})),e()}),u&&!l&&f.observe(u),f.observe(t));let m=l?gi(n):null;return l&&function g(){const E=gi(n);m&&!ev(m,E)&&e(),m=E,h=requestAnimationFrame(g)}(),e(),()=>{var g;c.forEach(E=>{i&&E.removeEventListener("scroll",e),o&&E.removeEventListener("resize",e)}),d==null||d(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const eb=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(u,c){const{placement:d,platform:h,elements:p}=u,f=await(h.isRTL==null?void 0:h.isRTL(p.floating)),m=lr(d),g=_o(d),E=Pn(d)==="y",A=["left","top"].includes(m)?-1:1,v=f&&E?-1:1,_=ar(c,u);let{mainAxis:O,crossAxis:T,alignmentAxis:S}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return g&&typeof S=="number"&&(T=g==="end"?-1*S:S),E?{x:T*v,y:O*A}:{x:O*A,y:T*v}}(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},nb=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:E,y:A}=g;return{x:E,y:A}}},...l}=ar(n,t),u={x:e,y:r},c=await $s(t,l),d=Pn(lr(i)),h=lh(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"bottom":"right";p=ah(p+c[h==="y"?"top":"left"],p,p-c[g])}if(s){const g=d==="y"?"bottom":"right";f=ah(f+c[d==="y"?"top":"left"],f,f-c[g])}const m=a.fn({...t,[h]:p,[d]:f});return{...m,data:{x:m.x-e,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}},rb=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=ar(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};const E=lr(i),A=Pn(a),v=lr(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=h||(v||!m?[Ol(a)]:function(k){const B=Ol(k);return[dh(k),B,dh(B)]}(a)),T=f!=="none";!h&&T&&O.push(...function(k,B,$,U){const V=_o(k);let L=function(Q,j,tt){const it=["left","right"],x=["right","left"],q=["top","bottom"],ot=["bottom","top"];switch(Q){case"top":case"bottom":return tt?j?x:it:j?it:x;case"left":case"right":return j?q:ot;default:return[]}}(lr(k),$==="start",U);return V&&(L=L.map(Q=>Q+"-"+V),B&&(L=L.concat(L.map(dh)))),L}(a,m,f,_));const S=[a,...O],N=await $s(t,g),y=[];let w=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&y.push(N[E]),d){const k=function(B,$,U){U===void 0&&(U=!1);const V=_o(B),L=ch(B),Q=uh(L);let j=L==="x"?V===(U?"end":"start")?"right":"left":V==="start"?"bottom":"top";return $.reference[Q]>$.floating[Q]&&(j=Ol(j)),[j,Ol(j)]}(i,s,_);y.push(N[k[0]],N[k[1]])}if(w=[...w,{placement:i,overflows:y}],!y.every(k=>k<=0)){var b,I;const k=(((b=o.flip)==null?void 0:b.index)||0)+1,B=S[k];if(B&&(!(d==="alignment"&&A!==Pn(B))||w.every(U=>U.overflows[0]>0&&Pn(U.placement)===A)))return{data:{index:k,overflows:w},reset:{placement:B}};let $=(I=w.filter(U=>U.overflows[0]<=0).sort((U,V)=>U.overflows[1]-V.overflows[1])[0])==null?void 0:I.placement;if(!$)switch(p){case"bestFit":{var P;const U=(P=w.filter(V=>{if(T){const L=Pn(V.placement);return L===A||L==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(L=>L>0).reduce((L,Q)=>L+Q,0)]).sort((V,L)=>V[1]-L[1])[0])==null?void 0:P[0];U&&($=U);break}case"initialPlacement":$=a}if(i!==$)return{reset:{placement:$}}}return{}}}},ib=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var e,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ar(n,t),c=await $s(t,u),d=lr(i),h=_o(i),p=Pn(i)==="y",{width:f,height:m}=o.floating;let g,E;d==="top"||d==="bottom"?(g=d,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=d,g=h==="end"?"top":"bottom");const A=m-c.top-c.bottom,v=f-c.left-c.right,_=Lr(m-c[g],A),O=Lr(f-c[E],v),T=!t.middlewareData.shift;let S=_,N=O;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=A),T&&!h){const w=We(c.left,0),b=We(c.right,0),I=We(c.top,0),P=We(c.bottom,0);p?N=f-2*(w!==0||b!==0?w+b:We(c.left,c.right)):S=m-2*(I!==0||P!==0?I+P:We(c.top,c.bottom))}await l({...t,availableWidth:N,availableHeight:S});const y=await s.getDimensions(a.floating);return f!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}},ob=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(t){const{rects:e}=t,{strategy:r="referenceHidden",...i}=ar(n,t);switch(r){case"referenceHidden":{const o=YA(await $s(t,{...i,elementContext:"reference"}),e.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:zA(o)}}}case"escaped":{const o=YA(await $s(t,{...i,altBoundary:!0}),e.floating);return{data:{escapedOffsets:o,escaped:zA(o)}}}default:return{}}}}},nv=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ar(n,t)||{};if(u==null)return{};const d=$A(c),h={x:e,y:r},p=ch(i),f=uh(p),m=await s.getDimensions(u),g=p==="y",E=g?"top":"left",A=g?"bottom":"right",v=g?"clientHeight":"clientWidth",_=o.reference[f]+o.reference[p]-h[p]-o.floating[f],O=h[p]-o.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[v]:0;S&&await(s.isElement==null?void 0:s.isElement(T))||(S=a.floating[v]||o.floating[f]);const N=_/2-O/2,y=S/2-m[f]/2-1,w=Lr(d[E],y),b=Lr(d[A],y),I=w,P=S-m[f]-b,k=S/2-m[f]/2+N,B=ah(I,k,P),$=!l.arrow&&_o(i)!=null&&k!==B&&o.reference[f]/2-(k<I?w:b)-m[f]/2<0,U=$?k<I?k-I:k-P:0;return{[p]:h[p]+U,data:{[p]:B,centerOffset:k-B-U,...$&&{alignmentOffset:U}},reset:$}}}),sb=function(n){return n===void 0&&(n={}),{options:n,fn(t){const{x:e,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ar(n,t),c={x:e,y:r},d=Pn(i),h=lh(d);let p=c[h],f=c[d];const m=ar(a,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const v=h==="y"?"height":"width",_=o.reference[h]-o.floating[v]+g.mainAxis,O=o.reference[h]+o.reference[v]-g.mainAxis;p<_?p=_:p>O&&(p=O)}if(u){var E,A;const v=h==="y"?"width":"height",_=["top","left"].includes(lr(i)),O=o.reference[d]-o.floating[v]+(_&&((E=s.offset)==null?void 0:E[d])||0)+(_?0:g.crossAxis),T=o.reference[d]+o.reference[v]+(_?0:((A=s.offset)==null?void 0:A[d])||0)-(_?g.crossAxis:0);f<O?f=O:f>T&&(f=T)}return{[h]:p,[d]:f}}}},ab=(n,t,e)=>{const r=new Map,i={platform:QC,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=jA(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:w,reset:b}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...w}},b&&_<=50&&(_++,typeof b=="object"&&(b.placement&&(A=b.placement),b.rects&&(m=b.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):b.rects),{x:g,y:E}=jA(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var Il=typeof document!="undefined"?se:function(){};function wl(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!wl(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!wl(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function rv(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function iv(n,t){const e=rv(n);return Math.round(t*e)/e}function Ah(n){const t=X(n);return Il(()=>{t.current=n}),t}const lb=n=>({name:"arrow",options:n,fn(t){const{element:e,padding:r}=typeof n=="function"?n(t):n;return e&&(i=e,{}.hasOwnProperty.call(i,"current"))?e.current!=null?nv({element:e.current,padding:r}).fn(t):{}:e?nv({element:e,padding:r}).fn(t):{};var i}}),ub=(n,t)=>({...eb(n),options:[n,t]}),cb=(n,t)=>({...nb(n),options:[n,t]}),db=(n,t)=>({...sb(n),options:[n,t]}),hb=(n,t)=>({...rb(n),options:[n,t]}),pb=(n,t)=>({...ib(n),options:[n,t]}),fb=(n,t)=>({...ob(n),options:[n,t]}),mb=(n,t)=>({...lb(n),options:[n,t]});var ov=et((n,t)=>{const{children:e,width:r=10,height:i=5,...o}=n;return C(Xt.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?e:C("polygon",{points:"0,0 30,0 15,10"})})});ov.displayName="Arrow";var sv=ov;function av(n){const[t,e]=nt(void 0);return An(()=>{if(n){e({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=n.offsetWidth,a=n.offsetHeight;e({width:s,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}e(void 0)},[n]),t}var vh="Popper",[lv,uv]=mi(vh),[gb,cv]=lv(vh),dv=n=>{const{__scopePopper:t,children:e}=n,[r,i]=nt(null);return C(gb,{scope:t,anchor:r,onAnchorChange:i,children:e})};dv.displayName=vh;var hv="PopperAnchor",pv=et((n,t)=>{const{__scopePopper:e,virtualRef:r,...i}=n,o=cv(hv,e),s=X(null),a=Ft(t,s),l=X(null);return J(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||s.current,u!==l.current&&o.onAnchorChange(l.current)}),r?null:C(Xt.div,{...i,ref:a})});pv.displayName=hv;var _h="PopperContent",[Eb,Ab]=lv(_h),fv=et((n,t)=>{var ut,F,ct,yt,ee,jt,ce,Zt;const{__scopePopper:e,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=n,g=cv(_h,e),[E,A]=nt(null),v=Ft(t,gt=>A(gt)),[_,O]=nt(null),T=av(_),S=(ut=T==null?void 0:T.width)!=null?ut:0,N=(F=T==null?void 0:T.height)!=null?F:0,y=r+(o!=="center"?"-"+o:""),w=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},b=Array.isArray(u)?u:[u],I=b.length>0,P={padding:w,boundary:b.filter(_b),altBoundary:I},{refs:k,floatingStyles:B,placement:$,isPositioned:U,middlewareData:V}=function(gt){gt===void 0&&(gt={});const{placement:Kt="bottom",strategy:Nt="absolute",middleware:Rt=[],platform:qe,elements:{reference:hr,floating:ne}={},transform:Ur=!0,whileElementsMounted:bi,open:pr}=gt,[re,Ii]=nt({x:0,y:0,strategy:Nt,placement:Kt,middlewareData:{},isPositioned:!1}),[fr,Hr]=nt(Rt);wl(fr,Rt)||Hr(Rt);const[wi,Uo]=nt(null),[Ho,Ri]=nt(null),Di=rt(D=>{D!==de.current&&(de.current=D,Uo(D))},[]),Wn=rt(D=>{D!==ve.current&&(ve.current=D,Ri(D))},[]),Qt=hr||wi,te=ne||Ho,de=X(null),ve=X(null),Je=X(re),$o=bi!=null,Ie=Ah(bi),Ze=Ah(qe),$r=Ah(pr),Me=rt(()=>{if(!de.current||!ve.current)return;const D={placement:Kt,strategy:Nt,middleware:fr};Ze.current&&(D.platform=Ze.current),ab(de.current,ve.current,D).then(Y=>{const Z={...Y,isPositioned:$r.current!==!1};Sn.current&&!wl(Je.current,Z)&&(Je.current=Z,Hi(()=>{Ii(Z)}))})},[fr,Kt,Nt,Ze,$r]);Il(()=>{pr===!1&&Je.current.isPositioned&&(Je.current.isPositioned=!1,Ii(D=>({...D,isPositioned:!1})))},[pr]);const Sn=X(!1);Il(()=>(Sn.current=!0,()=>{Sn.current=!1}),[]),Il(()=>{if(Qt&&(de.current=Qt),te&&(ve.current=te),Qt&&te){if(Ie.current)return Ie.current(Qt,te,Me);Me()}},[Qt,te,Me,Ie,$o]);const ki=at(()=>({reference:de,floating:ve,setReference:Di,setFloating:Wn}),[Di,Wn]),ie=at(()=>({reference:Qt,floating:te}),[Qt,te]),R=at(()=>{const D={position:Nt,left:0,top:0};if(!ie.floating)return D;const Y=iv(ie.floating,re.x),Z=iv(ie.floating,re.y);return Ur?{...D,transform:"translate("+Y+"px, "+Z+"px)",...rv(ie.floating)>=1.5&&{willChange:"transform"}}:{position:Nt,left:Y,top:Z}},[Nt,Ur,ie.floating,re.x,re.y]);return at(()=>({...re,update:Me,refs:ki,elements:ie,floatingStyles:R}),[re,Me,ki,ie,R])}({strategy:"fixed",placement:y,whileElementsMounted:(...gt)=>tb(...gt,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[ub({mainAxis:i+N,alignmentAxis:s}),l&&cb({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?db():void 0,...P}),l&&hb({...P}),pb({...P,apply:({elements:gt,rects:Kt,availableWidth:Nt,availableHeight:Rt})=>{const{width:qe,height:hr}=Kt.reference,ne=gt.floating.style;ne.setProperty("--radix-popper-available-width",`${Nt}px`),ne.setProperty("--radix-popper-available-height",`${Rt}px`),ne.setProperty("--radix-popper-anchor-width",`${qe}px`),ne.setProperty("--radix-popper-anchor-height",`${hr}px`)}}),_&&mb({element:_,padding:a}),yb({arrowWidth:S,arrowHeight:N}),h&&fb({strategy:"referenceHidden",...P})]}),[L,Q]=Ev($),j=sn(f);An(()=>{U&&(j==null||j())},[U,j]);const tt=(ct=V.arrow)==null?void 0:ct.x,it=(yt=V.arrow)==null?void 0:yt.y,x=((ee=V.arrow)==null?void 0:ee.centerOffset)!==0,[q,ot]=nt();return An(()=>{E&&ot(window.getComputedStyle(E).zIndex)},[E]),C("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:U?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(jt=V.transformOrigin)==null?void 0:jt.x,(ce=V.transformOrigin)==null?void 0:ce.y].join(" "),...((Zt=V.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:C(Eb,{scope:e,placedSide:L,onArrowChange:O,arrowX:tt,arrowY:it,shouldHideArrow:x,children:C(Xt.div,{"data-side":L,"data-align":Q,...m,ref:v,style:{...m.style,animation:U?void 0:"none"}})})})});fv.displayName=_h;var mv="PopperArrow",vb={top:"bottom",right:"left",bottom:"top",left:"right"},gv=et(function(n,t){const{__scopePopper:e,...r}=n,i=Ab(mv,e),o=vb[i.placedSide];return C("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C(sv,{...r,ref:t,style:{...r.style,display:"block"}})})});function _b(n){return n!==null}gv.displayName=mv;var yb=n=>({name:"transformOrigin",options:n,fn(t){var m,g,E,A,v;const{placement:e,rects:r,middlewareData:i}=t,o=((m=i.arrow)==null?void 0:m.centerOffset)!==0,s=o?0:n.arrowWidth,a=o?0:n.arrowHeight,[l,u]=Ev(e),c={start:"0%",center:"50%",end:"100%"}[u],d=((E=(g=i.arrow)==null?void 0:g.x)!=null?E:0)+s/2,h=((v=(A=i.arrow)==null?void 0:A.y)!=null?v:0)+a/2;let p="",f="";return l==="bottom"?(p=o?c:`${d}px`,f=-a+"px"):l==="top"?(p=o?c:`${d}px`,f=`${r.floating.height+a}px`):l==="right"?(p=-a+"px",f=o?c:`${h}px`):l==="left"&&(p=`${r.floating.width+a}px`,f=o?c:`${h}px`),{data:{x:p,y:f}}}});function Ev(n){const[t,e="center"]=n.split("-");return[t,e]}var Tb=dv,Av=pv,Ob=fv,Sb=gv,vv=n=>{const{present:t,children:e}=n,r=function(s){const[a,l]=nt(),u=X(null),c=X(s),d=X("none"),h=s?"mounted":"unmounted",[p,f]=function(m,g){return Bi((E,A)=>{var v;return(v=g[E][A])!=null?v:E},m)}(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J(()=>{const m=Rl(u.current);d.current=p==="mounted"?m:"none"},[p]),An(()=>{const m=u.current,g=c.current;if(g!==s){const E=d.current,A=Rl(m);s?f("MOUNT"):A==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(g&&E!==A?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,f]),An(()=>{var m;if(a){let g;const E=(m=a.ownerDocument.defaultView)!=null?m:window,A=_=>{const O=Rl(u.current).includes(CSS.escape(_.animationName));if(_.target===a&&O&&(f("ANIMATION_END"),!c.current)){const T=a.style.animationFillMode;a.style.animationFillMode="forwards",g=E.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=T)})}},v=_=>{_.target===a&&(d.current=Rl(u.current))};return a.addEventListener("animationstart",v),a.addEventListener("animationcancel",A),a.addEventListener("animationend",A),()=>{E.clearTimeout(g),a.removeEventListener("animationstart",v),a.removeEventListener("animationcancel",A),a.removeEventListener("animationend",A)}}f("ANIMATION_END")},[a,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:rt(m=>{u.current=m?getComputedStyle(m):null,l(m)},[])}}(t),i=typeof e=="function"?e({present:r.isPresent}):Cn.only(e),o=Ft(r.ref,function(s){var u,c;let a=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?s.ref:(a=(c=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?s.props.ref:s.props.ref||s.ref)}(i));return typeof e=="function"||r.isPresent?zr(i,{ref:o}):null};function Rl(n){return(n==null?void 0:n.animationName)||"none"}vv.displayName="Presence";var Nb=qu[" useInsertionEffect ".trim().toString()]||An;function yh({prop:n,defaultProp:t,onChange:e=()=>{},caller:r}){const[i,o,s]=function({defaultProp:c,onChange:d}){const[h,p]=nt(c),f=X(h),m=X(d);return Nb(()=>{m.current=d},[d]),J(()=>{var g;f.current!==h&&((g=m.current)==null||g.call(m,h),f.current=h)},[h,f]),[h,p,m]}({defaultProp:t,onChange:e}),a=n!==void 0,l=a?n:i;{const c=X(n!==void 0);J(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=rt(c=>{var d;if(a){const h=function(p){return typeof p=="function"}(c)?c(n):c;h!==n&&((d=s.current)==null||d.call(s,h))}else o(c)},[a,n,o,s]);return[l,u]}var So=new WeakMap,Dl=new WeakMap,kl={},_v=0,yv=function(n){return n&&(n.host||yv(n.parentNode))},Cb=function(n,t,e,r){var i=function(d,h){return h.map(function(p){if(d.contains(p))return p;var f=yv(p);return f&&d.contains(f)?f:(console.error("aria-hidden",p,"in not contained inside",d,". Doing nothing"),null)}).filter(function(p){return!!p})}(t,Array.isArray(n)?n:[n]);kl[e]||(kl[e]=new WeakMap);var o=kl[e],s=[],a=new Set,l=new Set(i),u=function(d){d&&!a.has(d)&&(a.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){d&&!l.has(d)&&Array.prototype.forEach.call(d.children,function(h){if(a.has(h))c(h);else try{var p=h.getAttribute(r),f=p!==null&&p!=="false",m=(So.get(h)||0)+1,g=(o.get(h)||0)+1;So.set(h,m),o.set(h,g),s.push(h),m===1&&f&&Dl.set(h,!0),g===1&&h.setAttribute(e,"true"),f||h.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",h,E)}})};return c(t),a.clear(),_v++,function(){s.forEach(function(d){var h=So.get(d)-1,p=o.get(d)-1;So.set(d,h),o.set(d,p),h||(Dl.has(d)||d.removeAttribute(r),Dl.delete(d)),p||d.removeAttribute(e)}),--_v||(So=new WeakMap,So=new WeakMap,Dl=new WeakMap,kl={})}},Tv=function(n,t,e){e===void 0&&(e="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),i=function(o){return typeof document=="undefined"?null:(Array.isArray(o)?o[0]:o).ownerDocument.body}(n);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Cb(r,i,e,"aria-hidden")):function(){return null}},Mr=function(){return Mr=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Mr.apply(this,arguments)},Ll="right-scroll-bar-position",xl="width-before-scroll-bar";function Th(n,t){return typeof n=="function"?n(t):n&&(n.current=t),n}var bb=typeof window!="undefined"?se:J,Ov=new WeakMap;function Ib(n,t){var e,r,i,o=(e=null,r=function(s){return n.forEach(function(a){return Th(a,s)})},(i=nt(function(){return{value:e,callback:r,facade:{get current(){return i.value},set current(s){var a=i.value;a!==s&&(i.value=s,i.callback(s,a))}}}})[0]).callback=r,i.facade);return bb(function(){var s=Ov.get(o);if(s){var a=new Set(s),l=new Set(n),u=o.current;a.forEach(function(c){l.has(c)||Th(c,null)}),l.forEach(function(c){a.has(c)||Th(c,u)})}Ov.set(o,n)},[n]),o}var Ml=function(){return Ml=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Ml.apply(this,arguments)};function wb(n){return n}typeof SuppressedError=="function"&&SuppressedError;var Sv=function(n){var t=n.sideCar,e=function(i,o){var s={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.indexOf(a)<0&&(s[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var l=0;for(a=Object.getOwnPropertySymbols(i);l<a.length;l++)o.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(i,a[l])&&(s[a[l]]=i[a[l]])}return s}(n,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return ht(r,Ml({},e))};Sv.isSideCarExport=!0;var Nv=function(n){n===void 0&&(n={});var t=function(e,r){r===void 0&&(r=wb);var i=[],o=!1,s={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:e},useMedium:function(a){var l=r(a,o);return i.push(l),function(){i=i.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(o=!0;i.length;){var l=i;i=[],l.forEach(a)}i={push:function(u){return a(u)},filter:function(){return i}}},assignMedium:function(a){o=!0;var l=[];if(i.length){var u=i;i=[],u.forEach(a),l=i}var c=function(){var h=l;l=[],h.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),i={push:function(h){l.push(h),d()},filter:function(h){return l=l.filter(h),i}}}};return s}(null);return t.options=Ml({async:!0,ssr:!1},n),t}(),Oh=function(){},Pl=et(function(n,t){var e=X(null),r=nt({onScrollCapture:Oh,onWheelCapture:Oh,onTouchMoveCapture:Oh}),i=r[0],o=r[1],s=n.forwardProps,a=n.children,l=n.className,u=n.removeScrollBar,c=n.enabled,d=n.shards,h=n.sideCar,p=n.noRelative,f=n.noIsolation,m=n.inert,g=n.allowPinchZoom,E=n.as,A=E===void 0?"div":E,v=n.gapMode,_=function(N,y){var w={};for(var b in N)Object.prototype.hasOwnProperty.call(N,b)&&y.indexOf(b)<0&&(w[b]=N[b]);if(N!=null&&typeof Object.getOwnPropertySymbols=="function"){var I=0;for(b=Object.getOwnPropertySymbols(N);I<b.length;I++)y.indexOf(b[I])<0&&Object.prototype.propertyIsEnumerable.call(N,b[I])&&(w[b[I]]=N[b[I]])}return w}(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=h,T=Ib([e,t]),S=Mr(Mr({},_),i);return ht(Vt,null,c&&ht(O,{sideCar:Nv,removeScrollBar:u,shards:d,noRelative:p,noIsolation:f,inert:m,setCallbacks:o,allowPinchZoom:!!g,lockRef:e,gapMode:v}),s?zr(Cn.only(a),Mr(Mr({},S),{ref:T})):ht(A,Mr({},S,{className:l,ref:T}),a))});Pl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Pl.classNames={fullWidth:xl,zeroRight:Ll};function Rb(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var t=function(){if(typeof __webpack_nonce__!="undefined")return __webpack_nonce__}();return t&&n.setAttribute("nonce",t),n}var Db=function(){var n=0,t=null;return{add:function(e){var r;n==0&&(t=Rb())&&(function(i,o){i.styleSheet?i.styleSheet.cssText=o:i.appendChild(document.createTextNode(o))}(t,e),r=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(r)),n++},remove:function(){!--n&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Cv=function(){var n,t=(n=Db(),function(e,r){J(function(){return n.add(e),function(){n.remove()}},[e&&r])});return function(e){var r=e.styles,i=e.dynamic;return t(r,i),null}},kb={left:0,top:0,right:0,gap:0},Sh=function(n){return parseInt(n||"",10)||0},Lb=function(n){if(n===void 0&&(n="margin"),typeof window=="undefined")return kb;var t=function(i){var o=window.getComputedStyle(document.body),s=o[i==="padding"?"paddingLeft":"marginLeft"],a=o[i==="padding"?"paddingTop":"marginTop"],l=o[i==="padding"?"paddingRight":"marginRight"];return[Sh(s),Sh(a),Sh(l)]}(n),e=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-e+t[2]-t[0])}},xb=Cv(),No="data-scroll-locked",Mb=function(n,t,e,r){var i=n.left,o=n.top,s=n.right,a=n.gap;return e===void 0&&(e="margin"),`
85
85
  .`.concat("with-scroll-bars-hidden",` {
86
86
  overflow: hidden `).concat(r,`;
87
87
  padding-right: `).concat(a,"px ").concat(r,`;
88
88
  }
89
- body[`).concat(So,`] {
89
+ body[`).concat(No,`] {
90
90
  overflow: hidden `).concat(r,`;
91
91
  overscroll-behavior: contain;
92
92
  `).concat([t&&"position: relative ".concat(r,";"),e==="margin"&&`
@@ -115,16 +115,16 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
115
115
  margin-right: 0 `).concat(r,`;
116
116
  }
117
117
 
118
- body[`).concat(So,`] {
118
+ body[`).concat(No,`] {
119
119
  `).concat("--removed-body-scroll-bar-size",": ").concat(a,`px;
120
120
  }
121
- `)},bv=function(){var n=parseInt(document.body.getAttribute(So)||"0",10);return isFinite(n)?n:0},Pb=function(n){var t=n.noRelative,e=n.noImportant,r=n.gapMode,i=r===void 0?"margin":r;J(function(){return document.body.setAttribute(So,(bv()+1).toString()),function(){var s=bv()-1;s<=0?document.body.removeAttribute(So):document.body.setAttribute(So,s.toString())}},[]);var o=lt(function(){return Lb(i)},[i]);return pt(xb,{styles:Mb(o,!t,i,e?"":"!important")})},Nh=!1;if(typeof window!="undefined")try{var Bl=Object.defineProperty({},"passive",{get:function(){return Nh=!0,!0}});window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch(n){Nh=!1}var No=!!Nh&&{passive:!1},Iv=function(n,t){if(!(n instanceof Element))return!1;var e=window.getComputedStyle(n);return e[t]!=="hidden"&&!(e.overflowY===e.overflowX&&!function(r){return r.tagName==="TEXTAREA"}(n)&&e[t]==="visible")},wv=function(n,t){var e=t.ownerDocument,r=t;do{if(typeof ShadowRoot!="undefined"&&r instanceof ShadowRoot&&(r=r.host),Rv(n,r)){var i=Dv(n,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==e.body);return!1},Rv=function(n,t){return n==="v"?function(e){return Iv(e,"overflowY")}(t):function(e){return Iv(e,"overflowX")}(t)},Dv=function(n,t){return n==="v"?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Fl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},kv=function(n){return[n.deltaX,n.deltaY]},Lv=function(n){return n&&"current"in n?n.current:n},Bb=function(n){return`
121
+ `)},bv=function(){var n=parseInt(document.body.getAttribute(No)||"0",10);return isFinite(n)?n:0},Pb=function(n){var t=n.noRelative,e=n.noImportant,r=n.gapMode,i=r===void 0?"margin":r;J(function(){return document.body.setAttribute(No,(bv()+1).toString()),function(){var s=bv()-1;s<=0?document.body.removeAttribute(No):document.body.setAttribute(No,s.toString())}},[]);var o=at(function(){return Lb(i)},[i]);return ht(xb,{styles:Mb(o,!t,i,e?"":"!important")})},Nh=!1;if(typeof window!="undefined")try{var Bl=Object.defineProperty({},"passive",{get:function(){return Nh=!0,!0}});window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch(n){Nh=!1}var Co=!!Nh&&{passive:!1},Iv=function(n,t){if(!(n instanceof Element))return!1;var e=window.getComputedStyle(n);return e[t]!=="hidden"&&!(e.overflowY===e.overflowX&&!function(r){return r.tagName==="TEXTAREA"}(n)&&e[t]==="visible")},wv=function(n,t){var e=t.ownerDocument,r=t;do{if(typeof ShadowRoot!="undefined"&&r instanceof ShadowRoot&&(r=r.host),Rv(n,r)){var i=Dv(n,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==e.body);return!1},Rv=function(n,t){return n==="v"?function(e){return Iv(e,"overflowY")}(t):function(e){return Iv(e,"overflowX")}(t)},Dv=function(n,t){return n==="v"?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Fl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},kv=function(n){return[n.deltaX,n.deltaY]},Lv=function(n){return n&&"current"in n?n.current:n},Bb=function(n){return`
122
122
  .block-interactivity-`.concat(n,` {pointer-events: none;}
123
123
  .allow-interactivity-`).concat(n,` {pointer-events: all;}
124
- `)},Fb=0,Co=[];function Ub(n){for(var t=null;n!==null;)n instanceof ShadowRoot&&(t=n.host,n=n.host),n=n.parentNode;return t}const Hb=(xv=function(n){var t=q([]),e=q([0,0]),r=q(),i=et(Fb++)[0],o=et(Cv)[0],s=q(n);J(function(){s.current=n},[n]),J(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(i));var f=function(m,g){for(var E,A=0,v=g.length;A<v;A++)!E&&A in g||(E||(E=Array.prototype.slice.call(g,0,A)),E[A]=g[A]);return m.concat(E||Array.prototype.slice.call(g))}([n.lockRef.current],(n.shards||[]).map(Lv)).filter(Boolean);return f.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),f.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[n.inert,n.lockRef.current,n.shards]);var a=rt(function(f,m){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!s.current.allowPinchZoom;var g,E=Fl(f),A=e.current,v="deltaX"in f?f.deltaX:A[0]-E[0],_="deltaY"in f?f.deltaY:A[1]-E[1],O=f.target,T=Math.abs(v)>Math.abs(_)?"h":"v";if("touches"in f&&T==="h"&&O.type==="range")return!1;var S=wv(T,O);if(!S)return!0;if(S?g=T:(g=T==="v"?"h":"v",S=wv(T,O)),!S)return!1;if(!r.current&&"changedTouches"in f&&(v||_)&&(r.current=g),!g)return!0;var N=r.current||g;return function(y,I,R,b,L){var k=function(it,ut){return it==="h"&&ut==="rtl"?-1:1}(y,window.getComputedStyle(I).direction),B=k*b,j=R.target,$=I.contains(j),W=!1,x=B>0,Q=0,H=0;do{if(!j)break;var nt=Dv(y,j),ot=nt[0],P=nt[1]-nt[2]-k*ot;(ot||P)&&Rv(y,j)&&(Q+=P,H+=ot);var V=j.parentNode;j=V&&V.nodeType===Node.DOCUMENT_FRAGMENT_NODE?V.host:V}while(!$&&j!==document.body||$&&(I.contains(j)||I===j));return x&&(Math.abs(Q)<1||!L)?W=!0:x||!(Math.abs(H)<1)&&L||(W=!0),W}(N,m,f,N==="h"?v:_,!0)},[]),l=rt(function(f){var m=f;if(Co.length&&Co[Co.length-1]===o){var g="deltaY"in m?kv(m):Fl(m),E=t.current.filter(function(v){return v.name===m.type&&(v.target===m.target||m.target===v.shadowParent)&&function(_,O){return _[0]===O[0]&&_[1]===O[1]}(v.delta,g)})[0];if(E&&E.should)m.cancelable&&m.preventDefault();else if(!E){var A=(s.current.shards||[]).map(Lv).filter(Boolean).filter(function(v){return v.contains(m.target)});(A.length>0?a(m,A[0]):!s.current.noIsolation)&&m.cancelable&&m.preventDefault()}}},[]),u=rt(function(f,m,g,E){var A={name:f,delta:m,target:g,should:E,shadowParent:Ub(g)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(v){return v!==A})},1)},[]),c=rt(function(f){e.current=Fl(f),r.current=void 0},[]),d=rt(function(f){u(f.type,kv(f),f.target,a(f,n.lockRef.current))},[]),h=rt(function(f){u(f.type,Fl(f),f.target,a(f,n.lockRef.current))},[]);J(function(){return Co.push(o),n.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,No),document.addEventListener("touchmove",l,No),document.addEventListener("touchstart",c,No),function(){Co=Co.filter(function(f){return f!==o}),document.removeEventListener("wheel",l,No),document.removeEventListener("touchmove",l,No),document.removeEventListener("touchstart",c,No)}},[]);var p=n.removeScrollBar;return pt(Vt,null,n.inert?pt(o,{styles:Bb(i)}):null,p?pt(Pb,{noRelative:n.noRelative,gapMode:n.gapMode}):null)},Nv.useMedium(xv),Sv);var xv,Ch=tt(function(n,t){return pt(Pl,Mr({},n,{ref:t,sideCar:Hb}))});Ch.classNames=Pl.classNames;var Ul="Popover",[Mv,WD]=mi(Ul,[uv]),zs=uv(),[$b,Ei]=Mv(Ul),Pv=n=>{const{__scopePopover:t,children:e,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=n,a=zs(t),l=q(null),[u,c]=et(!1),[d,h]=yh({prop:r,defaultProp:i!=null?i:!1,onChange:o,caller:Ul});return C(Tb,{...a,children:C($b,{scope:t,contentId:_l(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:rt(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:rt(()=>c(!0),[]),onCustomAnchorRemove:rt(()=>c(!1),[]),modal:s,children:e})})};Pv.displayName=Ul;var Bv="PopoverAnchor",jb=tt((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(Bv,e),o=zs(e),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return J(()=>(s(),()=>a()),[s,a]),C(Av,{...o,...r,ref:t})});jb.displayName=Bv;var Fv="PopoverTrigger",Uv=tt((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(Fv,e),o=zs(e),s=Ft(t,i.triggerRef),a=C(Xt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Yv(i.open),...r,ref:s,onClick:Us(n.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:C(Av,{asChild:!0,...o,children:a})});Uv.displayName=Fv;var[GD,Yb]=Mv("PopoverPortal",{forceMount:void 0}),bo="PopoverContent",Hv=tt((n,t)=>{const e=Yb(bo,n.__scopePopover),{forceMount:r=e.forceMount,...i}=n,o=Ei(bo,n.__scopePopover);return C(vv,{present:r||o.open,children:o.modal?C(Vb,{...i,ref:t}):C(Wb,{...i,ref:t})})});Hv.displayName=bo;var zb=Hs("PopoverContent.RemoveScroll"),Vb=tt((n,t)=>{const e=Ei(bo,n.__scopePopover),r=q(null),i=Ft(t,r),o=q(!1);return J(()=>{const s=r.current;if(s)return Tv(s)},[]),C(Ch,{as:zb,allowPinchZoom:!0,children:C($v,{...n,ref:i,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Us(n.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||((a=e.triggerRef.current)==null||a.focus())}),onPointerDownOutside:Us(n.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;o.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Us(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),Wb=tt((n,t)=>{const e=Ei(bo,n.__scopePopover),r=q(!1),i=q(!1);return C($v,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=n.onCloseAutoFocus)==null||s.call(n,o),o.defaultPrevented||(r.current||((a=e.triggerRef.current)==null||a.focus()),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=n.onInteractOutside)==null||l.call(n,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=e.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),$v=tt((n,t)=>{const{__scopePopover:e,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:c,...d}=n,h=Ei(bo,e),p=zs(e);return J(()=>{var m,g;const f=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(m=f[0])!=null?m:MA()),document.body.insertAdjacentElement("beforeend",(g=f[1])!=null?g:MA()),rh++,()=>{rh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(E=>E.remove()),rh--}},[]),C(sh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:C(kA,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:c,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:C(Ob,{"data-state":Yv(h.open),role:"dialog",id:h.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),jv="PopoverClose",Gb=tt((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(jv,e);return C(Xt.button,{type:"button",...r,ref:t,onClick:Us(n.onClick,()=>i.onOpenChange(!1))})});Gb.displayName=jv;function Yv(n){return n?"open":"closed"}tt((n,t)=>{const{__scopePopover:e,...r}=n,i=zs(e);return C(Sb,{...i,...r,ref:t})}).displayName="PopoverArrow";var Xb=Pv,Kb=Uv,qb=Hv;function dt(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function zv(n){const t=n+"CollectionProvider",[e,r]=mi(t),[i,o]=e(t,{collectionRef:{current:null},itemMap:new Map}),s=f=>{const{scope:m,children:g}=f,E=Ot.useRef(null),A=Ot.useRef(new Map).current;return C(i,{scope:m,itemMap:A,collectionRef:E,children:g})};s.displayName=t;const a=n+"CollectionSlot",l=Hs(a),u=Ot.forwardRef((f,m)=>{const{scope:g,children:E}=f,A=Ft(m,o(a,g).collectionRef);return C(l,{ref:A,children:E})});u.displayName=a;const c=n+"CollectionItemSlot",d="data-radix-collection-item",h=Hs(c),p=Ot.forwardRef((f,m)=>{const{scope:g,children:E,...A}=f,v=Ot.useRef(null),_=Ft(m,v),O=o(c,g);return Ot.useEffect(()=>(O.itemMap.set(v,{ref:v,...A}),()=>{O.itemMap.delete(v)})),C(h,{[d]:"",ref:_,children:E})});return p.displayName=c,[{Provider:s,Slot:u,ItemSlot:p},function(f){const m=o(n+"CollectionConsumer",f);return Ot.useCallback(()=>{const E=m.collectionRef.current;if(!E)return[];const A=Array.from(E.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((_,O)=>A.indexOf(_.ref.current)-A.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])},r]}var Jb=nn(void 0);function Vv(n){const t=Re(Jb);return n||t||"ltr"}var Wv,bh="dismissableLayer.update",Zb="dismissableLayer.pointerDownOutside",Qb="dismissableLayer.focusOutside",Gv=nn({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xv=tt((n,t)=>{var S;const{disableOutsidePointerEvents:e=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=n,u=Re(Gv),[c,d]=et(null),h=(S=c==null?void 0:c.ownerDocument)!=null?S:globalThis==null?void 0:globalThis.document,[,p]=et({}),f=Ft(t,N=>d(N)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(g),A=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,_=A>=E,O=function(N,y=globalThis==null?void 0:globalThis.document){const I=sn(N),R=q(!1),b=q(()=>{});return J(()=>{const L=B=>{if(B.target&&!R.current){let j=function(){qv(Zb,I,$,{discrete:!0})};const $={originalEvent:B};B.pointerType==="touch"?(y.removeEventListener("click",b.current),b.current=j,y.addEventListener("click",b.current,{once:!0})):j()}else y.removeEventListener("click",b.current);R.current=!1},k=window.setTimeout(()=>{y.addEventListener("pointerdown",L)},0);return()=>{window.clearTimeout(k),y.removeEventListener("pointerdown",L),y.removeEventListener("click",b.current)}},[y,I]),{onPointerDownCapture:()=>R.current=!0}}(N=>{const y=N.target,I=[...u.branches].some(R=>R.contains(y));_&&!I&&(i==null||i(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h),T=function(N,y=globalThis==null?void 0:globalThis.document){const I=sn(N),R=q(!1);return J(()=>{const b=L=>{L.target&&!R.current&&qv(Qb,I,{originalEvent:L},{discrete:!1})};return y.addEventListener("focusin",b),()=>y.removeEventListener("focusin",b)},[y,I]),{onFocusCapture:()=>R.current=!0,onBlurCapture:()=>R.current=!1}}(N=>{const y=N.target;[...u.branches].some(I=>I.contains(y))||(o==null||o(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h);return wA(N=>{A===u.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),J(()=>{if(c)return e&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Wv=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Kv(),()=>{e&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Wv)}},[c,h,e,u]),J(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Kv())},[c,u]),J(()=>{const N=()=>p({});return document.addEventListener(bh,N),()=>document.removeEventListener(bh,N)},[]),C(Xt.div,{...l,ref:f,style:{pointerEvents:v?_?"auto":"none":void 0,...n.style},onFocusCapture:dt(n.onFocusCapture,T.onFocusCapture),onBlurCapture:dt(n.onBlurCapture,T.onBlurCapture),onPointerDownCapture:dt(n.onPointerDownCapture,O.onPointerDownCapture)})});Xv.displayName="DismissableLayer";var tI=tt((n,t)=>{const e=Re(Gv),r=q(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return e.branches.add(o),()=>{e.branches.delete(o)}},[e.branches]),C(Xt.div,{...n,ref:i})});function Kv(){const n=new CustomEvent(bh);document.dispatchEvent(n)}function qv(n,t,e,{discrete:r}){const i=e.originalEvent.target,o=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:e});t&&i.addEventListener(n,t,{once:!0}),r?eh(i,o):i.dispatchEvent(o)}tI.displayName="DismissableLayerBranch";var Ih=0;function Jv(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}const eI=["top","right","bottom","left"],Pr=Math.min,Xe=Math.max,Hl=Math.round,$l=Math.floor,Un=n=>({x:n,y:n}),nI={left:"right",right:"left",bottom:"top",top:"bottom"},rI={start:"end",end:"start"};function wh(n,t,e){return Xe(n,Pr(t,e))}function ur(n,t){return typeof n=="function"?n(t):n}function cr(n){return n.split("-")[0]}function Io(n){return n.split("-")[1]}function Rh(n){return n==="x"?"y":"x"}function Dh(n){return n==="y"?"height":"width"}function Hn(n){return["top","bottom"].includes(cr(n))?"y":"x"}function kh(n){return Rh(Hn(n))}function Lh(n){return n.replace(/start|end/g,t=>rI[t])}function jl(n){return n.replace(/left|right|bottom|top/g,t=>nI[t])}function Zv(n){return typeof n!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(n):{top:n,right:n,bottom:n,left:n}}function Yl(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function Qv(n,t,e){let{reference:r,floating:i}=n;const o=Hn(t),s=kh(t),a=Dh(s),l=cr(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Io(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}async function Vs(n,t){var e;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ur(t,n),f=Zv(p),m=a[h?d==="floating"?"reference":"floating":d],g=Yl(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(m)))==null||e?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),E=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(A))&&await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1},_=Yl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:A,strategy:l}):E);return{top:(g.top-_.top+f.top)/v.y,bottom:(_.bottom-g.bottom+f.bottom)/v.y,left:(g.left-_.left+f.left)/v.x,right:(_.right-g.right+f.right)/v.x}}function t_(n,t){return{top:n.top-t.height,right:n.right-t.width,bottom:n.bottom-t.height,left:n.left-t.width}}function e_(n){return eI.some(t=>n[t]>=0)}function zl(){return typeof window!="undefined"}function wo(n){return n_(n)?(n.nodeName||"").toLowerCase():"#document"}function Ke(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function $n(n){var t;return(t=(n_(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function n_(n){return!!zl()&&(n instanceof Node||n instanceof Ke(n).Node)}function yn(n){return!!zl()&&(n instanceof Element||n instanceof Ke(n).Element)}function jn(n){return!!zl()&&(n instanceof HTMLElement||n instanceof Ke(n).HTMLElement)}function r_(n){return!(!zl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ke(n).ShadowRoot)}function Ws(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=Tn(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!["inline","contents"].includes(i)}function iI(n){return["table","td","th"].includes(wo(n))}function Vl(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch(e){return!1}})}function xh(n){const t=Mh(),e=yn(n)?Tn(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||["transform","translate","scale","rotate","perspective","filter"].some(r=>(e.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(e.contain||"").includes(r))}function Mh(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ro(n){return["html","body","#document"].includes(wo(n))}function Tn(n){return Ke(n).getComputedStyle(n)}function Wl(n){return yn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Br(n){if(wo(n)==="html")return n;const t=n.assignedSlot||n.parentNode||r_(n)&&n.host||$n(n);return r_(t)?t.host:t}function i_(n){const t=Br(n);return Ro(t)?n.ownerDocument?n.ownerDocument.body:n.body:jn(t)&&Ws(t)?t:i_(t)}function Gs(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=i_(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ke(i);if(o){const a=Ph(s);return t.concat(s,s.visualViewport||[],Ws(i)?i:[],a&&e?Gs(a):[])}return t.concat(i,Gs(i,[],e))}function Ph(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function o_(n){const t=Tn(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=jn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=Hl(e)!==o||Hl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function Bh(n){return yn(n)?n:n.contextElement}function Do(n){const t=Bh(n);if(!jn(t))return Un(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=o_(t);let s=(o?Hl(e.width):e.width)/r,a=(o?Hl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const oI=Un(0);function s_(n){const t=Ke(n);return Mh()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oI}function Ai(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=Bh(n);let s=Un(1);t&&(r?yn(r)&&(s=Do(r)):s=Do(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ke(h))&&p}(o,e,r)?s_(o):Un(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ke(o),p=r&&yn(r)?Ke(r):r;let f=h,m=Ph(f);for(;m&&r&&p!==f;){const g=Do(m),E=m.getBoundingClientRect(),A=Tn(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ke(m),m=Ph(f)}}return Yl({width:c,height:d,x:l,y:u})}function Fh(n,t){const e=Wl(n).scrollLeft;return t?t.left+e:Ai($n(n)).left+e}function a_(n,t,e){e===void 0&&(e=!1);const r=n.getBoundingClientRect();return{x:r.left+t.scrollLeft-(e?0:Fh(n,r)),y:r.top+t.scrollTop}}function l_(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ke(i),a=$n(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const p=Mh();(!p||p&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=$n(i),s=Wl(i),a=i.ownerDocument.body,l=Xe(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=Xe(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+Fh(i);const d=-s.scrollTop;return Tn(a).direction==="rtl"&&(c+=Xe(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}($n(n));else if(yn(t))r=function(i,o){const s=Ai(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=jn(i)?Do(i):Un(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=s_(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Yl(r)}function u_(n,t){const e=Br(n);return!(e===t||!yn(e)||Ro(e))&&(Tn(e).position==="fixed"||u_(e,t))}function sI(n,t,e){const r=jn(t),i=$n(t),o=e==="fixed",s=Ai(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Un(0);function u(){l.x=Fh(i)}if(r||!r&&!o)if((wo(t)!=="body"||Ws(i))&&(a=Wl(t)),r){const d=Ai(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Un(0):a_(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Uh(n){return Tn(n).position==="static"}function c_(n,t){if(!jn(n)||Tn(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return $n(n)===e&&(e=e.ownerDocument.body),e}function d_(n,t){const e=Ke(n);if(Vl(n))return e;if(!jn(n)){let i=Br(n);for(;i&&!Ro(i);){if(yn(i)&&!Uh(i))return i;i=Br(i)}return e}let r=c_(n,t);for(;r&&iI(r)&&Uh(r);)r=c_(r,t);return r&&Ro(r)&&Uh(r)&&!xh(r)?e:r||function(i){let o=Br(i);for(;jn(o)&&!Ro(o);){if(xh(o))return o;if(Vl(o))return null;o=Br(o)}return null}(n)||e}const aI={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=$n(r),a=!!t&&Vl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Un(1);const c=Un(0),d=jn(r);if((d||!d&&!o)&&((wo(r)!=="body"||Ws(s))&&(l=Wl(r)),jn(r))){const p=Ai(r);u=Do(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Un(0):a_(s,l,!0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:$n,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?Vl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=Gs(u,[],!1).filter(g=>yn(g)&&wo(g)!=="body"),p=null;const f=Tn(u).position==="fixed";let m=f?Br(u):u;for(;yn(m)&&!Ro(m);){const g=Tn(m),E=xh(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&["absolute","fixed"].includes(p.position)||Ws(m)&&!E&&u_(u,m))?h=h.filter(A=>A!==m):p=g,m=Br(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=l_(t,c,i);return u.top=Xe(d.top,u.top),u.right=Pr(d.right,u.right),u.bottom=Pr(d.bottom,u.bottom),u.left=Xe(d.left,u.left),u},l_(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:d_,getElementRects:async function(n){const t=this.getOffsetParent||d_,e=this.getDimensions,r=await e(n.floating);return{reference:sI(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=o_(n);return{width:t,height:e}},getScale:Do,isElement:yn,isRTL:function(n){return Tn(n).direction==="rtl"}};function h_(n,t){return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function lI(n,t,e,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Bh(n),c=i||o?[...u?Gs(u):[],...Gs(t)]:[];c.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),o&&g.addEventListener("resize",e)});const d=u&&a?function(g,E){let A,v=null;const _=$n(g);function O(){var T;clearTimeout(A),(T=v)==null||T.disconnect(),v=null}return function T(S,N){S===void 0&&(S=!1),N===void 0&&(N=1),O();const y=g.getBoundingClientRect(),{left:I,top:R,width:b,height:L}=y;if(S||E(),!b||!L)return;const k={rootMargin:-$l(R)+"px "+-$l(_.clientWidth-(I+b))+"px "+-$l(_.clientHeight-(R+L))+"px "+-$l(I)+"px",threshold:Xe(0,Pr(1,N))||1};let B=!0;function j($){const W=$[0].intersectionRatio;if(W!==N){if(!B)return T();W?T(!1,W):A=setTimeout(()=>{T(!1,1e-7)},1e3)}W!==1||h_(y,g.getBoundingClientRect())||T(),B=!1}try{v=new IntersectionObserver(j,{...k,root:_.ownerDocument})}catch($){v=new IntersectionObserver(j,k)}v.observe(g)}(!0),O}(u,e):null;let h,p=-1,f=null;s&&(f=new ResizeObserver(g=>{let[E]=g;E&&E.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=f)==null||A.observe(t)})),e()}),u&&!l&&f.observe(u),f.observe(t));let m=l?Ai(n):null;return l&&function g(){const E=Ai(n);m&&!h_(m,E)&&e(),m=E,h=requestAnimationFrame(g)}(),e(),()=>{var g;c.forEach(E=>{i&&E.removeEventListener("scroll",e),o&&E.removeEventListener("resize",e)}),d==null||d(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const uI=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(u,c){const{placement:d,platform:h,elements:p}=u,f=await(h.isRTL==null?void 0:h.isRTL(p.floating)),m=cr(d),g=Io(d),E=Hn(d)==="y",A=["left","top"].includes(m)?-1:1,v=f&&E?-1:1,_=ur(c,u);let{mainAxis:O,crossAxis:T,alignmentAxis:S}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return g&&typeof S=="number"&&(T=g==="end"?-1*S:S),E?{x:T*v,y:O*A}:{x:O*A,y:T*v}}(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},cI=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:E,y:A}=g;return{x:E,y:A}}},...l}=ur(n,t),u={x:e,y:r},c=await Vs(t,l),d=Hn(cr(i)),h=Rh(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"bottom":"right";p=wh(p+c[h==="y"?"top":"left"],p,p-c[g])}if(s){const g=d==="y"?"bottom":"right";f=wh(f+c[d==="y"?"top":"left"],f,f-c[g])}const m=a.fn({...t,[h]:p,[d]:f});return{...m,data:{x:m.x-e,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}},dI=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=ur(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};const E=cr(i),A=Hn(a),v=cr(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=h||(v||!m?[jl(a)]:function(k){const B=jl(k);return[Lh(k),B,Lh(B)]}(a)),T=f!=="none";!h&&T&&O.push(...function(k,B,j,$){const W=Io(k);let x=function(Q,H,nt){const ot=["left","right"],P=["right","left"],V=["top","bottom"],it=["bottom","top"];switch(Q){case"top":case"bottom":return nt?H?P:ot:H?ot:P;case"left":case"right":return H?V:it;default:return[]}}(cr(k),j==="start",$);return W&&(x=x.map(Q=>Q+"-"+W),B&&(x=x.concat(x.map(Lh)))),x}(a,m,f,_));const S=[a,...O],N=await Vs(t,g),y=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&y.push(N[E]),d){const k=function(B,j,$){$===void 0&&($=!1);const W=Io(B),x=kh(B),Q=Dh(x);let H=x==="x"?W===($?"end":"start")?"right":"left":W==="start"?"bottom":"top";return j.reference[Q]>j.floating[Q]&&(H=jl(H)),[H,jl(H)]}(i,s,_);y.push(N[k[0]],N[k[1]])}if(I=[...I,{placement:i,overflows:y}],!y.every(k=>k<=0)){var R,b;const k=(((R=o.flip)==null?void 0:R.index)||0)+1,B=S[k];if(B&&(!(d==="alignment"&&A!==Hn(B))||I.every($=>$.overflows[0]>0&&Hn($.placement)===A)))return{data:{index:k,overflows:I},reset:{placement:B}};let j=(b=I.filter($=>$.overflows[0]<=0).sort(($,W)=>$.overflows[1]-W.overflows[1])[0])==null?void 0:b.placement;if(!j)switch(p){case"bestFit":{var L;const $=(L=I.filter(W=>{if(T){const x=Hn(W.placement);return x===A||x==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(x=>x>0).reduce((x,Q)=>x+Q,0)]).sort((W,x)=>W[1]-x[1])[0])==null?void 0:L[0];$&&(j=$);break}case"initialPlacement":j=a}if(i!==j)return{reset:{placement:j}}}return{}}}},hI=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var e,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ur(n,t),c=await Vs(t,u),d=cr(i),h=Io(i),p=Hn(i)==="y",{width:f,height:m}=o.floating;let g,E;d==="top"||d==="bottom"?(g=d,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=d,g=h==="end"?"top":"bottom");const A=m-c.top-c.bottom,v=f-c.left-c.right,_=Pr(m-c[g],A),O=Pr(f-c[E],v),T=!t.middlewareData.shift;let S=_,N=O;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=A),T&&!h){const I=Xe(c.left,0),R=Xe(c.right,0),b=Xe(c.top,0),L=Xe(c.bottom,0);p?N=f-2*(I!==0||R!==0?I+R:Xe(c.left,c.right)):S=m-2*(b!==0||L!==0?b+L:Xe(c.top,c.bottom))}await l({...t,availableWidth:N,availableHeight:S});const y=await s.getDimensions(a.floating);return f!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}},pI=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(t){const{rects:e}=t,{strategy:r="referenceHidden",...i}=ur(n,t);switch(r){case"referenceHidden":{const o=t_(await Vs(t,{...i,elementContext:"reference"}),e.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:e_(o)}}}case"escaped":{const o=t_(await Vs(t,{...i,altBoundary:!0}),e.floating);return{data:{escapedOffsets:o,escaped:e_(o)}}}default:return{}}}}},p_=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ur(n,t)||{};if(u==null)return{};const d=Zv(c),h={x:e,y:r},p=kh(i),f=Dh(p),m=await s.getDimensions(u),g=p==="y",E=g?"top":"left",A=g?"bottom":"right",v=g?"clientHeight":"clientWidth",_=o.reference[f]+o.reference[p]-h[p]-o.floating[f],O=h[p]-o.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[v]:0;S&&await(s.isElement==null?void 0:s.isElement(T))||(S=a.floating[v]||o.floating[f]);const N=_/2-O/2,y=S/2-m[f]/2-1,I=Pr(d[E],y),R=Pr(d[A],y),b=I,L=S-m[f]-R,k=S/2-m[f]/2+N,B=wh(b,k,L),j=!l.arrow&&Io(i)!=null&&k!==B&&o.reference[f]/2-(k<b?I:R)-m[f]/2<0,$=j?k<b?k-b:k-L:0;return{[p]:h[p]+$,data:{[p]:B,centerOffset:k-B-$,...j&&{alignmentOffset:$}},reset:j}}}),fI=function(n){return n===void 0&&(n={}),{options:n,fn(t){const{x:e,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ur(n,t),c={x:e,y:r},d=Hn(i),h=Rh(d);let p=c[h],f=c[d];const m=ur(a,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const v=h==="y"?"height":"width",_=o.reference[h]-o.floating[v]+g.mainAxis,O=o.reference[h]+o.reference[v]-g.mainAxis;p<_?p=_:p>O&&(p=O)}if(u){var E,A;const v=h==="y"?"width":"height",_=["top","left"].includes(cr(i)),O=o.reference[d]-o.floating[v]+(_&&((E=s.offset)==null?void 0:E[d])||0)+(_?0:g.crossAxis),T=o.reference[d]+o.reference[v]+(_?0:((A=s.offset)==null?void 0:A[d])||0)-(_?g.crossAxis:0);f<O?f=O:f>T&&(f=T)}return{[h]:p,[d]:f}}}},mI=(n,t,e)=>{const r=new Map,i={platform:aI,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=Qv(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:I,reset:R}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...I}},R&&_<=50&&(_++,typeof R=="object"&&(R.placement&&(A=R.placement),R.rects&&(m=R.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):R.rects),{x:g,y:E}=Qv(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var Gl=typeof document!="undefined"?he:function(){};function Xl(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!Xl(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!Xl(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function f_(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function m_(n,t){const e=f_(n);return Math.round(t*e)/e}function Hh(n){const t=q(n);return Gl(()=>{t.current=n}),t}const gI=n=>({name:"arrow",options:n,fn(t){const{element:e,padding:r}=typeof n=="function"?n(t):n;return e&&(i=e,{}.hasOwnProperty.call(i,"current"))?e.current!=null?p_({element:e.current,padding:r}).fn(t):{}:e?p_({element:e,padding:r}).fn(t):{};var i}}),EI=(n,t)=>({...uI(n),options:[n,t]}),AI=(n,t)=>({...cI(n),options:[n,t]}),vI=(n,t)=>({...fI(n),options:[n,t]}),_I=(n,t)=>({...dI(n),options:[n,t]}),yI=(n,t)=>({...hI(n),options:[n,t]}),TI=(n,t)=>({...pI(n),options:[n,t]}),OI=(n,t)=>({...gI(n),options:[n,t]});var $h="Popper",[g_,E_]=mi($h),[SI,A_]=g_($h),v_=n=>{const{__scopePopper:t,children:e}=n,[r,i]=et(null);return C(SI,{scope:t,anchor:r,onAnchorChange:i,children:e})};v_.displayName=$h;var __="PopperAnchor",y_=tt((n,t)=>{const{__scopePopper:e,virtualRef:r,...i}=n,o=A_(__,e),s=q(null),a=Ft(t,s);return J(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:C(Xt.div,{...i,ref:a})});y_.displayName=__;var jh="PopperContent",[NI,CI]=g_(jh),T_=tt((n,t)=>{var ut,F,ct,yt,ee,jt,ue,Zt;const{__scopePopper:e,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=n,g=A_(jh,e),[E,A]=et(null),v=Ft(t,gt=>A(gt)),[_,O]=et(null),T=av(_),S=(ut=T==null?void 0:T.width)!=null?ut:0,N=(F=T==null?void 0:T.height)!=null?F:0,y=r+(o!=="center"?"-"+o:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},R=Array.isArray(u)?u:[u],b=R.length>0,L={padding:I,boundary:R.filter(II),altBoundary:b},{refs:k,floatingStyles:B,placement:j,isPositioned:$,middlewareData:W}=function(gt){gt===void 0&&(gt={});const{placement:Kt="bottom",strategy:Nt="absolute",middleware:Rt=[],platform:qe,elements:{reference:hr,floating:ne}={},transform:Ur=!0,whileElementsMounted:bi,open:pr}=gt,[re,Ii]=et({x:0,y:0,strategy:Nt,placement:Kt,middlewareData:{},isPositioned:!1}),[fr,Hr]=et(Rt);Xl(fr,Rt)||Hr(Rt);const[wi,Fo]=et(null),[Uo,Ri]=et(null),Di=rt(D=>{D!==ce.current&&(ce.current=D,Fo(D))},[]),Wn=rt(D=>{D!==ve.current&&(ve.current=D,Ri(D))},[]),Qt=hr||wi,te=ne||Uo,ce=q(null),ve=q(null),Je=q(re),Ho=bi!=null,Ie=Hh(bi),Ze=Hh(qe),$r=Hh(pr),Me=rt(()=>{if(!ce.current||!ve.current)return;const D={placement:Kt,strategy:Nt,middleware:fr};Ze.current&&(D.platform=Ze.current),mI(ce.current,ve.current,D).then(Y=>{const Z={...Y,isPositioned:$r.current!==!1};Sn.current&&!Xl(Je.current,Z)&&(Je.current=Z,Hi(()=>{Ii(Z)}))})},[fr,Kt,Nt,Ze,$r]);Gl(()=>{pr===!1&&Je.current.isPositioned&&(Je.current.isPositioned=!1,Ii(D=>({...D,isPositioned:!1})))},[pr]);const Sn=q(!1);Gl(()=>(Sn.current=!0,()=>{Sn.current=!1}),[]),Gl(()=>{if(Qt&&(ce.current=Qt),te&&(ve.current=te),Qt&&te){if(Ie.current)return Ie.current(Qt,te,Me);Me()}},[Qt,te,Me,Ie,Ho]);const ki=lt(()=>({reference:ce,floating:ve,setReference:Di,setFloating:Wn}),[Di,Wn]),ie=lt(()=>({reference:Qt,floating:te}),[Qt,te]),w=lt(()=>{const D={position:Nt,left:0,top:0};if(!ie.floating)return D;const Y=m_(ie.floating,re.x),Z=m_(ie.floating,re.y);return Ur?{...D,transform:"translate("+Y+"px, "+Z+"px)",...f_(ie.floating)>=1.5&&{willChange:"transform"}}:{position:Nt,left:Y,top:Z}},[Nt,Ur,ie.floating,re.x,re.y]);return lt(()=>({...re,update:Me,refs:ki,elements:ie,floatingStyles:w}),[re,Me,ki,ie,w])}({strategy:"fixed",placement:y,whileElementsMounted:(...gt)=>lI(...gt,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[EI({mainAxis:i+N,alignmentAxis:s}),l&&AI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?vI():void 0,...L}),l&&_I({...L}),yI({...L,apply:({elements:gt,rects:Kt,availableWidth:Nt,availableHeight:Rt})=>{const{width:qe,height:hr}=Kt.reference,ne=gt.floating.style;ne.setProperty("--radix-popper-available-width",`${Nt}px`),ne.setProperty("--radix-popper-available-height",`${Rt}px`),ne.setProperty("--radix-popper-anchor-width",`${qe}px`),ne.setProperty("--radix-popper-anchor-height",`${hr}px`)}}),_&&OI({element:_,padding:a}),wI({arrowWidth:S,arrowHeight:N}),h&&TI({strategy:"referenceHidden",...L})]}),[x,Q]=N_(j),H=sn(f);An(()=>{$&&(H==null||H())},[$,H]);const nt=(ct=W.arrow)==null?void 0:ct.x,ot=(yt=W.arrow)==null?void 0:yt.y,P=((ee=W.arrow)==null?void 0:ee.centerOffset)!==0,[V,it]=et();return An(()=>{E&&it(window.getComputedStyle(E).zIndex)},[E]),C("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:$?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(jt=W.transformOrigin)==null?void 0:jt.x,(ue=W.transformOrigin)==null?void 0:ue.y].join(" "),...((Zt=W.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:C(NI,{scope:e,placedSide:x,onArrowChange:O,arrowX:nt,arrowY:ot,shouldHideArrow:P,children:C(Xt.div,{"data-side":x,"data-align":Q,...m,ref:v,style:{...m.style,animation:$?void 0:"none"}})})})});T_.displayName=jh;var O_="PopperArrow",bI={top:"bottom",right:"left",bottom:"top",left:"right"},S_=tt(function(n,t){const{__scopePopper:e,...r}=n,i=CI(O_,e),o=bI[i.placedSide];return C("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C(sv,{...r,ref:t,style:{...r.style,display:"block"}})})});function II(n){return n!==null}S_.displayName=O_;var wI=n=>({name:"transformOrigin",options:n,fn(t){var m,g,E,A,v;const{placement:e,rects:r,middlewareData:i}=t,o=((m=i.arrow)==null?void 0:m.centerOffset)!==0,s=o?0:n.arrowWidth,a=o?0:n.arrowHeight,[l,u]=N_(e),c={start:"0%",center:"50%",end:"100%"}[u],d=((E=(g=i.arrow)==null?void 0:g.x)!=null?E:0)+s/2,h=((v=(A=i.arrow)==null?void 0:A.y)!=null?v:0)+a/2;let p="",f="";return l==="bottom"?(p=o?c:`${d}px`,f=-a+"px"):l==="top"?(p=o?c:`${d}px`,f=`${r.floating.height+a}px`):l==="right"?(p=-a+"px",f=o?c:`${h}px`):l==="left"&&(p=`${r.floating.width+a}px`,f=o?c:`${h}px`),{data:{x:p,y:f}}}});function N_(n){const[t,e="center"]=n.split("-");return[t,e]}var RI=v_,DI=y_,kI=T_,LI=S_,Kl=n=>{const{present:t,children:e}=n,r=function(s){const[a,l]=et(),u=q(null),c=q(s),d=q("none"),h=s?"mounted":"unmounted",[p,f]=function(m,g){return Bi((E,A)=>{var v;return(v=g[E][A])!=null?v:E},m)}(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J(()=>{const m=ql(u.current);d.current=p==="mounted"?m:"none"},[p]),An(()=>{const m=u.current,g=c.current;if(g!==s){const E=d.current,A=ql(m);s?f("MOUNT"):A==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(g&&E!==A?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,f]),An(()=>{var m;if(a){let g;const E=(m=a.ownerDocument.defaultView)!=null?m:window,A=_=>{const O=ql(u.current).includes(_.animationName);if(_.target===a&&O&&(f("ANIMATION_END"),!c.current)){const T=a.style.animationFillMode;a.style.animationFillMode="forwards",g=E.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=T)})}},v=_=>{_.target===a&&(d.current=ql(u.current))};return a.addEventListener("animationstart",v),a.addEventListener("animationcancel",A),a.addEventListener("animationend",A),()=>{E.clearTimeout(g),a.removeEventListener("animationstart",v),a.removeEventListener("animationcancel",A),a.removeEventListener("animationend",A)}}f("ANIMATION_END")},[a,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:rt(m=>{u.current=m?getComputedStyle(m):null,l(m)},[])}}(t),i=typeof e=="function"?e({present:r.isPresent}):Cn.only(e),o=Ft(r.ref,function(s){var u,c;let a=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?s.ref:(a=(c=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?s.props.ref:s.props.ref||s.ref)}(i));return typeof e=="function"||r.isPresent?zr(i,{ref:o}):null};function ql(n){return(n==null?void 0:n.animationName)||"none"}Kl.displayName="Presence";var Yh="rovingFocusGroup.onEntryFocus",xI={bubbles:!1,cancelable:!0},Xs="RovingFocusGroup",[zh,C_,MI]=zv(Xs),[PI,b_]=mi(Xs,[MI]),[BI,FI]=PI(Xs),I_=tt((n,t)=>C(zh.Provider,{scope:n.__scopeRovingFocusGroup,children:C(zh.Slot,{scope:n.__scopeRovingFocusGroup,children:C(UI,{...n,ref:t})})}));I_.displayName=Xs;var UI=tt((n,t)=>{const{__scopeRovingFocusGroup:e,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=n,h=q(null),p=Ft(t,h),f=Vv(o),[m,g]=yh({prop:s,defaultProp:a!=null?a:null,onChange:l,caller:Xs}),[E,A]=et(!1),v=sn(u),_=C_(e),O=q(!1),[T,S]=et(0);return J(()=>{const N=h.current;if(N)return N.addEventListener(Yh,v),()=>N.removeEventListener(Yh,v)},[v]),C(BI,{scope:e,orientation:r,dir:f,loop:i,currentTabStopId:m,onItemFocus:rt(N=>g(N),[g]),onItemShiftTab:rt(()=>A(!0),[]),onFocusableItemAdd:rt(()=>S(N=>N+1),[]),onFocusableItemRemove:rt(()=>S(N=>N-1),[]),children:C(Xt.div,{tabIndex:E||T===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...n.style},onMouseDown:dt(n.onMouseDown,()=>{O.current=!0}),onFocus:dt(n.onFocus,N=>{const y=!O.current;if(N.target===N.currentTarget&&y&&!E){const I=new CustomEvent(Yh,xI);if(N.currentTarget.dispatchEvent(I),!I.defaultPrevented){const R=_().filter(b=>b.focusable);D_([R.find(b=>b.active),R.find(b=>b.id===m),...R].filter(Boolean).map(b=>b.ref.current),c)}}O.current=!1}),onBlur:dt(n.onBlur,()=>A(!1))})})}),w_="RovingFocusGroupItem",R_=tt((n,t)=>{const{__scopeRovingFocusGroup:e,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=n,l=_l(),u=o||l,c=FI(w_,e),d=c.currentTabStopId===u,h=C_(e),{onFocusableItemAdd:p,onFocusableItemRemove:f,currentTabStopId:m}=c;return J(()=>{if(r)return p(),()=>f()},[r,p,f]),C(zh.ItemSlot,{scope:e,id:u,focusable:r,active:i,children:C(Xt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:dt(n.onMouseDown,g=>{r?c.onItemFocus(u):g.preventDefault()}),onFocus:dt(n.onFocus,()=>c.onItemFocus(u)),onKeyDown:dt(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey)return void c.onItemShiftTab();if(g.target!==g.currentTarget)return;const E=function(_,O,T){const S=function(N,y){return y!=="rtl"?N:N==="ArrowLeft"?"ArrowRight":N==="ArrowRight"?"ArrowLeft":N}(_.key,T);return O==="vertical"&&["ArrowLeft","ArrowRight"].includes(S)||O==="horizontal"&&["ArrowUp","ArrowDown"].includes(S)?void 0:HI[S]}(g,c.orientation,c.dir);if(E!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=h().filter(O=>O.focusable).map(O=>O.ref.current);if(E==="last")_.reverse();else if(E==="prev"||E==="next"){E==="prev"&&_.reverse();const O=_.indexOf(g.currentTarget);_=c.loop?(v=O+1,(A=_).map((T,S)=>A[(v+S)%A.length])):_.slice(O+1)}setTimeout(()=>D_(_))}var A,v}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});R_.displayName=w_;var HI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function D_(n,t=!1){const e=document.activeElement;for(const r of n)if(r===e||(r.focus({preventScroll:t}),document.activeElement!==e))return}var $I=I_,jI=R_,Vh=["Enter"," "],k_=["ArrowUp","PageDown","End"],YI=["ArrowDown","PageUp","Home",...k_],zI={ltr:[...Vh,"ArrowRight"],rtl:[...Vh,"ArrowLeft"]},VI={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ks="Menu",[qs,WI,GI]=zv(Ks),[vi,L_]=mi(Ks,[GI,E_,b_]),Jl=E_(),x_=b_(),[XI,ko]=vi(Ks),[KI,Js]=vi(Ks),M_=n=>{const{__scopeMenu:t,open:e=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=n,a=Jl(t),[l,u]=et(null),c=q(!1),d=sn(o),h=Vv(i);return J(()=>{const p=()=>{c.current=!0,document.addEventListener("pointerdown",f,{capture:!0,once:!0}),document.addEventListener("pointermove",f,{capture:!0,once:!0})},f=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",f,{capture:!0}),document.removeEventListener("pointermove",f,{capture:!0})}},[]),C(RI,{...a,children:C(XI,{scope:t,open:e,onOpenChange:d,content:l,onContentChange:u,children:C(KI,{scope:t,onClose:rt(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:h,modal:s,children:r})})})};M_.displayName=Ks;var Wh=tt((n,t)=>{const{__scopeMenu:e,...r}=n,i=Jl(e);return C(DI,{...i,...r,ref:t})});Wh.displayName="MenuAnchor";var[XD,P_]=vi("MenuPortal",{forceMount:void 0}),an="MenuContent",[qI,Gh]=vi(an),B_=tt((n,t)=>{const e=P_(an,n.__scopeMenu),{forceMount:r=e.forceMount,...i}=n,o=ko(an,n.__scopeMenu),s=Js(an,n.__scopeMenu);return C(qs.Provider,{scope:n.__scopeMenu,children:C(Kl,{present:r||o.open,children:C(qs.Slot,{scope:n.__scopeMenu,children:s.modal?C(JI,{...i,ref:t}):C(ZI,{...i,ref:t})})})})}),JI=tt((n,t)=>{const e=ko(an,n.__scopeMenu),r=q(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return Tv(o)},[]),C(Xh,{...n,ref:i,trapFocus:e.open,disableOutsidePointerEvents:e.open,disableOutsideScroll:!0,onFocusOutside:dt(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>e.onOpenChange(!1)})}),ZI=tt((n,t)=>{const e=ko(an,n.__scopeMenu);return C(Xh,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>e.onOpenChange(!1)})}),QI=Hs("MenuContent.ScrollLock"),Xh=tt((n,t)=>{const{__scopeMenu:e,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:f,...m}=n,g=ko(an,e),E=Js(an,e),A=Jl(e),v=x_(e),_=WI(e),[O,T]=et(null),S=q(null),N=Ft(t,S,g.onContentChange),y=q(0),I=q(""),R=q(0),b=q(null),L=q("right"),k=q(0),B=f?Ch:Vt,j=f?{as:QI,allowPinchZoom:!0}:void 0,$=x=>{var it,ut;const Q=I.current+x,H=_().filter(F=>!F.disabled),nt=document.activeElement,ot=(it=H.find(F=>F.ref.current===nt))==null?void 0:it.textValue,P=function(F,ct,yt){const ee=ct.length>1&&Array.from(ct).every(Rt=>Rt===ct[0]),jt=ee?ct[0]:ct,ue=yt?F.indexOf(yt):-1;let Zt=(gt=F,Kt=Math.max(ue,0),gt.map((Rt,qe)=>gt[(Kt+qe)%gt.length]));var gt,Kt;jt.length===1&&(Zt=Zt.filter(Rt=>Rt!==yt));const Nt=Zt.find(Rt=>Rt.toLowerCase().startsWith(jt.toLowerCase()));return Nt!==yt?Nt:void 0}(H.map(F=>F.textValue),Q,ot),V=(ut=H.find(F=>F.textValue===P))==null?void 0:ut.ref.current;(function F(ct){I.current=ct,window.clearTimeout(y.current),ct!==""&&(y.current=window.setTimeout(()=>F(""),1e3))})(Q),V&&setTimeout(()=>V.focus())};J(()=>()=>window.clearTimeout(y.current),[]),J(()=>{var Q,H;const x=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(Q=x[0])!=null?Q:Jv()),document.body.insertAdjacentElement("beforeend",(H=x[1])!=null?H:Jv()),Ih++,()=>{Ih===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(nt=>nt.remove()),Ih--}},[]);const W=rt(x=>{var Q,H;return L.current===((Q=b.current)==null?void 0:Q.side)&&function(nt,ot){if(!ot)return!1;const P={x:nt.clientX,y:nt.clientY};return function(V,it){const{x:ut,y:F}=V;let ct=!1;for(let yt=0,ee=it.length-1;yt<it.length;ee=yt++){const jt=it[yt],ue=it[ee],Zt=jt.x,gt=jt.y,Kt=ue.x,Nt=ue.y;gt>F!=Nt>F&&ut<(Kt-Zt)*(F-gt)/(Nt-gt)+Zt&&(ct=!ct)}return ct}(P,ot)}(x,(H=b.current)==null?void 0:H.area)},[]);return C(qI,{scope:e,searchRef:I,onItemEnter:rt(x=>{W(x)&&x.preventDefault()},[W]),onItemLeave:rt(x=>{var Q;W(x)||((Q=S.current)==null||Q.focus(),T(null))},[W]),onTriggerLeave:rt(x=>{W(x)&&x.preventDefault()},[W]),pointerGraceTimerRef:R,onPointerGraceIntentChange:rt(x=>{b.current=x},[]),children:C(B,{...j,children:C(sh,{asChild:!0,trapped:i,onMountAutoFocus:dt(o,x=>{var Q;x.preventDefault(),(Q=S.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:C(Xv,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:C($I,{asChild:!0,...v,dir:E.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:dt(l,x=>{E.isUsingKeyboardRef.current||x.preventDefault()}),preventScrollOnEntryFocus:!0,children:C(kI,{role:"menu","aria-orientation":"vertical","data-state":ty(g.open),"data-radix-menu-content":"",dir:E.dir,...A,...m,ref:N,style:{outline:"none",...m.style},onKeyDown:dt(m.onKeyDown,x=>{const Q=x.target.closest("[data-radix-menu-content]")===x.currentTarget,H=x.ctrlKey||x.altKey||x.metaKey,nt=x.key.length===1;Q&&(x.key==="Tab"&&x.preventDefault(),!H&&nt&&$(x.key));const ot=S.current;if(x.target!==ot||!YI.includes(x.key))return;x.preventDefault();const P=_().filter(V=>!V.disabled).map(V=>V.ref.current);k_.includes(x.key)&&P.reverse(),function(V){const it=document.activeElement;for(const ut of V)if(ut===it||(ut.focus(),document.activeElement!==it))return}(P)}),onBlur:dt(n.onBlur,x=>{x.currentTarget.contains(x.target)||(window.clearTimeout(y.current),I.current="")}),onPointerMove:dt(n.onPointerMove,Qs(x=>{const Q=x.target,H=k.current!==x.clientX;if(x.currentTarget.contains(Q)&&H){const nt=x.clientX>k.current?"right":"left";L.current=nt,k.current=x.clientX}}))})})})})})})});B_.displayName=an;var Kh=tt((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{role:"group",...r,ref:t})});Kh.displayName="MenuGroup";var F_=tt((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{...r,ref:t})});F_.displayName="MenuLabel";var Zl="MenuItem",U_="menu.itemSelect",Ql=tt((n,t)=>{const{disabled:e=!1,onSelect:r,...i}=n,o=q(null),s=Js(Zl,n.__scopeMenu),a=Gh(Zl,n.__scopeMenu),l=Ft(t,o),u=q(!1);return C(H_,{...i,ref:l,disabled:e,onClick:dt(n.onClick,()=>{const c=o.current;if(!e&&c){const d=new CustomEvent(U_,{bubbles:!0,cancelable:!0});c.addEventListener(U_,h=>r==null?void 0:r(h),{once:!0}),eh(c,d),d.defaultPrevented?u.current=!1:s.onClose()}}),onPointerDown:c=>{var d;(d=n.onPointerDown)==null||d.call(n,c),u.current=!0},onPointerUp:dt(n.onPointerUp,c=>{var d;u.current||((d=c.currentTarget)==null||d.click())}),onKeyDown:dt(n.onKeyDown,c=>{const d=a.searchRef.current!=="";e||d&&c.key===" "||Vh.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});Ql.displayName=Zl;var H_=tt((n,t)=>{const{__scopeMenu:e,disabled:r=!1,textValue:i,...o}=n,s=Gh(Zl,e),a=x_(e),l=q(null),u=Ft(t,l),[c,d]=et(!1),[h,p]=et("");return J(()=>{var m;const f=l.current;f&&p(((m=f.textContent)!=null?m:"").trim())},[o.children]),C(qs.ItemSlot,{scope:e,disabled:r,textValue:i!=null?i:h,children:C(jI,{asChild:!0,...a,focusable:!r,children:C(Xt.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:dt(n.onPointerMove,Qs(f=>{r?s.onItemLeave(f):(s.onItemEnter(f),!f.defaultPrevented&&f.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:dt(n.onPointerLeave,Qs(f=>s.onItemLeave(f))),onFocus:dt(n.onFocus,()=>d(!0)),onBlur:dt(n.onBlur,()=>d(!1))})})})}),$_=tt((n,t)=>{const{checked:e=!1,onCheckedChange:r,...i}=n;return C(W_,{scope:n.__scopeMenu,checked:e,children:C(Ql,{role:"menuitemcheckbox","aria-checked":tu(e)?"mixed":e,...i,ref:t,"data-state":Jh(e),onSelect:dt(i.onSelect,()=>r==null?void 0:r(!!tu(e)||!e),{checkForDefaultPrevented:!1})})})});$_.displayName="MenuCheckboxItem";var j_="MenuRadioGroup",[tw,ew]=vi(j_,{value:void 0,onValueChange:()=>{}}),Y_=tt((n,t)=>{const{value:e,onValueChange:r,...i}=n,o=sn(r);return C(tw,{scope:n.__scopeMenu,value:e,onValueChange:o,children:C(Kh,{...i,ref:t})})});Y_.displayName=j_;var z_="MenuRadioItem",V_=tt((n,t)=>{const{value:e,...r}=n,i=ew(z_,n.__scopeMenu),o=e===i.value;return C(W_,{scope:n.__scopeMenu,checked:o,children:C(Ql,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Jh(o),onSelect:dt(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,e)},{checkForDefaultPrevented:!1})})})});V_.displayName=z_;var qh="MenuItemIndicator",[W_,nw]=vi(qh,{checked:!1}),G_=tt((n,t)=>{const{__scopeMenu:e,forceMount:r,...i}=n,o=nw(qh,e);return C(Kl,{present:r||tu(o.checked)||o.checked===!0,children:C(Xt.span,{...i,ref:t,"data-state":Jh(o.checked)})})});G_.displayName=qh;var X_=tt((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});X_.displayName="MenuSeparator";var K_=tt((n,t)=>{const{__scopeMenu:e,...r}=n,i=Jl(e);return C(LI,{...i,...r,ref:t})});K_.displayName="MenuArrow";var[KD,q_]=vi("MenuSub"),Zs="MenuSubTrigger",J_=tt((n,t)=>{const e=ko(Zs,n.__scopeMenu),r=Js(Zs,n.__scopeMenu),i=q_(Zs,n.__scopeMenu),o=Gh(Zs,n.__scopeMenu),s=q(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,u={__scopeMenu:n.__scopeMenu},c=rt(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return J(()=>c,[c]),J(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),C(Wh,{asChild:!0,...u,children:C(H_,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":e.open,"aria-controls":i.contentId,"data-state":ty(e.open),...n,ref:vl(t,i.onTriggerChange),onClick:d=>{var h;(h=n.onClick)==null||h.call(n,d),n.disabled||d.defaultPrevented||(d.currentTarget.focus(),e.open||e.onOpenChange(!0))},onPointerMove:dt(n.onPointerMove,Qs(d=>{o.onItemEnter(d),d.defaultPrevented||n.disabled||e.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{e.onOpenChange(!0),c()},100))})),onPointerLeave:dt(n.onPointerLeave,Qs(d=>{var p,f;c();const h=(p=e.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(f=e.content)==null?void 0:f.dataset.side,g=m==="right",E=g?-5:5,A=h[g?"left":"right"],v=h[g?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+E,y:d.clientY},{x:A,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:A,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:dt(n.onKeyDown,d=>{var p;const h=o.searchRef.current!=="";n.disabled||h&&d.key===" "||zI[r.dir].includes(d.key)&&(e.onOpenChange(!0),(p=e.content)==null||p.focus(),d.preventDefault())})})})});J_.displayName=Zs;var Z_="MenuSubContent",Q_=tt((n,t)=>{const e=P_(an,n.__scopeMenu),{forceMount:r=e.forceMount,...i}=n,o=ko(an,n.__scopeMenu),s=Js(an,n.__scopeMenu),a=q_(Z_,n.__scopeMenu),l=q(null),u=Ft(t,l);return C(qs.Provider,{scope:n.__scopeMenu,children:C(Kl,{present:r||o.open,children:C(qs.Slot,{scope:n.__scopeMenu,children:C(Xh,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:dt(n.onFocusOutside,c=>{c.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:dt(n.onEscapeKeyDown,c=>{s.onClose(),c.preventDefault()}),onKeyDown:dt(n.onKeyDown,c=>{var p;const d=c.currentTarget.contains(c.target),h=VI[s.dir].includes(c.key);d&&h&&(o.onOpenChange(!1),(p=a.trigger)==null||p.focus(),c.preventDefault())})})})})})});function ty(n){return n?"open":"closed"}function tu(n){return n==="indeterminate"}function Jh(n){return tu(n)?"indeterminate":n?"checked":"unchecked"}function Qs(n){return t=>t.pointerType==="mouse"?n(t):void 0}Q_.displayName=Z_;var rw=M_,iw=Wh,ow=B_,sw=Kh,aw=F_,lw=Ql,uw=$_,cw=Y_,dw=V_,hw=G_,pw=X_,fw=K_,mw=J_,gw=Q_,eu="DropdownMenu",[Ew,qD]=mi(eu,[L_]),xe=L_(),[Aw,ey]=Ew(eu),ny=n=>{const{__scopeDropdownMenu:t,children:e,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=n,l=xe(t),u=q(null),[c,d]=yh({prop:i,defaultProp:o!=null?o:!1,onChange:s,caller:eu});return C(Aw,{scope:t,triggerId:_l(),triggerRef:u,contentId:_l(),open:c,onOpenChange:d,onOpenToggle:rt(()=>d(h=>!h),[d]),modal:a,children:C(rw,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:e})})};ny.displayName=eu;var ry="DropdownMenuTrigger",iy=tt((n,t)=>{const{__scopeDropdownMenu:e,disabled:r=!1,...i}=n,o=ey(ry,e),s=xe(e);return C(iw,{asChild:!0,...s,children:C(Xt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:vl(t,o.triggerRef),onPointerDown:dt(n.onPointerDown,a=>{r||a.button!==0||a.ctrlKey!==!1||(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:dt(n.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iy.displayName=ry;var oy="DropdownMenuContent",sy=tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=ey(oy,e),o=xe(e),s=q(!1);return C(ow,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:dt(n.onCloseAutoFocus,a=>{var l;s.current||((l=i.triggerRef.current)==null||l.focus()),s.current=!1,a.preventDefault()}),onInteractOutside:dt(n.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;i.modal&&!c||(s.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sy.displayName=oy,tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(sw,{...i,...r,ref:t})}).displayName="DropdownMenuGroup",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(aw,{...i,...r,ref:t})}).displayName="DropdownMenuLabel";var ay=tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(lw,{...i,...r,ref:t})});ay.displayName="DropdownMenuItem",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(uw,{...i,...r,ref:t})}).displayName="DropdownMenuCheckboxItem",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(cw,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(dw,{...i,...r,ref:t})}).displayName="DropdownMenuRadioItem",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(hw,{...i,...r,ref:t})}).displayName="DropdownMenuItemIndicator",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(pw,{...i,...r,ref:t})}).displayName="DropdownMenuSeparator",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(fw,{...i,...r,ref:t})}).displayName="DropdownMenuArrow",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(mw,{...i,...r,ref:t})}).displayName="DropdownMenuSubTrigger",tt((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(gw,{...i,...r,ref:t,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="DropdownMenuSubContent";var vw=ny,_w=iy,yw=sy,Tw=ay;function ta(n){const{popoverComponent:t,popoverProps:e,children:r,type:i="popover",...o}=n,[s,a]=et(void 0),[l,u]=et(!1);let c,d,h;return i==="menu"?(c=vw,d=_w,h=yw):(c=Xb,d=Kb,h=qb),C(wO.Provider,{value:{closePopover:()=>u(!1)},children:C(c,{modal:!0,open:l,onOpenChange:u,children:[C(d,{asChild:!0,children:C("button",{...o,ref:p=>(f=>{var g;const m=(g=f==null?void 0:f.closest("[t-menu-boundary]"))!=null?g:void 0;a(m)})(p),children:r})}),C(h,{hideWhenDetached:!0,collisionBoundary:s,style:{zIndex:1e3},onWheel:p=>p.stopPropagation(),onTouchMove:p=>p.stopPropagation(),children:C(t,{...e})})]})})}function _i(n){return C(Tw,{...n})}function Ow(n){return Ff(n)}function Lo(n){var t;return(t=n.photoUrl)!=null?t:function(e,r){const i=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
124
+ `)},Fb=0,bo=[];function Ub(n){for(var t=null;n!==null;)n instanceof ShadowRoot&&(t=n.host,n=n.host),n=n.parentNode;return t}const Hb=(xv=function(n){var t=X([]),e=X([0,0]),r=X(),i=nt(Fb++)[0],o=nt(Cv)[0],s=X(n);J(function(){s.current=n},[n]),J(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(i));var f=function(m,g){for(var E,A=0,v=g.length;A<v;A++)!E&&A in g||(E||(E=Array.prototype.slice.call(g,0,A)),E[A]=g[A]);return m.concat(E||Array.prototype.slice.call(g))}([n.lockRef.current],(n.shards||[]).map(Lv)).filter(Boolean);return f.forEach(function(m){return m.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),f.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(i))})}}},[n.inert,n.lockRef.current,n.shards]);var a=rt(function(f,m){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!s.current.allowPinchZoom;var g,E=Fl(f),A=e.current,v="deltaX"in f?f.deltaX:A[0]-E[0],_="deltaY"in f?f.deltaY:A[1]-E[1],O=f.target,T=Math.abs(v)>Math.abs(_)?"h":"v";if("touches"in f&&T==="h"&&O.type==="range")return!1;var S=wv(T,O);if(!S)return!0;if(S?g=T:(g=T==="v"?"h":"v",S=wv(T,O)),!S)return!1;if(!r.current&&"changedTouches"in f&&(v||_)&&(r.current=g),!g)return!0;var N=r.current||g;return function(y,w,b,I,P){var k=function(ot,ut){return ot==="h"&&ut==="rtl"?-1:1}(y,window.getComputedStyle(w).direction),B=k*I,$=b.target,U=w.contains($),V=!1,L=B>0,Q=0,j=0;do{if(!$)break;var tt=Dv(y,$),it=tt[0],x=tt[1]-tt[2]-k*it;(it||x)&&Rv(y,$)&&(Q+=x,j+=it);var q=$.parentNode;$=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!U&&$!==document.body||U&&(w.contains($)||w===$));return L&&(Math.abs(Q)<1||!P)?V=!0:L||!(Math.abs(j)<1)&&P||(V=!0),V}(N,m,f,N==="h"?v:_,!0)},[]),l=rt(function(f){var m=f;if(bo.length&&bo[bo.length-1]===o){var g="deltaY"in m?kv(m):Fl(m),E=t.current.filter(function(v){return v.name===m.type&&(v.target===m.target||m.target===v.shadowParent)&&function(_,O){return _[0]===O[0]&&_[1]===O[1]}(v.delta,g)})[0];if(E&&E.should)m.cancelable&&m.preventDefault();else if(!E){var A=(s.current.shards||[]).map(Lv).filter(Boolean).filter(function(v){return v.contains(m.target)});(A.length>0?a(m,A[0]):!s.current.noIsolation)&&m.cancelable&&m.preventDefault()}}},[]),u=rt(function(f,m,g,E){var A={name:f,delta:m,target:g,should:E,shadowParent:Ub(g)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(v){return v!==A})},1)},[]),c=rt(function(f){e.current=Fl(f),r.current=void 0},[]),d=rt(function(f){u(f.type,kv(f),f.target,a(f,n.lockRef.current))},[]),h=rt(function(f){u(f.type,Fl(f),f.target,a(f,n.lockRef.current))},[]);J(function(){return bo.push(o),n.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Co),document.addEventListener("touchmove",l,Co),document.addEventListener("touchstart",c,Co),function(){bo=bo.filter(function(f){return f!==o}),document.removeEventListener("wheel",l,Co),document.removeEventListener("touchmove",l,Co),document.removeEventListener("touchstart",c,Co)}},[]);var p=n.removeScrollBar;return ht(Vt,null,n.inert?ht(o,{styles:Bb(i)}):null,p?ht(Pb,{noRelative:n.noRelative,gapMode:n.gapMode}):null)},Nv.useMedium(xv),Sv);var xv,Ch=et(function(n,t){return ht(Pl,Mr({},n,{ref:t,sideCar:Hb}))});Ch.classNames=Pl.classNames;var Ul="Popover",[Mv,WD]=mi(Ul,[uv]),zs=uv(),[$b,Ei]=Mv(Ul),Pv=n=>{const{__scopePopover:t,children:e,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=n,a=zs(t),l=X(null),[u,c]=nt(!1),[d,h]=yh({prop:r,defaultProp:i!=null?i:!1,onChange:o,caller:Ul});return C(Tb,{...a,children:C($b,{scope:t,contentId:_l(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:rt(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:rt(()=>c(!0),[]),onCustomAnchorRemove:rt(()=>c(!1),[]),modal:s,children:e})})};Pv.displayName=Ul;var Bv="PopoverAnchor",jb=et((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(Bv,e),o=zs(e),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=i;return J(()=>(s(),()=>a()),[s,a]),C(Av,{...o,...r,ref:t})});jb.displayName=Bv;var Fv="PopoverTrigger",Uv=et((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(Fv,e),o=zs(e),s=Ft(t,i.triggerRef),a=C(Xt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Yv(i.open),...r,ref:s,onClick:Us(n.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:C(Av,{asChild:!0,...o,children:a})});Uv.displayName=Fv;var[GD,Yb]=Mv("PopoverPortal",{forceMount:void 0}),Io="PopoverContent",Hv=et((n,t)=>{const e=Yb(Io,n.__scopePopover),{forceMount:r=e.forceMount,...i}=n,o=Ei(Io,n.__scopePopover);return C(vv,{present:r||o.open,children:o.modal?C(Vb,{...i,ref:t}):C(Wb,{...i,ref:t})})});Hv.displayName=Io;var zb=Hs("PopoverContent.RemoveScroll"),Vb=et((n,t)=>{const e=Ei(Io,n.__scopePopover),r=X(null),i=Ft(t,r),o=X(!1);return J(()=>{const s=r.current;if(s)return Tv(s)},[]),C(Ch,{as:zb,allowPinchZoom:!0,children:C($v,{...n,ref:i,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Us(n.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||((a=e.triggerRef.current)==null||a.focus())}),onPointerDownOutside:Us(n.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;o.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Us(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),Wb=et((n,t)=>{const e=Ei(Io,n.__scopePopover),r=X(!1),i=X(!1);return C($v,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=n.onCloseAutoFocus)==null||s.call(n,o),o.defaultPrevented||(r.current||((a=e.triggerRef.current)==null||a.focus()),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=n.onInteractOutside)==null||l.call(n,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=e.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),$v=et((n,t)=>{const{__scopePopover:e,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:c,...d}=n,h=Ei(Io,e),p=zs(e);return J(()=>{var m,g;const f=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(m=f[0])!=null?m:MA()),document.body.insertAdjacentElement("beforeend",(g=f[1])!=null?g:MA()),rh++,()=>{rh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(E=>E.remove()),rh--}},[]),C(sh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:C(kA,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:c,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:C(Ob,{"data-state":Yv(h.open),role:"dialog",id:h.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),jv="PopoverClose",Gb=et((n,t)=>{const{__scopePopover:e,...r}=n,i=Ei(jv,e);return C(Xt.button,{type:"button",...r,ref:t,onClick:Us(n.onClick,()=>i.onOpenChange(!1))})});Gb.displayName=jv;function Yv(n){return n?"open":"closed"}et((n,t)=>{const{__scopePopover:e,...r}=n,i=zs(e);return C(Sb,{...i,...r,ref:t})}).displayName="PopoverArrow";var Xb=Pv,Kb=Uv,qb=Hv;function dt(n,t,{checkForDefaultPrevented:e=!0}={}){return function(r){if(n==null||n(r),e===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function zv(n){const t=n+"CollectionProvider",[e,r]=mi(t),[i,o]=e(t,{collectionRef:{current:null},itemMap:new Map}),s=f=>{const{scope:m,children:g}=f,E=Ot.useRef(null),A=Ot.useRef(new Map).current;return C(i,{scope:m,itemMap:A,collectionRef:E,children:g})};s.displayName=t;const a=n+"CollectionSlot",l=Hs(a),u=Ot.forwardRef((f,m)=>{const{scope:g,children:E}=f,A=Ft(m,o(a,g).collectionRef);return C(l,{ref:A,children:E})});u.displayName=a;const c=n+"CollectionItemSlot",d="data-radix-collection-item",h=Hs(c),p=Ot.forwardRef((f,m)=>{const{scope:g,children:E,...A}=f,v=Ot.useRef(null),_=Ft(m,v),O=o(c,g);return Ot.useEffect(()=>(O.itemMap.set(v,{ref:v,...A}),()=>{O.itemMap.delete(v)})),C(h,{[d]:"",ref:_,children:E})});return p.displayName=c,[{Provider:s,Slot:u,ItemSlot:p},function(f){const m=o(n+"CollectionConsumer",f);return Ot.useCallback(()=>{const E=m.collectionRef.current;if(!E)return[];const A=Array.from(E.querySelectorAll(`[${d}]`));return Array.from(m.itemMap.values()).sort((_,O)=>A.indexOf(_.ref.current)-A.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])},r]}var Jb=nn(void 0);function Vv(n){const t=Re(Jb);return n||t||"ltr"}var Wv,bh="dismissableLayer.update",Zb="dismissableLayer.pointerDownOutside",Qb="dismissableLayer.focusOutside",Gv=nn({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xv=et((n,t)=>{var S;const{disableOutsidePointerEvents:e=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:a,...l}=n,u=Re(Gv),[c,d]=nt(null),h=(S=c==null?void 0:c.ownerDocument)!=null?S:globalThis==null?void 0:globalThis.document,[,p]=nt({}),f=Ft(t,N=>d(N)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),E=m.indexOf(g),A=c?m.indexOf(c):-1,v=u.layersWithOutsidePointerEventsDisabled.size>0,_=A>=E,O=function(N,y=globalThis==null?void 0:globalThis.document){const w=sn(N),b=X(!1),I=X(()=>{});return J(()=>{const P=B=>{if(B.target&&!b.current){let $=function(){qv(Zb,w,U,{discrete:!0})};const U={originalEvent:B};B.pointerType==="touch"?(y.removeEventListener("click",I.current),I.current=$,y.addEventListener("click",I.current,{once:!0})):$()}else y.removeEventListener("click",I.current);b.current=!1},k=window.setTimeout(()=>{y.addEventListener("pointerdown",P)},0);return()=>{window.clearTimeout(k),y.removeEventListener("pointerdown",P),y.removeEventListener("click",I.current)}},[y,w]),{onPointerDownCapture:()=>b.current=!0}}(N=>{const y=N.target,w=[...u.branches].some(b=>b.contains(y));_&&!w&&(i==null||i(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h),T=function(N,y=globalThis==null?void 0:globalThis.document){const w=sn(N),b=X(!1);return J(()=>{const I=P=>{P.target&&!b.current&&qv(Qb,w,{originalEvent:P},{discrete:!1})};return y.addEventListener("focusin",I),()=>y.removeEventListener("focusin",I)},[y,w]),{onFocusCapture:()=>b.current=!0,onBlurCapture:()=>b.current=!1}}(N=>{const y=N.target;[...u.branches].some(w=>w.contains(y))||(o==null||o(N),s==null||s(N),N.defaultPrevented||(a==null||a()))},h);return wA(N=>{A===u.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),J(()=>{if(c)return e&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Wv=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),Kv(),()=>{e&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Wv)}},[c,h,e,u]),J(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),Kv())},[c,u]),J(()=>{const N=()=>p({});return document.addEventListener(bh,N),()=>document.removeEventListener(bh,N)},[]),C(Xt.div,{...l,ref:f,style:{pointerEvents:v?_?"auto":"none":void 0,...n.style},onFocusCapture:dt(n.onFocusCapture,T.onFocusCapture),onBlurCapture:dt(n.onBlurCapture,T.onBlurCapture),onPointerDownCapture:dt(n.onPointerDownCapture,O.onPointerDownCapture)})});Xv.displayName="DismissableLayer";var tI=et((n,t)=>{const e=Re(Gv),r=X(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return e.branches.add(o),()=>{e.branches.delete(o)}},[e.branches]),C(Xt.div,{...n,ref:i})});function Kv(){const n=new CustomEvent(bh);document.dispatchEvent(n)}function qv(n,t,e,{discrete:r}){const i=e.originalEvent.target,o=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:e});t&&i.addEventListener(n,t,{once:!0}),r?eh(i,o):i.dispatchEvent(o)}tI.displayName="DismissableLayerBranch";var Ih=0;function Jv(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}const eI=["top","right","bottom","left"],Pr=Math.min,Xe=Math.max,Hl=Math.round,$l=Math.floor,Un=n=>({x:n,y:n}),nI={left:"right",right:"left",bottom:"top",top:"bottom"},rI={start:"end",end:"start"};function wh(n,t,e){return Xe(n,Pr(t,e))}function ur(n,t){return typeof n=="function"?n(t):n}function cr(n){return n.split("-")[0]}function wo(n){return n.split("-")[1]}function Rh(n){return n==="x"?"y":"x"}function Dh(n){return n==="y"?"height":"width"}function Hn(n){return["top","bottom"].includes(cr(n))?"y":"x"}function kh(n){return Rh(Hn(n))}function Lh(n){return n.replace(/start|end/g,t=>rI[t])}function jl(n){return n.replace(/left|right|bottom|top/g,t=>nI[t])}function Zv(n){return typeof n!="number"?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(n):{top:n,right:n,bottom:n,left:n}}function Yl(n){const{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function Qv(n,t,e){let{reference:r,floating:i}=n;const o=Hn(t),s=kh(t),a=Dh(s),l=cr(t),u=o==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:c,y:r.y-i.height};break;case"bottom":p={x:c,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(wo(t)){case"start":p[s]-=h*(e&&u?-1:1);break;case"end":p[s]+=h*(e&&u?-1:1)}return p}async function Vs(n,t){var e;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:p=0}=ur(t,n),f=Zv(p),m=a[h?d==="floating"?"reference":"floating":d],g=Yl(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(m)))==null||e?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),E=d==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),v=await(o.isElement==null?void 0:o.isElement(A))&&await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1},_=Yl(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:A,strategy:l}):E);return{top:(g.top-_.top+f.top)/v.y,bottom:(_.bottom-g.bottom+f.bottom)/v.y,left:(g.left-_.left+f.left)/v.x,right:(_.right-g.right+f.right)/v.x}}function t_(n,t){return{top:n.top-t.height,right:n.right-t.width,bottom:n.bottom-t.height,left:n.left-t.width}}function e_(n){return eI.some(t=>n[t]>=0)}function zl(){return typeof window!="undefined"}function Ro(n){return n_(n)?(n.nodeName||"").toLowerCase():"#document"}function Ke(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function $n(n){var t;return(t=(n_(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function n_(n){return!!zl()&&(n instanceof Node||n instanceof Ke(n).Node)}function yn(n){return!!zl()&&(n instanceof Element||n instanceof Ke(n).Element)}function jn(n){return!!zl()&&(n instanceof HTMLElement||n instanceof Ke(n).HTMLElement)}function r_(n){return!(!zl()||typeof ShadowRoot=="undefined")&&(n instanceof ShadowRoot||n instanceof Ke(n).ShadowRoot)}function Ws(n){const{overflow:t,overflowX:e,overflowY:r,display:i}=Tn(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!["inline","contents"].includes(i)}function iI(n){return["table","td","th"].includes(Ro(n))}function Vl(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch(e){return!1}})}function xh(n){const t=Mh(),e=yn(n)?Tn(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>!!e[r]&&e[r]!=="none")||!!e.containerType&&e.containerType!=="normal"||!t&&!!e.backdropFilter&&e.backdropFilter!=="none"||!t&&!!e.filter&&e.filter!=="none"||["transform","translate","scale","rotate","perspective","filter"].some(r=>(e.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(e.contain||"").includes(r))}function Mh(){return!(typeof CSS=="undefined"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Do(n){return["html","body","#document"].includes(Ro(n))}function Tn(n){return Ke(n).getComputedStyle(n)}function Wl(n){return yn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Br(n){if(Ro(n)==="html")return n;const t=n.assignedSlot||n.parentNode||r_(n)&&n.host||$n(n);return r_(t)?t.host:t}function i_(n){const t=Br(n);return Do(t)?n.ownerDocument?n.ownerDocument.body:n.body:jn(t)&&Ws(t)?t:i_(t)}function Gs(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);const i=i_(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Ke(i);if(o){const a=Ph(s);return t.concat(s,s.visualViewport||[],Ws(i)?i:[],a&&e?Gs(a):[])}return t.concat(i,Gs(i,[],e))}function Ph(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function o_(n){const t=Tn(n);let e=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=jn(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=Hl(e)!==o||Hl(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function Bh(n){return yn(n)?n:n.contextElement}function ko(n){const t=Bh(n);if(!jn(t))return Un(1);const e=t.getBoundingClientRect(),{width:r,height:i,$:o}=o_(t);let s=(o?Hl(e.width):e.width)/r,a=(o?Hl(e.height):e.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const oI=Un(0);function s_(n){const t=Ke(n);return Mh()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:oI}function Ai(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);const i=n.getBoundingClientRect(),o=Bh(n);let s=Un(1);t&&(r?yn(r)&&(s=ko(r)):s=ko(n));const a=function(h,p,f){return p===void 0&&(p=!1),!(!f||p&&f!==Ke(h))&&p}(o,e,r)?s_(o):Un(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,d=i.height/s.y;if(o){const h=Ke(o),p=r&&yn(r)?Ke(r):r;let f=h,m=Ph(f);for(;m&&r&&p!==f;){const g=ko(m),E=m.getBoundingClientRect(),A=Tn(m),v=E.left+(m.clientLeft+parseFloat(A.paddingLeft))*g.x,_=E.top+(m.clientTop+parseFloat(A.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,d*=g.y,l+=v,u+=_,f=Ke(m),m=Ph(f)}}return Yl({width:c,height:d,x:l,y:u})}function Fh(n,t){const e=Wl(n).scrollLeft;return t?t.left+e:Ai($n(n)).left+e}function a_(n,t,e){e===void 0&&(e=!1);const r=n.getBoundingClientRect();return{x:r.left+t.scrollLeft-(e?0:Fh(n,r)),y:r.top+t.scrollTop}}function l_(n,t,e){let r;if(t==="viewport")r=function(i,o){const s=Ke(i),a=$n(i),l=s.visualViewport;let u=a.clientWidth,c=a.clientHeight,d=0,h=0;if(l){u=l.width,c=l.height;const p=Mh();(!p||p&&o==="fixed")&&(d=l.offsetLeft,h=l.offsetTop)}return{width:u,height:c,x:d,y:h}}(n,e);else if(t==="document")r=function(i){const o=$n(i),s=Wl(i),a=i.ownerDocument.body,l=Xe(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),u=Xe(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let c=-s.scrollLeft+Fh(i);const d=-s.scrollTop;return Tn(a).direction==="rtl"&&(c+=Xe(o.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}($n(n));else if(yn(t))r=function(i,o){const s=Ai(i,!0,o==="fixed"),a=s.top+i.clientTop,l=s.left+i.clientLeft,u=jn(i)?ko(i):Un(1);return{width:i.clientWidth*u.x,height:i.clientHeight*u.y,x:l*u.x,y:a*u.y}}(t,e);else{const i=s_(n);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Yl(r)}function u_(n,t){const e=Br(n);return!(e===t||!yn(e)||Do(e))&&(Tn(e).position==="fixed"||u_(e,t))}function sI(n,t,e){const r=jn(t),i=$n(t),o=e==="fixed",s=Ai(n,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Un(0);function u(){l.x=Fh(i)}if(r||!r&&!o)if((Ro(t)!=="body"||Ws(i))&&(a=Wl(t)),r){const d=Ai(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();o&&!r&&i&&u();const c=!i||r||o?Un(0):a_(i,a);return{x:s.left+a.scrollLeft-l.x-c.x,y:s.top+a.scrollTop-l.y-c.y,width:s.width,height:s.height}}function Uh(n){return Tn(n).position==="static"}function c_(n,t){if(!jn(n)||Tn(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return $n(n)===e&&(e=e.ownerDocument.body),e}function d_(n,t){const e=Ke(n);if(Vl(n))return e;if(!jn(n)){let i=Br(n);for(;i&&!Do(i);){if(yn(i)&&!Uh(i))return i;i=Br(i)}return e}let r=c_(n,t);for(;r&&iI(r)&&Uh(r);)r=c_(r,t);return r&&Do(r)&&Uh(r)&&!xh(r)?e:r||function(i){let o=Br(i);for(;jn(o)&&!Do(o);){if(xh(o))return o;if(Vl(o))return null;o=Br(o)}return null}(n)||e}const aI={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n;const o=i==="fixed",s=$n(r),a=!!t&&Vl(t.floating);if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},u=Un(1);const c=Un(0),d=jn(r);if((d||!d&&!o)&&((Ro(r)!=="body"||Ws(s))&&(l=Wl(r)),jn(r))){const p=Ai(r);u=ko(r),c.x=p.x+r.clientLeft,c.y=p.y+r.clientTop}const h=!s||d||o?Un(0):a_(s,l,!0);return{width:e.width*u.x,height:e.height*u.y,x:e.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:e.y*u.y-l.scrollTop*u.y+c.y+h.y}},getDocumentElement:$n,getClippingRect:function(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n;const o=e==="clippingAncestors"?Vl(t)?[]:function(u,c){const d=c.get(u);if(d)return d;let h=Gs(u,[],!1).filter(g=>yn(g)&&Ro(g)!=="body"),p=null;const f=Tn(u).position==="fixed";let m=f?Br(u):u;for(;yn(m)&&!Do(m);){const g=Tn(m),E=xh(m);E||g.position!=="fixed"||(p=null),(f?!E&&!p:!E&&g.position==="static"&&p&&["absolute","fixed"].includes(p.position)||Ws(m)&&!E&&u_(u,m))?h=h.filter(A=>A!==m):p=g,m=Br(m)}return c.set(u,h),h}(t,this._c):[].concat(e),s=[...o,r],a=s[0],l=s.reduce((u,c)=>{const d=l_(t,c,i);return u.top=Xe(d.top,u.top),u.right=Pr(d.right,u.right),u.bottom=Pr(d.bottom,u.bottom),u.left=Xe(d.left,u.left),u},l_(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:d_,getElementRects:async function(n){const t=this.getOffsetParent||d_,e=this.getDimensions,r=await e(n.floating);return{reference:sI(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){const{width:t,height:e}=o_(n);return{width:t,height:e}},getScale:ko,isElement:yn,isRTL:function(n){return Tn(n).direction==="rtl"}};function h_(n,t){return n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function lI(n,t,e,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Bh(n),c=i||o?[...u?Gs(u):[],...Gs(t)]:[];c.forEach(g=>{i&&g.addEventListener("scroll",e,{passive:!0}),o&&g.addEventListener("resize",e)});const d=u&&a?function(g,E){let A,v=null;const _=$n(g);function O(){var T;clearTimeout(A),(T=v)==null||T.disconnect(),v=null}return function T(S,N){S===void 0&&(S=!1),N===void 0&&(N=1),O();const y=g.getBoundingClientRect(),{left:w,top:b,width:I,height:P}=y;if(S||E(),!I||!P)return;const k={rootMargin:-$l(b)+"px "+-$l(_.clientWidth-(w+I))+"px "+-$l(_.clientHeight-(b+P))+"px "+-$l(w)+"px",threshold:Xe(0,Pr(1,N))||1};let B=!0;function $(U){const V=U[0].intersectionRatio;if(V!==N){if(!B)return T();V?T(!1,V):A=setTimeout(()=>{T(!1,1e-7)},1e3)}V!==1||h_(y,g.getBoundingClientRect())||T(),B=!1}try{v=new IntersectionObserver($,{...k,root:_.ownerDocument})}catch(U){v=new IntersectionObserver($,k)}v.observe(g)}(!0),O}(u,e):null;let h,p=-1,f=null;s&&(f=new ResizeObserver(g=>{let[E]=g;E&&E.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var A;(A=f)==null||A.observe(t)})),e()}),u&&!l&&f.observe(u),f.observe(t));let m=l?Ai(n):null;return l&&function g(){const E=Ai(n);m&&!h_(m,E)&&e(),m=E,h=requestAnimationFrame(g)}(),e(),()=>{var g;c.forEach(E=>{i&&E.removeEventListener("scroll",e),o&&E.removeEventListener("resize",e)}),d==null||d(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const uI=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await async function(u,c){const{placement:d,platform:h,elements:p}=u,f=await(h.isRTL==null?void 0:h.isRTL(p.floating)),m=cr(d),g=wo(d),E=Hn(d)==="y",A=["left","top"].includes(m)?-1:1,v=f&&E?-1:1,_=ur(c,u);let{mainAxis:O,crossAxis:T,alignmentAxis:S}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return g&&typeof S=="number"&&(T=g==="end"?-1*S:S),E?{x:T*v,y:O*A}:{x:O*A,y:T*v}}(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},cI=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){const{x:e,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:E,y:A}=g;return{x:E,y:A}}},...l}=ur(n,t),u={x:e,y:r},c=await Vs(t,l),d=Hn(cr(i)),h=Rh(d);let p=u[h],f=u[d];if(o){const g=h==="y"?"bottom":"right";p=wh(p+c[h==="y"?"top":"left"],p,p-c[g])}if(s){const g=d==="y"?"bottom":"right";f=wh(f+c[d==="y"?"top":"left"],f,f-c[g])}const m=a.fn({...t,[h]:p,[d]:f});return{...m,data:{x:m.x-e,y:m.y-r,enabled:{[h]:o,[d]:s}}}}}},dI=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=ur(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};const E=cr(i),A=Hn(a),v=cr(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=h||(v||!m?[jl(a)]:function(k){const B=jl(k);return[Lh(k),B,Lh(B)]}(a)),T=f!=="none";!h&&T&&O.push(...function(k,B,$,U){const V=wo(k);let L=function(Q,j,tt){const it=["left","right"],x=["right","left"],q=["top","bottom"],ot=["bottom","top"];switch(Q){case"top":case"bottom":return tt?j?x:it:j?it:x;case"left":case"right":return j?q:ot;default:return[]}}(cr(k),$==="start",U);return V&&(L=L.map(Q=>Q+"-"+V),B&&(L=L.concat(L.map(Lh)))),L}(a,m,f,_));const S=[a,...O],N=await Vs(t,g),y=[];let w=((r=o.flip)==null?void 0:r.overflows)||[];if(c&&y.push(N[E]),d){const k=function(B,$,U){U===void 0&&(U=!1);const V=wo(B),L=kh(B),Q=Dh(L);let j=L==="x"?V===(U?"end":"start")?"right":"left":V==="start"?"bottom":"top";return $.reference[Q]>$.floating[Q]&&(j=jl(j)),[j,jl(j)]}(i,s,_);y.push(N[k[0]],N[k[1]])}if(w=[...w,{placement:i,overflows:y}],!y.every(k=>k<=0)){var b,I;const k=(((b=o.flip)==null?void 0:b.index)||0)+1,B=S[k];if(B&&(!(d==="alignment"&&A!==Hn(B))||w.every(U=>U.overflows[0]>0&&Hn(U.placement)===A)))return{data:{index:k,overflows:w},reset:{placement:B}};let $=(I=w.filter(U=>U.overflows[0]<=0).sort((U,V)=>U.overflows[1]-V.overflows[1])[0])==null?void 0:I.placement;if(!$)switch(p){case"bestFit":{var P;const U=(P=w.filter(V=>{if(T){const L=Hn(V.placement);return L===A||L==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(L=>L>0).reduce((L,Q)=>L+Q,0)]).sort((V,L)=>V[1]-L[1])[0])==null?void 0:P[0];U&&($=U);break}case"initialPlacement":$=a}if(i!==$)return{reset:{placement:$}}}return{}}}},hI=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var e,r;const{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ur(n,t),c=await Vs(t,u),d=cr(i),h=wo(i),p=Hn(i)==="y",{width:f,height:m}=o.floating;let g,E;d==="top"||d==="bottom"?(g=d,E=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=d,g=h==="end"?"top":"bottom");const A=m-c.top-c.bottom,v=f-c.left-c.right,_=Pr(m-c[g],A),O=Pr(f-c[E],v),T=!t.middlewareData.shift;let S=_,N=O;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(N=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=A),T&&!h){const w=Xe(c.left,0),b=Xe(c.right,0),I=Xe(c.top,0),P=Xe(c.bottom,0);p?N=f-2*(w!==0||b!==0?w+b:Xe(c.left,c.right)):S=m-2*(I!==0||P!==0?I+P:Xe(c.top,c.bottom))}await l({...t,availableWidth:N,availableHeight:S});const y=await s.getDimensions(a.floating);return f!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}},pI=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(t){const{rects:e}=t,{strategy:r="referenceHidden",...i}=ur(n,t);switch(r){case"referenceHidden":{const o=t_(await Vs(t,{...i,elementContext:"reference"}),e.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:e_(o)}}}case"escaped":{const o=t_(await Vs(t,{...i,altBoundary:!0}),e.floating);return{data:{escapedOffsets:o,escaped:e_(o)}}}default:return{}}}}},p_=n=>({name:"arrow",options:n,async fn(t){const{x:e,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=ur(n,t)||{};if(u==null)return{};const d=Zv(c),h={x:e,y:r},p=kh(i),f=Dh(p),m=await s.getDimensions(u),g=p==="y",E=g?"top":"left",A=g?"bottom":"right",v=g?"clientHeight":"clientWidth",_=o.reference[f]+o.reference[p]-h[p]-o.floating[f],O=h[p]-o.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=T?T[v]:0;S&&await(s.isElement==null?void 0:s.isElement(T))||(S=a.floating[v]||o.floating[f]);const N=_/2-O/2,y=S/2-m[f]/2-1,w=Pr(d[E],y),b=Pr(d[A],y),I=w,P=S-m[f]-b,k=S/2-m[f]/2+N,B=wh(I,k,P),$=!l.arrow&&wo(i)!=null&&k!==B&&o.reference[f]/2-(k<I?w:b)-m[f]/2<0,U=$?k<I?k-I:k-P:0;return{[p]:h[p]+U,data:{[p]:B,centerOffset:k-B-U,...$&&{alignmentOffset:U}},reset:$}}}),fI=function(n){return n===void 0&&(n={}),{options:n,fn(t){const{x:e,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ur(n,t),c={x:e,y:r},d=Hn(i),h=Rh(d);let p=c[h],f=c[d];const m=ur(a,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const v=h==="y"?"height":"width",_=o.reference[h]-o.floating[v]+g.mainAxis,O=o.reference[h]+o.reference[v]-g.mainAxis;p<_?p=_:p>O&&(p=O)}if(u){var E,A;const v=h==="y"?"width":"height",_=["top","left"].includes(cr(i)),O=o.reference[d]-o.floating[v]+(_&&((E=s.offset)==null?void 0:E[d])||0)+(_?0:g.crossAxis),T=o.reference[d]+o.reference[v]+(_?0:((A=s.offset)==null?void 0:A[d])||0)-(_?g.crossAxis:0);f<O?f=O:f>T&&(f=T)}return{[h]:p,[d]:f}}}},mI=(n,t,e)=>{const r=new Map,i={platform:aI,...e},o={...i.platform,_c:r};return(async(s,a,l)=>{const{placement:u="bottom",strategy:c="absolute",middleware:d=[],platform:h}=l,p=d.filter(Boolean),f=await(h.isRTL==null?void 0:h.isRTL(a));let m=await h.getElementRects({reference:s,floating:a,strategy:c}),{x:g,y:E}=Qv(m,u,f),A=u,v={},_=0;for(let O=0;O<p.length;O++){const{name:T,fn:S}=p[O],{x:N,y,data:w,reset:b}=await S({x:g,y:E,initialPlacement:u,placement:A,strategy:c,middlewareData:v,rects:m,platform:h,elements:{reference:s,floating:a}});g=N!=null?N:g,E=y!=null?y:E,v={...v,[T]:{...v[T],...w}},b&&_<=50&&(_++,typeof b=="object"&&(b.placement&&(A=b.placement),b.rects&&(m=b.rects===!0?await h.getElementRects({reference:s,floating:a,strategy:c}):b.rects),{x:g,y:E}=Qv(m,A,f)),O=-1)}return{x:g,y:E,placement:A,strategy:c,middlewareData:v}})(n,t,{...i,platform:o})};var Gl=typeof document!="undefined"?se:function(){};function Xl(n,t){if(n===t)return!0;if(typeof n!=typeof t)return!1;if(typeof n=="function"&&n.toString()===t.toString())return!0;let e,r,i;if(n&&t&&typeof n=="object"){if(Array.isArray(n)){if(e=n.length,e!==t.length)return!1;for(r=e;r--!=0;)if(!Xl(n[r],t[r]))return!1;return!0}if(i=Object.keys(n),e=i.length,e!==Object.keys(t).length)return!1;for(r=e;r--!=0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=e;r--!=0;){const o=i[r];if((o!=="_owner"||!n.$$typeof)&&!Xl(n[o],t[o]))return!1}return!0}return n!=n&&t!=t}function f_(n){return typeof window=="undefined"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function m_(n,t){const e=f_(n);return Math.round(t*e)/e}function Hh(n){const t=X(n);return Gl(()=>{t.current=n}),t}const gI=n=>({name:"arrow",options:n,fn(t){const{element:e,padding:r}=typeof n=="function"?n(t):n;return e&&(i=e,{}.hasOwnProperty.call(i,"current"))?e.current!=null?p_({element:e.current,padding:r}).fn(t):{}:e?p_({element:e,padding:r}).fn(t):{};var i}}),EI=(n,t)=>({...uI(n),options:[n,t]}),AI=(n,t)=>({...cI(n),options:[n,t]}),vI=(n,t)=>({...fI(n),options:[n,t]}),_I=(n,t)=>({...dI(n),options:[n,t]}),yI=(n,t)=>({...hI(n),options:[n,t]}),TI=(n,t)=>({...pI(n),options:[n,t]}),OI=(n,t)=>({...gI(n),options:[n,t]});var $h="Popper",[g_,E_]=mi($h),[SI,A_]=g_($h),v_=n=>{const{__scopePopper:t,children:e}=n,[r,i]=nt(null);return C(SI,{scope:t,anchor:r,onAnchorChange:i,children:e})};v_.displayName=$h;var __="PopperAnchor",y_=et((n,t)=>{const{__scopePopper:e,virtualRef:r,...i}=n,o=A_(__,e),s=X(null),a=Ft(t,s);return J(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:C(Xt.div,{...i,ref:a})});y_.displayName=__;var jh="PopperContent",[NI,CI]=g_(jh),T_=et((n,t)=>{var ut,F,ct,yt,ee,jt,ce,Zt;const{__scopePopper:e,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:f,...m}=n,g=A_(jh,e),[E,A]=nt(null),v=Ft(t,gt=>A(gt)),[_,O]=nt(null),T=av(_),S=(ut=T==null?void 0:T.width)!=null?ut:0,N=(F=T==null?void 0:T.height)!=null?F:0,y=r+(o!=="center"?"-"+o:""),w=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},b=Array.isArray(u)?u:[u],I=b.length>0,P={padding:w,boundary:b.filter(II),altBoundary:I},{refs:k,floatingStyles:B,placement:$,isPositioned:U,middlewareData:V}=function(gt){gt===void 0&&(gt={});const{placement:Kt="bottom",strategy:Nt="absolute",middleware:Rt=[],platform:qe,elements:{reference:hr,floating:ne}={},transform:Ur=!0,whileElementsMounted:bi,open:pr}=gt,[re,Ii]=nt({x:0,y:0,strategy:Nt,placement:Kt,middlewareData:{},isPositioned:!1}),[fr,Hr]=nt(Rt);Xl(fr,Rt)||Hr(Rt);const[wi,Uo]=nt(null),[Ho,Ri]=nt(null),Di=rt(D=>{D!==de.current&&(de.current=D,Uo(D))},[]),Wn=rt(D=>{D!==ve.current&&(ve.current=D,Ri(D))},[]),Qt=hr||wi,te=ne||Ho,de=X(null),ve=X(null),Je=X(re),$o=bi!=null,Ie=Hh(bi),Ze=Hh(qe),$r=Hh(pr),Me=rt(()=>{if(!de.current||!ve.current)return;const D={placement:Kt,strategy:Nt,middleware:fr};Ze.current&&(D.platform=Ze.current),mI(de.current,ve.current,D).then(Y=>{const Z={...Y,isPositioned:$r.current!==!1};Sn.current&&!Xl(Je.current,Z)&&(Je.current=Z,Hi(()=>{Ii(Z)}))})},[fr,Kt,Nt,Ze,$r]);Gl(()=>{pr===!1&&Je.current.isPositioned&&(Je.current.isPositioned=!1,Ii(D=>({...D,isPositioned:!1})))},[pr]);const Sn=X(!1);Gl(()=>(Sn.current=!0,()=>{Sn.current=!1}),[]),Gl(()=>{if(Qt&&(de.current=Qt),te&&(ve.current=te),Qt&&te){if(Ie.current)return Ie.current(Qt,te,Me);Me()}},[Qt,te,Me,Ie,$o]);const ki=at(()=>({reference:de,floating:ve,setReference:Di,setFloating:Wn}),[Di,Wn]),ie=at(()=>({reference:Qt,floating:te}),[Qt,te]),R=at(()=>{const D={position:Nt,left:0,top:0};if(!ie.floating)return D;const Y=m_(ie.floating,re.x),Z=m_(ie.floating,re.y);return Ur?{...D,transform:"translate("+Y+"px, "+Z+"px)",...f_(ie.floating)>=1.5&&{willChange:"transform"}}:{position:Nt,left:Y,top:Z}},[Nt,Ur,ie.floating,re.x,re.y]);return at(()=>({...re,update:Me,refs:ki,elements:ie,floatingStyles:R}),[re,Me,ki,ie,R])}({strategy:"fixed",placement:y,whileElementsMounted:(...gt)=>lI(...gt,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[EI({mainAxis:i+N,alignmentAxis:s}),l&&AI({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?vI():void 0,...P}),l&&_I({...P}),yI({...P,apply:({elements:gt,rects:Kt,availableWidth:Nt,availableHeight:Rt})=>{const{width:qe,height:hr}=Kt.reference,ne=gt.floating.style;ne.setProperty("--radix-popper-available-width",`${Nt}px`),ne.setProperty("--radix-popper-available-height",`${Rt}px`),ne.setProperty("--radix-popper-anchor-width",`${qe}px`),ne.setProperty("--radix-popper-anchor-height",`${hr}px`)}}),_&&OI({element:_,padding:a}),wI({arrowWidth:S,arrowHeight:N}),h&&TI({strategy:"referenceHidden",...P})]}),[L,Q]=N_($),j=sn(f);An(()=>{U&&(j==null||j())},[U,j]);const tt=(ct=V.arrow)==null?void 0:ct.x,it=(yt=V.arrow)==null?void 0:yt.y,x=((ee=V.arrow)==null?void 0:ee.centerOffset)!==0,[q,ot]=nt();return An(()=>{E&&ot(window.getComputedStyle(E).zIndex)},[E]),C("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:U?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[(jt=V.transformOrigin)==null?void 0:jt.x,(ce=V.transformOrigin)==null?void 0:ce.y].join(" "),...((Zt=V.hide)==null?void 0:Zt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:C(NI,{scope:e,placedSide:L,onArrowChange:O,arrowX:tt,arrowY:it,shouldHideArrow:x,children:C(Xt.div,{"data-side":L,"data-align":Q,...m,ref:v,style:{...m.style,animation:U?void 0:"none"}})})})});T_.displayName=jh;var O_="PopperArrow",bI={top:"bottom",right:"left",bottom:"top",left:"right"},S_=et(function(n,t){const{__scopePopper:e,...r}=n,i=CI(O_,e),o=bI[i.placedSide];return C("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:C(sv,{...r,ref:t,style:{...r.style,display:"block"}})})});function II(n){return n!==null}S_.displayName=O_;var wI=n=>({name:"transformOrigin",options:n,fn(t){var m,g,E,A,v;const{placement:e,rects:r,middlewareData:i}=t,o=((m=i.arrow)==null?void 0:m.centerOffset)!==0,s=o?0:n.arrowWidth,a=o?0:n.arrowHeight,[l,u]=N_(e),c={start:"0%",center:"50%",end:"100%"}[u],d=((E=(g=i.arrow)==null?void 0:g.x)!=null?E:0)+s/2,h=((v=(A=i.arrow)==null?void 0:A.y)!=null?v:0)+a/2;let p="",f="";return l==="bottom"?(p=o?c:`${d}px`,f=-a+"px"):l==="top"?(p=o?c:`${d}px`,f=`${r.floating.height+a}px`):l==="right"?(p=-a+"px",f=o?c:`${h}px`):l==="left"&&(p=`${r.floating.width+a}px`,f=o?c:`${h}px`),{data:{x:p,y:f}}}});function N_(n){const[t,e="center"]=n.split("-");return[t,e]}var RI=v_,DI=y_,kI=T_,LI=S_,Kl=n=>{const{present:t,children:e}=n,r=function(s){const[a,l]=nt(),u=X(null),c=X(s),d=X("none"),h=s?"mounted":"unmounted",[p,f]=function(m,g){return Bi((E,A)=>{var v;return(v=g[E][A])!=null?v:E},m)}(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J(()=>{const m=ql(u.current);d.current=p==="mounted"?m:"none"},[p]),An(()=>{const m=u.current,g=c.current;if(g!==s){const E=d.current,A=ql(m);s?f("MOUNT"):A==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(g&&E!==A?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,f]),An(()=>{var m;if(a){let g;const E=(m=a.ownerDocument.defaultView)!=null?m:window,A=_=>{const O=ql(u.current).includes(_.animationName);if(_.target===a&&O&&(f("ANIMATION_END"),!c.current)){const T=a.style.animationFillMode;a.style.animationFillMode="forwards",g=E.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=T)})}},v=_=>{_.target===a&&(d.current=ql(u.current))};return a.addEventListener("animationstart",v),a.addEventListener("animationcancel",A),a.addEventListener("animationend",A),()=>{E.clearTimeout(g),a.removeEventListener("animationstart",v),a.removeEventListener("animationcancel",A),a.removeEventListener("animationend",A)}}f("ANIMATION_END")},[a,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:rt(m=>{u.current=m?getComputedStyle(m):null,l(m)},[])}}(t),i=typeof e=="function"?e({present:r.isPresent}):Cn.only(e),o=Ft(r.ref,function(s){var u,c;let a=(u=Object.getOwnPropertyDescriptor(s.props,"ref"))==null?void 0:u.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?s.ref:(a=(c=Object.getOwnPropertyDescriptor(s,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?s.props.ref:s.props.ref||s.ref)}(i));return typeof e=="function"||r.isPresent?zr(i,{ref:o}):null};function ql(n){return(n==null?void 0:n.animationName)||"none"}Kl.displayName="Presence";var Yh="rovingFocusGroup.onEntryFocus",xI={bubbles:!1,cancelable:!0},Xs="RovingFocusGroup",[zh,C_,MI]=zv(Xs),[PI,b_]=mi(Xs,[MI]),[BI,FI]=PI(Xs),I_=et((n,t)=>C(zh.Provider,{scope:n.__scopeRovingFocusGroup,children:C(zh.Slot,{scope:n.__scopeRovingFocusGroup,children:C(UI,{...n,ref:t})})}));I_.displayName=Xs;var UI=et((n,t)=>{const{__scopeRovingFocusGroup:e,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=n,h=X(null),p=Ft(t,h),f=Vv(o),[m,g]=yh({prop:s,defaultProp:a!=null?a:null,onChange:l,caller:Xs}),[E,A]=nt(!1),v=sn(u),_=C_(e),O=X(!1),[T,S]=nt(0);return J(()=>{const N=h.current;if(N)return N.addEventListener(Yh,v),()=>N.removeEventListener(Yh,v)},[v]),C(BI,{scope:e,orientation:r,dir:f,loop:i,currentTabStopId:m,onItemFocus:rt(N=>g(N),[g]),onItemShiftTab:rt(()=>A(!0),[]),onFocusableItemAdd:rt(()=>S(N=>N+1),[]),onFocusableItemRemove:rt(()=>S(N=>N-1),[]),children:C(Xt.div,{tabIndex:E||T===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...n.style},onMouseDown:dt(n.onMouseDown,()=>{O.current=!0}),onFocus:dt(n.onFocus,N=>{const y=!O.current;if(N.target===N.currentTarget&&y&&!E){const w=new CustomEvent(Yh,xI);if(N.currentTarget.dispatchEvent(w),!w.defaultPrevented){const b=_().filter(I=>I.focusable);D_([b.find(I=>I.active),b.find(I=>I.id===m),...b].filter(Boolean).map(I=>I.ref.current),c)}}O.current=!1}),onBlur:dt(n.onBlur,()=>A(!1))})})}),w_="RovingFocusGroupItem",R_=et((n,t)=>{const{__scopeRovingFocusGroup:e,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=n,l=_l(),u=o||l,c=FI(w_,e),d=c.currentTabStopId===u,h=C_(e),{onFocusableItemAdd:p,onFocusableItemRemove:f,currentTabStopId:m}=c;return J(()=>{if(r)return p(),()=>f()},[r,p,f]),C(zh.ItemSlot,{scope:e,id:u,focusable:r,active:i,children:C(Xt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:dt(n.onMouseDown,g=>{r?c.onItemFocus(u):g.preventDefault()}),onFocus:dt(n.onFocus,()=>c.onItemFocus(u)),onKeyDown:dt(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey)return void c.onItemShiftTab();if(g.target!==g.currentTarget)return;const E=function(_,O,T){const S=function(N,y){return y!=="rtl"?N:N==="ArrowLeft"?"ArrowRight":N==="ArrowRight"?"ArrowLeft":N}(_.key,T);return O==="vertical"&&["ArrowLeft","ArrowRight"].includes(S)||O==="horizontal"&&["ArrowUp","ArrowDown"].includes(S)?void 0:HI[S]}(g,c.orientation,c.dir);if(E!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=h().filter(O=>O.focusable).map(O=>O.ref.current);if(E==="last")_.reverse();else if(E==="prev"||E==="next"){E==="prev"&&_.reverse();const O=_.indexOf(g.currentTarget);_=c.loop?(v=O+1,(A=_).map((T,S)=>A[(v+S)%A.length])):_.slice(O+1)}setTimeout(()=>D_(_))}var A,v}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});R_.displayName=w_;var HI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function D_(n,t=!1){const e=document.activeElement;for(const r of n)if(r===e||(r.focus({preventScroll:t}),document.activeElement!==e))return}var $I=I_,jI=R_,Vh=["Enter"," "],k_=["ArrowUp","PageDown","End"],YI=["ArrowDown","PageUp","Home",...k_],zI={ltr:[...Vh,"ArrowRight"],rtl:[...Vh,"ArrowLeft"]},VI={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ks="Menu",[qs,WI,GI]=zv(Ks),[vi,L_]=mi(Ks,[GI,E_,b_]),Jl=E_(),x_=b_(),[XI,Lo]=vi(Ks),[KI,Js]=vi(Ks),M_=n=>{const{__scopeMenu:t,open:e=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=n,a=Jl(t),[l,u]=nt(null),c=X(!1),d=sn(o),h=Vv(i);return J(()=>{const p=()=>{c.current=!0,document.addEventListener("pointerdown",f,{capture:!0,once:!0}),document.addEventListener("pointermove",f,{capture:!0,once:!0})},f=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",f,{capture:!0}),document.removeEventListener("pointermove",f,{capture:!0})}},[]),C(RI,{...a,children:C(XI,{scope:t,open:e,onOpenChange:d,content:l,onContentChange:u,children:C(KI,{scope:t,onClose:rt(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:h,modal:s,children:r})})})};M_.displayName=Ks;var Wh=et((n,t)=>{const{__scopeMenu:e,...r}=n,i=Jl(e);return C(DI,{...i,...r,ref:t})});Wh.displayName="MenuAnchor";var[XD,P_]=vi("MenuPortal",{forceMount:void 0}),an="MenuContent",[qI,Gh]=vi(an),B_=et((n,t)=>{const e=P_(an,n.__scopeMenu),{forceMount:r=e.forceMount,...i}=n,o=Lo(an,n.__scopeMenu),s=Js(an,n.__scopeMenu);return C(qs.Provider,{scope:n.__scopeMenu,children:C(Kl,{present:r||o.open,children:C(qs.Slot,{scope:n.__scopeMenu,children:s.modal?C(JI,{...i,ref:t}):C(ZI,{...i,ref:t})})})})}),JI=et((n,t)=>{const e=Lo(an,n.__scopeMenu),r=X(null),i=Ft(t,r);return J(()=>{const o=r.current;if(o)return Tv(o)},[]),C(Xh,{...n,ref:i,trapFocus:e.open,disableOutsidePointerEvents:e.open,disableOutsideScroll:!0,onFocusOutside:dt(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>e.onOpenChange(!1)})}),ZI=et((n,t)=>{const e=Lo(an,n.__scopeMenu);return C(Xh,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>e.onOpenChange(!1)})}),QI=Hs("MenuContent.ScrollLock"),Xh=et((n,t)=>{const{__scopeMenu:e,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:f,...m}=n,g=Lo(an,e),E=Js(an,e),A=Jl(e),v=x_(e),_=WI(e),[O,T]=nt(null),S=X(null),N=Ft(t,S,g.onContentChange),y=X(0),w=X(""),b=X(0),I=X(null),P=X("right"),k=X(0),B=f?Ch:Vt,$=f?{as:QI,allowPinchZoom:!0}:void 0,U=L=>{var ot,ut;const Q=w.current+L,j=_().filter(F=>!F.disabled),tt=document.activeElement,it=(ot=j.find(F=>F.ref.current===tt))==null?void 0:ot.textValue,x=function(F,ct,yt){const ee=ct.length>1&&Array.from(ct).every(Rt=>Rt===ct[0]),jt=ee?ct[0]:ct,ce=yt?F.indexOf(yt):-1;let Zt=(gt=F,Kt=Math.max(ce,0),gt.map((Rt,qe)=>gt[(Kt+qe)%gt.length]));var gt,Kt;jt.length===1&&(Zt=Zt.filter(Rt=>Rt!==yt));const Nt=Zt.find(Rt=>Rt.toLowerCase().startsWith(jt.toLowerCase()));return Nt!==yt?Nt:void 0}(j.map(F=>F.textValue),Q,it),q=(ut=j.find(F=>F.textValue===x))==null?void 0:ut.ref.current;(function F(ct){w.current=ct,window.clearTimeout(y.current),ct!==""&&(y.current=window.setTimeout(()=>F(""),1e3))})(Q),q&&setTimeout(()=>q.focus())};J(()=>()=>window.clearTimeout(y.current),[]),J(()=>{var Q,j;const L=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(Q=L[0])!=null?Q:Jv()),document.body.insertAdjacentElement("beforeend",(j=L[1])!=null?j:Jv()),Ih++,()=>{Ih===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(tt=>tt.remove()),Ih--}},[]);const V=rt(L=>{var Q,j;return P.current===((Q=I.current)==null?void 0:Q.side)&&function(tt,it){if(!it)return!1;const x={x:tt.clientX,y:tt.clientY};return function(q,ot){const{x:ut,y:F}=q;let ct=!1;for(let yt=0,ee=ot.length-1;yt<ot.length;ee=yt++){const jt=ot[yt],ce=ot[ee],Zt=jt.x,gt=jt.y,Kt=ce.x,Nt=ce.y;gt>F!=Nt>F&&ut<(Kt-Zt)*(F-gt)/(Nt-gt)+Zt&&(ct=!ct)}return ct}(x,it)}(L,(j=I.current)==null?void 0:j.area)},[]);return C(qI,{scope:e,searchRef:w,onItemEnter:rt(L=>{V(L)&&L.preventDefault()},[V]),onItemLeave:rt(L=>{var Q;V(L)||((Q=S.current)==null||Q.focus(),T(null))},[V]),onTriggerLeave:rt(L=>{V(L)&&L.preventDefault()},[V]),pointerGraceTimerRef:b,onPointerGraceIntentChange:rt(L=>{I.current=L},[]),children:C(B,{...$,children:C(sh,{asChild:!0,trapped:i,onMountAutoFocus:dt(o,L=>{var Q;L.preventDefault(),(Q=S.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:C(Xv,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:C($I,{asChild:!0,...v,dir:E.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:dt(l,L=>{E.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:C(kI,{role:"menu","aria-orientation":"vertical","data-state":ty(g.open),"data-radix-menu-content":"",dir:E.dir,...A,...m,ref:N,style:{outline:"none",...m.style},onKeyDown:dt(m.onKeyDown,L=>{const Q=L.target.closest("[data-radix-menu-content]")===L.currentTarget,j=L.ctrlKey||L.altKey||L.metaKey,tt=L.key.length===1;Q&&(L.key==="Tab"&&L.preventDefault(),!j&&tt&&U(L.key));const it=S.current;if(L.target!==it||!YI.includes(L.key))return;L.preventDefault();const x=_().filter(q=>!q.disabled).map(q=>q.ref.current);k_.includes(L.key)&&x.reverse(),function(q){const ot=document.activeElement;for(const ut of q)if(ut===ot||(ut.focus(),document.activeElement!==ot))return}(x)}),onBlur:dt(n.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(y.current),w.current="")}),onPointerMove:dt(n.onPointerMove,Qs(L=>{const Q=L.target,j=k.current!==L.clientX;if(L.currentTarget.contains(Q)&&j){const tt=L.clientX>k.current?"right":"left";P.current=tt,k.current=L.clientX}}))})})})})})})});B_.displayName=an;var Kh=et((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{role:"group",...r,ref:t})});Kh.displayName="MenuGroup";var F_=et((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{...r,ref:t})});F_.displayName="MenuLabel";var Zl="MenuItem",U_="menu.itemSelect",Ql=et((n,t)=>{const{disabled:e=!1,onSelect:r,...i}=n,o=X(null),s=Js(Zl,n.__scopeMenu),a=Gh(Zl,n.__scopeMenu),l=Ft(t,o),u=X(!1);return C(H_,{...i,ref:l,disabled:e,onClick:dt(n.onClick,()=>{const c=o.current;if(!e&&c){const d=new CustomEvent(U_,{bubbles:!0,cancelable:!0});c.addEventListener(U_,h=>r==null?void 0:r(h),{once:!0}),eh(c,d),d.defaultPrevented?u.current=!1:s.onClose()}}),onPointerDown:c=>{var d;(d=n.onPointerDown)==null||d.call(n,c),u.current=!0},onPointerUp:dt(n.onPointerUp,c=>{var d;u.current||((d=c.currentTarget)==null||d.click())}),onKeyDown:dt(n.onKeyDown,c=>{const d=a.searchRef.current!=="";e||d&&c.key===" "||Vh.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});Ql.displayName=Zl;var H_=et((n,t)=>{const{__scopeMenu:e,disabled:r=!1,textValue:i,...o}=n,s=Gh(Zl,e),a=x_(e),l=X(null),u=Ft(t,l),[c,d]=nt(!1),[h,p]=nt("");return J(()=>{var m;const f=l.current;f&&p(((m=f.textContent)!=null?m:"").trim())},[o.children]),C(qs.ItemSlot,{scope:e,disabled:r,textValue:i!=null?i:h,children:C(jI,{asChild:!0,...a,focusable:!r,children:C(Xt.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:dt(n.onPointerMove,Qs(f=>{r?s.onItemLeave(f):(s.onItemEnter(f),!f.defaultPrevented&&f.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:dt(n.onPointerLeave,Qs(f=>s.onItemLeave(f))),onFocus:dt(n.onFocus,()=>d(!0)),onBlur:dt(n.onBlur,()=>d(!1))})})})}),$_=et((n,t)=>{const{checked:e=!1,onCheckedChange:r,...i}=n;return C(W_,{scope:n.__scopeMenu,checked:e,children:C(Ql,{role:"menuitemcheckbox","aria-checked":tu(e)?"mixed":e,...i,ref:t,"data-state":Jh(e),onSelect:dt(i.onSelect,()=>r==null?void 0:r(!!tu(e)||!e),{checkForDefaultPrevented:!1})})})});$_.displayName="MenuCheckboxItem";var j_="MenuRadioGroup",[tw,ew]=vi(j_,{value:void 0,onValueChange:()=>{}}),Y_=et((n,t)=>{const{value:e,onValueChange:r,...i}=n,o=sn(r);return C(tw,{scope:n.__scopeMenu,value:e,onValueChange:o,children:C(Kh,{...i,ref:t})})});Y_.displayName=j_;var z_="MenuRadioItem",V_=et((n,t)=>{const{value:e,...r}=n,i=ew(z_,n.__scopeMenu),o=e===i.value;return C(W_,{scope:n.__scopeMenu,checked:o,children:C(Ql,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Jh(o),onSelect:dt(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,e)},{checkForDefaultPrevented:!1})})})});V_.displayName=z_;var qh="MenuItemIndicator",[W_,nw]=vi(qh,{checked:!1}),G_=et((n,t)=>{const{__scopeMenu:e,forceMount:r,...i}=n,o=nw(qh,e);return C(Kl,{present:r||tu(o.checked)||o.checked===!0,children:C(Xt.span,{...i,ref:t,"data-state":Jh(o.checked)})})});G_.displayName=qh;var X_=et((n,t)=>{const{__scopeMenu:e,...r}=n;return C(Xt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});X_.displayName="MenuSeparator";var K_=et((n,t)=>{const{__scopeMenu:e,...r}=n,i=Jl(e);return C(LI,{...i,...r,ref:t})});K_.displayName="MenuArrow";var[KD,q_]=vi("MenuSub"),Zs="MenuSubTrigger",J_=et((n,t)=>{const e=Lo(Zs,n.__scopeMenu),r=Js(Zs,n.__scopeMenu),i=q_(Zs,n.__scopeMenu),o=Gh(Zs,n.__scopeMenu),s=X(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,u={__scopeMenu:n.__scopeMenu},c=rt(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return J(()=>c,[c]),J(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),C(Wh,{asChild:!0,...u,children:C(H_,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":e.open,"aria-controls":i.contentId,"data-state":ty(e.open),...n,ref:vl(t,i.onTriggerChange),onClick:d=>{var h;(h=n.onClick)==null||h.call(n,d),n.disabled||d.defaultPrevented||(d.currentTarget.focus(),e.open||e.onOpenChange(!0))},onPointerMove:dt(n.onPointerMove,Qs(d=>{o.onItemEnter(d),d.defaultPrevented||n.disabled||e.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{e.onOpenChange(!0),c()},100))})),onPointerLeave:dt(n.onPointerLeave,Qs(d=>{var p,f;c();const h=(p=e.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(f=e.content)==null?void 0:f.dataset.side,g=m==="right",E=g?-5:5,A=h[g?"left":"right"],v=h[g?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+E,y:d.clientY},{x:A,y:h.top},{x:v,y:h.top},{x:v,y:h.bottom},{x:A,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:dt(n.onKeyDown,d=>{var p;const h=o.searchRef.current!=="";n.disabled||h&&d.key===" "||zI[r.dir].includes(d.key)&&(e.onOpenChange(!0),(p=e.content)==null||p.focus(),d.preventDefault())})})})});J_.displayName=Zs;var Z_="MenuSubContent",Q_=et((n,t)=>{const e=P_(an,n.__scopeMenu),{forceMount:r=e.forceMount,...i}=n,o=Lo(an,n.__scopeMenu),s=Js(an,n.__scopeMenu),a=q_(Z_,n.__scopeMenu),l=X(null),u=Ft(t,l);return C(qs.Provider,{scope:n.__scopeMenu,children:C(Kl,{present:r||o.open,children:C(qs.Slot,{scope:n.__scopeMenu,children:C(Xh,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:dt(n.onFocusOutside,c=>{c.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:dt(n.onEscapeKeyDown,c=>{s.onClose(),c.preventDefault()}),onKeyDown:dt(n.onKeyDown,c=>{var p;const d=c.currentTarget.contains(c.target),h=VI[s.dir].includes(c.key);d&&h&&(o.onOpenChange(!1),(p=a.trigger)==null||p.focus(),c.preventDefault())})})})})})});function ty(n){return n?"open":"closed"}function tu(n){return n==="indeterminate"}function Jh(n){return tu(n)?"indeterminate":n?"checked":"unchecked"}function Qs(n){return t=>t.pointerType==="mouse"?n(t):void 0}Q_.displayName=Z_;var rw=M_,iw=Wh,ow=B_,sw=Kh,aw=F_,lw=Ql,uw=$_,cw=Y_,dw=V_,hw=G_,pw=X_,fw=K_,mw=J_,gw=Q_,eu="DropdownMenu",[Ew,qD]=mi(eu,[L_]),xe=L_(),[Aw,ey]=Ew(eu),ny=n=>{const{__scopeDropdownMenu:t,children:e,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=n,l=xe(t),u=X(null),[c,d]=yh({prop:i,defaultProp:o!=null?o:!1,onChange:s,caller:eu});return C(Aw,{scope:t,triggerId:_l(),triggerRef:u,contentId:_l(),open:c,onOpenChange:d,onOpenToggle:rt(()=>d(h=>!h),[d]),modal:a,children:C(rw,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:e})})};ny.displayName=eu;var ry="DropdownMenuTrigger",iy=et((n,t)=>{const{__scopeDropdownMenu:e,disabled:r=!1,...i}=n,o=ey(ry,e),s=xe(e);return C(iw,{asChild:!0,...s,children:C(Xt.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:vl(t,o.triggerRef),onPointerDown:dt(n.onPointerDown,a=>{r||a.button!==0||a.ctrlKey!==!1||(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:dt(n.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});iy.displayName=ry;var oy="DropdownMenuContent",sy=et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=ey(oy,e),o=xe(e),s=X(!1);return C(ow,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:dt(n.onCloseAutoFocus,a=>{var l;s.current||((l=i.triggerRef.current)==null||l.focus()),s.current=!1,a.preventDefault()}),onInteractOutside:dt(n.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;i.modal&&!c||(s.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});sy.displayName=oy,et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(sw,{...i,...r,ref:t})}).displayName="DropdownMenuGroup",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(aw,{...i,...r,ref:t})}).displayName="DropdownMenuLabel";var ay=et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(lw,{...i,...r,ref:t})});ay.displayName="DropdownMenuItem",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(uw,{...i,...r,ref:t})}).displayName="DropdownMenuCheckboxItem",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(cw,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(dw,{...i,...r,ref:t})}).displayName="DropdownMenuRadioItem",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(hw,{...i,...r,ref:t})}).displayName="DropdownMenuItemIndicator",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(pw,{...i,...r,ref:t})}).displayName="DropdownMenuSeparator",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(fw,{...i,...r,ref:t})}).displayName="DropdownMenuArrow",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(mw,{...i,...r,ref:t})}).displayName="DropdownMenuSubTrigger",et((n,t)=>{const{__scopeDropdownMenu:e,...r}=n,i=xe(e);return C(gw,{...i,...r,ref:t,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="DropdownMenuSubContent";var vw=ny,_w=iy,yw=sy,Tw=ay;function ta(n){const{popoverComponent:t,popoverProps:e,children:r,type:i="popover",...o}=n,[s,a]=nt(void 0),[l,u]=nt(!1);let c,d,h;return i==="menu"?(c=vw,d=_w,h=yw):(c=Xb,d=Kb,h=qb),C(wO.Provider,{value:{closePopover:()=>u(!1)},children:C(c,{modal:!0,open:l,onOpenChange:u,children:[C(d,{asChild:!0,children:C("button",{...o,ref:p=>(f=>{var g;const m=(g=f==null?void 0:f.closest("[t-menu-boundary]"))!=null?g:void 0;a(m)})(p),children:r})}),C(h,{hideWhenDetached:!0,collisionBoundary:s,style:{zIndex:1e3},onWheel:p=>p.stopPropagation(),onTouchMove:p=>p.stopPropagation(),children:C(t,{...e})})]})})}function _i(n){return C(Tw,{...n})}function Ow(n){return Ff(n)}function xo(n){var t;return(t=n.photoUrl)!=null?t:function(e,r){const i=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
125
125
  <rect x="0" y="0" width="100" height="100" fill="${Ff(e)}"/>
126
126
  <text x="50%" y="54%" dominant-baseline="middle" font-size="34" font-family="San Francisco, Segoe UI, Helvetica Neue, Arial, Helvetica, sans-serif" fill="#fff" text-anchor="middle">${r}</text>
127
- </svg>`.replace(/\s+/g," ");return"data:image/svg+xml;base64,"+mO(i)}(n.id,AO(n.name))}function nu(n){return n<1024?n+" B":n<1048576?Math.floor(n/1024)+" KB":n<1073741824?Math.floor(n/1048576)+" MB":n<1099511627776?Math.floor(n/1073741824)+" GB":Math.floor(n/1099511627776)+" TB"}function ly({latitude:n,longitude:t}){const e=n+","+t;return{imageUrl:`https://maps.googleapis.com/maps/api/staticmap?center=${e}&zoom=15&size=300x200&scale=2&maptype=roadmap&markers=${e}&key=${dO}`,linkUrl:`https://maps.google.com/maps?q=${e}&z=15`}}function Sw(n,t){const[e,r]=et({long:"",short:""});return he(()=>{let i,o=!0;const s=()=>{const l=Date.now(),u=function(c,d,h){const p=c-d;let f,m,g;const E=new Date(d),A={month:"short",day:"numeric"};if(p<cy)return{changeTimeout:5e3,short:h.JUST_NOW,long:h.JUST_NOW};if(p<dy)f=cy,m="MINUTES",g=h.MINUTES;else if(p<hy)f=dy,m="HOURS",g=h.HOURS;else{if(!(p<bw)){if(E.getFullYear()===new Date(c).getFullYear()){const _=E.toLocaleDateString(h.locale,A);return{changeTimeout:void 0,short:_,long:_}}{const _=E.toLocaleDateString(h.locale,{...A,year:"numeric"});return{changeTimeout:void 0,short:_,long:_}}}f=hy,m="DAYS",g=h.DAYS}const v=Math.floor(p/f);return{changeTimeout:f,short:v+g,long:Iw(v,m.toLowerCase(),h.locale)}}(l,n>l?l-2e3:n,t);return r(u),u},a=()=>{const l=s();o&&l.changeTimeout&&(i=window.setTimeout(a,l.changeTimeout))};return s(),i=window.setTimeout(a,100),()=>{o=!1,clearTimeout(i)}},[t,n]),e}function uy(n){n=Math.floor(n);const t=Math.floor(n/3600);n%=3600;const e=Math.floor(n/60);n%=60;const r=o=>o.toString().padStart(2,"0");let i=`${r(e)}:${r(n)}`;return t>0&&(i=`${r(t)}:${i}`),i}const Nw=864e5;function Cw(n,t){const e=Date.now(),r=(i=n,o=e,Math.floor((o-i)/Nw));var i,o;if(r<0||r===0)return t.TODAY;if(r===1)return t.YESTERDAY;const s={weekday:"long"},a=new Date(n);if(r<7)return a.toLocaleDateString(t.locale,s);const l=new Date(e);return function(c,d){return Math.floor((d-c)/31536e6)}(l.setFullYear(l.getFullYear()-1),n)===0?a.toLocaleDateString(t.locale,{...s,month:"long",day:"numeric"}):a.toLocaleDateString(t.locale,{...s,year:"numeric",month:"long",day:"numeric"})}const cy=6e4,dy=36e5,hy=864e5,bw=6048e5;function Iw(n,t,e){return new Intl.RelativeTimeFormat(e).format(-n,t)}function z(n,...t){const e=zT.bind(Ot.createElement)(n,...t);return Array.isArray(e)?Ot.createElement(Ot.Fragment,{},...e):e}function ww(n){const{common:t}=n;return t.conversation.subject?z`
127
+ </svg>`.replace(/\s+/g," ");return"data:image/svg+xml;base64,"+mO(i)}(n.id,AO(n.name))}function nu(n){return n<1024?n+" B":n<1048576?Math.floor(n/1024)+" KB":n<1073741824?Math.floor(n/1048576)+" MB":n<1099511627776?Math.floor(n/1073741824)+" GB":Math.floor(n/1099511627776)+" TB"}function ly({latitude:n,longitude:t}){const e=n+","+t;return{imageUrl:`https://maps.googleapis.com/maps/api/staticmap?center=${e}&zoom=15&size=300x200&scale=2&maptype=roadmap&markers=${e}&key=${dO}`,linkUrl:`https://maps.google.com/maps?q=${e}&z=15`}}function Sw(n,t){const[e,r]=nt({long:"",short:""});return se(()=>{let i,o=!0;const s=()=>{const l=Date.now(),u=function(c,d,h){const p=c-d;let f,m,g;const E=new Date(d),A={month:"short",day:"numeric"};if(p<cy)return{changeTimeout:5e3,short:h.JUST_NOW,long:h.JUST_NOW};if(p<dy)f=cy,m="MINUTES",g=h.MINUTES;else if(p<hy)f=dy,m="HOURS",g=h.HOURS;else{if(!(p<bw)){if(E.getFullYear()===new Date(c).getFullYear()){const _=E.toLocaleDateString(h.locale,A);return{changeTimeout:void 0,short:_,long:_}}{const _=E.toLocaleDateString(h.locale,{...A,year:"numeric"});return{changeTimeout:void 0,short:_,long:_}}}f=hy,m="DAYS",g=h.DAYS}const v=Math.floor(p/f);return{changeTimeout:f,short:v+g,long:Iw(v,m.toLowerCase(),h.locale)}}(l,n>l?l-2e3:n,t);return r(u),u},a=()=>{const l=s();o&&l.changeTimeout&&(i=window.setTimeout(a,l.changeTimeout))};return s(),i=window.setTimeout(a,100),()=>{o=!1,clearTimeout(i)}},[t,n]),e}function uy(n){n=Math.floor(n);const t=Math.floor(n/3600);n%=3600;const e=Math.floor(n/60);n%=60;const r=o=>o.toString().padStart(2,"0");let i=`${r(e)}:${r(n)}`;return t>0&&(i=`${r(t)}:${i}`),i}const Nw=864e5;function Cw(n,t){const e=Date.now(),r=(i=n,o=e,Math.floor((o-i)/Nw));var i,o;if(r<0||r===0)return t.TODAY;if(r===1)return t.YESTERDAY;const s={weekday:"long"},a=new Date(n);if(r<7)return a.toLocaleDateString(t.locale,s);const l=new Date(e);return function(c,d){return Math.floor((d-c)/31536e6)}(l.setFullYear(l.getFullYear()-1),n)===0?a.toLocaleDateString(t.locale,{...s,month:"long",day:"numeric"}):a.toLocaleDateString(t.locale,{...s,year:"numeric",month:"long",day:"numeric"})}const cy=6e4,dy=36e5,hy=864e5,bw=6048e5;function Iw(n,t,e){return new Intl.RelativeTimeFormat(e).format(-n,t)}function z(n,...t){const e=zT.bind(Ot.createElement)(n,...t);return Array.isArray(e)?Ot.createElement(Ot.Fragment,{},...e):e}function ww(n){const{common:t}=n;return t.conversation.subject?z`
128
128
  <div className="t-title">${t.conversation.subject}</div>
129
129
  <div className="t-subtitle">
130
130
  <${py} ...${n} />
@@ -859,10 +859,10 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
859
859
  photoUrl=${t.photoUrl}
860
860
  common=${n}
861
861
  />`:e.length===0?null:e.length===1?z`<${o}
862
- photoUrl=${Lo(r)}
862
+ photoUrl=${xo(r)}
863
863
  common=${n}
864
864
  />`:e.length===2?z`<${o}
865
- photoUrl=${Lo(e[0].user.id===r.id?e[1].user:e[0].user)}
865
+ photoUrl=${xo(e[0].user.id===r.id?e[1].user:e[0].user)}
866
866
  common=${n}
867
867
  />`:z`
868
868
  <${s} participants=${e} common=${n} />
@@ -922,11 +922,11 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
922
922
  <div className="t-theme-group-chat-image">
923
923
  <div
924
924
  className="t-mini-avatar"
925
- style=${{backgroundImage:`url("${Lo(n[0].user)}")`}}
925
+ style=${{backgroundImage:`url("${xo(n[0].user)}")`}}
926
926
  ></div>
927
927
  <div
928
928
  className="t-mini-avatar"
929
- style=${{backgroundImage:`url("${Lo(n[1].user)}")`}}
929
+ style=${{backgroundImage:`url("${xo(n[1].user)}")`}}
930
930
  ></div>
931
931
  ${n.length>2&&z`<svg
932
932
  className="t-counter"
@@ -1008,7 +1008,7 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
1008
1008
  >
1009
1009
  <div className="t-message-row">
1010
1010
  ${g&&z`<${c}
1011
- photoUrl=${Lo(g)}
1011
+ photoUrl=${xo(g)}
1012
1012
  common=${i}
1013
1013
  />`}
1014
1014
 
@@ -1205,7 +1205,7 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
1205
1205
  </div>
1206
1206
  `},MessageListFooter:function({common:n}){const{typing:t,theme:e}=n,{Avatar:r}=e,{users:i,many:o}=t;if(!o&&i.length===0)return null;const s=o?z`<div className="t-theme-avatar">5+</div>`:i.slice(0,2).map(a=>z`<${r}
1207
1207
  key=${a.id}
1208
- photoUrl=${Lo(a)}
1208
+ photoUrl=${xo(a)}
1209
1209
  common=${n}
1210
1210
  />`);return z`
1211
1211
  <div
@@ -1298,27 +1298,27 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
1298
1298
  className="t-theme-voice-block"
1299
1299
  src=${n.url}
1300
1300
  filename=${n.filename}
1301
- />`}},Symbol.toStringTag,{value:"Module"})),xw=nn(null),Qh={didCatch:!1,error:null};class Ay extends en{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Qh}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var e,r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];(e=(r=this.props).onReset)===null||e===void 0||e.call(r,{args:o,reason:"imperative-api"}),this.setState(Qh)}}componentDidCatch(t,e){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,t,e)}componentDidUpdate(t,e){const{didCatch:r}=this.state,{resetKeys:i}=this.props;var o,s;r&&e.error!==null&&function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return a.length!==l.length||a.some((u,c)=>!Object.is(u,l[c]))}(t.resetKeys,i)&&((o=(s=this.props).onReset)===null||o===void 0||o.call(s,{next:i,prev:t.resetKeys,reason:"keys"}),this.setState(Qh))}render(){const{children:t,fallbackRender:e,FallbackComponent:r,fallback:i}=this.props,{didCatch:o,error:s}=this.state;let a=t;if(o){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof e=="function")a=e(l);else if(r)a=pt(r,l);else{if(i===void 0)throw s;a=i}}return pt(xw.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function Yn(n,t=!1){return function(e,r=!1){return e.map(i=>{if(typeof i=="string")return i;switch(i.type){case"bold":return"*"+Yn(i.children)+"*";case"italic":return"_"+Yn(i.children)+"_";case"strikethrough":return"~"+Yn(i.children)+"~";case"blockquote":return Yn(i.children).split(`
1301
+ />`}},Symbol.toStringTag,{value:"Module"})),xw=nn(null),Qh={didCatch:!1,error:null};class Ay extends en{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Qh}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var e,r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];(e=(r=this.props).onReset)===null||e===void 0||e.call(r,{args:o,reason:"imperative-api"}),this.setState(Qh)}}componentDidCatch(t,e){var r,i;(r=(i=this.props).onError)===null||r===void 0||r.call(i,t,e)}componentDidUpdate(t,e){const{didCatch:r}=this.state,{resetKeys:i}=this.props;var o,s;r&&e.error!==null&&function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return a.length!==l.length||a.some((u,c)=>!Object.is(u,l[c]))}(t.resetKeys,i)&&((o=(s=this.props).onReset)===null||o===void 0||o.call(s,{next:i,prev:t.resetKeys,reason:"keys"}),this.setState(Qh))}render(){const{children:t,fallbackRender:e,FallbackComponent:r,fallback:i}=this.props,{didCatch:o,error:s}=this.state;let a=t;if(o){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof e=="function")a=e(l);else if(r)a=ht(r,l);else{if(i===void 0)throw s;a=i}}return ht(xw.Provider,{value:{didCatch:o,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function Yn(n,t=!1){return function(e,r=!1){return e.map(i=>{if(typeof i=="string")return i;switch(i.type){case"bold":return"*"+Yn(i.children)+"*";case"italic":return"_"+Yn(i.children)+"_";case"strikethrough":return"~"+Yn(i.children)+"~";case"blockquote":return Yn(i.children).split(`
1302
1302
  `).map(o=>"> "+o).join(`
1303
1303
  `)+`
1304
1304
  `;case"autolink":case"autoLink":case"suppressed":case"emoji":return i.text;case"codeblock":case"codeBlock":return"```"+i.language+`
1305
1305
  `+i.text+"```";case"codespan":case"codeSpan":return"```"+i.text+"```";case"mention":return r?`<!!mention:${i.id}|${i.text}>`:`@${i.text}`;case"customemoji":case"customEmoji":return r?`<!!customemoji:${i.text}>`:i.text;case"link":return`<${i.url}|${Yn(i.children)}>`;case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return function(o){const s=new URLSearchParams(o.params).toString(),a=s?o.action+"?"+s:o.action;return`<${o.type}:${a}|${Yn(o.children)}>`}(i);case"bulletlist":case"bulletList":return`
1306
1306
  `+Yn(i.children);case"bulletpoint":case"bulletPoint":return"- "+Yn(i.children)+`
1307
- `}}).join("")}(n,t).trim()}class vy{constructor(t,e,r,i,o){this.send=e,this.attachFile=r,this.shareLocation=i,this.toggleEmojiPicker=o,this.isEmpty=t.isEmpty,this.isTyping=t.isTyping,this.atTextLimit=t.atTextLimit,this.characterCount=t.characterCount,this.showEmojiPicker=t.showEmojiPicker}}const _y=(n,t)=>e=>{var l;const r=(l=e.nodeBefore)==null?void 0:l.text;if(!r)return;const i=r.match(n);if(!i)return;const o=i[2],s=e.pos-o.length,a=e.pos;if(!e.doc.rangeHasMark(s,a,t.marks.literal))return{range:{from:s,to:a},text:o}},Mw=/(^|\s)(:[^:\s]+:?)$/,Pw=/(^|\s)(@[^@]*)$/;class yy{constructor(t,e,r){this.state$=t,this.device$=e,this.userPermissions$=r,this.currentDoc=ul.EMPTY,this.maxLength=1e3,this.markAsTyping=function(i,o){let s=!1;return(...a)=>{if(!s)return s=!0,setTimeout(()=>{s=!1},o),i(...a)}}(()=>{var i;(i=this.controller)==null||i.markAsTyping()},5e3),this._suggesterKeydownHandlers={emoji:void 0,mention:void 0},this.toggleEmojiPicker=i=>{const o=this.state$.showEmojiPicker;i!=null||(i=!o.peek()),o.set(i),i===!1&&this.focus()},this.spellcheck$=Pt(),this.placeholder$=Pt()}setEditorView(t){this.editorView=t}emojiSuggesterPlugin(){if(this.device$.peek().supportsEmojiPicker)return Y0({debug:!1,matcher:_y(Mw,Jt),onEnter:t=>this.suggestEmoji(t.text,t.range),onChange:t=>this.suggestEmoji(t.text,t.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:t})=>{var e,r,i;return(i=(r=(e=this._suggesterKeydownHandlers).emoji)==null?void 0:r.call(e,t.key))!=null?i:!1}})}mentionsPlugin(){const t=this.userPermissions$.peek();if(St.defined(t),t.canMention)return Y0({debug:!1,matcher:_y(Pw,Jt),onEnter:e=>this.suggestMention(e.text,e.range),onChange:e=>this.suggestMention(e.text,e.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:e})=>{var r,i,o;return(o=(i=(r=this._suggesterKeydownHandlers).mention)==null?void 0:i.call(r,e.key))!=null?o:!1}})}closeSuggester(){St.defined(this._suggestionRange),function(t,e){const{from:r,to:i}=e,o=t.state.tr.addMark(r,i,Jt.marks.literal.create());t.dispatch(o)}(this.editorView,this._suggestionRange)}listenKeydown(t,e){this._suggesterKeydownHandlers[t]=e}onExitSuggester(){this._suggestionRange=void 0,this.state$.suggestEmojiQuery.set(void 0),this.state$.suggestMentionQuery.set(void 0)}suggestEmoji(t,e){t.length<2||(this._suggestionRange=e,this.state$.suggestEmojiQuery.set(t))}suggestMention(t,e){t.length<1||(this._suggestionRange=e,this.state$.suggestMentionQuery.set(t))}onPasteImage(t){St.defined(this.uploadFile),this.uploadFile(t)}onChange(t){this.currentDoc=t;const e=t.asText(),r=t.size>this.maxLength&&e.length>this.maxLength;t.hasContent&&this.markAsTyping(),this.state$.assign({isTyping:t.hasContent,atTextLimit:r,isEmpty:!t.hasContent||e.trim().length===0,characterCount:t.size===0?0:t.size-2})}setMaxLength(t){this.maxLength=t}focus(){var t;(t=this.editorView)==null||t.dom.focus()}setText(t){this.editorView&&function(e,r){const i=e.state.doc.content.size,o=r.split(/(<!!(?:mention|customemoji):.*?>)/g).filter(a=>a||a.length).map(a=>{const[l,u,c]=a.match(/<!!mention:(.*)\|(.*)>/)||[null];if(l&&u&&c)return V0(u,c);const[d,h]=a.match(/<!!customemoji:(.*?)>/)||[null];return d&&h?z0(h):Jt.text(a)}),s=e.state.tr.replaceWith(0,i,o);e.dispatch(s)}(this.editorView,t)}typeText(t){this.editorView&&function(e,r,i="replace"){const o=e.state.doc.content.size,s=i=="insert"?e.state.tr.insertText(r):e.state.tr.insertText(r,0,o);e.dispatch(s)}(this.editorView,t,"insert")}getText(){return this.currentDoc.asText().trim()}clearText(){this.editorView&&function(t){const e=t.state.doc.content.size,r=t.state.tr.insertText("",0,e);t.dispatch(r)}(this.editorView)}selectEmoji(t){St.defined(this.editorView),function(e,r,i){const o=z0(r);let s;if(i){const{from:a,to:l}=i;s=e.state.tr.replaceRangeWith(a,l,o)}else s=e.state.tr.replaceSelectionWith(o,!1);e.dispatch(s)}(this.editorView,t,this._suggestionRange),this.focus()}selectMention(t){St.defined(this.editorView),function(e,r,i){const o=V0(r.id,r.name);let s=e.state.tr;if(i){const{from:a,to:l}=i;s=s.replaceRangeWith(a,l,o)}else s=s.replaceSelectionWith(o,!1);s=s.insertText(" "),e.dispatch(s)}(this.editorView,t,this._suggestionRange),this.focus()}}function Ty(n){const t=cn(),e=bt(),r=Qi(),i=Et(e.referencedMessage$),o=Et(e.state$.userPermissions),s=Qo(),{sendMessage:a}=bO(),l=Et(s.state$);let u;return u=n.editMessageId===void 0?new vy(l,a,n.attachFile,n.shareLocation,s.toggleEmojiPicker):new vy(l,n.onEditMessage,()=>{},()=>{},()=>{}),C(Jf.Provider,{value:{onClose:()=>s.toggleEmojiPicker(!1),onEmojiSelected:c=>s.selectEmoji(c)},children:C(t.MessageField,{common:r,referencedMessage:i,permissions:o,editor:u,editMessageId:n.editMessageId})})}function Bw({message:n}){const t=bt(),e=$i(),r=Et(t.state$.editingMessageId),i=lt(()=>Yn(n.content[0].children),[n]),o=Er({isEmpty:i.length===0,isTyping:!1,atTextLimit:!1,characterCount:i.length,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0}),s=lt(()=>new yy(o,t.device$,t.state$.userPermissions),[o,t]),a=rt(async()=>{const l=s.state$;if(l.isEmpty.peek()||l.atTextLimit.peek())return;const u=s.getText();u&&await e.editMessage(n.id,{text:u}),t.state$.editingMessageId.set(null)},[t,e,s,n.id]);return J(()=>{s.onEnter=a},[s,a]),J(()=>{s.focus(),s.setText(Yn(n.content[0].children,!0))},[s,n]),C(Xf.Provider,{value:s,children:C(Ty,{editMessageId:r,onEditMessage:a})})}function Fw(){const n=cn(),t=Qi();return C(n.MessageListFooter,{common:t})}function Uw(n){const t=cn(),e=Qi();return C(t.MessageDivider,{common:e,...n})}function Hw({message:n}){const t=cn(),e=bt(),r=Qi(),[i,o]=et("sent");return Zi(s=>{if(n.id.startsWith("ephemeral-"))return o("sending");const a=e.state$.currentConversation.everyoneReadUntil.get();return a!==void 0?n.createdAt<=a?o("everyoneRead"):o("sent"):void 0}),C(t.Message,{common:r,message:n,messageStatus:i,permissions:e.messagePermissions$(n).get()})}function $w({extConversationId:n}){const t=ts(),e=bt(),r=$i(),i=q(!0),o=q(null);he(()=>{i.current=o.current.scrollTop>-30}),J(()=>{i.current&&(o.current.scrollTop=0)}),J(()=>{const l=new IntersectionObserver(u=>e.state$.visibility.isInView.set(u[0].isIntersecting),{threshold:.9});return l.observe(o.current),()=>l.disconnect()},[e]),J(()=>{const l=()=>e.state$.visibility.tabFocused.set(!document.hidden);return document.addEventListener("visibilitychange",l),()=>document.removeEventListener("visibilitychange",l)},[e]),Zi(l=>{if(!o.current)return;const u=e.state$.visibility.tabFocused.get(),c=e.state$.visibility.isInView.get(),d=function(p){if(p.checkVisibility)return p.checkVisibility({contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0,checkOpacity:!0,checkVisibilityCSS:!0});{const f=window.getComputedStyle(p),m=f.visibility,g=f.opacity;return!(p.getClientRects().length===0||m==="hidden"||g==="0")}}(o.current),h=e.state$.currentConversation.get();return h&&h.isUnread&&u&&c&&d?t.conversation(h.id).markAsRead():void 0});const s=rt(l=>{const u=l.currentTarget;u.scrollHeight-u.clientHeight+u.scrollTop<90&&e.messageSubscription&&e.messageSubscription.loadMore(10)},[e.messageSubscription]),a=Et(e.state$.typing.child(n));return C("div",{className:"t-message-list",ref:o,"t-menu-boundary":"",onScroll:s,children:[a&&C(Fw,{}),C(Ac,{each:e.chatItems$,children:l=>C("div",{className:"t-message-group",children:C(Ac,{each:l,item:jw,itemProps:{controller:r,extConversationId:n}})})})]})}function jw({item$:n}){const t=bt(),e=Et(n),r=Et(t.state$.editingMessageId);return e instanceof _c?C(Uw,{timestamp:e.timestamp,isReadMarker:e.isReadMarker,isDayMarker:e.isDayMarker}):r===e.id?C(Bw,{message:e}):C(Hw,{message:e})}const Yw=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function ru({appId:n,chatboxState:t}){const e=n.charAt(0)==="t"||Yw.has(n);return J(()=>{switch(t.type){case"auth-failed":Jn.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":Jn.error(`User \`${t.userId}\` not found. Please verify that you synchronized this user's data with TalkJS, either using the JS SDK or through the REST API.`);break;case"unexpected-error":Jn.error(t.error);break;case"wrong-app-id":Jn.error(`Could not find given appId: "${t.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:St.never(t)}},[t]),C("div",{className:"t-panel t-error-panel",children:[C("span",{className:"t-heading",children:"Something went wrong."}),C("p",{children:"Please reload the page and try again."}),C("p",e?{style:{fontStyle:"italic"},children:["Developer note: check your browser's developer tools console for messages that may help solve the problem.",C("br",{}),C("small",{children:"This message only shows up in test mode."})]}:{children:"If things keep not working, do not hesitate to get in touch with us."})]})}function zw(){return C("div",{className:"t-panel t-error-panel",children:C("span",{className:"t-heading",style:{fontStyle:"italic"},children:Et(bt().t$).CHAT_NOT_FOUND})})}function Oy(){return C("div",{className:"t-panel t-loading-panel",children:C(Hd,{})})}function Sy(){const n=Et(bt().t$);return C("div",{className:"t-panel t-error-panel",children:[C("span",{className:"t-heading",style:{fontStyle:"italic"},children:n.AUTH_EXPIRED_OVERLAY_TITLE}),C("p",{children:n.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}const Vw=()=>!0;async function tp(n,t,{initialDelay:e,maxDelay:r,log:i,shouldRetry:o=Vw}){return t().catch(async s=>{if(i&&i(`[TalkJS] Retries left: ${n}. Error: ${JSON.stringify(s)}.`),n===0||!await o(s))throw s;const a=1e3*e*1.2,l=r?Math.min(1e3*r,a):a,u=l*(1-(c=.05)+2*Math.random()*c);var c;return function(d){return d<=0?Promise.resolve():new Promise(h=>setTimeout(h,d))}(u).then(()=>tp(n-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:o}))})}function ea(){const n={},t=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=t,n}function Ww(n,t,e){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=Re(Kf);return rt(async()=>{function o(c){c==="denied"&&i({type:n})}if(!r||!await async function(c){if(!("permissions"in navigator))return!1;const d=c;try{return(await navigator.permissions.query({name:d})).state==="prompt"}catch(h){return!1}}(n))return t(c=>{o(c)});const s=ea(),a=ea(),l={type:n,showPrompt:async()=>(a.resolve({cancelled:!1}),await s.promise),cancel:()=>{a.resolve({cancelled:!0})}};try{r(l)}catch(c){Jn.error("Your beforeBrowserPermissionPrompt callback threw an error: ",c),a.resolve({cancelled:!0})}const{cancelled:u}=await a.promise;return u?void 0:t(c=>{s.resolve(c),o(c)})},[r,i,n,t,...e])}function Gw({onClose:n}){const t=bt(),e=$i(),r=ts(),[i,o]=et(null),s=rt(async l=>{try{if(l||(l=(await new Promise(m=>{const g=document.createElement("input");g.type="file",g.multiple=!1,g.addEventListener("change",()=>{m([...g.files])}),g.addEventListener("cancel",()=>{m([])}),g.click()}))[0]),!l)return;const{uploadPromise:u,upload:c}=await async function(m,g){const E=m.name;if(function(O){return/\.(mp4|ts|mov|webm|ogv)$/i.test(O)}(m.name)){const O=await np("video",m,N=>({width:N.videoWidth,height:N.videoHeight,duration:N.duration,filename:E})),T=g.uploadVideo(m,O),S=function(N){switch(N.name.split(".").pop()){case"ts":return"video/MP2T";case"mov":return"video/quicktime";case"webm":return"video/webm";case"ogv":return"video/ogg";default:return"video/mp4"}}(m);return{uploadPromise:T,upload:{type:"video",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m],{type:S}))}}}if(function(O){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(O)}(m.name)){const O=await np("audio",m,T=>({duration:T.duration,filename:E}));return{uploadPromise:g.uploadAudio(m,O),upload:{type:"audio",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}if(function(O){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(O)}(m.name)){const O=await np("img",m,T=>({width:T.naturalWidth,height:T.naturalHeight,filename:E}));return{uploadPromise:g.uploadImage(m,O),upload:{type:"image",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}const A={filename:E},v=g.uploadFile(m,A),_=URL.createObjectURL(new Blob([m]));return{uploadPromise:v,upload:{type:"file",file:m,metadata:A,temporaryBlobUrl:_}}}(l,r),d=c.file.size+","+c.file.name;t.state$.localFileBlobUrls.child(t.state$.extCurrentConversationId.peek()).child(d).set({url:c.temporaryBlobUrl,fetching:!1}),t.latestFileUpload=c;const h=ea(),p={upload:c,closePreview:h.resolve,uploaded:!1};let f;o(p);try{f=await Ny(u,h.promise),o({...p,uploaded:!0})}catch(m){if(m===ep)return;o(g=>({...g,error:m.toString()}))}if(await h.promise==="cancel")return;St.defined(f),e.sendFileMessage({fileToken:f})}finally{n(),o(null)}},[e,r,o,t,n]),a=Ww("geolocation",async l=>{try{const u=ea(),c={upload:{type:"location",location:void 0},uploaded:!1,closePreview:u.resolve};o(c);const{permissionResult:d,location:h}=await Ny(new Promise(p=>{navigator.geolocation.getCurrentPosition(f=>{const m={latitude:f.coords.latitude,longitude:f.coords.longitude};p({permissionResult:"granted",location:m})},f=>{f.code===1?p({permissionResult:"denied"}):p({permissionResult:"granted"})})}),u.promise);if(l(d),!h||(o({...c,upload:{type:"location",location:h},uploaded:!0}),await u.promise==="cancel"))return;e.sendLocationMessage({location:h})}catch(u){if(u===ep)return;throw u}finally{n(),o(null)}},[e,o,n]);return{attachFile:s,shareLocation:a,uploadState:i}}const ep=Symbol("cancelled");function Ny(n,t){return Promise.race([n,t.then(()=>Promise.reject(ep))])}async function np(n,t,e){const r=document.createElement(n);try{return r.src=URL.createObjectURL(t),await new Promise((i,o)=>{const s=n==="img"?"load":"loadedmetadata";r.addEventListener(s,()=>{try{i(e(r))}catch(a){o(a)}},{once:!0})})}finally{URL.revokeObjectURL(r.src)}}function Cy({children:n,className:t,...e}){return C("div",{className:"t-attach-overlay "+t,...e,children:n})}function Xw({uploadState:n}){const t=n.error,e=n.uploaded;dl(()=>n.closePreview("cancel"),".t-upload-preview");const r=q(null);J(()=>{e&&r.current.focus()},[e]);const i=Et(bt().t$);return C(Cy,{className:"t-upload-preview",children:C("div",{className:"t-preview",children:[C(Kw,{upload:n.upload,uploaded:e}),t!==void 0&&C("div",{className:"t-error-row",children:t}),C("div",{className:"t-send-row",children:[C("button",{className:"t-cancel",onClick:()=>n.closePreview("cancel"),children:i.CANCEL}),t===void 0&&e&&C("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>n.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function Kw({upload:n,uploaded:t}){const e=Et(bt().t$);return n.type!=="location"?C(Vt,{children:[C(Jw,{upload:n}),C(Zw,{upload:n,uploaded:t,t:e})]}):t?C(qw,{location:n.location}):C("div",{className:"t-loading",children:C(Hd,{})})}function qw({location:n}){const{imageUrl:t,linkUrl:e}=ly(n);return C("a",{href:e,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(t)}) center center / cover no-repeat`}})}const Jw=Ot.memo(function({upload:n}){let t=null;const e=n.file;if(n.type==="video"){const r=/[.]ts/i.test(e.name)?"mpegts":"native";t=C("div",{className:"video-container",children:C(Qw,{src:n.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else n.type==="image"?t=C("div",{className:"t-img-container",children:C("img",{src:URL.createObjectURL(e)})}):n.type==="audio"&&(t=C(yc,{src:URL.createObjectURL(e),filename:e.name}));return t}),Zw=Ot.memo(function({uploaded:n,upload:t,t:e}){let r;r=n?t.metadata.filename:e.UPLOAD_IN_PROGRESS;let i="",o="";return t.type==="file"&&(i="is-file",n&&(o="file-block")),C("div",{className:`t-filename-row ${i}`,children:C("div",{className:o,children:r})})});function Qw(n){const{videoType:t,...e}=n;return C("video",{...e})}function tR(){const n=cn(),t=bt(),e=Qi(),r=Et(t.state$.isUserConnected),i=Et(t.state$.userPermissions);return C(n.ChatHeader,{common:e,isUserConnected:r,permissions:i})}function eR({appId:n,chatHeaderVisible:t,messageFieldVisible:e}){const r=Qo(),i=function(){const p=bt(),f=Er(()=>{const E=p.extUserId$.get(),A=p.errors$.get(),v=p.authTokenState$.get(),_=E&&p.currentUser$.get(),O=p.state$.currentConversation.get(),T=p.state$.extCurrentConversationId.get(),S=T&&p.state$.participants.child(T).get(),N=p.app$.get();return p.device$.get(),A.serverError?"server-error":A.wrongAppId?"wrong-app-id":v==="loading"||v==="idle"?"loading-token":v==="invalid"?"invalid-token":v==="expired"?"expired-token":v==="valid"?A.unknownUser?"unknown-user":A.unknownConversation?"loading-conv-failed":_&&O&&S&&N?"loaded":"loading-data":void St.unreachable()}),m=Er({type:"loading"});Zi(E=>{const A=f.get(),v=p.state$.extCurrentConversationId.peek(),_=p.extUserId$.peek(),O=p.appId$.peek();function T(S){m.set({type:"loading"});const N=setTimeout(()=>{m.set(S)},5e3);return()=>clearTimeout(N)}switch(A){case"invalid-token":m.set({type:"auth-failed"});break;case"expired-token":m.set({type:"expired-token"});break;case"wrong-app-id":m.set({type:"wrong-app-id",appId:O});break;case"server-error":m.set({type:"server-error"});break;case"loading-data":case"loading-token":m.set({type:"loading"});break;case"loaded":m.set({type:"loaded",conversationId:v,userId:_});break;case"loading-conv-failed":E.onCleanup=T({type:"inaccessible-conversation",userId:_,conversationId:v});break;case"unknown-user":E.onCleanup=T({type:"unknown-user",userId:_});break;default:St.never(A)}});const g=Er({type:"loading"});return Zi(E=>{if(m.type.get()==="loading"){g.set({type:"invisible-loading"});const A=setTimeout(()=>{g.set({type:"loading"})},1e3);E.onCleanup=()=>{clearTimeout(A)}}else g.set(m.get())}),Et(g)}(),{attachFile:o,shareLocation:s,uploadState:a}=Gw({onClose:()=>r.focus()});J(()=>{r.uploadFile=o},[r,o]);const[l,u]=et(!1),c=rt(p=>{o(p.dataTransfer.files[0]),p.preventDefault(),u(!1)},[o]),d=rt(p=>{p.preventDefault(),u(!0)},[]),h=rt(p=>{p.preventDefault(),u(!1)},[]);return i.type==="invisible-loading"?C(Vt,{}):i.type==="loading"?C(Oy,{}):i.type==="inaccessible-conversation"?C(zw,{}):i.type==="unknown-user"||i.type==="auth-failed"||i.type==="wrong-app-id"||i.type==="server-error"||i.type==="unexpected-error"?C(ru,{appId:n,chatboxState:i}):i.type=="expired-token"?C(Sy,{}):i.type==="loaded"?C("div",{className:"t-chatbox-content",onDragOver:d,onDragLeave:h,onDrop:c,children:[t&&C(tR,{}),C($w,{extConversationId:i.conversationId}),e&&C(Ty,{attachFile:o,shareLocation:s}),a&&C(Xw,{uploadState:a}),l&&C(Cy,{className:"t-drop-overlay",children:C(Pa,{type:"attach"})})]}):C(Vt,{})}function nR(n,t){return n.map(r=>function(i,o){if(i.type==="text")return function(s,a){const l=X0(a);return iu(s,l)}(i.children,o);if(i.type==="file"&&i.subtype==="video")return`🎥 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="image")return`📷 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="audio")return`🎧 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="voice"){const s=i.duration;return s===void 0?"🎙️":`🎙️ (${Math.floor(s/60)}:${Math.floor(s%60).toString().padStart(2,"0")})`}return i.type==="file"?(i.subtype,`📎 ${Oa(i.url)}`):i.type==="location"?"📍":""}(r,t)).join(`
1307
+ `}}).join("")}(n,t).trim()}class vy{constructor(t,e,r,i,o){this.send=e,this.attachFile=r,this.shareLocation=i,this.toggleEmojiPicker=o,this.isEmpty=t.isEmpty,this.isTyping=t.isTyping,this.atTextLimit=t.atTextLimit,this.characterCount=t.characterCount,this.showEmojiPicker=t.showEmojiPicker}}const _y=(n,t)=>e=>{var l;const r=(l=e.nodeBefore)==null?void 0:l.text;if(!r)return;const i=r.match(n);if(!i)return;const o=i[2],s=e.pos-o.length,a=e.pos;if(!e.doc.rangeHasMark(s,a,t.marks.literal))return{range:{from:s,to:a},text:o}},Mw=/(^|\s)(:[^:\s]+:?)$/,Pw=/(^|\s)(@[^@]*)$/;class yy{constructor(t,e,r){this.state$=t,this.device$=e,this.userPermissions$=r,this.currentDoc=ul.EMPTY,this.maxLength=1e3,this.markAsTyping=function(i,o){let s=!1;return(...a)=>{if(!s)return s=!0,setTimeout(()=>{s=!1},o),i(...a)}}(()=>{var i;(i=this.controller)==null||i.markAsTyping()},5e3),this._suggesterKeydownHandlers={emoji:void 0,mention:void 0},this.toggleEmojiPicker=i=>{const o=this.state$.showEmojiPicker;i!=null||(i=!o.peek()),o.set(i),i===!1&&this.focus()},this.spellcheck$=Pt(),this.placeholder$=Pt()}setEditorView(t){this.editorView=t}emojiSuggesterPlugin(){if(this.device$.peek().supportsEmojiPicker)return Y0({debug:!1,matcher:_y(Mw,Jt),onEnter:t=>this.suggestEmoji(t.text,t.range),onChange:t=>this.suggestEmoji(t.text,t.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:t})=>{var e,r,i;return(i=(r=(e=this._suggesterKeydownHandlers).emoji)==null?void 0:r.call(e,t.key))!=null?i:!1}})}mentionsPlugin(){const t=this.userPermissions$.peek();if(St.defined(t),t.canMention)return Y0({debug:!1,matcher:_y(Pw,Jt),onEnter:e=>this.suggestMention(e.text,e.range),onChange:e=>this.suggestMention(e.text,e.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:e})=>{var r,i,o;return(o=(i=(r=this._suggesterKeydownHandlers).mention)==null?void 0:i.call(r,e.key))!=null?o:!1}})}closeSuggester(){St.defined(this._suggestionRange),function(t,e){const{from:r,to:i}=e,o=t.state.tr.addMark(r,i,Jt.marks.literal.create());t.dispatch(o)}(this.editorView,this._suggestionRange)}listenKeydown(t,e){this._suggesterKeydownHandlers[t]=e}onExitSuggester(){this._suggestionRange=void 0,this.state$.suggestEmojiQuery.set(void 0),this.state$.suggestMentionQuery.set(void 0)}suggestEmoji(t,e){t.length<2||(this._suggestionRange=e,this.state$.suggestEmojiQuery.set(t))}suggestMention(t,e){t.length<1||(this._suggestionRange=e,this.state$.suggestMentionQuery.set(t))}onPasteImage(t){St.defined(this.uploadFile),this.uploadFile(t)}onChange(t){this.currentDoc=t;const e=t.asText(),r=t.size>this.maxLength&&e.length>this.maxLength;t.hasContent&&this.markAsTyping(),this.state$.assign({isTyping:t.hasContent,atTextLimit:r,isEmpty:!t.hasContent||e.trim().length===0,characterCount:t.size===0?0:t.size-2})}setMaxLength(t){this.maxLength=t}focus(){var t;(t=this.editorView)==null||t.dom.focus()}setText(t){this.editorView&&function(e,r){const i=e.state.doc.content.size,o=r.split(/(<!!(?:mention|customemoji):.*?>)/g).filter(a=>a||a.length).map(a=>{const[l,u,c]=a.match(/<!!mention:(.*)\|(.*)>/)||[null];if(l&&u&&c)return V0(u,c);const[d,h]=a.match(/<!!customemoji:(.*?)>/)||[null];return d&&h?z0(h):Jt.text(a)}),s=e.state.tr.replaceWith(0,i,o);e.dispatch(s)}(this.editorView,t)}typeText(t){this.editorView&&function(e,r,i="replace"){const o=e.state.doc.content.size,s=i=="insert"?e.state.tr.insertText(r):e.state.tr.insertText(r,0,o);e.dispatch(s)}(this.editorView,t,"insert")}getText(){return this.currentDoc.asText().trim()}clearText(){this.editorView&&function(t){const e=t.state.doc.content.size,r=t.state.tr.insertText("",0,e);t.dispatch(r)}(this.editorView)}selectEmoji(t){St.defined(this.editorView),function(e,r,i){const o=z0(r);let s;if(i){const{from:a,to:l}=i;s=e.state.tr.replaceRangeWith(a,l,o)}else s=e.state.tr.replaceSelectionWith(o,!1);e.dispatch(s)}(this.editorView,t,this._suggestionRange),this.focus()}selectMention(t){St.defined(this.editorView),function(e,r,i){const o=V0(r.id,r.name);let s=e.state.tr;if(i){const{from:a,to:l}=i;s=s.replaceRangeWith(a,l,o)}else s=s.replaceSelectionWith(o,!1);s=s.insertText(" "),e.dispatch(s)}(this.editorView,t,this._suggestionRange),this.focus()}}function Ty(n){const t=cn(),e=bt(),r=to(),i=Et(e.referencedMessage$),o=Et(e.state$.userPermissions),s=ts(),{sendMessage:a}=bO(),l=Et(s.state$);let u;return u=n.editMessageId===void 0?new vy(l,a,n.attachFile,n.shareLocation,s.toggleEmojiPicker):new vy(l,n.onEditMessage,()=>{},()=>{},()=>{}),C(Jf.Provider,{value:{onClose:()=>s.toggleEmojiPicker(!1),onEmojiSelected:c=>s.selectEmoji(c)},children:C(t.MessageField,{common:r,referencedMessage:i,permissions:o,editor:u,editMessageId:n.editMessageId})})}function Bw({message:n}){const t=bt(),e=$i(),r=Et(t.state$.editingMessageId),i=at(()=>Yn(n.content[0].children),[n]),o=Er({isEmpty:i.length===0,isTyping:!1,atTextLimit:!1,characterCount:i.length,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0}),s=at(()=>new yy(o,t.device$,t.state$.userPermissions),[o,t]),a=rt(async()=>{const l=s.state$;if(l.isEmpty.peek()||l.atTextLimit.peek())return;const u=s.getText();u&&await e.editMessage(n.id,{text:u}),t.state$.editingMessageId.set(null)},[t,e,s,n.id]);return J(()=>{s.onEnter=a},[s,a]),J(()=>{s.focus(),s.setText(Yn(n.content[0].children,!0))},[s,n]),C(Xf.Provider,{value:s,children:C(Ty,{editMessageId:r,onEditMessage:a})})}function Fw(){const n=cn(),t=to();return C(n.MessageListFooter,{common:t})}function Uw(n){const t=cn(),e=to();return C(t.MessageDivider,{common:e,...n})}function Hw({message:n}){const t=cn(),e=bt(),r=to(),[i,o]=nt("sent");return Qi(s=>{if(n.id.startsWith("ephemeral-"))return o("sending");const a=e.state$.currentConversation.everyoneReadUntil.get();return a!==void 0?n.createdAt<=a?o("everyoneRead"):o("sent"):void 0}),C(t.Message,{common:r,message:n,messageStatus:i,permissions:e.messagePermissions$(n).get()})}function $w({extConversationId:n}){const t=es(),e=bt(),r=$i(),i=X(!0),o=X(null);se(()=>{i.current=o.current.scrollTop>-30}),J(()=>{i.current&&(o.current.scrollTop=0)}),J(()=>{const l=new IntersectionObserver(u=>e.state$.visibility.isInView.set(u[0].isIntersecting),{threshold:.9});return l.observe(o.current),()=>l.disconnect()},[e]),J(()=>{const l=()=>e.state$.visibility.tabFocused.set(!document.hidden);return document.addEventListener("visibilitychange",l),()=>document.removeEventListener("visibilitychange",l)},[e]),Qi(l=>{if(!o.current)return;const u=e.state$.visibility.tabFocused.get(),c=e.state$.visibility.isInView.get(),d=function(p){if(p.checkVisibility)return p.checkVisibility({contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0,checkOpacity:!0,checkVisibilityCSS:!0});{const f=window.getComputedStyle(p),m=f.visibility,g=f.opacity;return!(p.getClientRects().length===0||m==="hidden"||g==="0")}}(o.current),h=e.state$.currentConversation.get();return h&&h.isUnread&&u&&c&&d?t.conversation(h.id).markAsRead():void 0});const s=rt(l=>{const u=l.currentTarget;u.scrollHeight-u.clientHeight+u.scrollTop<90&&e.messageSubscription&&e.messageSubscription.loadMore(10)},[e.messageSubscription]),a=Et(e.state$.typing.child(n));return C("div",{className:"t-message-list",ref:o,"t-menu-boundary":"",onScroll:s,children:[a&&C(Fw,{}),C(Ac,{each:e.chatItems$,children:l=>C("div",{className:"t-message-group",children:C(Ac,{each:l,item:jw,itemProps:{controller:r,extConversationId:n}})})})]})}function jw({item$:n}){const t=bt(),e=Et(n),r=Et(t.state$.editingMessageId);return e instanceof _c?C(Uw,{timestamp:e.timestamp,isReadMarker:e.isReadMarker,isDayMarker:e.isDayMarker}):r===e.id?C(Bw,{message:e}):C(Hw,{message:e})}const Yw=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function ru({appId:n,chatboxState:t}){const e=n.charAt(0)==="t"||Yw.has(n);return J(()=>{switch(t.type){case"auth-failed":Jn.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":Jn.error(`User \`${t.userId}\` not found. Please verify that you synchronized this user's data with TalkJS, either using the JS SDK or through the REST API.`);break;case"unexpected-error":Jn.error(t.error);break;case"wrong-app-id":Jn.error(`Could not find given appId: "${t.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:St.never(t)}},[t]),C("div",{className:"t-panel t-error-panel",children:[C("span",{className:"t-heading",children:"Something went wrong."}),C("p",{children:"Please reload the page and try again."}),C("p",e?{style:{fontStyle:"italic"},children:["Developer note: check your browser's developer tools console for messages that may help solve the problem.",C("br",{}),C("small",{children:"This message only shows up in test mode."})]}:{children:"If things keep not working, do not hesitate to get in touch with us."})]})}function zw(){return C("div",{className:"t-panel t-error-panel",children:C("span",{className:"t-heading",style:{fontStyle:"italic"},children:Et(bt().t$).CHAT_NOT_FOUND})})}function Oy(){return C("div",{className:"t-panel t-loading-panel",children:C(Hd,{})})}function Sy(){const n=Et(bt().t$);return C("div",{className:"t-panel t-error-panel",children:[C("span",{className:"t-heading",style:{fontStyle:"italic"},children:n.AUTH_EXPIRED_OVERLAY_TITLE}),C("p",{children:n.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}const Vw=()=>!0;async function tp(n,t,{initialDelay:e,maxDelay:r,log:i,shouldRetry:o=Vw}){return t().catch(async s=>{if(i&&i(`[TalkJS] Retries left: ${n}. Error: ${JSON.stringify(s)}.`),n===0||!await o(s))throw s;const a=1e3*e*1.2,l=r?Math.min(1e3*r,a):a,u=l*(1-(c=.05)+2*Math.random()*c);var c;return function(d){return d<=0?Promise.resolve():new Promise(h=>setTimeout(h,d))}(u).then(()=>tp(n-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:o}))})}function ea(){const n={},t=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=t,n}function Ww(n,t,e){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=Re(Kf);return rt(async()=>{function o(c){c==="denied"&&i({type:n})}if(!r||!await async function(c){if(!("permissions"in navigator))return!1;const d=c;try{return(await navigator.permissions.query({name:d})).state==="prompt"}catch(h){return!1}}(n))return t(c=>{o(c)});const s=ea(),a=ea(),l={type:n,showPrompt:async()=>(a.resolve({cancelled:!1}),await s.promise),cancel:()=>{a.resolve({cancelled:!0})}};try{r(l)}catch(c){Jn.error("Your beforeBrowserPermissionPrompt callback threw an error: ",c),a.resolve({cancelled:!0})}const{cancelled:u}=await a.promise;return u?void 0:t(c=>{s.resolve(c),o(c)})},[r,i,n,t,...e])}function Gw({onClose:n}){const t=bt(),e=$i(),r=es(),[i,o]=nt(null),s=rt(async l=>{try{if(l||(l=(await new Promise(m=>{const g=document.createElement("input");g.type="file",g.multiple=!1,g.addEventListener("change",()=>{m([...g.files])}),g.addEventListener("cancel",()=>{m([])}),g.click()}))[0]),!l)return;const{uploadPromise:u,upload:c}=await async function(m,g){const E=m.name;if(function(O){return/\.(mp4|ts|mov|webm|ogv)$/i.test(O)}(m.name)){const O=await np("video",m,N=>({width:N.videoWidth,height:N.videoHeight,duration:N.duration,filename:E})),T=g.uploadVideo(m,O),S=function(N){switch(N.name.split(".").pop()){case"ts":return"video/MP2T";case"mov":return"video/quicktime";case"webm":return"video/webm";case"ogv":return"video/ogg";default:return"video/mp4"}}(m);return{uploadPromise:T,upload:{type:"video",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m],{type:S}))}}}if(function(O){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(O)}(m.name)){const O=await np("audio",m,T=>({duration:T.duration,filename:E}));return{uploadPromise:g.uploadAudio(m,O),upload:{type:"audio",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}if(function(O){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(O)}(m.name)){const O=await np("img",m,T=>({width:T.naturalWidth,height:T.naturalHeight,filename:E}));return{uploadPromise:g.uploadImage(m,O),upload:{type:"image",file:m,metadata:O,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}const A={filename:E},v=g.uploadFile(m,A),_=URL.createObjectURL(new Blob([m]));return{uploadPromise:v,upload:{type:"file",file:m,metadata:A,temporaryBlobUrl:_}}}(l,r),d=c.file.size+","+c.file.name;t.state$.localFileBlobUrls.child(t.state$.extCurrentConversationId.peek()).child(d).set({url:c.temporaryBlobUrl,fetching:!1}),t.latestFileUpload=c;const h=ea(),p={upload:c,closePreview:h.resolve,uploaded:!1};let f;o(p);try{f=await Ny(u,h.promise),o({...p,uploaded:!0})}catch(m){if(m===ep)return;o(g=>({...g,error:m.toString()}))}if(await h.promise==="cancel")return;St.defined(f),e.sendFileMessage({fileToken:f})}finally{n(),o(null)}},[e,r,o,t,n]),a=Ww("geolocation",async l=>{try{const u=ea(),c={upload:{type:"location",location:void 0},uploaded:!1,closePreview:u.resolve};o(c);const{permissionResult:d,location:h}=await Ny(new Promise(p=>{navigator.geolocation.getCurrentPosition(f=>{const m={latitude:f.coords.latitude,longitude:f.coords.longitude};p({permissionResult:"granted",location:m})},f=>{f.code===1?p({permissionResult:"denied"}):p({permissionResult:"granted"})})}),u.promise);if(l(d),!h||(o({...c,upload:{type:"location",location:h},uploaded:!0}),await u.promise==="cancel"))return;e.sendLocationMessage({location:h})}catch(u){if(u===ep)return;throw u}finally{n(),o(null)}},[e,o,n]);return{attachFile:s,shareLocation:a,uploadState:i}}const ep=Symbol("cancelled");function Ny(n,t){return Promise.race([n,t.then(()=>Promise.reject(ep))])}async function np(n,t,e){const r=document.createElement(n);try{return r.src=URL.createObjectURL(t),await new Promise((i,o)=>{const s=n==="img"?"load":"loadedmetadata";r.addEventListener(s,()=>{try{i(e(r))}catch(a){o(a)}},{once:!0})})}finally{URL.revokeObjectURL(r.src)}}function Cy({children:n,className:t,...e}){return C("div",{className:"t-attach-overlay "+t,...e,children:n})}function Xw({uploadState:n}){const t=n.error,e=n.uploaded;dl(()=>n.closePreview("cancel"),".t-upload-preview");const r=X(null);J(()=>{e&&r.current.focus()},[e]);const i=Et(bt().t$);return C(Cy,{className:"t-upload-preview",children:C("div",{className:"t-preview",children:[C(Kw,{upload:n.upload,uploaded:e}),t!==void 0&&C("div",{className:"t-error-row",children:t}),C("div",{className:"t-send-row",children:[C("button",{className:"t-cancel",onClick:()=>n.closePreview("cancel"),children:i.CANCEL}),t===void 0&&e&&C("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>n.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function Kw({upload:n,uploaded:t}){const e=Et(bt().t$);return n.type!=="location"?C(Vt,{children:[C(Jw,{upload:n}),C(Zw,{upload:n,uploaded:t,t:e})]}):t?C(qw,{location:n.location}):C("div",{className:"t-loading",children:C(Hd,{})})}function qw({location:n}){const{imageUrl:t,linkUrl:e}=ly(n);return C("a",{href:e,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(t)}) center center / cover no-repeat`}})}const Jw=Ot.memo(function({upload:n}){let t=null;const e=n.file;if(n.type==="video"){const r=/[.]ts/i.test(e.name)?"mpegts":"native";t=C("div",{className:"video-container",children:C(Qw,{src:n.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else n.type==="image"?t=C("div",{className:"t-img-container",children:C("img",{src:URL.createObjectURL(e)})}):n.type==="audio"&&(t=C(yc,{src:URL.createObjectURL(e),filename:e.name}));return t}),Zw=Ot.memo(function({uploaded:n,upload:t,t:e}){let r;r=n?t.metadata.filename:e.UPLOAD_IN_PROGRESS;let i="",o="";return t.type==="file"&&(i="is-file",n&&(o="file-block")),C("div",{className:`t-filename-row ${i}`,children:C("div",{className:o,children:r})})});function Qw(n){const{videoType:t,...e}=n;return C("video",{...e})}function tR(){const n=cn(),t=bt(),e=to(),r=Et(t.state$.isUserConnected),i=Et(t.state$.userPermissions);return C(n.ChatHeader,{common:e,isUserConnected:r,permissions:i})}function eR({appId:n,chatHeaderVisible:t,messageFieldVisible:e}){const r=ts(),i=function(){const p=bt(),f=Er(()=>{const E=p.extUserId$.get(),A=p.errors$.get(),v=p.authTokenState$.get(),_=E&&p.currentUser$.get(),O=p.state$.currentConversation.get(),T=p.state$.extCurrentConversationId.get(),S=T&&p.state$.participants.child(T).get(),N=p.app$.get();return p.device$.get(),A.serverError?"server-error":A.wrongAppId?"wrong-app-id":v==="loading"||v==="idle"?"loading-token":v==="invalid"?"invalid-token":v==="expired"?"expired-token":v==="valid"?A.unknownUser?"unknown-user":A.unknownConversation?"loading-conv-failed":_&&O&&S&&N?"loaded":"loading-data":void St.unreachable()}),m=Er({type:"loading"});Qi(E=>{const A=f.get(),v=p.state$.extCurrentConversationId.peek(),_=p.extUserId$.peek(),O=p.appId$.peek();function T(S){m.set({type:"loading"});const N=setTimeout(()=>{m.set(S)},5e3);return()=>clearTimeout(N)}switch(A){case"invalid-token":m.set({type:"auth-failed"});break;case"expired-token":m.set({type:"expired-token"});break;case"wrong-app-id":m.set({type:"wrong-app-id",appId:O});break;case"server-error":m.set({type:"server-error"});break;case"loading-data":case"loading-token":m.set({type:"loading"});break;case"loaded":m.set({type:"loaded",conversationId:v,userId:_});break;case"loading-conv-failed":E.onCleanup=T({type:"inaccessible-conversation",userId:_,conversationId:v});break;case"unknown-user":E.onCleanup=T({type:"unknown-user",userId:_});break;default:St.never(A)}});const g=Er({type:"loading"});return Qi(E=>{if(m.type.get()==="loading"){g.set({type:"invisible-loading"});const A=setTimeout(()=>{g.set({type:"loading"})},1e3);E.onCleanup=()=>{clearTimeout(A)}}else g.set(m.get())}),Et(g)}(),{attachFile:o,shareLocation:s,uploadState:a}=Gw({onClose:()=>r.focus()});J(()=>{r.uploadFile=o},[r,o]);const[l,u]=nt(!1),c=rt(p=>{o(p.dataTransfer.files[0]),p.preventDefault(),u(!1)},[o]),d=rt(p=>{p.preventDefault(),u(!0)},[]),h=rt(p=>{p.preventDefault(),u(!1)},[]);return i.type==="invisible-loading"?C(Vt,{}):i.type==="loading"?C(Oy,{}):i.type==="inaccessible-conversation"?C(zw,{}):i.type==="unknown-user"||i.type==="auth-failed"||i.type==="wrong-app-id"||i.type==="server-error"||i.type==="unexpected-error"?C(ru,{appId:n,chatboxState:i}):i.type=="expired-token"?C(Sy,{}):i.type==="loaded"?C("div",{className:"t-chatbox-content",onDragOver:d,onDragLeave:h,onDrop:c,children:[t&&C(tR,{}),C($w,{extConversationId:i.conversationId}),e&&C(Ty,{attachFile:o,shareLocation:s}),a&&C(Xw,{uploadState:a}),l&&C(Cy,{className:"t-drop-overlay",children:C(Pa,{type:"attach"})})]}):C(Vt,{})}function nR(n,t){return n.map(r=>function(i,o){if(i.type==="text")return function(s,a){const l=X0(a);return iu(s,l)}(i.children,o);if(i.type==="file"&&i.subtype==="video")return`🎥 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="image")return`📷 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="audio")return`🎧 ${Oa(i.url)}`;if(i.type==="file"&&i.subtype==="voice"){const s=i.duration;return s===void 0?"🎙️":`🎙️ (${Math.floor(s/60)}:${Math.floor(s%60).toString().padStart(2,"0")})`}return i.type==="file"?(i.subtype,`📎 ${Oa(i.url)}`):i.type==="location"?"📍":""}(r,t)).join(`
1308
1308
 
1309
1309
  `)}function iu(n,t){return n.flatMap(e=>{if(typeof e=="string")return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return iu(e.children,t);case"bulletlist":case"bulletList":return`
1310
1310
  `+iu(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+iu(e.children,t)+`
1311
- `;case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"emoji":case"customemoji":case"customEmoji":return e.text;case"suppressed":return t.contactInfoHiddenText;case"mention":return`@${e.text}`}}).join("")}function by(){const n=typeof window!="undefined"?window.crypto:void 0,t=n?()=>n.getRandomValues(new Uint8Array(1))[0]:()=>Math.floor(255*Math.random());return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^t()&15>>e/4).toString(16))}class rR{constructor(t,e,r,i,o){this.store=t,this.talkSession=e,this.editorInternals=r,this.onSendMessage=i,this.onDeleteMessage=o}async deleteMessage(t){const e=this.store.state$.extCurrentConversationId.peek(),r=this.store.state$.messages.child(e).lookup.child(t).peek(),i=this.talkSession.conversation(e).message(t),[o]=await Promise.all([r!=null?r:i.get(),i.delete()]);if(o){const s={currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek(),message:r};this.onDeleteMessage(s)}}setEditing(t){this.store.state$.editingMessageId.set(t)}async editMessage(t,e){const r=this.store.state$.extCurrentConversationId.peek();await this.talkSession.conversation(r).message(t).edit(e)}setReferencedMessage(t){this.store.state$.referencedMessageId.set(t)}async sendMessage(t){const e=this.store.state$.extCurrentConversationId.peek(),r=await async function(s,a){var m,g,E,A,v;const l=s.state$.extCurrentConversationId.peek(),u=s.state$.messages.child(l),c=typeof a.referencedMessage=="string"?u.lookup.child(a.referencedMessage).peek():await((g=(m=a.referencedMessage)==null?void 0:m.get())!=null?g:null),d=c&&{...c,type:"UserMessage",sender:c.sender,referencedMessageId:(A=(E=c.referencedMessage)==null?void 0:E.id)!=null?A:null};d&&delete d.referencedMessage;const h=s.latestFileUpload,p="content"in a?[Iy(h,a.content[0])]:[iR(a.text)],f="text"in a?a.text:nR(a.content.map(_=>Iy(h,_)),{});return{id:"ephemeral-"+by(),type:"UserMessage",sender:s.currentUser$.peek(),createdAt:Date.now(),editedAt:null,custom:(v=a.custom)!=null?v:{},origin:"web",referencedMessage:d,reactions:[],content:p,plaintext:f}}(this.store,t);this.store.state$.ephemeralMessages.child(e).child(r.id).set(r);const i=ea();this.store.readyForNewMessagesPromise=i.promise;const o=await this.talkSession.conversation(e).send(t);this.store.state$.ephemeralMessageIdMapping.child(e).child(o.id).set(r.id),i.resolve(),this.onSendMessage({message:await o.get(),currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek()})}sendFileMessage(t){const e={type:"file",fileToken:t.fileToken};return this.sendMessage({content:[e],custom:t.custom})}sendLocationMessage(t){const e={type:"location",latitude:t.location.latitude,longitude:t.location.longitude};return this.sendMessage({content:[e],custom:t.custom})}getMessageFieldText(){return this.editorInternals.getText()}setMessageFieldText(t){this.editorInternals.setText(t)}markAsTyping(){const t=this.store.state$.extCurrentConversationId.peek();this.talkSession.conversation(t).markAsTyping()}async toggleReaction(t,e){this.store.state$.extCurrentConversationId.peek();const r=this.getReactionRef(t,e.emoji);e.currentUserReacted?await r.remove():await r.add()}async addReaction(t,e){this.store.state$.extCurrentConversationId.peek(),await this.getReactionRef(t,e).add()}getReactionRef(t,e){const r=this.store.state$.extCurrentConversationId.peek();return this.talkSession.conversation(r).message(t).reaction(e)}}const iR=n=>({type:"text",children:function(e){return F0(e,{except:["FormattedLink","Actions"]})}(n)});function Iy(n,t){switch(t.type){case"text":case"location":return t;case"file":return function(e,r){return{type:"file",subtype:e.type==="file"?void 0:e.type,...e.metadata,size:e.file.size,filename:e.file.name,fileToken:r.fileToken,url:e.temporaryBlobUrl}}(n,t)}}var wy,oR=Object.defineProperty,sR=Object.defineProperties,aR=Object.getOwnPropertyDescriptors,ou=Object.getOwnPropertySymbols,Ry=Object.prototype.hasOwnProperty,Dy=Object.prototype.propertyIsEnumerable,ky=(n,t,e)=>t in n?oR(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_t=(n,t)=>{for(var e in t||(t={}))Ry.call(t,e)&&ky(n,e,t[e]);if(ou)for(var e of ou(t))Dy.call(t,e)&&ky(n,e,t[e]);return n},On=(n,t)=>sR(n,aR(t)),Ly=(n,t)=>{var e={};for(var r in n)Ry.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&ou)for(var r of ou(n))t.indexOf(r)<0&&Dy.call(n,r)&&(e[r]=n[r]);return e},U=(n,t,e)=>new Promise((r,i)=>{var o=l=>{try{a(e.next(l))}catch(u){i(u)}},s=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((e=e.apply(n,t)).next())});function xt(n,t){if(t.ok)return t.value.data;throw t.value==="SESSION_DESTROYED"?new Error(`${n} failed because the session was destroyed`):t.where==="server"?new Error(na(n,t.value)):"unreachable"}function na(n,t){let e;return e=Array.isArray(t.reasons)?t.reasons.join():JSON.stringify(t.reasons),`${n} failed, got status ${t.status} ${t.errorCode}, reasons: ${e}`}function ln(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!=="*"&&n[e]!==t[e])return!1;return!0}function xy(n){return n<=0?Promise.resolve():new Promise(t=>setTimeout(t,n))}function rp(n,t){return n*(1-t+2*Math.random()*t)}const lR=()=>!0;function My(n,t,e){return U(this,arguments,function*(r,i,{initialDelay:o,maxDelay:s,log:a,shouldRetry:l=lR}){return i().catch(u=>U(this,null,function*(){if(r===0||!(yield l(u)))throw u;const c=1e3*o*1.2,d=rp(s?Math.min(1e3*s,c):c,.05);return xy(d).then(()=>My(r-1,i,{initialDelay:d/1e3,maxDelay:s,log:a,shouldRetry:l}))}))})}function yi(){const n={},t=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=t,n}class su{constructor(t,e,r){this.layer=t,this.states=e,this.transitions=r,this._state=e[0]}get state(){return this._state}transition(t){const e=this.transitions[t];if(!e||!this.canTransition(t))return;const r=this.state;this._state=e.to,e.afterTransition({from:r,to:this.state})}canTransition(t){const e=this.transitions[t];return!!e&&(e.from==="ANY"||e.from.includes(this.state))}}function X(n){return{ok:!0,value:n}}function Ut(n){return{ok:!1,where:"client",value:n}}function Ti(n){return{ok:!1,where:"server",value:n}}function ra(){const n={},t=new Promise(e=>{n.ok=r=>U(this,null,function*(){return e(X(r))}),n.clientErr=r=>e(Ut(r)),n.serverErr=r=>e(Ti(r)),n.resolve=r=>e(r)});return n.promise=t,n}class uR{constructor(t,e){this.realtimeUrl=t,this.handlers=e,this.socket=null,this.stateMachine=new su("ReconnectingSocket",["STOPPED","CONNECTING","READY","DISCONNECTED","TERMINATED"],{startWs:{from:["STOPPED","DISCONNECTED"],to:"CONNECTING",afterTransition:()=>{const r=new(function(){if(globalThis.WebSocket)return globalThis.WebSocket;throw new Error("Missing WebSocket implementation")}())(this.realtimeUrl+"&talkjs-time="+Date.now());this.socket=r,r.addEventListener("open",()=>{this.socket===r&&this.stateMachine.transition("onOpen")}),r.addEventListener("close",()=>{this.socket===r&&this.stateMachine.transition("onClose")}),r.addEventListener("message",i=>{this.socket===r&&this.handlers.onMessage(i)})}},onOpen:{from:["CONNECTING"],to:"READY",afterTransition:()=>{this.handlers.onOpen()}},onClose:{from:["CONNECTING","READY"],to:"DISCONNECTED",afterTransition:r=>U(this,[r],function*({from:i}){i==="READY"&&this.handlers.onClose(),this.socket=null;const o=rp(1e4,.5);setTimeout(()=>{this.stateMachine.state==="DISCONNECTED"&&this.stateMachine.transition("startWs")},o)})},stopWs:{from:["CONNECTING","DISCONNECTED","READY"],to:"STOPPED",afterTransition:({from:r})=>{r==="READY"&&this.handlers.onClose();const i=this.socket;this.socket=null,i==null||i.close(1e3)}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{const r=this.socket;this.socket=null,r==null||r.close(1e3)}}})}stopWs(){this.stateMachine.transition("stopWs")}startWs(){this.stateMachine.transition("startWs")}send(t){return this.stateMachine.state==="READY"?(this.socket.send(t),X(void 0)):Ut("SOCKET_NOT_READY")}terminate(){const t=this.socket;this.stateMachine.canTransition("onClose")&&this.stateMachine.transition("onClose"),t&&("terminate"in t?t.terminate():t.close(1e3))}destroy(){this.stateMachine.transition("destroy")}}class cR{constructor(t,e){this.handlers=e,this.socket=new uR(t,{onOpen:()=>this.handlers.onOpen(),onClose:()=>this.handlers.onClose(),onMessage:r=>this.onWebSocketMessage(r)})}call(t,e,r,i){const o=`/${r.map(a=>encodeURIComponent(a)).join("/")}`,s=JSON.stringify([t,e,o,i]);return this.socket.send(s)}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.socket.destroy()}terminate(){this.socket.terminate()}onWebSocketMessage(t){if(t.data!=="Auth token expired")try{const e=JSON.parse(t.data);if(e[1]==="PUBLISH"){const r=e[0],i=JSON.stringify([r,"ACK"]);this.socket.send(i);const o=e.slice(2),s=[];o.forEach(a=>{a.type==="session.expired"?this.handlers.onAuthExpired():a.type==="upstream.restarting"?this.handlers.onUpstreamRestarting():s.push(a)}),s.length>0&&this.handlers.onPublish(r,s)}else{const r=e[0],i=e[1],o=e[2];this.handlers.onResponse(r,i,o)}}catch(e){}else this.handlers.onAuthExpired()}}class au{constructor(t){this.delayMs=t,this.timeout=void 0}schedule(t){this.stop(),this.timeout=setTimeout(()=>{this.timeout!==void 0&&(this.stop(),t())},this.delayMs)}stop(){this.timeout!==void 0&&(clearTimeout(this.timeout),this.timeout=void 0)}}class dR{constructor(){this.i=-1}next(){return this.i++,this.i}reset(){this.i=-1}}class hR{constructor(t,e){this.handlers=e,this.seqCounter=new dR,this.responseHandlers={},this.heartbeats=new pR(this),this.socket=new cR(t,{onUpstreamRestarting:()=>{this.heartbeats.serverActive(),this.handlers.onUpstreamRestarting()},onOpen:()=>{this.heartbeats.clientActive(),this.heartbeats.serverActive(),this.handlers.onReady()},onClose:()=>{this.heartbeats.stop(),Object.values(this.responseHandlers).forEach(r=>{r.clientErr("WEBSOCKET_DISCONNECTED")}),this.responseHandlers={},this.seqCounter.reset(),this.handlers.onNotReady()},onResponse:(r,i,o)=>{this.heartbeats.serverActive(),this.onResponse(r,i,o)},onPublish:(r,i)=>{this.heartbeats.serverActive(),this.handlers.onPublish(r,i),this.heartbeats.clientActive()},onAuthExpired:()=>{this.heartbeats.serverActive(),this.handlers.onAuthExpired()}})}call(t,e,r){const i=this.seqCounter.next(),o=ra();this.responseHandlers[i]=o;const s=this.socket.call(i,t,e,r);return s.ok||o.resolve(s),this.heartbeats.clientActive(),o.promise}onResponse(t,e,r){return U(this,null,function*(){const i=this.responseHandlers[t];i&&(e===200?i.ok({status:e,data:r}):i.serverErr({status:e,errorCode:r.errorCode,reasons:r.reasons}),delete this.responseHandlers[t])})}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.heartbeats.stop(),Object.values(this.responseHandlers).forEach(t=>{t.clientErr("WEBSOCKET_DISCONNECTED")}),this.responseHandlers={},this.socket.destroy()}terminate(){this.socket.terminate()}}class pR{constructor(t){this.connection=t,this.clientInactivityTimer=new au(25e3),this.serverInactivityTimer=new au(1e4),this.serverTimeoutTimer=new au(5e3)}clientActive(){this.clientInactivityTimer.schedule(()=>{this.sendHeartbeat()})}serverActive(){this.serverTimeoutTimer.stop(),this.serverInactivityTimer.schedule(()=>{this.sendHeartbeat(),this.serverTimeoutTimer.schedule(()=>{this.connection.terminate()})})}stop(){this.clientInactivityTimer.stop(),this.serverInactivityTimer.stop(),this.serverTimeoutTimer.stop()}sendHeartbeat(){this.connection.call("GET",["ping"],{}).catch(()=>{})}}class fR{constructor(t,e,r){this.authProvider=e,this.handlers=r,this.stateMachine=new su("AuthenticatedConnection",["WAITING_FOR_WS","LOGGING_IN","RENEWING_SESSION","READY","TERMINATED"],{logIn:{from:["WAITING_FOR_WS"],to:"LOGGING_IN",afterTransition:()=>U(this,null,function*(){yield this.renewSession()})},logInFailed:{from:["LOGGING_IN"],to:"LOGGING_IN",afterTransition:()=>U(this,null,function*(){this.authProvider.refreshToken(),yield this.renewSession()})},scheduledReauth:{from:["READY"],to:"RENEWING_SESSION",afterTransition:()=>U(this,null,function*(){yield this.renewSession()})},scheduledReauthFailed:{from:["RENEWING_SESSION"],to:"RENEWING_SESSION",afterTransition:()=>U(this,null,function*(){this.authProvider.refreshToken(),yield this.renewSession()})},authenticated:{from:["LOGGING_IN","RENEWING_SESSION"],to:"READY",afterTransition:({from:i})=>{i==="LOGGING_IN"&&this.handlers.onReady()}},authExpired:{from:["READY","RENEWING_SESSION"],to:"LOGGING_IN",afterTransition:()=>U(this,null,function*(){this.handlers.onNotReady(),this.authProvider.refreshToken(),yield this.renewSession()})},wsDisconnected:{from:["READY","LOGGING_IN","RENEWING_SESSION"],to:"WAITING_FOR_WS",afterTransition:({from:i})=>{i!=="READY"&&i!=="RENEWING_SESSION"||this.handlers.onNotReady(),this.authProvider.clearScheduledRefresh()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.authProvider.clearScheduledRefresh(),this.connection.destroy()}}}),this.connection=new hR(t,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onReady:()=>this.stateMachine.transition("logIn"),onNotReady:()=>{this.stateMachine.transition("wsDisconnected")},onAuthExpired:()=>{this.stateMachine.transition("authExpired")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}}),e.onTokenChanged(()=>{this.stateMachine.state==="READY"&&this.stateMachine.transition("scheduledReauth")})}call(t,e,r){const i=this.connection.call(t,e,r);return i.then(o=>{o.ok||o.where!=="server"||o.value.status!==401||this.stateMachine.state!=="READY"&&this.stateMachine.state!=="RENEWING_SESSION"||this.stateMachine.transition("authExpired")}),i}stopWs(){this.connection.stopWs()}startWs(){this.connection.startWs()}destroy(){this.stateMachine.transition("destroy")}renewSession(){return U(this,null,function*(){const t=yield this.authProvider.getToken(),e=yield this.connection.call("POST",["session","renew"],{token:t});if(!e.ok&&e.where==="client")return;const r=e.value;if(r.status,r.status===200){const o=r.data.expiresInSeconds;return void(o!==null&&o<120?(console.warn(`[TalkJS] Authenticated with a token that expires in ${o}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`),this.stateMachine.state==="LOGGING_IN"?this.stateMachine.transition("logInFailed"):this.stateMachine.state==="RENEWING_SESSION"&&this.stateMachine.transition("scheduledReauthFailed")):(this.authProvider.scheduleRefresh(o),this.authProvider.emitTokenAccepted(t),this.stateMachine.canTransition("authenticated")&&this.stateMachine.transition("authenticated")))}if(r.status===401)return void(this.stateMachine.state==="LOGGING_IN"?this.stateMachine.transition("logInFailed"):this.stateMachine.state==="RENEWING_SESSION"&&this.stateMachine.transition("scheduledReauthFailed"));if(r.status===400)return void this.authProvider.emitTokenRefreshFailed(na("Authentication",r));if(r.status===402)return void this.authProvider.emitTokenRefreshFailed(na("Authentication",r));const i=5e3*Math.random()+5e3;setTimeout(()=>{this.call("POST",["session","renew"],{token:t}).catch(()=>{})},i)})}}class mR{constructor(t,e,r){this.handlers=r,this.stateMachine=new su("StopStartConnection",["STOPPED","WAITING_FOR_WS","READY","TERMINATED"],{unexpectedDisconnect:{from:["READY"],to:"WAITING_FOR_WS",afterTransition:()=>{this.inactivityTimer.stop(),this.handlers.onNotReady()}},stop:{from:["WAITING_FOR_WS","READY"],to:"STOPPED",afterTransition:()=>{this.connection.stopWs(),this.inactivityTimer.stop(),this.handlers.onNotReady()}},start:{from:["STOPPED"],to:"WAITING_FOR_WS",afterTransition:()=>{this.connection.startWs()}},ready:{from:["WAITING_FOR_WS"],to:"READY",afterTransition:()=>{this.pendingCalls=0,this.activeSubscriptions=0,this.inactivityTimer.schedule(()=>{this.stateMachine.transition("stop")}),this.handlers.onReady()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.inactivityTimer.stop(),this.connection.destroy()}}}),this.pendingCalls=0,this.activeSubscriptions=0,this.inactivityTimer=new au(3e3),this.connection=new fR(t,e,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("ready")},onNotReady:()=>{this.stateMachine.state==="READY"&&this.stateMachine.transition("unexpectedDisconnect")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}get inactive(){return this.pendingCalls===0&&this.activeSubscriptions===0}ensureStarted(){this.stateMachine.canTransition("start")&&this.stateMachine.transition("start")}call(t,e,r){return U(this,null,function*(){this.inactivityTimer.stop(),this.pendingCalls++;const i=yield this.connection.call(t,e,r);return this.pendingCalls--,t==="SUBSCRIBE"&&i.ok?this.activeSubscriptions++:t==="UNSUBSCRIBE"&&i.ok&&this.activeSubscriptions--,this.inactive&&this.inactivityTimer.schedule(()=>{this.stateMachine.transition("stop")}),i})}destroy(){this.stateMachine.transition("destroy")}isConnected(){return this.stateMachine.state==="READY"}}class gR{constructor(t,e,r){this.handlers=r,this.stateMachine=new su("QueuedConnection",["NOT_READY","PROCESSING_QUEUE","READY","TERMINATED"],{processQueue:{from:["NOT_READY"],to:"PROCESSING_QUEUE",afterTransition:()=>{this.sendQueuedCalls()}},ready:{from:["PROCESSING_QUEUE"],to:"READY",afterTransition:()=>{this.handlers.onReady()}},notReady:{from:["PROCESSING_QUEUE","READY"],to:"NOT_READY",afterTransition:()=>{Object.values(this.subscribeQueue).forEach(i=>i.deferred.ok({status:200,data:{}})),this.subscribeQueue={},this.handlers.onSubscriptionsLost()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{for(var i;this.callQueue.length;){const o=(i=this.callQueue.shift())==null?void 0:i.deferred;o==null||o.clientErr("SESSION_DESTROYED")}this.connection.destroy()}}}),this.subscribeQueue={},this.callQueue=[],this.connection=new mR(t,e,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("processQueue")},onNotReady:()=>{this.stateMachine.transition("notReady")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}call(t,e,r){return this.stateMachine.state==="READY"?this.connection.call(t,e,r):(this.stateMachine.state==="NOT_READY"&&this.connection.ensureStarted(),t==="SUBSCRIBE"||t==="UNSUBSCRIBE"?this._subscribe(t,e,r):this._call(t,e,r))}_subscribe(t,e,r){const i=e.join("/"),o=this.subscribeQueue[i];if(o&&o.method===t)return o.deferred.promise;o&&o.method!==t&&(o.deferred.ok({status:200,data:{}}),delete this.subscribeQueue[i]);const s={deferred:ra(),method:t,path:e,data:r};return this.subscribeQueue[i]=s,s.deferred.promise}_call(t,e,r){const i={deferred:ra(),method:t,path:e,data:r};return this.callQueue.push(i),i.deferred.promise}dequeue(){for(const t in this.subscribeQueue){const e=this.subscribeQueue[t];return delete this.subscribeQueue[t],e}return this.callQueue.shift()}destroy(){this.stateMachine.transition("destroy")}sendQueuedCalls(){return U(this,null,function*(){let t=0;for(;this.stateMachine.state==="PROCESSING_QUEUE";){t++;const e=this.dequeue();if(!e)return void this.stateMachine.transition("ready");this.connection.call(e.method,e.path,e.data).then(r=>{e.deferred.resolve(r)}),t>50&&(yield new Promise(r=>setTimeout(r,100)))}})}isConnected(){return this.stateMachine.state==="READY"||this.stateMachine.state==="PROCESSING_QUEUE"}}const ER=typeof window!="undefined"&&(wy=window.queueMicrotask)!=null?wy:setTimeout;class Py{constructor(t,e){this.clearPendingBatch=t,this.sendCalls=e,this.sent=!1,ER(()=>this.send())}send(){this.sent||(this.sent=!0,this.clearPendingBatch(),this.sendCalls())}destroy(){this.sent=!0}}class lu extends Py{constructor(t,e){super(e,()=>{this.sendSubscribe(),this.sendGet()}),this.connection=t,this.getCalls=[],this.subscribeCalls=[]}canPush(t,e){return lu.isCorrectBatchTypeFor(t,e)}static isCorrectBatchTypeFor(t,e){return ln(e,["users","*"])&&(t==="GET"||t==="SUBSCRIBE")}push(t,e,r){const i=e[1],o=ra();return t==="GET"?this.getCalls.push({userId:i,deferred:o}):this.subscribeCalls.push({userId:i,deferred:o}),this.getCalls.length!==1e3&&this.subscribeCalls.length!==1e3||this.send(),o.promise}sendGet(){return U(this,null,function*(){if(this.getCalls.length===0)return;const t=[...new Set(this.getCalls.map(r=>r.userId))],e=yield this.connection.call("GET",["users"],{ids:t,includePrivateFields:!1});if(e.ok)for(const r of this.getCalls){const i=e.value.data[r.userId];i?r.deferred.ok({status:200,data:i}):r.deferred.serverErr({status:404,errorCode:"NOT_FOUND",reasons:["No user with that ID exists"]})}else this.getCalls.forEach(r=>r.deferred.resolve(e))})}sendSubscribe(){if(this.subscribeCalls.length===0)return;const t=[...new Set(this.subscribeCalls.map(e=>e.userId))];this.connection.call("SUBSCRIBE",["users"],{ids:t}).then(e=>this.subscribeCalls.forEach(r=>r.deferred.resolve(e)))}}class uu extends Py{constructor(t,e,r){super(r,()=>this.sendMutate()),this.conversationId=t,this.connection=e,this.calls=[]}canPush(t,e){return!!uu.isCorrectBatchTypeFor(t,e)&&e[1]===this.conversationId}static isCorrectBatchTypeFor(t,e){return ln(e,["conversations","*","participants","*"])&&(t==="PUT"||t==="POST"||t==="PATCH")}push(t,e,r){const i=e[3],o=ra();return this.calls.push({action:{id:i,method:t,params:r},deferred:o}),this.calls.length===100&&this.send(),o.promise}sendMutate(){return U(this,null,function*(){const t=this.calls.map(i=>i.action),e=yield this.connection.call("POST",["conversations",this.conversationId,"participants"],{actions:t});if(!e.ok)return void this.calls.forEach(i=>i.deferred.resolve(e));const r=e.value.data.responses;for(let i=0;i<r.length;i++){const o=this.calls[i].deferred,s=r[i];s.status===200?o.ok(On(_t({},s),{data:{}})):o.serverErr(s)}})}}class AR{constructor(t,e,r){this.pendingBatch=null,this.connection=new gR(t,e,r)}call(t,e,r){return U(this,null,function*(){var i;if((i=this.pendingBatch)!=null&&i.canPush(t,e))return this.pendingBatch.push(t,e,r);this.pendingBatch&&this.pendingBatch.send();const o=this.createEmptyBatchFor(t,e);return o?(this.pendingBatch=o,o.push(t,e,r)):this.connection.call(t,e,r)})}destroy(){var t;this.connection.destroy(),(t=this.pendingBatch)==null||t.destroy()}isConnected(){return this.connection.isConnected()}createEmptyBatchFor(t,e){if(lu.isCorrectBatchTypeFor(t,e))return new lu(this.connection,()=>this.pendingBatch=null);if(uu.isCorrectBatchTypeFor(t,e)){const r=e[1];return new uu(r,this.connection,()=>this.pendingBatch=null)}return null}}const vR={200:"RESOLVE",400:"RESOLVE",401:"RETRY",402:"RESOLVE",403:"RESOLVE",404:"RESOLVE",405:"RESOLVE",409:"RESOLVE",429:"DELAY",500:"DELAY"};class _R{constructor(t,e,r){this.throttler=new yR,this.alive=!0,this.connection=new AR(t,e,r)}call(t,e,r){return U(this,null,function*(){let i=0;for(;this.alive;){const o=yield this.connection.call(t,e,r);if((o.ok||o.where!=="client"||o.value!=="SOCKET_NOT_READY")&&(o.ok||o.where!=="server"||o.value.status!==500)||i++,i===10)return o;if(o.ok||o.where!=="client"){const s=o.value,a=s.status,l=vR[a];if(l==="RESOLVE")return this.throttler.resetDelay(),o;if(l==="RETRY")continue;if(l==="DELAY"){yield this.throttler.wait();continue}return console.warn("[TalkJS] Unexpected status code",a),s}if(o.value==="SESSION_DESTROYED")return Ut("SESSION_DESTROYED");o.value!=="WEBSOCKET_DISCONNECTED"&&(o.value!=="SOCKET_NOT_READY"?o.value:yield this.throttler.wait())}return Ut("SESSION_DESTROYED")})}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}}class yR{constructor(){this.initialDelayMs=200,this.exponentialFactor=1.2,this.maxDelayMs=3e4,this.currentDelayMs=this.initialDelayMs,this.lastCall=0}getCurrentDelay(){return this.currentDelayMs}wait(){const t=new Date().getTime(),e=rp(this.currentDelayMs,.05),r=this.lastCall+e,i=Math.max(0,r-t);return this.lastCall=t+i,this.currentDelayMs=Math.min(e*this.exponentialFactor,this.maxDelayMs),xy(i)}resetDelay(){this.currentDelayMs=this.initialDelayMs}}function ip(n){return n.map(t=>encodeURIComponent(t)).join()}class TR{constructor(){this.paths={}}add(t){this.paths[ip(t)]=t}delete(t){delete this.paths[ip(t)]}has(t){return Object.hasOwnProperty.call(this.paths,ip(t))}clear(){this.paths={}}forEach(t){Object.values(this.paths).forEach(e=>t(e))}}class OR{constructor(t,e,r){this.handlers=r,this.targetSubscriptions=new TR,this.connection=new _R(t,e,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onSubscriptionsLost:()=>{this.targetSubscriptions.forEach(i=>{this.resubscribe(i)}),this.handlers.onResubscribeSent()},onReady:()=>this.handlers.onReady(),onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}call(t,e,r){return this.connection.call(t,e,r)}subscribe(t){return U(this,null,function*(){return this.targetSubscriptions.add(t),this.connection.call("SUBSCRIBE",t,{})})}unsubscribe(t){return U(this,null,function*(){return this.targetSubscriptions.delete(t),this.connection.call("UNSUBSCRIBE",t,{})})}resubscribe(t){return U(this,null,function*(){const e=yield this.connection.call("SUBSCRIBE",t,{});e.ok||this.handlers.onResubscribeError(t,e)})}destroy(){this.targetSubscriptions.clear(),this.connection.destroy()}isConnected(){return this.connection.isConnected()}}function Ht(n,t){return t===void 0?n:t}function op(n,t){if(t===void 0)return n;if(t===null)return{};const e=_t({},n);for(const r in t){const i=t[r];i===null?delete e[r]:e[r]=i}return e}function be(n,t){if(n===t)return!0;if(!n||!t||typeof n!="object"||typeof t!="object"||n.constructor!==t.constructor)return!1;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(!be(n[e],t[e]))return!1}else{const e=Object.keys(n);if(e.length!==Object.keys(t).length)return!1;for(const r of e)if(!Object.hasOwnProperty.call(t,r)||!be(n[r],t[r]))return!1}return!0}class By{constructor(){this.prev=Promise.resolve()}runExclusive(t){return U(this,null,function*(){const e=this.prev.then(()=>t());return this.prev=e,e})}}class SR{constructor(t){this.initialised=!1,this.getPointer=void 0,this.pendingStates=[t],t.resultPromise.then(()=>this.initialised=!0)}get pendingPointer(){if(this.pendingStates.length!==0)return this.pendingStates[this.pendingStates.length-1]}get mostRecentState(){var t;return(t=this.pendingPointer)!=null?t:this.getPointer}canAppendState(t){var e,r;const i=(e=this.getPointer)==null?void 0:e.seq;if(i!==void 0&&t<=i)return!1;const o=(r=this.pendingPointer)==null?void 0:r.seq;return!(o!==void 0&&t<o)}set(t){if(!this.canAppendState(t.seq))throw"Appending in the past";this.pendingStates.push(t)}mutate(t,e){if(!this.initialised)return;if(!this.canAppendState(t))throw"Mutating in the past";const r=this.mostRecentState.resultPromise.then(i=>i.ok?e(i):i);this.pendingStates.push({seq:t,resultPromise:r})}get(t){for(;this.pendingStates.length>0&&(this.getPointer===void 0||this.pendingStates[0].seq<=t);)this.getPointer=this.pendingStates.shift();return this.getPointer}}class NR extends SR{constructor(t,e){super(t),this.onTeardown=e,this._error=null,this._lastGoodState=Promise.resolve(void 0)}get error(){return this._error}get lastGoodState(){return this._lastGoodState}mutate(t,e){super.mutate(t,e),this.registerNewState(this.mostRecentState.resultPromise)}set(t){super.set(t),this.registerNewState(this.mostRecentState.resultPromise)}registerNewState(t){const e=this.lastGoodState;this._lastGoodState=t.then(r=>r.ok?r.value:e),t.then(r=>{r.ok||this.setError(r)})}setError(t){var e;this._error||(this._error=t,(e=this.onTeardown)==null||e.call(this,t),this.lastGoodState.then(r=>{r!==void 0&&this.teardownNested(r)}))}}class cu extends NR{constructor(t,e){const r=new Promise(i=>setTimeout(i)).then(()=>this.fetchInitial(t));super({seq:t,resultPromise:r},e),this.initialSeq=t,this.getDeepMutex=new By,this.lastDeep=void 0}refetchInitial(t){return U(this,null,function*(){const e=this.mostRecentState.resultPromise,r=this.fetchInitial(t),[i,o]=yield Promise.all([e,r]);return i!==void 0&&i.ok&&o.ok&&this.equal(i.value,o.value)?i:o})}refetch(t){if(this.error!==null)return;const e={seq:t,resultPromise:this.refetchInitial(t)};this.set(e)}changedBetween(t,e){return U(this,null,function*(){if(t>=e)return!1;const r=this.get(e),i=yield r.resultPromise;return!!i.ok&&(i.value.lastChanged>Math.max(this.initialSeq,t)&&i.value.lastChanged<=e||(yield this.anyChildChanged(t,e,i.value)))})}getDeep(t){return U(this,null,function*(){return this.getDeepMutex.runExclusive(()=>U(this,null,function*(){var e;if(this.error!==null)return this.error;const r=(e=this.lastDeep)==null?void 0:e.seq;if(t===r)return this.lastDeep.deep;if(r!==void 0){if(t<r)throw`Trying to load seq ${t} when we have previously loaded seq ${r}`;if(!(yield this.changedBetween(r,t)))return this.lastDeep.seq=t,this.lastDeep.deep}const i=this.get(t).resultPromise,o=i.then(a=>a.ok?this.loadNested(t,a.value):a);this.lastDeep={seq:t,shallow:i,deep:o};const s=yield o;return s.ok||this.setError(s),s}))})}}class Fr extends cu{constructor(t,e,r){super(t,r),this.emitMutex=e,this.unsubscribeTimer=new CR,this.referencedByOtherStores=0,this.listeners=[],this.lastEmitSeq=void 0,this.lastEmitResult=void 0,e.runExclusive(()=>U(this,null,function*(){yield this.emit(t)}))}registerInternalSubscription(){this.referencedByOtherStores++;let t=!0;return()=>{t&&(t=!1,this.referencedByOtherStores--,this.startUnsubscribeTimerIfOrphan())}}get onlyUsedInternally(){return this.listeners.length===0}listen(t){return this.unsubscribeTimer.stop(),this.listeners.push(t),this.lastEmitResult!==void 0&&t(this.lastEmitResult),()=>{this.listeners=this.listeners.filter(e=>e!==t),this.startUnsubscribeTimerIfOrphan()}}startUnsubscribeTimerIfOrphan(){this.referencedByOtherStores===0&&this.listeners.length===0&&this.unsubscribeTimer.restart(()=>{this.setError(Ut("UNSUBSCRIBED"))},this.unsubscribeDebounceMs)}getLoadMoreSeq(){var t;const e=(t=this.lastEmitSeq)!=null?t:0,r=this.mostRecentState.seq;return Math.max(e,r)+1e-6}emit(t){return U(this,null,function*(){var e;if(this.onlyUsedInternally||this.lastEmitSeq&&this.lastEmitSeq>=t||((e=this.lastEmitResult)==null?void 0:e.ok)===!1)return;this.lastEmitSeq=t;const r=yield this.getDeep(t);r!==this.lastEmitResult&&(this.lastEmitResult=r,this.listeners.forEach(i=>i(r)))})}}class CR{constructor(){this.timerId=void 0}restart(t,e){this.timerId!==void 0&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>t(),e)}stop(){clearTimeout(this.timerId)}}class bR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.userId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e4}fetchInitial(t){return U(this,null,function*(){const e=yield this.realtimeClient.call("GET",["users",this.userId],{includePrivateFields:!1},{bypassCache:!0});return e.ok?X({snapshot:this.realtimeClient.createUserSnapshot(e.value.data),lastChanged:t}):e.where==="server"&&e.value.status===404?X({snapshot:null,lastChanged:t}):e})}equal(t,e){return be(t.snapshot,e.snapshot)}loadNested(t,e){return U(this,null,function*(){return X(e)})}userCreated(t,e){this.mutate(t,r=>r.value.snapshot!==null?r:X({snapshot:this.realtimeClient.createUserSnapshot(e.state),lastChanged:t}))}userEdited(t,e){this.mutate(t,r=>{const i=r.value.snapshot;return i===null?(console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."),r):X({snapshot:{id:i.id,name:Ht(i.name,e.diff.name),custom:op(i.custom,e.diff.custom),locale:Ht(i.locale,e.diff.locale),photoUrl:Ht(i.photoUrl,e.diff.photoUrl),role:Ht(i.role,e.diff.role),welcomeMessage:Ht(i.welcomeMessage,e.diff.welcomeMessage)},lastChanged:t})})}getFromCache(){return U(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok?t.value.snapshot===null?Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["That user does not exist yet"]}):X({status:200,data:{id:t.value.snapshot.id,name:t.value.snapshot.name,custom:t.value.snapshot.custom,locale:t.value.snapshot.locale,photoUrl:t.value.snapshot.photoUrl,role:t.value.snapshot.role,welcomeMessage:t.value.snapshot.welcomeMessage}}):Ut("NOT_IN_CACHE")})}teardownNested(t){}anyChildChanged(t,e,r){return U(this,null,function*(){return!1})}}var Fy,du={};function Uy(n,t){const e=t.lastIndex;let r;const i=[];for(;(r=t.exec(n))!==null;)i.push(r);return t.lastIndex=e,i}function hu(n){const t=n.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function sp(n,t){n()||t||(t=n.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}(function(){if(Fy)return du;function n(e){return String.fromCharCode(parseInt(e.slice(1),16))}function t(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Fy=1,Object.defineProperty(du,"__esModule",{value:!0}),du.encode=function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,n))},du.decode=function(e){return decodeURIComponent(Array.from(atob(e),t).join(""))}})(),(n=>{function t(e,r){(function(i,o){switch(o){case"undefined":return i===void 0;case String:return typeof i=="string"||i instanceof String;case Boolean:return typeof i=="boolean"||i instanceof Boolean;case Number:return typeof i=="number"||i instanceof Number;default:return i instanceof o}})(e,r)||(r.name,String(e))}n.defined=function(e){},n.has=function(e,r){e[r]},n.is=t,n.equals=function(e,r){},n.oneOf=function(e,r){r.includes(e)||JSON.stringify(r)},n.isArray=function(e,r){t(e,Array),e&&e.length>0&&t(e[0],r)},n.optional=function(e,r){e!==void 0&&t(e,r)},n.falsy=function(e){},n.never=function(e){}})(sp||(sp={}));const ap=sp,IR=/^\/.*[^\\]\/[im]*$/;function Hy(n){return!!IR.test(n)&&!lp(n).test("")}function lp(n){const t=n.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${n} to be a (non-empty) regex`);let e=t[2]||"";return e=e.replace(/[^im]/g,"")+"g",new RegExp(t[1],e)}class wR{constructor({mode:t,allowedHostnames:e,allowedPhoneNrs:r,allowedMatches:i,forbiddenMatches:o,suppressLinks:s,suppressEmailAddresses:a,suppressPhoneNumbers:l,replacement:u}){ap.oneOf(t,["all","otherOnly","off"]),this.mode=t,this.suppressLinks=s!==!1,this.suppressEmailAddresses=a!==!1,this.suppressPhoneNumbers=l!==!1,this.allowedHostnames=e||[],this.allowedPhoneNrs=(r||[]).filter(c=>c).map(c=>c.replace(/[^0-9]/g,"")),this.allowedMatches=(i||[]).filter(Hy).map(c=>lp(c)),this.forbiddenMatches=(o||[]).filter(Hy).map(c=>lp(c)),ap(()=>this.allowedMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),ap(()=>this.forbiddenMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u==null?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:t}){return this.mode==="all"||this.mode==="otherOnly"&&!t}}function pu(n,t){return n.map(e=>function(r,i){if(r.type==="text")return fu(r.children,function(o){var s,a,l,u,c,d,h,p,f,m,g,E;let A="";return o.t&&(A=`(${o.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:(s=o.formattedLinks)!=null?s:"plaintext",markup:(a=o.markup)!=null&&a,useFallbackMentions:(l=o.useFallbackMentions)!=null&&l,sameTabLinkRules:(u=o.sameTabLinkRules)!=null?u:[],enableEmojiImageFallback:(c=o.enableEmojiImageFallback)!=null&&c,highlight:(d=o.highlight)!=null?d:[],contactInfo:(h=o.contactInfo)!=null&&h,suppression:(p=o.suppression)!=null?p:new wR({mode:"off"}),contactInfoHiddenText:(g=(m=o.contactInfoHiddenText)!=null?m:(f=o.suppression)==null?void 0:f.replacement)!=null?g:A,customEmojiUrls:(E=o.customEmojiUrls)!=null?E:{}}}(i));if(r.type==="file"&&r.subtype==="video")return`🎥 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="image")return`📷 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="audio")return`🎧 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="voice"){const o=r.duration;return o===void 0?"🎙️":`🎙️ (${Math.floor(o/60)}:${Math.floor(o%60).toString().padStart(2,"0")})`}return r.type==="file"?(r.subtype,`📎 ${hu(r.url)}`):r.type==="location"?"📍":""}(e,t)).join(`
1311
+ `;case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"emoji":case"customemoji":case"customEmoji":return e.text;case"suppressed":return t.contactInfoHiddenText;case"mention":return`@${e.text}`}}).join("")}function by(){const n=typeof window!="undefined"?window.crypto:void 0,t=n?()=>n.getRandomValues(new Uint8Array(1))[0]:()=>Math.floor(255*Math.random());return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^t()&15>>e/4).toString(16))}class rR{constructor(t,e,r,i,o){this.store=t,this.talkSession=e,this.editorInternals=r,this.onSendMessage=i,this.onDeleteMessage=o}async deleteMessage(t){const e=this.store.state$.extCurrentConversationId.peek(),r=this.store.state$.messages.child(e).lookup.child(t).peek(),i=this.talkSession.conversation(e).message(t),[o]=await Promise.all([r!=null?r:i.get(),i.delete()]);if(o){const s={currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek(),message:r};this.onDeleteMessage(s)}}setEditing(t){this.store.state$.editingMessageId.set(t)}async editMessage(t,e){const r=this.store.state$.extCurrentConversationId.peek();await this.talkSession.conversation(r).message(t).edit(e)}setReferencedMessage(t){this.store.state$.referencedMessageId.set(t)}async sendMessage(t){const e=this.store.state$.extCurrentConversationId.peek(),r=await async function(s,a){var m,g,E,A,v;const l=s.state$.extCurrentConversationId.peek(),u=s.state$.messages.child(l),c=typeof a.referencedMessage=="string"?u.lookup.child(a.referencedMessage).peek():await((g=(m=a.referencedMessage)==null?void 0:m.get())!=null?g:null),d=c&&{...c,type:"UserMessage",sender:c.sender,referencedMessageId:(A=(E=c.referencedMessage)==null?void 0:E.id)!=null?A:null};d&&delete d.referencedMessage;const h=s.latestFileUpload,p="content"in a?[Iy(h,a.content[0])]:[iR(a.text)],f="text"in a?a.text:nR(a.content.map(_=>Iy(h,_)),{});return{id:"ephemeral-"+by(),type:"UserMessage",sender:s.currentUser$.peek(),createdAt:Date.now(),editedAt:null,custom:(v=a.custom)!=null?v:{},origin:"web",referencedMessage:d,reactions:[],content:p,plaintext:f}}(this.store,t);this.store.state$.ephemeralMessages.child(e).child(r.id).set(r);const i=ea();this.store.readyForNewMessagesPromise=i.promise;const o=await this.talkSession.conversation(e).send(t);this.store.state$.ephemeralMessageIdMapping.child(e).child(o.id).set(r.id),i.resolve(),this.onSendMessage({message:await o.get(),currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek()})}sendFileMessage(t){const e={type:"file",fileToken:t.fileToken};return this.sendMessage({content:[e],custom:t.custom})}sendLocationMessage(t){const e={type:"location",latitude:t.location.latitude,longitude:t.location.longitude};return this.sendMessage({content:[e],custom:t.custom})}getMessageFieldText(){return this.editorInternals.getText()}setMessageFieldText(t){this.editorInternals.setText(t)}markAsTyping(){const t=this.store.state$.extCurrentConversationId.peek();this.talkSession.conversation(t).markAsTyping()}async toggleReaction(t,e){this.store.state$.extCurrentConversationId.peek();const r=this.getReactionRef(t,e.emoji);e.currentUserReacted?await r.remove():await r.add()}async addReaction(t,e){this.store.state$.extCurrentConversationId.peek(),await this.getReactionRef(t,e).add()}getReactionRef(t,e){const r=this.store.state$.extCurrentConversationId.peek();return this.talkSession.conversation(r).message(t).reaction(e)}}const iR=n=>({type:"text",children:function(e){return F0(e,{except:["FormattedLink","Actions"]})}(n)});function Iy(n,t){switch(t.type){case"text":case"location":return t;case"file":return function(e,r){return{type:"file",subtype:e.type==="file"?void 0:e.type,...e.metadata,size:e.file.size,filename:e.file.name,fileToken:r.fileToken,url:e.temporaryBlobUrl}}(n,t)}}var wy,oR=Object.defineProperty,sR=Object.defineProperties,aR=Object.getOwnPropertyDescriptors,ou=Object.getOwnPropertySymbols,Ry=Object.prototype.hasOwnProperty,Dy=Object.prototype.propertyIsEnumerable,ky=(n,t,e)=>t in n?oR(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,_t=(n,t)=>{for(var e in t||(t={}))Ry.call(t,e)&&ky(n,e,t[e]);if(ou)for(var e of ou(t))Dy.call(t,e)&&ky(n,e,t[e]);return n},On=(n,t)=>sR(n,aR(t)),Ly=(n,t)=>{var e={};for(var r in n)Ry.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&ou)for(var r of ou(n))t.indexOf(r)<0&&Dy.call(n,r)&&(e[r]=n[r]);return e},H=(n,t,e)=>new Promise((r,i)=>{var o=l=>{try{a(e.next(l))}catch(u){i(u)}},s=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((e=e.apply(n,t)).next())});function xt(n,t){if(t.ok)return t.value.data;throw t.value==="SESSION_DESTROYED"?new Error(`${n} failed because the session was destroyed`):t.where==="server"?new Error(na(n,t.value)):"unreachable"}function na(n,t){let e;return e=Array.isArray(t.reasons)?t.reasons.join():JSON.stringify(t.reasons),`${n} failed, got status ${t.status} ${t.errorCode}, reasons: ${e}`}function ln(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(t[e]!=="*"&&n[e]!==t[e])return!1;return!0}function xy(n){return n<=0?Promise.resolve():new Promise(t=>setTimeout(t,n))}function rp(n,t){return n*(1-t+2*Math.random()*t)}const lR=()=>!0;function My(n,t,e){return H(this,arguments,function*(r,i,{initialDelay:o,maxDelay:s,log:a,shouldRetry:l=lR}){return i().catch(u=>H(this,null,function*(){if(r===0||!(yield l(u)))throw u;const c=1e3*o*1.2,d=rp(s?Math.min(1e3*s,c):c,.05);return xy(d).then(()=>My(r-1,i,{initialDelay:d/1e3,maxDelay:s,log:a,shouldRetry:l}))}))})}function yi(){const n={},t=new Promise(function(e,r){n.resolve=e,n.reject=r});return n.promise=t,n}class su{constructor(t,e,r){this.layer=t,this.states=e,this.transitions=r,this._state=e[0]}get state(){return this._state}transition(t){const e=this.transitions[t];if(!e||!this.canTransition(t))return;const r=this.state;this._state=e.to,e.afterTransition({from:r,to:this.state})}canTransition(t){const e=this.transitions[t];return!!e&&(e.from==="ANY"||e.from.includes(this.state))}}function G(n){return{ok:!0,value:n}}function Ut(n){return{ok:!1,where:"client",value:n}}function Ti(n){return{ok:!1,where:"server",value:n}}function ra(){const n={},t=new Promise(e=>{n.ok=r=>H(this,null,function*(){return e(G(r))}),n.clientErr=r=>e(Ut(r)),n.serverErr=r=>e(Ti(r)),n.resolve=r=>e(r)});return n.promise=t,n}class uR{constructor(t,e){this.realtimeUrl=t,this.handlers=e,this.socket=null,this.stateMachine=new su("ReconnectingSocket",["STOPPED","CONNECTING","READY","DISCONNECTED","TERMINATED"],{startWs:{from:["STOPPED","DISCONNECTED"],to:"CONNECTING",afterTransition:()=>{const r=new(function(){if(globalThis.WebSocket)return globalThis.WebSocket;throw new Error("Missing WebSocket implementation")}())(this.realtimeUrl+"&talkjs-time="+Date.now());this.socket=r,r.addEventListener("open",()=>{this.socket===r&&this.stateMachine.transition("onOpen")}),r.addEventListener("close",()=>{this.socket===r&&this.stateMachine.transition("onClose")}),r.addEventListener("message",i=>{this.socket===r&&this.handlers.onMessage(i)})}},onOpen:{from:["CONNECTING"],to:"READY",afterTransition:()=>{this.handlers.onOpen()}},onClose:{from:["CONNECTING","READY"],to:"DISCONNECTED",afterTransition:r=>H(this,[r],function*({from:i}){i==="READY"&&this.handlers.onClose(),this.socket=null;const o=rp(1e4,.5);setTimeout(()=>{this.stateMachine.state==="DISCONNECTED"&&this.stateMachine.transition("startWs")},o)})},stopWs:{from:["CONNECTING","DISCONNECTED","READY"],to:"STOPPED",afterTransition:({from:r})=>{r==="READY"&&this.handlers.onClose();const i=this.socket;this.socket=null,i==null||i.close(1e3)}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{const r=this.socket;this.socket=null,r==null||r.close(1e3)}}})}stopWs(){this.stateMachine.transition("stopWs")}startWs(){this.stateMachine.transition("startWs")}send(t){return this.stateMachine.state==="READY"?(this.socket.send(t),G(void 0)):Ut("SOCKET_NOT_READY")}terminate(){const t=this.socket;this.stateMachine.canTransition("onClose")&&this.stateMachine.transition("onClose"),t&&("terminate"in t?t.terminate():t.close(1e3))}destroy(){this.stateMachine.transition("destroy")}}class cR{constructor(t,e){this.handlers=e,this.socket=new uR(t,{onOpen:()=>this.handlers.onOpen(),onClose:()=>this.handlers.onClose(),onMessage:r=>this.onWebSocketMessage(r)})}call(t,e,r,i){const o=`/${r.map(a=>encodeURIComponent(a)).join("/")}`,s=JSON.stringify([t,e,o,i]);return this.socket.send(s)}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.socket.destroy()}terminate(){this.socket.terminate()}onWebSocketMessage(t){if(t.data!=="Auth token expired")try{const e=JSON.parse(t.data);if(e[1]==="PUBLISH"){const r=e[0],i=JSON.stringify([r,"ACK"]);this.socket.send(i);const o=e.slice(2),s=[];o.forEach(a=>{a.type==="session.expired"?this.handlers.onAuthExpired():a.type==="upstream.restarting"?this.handlers.onUpstreamRestarting():s.push(a)}),s.length>0&&this.handlers.onPublish(r,s)}else{const r=e[0],i=e[1],o=e[2];this.handlers.onResponse(r,i,o)}}catch(e){}else this.handlers.onAuthExpired()}}class au{constructor(t){this.delayMs=t,this.timeout=void 0}schedule(t){this.stop(),this.timeout=setTimeout(()=>{this.timeout!==void 0&&(this.stop(),t())},this.delayMs)}stop(){this.timeout!==void 0&&(clearTimeout(this.timeout),this.timeout=void 0)}}class dR{constructor(){this.i=-1}next(){return this.i++,this.i}reset(){this.i=-1}}class hR{constructor(t,e){this.handlers=e,this.seqCounter=new dR,this.responseHandlers={},this.heartbeats=new pR(this),this.socket=new cR(t,{onUpstreamRestarting:()=>{this.heartbeats.serverActive(),this.handlers.onUpstreamRestarting()},onOpen:()=>{this.heartbeats.clientActive(),this.heartbeats.serverActive(),this.handlers.onReady()},onClose:()=>{this.heartbeats.stop(),Object.values(this.responseHandlers).forEach(r=>{r.clientErr("WEBSOCKET_DISCONNECTED")}),this.responseHandlers={},this.seqCounter.reset(),this.handlers.onNotReady()},onResponse:(r,i,o)=>{this.heartbeats.serverActive(),this.onResponse(r,i,o)},onPublish:(r,i)=>{this.heartbeats.serverActive(),this.handlers.onPublish(r,i),this.heartbeats.clientActive()},onAuthExpired:()=>{this.heartbeats.serverActive(),this.handlers.onAuthExpired()}})}call(t,e,r){const i=this.seqCounter.next(),o=ra();this.responseHandlers[i]=o;const s=this.socket.call(i,t,e,r);return s.ok||o.resolve(s),this.heartbeats.clientActive(),o.promise}onResponse(t,e,r){return H(this,null,function*(){const i=this.responseHandlers[t];i&&(e===200?i.ok({status:e,data:r}):i.serverErr({status:e,errorCode:r.errorCode,reasons:r.reasons}),delete this.responseHandlers[t])})}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.heartbeats.stop(),Object.values(this.responseHandlers).forEach(t=>{t.clientErr("WEBSOCKET_DISCONNECTED")}),this.responseHandlers={},this.socket.destroy()}terminate(){this.socket.terminate()}}class pR{constructor(t){this.connection=t,this.clientInactivityTimer=new au(25e3),this.serverInactivityTimer=new au(1e4),this.serverTimeoutTimer=new au(5e3)}clientActive(){this.clientInactivityTimer.schedule(()=>{this.sendHeartbeat()})}serverActive(){this.serverTimeoutTimer.stop(),this.serverInactivityTimer.schedule(()=>{this.sendHeartbeat(),this.serverTimeoutTimer.schedule(()=>{this.connection.terminate()})})}stop(){this.clientInactivityTimer.stop(),this.serverInactivityTimer.stop(),this.serverTimeoutTimer.stop()}sendHeartbeat(){this.connection.call("GET",["ping"],{}).catch(()=>{})}}class fR{constructor(t,e,r){this.authProvider=e,this.handlers=r,this.stateMachine=new su("AuthenticatedConnection",["WAITING_FOR_WS","LOGGING_IN","RENEWING_SESSION","READY","TERMINATED"],{logIn:{from:["WAITING_FOR_WS"],to:"LOGGING_IN",afterTransition:()=>H(this,null,function*(){yield this.renewSession()})},logInFailed:{from:["LOGGING_IN"],to:"LOGGING_IN",afterTransition:()=>H(this,null,function*(){this.authProvider.refreshToken(),yield this.renewSession()})},scheduledReauth:{from:["READY"],to:"RENEWING_SESSION",afterTransition:()=>H(this,null,function*(){yield this.renewSession()})},scheduledReauthFailed:{from:["RENEWING_SESSION"],to:"RENEWING_SESSION",afterTransition:()=>H(this,null,function*(){this.authProvider.refreshToken(),yield this.renewSession()})},authenticated:{from:["LOGGING_IN","RENEWING_SESSION"],to:"READY",afterTransition:({from:i})=>{i==="LOGGING_IN"&&this.handlers.onReady()}},authExpired:{from:["READY","RENEWING_SESSION"],to:"LOGGING_IN",afterTransition:()=>H(this,null,function*(){this.handlers.onNotReady(),this.authProvider.refreshToken(),yield this.renewSession()})},wsDisconnected:{from:["READY","LOGGING_IN","RENEWING_SESSION"],to:"WAITING_FOR_WS",afterTransition:({from:i})=>{i!=="READY"&&i!=="RENEWING_SESSION"||this.handlers.onNotReady(),this.authProvider.clearScheduledRefresh()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.authProvider.clearScheduledRefresh(),this.connection.destroy()}}}),this.connection=new hR(t,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onReady:()=>this.stateMachine.transition("logIn"),onNotReady:()=>{this.stateMachine.transition("wsDisconnected")},onAuthExpired:()=>{this.stateMachine.transition("authExpired")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}}),e.onTokenChanged(()=>{this.stateMachine.state==="READY"&&this.stateMachine.transition("scheduledReauth")})}call(t,e,r){const i=this.connection.call(t,e,r);return i.then(o=>{o.ok||o.where!=="server"||o.value.status!==401||this.stateMachine.state!=="READY"&&this.stateMachine.state!=="RENEWING_SESSION"||this.stateMachine.transition("authExpired")}),i}stopWs(){this.connection.stopWs()}startWs(){this.connection.startWs()}destroy(){this.stateMachine.transition("destroy")}renewSession(){return H(this,null,function*(){const t=yield this.authProvider.getToken(),e=yield this.connection.call("POST",["session","renew"],{token:t});if(!e.ok&&e.where==="client")return;const r=e.value;if(r.status,r.status===200){const o=r.data.expiresInSeconds;return void(o!==null&&o<120?(console.warn(`[TalkJS] Authenticated with a token that expires in ${o}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`),this.stateMachine.state==="LOGGING_IN"?this.stateMachine.transition("logInFailed"):this.stateMachine.state==="RENEWING_SESSION"&&this.stateMachine.transition("scheduledReauthFailed")):(this.authProvider.scheduleRefresh(o),this.authProvider.emitTokenAccepted(t),this.stateMachine.canTransition("authenticated")&&this.stateMachine.transition("authenticated")))}if(r.status===401)return void(this.stateMachine.state==="LOGGING_IN"?this.stateMachine.transition("logInFailed"):this.stateMachine.state==="RENEWING_SESSION"&&this.stateMachine.transition("scheduledReauthFailed"));if(r.status===400)return void this.authProvider.emitTokenRefreshFailed(na("Authentication",r));if(r.status===402)return void this.authProvider.emitTokenRefreshFailed(na("Authentication",r));const i=5e3*Math.random()+5e3;setTimeout(()=>{this.call("POST",["session","renew"],{token:t}).catch(()=>{})},i)})}}class mR{constructor(t,e,r){this.handlers=r,this.stateMachine=new su("StopStartConnection",["STOPPED","WAITING_FOR_WS","READY","TERMINATED"],{unexpectedDisconnect:{from:["READY"],to:"WAITING_FOR_WS",afterTransition:()=>{this.inactivityTimer.stop(),this.handlers.onNotReady()}},stop:{from:["WAITING_FOR_WS","READY"],to:"STOPPED",afterTransition:()=>{this.connection.stopWs(),this.inactivityTimer.stop(),this.handlers.onNotReady()}},start:{from:["STOPPED"],to:"WAITING_FOR_WS",afterTransition:()=>{this.connection.startWs()}},ready:{from:["WAITING_FOR_WS"],to:"READY",afterTransition:()=>{this.pendingCalls=0,this.activeSubscriptions=0,this.inactivityTimer.schedule(()=>{this.stateMachine.transition("stop")}),this.handlers.onReady()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.inactivityTimer.stop(),this.connection.destroy()}}}),this.pendingCalls=0,this.activeSubscriptions=0,this.inactivityTimer=new au(3e3),this.connection=new fR(t,e,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("ready")},onNotReady:()=>{this.stateMachine.state==="READY"&&this.stateMachine.transition("unexpectedDisconnect")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}get inactive(){return this.pendingCalls===0&&this.activeSubscriptions===0}ensureStarted(){this.stateMachine.canTransition("start")&&this.stateMachine.transition("start")}call(t,e,r){return H(this,null,function*(){this.inactivityTimer.stop(),this.pendingCalls++;const i=yield this.connection.call(t,e,r);return this.pendingCalls--,t==="SUBSCRIBE"&&i.ok?this.activeSubscriptions++:t==="UNSUBSCRIBE"&&i.ok&&this.activeSubscriptions--,this.inactive&&this.inactivityTimer.schedule(()=>{this.stateMachine.transition("stop")}),i})}destroy(){this.stateMachine.transition("destroy")}isConnected(){return this.stateMachine.state==="READY"}}class gR{constructor(t,e,r){this.handlers=r,this.stateMachine=new su("QueuedConnection",["NOT_READY","PROCESSING_QUEUE","READY","TERMINATED"],{processQueue:{from:["NOT_READY"],to:"PROCESSING_QUEUE",afterTransition:()=>{this.sendQueuedCalls()}},ready:{from:["PROCESSING_QUEUE"],to:"READY",afterTransition:()=>{this.handlers.onReady()}},notReady:{from:["PROCESSING_QUEUE","READY"],to:"NOT_READY",afterTransition:()=>{Object.values(this.subscribeQueue).forEach(i=>i.deferred.ok({status:200,data:{}})),this.subscribeQueue={},this.handlers.onSubscriptionsLost()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{for(var i;this.callQueue.length;){const o=(i=this.callQueue.shift())==null?void 0:i.deferred;o==null||o.clientErr("SESSION_DESTROYED")}this.connection.destroy()}}}),this.subscribeQueue={},this.callQueue=[],this.connection=new mR(t,e,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("processQueue")},onNotReady:()=>{this.stateMachine.transition("notReady")},onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}call(t,e,r){return this.stateMachine.state==="READY"?this.connection.call(t,e,r):(this.stateMachine.state==="NOT_READY"&&this.connection.ensureStarted(),t==="SUBSCRIBE"||t==="UNSUBSCRIBE"?this._subscribe(t,e,r):this._call(t,e,r))}_subscribe(t,e,r){const i=e.join("/"),o=this.subscribeQueue[i];if(o&&o.method===t)return o.deferred.promise;o&&o.method!==t&&(o.deferred.ok({status:200,data:{}}),delete this.subscribeQueue[i]);const s={deferred:ra(),method:t,path:e,data:r};return this.subscribeQueue[i]=s,s.deferred.promise}_call(t,e,r){const i={deferred:ra(),method:t,path:e,data:r};return this.callQueue.push(i),i.deferred.promise}dequeue(){for(const t in this.subscribeQueue){const e=this.subscribeQueue[t];return delete this.subscribeQueue[t],e}return this.callQueue.shift()}destroy(){this.stateMachine.transition("destroy")}sendQueuedCalls(){return H(this,null,function*(){let t=0;for(;this.stateMachine.state==="PROCESSING_QUEUE";){t++;const e=this.dequeue();if(!e)return void this.stateMachine.transition("ready");this.connection.call(e.method,e.path,e.data).then(r=>{e.deferred.resolve(r)}),t>50&&(yield new Promise(r=>setTimeout(r,100)))}})}isConnected(){return this.stateMachine.state==="READY"||this.stateMachine.state==="PROCESSING_QUEUE"}}const ER=typeof window!="undefined"&&(wy=window.queueMicrotask)!=null?wy:setTimeout;class Py{constructor(t,e){this.clearPendingBatch=t,this.sendCalls=e,this.sent=!1,ER(()=>this.send())}send(){this.sent||(this.sent=!0,this.clearPendingBatch(),this.sendCalls())}destroy(){this.sent=!0}}class lu extends Py{constructor(t,e){super(e,()=>{this.sendSubscribe(),this.sendGet()}),this.connection=t,this.getCalls=[],this.subscribeCalls=[]}canPush(t,e){return lu.isCorrectBatchTypeFor(t,e)}static isCorrectBatchTypeFor(t,e){return ln(e,["users","*"])&&(t==="GET"||t==="SUBSCRIBE")}push(t,e,r){const i=e[1],o=ra();return t==="GET"?this.getCalls.push({userId:i,deferred:o}):this.subscribeCalls.push({userId:i,deferred:o}),this.getCalls.length!==1e3&&this.subscribeCalls.length!==1e3||this.send(),o.promise}sendGet(){return H(this,null,function*(){if(this.getCalls.length===0)return;const t=[...new Set(this.getCalls.map(r=>r.userId))],e=yield this.connection.call("GET",["users"],{ids:t,includePrivateFields:!1});if(e.ok)for(const r of this.getCalls){const i=e.value.data[r.userId];i?r.deferred.ok({status:200,data:i}):r.deferred.serverErr({status:404,errorCode:"NOT_FOUND",reasons:["No user with that ID exists"]})}else this.getCalls.forEach(r=>r.deferred.resolve(e))})}sendSubscribe(){if(this.subscribeCalls.length===0)return;const t=[...new Set(this.subscribeCalls.map(e=>e.userId))];this.connection.call("SUBSCRIBE",["users"],{ids:t}).then(e=>this.subscribeCalls.forEach(r=>r.deferred.resolve(e)))}}class uu extends Py{constructor(t,e,r){super(r,()=>this.sendMutate()),this.conversationId=t,this.connection=e,this.calls=[]}canPush(t,e){return!!uu.isCorrectBatchTypeFor(t,e)&&e[1]===this.conversationId}static isCorrectBatchTypeFor(t,e){return ln(e,["conversations","*","participants","*"])&&(t==="PUT"||t==="POST"||t==="PATCH")}push(t,e,r){const i=e[3],o=ra();return this.calls.push({action:{id:i,method:t,params:r},deferred:o}),this.calls.length===100&&this.send(),o.promise}sendMutate(){return H(this,null,function*(){const t=this.calls.map(i=>i.action),e=yield this.connection.call("POST",["conversations",this.conversationId,"participants"],{actions:t});if(!e.ok)return void this.calls.forEach(i=>i.deferred.resolve(e));const r=e.value.data.responses;for(let i=0;i<r.length;i++){const o=this.calls[i].deferred,s=r[i];s.status===200?o.ok(On(_t({},s),{data:{}})):o.serverErr(s)}})}}class AR{constructor(t,e,r){this.pendingBatch=null,this.connection=new gR(t,e,r)}call(t,e,r){return H(this,null,function*(){var i;if((i=this.pendingBatch)!=null&&i.canPush(t,e))return this.pendingBatch.push(t,e,r);this.pendingBatch&&this.pendingBatch.send();const o=this.createEmptyBatchFor(t,e);return o?(this.pendingBatch=o,o.push(t,e,r)):this.connection.call(t,e,r)})}destroy(){var t;this.connection.destroy(),(t=this.pendingBatch)==null||t.destroy()}isConnected(){return this.connection.isConnected()}createEmptyBatchFor(t,e){if(lu.isCorrectBatchTypeFor(t,e))return new lu(this.connection,()=>this.pendingBatch=null);if(uu.isCorrectBatchTypeFor(t,e)){const r=e[1];return new uu(r,this.connection,()=>this.pendingBatch=null)}return null}}const vR={200:"RESOLVE",400:"RESOLVE",401:"RETRY",402:"RESOLVE",403:"RESOLVE",404:"RESOLVE",405:"RESOLVE",409:"RESOLVE",429:"DELAY",500:"DELAY"};class _R{constructor(t,e,r){this.throttler=new yR,this.alive=!0,this.connection=new AR(t,e,r)}call(t,e,r){return H(this,null,function*(){let i=0;for(;this.alive;){const o=yield this.connection.call(t,e,r);if((o.ok||o.where!=="client"||o.value!=="SOCKET_NOT_READY")&&(o.ok||o.where!=="server"||o.value.status!==500)||i++,i===10)return o;if(o.ok||o.where!=="client"){const s=o.value,a=s.status,l=vR[a];if(l==="RESOLVE")return this.throttler.resetDelay(),o;if(l==="RETRY")continue;if(l==="DELAY"){yield this.throttler.wait();continue}return console.warn("[TalkJS] Unexpected status code",a),s}if(o.value==="SESSION_DESTROYED")return Ut("SESSION_DESTROYED");o.value!=="WEBSOCKET_DISCONNECTED"&&(o.value!=="SOCKET_NOT_READY"?o.value:yield this.throttler.wait())}return Ut("SESSION_DESTROYED")})}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}}class yR{constructor(){this.initialDelayMs=200,this.exponentialFactor=1.2,this.maxDelayMs=3e4,this.currentDelayMs=this.initialDelayMs,this.lastCall=0}getCurrentDelay(){return this.currentDelayMs}wait(){const t=new Date().getTime(),e=rp(this.currentDelayMs,.05),r=this.lastCall+e,i=Math.max(0,r-t);return this.lastCall=t+i,this.currentDelayMs=Math.min(e*this.exponentialFactor,this.maxDelayMs),xy(i)}resetDelay(){this.currentDelayMs=this.initialDelayMs}}function ip(n){return n.map(t=>encodeURIComponent(t)).join()}class TR{constructor(){this.paths={}}add(t){this.paths[ip(t)]=t}delete(t){delete this.paths[ip(t)]}has(t){return Object.hasOwnProperty.call(this.paths,ip(t))}clear(){this.paths={}}forEach(t){Object.values(this.paths).forEach(e=>t(e))}}class OR{constructor(t,e,r){this.handlers=r,this.targetSubscriptions=new TR,this.connection=new _R(t,e,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onSubscriptionsLost:()=>{this.targetSubscriptions.forEach(i=>{this.resubscribe(i)}),this.handlers.onResubscribeSent()},onReady:()=>this.handlers.onReady(),onPublish:(i,o)=>{this.handlers.onPublish(i,o)}})}call(t,e,r){return this.connection.call(t,e,r)}subscribe(t){return H(this,null,function*(){return this.targetSubscriptions.add(t),this.connection.call("SUBSCRIBE",t,{})})}unsubscribe(t){return H(this,null,function*(){return this.targetSubscriptions.delete(t),this.connection.call("UNSUBSCRIBE",t,{})})}resubscribe(t){return H(this,null,function*(){const e=yield this.connection.call("SUBSCRIBE",t,{});e.ok||this.handlers.onResubscribeError(t,e)})}destroy(){this.targetSubscriptions.clear(),this.connection.destroy()}isConnected(){return this.connection.isConnected()}}function Ht(n,t){return t===void 0?n:t}function op(n,t){if(t===void 0)return n;if(t===null)return{};const e=_t({},n);for(const r in t){const i=t[r];i===null?delete e[r]:e[r]=i}return e}function be(n,t){if(n===t)return!0;if(!n||!t||typeof n!="object"||typeof t!="object"||n.constructor!==t.constructor)return!1;if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(!be(n[e],t[e]))return!1}else{const e=Object.keys(n);if(e.length!==Object.keys(t).length)return!1;for(const r of e)if(!Object.hasOwnProperty.call(t,r)||!be(n[r],t[r]))return!1}return!0}class By{constructor(){this.prev=Promise.resolve()}runExclusive(t){return H(this,null,function*(){const e=this.prev.then(()=>t());return this.prev=e,e})}}class SR{constructor(t){this.initialised=!1,this.getPointer=void 0,this.pendingStates=[t],t.resultPromise.then(()=>this.initialised=!0)}get pendingPointer(){if(this.pendingStates.length!==0)return this.pendingStates[this.pendingStates.length-1]}get mostRecentState(){var t;return(t=this.pendingPointer)!=null?t:this.getPointer}canAppendState(t){var e,r;const i=(e=this.getPointer)==null?void 0:e.seq;if(i!==void 0&&t<=i)return!1;const o=(r=this.pendingPointer)==null?void 0:r.seq;return!(o!==void 0&&t<o)}set(t){if(!this.canAppendState(t.seq))throw"Appending in the past";this.pendingStates.push(t)}mutate(t,e){if(!this.initialised)return;if(!this.canAppendState(t))throw"Mutating in the past";const r=this.mostRecentState.resultPromise.then(i=>i.ok?e(i):i);this.pendingStates.push({seq:t,resultPromise:r})}get(t){for(;this.pendingStates.length>0&&(this.getPointer===void 0||this.pendingStates[0].seq<=t);)this.getPointer=this.pendingStates.shift();return this.getPointer}}class NR extends SR{constructor(t,e){super(t),this.onTeardown=e,this._error=null,this._lastGoodState=Promise.resolve(void 0)}get error(){return this._error}get lastGoodState(){return this._lastGoodState}mutate(t,e){super.mutate(t,e),this.registerNewState(this.mostRecentState.resultPromise)}set(t){super.set(t),this.registerNewState(this.mostRecentState.resultPromise)}registerNewState(t){const e=this.lastGoodState;this._lastGoodState=t.then(r=>r.ok?r.value:e),t.then(r=>{r.ok||this.setError(r)})}setError(t){var e;this._error||(this._error=t,(e=this.onTeardown)==null||e.call(this,t),this.lastGoodState.then(r=>{r!==void 0&&this.teardownNested(r)}))}}class cu extends NR{constructor(t,e){const r=new Promise(i=>setTimeout(i)).then(()=>this.fetchInitial(t));super({seq:t,resultPromise:r},e),this.initialSeq=t,this.getDeepMutex=new By,this.lastDeep=void 0}refetchInitial(t){return H(this,null,function*(){const e=this.mostRecentState.resultPromise,r=this.fetchInitial(t),[i,o]=yield Promise.all([e,r]);return i!==void 0&&i.ok&&o.ok&&this.equal(i.value,o.value)?i:o})}refetch(t){if(this.error!==null)return;const e={seq:t,resultPromise:this.refetchInitial(t)};this.set(e)}changedBetween(t,e){return H(this,null,function*(){if(t>=e)return!1;const r=this.get(e),i=yield r.resultPromise;return!!i.ok&&(i.value.lastChanged>Math.max(this.initialSeq,t)&&i.value.lastChanged<=e||(yield this.anyChildChanged(t,e,i.value)))})}getDeep(t){return H(this,null,function*(){return this.getDeepMutex.runExclusive(()=>H(this,null,function*(){var e;if(this.error!==null)return this.error;const r=(e=this.lastDeep)==null?void 0:e.seq;if(t===r)return this.lastDeep.deep;if(r!==void 0){if(t<r)throw`Trying to load seq ${t} when we have previously loaded seq ${r}`;if(!(yield this.changedBetween(r,t)))return this.lastDeep.seq=t,this.lastDeep.deep}const i=this.get(t).resultPromise,o=i.then(a=>a.ok?this.loadNested(t,a.value):a);this.lastDeep={seq:t,shallow:i,deep:o};const s=yield o;return s.ok||this.setError(s),s}))})}}class Fr extends cu{constructor(t,e,r){super(t,r),this.emitMutex=e,this.unsubscribeTimer=new CR,this.referencedByOtherStores=0,this.listeners=[],this.lastEmitSeq=void 0,this.lastEmitResult=void 0,e.runExclusive(()=>H(this,null,function*(){yield this.emit(t)}))}registerInternalSubscription(){this.referencedByOtherStores++;let t=!0;return()=>{t&&(t=!1,this.referencedByOtherStores--,this.startUnsubscribeTimerIfOrphan())}}get onlyUsedInternally(){return this.listeners.length===0}listen(t){return this.unsubscribeTimer.stop(),this.listeners.push(t),this.lastEmitResult!==void 0&&t(this.lastEmitResult),()=>{this.listeners=this.listeners.filter(e=>e!==t),this.startUnsubscribeTimerIfOrphan()}}startUnsubscribeTimerIfOrphan(){this.referencedByOtherStores===0&&this.listeners.length===0&&this.unsubscribeTimer.restart(()=>{this.setError(Ut("UNSUBSCRIBED"))},this.unsubscribeDebounceMs)}getLoadMoreSeq(){var t;const e=(t=this.lastEmitSeq)!=null?t:0,r=this.mostRecentState.seq;return Math.max(e,r)+1e-6}emit(t){return H(this,null,function*(){var e;if(this.onlyUsedInternally||this.lastEmitSeq&&this.lastEmitSeq>=t||((e=this.lastEmitResult)==null?void 0:e.ok)===!1)return;this.lastEmitSeq=t;const r=yield this.getDeep(t);r!==this.lastEmitResult&&(this.lastEmitResult=r,this.listeners.forEach(i=>i(r)))})}}class CR{constructor(){this.timerId=void 0}restart(t,e){this.timerId!==void 0&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>t(),e)}stop(){clearTimeout(this.timerId)}}class bR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.userId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e4}fetchInitial(t){return H(this,null,function*(){const e=yield this.realtimeClient.call("GET",["users",this.userId],{includePrivateFields:!1},{bypassCache:!0});return e.ok?G({snapshot:this.realtimeClient.createUserSnapshot(e.value.data),lastChanged:t}):e.where==="server"&&e.value.status===404?G({snapshot:null,lastChanged:t}):e})}equal(t,e){return be(t.snapshot,e.snapshot)}loadNested(t,e){return H(this,null,function*(){return G(e)})}userCreated(t,e){this.mutate(t,r=>r.value.snapshot!==null?r:G({snapshot:this.realtimeClient.createUserSnapshot(e.state),lastChanged:t}))}userEdited(t,e){this.mutate(t,r=>{const i=r.value.snapshot;return i===null?(console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."),r):G({snapshot:{id:i.id,name:Ht(i.name,e.diff.name),custom:op(i.custom,e.diff.custom),locale:Ht(i.locale,e.diff.locale),photoUrl:Ht(i.photoUrl,e.diff.photoUrl),role:Ht(i.role,e.diff.role),welcomeMessage:Ht(i.welcomeMessage,e.diff.welcomeMessage)},lastChanged:t})})}getFromCache(){return H(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok?t.value.snapshot===null?Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["That user does not exist yet"]}):G({status:200,data:{id:t.value.snapshot.id,name:t.value.snapshot.name,custom:t.value.snapshot.custom,locale:t.value.snapshot.locale,photoUrl:t.value.snapshot.photoUrl,role:t.value.snapshot.role,welcomeMessage:t.value.snapshot.welcomeMessage}}):Ut("NOT_IN_CACHE")})}teardownNested(t){}anyChildChanged(t,e,r){return H(this,null,function*(){return!1})}}var Fy,du={};function Uy(n,t){const e=t.lastIndex;let r;const i=[];for(;(r=t.exec(n))!==null;)i.push(r);return t.lastIndex=e,i}function hu(n){const t=n.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function sp(n,t){n()||t||(t=n.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}(function(){if(Fy)return du;function n(e){return String.fromCharCode(parseInt(e.slice(1),16))}function t(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Fy=1,Object.defineProperty(du,"__esModule",{value:!0}),du.encode=function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,n))},du.decode=function(e){return decodeURIComponent(Array.from(atob(e),t).join(""))}})(),(n=>{function t(e,r){(function(i,o){switch(o){case"undefined":return i===void 0;case String:return typeof i=="string"||i instanceof String;case Boolean:return typeof i=="boolean"||i instanceof Boolean;case Number:return typeof i=="number"||i instanceof Number;default:return i instanceof o}})(e,r)||(r.name,String(e))}n.defined=function(e){},n.has=function(e,r){e[r]},n.is=t,n.equals=function(e,r){},n.oneOf=function(e,r){r.includes(e)||JSON.stringify(r)},n.isArray=function(e,r){t(e,Array),e&&e.length>0&&t(e[0],r)},n.optional=function(e,r){e!==void 0&&t(e,r)},n.falsy=function(e){},n.never=function(e){}})(sp||(sp={}));const ap=sp,IR=/^\/.*[^\\]\/[im]*$/;function Hy(n){return!!IR.test(n)&&!lp(n).test("")}function lp(n){const t=n.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${n} to be a (non-empty) regex`);let e=t[2]||"";return e=e.replace(/[^im]/g,"")+"g",new RegExp(t[1],e)}class wR{constructor({mode:t,allowedHostnames:e,allowedPhoneNrs:r,allowedMatches:i,forbiddenMatches:o,suppressLinks:s,suppressEmailAddresses:a,suppressPhoneNumbers:l,replacement:u}){ap.oneOf(t,["all","otherOnly","off"]),this.mode=t,this.suppressLinks=s!==!1,this.suppressEmailAddresses=a!==!1,this.suppressPhoneNumbers=l!==!1,this.allowedHostnames=e||[],this.allowedPhoneNrs=(r||[]).filter(c=>c).map(c=>c.replace(/[^0-9]/g,"")),this.allowedMatches=(i||[]).filter(Hy).map(c=>lp(c)),this.forbiddenMatches=(o||[]).filter(Hy).map(c=>lp(c)),ap(()=>this.allowedMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),ap(()=>this.forbiddenMatches.every(c=>c.flags.includes("g")),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u==null?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:t}){return this.mode==="all"||this.mode==="otherOnly"&&!t}}function pu(n,t){return n.map(e=>function(r,i){if(r.type==="text")return fu(r.children,function(o){var s,a,l,u,c,d,h,p,f,m,g,E;let A="";return o.t&&(A=`(${o.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:(s=o.formattedLinks)!=null?s:"plaintext",markup:(a=o.markup)!=null&&a,useFallbackMentions:(l=o.useFallbackMentions)!=null&&l,sameTabLinkRules:(u=o.sameTabLinkRules)!=null?u:[],enableEmojiImageFallback:(c=o.enableEmojiImageFallback)!=null&&c,highlight:(d=o.highlight)!=null?d:[],contactInfo:(h=o.contactInfo)!=null&&h,suppression:(p=o.suppression)!=null?p:new wR({mode:"off"}),contactInfoHiddenText:(g=(m=o.contactInfoHiddenText)!=null?m:(f=o.suppression)==null?void 0:f.replacement)!=null?g:A,customEmojiUrls:(E=o.customEmojiUrls)!=null?E:{}}}(i));if(r.type==="file"&&r.subtype==="video")return`🎥 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="image")return`📷 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="audio")return`🎧 ${hu(r.url)}`;if(r.type==="file"&&r.subtype==="voice"){const o=r.duration;return o===void 0?"🎙️":`🎙️ (${Math.floor(o/60)}:${Math.floor(o%60).toString().padStart(2,"0")})`}return r.type==="file"?(r.subtype,`📎 ${hu(r.url)}`):r.type==="location"?"📍":""}(e,t)).join(`
1312
1312
 
1313
1313
  `)}function fu(n,t){return n.flatMap(e=>{if(typeof e=="string")return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return fu(e.children,t);case"bulletlist":case"bulletList":return`
1314
1314
  `+fu(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+fu(e.children,t)+`
1315
- `;case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"emoji":case"customemoji":case"customEmoji":return e.text;case"suppressed":return t.contactInfoHiddenText;case"mention":return`@${e.text}`}}).join("")}class xo extends cu{constructor(t,e,r,i){super(t),this.conversationId=e,this.message=r,this.realtimeClient=i}get messageId(){return typeof this.message=="string"?this.message:this.message.id}fetchInitial(t){return U(this,null,function*(){let e;if(typeof this.message=="object")e=this.message;else{const r=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"messages",this.message],{},{bypassCache:!0});if(!r.ok)return r;e=r.value.data}return X({lastChanged:t,sender:e.senderId===null?null:this.realtimeClient.internalSubscribe(["users",e.senderId]),data:{id:e.id,type:e.type,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,referencedMessageId:e.referencedMessageId,origin:e.origin,plaintext:pu(e.content,{}),content:e.content,reactions:up(e.reactions)}})})}refetch(t){throw"Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){return be(t.data,e.data)}teardownNested(t){var e;(e=t.sender)==null||e.unsubscribe()}anyChildChanged(t,e,r){return U(this,null,function*(){var i;const o=(i=r.sender)==null?void 0:i.store;return(yield o==null?void 0:o.changedBetween(t,e))===!0})}loadNested(t,e){return U(this,null,function*(){var r,i,o;const s=yield(i=(r=e.sender)==null?void 0:r.store)==null?void 0:i.getDeep(t);if((s==null?void 0:s.ok)===!1)return s;if(e.data===null)return X({snapshot:null});const a=s==null?void 0:s.value;return X({snapshot:{sender:(o=a==null?void 0:a.snapshot)!=null?o:null,id:e.data.id,type:e.data.type,custom:e.data.custom,createdAt:e.data.createdAt,editedAt:e.data.editedAt,origin:e.data.origin,plaintext:pu(e.data.content,{}),content:e.data.content,referencedMessageId:e.data.referencedMessageId,reactions:e.data.reactions}})})}messageEdited(t,e){this.mutate(t,r=>r.value.data===null?r:X({lastChanged:t,sender:r.value.sender,data:{id:r.value.data.id,type:r.value.data.type,createdAt:r.value.data.createdAt,origin:r.value.data.origin,referencedMessageId:r.value.data.referencedMessageId,editedAt:Ht(r.value.data.editedAt,e.diff.editedAt),custom:op(r.value.data.custom,e.diff.custom),content:Ht(r.value.data.content,e.diff.content),reactions:RR(r.value.data.reactions,e.diff.reactions)}}))}messageDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:this.messageId===e.messageId?(this.teardownNested(r.value),X({lastChanged:t,sender:null,data:null})):r.value.data.referencedMessageId===e.messageId?X({lastChanged:t,sender:r.value.sender,data:{id:r.value.data.id,type:r.value.data.type,createdAt:r.value.data.createdAt,origin:r.value.data.origin,referencedMessageId:null,editedAt:r.value.data.editedAt,custom:r.value.data.custom,content:r.value.data.content,reactions:r.value.data.reactions}}):r)}getFromCache(){return U(this,null,function*(){var t;const e=yield this.mostRecentState.resultPromise;if(!e.ok)return Ut("NOT_IN_CACHE");if(e.value.data===null)return Ti({status:404,errorCode:"MESSAGE_NOT_FOUND",reasons:["No message with that ID exists"]});const r=e.value,{sender:i}=r,o=Ly(r,["sender"]),s={};return o.data.reactions.forEach(a=>{s[a.emoji]={count:a.count,currentUserReacted:a.currentUserReacted}}),X({status:200,data:On(_t({},o.data),{senderId:(t=i==null?void 0:i.store.userId)!=null?t:null,reactions:s})})})}}function RR(n,t){if(t===void 0)return n;const e=n.map(i=>{const o=t[i.emoji];return o===void 0?i:o===null?On(_t({},i),{count:0}):{emoji:i.emoji,count:Ht(i.count,o.count),currentUserReacted:Ht(i.currentUserReacted,o.currentUserReacted)}}).filter(i=>i.count>0),r=new Set(e.map(i=>i.emoji));for(const i in t){const o=t[i];o&&!r.has(i)&&e.push({emoji:i,count:o.count,currentUserReacted:o.currentUserReacted})}return e.sort((i,o)=>i.emoji.localeCompare(o.emoji)),e}function up(n){const t=Object.entries(n).map(([e,r])=>({emoji:e,count:r.count,currentUserReacted:r.currentUserReacted}));return t.sort((e,r)=>e.emoji.localeCompare(r.emoji)),t}class cp extends cu{constructor(t,e,r,i){super(t),this.createdAt=e,this.dataStore=r,this.referencedDataStore=i}get messageId(){return this.dataStore.messageId}fetchInitial(t){return U(this,null,function*(){return X({lastChanged:t,dataStore:this.dataStore,referencedDataStore:this.referencedDataStore})})}refetch(t){throw"Do not call refetch on message stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){return!0}teardownNested(t){}anyChildChanged(t,e,r){return U(this,arguments,function*(i,o,{dataStore:s,referencedDataStore:a}){return(yield s.changedBetween(i,o))===!0||(yield a==null?void 0:a.changedBetween(i,o))===!0})}loadNested(t,e){return U(this,null,function*(){var r,i,o;const s=yield e.dataStore.getDeep(t);if(!s.ok)return s;const a=s.value;if(a.snapshot===null)return X({snapshot:null});const l=yield(r=e.referencedDataStore)==null?void 0:r.getDeep(t);if(l&&!l.ok)return l;const u=(i=l==null?void 0:l.value)!=null?i:null,c=(o=u==null?void 0:u.snapshot)!=null?o:null;return X({snapshot:{id:a.snapshot.id,type:a.snapshot.type,sender:a.snapshot.sender,custom:a.snapshot.custom,createdAt:a.snapshot.createdAt,editedAt:a.snapshot.editedAt,referencedMessage:c,origin:a.snapshot.origin,plaintext:a.snapshot.plaintext,content:a.snapshot.content,reactions:a.snapshot.reactions}})})}}class DR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}listen(t){return this.onlyUsedInternally&&this.mostRecentState.resultPromise.then(e=>{if(e.ok&&e.value.inWindow!==null){const r=30-e.value.inWindow.length;r>0&&this._loadMoreMessages(r)}}),super.listen(t)}fetchInitial(t){return U(this,null,function*(){const e=this.onlyUsedInternally?1:30,r=yield $y({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:e});return r.ok?r.value.messages===null?X({lastChanged:t,lastMessageChanged:t,stores:null,inWindow:null,windowEnd:null}):jy({seq:t,messages:r.value.messages,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r})}teardownNested(t){if(t.stores){const e=Ut("TERMINATED");Object.values(t.stores).forEach(r=>r.setError(e)),t.inWindow.forEach(r=>r.setError(e))}}anyChildChanged(t,e,r){return U(this,null,function*(){for(const i in r.stores){const o=r.stores[i];if((yield o==null?void 0:o.changedBetween(t,e))===!0)return!0}return!1})}lastMessageChangedBetween(t,e){return U(this,null,function*(){if(t>=e)return!1;const r=yield this.get(e).resultPromise;if(!r.ok)return!1;if(r.value.lastMessageChanged>t)return!0;if(r.value.stores===null)return!1;const i=r.value.inWindow[0];return i!==void 0&&(yield i.changedBetween(t,e))===!0})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&!!be(t.inWindow.map(r=>r.messageId),e.inWindow.map(r=>r.messageId))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return U(this,null,function*(){if(e.stores===null)return X({snapshot:null,loadedAll:!0});const r=yield Promise.all(e.inWindow.map(o=>o.getDeep(t)));return r.find(o=>!o.ok)||X({snapshot:r.filter(o=>o.value.snapshot!==null).map(o=>o.value.snapshot),loadedAll:e.windowEnd===null})})}loadMore(t){return U(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreMessages(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreMessages(t=30){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield $y({count:t,cursor:r,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.messages===null?(console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."),s):jy({seq:o,prevState:s.value,messages:i.value.messages,cursor:i.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}messageCreated(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."),r;if(r.value.windowEnd&&e.state.createdAt<r.value.windowEnd.oldestMessageTs||Object.hasOwnProperty.call(r.value.stores,e.state.id))return r;const i=_t({},r.value.stores),o=new xo(t,this.conversationId,e.state,this.realtimeClient);i[e.state.id]=o;const s=e.state.referencedMessageId;let a;s===null?a=null:s in i?a=i[s]:(a=new xo(t,this.conversationId,s,this.realtimeClient),i[s]=a);const l=new cp(t,e.state.createdAt,o,a),u=[...r.value.inWindow,l];u.sort((d,h)=>h.createdAt-d.createdAt);const c=u[0].messageId===e.messageId?t:r.value.lastMessageChanged;return X({lastChanged:t,lastMessageChanged:c,stores:i,inWindow:u,windowEnd:r.value.windowEnd})})}messageEdited(t,e){this.mutate(t,r=>{var i;return r.value.stores===null?(console.warn("[TalkJS] Received a 'message.edited' event for a nonexistent conversation."),r):((i=r.value.stores[e.messageId])==null||i.messageEdited(t,e),r)})}messageDeleted(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'message.deleted' event for a conversation that we thought didn't exist."),r;if(Object.values(r.value.stores).forEach(a=>a.messageDeleted(t,e)),r.value.stores[e.messageId]===void 0)return r;const i=_t({},r.value.stores);delete i[e.messageId];const o=r.value.inWindow.filter(a=>a.messageId!==e.messageId);if(e.newLastMessage&&o.length===0){const a=new xo(t,this.conversationId,e.newLastMessage,this.realtimeClient);i[a.messageId]=a;const l=e.newLastMessage.referencedMessageId;let u;l===null?u=null:l in i?u=i[l]:(u=new xo(t,this.conversationId,l,this.realtimeClient),i[l]=u);const c=new cp(t,e.newLastMessage.createdAt,a,u);o.push(c)}const s=e.newLastMessage!==void 0?t:r.value.lastMessageChanged;return X({lastChanged:t,lastMessageChanged:s,stores:i,inWindow:o,windowEnd:r.value.windowEnd})})}conversationCleared(t,e){this.mutate(t,r=>{var i;return((i=r.value.inWindow)==null?void 0:i.length)===0&&r.value.windowEnd===null?r:(this.teardownNested(r.value),X({lastChanged:t,lastMessageChanged:t,stores:{},inWindow:[],windowEnd:null}))})}sideCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.stores!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}sideDeleted(t,e){this.mutate(t,r=>r.value.stores===null?r:(this.teardownNested(r.value),X({lastChanged:t,lastMessageChanged:t,stores:null,inWindow:null,windowEnd:null})))}getMessageFromCache(t){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.stores===null)return Ut("NOT_IN_CACHE");const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.getFromCache()})}}function $y(n){return U(this,arguments,function*({cursor:t,realtimeClient:e,conversationId:r,count:i}){const o={limit:i,cursor:t},s=yield e.call("GET",["me","conversations",r,"messages"],o,{bypassCache:!0});if(s.ok){const{data:a,cursor:l}=s.value.data;return X({messages:a,nextCursor:l})}return!s.ok&&s.where==="server"&&s.value.status===404||!s.ok&&s.where==="server"&&s.value.status===403&&s.value.errorCode==="NOT_A_PARTICIPANT"?X({messages:null,nextCursor:null}):s})}function jy({seq:n,prevState:t,messages:e,cursor:r,conversationId:i,realtimeClient:o}){var s,a,l,u;const c=t?_t({},t.stores):{};for(const p of e)if(c[p.id]===void 0){const f=new xo(n,i,p,o);c[f.messageId]=f}for(const p of e){const f=p.referencedMessageId;if(f&&c[f]===void 0){const m=new xo(n,i,f,o);c[m.messageId]=m}}const d=t?[...t.inWindow]:[];for(const p of e)d.push(new cp(n,p.createdAt,c[p.id],p.referencedMessageId?c[p.referencedMessageId]:null));d.sort((p,f)=>f.createdAt-p.createdAt);const h=((a=(s=t==null?void 0:t.inWindow)==null?void 0:s[0])==null?void 0:a.messageId)===((l=d==null?void 0:d[0])==null?void 0:l.messageId)&&(u=t==null?void 0:t.lastMessageChanged)!=null?u:n;return X(r===null?{lastChanged:n,lastMessageChanged:h,stores:c,inWindow:d,windowEnd:null}:{lastChanged:n,lastMessageChanged:h,stores:c,inWindow:d,windowEnd:{cursor:r,oldestMessageTs:e[e.length-1].createdAt}})}class kR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.convDataStore=e,this.realtimeClient=r,this.unsubscribeDebounceMs=0}fetchInitial(t){return U(this,null,function*(){return X({lastChanged:t,store:this.convDataStore})})}teardownNested(t){t.store.unsubscribe()}anyChildChanged(t,e,r){return U(this,null,function*(){return r.store.store.changedBetween(t,e)})}equal(t,e){return!0}loadNested(t,e){return U(this,null,function*(){return e.store.store.getDeep(t)})}getFromCache(){return U(this,null,function*(){return this.convDataStore.store.getFromCache()})}}function dp(n,t){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t(n[e],e)}function hp(n,t){return function(e){let r={};return dp(e,(i,o)=>{const[s,a]=(([l,u])=>[l,t(u,l)])([o,i],0);r[s]=a}),r}(n)}class LR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e4}fetchInitial(t){return U(this,null,function*(){const e=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"typing"],{},{bypassCache:!0});if(!e.ok&&e.where==="server"&&e.value.status===404)return X({data:null,lastChanged:t});if(!e.ok&&e.where==="server"&&e.value.status===403&&e.value.errorCode==="NOT_A_PARTICIPANT")return X({data:null,lastChanged:t});if(!e.ok)return e;const r=e.value.data;return r.many?X({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:t}):X({data:r,userSubscriptions:hp(r.usersTyping,(i,o)=>this.realtimeClient.internalSubscribe(["users",o])),lastChanged:t})})}equal(t,e){return be(t.data,e.data)}loadNested(t,e){return U(this,null,function*(){if(e.data===null)return X({snapshot:null,lastChanged:e.lastChanged});if(e.data.many)return X({snapshot:{many:!0},lastChanged:e.lastChanged});const r=Object.entries(e.data.usersTyping).sort(([u,c],[d,h])=>c-h).map(([u,c])=>u).map(u=>e.userSubscriptions[u].store.getDeep(t)),i=yield Promise.all(r),o=i.find(u=>!u.ok);if(o)return o;const s=i.map(u=>u.value),a=s.map(u=>u.snapshot),l=s.map(u=>u.lastChanged);return X({snapshot:{users:a,many:!1},lastChanged:Math.max(e.lastChanged,...l)})})}typingAvailable(t,e){this.mutate(t,()=>X({data:e.state,userSubscriptions:e.state.many?{}:hp(e.state.usersTyping,(r,i)=>this.realtimeClient.internalSubscribe(["users",i])),lastChanged:t}))}typingChanged(t,e){this.mutate(t,r=>{if(r.value.data===null)return r;if(e.diff.many===void 0){if(r.value.data.many===!0)return r;const i=_t({},r.value.data.usersTyping),o=_t({},r.value.userSubscriptions);return dp(e.diff.usersTyping,(s,a)=>{var l;typeof s=="number"?(i[a]=s,o[a]=this.realtimeClient.internalSubscribe(["users",a])):s===null&&(delete i[a],(l=o[a])==null||l.unsubscribe(),delete o[a])}),X({data:{usersTyping:i,many:!1},userSubscriptions:o,lastChanged:t})}if(e.diff.many===!0)return r.value.data.many?r:X({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:t});if(e.diff.many===!1){if(r.value.data.many===!1)return r;const i=hp(e.diff.usersTyping,(o,s)=>this.realtimeClient.internalSubscribe(["users",s]));return X({data:e.diff,userSubscriptions:i,lastChanged:t})}throw e.diff,"Unreachable"})}sideDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:X({data:null,lastChanged:t}))}teardownNested(t){t.data&&dp(t.userSubscriptions,e=>e.unsubscribe())}anyChildChanged(t,e,r){return U(this,null,function*(){var i;if(r.data===null)return!1;for(const o in r.userSubscriptions){const s=r.userSubscriptions[o];if((yield(i=s==null?void 0:s.store)==null?void 0:i.changedBetween(t,e))===!0)return!0}return!1})}}class Yy extends cu{constructor(t,e,r,i){super(t),this.conversationId=e,this.participantData=r,this.realtimeClient=i}fetchInitial(t){return U(this,null,function*(){return X({lastChanged:t,user:this.realtimeClient.internalSubscribe(["users",this.participantData.id]),data:this.participantData})})}refetch(t){throw"Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){var r,i,o,s;return((i=(r=t.user)==null?void 0:r.store)==null?void 0:i.userId)===((s=(o=e.user)==null?void 0:o.store)==null?void 0:s.userId)&&be(t.data,e.data)}teardownNested(t){var e;(e=t.user)==null||e.unsubscribe()}anyChildChanged(t,e,r){return U(this,null,function*(){var i;const o=(i=r.user)==null?void 0:i.store;return(yield o==null?void 0:o.changedBetween(t,e))===!0})}loadNested(t,e){return U(this,null,function*(){if(e.data===null)return X({snapshot:null});const r=yield e.user.store.getDeep(t);if(r.ok===!1)return r;const i=r.value.snapshot;return X({snapshot:this.realtimeClient.createParticipantSnapshotPreloaded(e.data,i)})})}participantEdited(t,e){this.mutate(t,r=>r.value.data===null?r:X({lastChanged:t,user:r.value.user,data:{id:r.value.data.id,access:Ht(r.value.data.access,e.diff.access),notify:Ht(r.value.data.notify,e.diff.notify),joinedAt:r.value.data.joinedAt}}))}participantDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:(this.teardownNested(r.value),X({lastChanged:t,user:null,data:null})))}getFromCache(){return U(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok?t.value.data===null?Ti({status:404,errorCode:"PARTICIPANT_NOT_FOUND",reasons:["No participant with that ID exists"]}):X({status:200,data:t.value.data}):Ut("NOT_IN_CACHE")})}}class xR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(t){return U(this,null,function*(){const e=yield zy({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:10});return e.ok?e.value.participants===null?X({lastChanged:t,stores:null,inWindow:null,windowEnd:null}):Vy({seq:t,participants:e.value.participants,cursor:e.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):e})}teardownNested(t){if(t.stores){const e=Ut("TERMINATED");Object.values(t.stores).forEach(r=>r.setError(e))}}anyChildChanged(t,e,r){return U(this,null,function*(){for(const i in r.stores){const o=r.stores[i];if((yield o==null?void 0:o.changedBetween(t,e))===!0)return!0}return!1})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return U(this,null,function*(){if(e.stores===null)return X({snapshot:null,loadedAll:!0});const r=yield Promise.all(Object.values(e.stores).map(s=>s.getDeep(t))),i=r.find(s=>!s.ok);if(i)return i;const o=r.filter(s=>s.value.snapshot!==null).map(s=>s.value.snapshot);return o.sort((s,a)=>a.joinedAt-s.joinedAt),X({snapshot:o,loadedAll:e.windowEnd===null})})}loadMore(t){return U(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreParticipants(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreParticipants(t=10){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield zy({count:t,cursor:r,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.participants===null?(console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."),s):Vy({seq:o,prevStores:s.value.stores,participants:i.value.participants,cursor:i.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}participantCreated(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."),r;if(r.value.windowEnd&&e.state.joinedAt<r.value.windowEnd.oldestParticipantTs||Object.hasOwnProperty.call(r.value.stores,e.state.id))return r;const i=_t({},r.value.stores),o=new Yy(t,this.conversationId,e.state,this.realtimeClient);return i[e.state.id]=o,X({lastChanged:t,stores:i,windowEnd:r.value.windowEnd})})}participantEdited(t,e){this.mutate(t,r=>{var i;return r.value.stores===null?(console.warn("[TalkJS] Received a 'participant.edited' event for a nonexistent conversation."),r):((i=r.value.stores[e.userId])==null||i.participantEdited(t,e),r)})}participantDeleted(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."),r;const i=r.value.stores[e.userId];if(i===void 0)return r;i.participantDeleted(t,e);const o=_t({},r.value.stores);return delete o[e.userId],X({lastChanged:t,stores:o,windowEnd:r.value.windowEnd})})}sideCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.stores!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}sideDeleted(t,e){this.mutate(t,r=>r.value.stores===null?r:(this.teardownNested(r.value),X({lastChanged:t,stores:null,inWindow:null,windowEnd:null})))}getParticipantFromCache(t){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.stores===null)return Ut("NOT_IN_CACHE");const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.getFromCache()})}}function zy(n){return U(this,arguments,function*({cursor:t,realtimeClient:e,conversationId:r,count:i}){const o={limit:i,cursor:t},s=yield e.call("GET",["me","conversations",r,"participants"],o,{bypassCache:!0});if(s.ok){const{data:a,cursor:l}=s.value.data;return X({participants:a,nextCursor:l})}return!s.ok&&s.where==="server"&&s.value.status===404||!s.ok&&s.where==="server"&&s.value.status===403&&s.value.errorCode==="NOT_A_PARTICIPANT"?X({participants:null,nextCursor:null}):s})}function Vy({seq:n,prevStores:t,participants:e,cursor:r,conversationId:i,realtimeClient:o}){const s=t?_t({},t):{};for(const a of e)if(s[a.id]===void 0){const l=new Yy(n,i,a,o);s[a.id]=l}return X(r===null?{lastChanged:n,stores:s,windowEnd:null}:{lastChanged:n,stores:s,windowEnd:{cursor:r,oldestParticipantTs:e[e.length-1].joinedAt}})}class MR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.getConvDataStore=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(t){return U(this,null,function*(){const e=yield Wy({realtimeClient:this.realtimeClient,count:20});return e.ok?e.value.conversations===null?X({lastChanged:t,stores:null,windowEnd:null}):Gy({seq:t,conversations:e.value.conversations,cursor:e.value.nextCursor,getConvDataStore:this.getConvDataStore}):e})}teardownNested(t){t.stores!==null&&Object.values(t.stores).forEach(e=>e.unsubscribe())}anyChildChanged(t,e,r){return U(this,null,function*(){var i;for(const o in r.stores){const s=r.stores[o];if((yield(i=s==null?void 0:s.store)==null?void 0:i.changedBetween(t,e))===!0)return!0}return!1})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return U(this,null,function*(){if(e.stores===null)return X({snapshot:[],loadedAll:!0});const r=yield Promise.all(Object.values(e.stores).map(s=>s.store.getDeep(t))),i=r.find(s=>!s.ok);if(i)return i;const o=r.filter(s=>s.value.snapshot!==null).map(s=>s.value.snapshot);return o.sort((s,a)=>{var l,u,c,d;const h=(u=(l=s.lastMessage)==null?void 0:l.createdAt)!=null?u:s.joinedAt;return((d=(c=a.lastMessage)==null?void 0:c.createdAt)!=null?d:a.joinedAt)-h}),X({snapshot:o,loadedAll:e.windowEnd===null})})}loadMore(t){return U(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreConversations(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreConversations(t=20){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield Wy({count:t,cursor:r,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.conversations===null?(console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."),s):Gy({seq:o,prevStores:s.value.stores,conversations:i.value.conversations,cursor:i.value.nextCursor,getConvDataStore:this.getConvDataStore}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}getConvFromCache(t){return U(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok)return Ut("NOT_IN_CACHE");if(e.value.stores===null)return Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.store.getFromCache()})}userCreated(t,e){this.mutate(t,r=>r.value.stores!==null?r:X({lastChanged:r.value.lastChanged,stores:{},windowEnd:null}))}sideCreated(t,e){const r=this.getConvDataStore(e.state);this.mutate(t,i=>Object.hasOwnProperty.call(i.value.stores,e.conversationId)?(r.unsubscribe(),i):X({lastChanged:t,stores:On(_t({},i.value.stores),{[e.conversationId]:r}),windowEnd:i.value.windowEnd}))}sideDeleted(t,e){this.mutate(t,r=>{var i;if(!Object.hasOwnProperty.call(r.value.stores,e.conversationId))return r;const o=_t({},r.value.stores);return(i=o[e.conversationId])==null||i.unsubscribe(),delete o[e.conversationId],X({lastChanged:t,stores:o,windowEnd:r.value.windowEnd})})}sideEdited(t,e){const r=e.diff.lastMessageAt;r!==void 0&&this.mutate(t,i=>{var o;if(i.value.stores===null)return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."),i;if(i.value.windowEnd===null)return i;const s=Object.hasOwnProperty.call(i.value.stores,e.conversationId);if(s&&r<i.value.windowEnd.oldestMessageTs){const a=_t({},i.value.stores);return(o=a[e.conversationId])==null||o.unsubscribe(),delete a[e.conversationId],X({lastChanged:t,stores:a,windowEnd:i.value.windowEnd})}if(!s&&r>=i.value.windowEnd.oldestMessageTs){const a=this.getConvDataStore(e.conversationId);return X({lastChanged:t,stores:On(_t({},i.value.stores),{[e.conversationId]:a}),windowEnd:i.value.windowEnd})}return i})}}function Wy(n){return U(this,arguments,function*({cursor:t,realtimeClient:e,count:r}){const i={limit:r,cursor:t},o=yield e.call("GET",["me","conversations"],i,{bypassCache:!0});if(o.ok){const{data:s,cursor:a}=o.value.data;return X({conversations:s,nextCursor:a})}return o.ok||o.where!=="server"||o.value.status!==404||o.value.errorCode!=="USER_NOT_FOUND"?o:X({conversations:null,nextCursor:null})})}function Gy({seq:n,prevStores:t,conversations:e,cursor:r,getConvDataStore:i}){const o=t?_t({},t):{};for(const s of e)o[s.id]===void 0&&(o[s.id]=i(s));return X(r===null?{lastChanged:n,stores:o,windowEnd:null}:{lastChanged:n,stores:o,windowEnd:{cursor:r,oldestMessageTs:Math.min(...e.map(s=>s.lastMessageAt))}})}class PR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversation=e,this.realtimeClient=r,this.unsubscribeDebounceMs=5e3}get conversationId(){return typeof this.conversation=="string"?this.conversation:this.conversation.id}fetchInitial(t){return U(this,null,function*(){const e=this.realtimeClient.internalSubscribe(["me","conversations",this.conversationId,"messages"]);if(typeof this.conversation=="object")return X({lastChanged:t,snapshot:this.conversation,messageWindowStore:e});const r=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId],{},{bypassCache:!0});let i;if(r.ok)i=r.value.data;else if(r.where==="server"&&r.value.status===404)i=null;else{if(r.where!=="server"||r.value.status!==403||r.value.errorCode!=="NOT_A_PARTICIPANT")return e.unsubscribe(),r;i=null}return X({lastChanged:t,snapshot:i,messageWindowStore:e})})}teardownNested(t){var e;(e=t.messageWindowStore)==null||e.unsubscribe()}anyChildChanged(t,e,r){return U(this,null,function*(){return(yield r.messageWindowStore.store.lastMessageChangedBetween(t,e))===!0})}equal(t,e){return be(t.snapshot,e.snapshot)}loadNested(t,e){return U(this,null,function*(){var r;if(!e.snapshot)return X({snapshot:null,loadedAll:!0});const i=yield e.messageWindowStore.store.getDeep(t);if(!i.ok)return i;const o=i.value.snapshot,s=(r=o==null?void 0:o[0])!=null?r:null;return X({snapshot:On(_t({},e.snapshot),{lastMessage:s})})})}participantEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."),r):X({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}conversationEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."),r):X({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}sideEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."),r):X({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}sideCreated(t,e){this.mutate(t,r=>r.value.snapshot?r:X({lastChanged:t,snapshot:e.state,messageWindowStore:r.value.messageWindowStore}))}sideDeleted(t,e){this.mutate(t,r=>r.value.snapshot===null?r:X({lastChanged:t,snapshot:null,messageWindowStore:r.value.messageWindowStore}))}getFromCache(){return U(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok&&t.value.snapshot?X({status:200,data:t.value.snapshot}):Ut("NOT_IN_CACHE")})}}function pp(n,t){const e=t;return{id:n.id,createdAt:n.createdAt,subject:Ht(n.subject,e.subject),photoUrl:Ht(n.photoUrl,e.photoUrl),welcomeMessages:Ht(n.welcomeMessages,e.welcomeMessages),custom:op(n.custom,e.custom),lastMessageAt:Ht(n.lastMessageAt,e.lastMessageAt),unreadMessageCount:Ht(n.unreadMessageCount,e.unreadMessageCount),isUnread:Ht(n.isUnread,e.isUnread),access:Ht(n.access,e.access),notify:Ht(n.notify,e.notify),readUntil:Ht(n.readUntil,e.readUntil),everyoneReadUntil:Ht(n.everyoneReadUntil,e.everyoneReadUntil),joinedAt:n.joinedAt}}class BR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.userId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3}fetchInitial(t){return U(this,null,function*(){const e=this.realtimeClient.internalSubscribe(["users",this.userId]),r=yield this.realtimeClient.call("GET",["users",this.userId,"online"],{},{bypassCache:!0});return r.ok||r.where!=="server"||r.value.status!==404||r.value.errorCode!=="USER_NOT_FOUND"?r.ok?X({lastChanged:t,user:e,data:r.value.data}):r:X({lastChanged:t,user:e,data:null})})}equal(t,e){return be(t.data,e.data)}teardownNested(t){t.user.unsubscribe()}anyChildChanged(t,e,r){return U(this,null,function*(){return r.user.store.changedBetween(t,e)})}loadNested(t,e){return U(this,null,function*(){const r=yield e.user.store.getDeep(t);if(!r.ok)return r;const i=r.value.snapshot;return e.data===null||i===null?X({snapshot:null}):X({snapshot:_t({user:i},e.data)})})}userCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.data!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}userOnlineChanged(t,e){this.mutate(t,r=>r.value.data===null?r:X({lastChanged:t,user:r.value.user,data:e.diff}))}getFromCache(){return U(this,null,function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return Ut("NOT_IN_CACHE");if(t.value.data===null)return Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const e=t.value,r=Ly(e,["user"]);return X({status:200,data:_t({},r.data)})})}}class FR{constructor(t,e,r){this.realtimeClient=r,this.convDataStores={},this.storeMap={},this.emitMutex=new By,this.seqOffset=0,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss=!0,this.connection=new OR(t,e,{onUpstreamRestarting:()=>{this.refetchOnNextNetworkLoss=!1},onReady:()=>{this.refetchOnNextNetworkLoss=!0},onResubscribeSent:()=>{if(this.seqOffset+=this.seq,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss){this.seqOffset++;const i=this.seq;this.refetchAll(i),this.emitAll(i)}},onResubscribeError:(i,o)=>{var s;(s=this.storeMap[fp(i)])==null||s.setError(o)},onPublish:(i,o)=>{this.seqInThisConnection=i;const s=this.seq;for(const a of o)this.handlePublish(s,a);this.emitAll(s)}})}get seq(){return this.seqOffset+this.seqInThisConnection}refetchAll(t){Object.values(this.storeMap).forEach(e=>e==null?void 0:e.refetch(t))}emitAll(t){return this.emitMutex.runExclusive(()=>U(this,null,function*(){const e=Object.values(this.storeMap).map(r=>r==null?void 0:r.emit(t));yield Promise.all(e)}))}handlePublish(t,e){var r,i,o,s,a,l,u,c,d,h,p,f,m,g,E,A,v,_,O,T,S,N,y,I,R,b,L;switch(e.type){case"user.created":return(r=this.storeMap[`/users/${e.userId}`])==null||r.userCreated(t,e),(i=this.storeMap["/me/conversations"])==null||i.userCreated(t,e),void((o=this.storeMap[`/users/${e.userId}/online`])==null||o.userCreated(t,e));case"user.edited":return void((s=this.storeMap[`/users/${e.userId}`])==null||s.userEdited(t,e));case"side.created":return(a=this.convDataStores[e.conversationId])==null||a.sideCreated(t,e),(l=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||l.sideCreated(t,e),(u=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||u.sideCreated(t,e),void((c=this.storeMap["/me/conversations"])==null||c.sideCreated(t,e));case"side.edited":return(d=this.convDataStores[e.conversationId])==null||d.sideEdited(t,e),void((h=this.storeMap["/me/conversations"])==null||h.sideEdited(t,e));case"side.deleted":return(p=this.convDataStores[e.conversationId])==null||p.sideDeleted(t,e),(f=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||f.sideDeleted(t,e),(m=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||m.sideDeleted(t,e),(g=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||g.sideDeleted(t,e),void((E=this.storeMap["/me/conversations"])==null||E.sideDeleted(t,e));case"conversation.edited":return void((A=this.convDataStores[e.conversationId])==null||A.conversationEdited(t,e));case"message.created":return void((v=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||v.messageCreated(t,e));case"message.edited":return void((_=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||_.messageEdited(t,e));case"message.deleted":return void((O=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||O.messageDeleted(t,e));case"typing.available":return void((T=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||T.typingAvailable(t,e));case"typing.changed":return void((S=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||S.typingChanged(t,e));case"conversation.cleared":return void((N=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||N.conversationCleared(t,e));case"participant.edited":return(y=this.convDataStores[e.conversationId])==null||y.participantEdited(t,e),void((I=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||I.participantEdited(t,e));case"participant.created":return void((R=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||R.participantCreated(t,e));case"participant.deleted":return void((b=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||b.participantDeleted(t,e));case"user.online.changed":return void((L=this.storeMap[`/users/${e.userId}/online`])==null||L.userOnlineChanged(t,e))}}call(t,e,r,i){return U(this,null,function*(){if(!i.bypassCache&&t==="GET"){const o=fp(e);if(o in this.storeMap){const s=o,a=this.storeMap[s];if(a&&"getFromCache"in a){const l=yield a.getFromCache();if(l.value!=="NOT_IN_CACHE")return l}}else if(ln(e,["me","conversations","*","messages","*"])){const s=this.storeMap[`/me/conversations/${e[2]}/messages`];if(s){const a=yield s.getMessageFromCache(e[4]);if(a.value!=="NOT_IN_CACHE")return a}}else if(ln(e,["me","conversations","*","participants","*"])){const s=this.storeMap[`/me/conversations/${e[2]}/participants`];if(s){const a=yield s.getParticipantFromCache(e[4]);if(a.value!=="NOT_IN_CACHE")return a}}else if(ln(e,["me","conversations","*"])){const s=this.storeMap["/me/conversations"];if(s){const a=yield s.getConvFromCache(e[2]);if(a.value!=="NOT_IN_CACHE")return a}}}return this.connection.call(t,e,r)})}subscribe(t,e){const r=this.getOrCreateStore(t),i=yi(),o=yi();i.promise.catch(()=>{}),o.promise.catch(()=>{});const s={state:{type:"pending",latestSnapshot:void 0},connected:i.promise,terminated:o.promise,loadMore:l=>U(this,null,function*(){"loadMore"in r&&(yield r.loadMore(l))}),unsubscribe:()=>{}},a=r.listen(l=>{if(l.ok){const u=!("loadedAll"in l.value)||l.value.loadedAll,c={type:"active",latestSnapshot:l.value.snapshot,loadedAll:u};s.state=c,e==null||e(l.value.snapshot,u),i.resolve(c)}else if(s.state.type==="pending"||s.state.type==="active"){if(l.where==="server"){const u={type:"error",error:new Error(na(`Subscribe to ${t.join("/")}`,l.value))};return s.state=u,o.resolve(u),void i.reject("Subscription encountered an error during initial connection")}if(l.value==="SESSION_DESTROYED"){const u={type:"error",error:new Error("Session was destroyed causing all subscriptions to be terminated")};return s.state=u,o.resolve(u),void i.reject("Subscription encountered an error during initial connection")}if(l.value==="UNSUBSCRIBED"||l.value==="TERMINATED")return;l.value}});return s.unsubscribe=()=>{if(s.state.type==="pending"||s.state.type==="active"){a();const l={type:"unsubscribed"};s.state=l,o.resolve(l),i.reject("Subscription was unsubscribed before connecting")}},s}getOrCreateStore(t){const e=fp(t);if(e in this.storeMap)return this.storeMap[e];this.connection.subscribe(t).then(i=>{i.ok||r.setError(i)});const r=this.instantiateStore(t,()=>{delete this.storeMap[e],this.connection.unsubscribe(t)});return this.storeMap[e]=r,r}destroy(){this.storeMap={},this.convDataStores={},this.connection.destroy()}isConnected(){return this.connection.isConnected()}instantiateStore(t,e){if(ln(t,["users","*"]))return new bR(this.seq,t[1],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*"]))return new kR(this.seq,this.subscribeConvData(t[2]),this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","messages"]))return new DR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","participants"]))return new xR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","typing"]))return new LR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations"]))return new MR(this.seq,r=>this.subscribeConvData(r),this.realtimeClient,this.emitMutex,e);if(ln(t,["users","*","online"]))return new BR(this.seq,t[1],this.realtimeClient,this.emitMutex,e);throw"Unreachable"}subscribeConvData(t){const e=typeof t=="string"?t:t.id;if(Object.hasOwnProperty.call(this.convDataStores,e)){const i=this.convDataStores[e];return{store:i,unsubscribe:i.registerInternalSubscription()}}const r=new PR(this.seq,t,this.realtimeClient,this.emitMutex,()=>{delete this.convDataStores[e]});return this.convDataStores[e]=r,{store:r,unsubscribe:r.registerInternalSubscription()}}}function fp(n){return`/${n.join("/")}`}class UR{constructor(t,e,r){this.userId=e,this.alive=!0,this.connection=new FR(t,r,this),r.onTokenRefreshFailed(()=>{this.destroy()})}call(t,e,r){return U(this,arguments,function*(i,o,s,a={}){return this.alive?this.connection.call(i,o,s,a):Ut("SESSION_DESTROYED")})}subscribe(t,e){return this.connection.subscribe(t,e)}internalSubscribe(t){const e=this.connection.getOrCreateStore(t);return{store:e,unsubscribe:e.registerInternalSubscription()}}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}listMessages(t,e){return U(this,null,function*(){const r=yield this.call("GET",["me","conversations",t,"messages"],e);if(!r.ok)return mp(r,"Listing messages in "+t);const i=r.value.data.data,o=yield Promise.all(i.map(a=>this.createMessageSnapshot(a,t))),s=o.find(a=>!a.ok);return s===void 0||s.ok?X(o.map(({value:a})=>a)):s})}createConversationSnapshotPreloaded(t,e){return{id:t.id,subject:t.subject,photoUrl:t.photoUrl,welcomeMessages:t.welcomeMessages,custom:t.custom,createdAt:t.createdAt,joinedAt:t.joinedAt,lastMessageAt:t.lastMessageAt,unreadMessageCount:t.unreadMessageCount,isUnread:t.isUnread,access:t.access,notify:t.notify,lastMessage:e,readUntil:t.readUntil,everyoneReadUntil:t.everyoneReadUntil}}createUserSnapshot(t){return{id:t.id,name:t.name,custom:t.custom,locale:t.locale,photoUrl:t.photoUrl,role:t.role,welcomeMessage:t.welcomeMessage}}createParticipantSnapshotPreloaded(t,e){return{user:e,access:t.access,notify:t.notify,joinedAt:t.joinedAt}}createMessageSnapshot(t,e){return U(this,null,function*(){const r=t.senderId===null?Promise.resolve(X(null)):this.getUser(t.senderId),i=t.referencedMessageId===null?Promise.resolve(X(null)):this.getReferencedMessage(e,t.referencedMessageId),o=yield r;if(!o.ok)return o;const s=yield i;return s.ok?X(this.createMessageSnapshotPreloaded(t,o.value,s.value)):s})}getReferencedMessage(t,e){return U(this,null,function*(){const r=yield this.call("GET",["me","conversations",t,"messages",e],{});if(!r.ok&&r.where==="server"&&r.value.status===404||!r.ok&&r.where==="server"&&r.value.status===403&&r.value.errorCode==="NOT_A_PARTICIPANT")return X(null);if(!r.ok)return mp(r,`Fetching referenced message ${e} in conversation ${t}`);const i=r.value.data,o=yield this.getUser(i.senderId);if(!o.ok)return o;const s=o.value;return X(this.createReferencedMessageSnapshotPreloaded(i,s))})}getUser(t){return U(this,null,function*(){const e=yield this.call("GET",["users",t],{includePrivateFields:!1});return e.ok||e.where!=="server"||e.value.status!==404?e.ok?X(this.createUserSnapshot(e.value.data)):mp(e,"Get user "+t):X(null)})}createMessageSnapshotPreloaded(t,e,r){return{id:t.id,type:t.type,sender:e,referencedMessage:r,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,origin:t.origin,content:t.content,reactions:up(t.reactions),plaintext:pu(t.content,{})}}createReferencedMessageSnapshotPreloaded(t,e){return{id:t.id,type:t.type,sender:e,referencedMessageId:t.referencedMessageId,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,origin:t.origin,content:t.content,reactions:up(t.reactions),plaintext:pu(t.content,{})}}}function mp(n,t){return n.where==="server"?Ti(On(_t({},n.value),{operation:t})):n}function gp(n,t){var e;if(t.ok)return t.value;throw t.value==="SESSION_DESTROYED"?new Error(`${n} failed because the session was destroyed`):new Error(na((e=t.value.operation)!=null?e:n,t.value))}class Xy{constructor(t,e){this.id=t,this._realtimeClient=e}get brandedId(){return this.id}get(){return U(this,null,function*(){const t=yield this._realtimeClient.getUser(this.brandedId);return gp("Get user "+this.id,t)})}set(t){return U(this,null,function*(){t.role===null&&(t.role="default");const e=typeof t.email=="string"?[t.email]:t.email,r=typeof t.phone=="string"?[t.phone]:t.phone,i=yield this._realtimeClient.call("PUT",["users",this.brandedId],On(_t({},t),{email:e,phone:r}));xt("Set user "+this.id,i)})}createIfNotExists(t){return U(this,null,function*(){t.role===void 0&&(t.role="default");const e=typeof t.email=="string"?[t.email]:t.email,r=typeof t.phone=="string"?[t.phone]:t.phone,i=yield this._realtimeClient.call("POST",["users",this.brandedId],On(_t({},t),{email:e,phone:r}));(i.ok||i.where!=="server"||i.value.status!=409)&&xt(`Create user ${this.id} if not exists`,i)})}subscribe(t){return this._realtimeClient.subscribe(["users",this.brandedId],t)}subscribeOnline(t){return this._realtimeClient.subscribe(["users",this.brandedId,"online"],t)}}class Ky{constructor(t,e,r){this.userId=t,this.conversationId=e,this._realtimeClient=r}get brandedUserId(){return this.userId}get brandedConversationId(){return this.conversationId}get(){return U(this,null,function*(){const t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"participants",this.brandedUserId],{}),e=yield this._realtimeClient.call("GET",["users",this.brandedUserId],{includePrivateFields:!1}),[r,i]=yield Promise.all([t,e]);if(!r.ok&&r.where==="server"&&r.value.status===404||!i.ok&&i.where==="server"&&i.value.status===404)return null;const o=xt(`Get participant ${this.userId} in conversation ${this.conversationId}`,r),s=xt(`Get user ${this.userId}`,i),a=this._realtimeClient.createUserSnapshot(s);return this._realtimeClient.createParticipantSnapshotPreloaded(o,a)})}set(){return U(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);xt(`Set participant ${this.userId} in conversation ${this.conversationId}`,e)})}edit(){return U(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);xt(`Edit participant ${this.userId} in conversation ${this.conversationId}`,e)})}createIfNotExists(){return U(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("POST",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);(e.ok||e.where!=="server"||e.value.status!==409)&&xt(`Add participant ${this.userId} to conversation ${this.conversationId}`,e)})}delete(){return U(this,null,function*(){const t=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"participants",this.brandedUserId],{});(t.ok||t.where!=="server"||t.value.status!==404)&&xt(`Remove participant ${this.userId} from conversation ${this.conversationId}`,t)})}}function HR(n){const t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";let e=0;const r=[],i=n===e;e=n;const o=new Array(8);for(let a=7;a>=0;a--)o[a]=t.charAt(n%64),n=Math.floor(n/64);if(n!==0)throw new Error("We should have converted the entire timestamp.");let s=o.join("");if(i){let a;for(a=11;a>=0&&r[a]===63;a--)r[a]=0;r[a]++}else for(let a=0;a<12;a++)r[a]=Math.floor(64*Math.random());for(let a=0;a<12;a++)s+=t.charAt(r[a]);if(s.length!=20)throw new Error("Length should be 20.");return s}const ia=(n,t,e=void 0)=>n.reduce((r,i,o)=>r.concat((s=>{if(typeof s=="string")return t(s,e);switch(s.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:s.type,children:ia(s.children,t,s.type)}];case"link":return[{type:s.type,url:s.url,children:ia(s.children,t,s.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:s.type,action:s.action,params:s.params,children:ia(s.children,t,s.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[s]}})(i)),[]);function dr(n,t){return e=>{const r=e;let i=0;const o=[];for(const s of Uy(e,n)){s.index-i>0&&o.push(r.substring(i,s.index));const a=t(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<e.length&&o.push(e.substring(i)),o}}const qy="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Oi,Ep=((Oi=Ep||{})[Oi.italic=1]="italic",Oi[Oi.strikethrough=2]="strikethrough",Oi[Oi.bold=4]="bold",Oi);const $R=[0,1,2,3,4,5,6].map(n=>{const t=[];return 1&n||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&n||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&n||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map(e=>e.source).join("|"),"g")}),jR={_:1,"*":4,"~":2};function YR(n){return Jy(n,0)}function Jy(n,t=0){const e=$R[t],r=e?function(i){const o=dr(zR.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${qy}])(?:${i.source})(?=[\\s${qy}]|$)`,"g")),s=>{const a=s[0][1],l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];return[" ",{type:Ep[jR[a]],children:[l]}]});return s=>{const[a,...l]=o(" "+s);return a.length>1&&l.unshift(a.substring(1)),l}}(e):()=>[n];return ia(r(n),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?Jy(i,t|Ep[o]):[i])}const zR=function(){const n=function(){try{return new WeakMap}catch(t){const e={has:()=>!1,get:()=>{},set:()=>e};return e}}();return{getOrCompute(t,e){if(n.has(t))return n.get(t);const r=e();return n.set(t,r),r}}}();function Zy(n,t){if(Array.prototype.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function Si(n,t){for(var e=n.length-1;e>=0;e--)t(n[e])===!0&&n.splice(e,1)}function Qy(n){throw new Error("Unhandled case for value: '"+n+"'")}var Ap=function(){function n(t){t===void 0&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return n.prototype.setTagName=function(t){return this.tagName=t,this},n.prototype.getTagName=function(){return this.tagName||""},n.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},n.prototype.getAttr=function(t){return this.getAttrs()[t]},n.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},n.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},n.prototype.setClass=function(t){return this.setAttr("class",t)},n.prototype.addClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);e=s.shift();)Zy(o,e)===-1&&o.push(e);return this.getAttrs().class=o.join(" "),this},n.prototype.removeClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);o.length&&(e=s.shift());){var a=Zy(o,e);a!==-1&&o.splice(a,1)}return this.getAttrs().class=o.join(" "),this},n.prototype.getClass=function(){return this.getAttrs().class||""},n.prototype.hasClass=function(t){return(" "+this.getClass()+" ").indexOf(" "+t+" ")!==-1},n.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},n.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},n.prototype.getInnerHTML=function(){return this.innerHTML||""},n.prototype.getInnerHtml=function(){return this.getInnerHTML()},n.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},n.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r+'="'+t[r]+'"');return e.join(" ")},n}(),tT=function(){function n(t){t===void 0&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return n.prototype.build=function(t){return new Ap({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},n.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},r=this.createCssClass(t);return r&&(e.class=r),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},n.prototype.createCssClass=function(t){var e=this.className;if(e){for(var r=[e],i=t.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(e+"-"+i[o]);return r.join(" ")}return""},n.prototype.processAnchorText=function(t){return this.doTruncate(t)},n.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var r,i,o,s,a=e.length,l=e.location;return l==="smart"?function(u,c,d){var h,p;d==null?(d="&hellip;",p=3,h=8):(p=d.length,h=d.length);var f=function(R){var b="";return R.scheme&&R.host&&(b+=R.scheme+"://"),R.host&&(b+=R.host),R.path&&(b+="/"+R.path),R.query&&(b+="?"+R.query),R.fragment&&(b+="#"+R.fragment),b},m=function(R,b){var L=b/2,k=Math.ceil(L),B=-1*Math.floor(L),j="";return B<0&&(j=R.substr(B)),R.substr(0,k)+d+j};if(u.length<=c)return u;var g,E,A,v=c-p,_=(g={},(A=(E=u).match(/^([a-z]+):\/\//i))&&(g.scheme=A[1],E=E.substr(A[0].length)),(A=E.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(g.host=A[1],E=E.substr(A[0].length)),(A=E.match(/^\/(.*?)(?=(\?|#|$))/i))&&(g.path=A[1],E=E.substr(A[0].length)),(A=E.match(/^\?(.*?)(?=(#|$))/i))&&(g.query=A[1],E=E.substr(A[0].length)),(A=E.match(/^#(.*?)$/i))&&(g.fragment=A[1]),g);if(_.query){var O=_.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);O&&(_.query=_.query.substr(0,O[1].length),u=f(_))}if(u.length<=c||(_.host&&(_.host=_.host.replace(/^www\./,""),u=f(_)),u.length<=c))return u;var T="";if(_.host&&(T+=_.host),T.length>=v)return _.host.length==c?(_.host.substr(0,c-p)+d).substr(0,v+h):m(T,v).substr(0,v+h);var S="";if(_.path&&(S+="/"+_.path),_.query&&(S+="?"+_.query),S){if((T+S).length>=v)return(T+S).length==c?(T+S).substr(0,c):(T+m(S,v-T.length)).substr(0,v+h);T+=S}if(_.fragment){var N="#"+_.fragment;if((T+N).length>=v)return(T+N).length==c?(T+N).substr(0,c):(T+m(N,v-T.length)).substr(0,v+h);T+=N}if(_.scheme&&_.host){var y=_.scheme+"://";if((T+y).length<v)return(y+T).substr(0,c)}if(T.length<=c)return T;var I="";return v>0&&(I=T.substr(-1*Math.floor(v/2))),(T.substr(0,Math.ceil(v/2))+d+I).substr(0,v+h)}(t,a):l==="middle"?function(u,c,d){if(u.length<=c)return u;var h,p;d==null?(d="&hellip;",h=8,p=3):(h=d.length,p=d.length);var f=c-p,m="";return f>0&&(m=u.substr(-1*Math.floor(f/2))),(u.substr(0,Math.ceil(f/2))+d+m).substr(0,f+h)}(t,a):(i=a,o=void 0,(r=t).length>i&&(o==null?(o="&hellip;",s=3):s=o.length,r=r.substring(0,i-s)+o),r)},n}(),Mo=function(){function n(t){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return n.prototype.getMatchedText=function(){return this.matchedText},n.prototype.setOffset=function(t){this.offset=t},n.prototype.getOffset=function(){return this.offset},n.prototype.getCssClassSuffixes=function(){return[this.getType()]},n.prototype.buildTag=function(){return this.tagBuilder.build(this)},n}(),eT=function(n,t){return(eT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])})(n,t)};function zn(n,t){function e(){this.constructor=n}eT(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var nT,Mt=function(){return Mt=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Mt.apply(this,arguments)},vp=function(n){function t(e){var r=n.call(this,e)||this;return r.email="",r.email=e.email,r}return zn(t,n),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Mo),rT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="",r.hashtag="",r.serviceName=e.serviceName,r.hashtag=e.hashtag,r}return zn(t,n),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,r=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(Mo),iT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.mention="",r.mention=e.mention,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var e=n.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&e.push(r),e},t}(Mo),oT=function(n){function t(e){var r=n.call(this,e)||this;return r.number="",r.plusSign=!1,r.number=e.number,r.plusSign=e.plusSign,r}return zn(t,n),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Mo),_p=function(n){function t(e){var r=n.call(this,e)||this;return r.url="",r.urlMatchType="scheme",r.protocolUrlMatch=!1,r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.schemePrefixRegex=/^(https?:\/\/)?/i,r.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,r.protocolRelativeRegex=/^\/\//,r.protocolPrepended=!1,r.urlMatchType=e.urlMatchType,r.url=e.url,r.protocolUrlMatch=e.protocolUrlMatch,r.protocolRelativeMatch=e.protocolRelativeMatch,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return zn(t,n),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var r=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(r)}catch(i){return r}},t}(Mo),Po=function(n){this.__jsduckDummyDocProp=null,this.tagBuilder=n.tagBuilder},yp=/[A-Za-z]/,VR=/[\d]/,WR=/[\D]/,Ni=/\s/,Tp=/['"]/,GR=/[\x00-\x1F\x7F]/,sT=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,aT=sT+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,mu=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,XR=aT+mu,$t=aT+mu,KR="(?:["+mu+"]{1,3}\\.){3}["+mu+"]{1,3}",qR="["+$t+"](?:["+$t+"\\-]{0,61}["+$t+"])?",lT=function(n){return"(?=("+qR+"))\\"+n},Op=function(n){return"(?:"+lT(n)+"(?:\\."+lT(n+1)+"){0,126}|"+KR+")"},gu=new RegExp("["+$t+"]"),uT=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,JR=new RegExp("["+$t+"!#$%&'*+/=?^_`{|}~-]"),ZR=new RegExp("^"+uT.source+"$"),cT=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.localPartCharRegex=JR,e.strictTldRegex=ZR,e}return zn(t,n),t.prototype.parseMatches=function(e){for(var r=this.tagBuilder,i=this.localPartCharRegex,o=this.strictTldRegex,s=[],a=e.length,l=new Eu,u={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,d=0,h=l;c<a;){var p=e.charAt(c);switch(d){case 0:(f=p)==="m"?T(1):i.test(f)&&T();break;case 1:m(e.charAt(c-1),p);break;case 2:g(p);break;case 3:E(p);break;case 4:A(p);break;case 5:v(p);break;case 6:_(p);break;case 7:O(p);break;default:Qy(d)}c++}var f;return N(),s;function m(y,I){y===":"?i.test(I)?(d=2,h=new Eu(Mt(Mt({},h),{hasMailtoPrefix:!0}))):S():u[y]===I||(i.test(I)?d=2:I==="."?d=3:I==="@"?d=4:S())}function g(y){y==="."?d=3:y==="@"?d=4:i.test(y)||S()}function E(y){y==="."||y==="@"?S():i.test(y)?d=2:S()}function A(y){gu.test(y)?d=5:S()}function v(y){y==="."?d=7:y==="-"?d=6:gu.test(y)||N()}function _(y){y==="-"||y==="."?N():gu.test(y)?d=5:N()}function O(y){y==="."||y==="-"?N():gu.test(y)?(d=5,h=new Eu(Mt(Mt({},h),{hasDomainDot:!0}))):N()}function T(y){y===void 0&&(y=2),d=y,h=new Eu({idx:c})}function S(){d=0,h=l}function N(){if(h.hasDomainDot){var y=e.slice(h.idx,c);/[-.]$/.test(y)&&(y=y.slice(0,-1));var I=h.hasMailtoPrefix?y.slice(7):y;(function(R){var b=(R.split(".").pop()||"").toLowerCase();return o.test(b)})(I)&&s.push(new vp({tagBuilder:r,matchedText:y,offset:h.idx,email:I}))}S()}},t}(Po),Eu=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.hasMailtoPrefix=!!n.hasMailtoPrefix,this.hasDomainDot=!!n.hasDomainDot},QR=function(){function n(){}return n.isValid=function(t,e){return!(e&&!this.isValidUriScheme(e)||this.urlMatchDoesNotHaveProtocolOrDot(t,e)||this.urlMatchDoesNotHaveAtLeastOneWordChar(t,e)&&!this.isValidIpAddress(t)||this.containsMultipleDots(t))},n.isValidIpAddress=function(t){var e=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return t.match(e)!==null},n.containsMultipleDots=function(t){var e=t;return this.hasFullProtocolRegex.test(t)&&(e=t.split("://")[1]),e.split("/")[0].indexOf("..")>-1},n.isValidUriScheme=function(t){var e=t.match(this.uriSchemeRegex),r=e&&e[0].toLowerCase();return r!=="javascript:"&&r!=="vbscript:"},n.urlMatchDoesNotHaveProtocolOrDot=function(t,e){return!(!t||e&&this.hasFullProtocolRegex.test(e)||t.indexOf(".")!==-1)},n.urlMatchDoesNotHaveAtLeastOneWordChar=function(t,e){return!(!t||!e||this.hasFullProtocolRegex.test(e)||this.hasWordCharAfterProtocolRegex.test(t))},n.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,n.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,n.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+sT+"]"),n.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,n}(),tD=(nT=new RegExp("[/?#](?:["+$t+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+$t+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Op(2),")","|","(","(//)?",/(?:www\.)/.source,Op(6),")","|","(","(//)?",Op(10)+"\\.",uT.source,"(?![-"+XR+"])",")",")","(?::[0-9]+)?","(?:"+nT.source+")?"].join(""),"gi")),eD=new RegExp("["+$t+"]"),dT=function(n){function t(e){var r=n.call(this,e)||this;return r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.matcherRegex=tD,r.wordCharRegExp=eD,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.stripPrefix,s=this.stripTrailingSlash,a=this.decodePercentEncoding,l=this.tagBuilder,u=[],c=function(){var h=r[0],p=r[1],f=r[4],m=r[5],g=r[9],E=r.index,A=m||g,v=e.charAt(E-1);if(!QR.isValid(h,p)||E>0&&v==="@"||E>0&&A&&d.wordCharRegExp.test(v))return"continue";if(/\?$/.test(h)&&(h=h.substr(0,h.length-1)),d.matchHasUnbalancedClosingParen(h))h=h.substr(0,h.length-1);else{var _=d.matchHasInvalidCharAfterTld(h,p);_>-1&&(h=h.substr(0,_))}var O=["http://","https://"].find(function(y){return!!p&&p.indexOf(y)!==-1});if(O){var T=h.indexOf(O);h=h.substr(T),p=p.substr(T),E+=T}var S=p?"scheme":f?"www":"tld",N=!!p;u.push(new _p({tagBuilder:l,matchedText:h,offset:E,urlMatchType:S,url:h,protocolUrlMatch:N,protocolRelativeMatch:!!A,stripPrefix:o,stripTrailingSlash:s,decodePercentEncoding:a}))},d=this;(r=i.exec(e))!==null;)c();return u},t.prototype.matchHasUnbalancedClosingParen=function(e){var r,i=e.charAt(e.length-1);if(i===")")r="(";else if(i==="]")r="[";else{if(i!=="}")return!1;r="{"}for(var o=0,s=0,a=e.length-1;s<a;s++){var l=e.charAt(s);l===r?o++:l===i&&(o=Math.max(o-1,0))}return o===0},t.prototype.matchHasInvalidCharAfterTld=function(e,r){if(!e)return-1;var i=0;r&&(i=e.indexOf(":"),e=e.slice(i));var o=new RegExp("^((.?//)?[-."+$t+"]*[-"+$t+"]\\.[-"+$t+"]+)").exec(e);return o===null?-1:(i+=o[1].length,e=e.slice(o[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(Po),nD=new RegExp("#[_"+$t+"]{1,139}(?![_"+$t+"])","g"),rD=new RegExp("[^"+$t+"]"),hT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegex=nD,r.nonWordCharRegex=rD,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.nonWordCharRegex,s=this.serviceName,a=this.tagBuilder,l=[];(r=i.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||o.test(c)){var d=r[0],h=r[0].slice(1);l.push(new rT({tagBuilder:a,matchedText:d,offset:u,serviceName:s,hashtag:h}))}}return l},t}(Po),iD=new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source+"|"+/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source,"g"),pT=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.matcherRegex=iD,e}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.tagBuilder,s=[];(r=i.exec(e))!==null;){var a=r[0],l=a.replace(/[^0-9,;#]/g,""),u=!(!r[1]&&!r[2]),c=r.index==0?"":e.substr(r.index-1,1),d=e.substr(r.index+a.length,1),h=!c.match(/\d/)&&!d.match(/\d/);this.testMatch(r[3])&&this.testMatch(a)&&h&&s.push(new oT({tagBuilder:o,matchedText:a,offset:r.index,number:l,plusSign:u}))}return s},t.prototype.testMatch=function(e){return WR.test(e)},t}(Po),oD=new RegExp("@[_"+$t+"]{1,50}(?![_"+$t+"])","g"),sD=new RegExp("@[_."+$t+"]{1,30}(?![_"+$t+"])","g"),aD=new RegExp("@[-_."+$t+"]{1,50}(?![-_"+$t+"])","g"),lD=new RegExp("[^"+$t+"]"),fT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegexes={twitter:oD,instagram:sD,soundcloud:aD},r.nonWordCharRegex=lD,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.parseMatches=function(e){var r,i=this.serviceName,o=this.matcherRegexes[this.serviceName],s=this.nonWordCharRegex,a=this.tagBuilder,l=[];if(!o)return l;for(;(r=o.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||s.test(c)){var d=r[0].replace(/\.+$/g,""),h=d.slice(1);l.push(new iT({tagBuilder:a,matchedText:d,offset:u,serviceName:i,mention:h}))}}return l},t}(Po),Vn=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.type=n.type||"tag",this.name=n.name||"",this.isOpening=!!n.isOpening,this.isClosing=!!n.isClosing},uD=function(){function n(t){t===void 0&&(t={}),this.version=n.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email=typeof t.email=="boolean"?t.email:this.email,this.phone=typeof t.phone=="boolean"?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=typeof t.newWindow=="boolean"?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash=typeof t.stripTrailingSlash=="boolean"?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=typeof t.decodePercentEncoding=="boolean"?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var e=this.mention;if(e!==!1&&e!=="twitter"&&e!=="instagram"&&e!=="soundcloud")throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(r!==!1&&r!=="twitter"&&r!=="facebook"&&r!=="instagram")throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return n.link=function(t,e){return new n(e).link(t)},n.parse=function(t,e){return new n(e).parse(t)},n.prototype.normalizeUrlsCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:typeof t.schemeMatches!="boolean"||t.schemeMatches,wwwMatches:typeof t.wwwMatches!="boolean"||t.wwwMatches,tldMatches:typeof t.tldMatches!="boolean"||t.tldMatches}},n.prototype.normalizeStripPrefixCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{scheme:t,www:t}:{scheme:typeof t.scheme!="boolean"||t.scheme,www:typeof t.www!="boolean"||t.www}},n.prototype.normalizeTruncateCfg=function(t){return typeof t=="number"?{length:t,location:"end"}:function(e,r){for(var i in r)r.hasOwnProperty(i)&&e[i]===void 0&&(e[i]=r[i]);return e}(t||{},{length:Number.POSITIVE_INFINITY,location:"end"})},n.prototype.parse=function(t){var e=this,r=["a","style","script"],i=0,o=[];return function(s,a){for(var l,u=a.onOpenTag,c=a.onCloseTag,d=a.onText,h=a.onComment,p=a.onDoctype,f=new Vn,m=0,g=s.length,E=0,A=0,v=f;m<g;){var _=s.charAt(m);switch(E){case 0:_==="<"&&V();break;case 1:O(_);break;case 2:S(_);break;case 3:T(_);break;case 4:N(_);break;case 5:y(_);break;case 6:I(_);break;case 7:R(_);break;case 8:b(_);break;case 9:L(_);break;case 10:k(_);break;case 11:B(_);break;case 12:j(_);break;case 13:s.substr(m,2)==="--"?(m+=2,v=new Vn(Mt(Mt({},v),{type:"comment"})),E=14):s.substr(m,7).toUpperCase()==="DOCTYPE"?(m+=7,v=new Vn(Mt(Mt({},v),{type:"doctype"})),E=20):P();break;case 14:$(_);break;case 15:W(_);break;case 16:x(_);break;case 17:Q(_);break;case 18:H(_);break;case 19:nt(_);break;case 20:ot(_);break;default:Qy(E)}m++}function O(F){F==="!"?E=13:F==="/"?(E=2,v=new Vn(Mt(Mt({},v),{isClosing:!0}))):F==="<"?V():yp.test(F)?(E=3,v=new Vn(Mt(Mt({},v),{isOpening:!0}))):(E=0,v=f)}function T(F){Ni.test(F)?(v=new Vn(Mt(Mt({},v),{name:ut()})),E=4):F==="<"?V():F==="/"?(v=new Vn(Mt(Mt({},v),{name:ut()})),E=12):F===">"?(v=new Vn(Mt(Mt({},v),{name:ut()})),it()):yp.test(F)||VR.test(F)||F===":"||P()}function S(F){F===">"?P():yp.test(F)?E=3:P()}function N(F){Ni.test(F)||(F==="/"?E=12:F===">"?it():F==="<"?V():F==="="||Tp.test(F)||GR.test(F)?P():E=5)}function y(F){Ni.test(F)?E=6:F==="/"?E=12:F==="="?E=7:F===">"?it():F==="<"?V():Tp.test(F)&&P()}function I(F){Ni.test(F)||(F==="/"?E=12:F==="="?E=7:F===">"?it():F==="<"?V():Tp.test(F)?P():E=5)}function R(F){Ni.test(F)||(F==='"'?E=8:F==="'"?E=9:/[>=`]/.test(F)?P():F==="<"?V():E=10)}function b(F){F==='"'&&(E=11)}function L(F){F==="'"&&(E=11)}function k(F){Ni.test(F)?E=4:F===">"?it():F==="<"&&V()}function B(F){Ni.test(F)?E=4:F==="/"?E=12:F===">"?it():F==="<"?V():(E=4,m--)}function j(F){F===">"?(v=new Vn(Mt(Mt({},v),{isClosing:!0})),it()):E=4}function $(F){F==="-"?E=15:F===">"?P():E=16}function W(F){F==="-"?E=18:F===">"?P():E=16}function x(F){F==="-"&&(E=17)}function Q(F){E=F==="-"?18:16}function H(F){F===">"?it():F==="!"?E=19:F==="-"||(E=16)}function nt(F){F==="-"?E=17:F===">"?it():E=16}function ot(F){F===">"?it():F==="<"&&V()}function P(){E=0,v=f}function V(){E=1,v=new Vn({idx:m})}function it(){var F=s.slice(A,v.idx);F&&d(F,A),v.type==="comment"?h(v.idx):v.type==="doctype"?p(v.idx):(v.isOpening&&u(v.name,v.idx),v.isClosing&&c(v.name,v.idx)),P(),A=m+1}function ut(){var F=v.idx+(v.isClosing?2:1);return s.slice(F,m).toLowerCase()}A<m&&(l=s.slice(A,m),d(l,A),A=m+1)}(t,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=function(c,d){if(!d.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var h,p=[],f=0;h=d.exec(c);)p.push(c.substring(f,h.index)),p.push(h[0]),f=h.index+h[0].length;return p.push(c.substring(f)),p}(s,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),u=a;l.forEach(function(c,d){if(d%2==0){var h=e.parseText(c,u);o.push.apply(o,h)}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(s){},onDoctype:function(s){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},n.prototype.compactMatches=function(t){t.sort(function(l,u){return l.getOffset()-u.getOffset()});for(var e=0;e<t.length-1;e++){var r=t[e],i=r.getOffset(),o=r.getMatchedText().length,s=i+o;if(e+1<t.length){if(t[e+1].getOffset()===i){var a=t[e+1].getMatchedText().length>o?e:e+1;t.splice(a,1);continue}t[e+1].getOffset()<s&&t.splice(e+1,1)}}return t},n.prototype.removeUnwantedMatches=function(t){return this.hashtag||Si(t,function(e){return e.getType()==="hashtag"}),this.email||Si(t,function(e){return e.getType()==="email"}),this.phone||Si(t,function(e){return e.getType()==="phone"}),this.mention||Si(t,function(e){return e.getType()==="mention"}),this.urls.schemeMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="scheme"}),this.urls.wwwMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="www"}),this.urls.tldMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="tld"}),t},n.prototype.parseText=function(t,e){e===void 0&&(e=0),e=e||0;for(var r=this.getMatchers(),i=[],o=0,s=r.length;o<s;o++){for(var a=r[o].parseMatches(t),l=0,u=a.length;l<u;l++)a[l].setOffset(e+a[l].getOffset());i.push.apply(i,a)}return i},n.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),r=[],i=0,o=0,s=e.length;o<s;o++){var a=e[o];r.push(t.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(t.substring(i)),r.join("")},n.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),typeof e=="string"?e:e===!1?t.getMatchedText():e instanceof Ap?e.toAnchorString():t.buildTag().toAnchorString()},n.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var t=this.getTagBuilder(),e=[new hT({tagBuilder:t,serviceName:this.hashtag}),new cT({tagBuilder:t}),new pT({tagBuilder:t}),new fT({tagBuilder:t,serviceName:this.mention}),new dT({tagBuilder:t,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=e},n.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new tT({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},n.version="3.14.3",n.AnchorTagBuilder=tT,n.HtmlTag=Ap,n.matcher={Email:cT,Hashtag:hT,Matcher:Po,Mention:fT,Phone:pT,Url:dT},n.match={Email:vp,Hashtag:rT,Match:Mo,Mention:iT,Phone:oT,Url:_p},n}();function mT(n,t=n){return{type:"autolink",url:n,text:t}}const cD=dr(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([n,t,e])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(t),e)),dD=dr(/<!!customemoji:(.*?)>/gm,([n,t])=>function(e){return{type:"customemoji",text:e}}(t)),gT=dr(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([n,t,e])=>function(r,i=[]){return{type:"link",url:r,children:i}}(t,[e])),hD=dr(/<actionlink:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=ET(t);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[e])}),pD=dr(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=ET(t);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[e])});function ET(n){const t=n.indexOf("?");return t===-1?{action:n,params:{}}:{action:n.slice(0,t),params:Object.fromEntries(new URLSearchParams(n.slice(t)))}}const fD=dr(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([n])=>function(t=[]){return{type:"bulletlist",children:t}}([n.startsWith(`
1315
+ `;case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"emoji":case"customemoji":case"customEmoji":return e.text;case"suppressed":return t.contactInfoHiddenText;case"mention":return`@${e.text}`}}).join("")}class Mo extends cu{constructor(t,e,r,i){super(t),this.conversationId=e,this.message=r,this.realtimeClient=i}get messageId(){return typeof this.message=="string"?this.message:this.message.id}fetchInitial(t){return H(this,null,function*(){let e;if(typeof this.message=="object")e=this.message;else{const r=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"messages",this.message],{},{bypassCache:!0});if(!r.ok)return r;e=r.value.data}return G({lastChanged:t,sender:e.senderId===null?null:this.realtimeClient.internalSubscribe(["users",e.senderId]),data:{id:e.id,type:e.type,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,referencedMessageId:e.referencedMessageId,origin:e.origin,plaintext:pu(e.content,{}),content:e.content,reactions:up(e.reactions)}})})}refetch(t){throw"Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){return be(t.data,e.data)}teardownNested(t){var e;(e=t.sender)==null||e.unsubscribe()}anyChildChanged(t,e,r){return H(this,null,function*(){var i;const o=(i=r.sender)==null?void 0:i.store;return(yield o==null?void 0:o.changedBetween(t,e))===!0})}loadNested(t,e){return H(this,null,function*(){var r,i,o;const s=yield(i=(r=e.sender)==null?void 0:r.store)==null?void 0:i.getDeep(t);if((s==null?void 0:s.ok)===!1)return s;if(e.data===null)return G({snapshot:null});const a=s==null?void 0:s.value;return G({snapshot:{sender:(o=a==null?void 0:a.snapshot)!=null?o:null,id:e.data.id,type:e.data.type,custom:e.data.custom,createdAt:e.data.createdAt,editedAt:e.data.editedAt,origin:e.data.origin,plaintext:pu(e.data.content,{}),content:e.data.content,referencedMessageId:e.data.referencedMessageId,reactions:e.data.reactions}})})}messageEdited(t,e){this.mutate(t,r=>r.value.data===null?r:G({lastChanged:t,sender:r.value.sender,data:{id:r.value.data.id,type:r.value.data.type,createdAt:r.value.data.createdAt,origin:r.value.data.origin,referencedMessageId:r.value.data.referencedMessageId,editedAt:Ht(r.value.data.editedAt,e.diff.editedAt),custom:op(r.value.data.custom,e.diff.custom),content:Ht(r.value.data.content,e.diff.content),reactions:RR(r.value.data.reactions,e.diff.reactions)}}))}messageDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:this.messageId===e.messageId?(this.teardownNested(r.value),G({lastChanged:t,sender:null,data:null})):r.value.data.referencedMessageId===e.messageId?G({lastChanged:t,sender:r.value.sender,data:{id:r.value.data.id,type:r.value.data.type,createdAt:r.value.data.createdAt,origin:r.value.data.origin,referencedMessageId:null,editedAt:r.value.data.editedAt,custom:r.value.data.custom,content:r.value.data.content,reactions:r.value.data.reactions}}):r)}getFromCache(){return H(this,null,function*(){var t;const e=yield this.mostRecentState.resultPromise;if(!e.ok)return Ut("NOT_IN_CACHE");if(e.value.data===null)return Ti({status:404,errorCode:"MESSAGE_NOT_FOUND",reasons:["No message with that ID exists"]});const r=e.value,{sender:i}=r,o=Ly(r,["sender"]),s={};return o.data.reactions.forEach(a=>{s[a.emoji]={count:a.count,currentUserReacted:a.currentUserReacted}}),G({status:200,data:On(_t({},o.data),{senderId:(t=i==null?void 0:i.store.userId)!=null?t:null,reactions:s})})})}}function RR(n,t){if(t===void 0)return n;const e=n.map(i=>{const o=t[i.emoji];return o===void 0?i:o===null?On(_t({},i),{count:0}):{emoji:i.emoji,count:Ht(i.count,o.count),currentUserReacted:Ht(i.currentUserReacted,o.currentUserReacted)}}).filter(i=>i.count>0),r=new Set(e.map(i=>i.emoji));for(const i in t){const o=t[i];o&&!r.has(i)&&e.push({emoji:i,count:o.count,currentUserReacted:o.currentUserReacted})}return e.sort((i,o)=>i.emoji.localeCompare(o.emoji)),e}function up(n){const t=Object.entries(n).map(([e,r])=>({emoji:e,count:r.count,currentUserReacted:r.currentUserReacted}));return t.sort((e,r)=>e.emoji.localeCompare(r.emoji)),t}class cp extends cu{constructor(t,e,r,i){super(t),this.createdAt=e,this.dataStore=r,this.referencedDataStore=i}get messageId(){return this.dataStore.messageId}fetchInitial(t){return H(this,null,function*(){return G({lastChanged:t,dataStore:this.dataStore,referencedDataStore:this.referencedDataStore})})}refetch(t){throw"Do not call refetch on message stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){return!0}teardownNested(t){}anyChildChanged(t,e,r){return H(this,arguments,function*(i,o,{dataStore:s,referencedDataStore:a}){return(yield s.changedBetween(i,o))===!0||(yield a==null?void 0:a.changedBetween(i,o))===!0})}loadNested(t,e){return H(this,null,function*(){var r,i,o;const s=yield e.dataStore.getDeep(t);if(!s.ok)return s;const a=s.value;if(a.snapshot===null)return G({snapshot:null});const l=yield(r=e.referencedDataStore)==null?void 0:r.getDeep(t);if(l&&!l.ok)return l;const u=(i=l==null?void 0:l.value)!=null?i:null,c=(o=u==null?void 0:u.snapshot)!=null?o:null;return G({snapshot:{id:a.snapshot.id,type:a.snapshot.type,sender:a.snapshot.sender,custom:a.snapshot.custom,createdAt:a.snapshot.createdAt,editedAt:a.snapshot.editedAt,referencedMessage:c,origin:a.snapshot.origin,plaintext:a.snapshot.plaintext,content:a.snapshot.content,reactions:a.snapshot.reactions}})})}}class DR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}listen(t){return this.onlyUsedInternally&&this.mostRecentState.resultPromise.then(e=>{if(e.ok&&e.value.inWindow!==null){const r=30-e.value.inWindow.length;r>0&&this._loadMoreMessages(r)}}),super.listen(t)}fetchInitial(t){return H(this,null,function*(){const e=this.onlyUsedInternally?1:30,r=yield $y({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:e});return r.ok?r.value.messages===null?G({lastChanged:t,lastMessageChanged:t,stores:null,inWindow:null,windowEnd:null}):jy({seq:t,messages:r.value.messages,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r})}teardownNested(t){if(t.stores){const e=Ut("TERMINATED");Object.values(t.stores).forEach(r=>r.setError(e)),t.inWindow.forEach(r=>r.setError(e))}}anyChildChanged(t,e,r){return H(this,null,function*(){for(const i in r.stores){const o=r.stores[i];if((yield o==null?void 0:o.changedBetween(t,e))===!0)return!0}return!1})}lastMessageChangedBetween(t,e){return H(this,null,function*(){if(t>=e)return!1;const r=yield this.get(e).resultPromise;if(!r.ok)return!1;if(r.value.lastMessageChanged>t)return!0;if(r.value.stores===null)return!1;const i=r.value.inWindow[0];return i!==void 0&&(yield i.changedBetween(t,e))===!0})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&!!be(t.inWindow.map(r=>r.messageId),e.inWindow.map(r=>r.messageId))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return H(this,null,function*(){if(e.stores===null)return G({snapshot:null,loadedAll:!0});const r=yield Promise.all(e.inWindow.map(o=>o.getDeep(t)));return r.find(o=>!o.ok)||G({snapshot:r.filter(o=>o.value.snapshot!==null).map(o=>o.value.snapshot),loadedAll:e.windowEnd===null})})}loadMore(t){return H(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreMessages(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreMessages(t=30){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield $y({count:t,cursor:r,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.messages===null?(console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."),s):jy({seq:o,prevState:s.value,messages:i.value.messages,cursor:i.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}messageCreated(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."),r;if(r.value.windowEnd&&e.state.createdAt<r.value.windowEnd.oldestMessageTs||Object.hasOwnProperty.call(r.value.stores,e.state.id))return r;const i=_t({},r.value.stores),o=new Mo(t,this.conversationId,e.state,this.realtimeClient);i[e.state.id]=o;const s=e.state.referencedMessageId;let a;s===null?a=null:s in i?a=i[s]:(a=new Mo(t,this.conversationId,s,this.realtimeClient),i[s]=a);const l=new cp(t,e.state.createdAt,o,a),u=[...r.value.inWindow,l];u.sort((d,h)=>h.createdAt-d.createdAt);const c=u[0].messageId===e.messageId?t:r.value.lastMessageChanged;return G({lastChanged:t,lastMessageChanged:c,stores:i,inWindow:u,windowEnd:r.value.windowEnd})})}messageEdited(t,e){this.mutate(t,r=>{var i;return r.value.stores===null?(console.warn("[TalkJS] Received a 'message.edited' event for a nonexistent conversation."),r):((i=r.value.stores[e.messageId])==null||i.messageEdited(t,e),r)})}messageDeleted(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'message.deleted' event for a conversation that we thought didn't exist."),r;if(Object.values(r.value.stores).forEach(a=>a.messageDeleted(t,e)),r.value.stores[e.messageId]===void 0)return r;const i=_t({},r.value.stores);delete i[e.messageId];const o=r.value.inWindow.filter(a=>a.messageId!==e.messageId);if(e.newLastMessage&&o.length===0){const a=new Mo(t,this.conversationId,e.newLastMessage,this.realtimeClient);i[a.messageId]=a;const l=e.newLastMessage.referencedMessageId;let u;l===null?u=null:l in i?u=i[l]:(u=new Mo(t,this.conversationId,l,this.realtimeClient),i[l]=u);const c=new cp(t,e.newLastMessage.createdAt,a,u);o.push(c)}const s=e.newLastMessage!==void 0?t:r.value.lastMessageChanged;return G({lastChanged:t,lastMessageChanged:s,stores:i,inWindow:o,windowEnd:r.value.windowEnd})})}conversationCleared(t,e){this.mutate(t,r=>{var i;return((i=r.value.inWindow)==null?void 0:i.length)===0&&r.value.windowEnd===null?r:(this.teardownNested(r.value),G({lastChanged:t,lastMessageChanged:t,stores:{},inWindow:[],windowEnd:null}))})}sideCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.stores!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}sideDeleted(t,e){this.mutate(t,r=>r.value.stores===null?r:(this.teardownNested(r.value),G({lastChanged:t,lastMessageChanged:t,stores:null,inWindow:null,windowEnd:null})))}getMessageFromCache(t){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.stores===null)return Ut("NOT_IN_CACHE");const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.getFromCache()})}}function $y(n){return H(this,arguments,function*({cursor:t,realtimeClient:e,conversationId:r,count:i}){const o={limit:i,cursor:t},s=yield e.call("GET",["me","conversations",r,"messages"],o,{bypassCache:!0});if(s.ok){const{data:a,cursor:l}=s.value.data;return G({messages:a,nextCursor:l})}return!s.ok&&s.where==="server"&&s.value.status===404||!s.ok&&s.where==="server"&&s.value.status===403&&s.value.errorCode==="NOT_A_PARTICIPANT"?G({messages:null,nextCursor:null}):s})}function jy({seq:n,prevState:t,messages:e,cursor:r,conversationId:i,realtimeClient:o}){var s,a,l,u;const c=t?_t({},t.stores):{};for(const p of e)if(c[p.id]===void 0){const f=new Mo(n,i,p,o);c[f.messageId]=f}for(const p of e){const f=p.referencedMessageId;if(f&&c[f]===void 0){const m=new Mo(n,i,f,o);c[m.messageId]=m}}const d=t?[...t.inWindow]:[];for(const p of e)d.push(new cp(n,p.createdAt,c[p.id],p.referencedMessageId?c[p.referencedMessageId]:null));d.sort((p,f)=>f.createdAt-p.createdAt);const h=((a=(s=t==null?void 0:t.inWindow)==null?void 0:s[0])==null?void 0:a.messageId)===((l=d==null?void 0:d[0])==null?void 0:l.messageId)&&(u=t==null?void 0:t.lastMessageChanged)!=null?u:n;return G(r===null?{lastChanged:n,lastMessageChanged:h,stores:c,inWindow:d,windowEnd:null}:{lastChanged:n,lastMessageChanged:h,stores:c,inWindow:d,windowEnd:{cursor:r,oldestMessageTs:e[e.length-1].createdAt}})}class kR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.convDataStore=e,this.realtimeClient=r,this.unsubscribeDebounceMs=0}fetchInitial(t){return H(this,null,function*(){return G({lastChanged:t,store:this.convDataStore})})}teardownNested(t){t.store.unsubscribe()}anyChildChanged(t,e,r){return H(this,null,function*(){return r.store.store.changedBetween(t,e)})}equal(t,e){return!0}loadNested(t,e){return H(this,null,function*(){return e.store.store.getDeep(t)})}getFromCache(){return H(this,null,function*(){return this.convDataStore.store.getFromCache()})}}function dp(n,t){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t(n[e],e)}function hp(n,t){return function(e){let r={};return dp(e,(i,o)=>{const[s,a]=(([l,u])=>[l,t(u,l)])([o,i],0);r[s]=a}),r}(n)}class LR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e4}fetchInitial(t){return H(this,null,function*(){const e=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"typing"],{},{bypassCache:!0});if(!e.ok&&e.where==="server"&&e.value.status===404)return G({data:null,lastChanged:t});if(!e.ok&&e.where==="server"&&e.value.status===403&&e.value.errorCode==="NOT_A_PARTICIPANT")return G({data:null,lastChanged:t});if(!e.ok)return e;const r=e.value.data;return r.many?G({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:t}):G({data:r,userSubscriptions:hp(r.usersTyping,(i,o)=>this.realtimeClient.internalSubscribe(["users",o])),lastChanged:t})})}equal(t,e){return be(t.data,e.data)}loadNested(t,e){return H(this,null,function*(){if(e.data===null)return G({snapshot:null,lastChanged:e.lastChanged});if(e.data.many)return G({snapshot:{many:!0},lastChanged:e.lastChanged});const r=Object.entries(e.data.usersTyping).sort(([u,c],[d,h])=>c-h).map(([u,c])=>u).map(u=>e.userSubscriptions[u].store.getDeep(t)),i=yield Promise.all(r),o=i.find(u=>!u.ok);if(o)return o;const s=i.map(u=>u.value),a=s.map(u=>u.snapshot),l=s.map(u=>u.lastChanged);return G({snapshot:{users:a,many:!1},lastChanged:Math.max(e.lastChanged,...l)})})}typingAvailable(t,e){this.mutate(t,()=>G({data:e.state,userSubscriptions:e.state.many?{}:hp(e.state.usersTyping,(r,i)=>this.realtimeClient.internalSubscribe(["users",i])),lastChanged:t}))}typingChanged(t,e){this.mutate(t,r=>{if(r.value.data===null)return r;if(e.diff.many===void 0){if(r.value.data.many===!0)return r;const i=_t({},r.value.data.usersTyping),o=_t({},r.value.userSubscriptions);return dp(e.diff.usersTyping,(s,a)=>{var l;typeof s=="number"?(i[a]=s,o[a]=this.realtimeClient.internalSubscribe(["users",a])):s===null&&(delete i[a],(l=o[a])==null||l.unsubscribe(),delete o[a])}),G({data:{usersTyping:i,many:!1},userSubscriptions:o,lastChanged:t})}if(e.diff.many===!0)return r.value.data.many?r:G({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:t});if(e.diff.many===!1){if(r.value.data.many===!1)return r;const i=hp(e.diff.usersTyping,(o,s)=>this.realtimeClient.internalSubscribe(["users",s]));return G({data:e.diff,userSubscriptions:i,lastChanged:t})}throw e.diff,"Unreachable"})}sideDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:G({data:null,lastChanged:t}))}teardownNested(t){t.data&&dp(t.userSubscriptions,e=>e.unsubscribe())}anyChildChanged(t,e,r){return H(this,null,function*(){var i;if(r.data===null)return!1;for(const o in r.userSubscriptions){const s=r.userSubscriptions[o];if((yield(i=s==null?void 0:s.store)==null?void 0:i.changedBetween(t,e))===!0)return!0}return!1})}}class Yy extends cu{constructor(t,e,r,i){super(t),this.conversationId=e,this.participantData=r,this.realtimeClient=i}fetchInitial(t){return H(this,null,function*(){return G({lastChanged:t,user:this.realtimeClient.internalSubscribe(["users",this.participantData.id]),data:this.participantData})})}refetch(t){throw"Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead"}equal(t,e){var r,i,o,s;return((i=(r=t.user)==null?void 0:r.store)==null?void 0:i.userId)===((s=(o=e.user)==null?void 0:o.store)==null?void 0:s.userId)&&be(t.data,e.data)}teardownNested(t){var e;(e=t.user)==null||e.unsubscribe()}anyChildChanged(t,e,r){return H(this,null,function*(){var i;const o=(i=r.user)==null?void 0:i.store;return(yield o==null?void 0:o.changedBetween(t,e))===!0})}loadNested(t,e){return H(this,null,function*(){if(e.data===null)return G({snapshot:null});const r=yield e.user.store.getDeep(t);if(r.ok===!1)return r;const i=r.value.snapshot;return G({snapshot:this.realtimeClient.createParticipantSnapshotPreloaded(e.data,i)})})}participantEdited(t,e){this.mutate(t,r=>r.value.data===null?r:G({lastChanged:t,user:r.value.user,data:{id:r.value.data.id,access:Ht(r.value.data.access,e.diff.access),notify:Ht(r.value.data.notify,e.diff.notify),joinedAt:r.value.data.joinedAt}}))}participantDeleted(t,e){this.mutate(t,r=>r.value.data===null?r:(this.teardownNested(r.value),G({lastChanged:t,user:null,data:null})))}getFromCache(){return H(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok?t.value.data===null?Ti({status:404,errorCode:"PARTICIPANT_NOT_FOUND",reasons:["No participant with that ID exists"]}):G({status:200,data:t.value.data}):Ut("NOT_IN_CACHE")})}}class xR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversationId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(t){return H(this,null,function*(){const e=yield zy({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:10});return e.ok?e.value.participants===null?G({lastChanged:t,stores:null,inWindow:null,windowEnd:null}):Vy({seq:t,participants:e.value.participants,cursor:e.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):e})}teardownNested(t){if(t.stores){const e=Ut("TERMINATED");Object.values(t.stores).forEach(r=>r.setError(e))}}anyChildChanged(t,e,r){return H(this,null,function*(){for(const i in r.stores){const o=r.stores[i];if((yield o==null?void 0:o.changedBetween(t,e))===!0)return!0}return!1})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return H(this,null,function*(){if(e.stores===null)return G({snapshot:null,loadedAll:!0});const r=yield Promise.all(Object.values(e.stores).map(s=>s.getDeep(t))),i=r.find(s=>!s.ok);if(i)return i;const o=r.filter(s=>s.value.snapshot!==null).map(s=>s.value.snapshot);return o.sort((s,a)=>a.joinedAt-s.joinedAt),G({snapshot:o,loadedAll:e.windowEnd===null})})}loadMore(t){return H(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreParticipants(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreParticipants(t=10){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield zy({count:t,cursor:r,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.participants===null?(console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."),s):Vy({seq:o,prevStores:s.value.stores,participants:i.value.participants,cursor:i.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}participantCreated(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."),r;if(r.value.windowEnd&&e.state.joinedAt<r.value.windowEnd.oldestParticipantTs||Object.hasOwnProperty.call(r.value.stores,e.state.id))return r;const i=_t({},r.value.stores),o=new Yy(t,this.conversationId,e.state,this.realtimeClient);return i[e.state.id]=o,G({lastChanged:t,stores:i,windowEnd:r.value.windowEnd})})}participantEdited(t,e){this.mutate(t,r=>{var i;return r.value.stores===null?(console.warn("[TalkJS] Received a 'participant.edited' event for a nonexistent conversation."),r):((i=r.value.stores[e.userId])==null||i.participantEdited(t,e),r)})}participantDeleted(t,e){this.mutate(t,r=>{if(r.value.stores===null)return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."),r;const i=r.value.stores[e.userId];if(i===void 0)return r;i.participantDeleted(t,e);const o=_t({},r.value.stores);return delete o[e.userId],G({lastChanged:t,stores:o,windowEnd:r.value.windowEnd})})}sideCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.stores!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}sideDeleted(t,e){this.mutate(t,r=>r.value.stores===null?r:(this.teardownNested(r.value),G({lastChanged:t,stores:null,inWindow:null,windowEnd:null})))}getParticipantFromCache(t){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.stores===null)return Ut("NOT_IN_CACHE");const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.getFromCache()})}}function zy(n){return H(this,arguments,function*({cursor:t,realtimeClient:e,conversationId:r,count:i}){const o={limit:i,cursor:t},s=yield e.call("GET",["me","conversations",r,"participants"],o,{bypassCache:!0});if(s.ok){const{data:a,cursor:l}=s.value.data;return G({participants:a,nextCursor:l})}return!s.ok&&s.where==="server"&&s.value.status===404||!s.ok&&s.where==="server"&&s.value.status===403&&s.value.errorCode==="NOT_A_PARTICIPANT"?G({participants:null,nextCursor:null}):s})}function Vy({seq:n,prevStores:t,participants:e,cursor:r,conversationId:i,realtimeClient:o}){const s=t?_t({},t):{};for(const a of e)if(s[a.id]===void 0){const l=new Yy(n,i,a,o);s[a.id]=l}return G(r===null?{lastChanged:n,stores:s,windowEnd:null}:{lastChanged:n,stores:s,windowEnd:{cursor:r,oldestParticipantTs:e[e.length-1].joinedAt}})}class MR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.getConvDataStore=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(t){return H(this,null,function*(){const e=yield Wy({realtimeClient:this.realtimeClient,count:20});return e.ok?e.value.conversations===null?G({lastChanged:t,stores:null,windowEnd:null}):Gy({seq:t,conversations:e.value.conversations,cursor:e.value.nextCursor,getConvDataStore:this.getConvDataStore}):e})}teardownNested(t){t.stores!==null&&Object.values(t.stores).forEach(e=>e.unsubscribe())}anyChildChanged(t,e,r){return H(this,null,function*(){var i;for(const o in r.stores){const s=r.stores[o];if((yield(i=s==null?void 0:s.store)==null?void 0:i.changedBetween(t,e))===!0)return!0}return!1})}equal(t,e){return t.stores===null&&e.stores===null||t.stores!==null&&e.stores!==null&&!!be(Object.keys(t.stores),Object.keys(e.stores))&&be(t.windowEnd,e.windowEnd)}loadNested(t,e){return H(this,null,function*(){if(e.stores===null)return G({snapshot:[],loadedAll:!0});const r=yield Promise.all(Object.values(e.stores).map(s=>s.store.getDeep(t))),i=r.find(s=>!s.ok);if(i)return i;const o=r.filter(s=>s.value.snapshot!==null).map(s=>s.value.snapshot);return o.sort((s,a)=>{var l,u,c,d;const h=(u=(l=s.lastMessage)==null?void 0:l.createdAt)!=null?u:s.joinedAt;return((d=(c=a.lastMessage)==null?void 0:c.createdAt)!=null?d:a.joinedAt)-h}),G({snapshot:o,loadedAll:e.windowEnd===null})})}loadMore(t){return H(this,null,function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const e=yi();this.pendingLoadMore=e.promise,yield this._loadMoreConversations(t),e.resolve(),this.pendingLoadMore=void 0})}_loadMoreConversations(t=20){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok||e.value.windowEnd===null)return;const r=e.value.windowEnd.cursor,i=yield Wy({count:t,cursor:r,realtimeClient:this.realtimeClient}),o=this.getLoadMoreSeq();this.mutate(o,s=>s.value.windowEnd===null||r!==s.value.windowEnd.cursor?s:i.ok?i.value.conversations===null?(console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."),s):Gy({seq:o,prevStores:s.value.stores,conversations:i.value.conversations,cursor:i.value.nextCursor,getConvDataStore:this.getConvDataStore}):i),yield this.emitMutex.runExclusive(()=>this.emit(o))})}getConvFromCache(t){return H(this,null,function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok)return Ut("NOT_IN_CACHE");if(e.value.stores===null)return Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const r=e.value.stores[t];return r===void 0?Ut("NOT_IN_CACHE"):r.store.getFromCache()})}userCreated(t,e){this.mutate(t,r=>r.value.stores!==null?r:G({lastChanged:r.value.lastChanged,stores:{},windowEnd:null}))}sideCreated(t,e){const r=this.getConvDataStore(e.state);this.mutate(t,i=>Object.hasOwnProperty.call(i.value.stores,e.conversationId)?(r.unsubscribe(),i):G({lastChanged:t,stores:On(_t({},i.value.stores),{[e.conversationId]:r}),windowEnd:i.value.windowEnd}))}sideDeleted(t,e){this.mutate(t,r=>{var i;if(!Object.hasOwnProperty.call(r.value.stores,e.conversationId))return r;const o=_t({},r.value.stores);return(i=o[e.conversationId])==null||i.unsubscribe(),delete o[e.conversationId],G({lastChanged:t,stores:o,windowEnd:r.value.windowEnd})})}sideEdited(t,e){const r=e.diff.lastMessageAt;r!==void 0&&this.mutate(t,i=>{var o;if(i.value.stores===null)return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."),i;if(i.value.windowEnd===null)return i;const s=Object.hasOwnProperty.call(i.value.stores,e.conversationId);if(s&&r<i.value.windowEnd.oldestMessageTs){const a=_t({},i.value.stores);return(o=a[e.conversationId])==null||o.unsubscribe(),delete a[e.conversationId],G({lastChanged:t,stores:a,windowEnd:i.value.windowEnd})}if(!s&&r>=i.value.windowEnd.oldestMessageTs){const a=this.getConvDataStore(e.conversationId);return G({lastChanged:t,stores:On(_t({},i.value.stores),{[e.conversationId]:a}),windowEnd:i.value.windowEnd})}return i})}}function Wy(n){return H(this,arguments,function*({cursor:t,realtimeClient:e,count:r}){const i={limit:r,cursor:t},o=yield e.call("GET",["me","conversations"],i,{bypassCache:!0});if(o.ok){const{data:s,cursor:a}=o.value.data;return G({conversations:s,nextCursor:a})}return o.ok||o.where!=="server"||o.value.status!==404||o.value.errorCode!=="USER_NOT_FOUND"?o:G({conversations:null,nextCursor:null})})}function Gy({seq:n,prevStores:t,conversations:e,cursor:r,getConvDataStore:i}){const o=t?_t({},t):{};for(const s of e)o[s.id]===void 0&&(o[s.id]=i(s));return G(r===null?{lastChanged:n,stores:o,windowEnd:null}:{lastChanged:n,stores:o,windowEnd:{cursor:r,oldestMessageTs:Math.min(...e.map(s=>s.lastMessageAt))}})}class PR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.conversation=e,this.realtimeClient=r,this.unsubscribeDebounceMs=5e3}get conversationId(){return typeof this.conversation=="string"?this.conversation:this.conversation.id}fetchInitial(t){return H(this,null,function*(){const e=this.realtimeClient.internalSubscribe(["me","conversations",this.conversationId,"messages"]);if(typeof this.conversation=="object")return G({lastChanged:t,snapshot:this.conversation,messageWindowStore:e});const r=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId],{},{bypassCache:!0});let i;if(r.ok)i=r.value.data;else if(r.where==="server"&&r.value.status===404)i=null;else{if(r.where!=="server"||r.value.status!==403||r.value.errorCode!=="NOT_A_PARTICIPANT")return e.unsubscribe(),r;i=null}return G({lastChanged:t,snapshot:i,messageWindowStore:e})})}teardownNested(t){var e;(e=t.messageWindowStore)==null||e.unsubscribe()}anyChildChanged(t,e,r){return H(this,null,function*(){return(yield r.messageWindowStore.store.lastMessageChangedBetween(t,e))===!0})}equal(t,e){return be(t.snapshot,e.snapshot)}loadNested(t,e){return H(this,null,function*(){var r;if(!e.snapshot)return G({snapshot:null,loadedAll:!0});const i=yield e.messageWindowStore.store.getDeep(t);if(!i.ok)return i;const o=i.value.snapshot,s=(r=o==null?void 0:o[0])!=null?r:null;return G({snapshot:On(_t({},e.snapshot),{lastMessage:s})})})}participantEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."),r):G({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}conversationEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."),r):G({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}sideEdited(t,e){this.mutate(t,r=>r.value.snapshot===null?(console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."),r):G({lastChanged:t,snapshot:pp(r.value.snapshot,e.diff),messageWindowStore:r.value.messageWindowStore}))}sideCreated(t,e){this.mutate(t,r=>r.value.snapshot?r:G({lastChanged:t,snapshot:e.state,messageWindowStore:r.value.messageWindowStore}))}sideDeleted(t,e){this.mutate(t,r=>r.value.snapshot===null?r:G({lastChanged:t,snapshot:null,messageWindowStore:r.value.messageWindowStore}))}getFromCache(){return H(this,null,function*(){const t=yield this.mostRecentState.resultPromise;return t.ok&&t.value.snapshot?G({status:200,data:t.value.snapshot}):Ut("NOT_IN_CACHE")})}}function pp(n,t){const e=t;return{id:n.id,createdAt:n.createdAt,subject:Ht(n.subject,e.subject),photoUrl:Ht(n.photoUrl,e.photoUrl),welcomeMessages:Ht(n.welcomeMessages,e.welcomeMessages),custom:op(n.custom,e.custom),lastMessageAt:Ht(n.lastMessageAt,e.lastMessageAt),unreadMessageCount:Ht(n.unreadMessageCount,e.unreadMessageCount),isUnread:Ht(n.isUnread,e.isUnread),access:Ht(n.access,e.access),notify:Ht(n.notify,e.notify),readUntil:Ht(n.readUntil,e.readUntil),everyoneReadUntil:Ht(n.everyoneReadUntil,e.everyoneReadUntil),joinedAt:n.joinedAt}}class BR extends Fr{constructor(t,e,r,i,o){super(t,i,o),this.userId=e,this.realtimeClient=r,this.unsubscribeDebounceMs=1e3}fetchInitial(t){return H(this,null,function*(){const e=this.realtimeClient.internalSubscribe(["users",this.userId]),r=yield this.realtimeClient.call("GET",["users",this.userId,"online"],{},{bypassCache:!0});return r.ok||r.where!=="server"||r.value.status!==404||r.value.errorCode!=="USER_NOT_FOUND"?r.ok?G({lastChanged:t,user:e,data:r.value.data}):r:G({lastChanged:t,user:e,data:null})})}equal(t,e){return be(t.data,e.data)}teardownNested(t){t.user.unsubscribe()}anyChildChanged(t,e,r){return H(this,null,function*(){return r.user.store.changedBetween(t,e)})}loadNested(t,e){return H(this,null,function*(){const r=yield e.user.store.getDeep(t);if(!r.ok)return r;const i=r.value.snapshot;return e.data===null||i===null?G({snapshot:null}):G({snapshot:_t({user:i},e.data)})})}userCreated(t,e){const r=this.fetchInitial(t);this.mutate(t,i=>i.value.data!==null?(r.then(o=>{o.ok&&this.teardownNested(o.value)}),i):r)}userOnlineChanged(t,e){this.mutate(t,r=>r.value.data===null?r:G({lastChanged:t,user:r.value.user,data:e.diff}))}getFromCache(){return H(this,null,function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return Ut("NOT_IN_CACHE");if(t.value.data===null)return Ti({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const e=t.value,r=Ly(e,["user"]);return G({status:200,data:_t({},r.data)})})}}class FR{constructor(t,e,r){this.realtimeClient=r,this.convDataStores={},this.storeMap={},this.emitMutex=new By,this.seqOffset=0,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss=!0,this.connection=new OR(t,e,{onUpstreamRestarting:()=>{this.refetchOnNextNetworkLoss=!1},onReady:()=>{this.refetchOnNextNetworkLoss=!0},onResubscribeSent:()=>{if(this.seqOffset+=this.seq,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss){this.seqOffset++;const i=this.seq;this.refetchAll(i),this.emitAll(i)}},onResubscribeError:(i,o)=>{var s;(s=this.storeMap[fp(i)])==null||s.setError(o)},onPublish:(i,o)=>{this.seqInThisConnection=i;const s=this.seq;for(const a of o)this.handlePublish(s,a);this.emitAll(s)}})}get seq(){return this.seqOffset+this.seqInThisConnection}refetchAll(t){Object.values(this.storeMap).forEach(e=>e==null?void 0:e.refetch(t))}emitAll(t){return this.emitMutex.runExclusive(()=>H(this,null,function*(){const e=Object.values(this.storeMap).map(r=>r==null?void 0:r.emit(t));yield Promise.all(e)}))}handlePublish(t,e){var r,i,o,s,a,l,u,c,d,h,p,f,m,g,E,A,v,_,O,T,S,N,y,w,b,I,P;switch(e.type){case"user.created":return(r=this.storeMap[`/users/${e.userId}`])==null||r.userCreated(t,e),(i=this.storeMap["/me/conversations"])==null||i.userCreated(t,e),void((o=this.storeMap[`/users/${e.userId}/online`])==null||o.userCreated(t,e));case"user.edited":return void((s=this.storeMap[`/users/${e.userId}`])==null||s.userEdited(t,e));case"side.created":return(a=this.convDataStores[e.conversationId])==null||a.sideCreated(t,e),(l=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||l.sideCreated(t,e),(u=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||u.sideCreated(t,e),void((c=this.storeMap["/me/conversations"])==null||c.sideCreated(t,e));case"side.edited":return(d=this.convDataStores[e.conversationId])==null||d.sideEdited(t,e),void((h=this.storeMap["/me/conversations"])==null||h.sideEdited(t,e));case"side.deleted":return(p=this.convDataStores[e.conversationId])==null||p.sideDeleted(t,e),(f=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||f.sideDeleted(t,e),(m=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||m.sideDeleted(t,e),(g=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||g.sideDeleted(t,e),void((E=this.storeMap["/me/conversations"])==null||E.sideDeleted(t,e));case"conversation.edited":return void((A=this.convDataStores[e.conversationId])==null||A.conversationEdited(t,e));case"message.created":return void((v=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||v.messageCreated(t,e));case"message.edited":return void((_=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||_.messageEdited(t,e));case"message.deleted":return void((O=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||O.messageDeleted(t,e));case"typing.available":return void((T=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||T.typingAvailable(t,e));case"typing.changed":return void((S=this.storeMap[`/me/conversations/${e.conversationId}/typing`])==null||S.typingChanged(t,e));case"conversation.cleared":return void((N=this.storeMap[`/me/conversations/${e.conversationId}/messages`])==null||N.conversationCleared(t,e));case"participant.edited":return(y=this.convDataStores[e.conversationId])==null||y.participantEdited(t,e),void((w=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||w.participantEdited(t,e));case"participant.created":return void((b=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||b.participantCreated(t,e));case"participant.deleted":return void((I=this.storeMap[`/me/conversations/${e.conversationId}/participants`])==null||I.participantDeleted(t,e));case"user.online.changed":return void((P=this.storeMap[`/users/${e.userId}/online`])==null||P.userOnlineChanged(t,e))}}call(t,e,r,i){return H(this,null,function*(){if(!i.bypassCache&&t==="GET"){const o=fp(e);if(o in this.storeMap){const s=o,a=this.storeMap[s];if(a&&"getFromCache"in a){const l=yield a.getFromCache();if(l.value!=="NOT_IN_CACHE")return l}}else if(ln(e,["me","conversations","*","messages","*"])){const s=this.storeMap[`/me/conversations/${e[2]}/messages`];if(s){const a=yield s.getMessageFromCache(e[4]);if(a.value!=="NOT_IN_CACHE")return a}}else if(ln(e,["me","conversations","*","participants","*"])){const s=this.storeMap[`/me/conversations/${e[2]}/participants`];if(s){const a=yield s.getParticipantFromCache(e[4]);if(a.value!=="NOT_IN_CACHE")return a}}else if(ln(e,["me","conversations","*"])){const s=this.storeMap["/me/conversations"];if(s){const a=yield s.getConvFromCache(e[2]);if(a.value!=="NOT_IN_CACHE")return a}}}return this.connection.call(t,e,r)})}subscribe(t,e){const r=this.getOrCreateStore(t),i=yi(),o=yi();i.promise.catch(()=>{}),o.promise.catch(()=>{});const s={state:{type:"pending",latestSnapshot:void 0},connected:i.promise,terminated:o.promise,loadMore:l=>H(this,null,function*(){"loadMore"in r&&(yield r.loadMore(l))}),unsubscribe:()=>{}},a=r.listen(l=>{if(l.ok){const u=!("loadedAll"in l.value)||l.value.loadedAll,c={type:"active",latestSnapshot:l.value.snapshot,loadedAll:u};s.state=c,e==null||e(l.value.snapshot,u),i.resolve(c)}else if(s.state.type==="pending"||s.state.type==="active"){if(l.where==="server"){const u={type:"error",error:new Error(na(`Subscribe to ${t.join("/")}`,l.value))};return s.state=u,o.resolve(u),void i.reject("Subscription encountered an error during initial connection")}if(l.value==="SESSION_DESTROYED"){const u={type:"error",error:new Error("Session was destroyed causing all subscriptions to be terminated")};return s.state=u,o.resolve(u),void i.reject("Subscription encountered an error during initial connection")}if(l.value==="UNSUBSCRIBED"||l.value==="TERMINATED")return;l.value}});return s.unsubscribe=()=>{if(s.state.type==="pending"||s.state.type==="active"){a();const l={type:"unsubscribed"};s.state=l,o.resolve(l),i.reject("Subscription was unsubscribed before connecting")}},s}getOrCreateStore(t){const e=fp(t);if(e in this.storeMap)return this.storeMap[e];this.connection.subscribe(t).then(i=>{i.ok||r.setError(i)});const r=this.instantiateStore(t,()=>{delete this.storeMap[e],this.connection.unsubscribe(t)});return this.storeMap[e]=r,r}destroy(){this.storeMap={},this.convDataStores={},this.connection.destroy()}isConnected(){return this.connection.isConnected()}instantiateStore(t,e){if(ln(t,["users","*"]))return new bR(this.seq,t[1],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*"]))return new kR(this.seq,this.subscribeConvData(t[2]),this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","messages"]))return new DR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","participants"]))return new xR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations","*","typing"]))return new LR(this.seq,t[2],this.realtimeClient,this.emitMutex,e);if(ln(t,["me","conversations"]))return new MR(this.seq,r=>this.subscribeConvData(r),this.realtimeClient,this.emitMutex,e);if(ln(t,["users","*","online"]))return new BR(this.seq,t[1],this.realtimeClient,this.emitMutex,e);throw"Unreachable"}subscribeConvData(t){const e=typeof t=="string"?t:t.id;if(Object.hasOwnProperty.call(this.convDataStores,e)){const i=this.convDataStores[e];return{store:i,unsubscribe:i.registerInternalSubscription()}}const r=new PR(this.seq,t,this.realtimeClient,this.emitMutex,()=>{delete this.convDataStores[e]});return this.convDataStores[e]=r,{store:r,unsubscribe:r.registerInternalSubscription()}}}function fp(n){return`/${n.join("/")}`}class UR{constructor(t,e,r){this.userId=e,this.alive=!0,this.connection=new FR(t,r,this),r.onTokenRefreshFailed(()=>{this.destroy()})}call(t,e,r){return H(this,arguments,function*(i,o,s,a={}){return this.alive?this.connection.call(i,o,s,a):Ut("SESSION_DESTROYED")})}subscribe(t,e){return this.connection.subscribe(t,e)}internalSubscribe(t){const e=this.connection.getOrCreateStore(t);return{store:e,unsubscribe:e.registerInternalSubscription()}}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}listMessages(t,e){return H(this,null,function*(){const r=yield this.call("GET",["me","conversations",t,"messages"],e);if(!r.ok)return mp(r,"Listing messages in "+t);const i=r.value.data.data,o=yield Promise.all(i.map(a=>this.createMessageSnapshot(a,t))),s=o.find(a=>!a.ok);return s===void 0||s.ok?G(o.map(({value:a})=>a)):s})}createConversationSnapshotPreloaded(t,e){return{id:t.id,subject:t.subject,photoUrl:t.photoUrl,welcomeMessages:t.welcomeMessages,custom:t.custom,createdAt:t.createdAt,joinedAt:t.joinedAt,lastMessageAt:t.lastMessageAt,unreadMessageCount:t.unreadMessageCount,isUnread:t.isUnread,access:t.access,notify:t.notify,lastMessage:e,readUntil:t.readUntil,everyoneReadUntil:t.everyoneReadUntil}}createUserSnapshot(t){return{id:t.id,name:t.name,custom:t.custom,locale:t.locale,photoUrl:t.photoUrl,role:t.role,welcomeMessage:t.welcomeMessage}}createParticipantSnapshotPreloaded(t,e){return{user:e,access:t.access,notify:t.notify,joinedAt:t.joinedAt}}createMessageSnapshot(t,e){return H(this,null,function*(){const r=t.senderId===null?Promise.resolve(G(null)):this.getUser(t.senderId),i=t.referencedMessageId===null?Promise.resolve(G(null)):this.getReferencedMessage(e,t.referencedMessageId),o=yield r;if(!o.ok)return o;const s=yield i;return s.ok?G(this.createMessageSnapshotPreloaded(t,o.value,s.value)):s})}getReferencedMessage(t,e){return H(this,null,function*(){const r=yield this.call("GET",["me","conversations",t,"messages",e],{});if(!r.ok&&r.where==="server"&&r.value.status===404||!r.ok&&r.where==="server"&&r.value.status===403&&r.value.errorCode==="NOT_A_PARTICIPANT")return G(null);if(!r.ok)return mp(r,`Fetching referenced message ${e} in conversation ${t}`);const i=r.value.data,o=yield this.getUser(i.senderId);if(!o.ok)return o;const s=o.value;return G(this.createReferencedMessageSnapshotPreloaded(i,s))})}getUser(t){return H(this,null,function*(){const e=yield this.call("GET",["users",t],{includePrivateFields:!1});return e.ok||e.where!=="server"||e.value.status!==404?e.ok?G(this.createUserSnapshot(e.value.data)):mp(e,"Get user "+t):G(null)})}createMessageSnapshotPreloaded(t,e,r){return{id:t.id,type:t.type,sender:e,referencedMessage:r,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,origin:t.origin,content:t.content,reactions:up(t.reactions),plaintext:pu(t.content,{})}}createReferencedMessageSnapshotPreloaded(t,e){return{id:t.id,type:t.type,sender:e,referencedMessageId:t.referencedMessageId,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,origin:t.origin,content:t.content,reactions:up(t.reactions),plaintext:pu(t.content,{})}}}function mp(n,t){return n.where==="server"?Ti(On(_t({},n.value),{operation:t})):n}function gp(n,t){var e;if(t.ok)return t.value;throw t.value==="SESSION_DESTROYED"?new Error(`${n} failed because the session was destroyed`):new Error(na((e=t.value.operation)!=null?e:n,t.value))}class Xy{constructor(t,e){this.id=t,this._realtimeClient=e}get brandedId(){return this.id}get(){return H(this,null,function*(){const t=yield this._realtimeClient.getUser(this.brandedId);return gp("Get user "+this.id,t)})}set(t){return H(this,null,function*(){t.role===null&&(t.role="default");const e=typeof t.email=="string"?[t.email]:t.email,r=typeof t.phone=="string"?[t.phone]:t.phone,i=yield this._realtimeClient.call("PUT",["users",this.brandedId],On(_t({},t),{email:e,phone:r}));xt("Set user "+this.id,i)})}createIfNotExists(t){return H(this,null,function*(){t.role===void 0&&(t.role="default");const e=typeof t.email=="string"?[t.email]:t.email,r=typeof t.phone=="string"?[t.phone]:t.phone,i=yield this._realtimeClient.call("POST",["users",this.brandedId],On(_t({},t),{email:e,phone:r}));(i.ok||i.where!=="server"||i.value.status!=409)&&xt(`Create user ${this.id} if not exists`,i)})}subscribe(t){return this._realtimeClient.subscribe(["users",this.brandedId],t)}subscribeOnline(t){return this._realtimeClient.subscribe(["users",this.brandedId,"online"],t)}}class Ky{constructor(t,e,r){this.userId=t,this.conversationId=e,this._realtimeClient=r}get brandedUserId(){return this.userId}get brandedConversationId(){return this.conversationId}get(){return H(this,null,function*(){const t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"participants",this.brandedUserId],{}),e=yield this._realtimeClient.call("GET",["users",this.brandedUserId],{includePrivateFields:!1}),[r,i]=yield Promise.all([t,e]);if(!r.ok&&r.where==="server"&&r.value.status===404||!i.ok&&i.where==="server"&&i.value.status===404)return null;const o=xt(`Get participant ${this.userId} in conversation ${this.conversationId}`,r),s=xt(`Get user ${this.userId}`,i),a=this._realtimeClient.createUserSnapshot(s);return this._realtimeClient.createParticipantSnapshotPreloaded(o,a)})}set(){return H(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);xt(`Set participant ${this.userId} in conversation ${this.conversationId}`,e)})}edit(){return H(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);xt(`Edit participant ${this.userId} in conversation ${this.conversationId}`,e)})}createIfNotExists(){return H(this,arguments,function*(t={}){const e=yield this._realtimeClient.call("POST",["conversations",this.brandedConversationId,"participants",this.brandedUserId],t);(e.ok||e.where!=="server"||e.value.status!==409)&&xt(`Add participant ${this.userId} to conversation ${this.conversationId}`,e)})}delete(){return H(this,null,function*(){const t=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"participants",this.brandedUserId],{});(t.ok||t.where!=="server"||t.value.status!==404)&&xt(`Remove participant ${this.userId} from conversation ${this.conversationId}`,t)})}}function HR(n){const t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";let e=0;const r=[],i=n===e;e=n;const o=new Array(8);for(let a=7;a>=0;a--)o[a]=t.charAt(n%64),n=Math.floor(n/64);if(n!==0)throw new Error("We should have converted the entire timestamp.");let s=o.join("");if(i){let a;for(a=11;a>=0&&r[a]===63;a--)r[a]=0;r[a]++}else for(let a=0;a<12;a++)r[a]=Math.floor(64*Math.random());for(let a=0;a<12;a++)s+=t.charAt(r[a]);if(s.length!=20)throw new Error("Length should be 20.");return s}const ia=(n,t,e=void 0)=>n.reduce((r,i,o)=>r.concat((s=>{if(typeof s=="string")return t(s,e);switch(s.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:s.type,children:ia(s.children,t,s.type)}];case"link":return[{type:s.type,url:s.url,children:ia(s.children,t,s.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:s.type,action:s.action,params:s.params,children:ia(s.children,t,s.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[s]}})(i)),[]);function dr(n,t){return e=>{const r=e;let i=0;const o=[];for(const s of Uy(e,n)){s.index-i>0&&o.push(r.substring(i,s.index));const a=t(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<e.length&&o.push(e.substring(i)),o}}const qy="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Oi,Ep=((Oi=Ep||{})[Oi.italic=1]="italic",Oi[Oi.strikethrough=2]="strikethrough",Oi[Oi.bold=4]="bold",Oi);const $R=[0,1,2,3,4,5,6].map(n=>{const t=[];return 1&n||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&n||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&n||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map(e=>e.source).join("|"),"g")}),jR={_:1,"*":4,"~":2};function YR(n){return Jy(n,0)}function Jy(n,t=0){const e=$R[t],r=e?function(i){const o=dr(zR.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${qy}])(?:${i.source})(?=[\\s${qy}]|$)`,"g")),s=>{const a=s[0][1],l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6];return[" ",{type:Ep[jR[a]],children:[l]}]});return s=>{const[a,...l]=o(" "+s);return a.length>1&&l.unshift(a.substring(1)),l}}(e):()=>[n];return ia(r(n),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?Jy(i,t|Ep[o]):[i])}const zR=function(){const n=function(){try{return new WeakMap}catch(t){const e={has:()=>!1,get:()=>{},set:()=>e};return e}}();return{getOrCompute(t,e){if(n.has(t))return n.get(t);const r=e();return n.set(t,r),r}}}();function Zy(n,t){if(Array.prototype.indexOf)return n.indexOf(t);for(var e=0,r=n.length;e<r;e++)if(n[e]===t)return e;return-1}function Si(n,t){for(var e=n.length-1;e>=0;e--)t(n[e])===!0&&n.splice(e,1)}function Qy(n){throw new Error("Unhandled case for value: '"+n+"'")}var Ap=function(){function n(t){t===void 0&&(t={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=t.tagName||"",this.attrs=t.attrs||{},this.innerHTML=t.innerHtml||t.innerHTML||""}return n.prototype.setTagName=function(t){return this.tagName=t,this},n.prototype.getTagName=function(){return this.tagName||""},n.prototype.setAttr=function(t,e){return this.getAttrs()[t]=e,this},n.prototype.getAttr=function(t){return this.getAttrs()[t]},n.prototype.setAttrs=function(t){return Object.assign(this.getAttrs(),t),this},n.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},n.prototype.setClass=function(t){return this.setAttr("class",t)},n.prototype.addClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);e=s.shift();)Zy(o,e)===-1&&o.push(e);return this.getAttrs().class=o.join(" "),this},n.prototype.removeClass=function(t){for(var e,r=this.getClass(),i=this.whitespaceRegex,o=r?r.split(i):[],s=t.split(i);o.length&&(e=s.shift());){var a=Zy(o,e);a!==-1&&o.splice(a,1)}return this.getAttrs().class=o.join(" "),this},n.prototype.getClass=function(){return this.getAttrs().class||""},n.prototype.hasClass=function(t){return(" "+this.getClass()+" ").indexOf(" "+t+" ")!==-1},n.prototype.setInnerHTML=function(t){return this.innerHTML=t,this},n.prototype.setInnerHtml=function(t){return this.setInnerHTML(t)},n.prototype.getInnerHTML=function(){return this.innerHTML||""},n.prototype.getInnerHtml=function(){return this.getInnerHTML()},n.prototype.toAnchorString=function(){var t=this.getTagName(),e=this.buildAttrsStr();return["<",t,e=e?" "+e:"",">",this.getInnerHtml(),"</",t,">"].join("")},n.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var t=this.getAttrs(),e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(r+'="'+t[r]+'"');return e.join(" ")},n}(),tT=function(){function n(t){t===void 0&&(t={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=t.newWindow||!1,this.truncate=t.truncate||{},this.className=t.className||""}return n.prototype.build=function(t){return new Ap({tagName:"a",attrs:this.createAttrs(t),innerHtml:this.processAnchorText(t.getAnchorText())})},n.prototype.createAttrs=function(t){var e={href:t.getAnchorHref()},r=this.createCssClass(t);return r&&(e.class=r),this.newWindow&&(e.target="_blank",e.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<t.getAnchorText().length&&(e.title=t.getAnchorHref()),e},n.prototype.createCssClass=function(t){var e=this.className;if(e){for(var r=[e],i=t.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(e+"-"+i[o]);return r.join(" ")}return""},n.prototype.processAnchorText=function(t){return this.doTruncate(t)},n.prototype.doTruncate=function(t){var e=this.truncate;if(!e||!e.length)return t;var r,i,o,s,a=e.length,l=e.location;return l==="smart"?function(u,c,d){var h,p;d==null?(d="&hellip;",p=3,h=8):(p=d.length,h=d.length);var f=function(b){var I="";return b.scheme&&b.host&&(I+=b.scheme+"://"),b.host&&(I+=b.host),b.path&&(I+="/"+b.path),b.query&&(I+="?"+b.query),b.fragment&&(I+="#"+b.fragment),I},m=function(b,I){var P=I/2,k=Math.ceil(P),B=-1*Math.floor(P),$="";return B<0&&($=b.substr(B)),b.substr(0,k)+d+$};if(u.length<=c)return u;var g,E,A,v=c-p,_=(g={},(A=(E=u).match(/^([a-z]+):\/\//i))&&(g.scheme=A[1],E=E.substr(A[0].length)),(A=E.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(g.host=A[1],E=E.substr(A[0].length)),(A=E.match(/^\/(.*?)(?=(\?|#|$))/i))&&(g.path=A[1],E=E.substr(A[0].length)),(A=E.match(/^\?(.*?)(?=(#|$))/i))&&(g.query=A[1],E=E.substr(A[0].length)),(A=E.match(/^#(.*?)$/i))&&(g.fragment=A[1]),g);if(_.query){var O=_.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);O&&(_.query=_.query.substr(0,O[1].length),u=f(_))}if(u.length<=c||(_.host&&(_.host=_.host.replace(/^www\./,""),u=f(_)),u.length<=c))return u;var T="";if(_.host&&(T+=_.host),T.length>=v)return _.host.length==c?(_.host.substr(0,c-p)+d).substr(0,v+h):m(T,v).substr(0,v+h);var S="";if(_.path&&(S+="/"+_.path),_.query&&(S+="?"+_.query),S){if((T+S).length>=v)return(T+S).length==c?(T+S).substr(0,c):(T+m(S,v-T.length)).substr(0,v+h);T+=S}if(_.fragment){var N="#"+_.fragment;if((T+N).length>=v)return(T+N).length==c?(T+N).substr(0,c):(T+m(N,v-T.length)).substr(0,v+h);T+=N}if(_.scheme&&_.host){var y=_.scheme+"://";if((T+y).length<v)return(y+T).substr(0,c)}if(T.length<=c)return T;var w="";return v>0&&(w=T.substr(-1*Math.floor(v/2))),(T.substr(0,Math.ceil(v/2))+d+w).substr(0,v+h)}(t,a):l==="middle"?function(u,c,d){if(u.length<=c)return u;var h,p;d==null?(d="&hellip;",h=8,p=3):(h=d.length,p=d.length);var f=c-p,m="";return f>0&&(m=u.substr(-1*Math.floor(f/2))),(u.substr(0,Math.ceil(f/2))+d+m).substr(0,f+h)}(t,a):(i=a,o=void 0,(r=t).length>i&&(o==null?(o="&hellip;",s=3):s=o.length,r=r.substring(0,i-s)+o),r)},n}(),Po=function(){function n(t){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=t.tagBuilder,this.matchedText=t.matchedText,this.offset=t.offset}return n.prototype.getMatchedText=function(){return this.matchedText},n.prototype.setOffset=function(t){this.offset=t},n.prototype.getOffset=function(){return this.offset},n.prototype.getCssClassSuffixes=function(){return[this.getType()]},n.prototype.buildTag=function(){return this.tagBuilder.build(this)},n}(),eT=function(n,t){return(eT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])})(n,t)};function zn(n,t){function e(){this.constructor=n}eT(n,t),n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var nT,Mt=function(){return Mt=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},Mt.apply(this,arguments)},vp=function(n){function t(e){var r=n.call(this,e)||this;return r.email="",r.email=e.email,r}return zn(t,n),t.prototype.getType=function(){return"email"},t.prototype.getEmail=function(){return this.email},t.prototype.getAnchorHref=function(){return"mailto:"+this.email},t.prototype.getAnchorText=function(){return this.email},t}(Po),rT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="",r.hashtag="",r.serviceName=e.serviceName,r.hashtag=e.hashtag,r}return zn(t,n),t.prototype.getType=function(){return"hashtag"},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getHashtag=function(){return this.hashtag},t.prototype.getAnchorHref=function(){var e=this.serviceName,r=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(Po),iT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.mention="",r.mention=e.mention,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.getType=function(){return"mention"},t.prototype.getMention=function(){return this.mention},t.prototype.getServiceName=function(){return this.serviceName},t.prototype.getAnchorHref=function(){switch(this.serviceName){case"twitter":return"https://twitter.com/"+this.mention;case"instagram":return"https://instagram.com/"+this.mention;case"soundcloud":return"https://soundcloud.com/"+this.mention;default:throw new Error("Unknown service name to point mention to: "+this.serviceName)}},t.prototype.getAnchorText=function(){return"@"+this.mention},t.prototype.getCssClassSuffixes=function(){var e=n.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&e.push(r),e},t}(Po),oT=function(n){function t(e){var r=n.call(this,e)||this;return r.number="",r.plusSign=!1,r.number=e.number,r.plusSign=e.plusSign,r}return zn(t,n),t.prototype.getType=function(){return"phone"},t.prototype.getPhoneNumber=function(){return this.number},t.prototype.getNumber=function(){return this.getPhoneNumber()},t.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},t.prototype.getAnchorText=function(){return this.matchedText},t}(Po),_p=function(n){function t(e){var r=n.call(this,e)||this;return r.url="",r.urlMatchType="scheme",r.protocolUrlMatch=!1,r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.schemePrefixRegex=/^(https?:\/\/)?/i,r.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,r.protocolRelativeRegex=/^\/\//,r.protocolPrepended=!1,r.urlMatchType=e.urlMatchType,r.url=e.url,r.protocolUrlMatch=e.protocolUrlMatch,r.protocolRelativeMatch=e.protocolRelativeMatch,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return zn(t,n),t.prototype.getType=function(){return"url"},t.prototype.getUrlMatchType=function(){return this.urlMatchType},t.prototype.getUrl=function(){var e=this.url;return this.protocolRelativeMatch||this.protocolUrlMatch||this.protocolPrepended||(e=this.url="http://"+e,this.protocolPrepended=!0),e},t.prototype.getAnchorHref=function(){return this.getUrl().replace(/&amp;/g,"&")},t.prototype.getAnchorText=function(){var e=this.getMatchedText();return this.protocolRelativeMatch&&(e=this.stripProtocolRelativePrefix(e)),this.stripPrefix.scheme&&(e=this.stripSchemePrefix(e)),this.stripPrefix.www&&(e=this.stripWwwPrefix(e)),this.stripTrailingSlash&&(e=this.removeTrailingSlash(e)),this.decodePercentEncoding&&(e=this.removePercentEncoding(e)),e},t.prototype.stripSchemePrefix=function(e){return e.replace(this.schemePrefixRegex,"")},t.prototype.stripWwwPrefix=function(e){return e.replace(this.wwwPrefixRegex,"$1")},t.prototype.stripProtocolRelativePrefix=function(e){return e.replace(this.protocolRelativeRegex,"")},t.prototype.removeTrailingSlash=function(e){return e.charAt(e.length-1)==="/"&&(e=e.slice(0,-1)),e},t.prototype.removePercentEncoding=function(e){var r=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(r)}catch(i){return r}},t}(Po),Bo=function(n){this.__jsduckDummyDocProp=null,this.tagBuilder=n.tagBuilder},yp=/[A-Za-z]/,VR=/[\d]/,WR=/[\D]/,Ni=/\s/,Tp=/['"]/,GR=/[\x00-\x1F\x7F]/,sT=/A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source,aT=sT+/\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source+/\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source,mu=/0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source,XR=aT+mu,$t=aT+mu,KR="(?:["+mu+"]{1,3}\\.){3}["+mu+"]{1,3}",qR="["+$t+"](?:["+$t+"\\-]{0,61}["+$t+"])?",lT=function(n){return"(?=("+qR+"))\\"+n},Op=function(n){return"(?:"+lT(n)+"(?:\\."+lT(n+1)+"){0,126}|"+KR+")"},gu=new RegExp("["+$t+"]"),uT=/(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,JR=new RegExp("["+$t+"!#$%&'*+/=?^_`{|}~-]"),ZR=new RegExp("^"+uT.source+"$"),cT=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.localPartCharRegex=JR,e.strictTldRegex=ZR,e}return zn(t,n),t.prototype.parseMatches=function(e){for(var r=this.tagBuilder,i=this.localPartCharRegex,o=this.strictTldRegex,s=[],a=e.length,l=new Eu,u={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},c=0,d=0,h=l;c<a;){var p=e.charAt(c);switch(d){case 0:(f=p)==="m"?T(1):i.test(f)&&T();break;case 1:m(e.charAt(c-1),p);break;case 2:g(p);break;case 3:E(p);break;case 4:A(p);break;case 5:v(p);break;case 6:_(p);break;case 7:O(p);break;default:Qy(d)}c++}var f;return N(),s;function m(y,w){y===":"?i.test(w)?(d=2,h=new Eu(Mt(Mt({},h),{hasMailtoPrefix:!0}))):S():u[y]===w||(i.test(w)?d=2:w==="."?d=3:w==="@"?d=4:S())}function g(y){y==="."?d=3:y==="@"?d=4:i.test(y)||S()}function E(y){y==="."||y==="@"?S():i.test(y)?d=2:S()}function A(y){gu.test(y)?d=5:S()}function v(y){y==="."?d=7:y==="-"?d=6:gu.test(y)||N()}function _(y){y==="-"||y==="."?N():gu.test(y)?d=5:N()}function O(y){y==="."||y==="-"?N():gu.test(y)?(d=5,h=new Eu(Mt(Mt({},h),{hasDomainDot:!0}))):N()}function T(y){y===void 0&&(y=2),d=y,h=new Eu({idx:c})}function S(){d=0,h=l}function N(){if(h.hasDomainDot){var y=e.slice(h.idx,c);/[-.]$/.test(y)&&(y=y.slice(0,-1));var w=h.hasMailtoPrefix?y.slice(7):y;(function(b){var I=(b.split(".").pop()||"").toLowerCase();return o.test(I)})(w)&&s.push(new vp({tagBuilder:r,matchedText:y,offset:h.idx,email:w}))}S()}},t}(Bo),Eu=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.hasMailtoPrefix=!!n.hasMailtoPrefix,this.hasDomainDot=!!n.hasDomainDot},QR=function(){function n(){}return n.isValid=function(t,e){return!(e&&!this.isValidUriScheme(e)||this.urlMatchDoesNotHaveProtocolOrDot(t,e)||this.urlMatchDoesNotHaveAtLeastOneWordChar(t,e)&&!this.isValidIpAddress(t)||this.containsMultipleDots(t))},n.isValidIpAddress=function(t){var e=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return t.match(e)!==null},n.containsMultipleDots=function(t){var e=t;return this.hasFullProtocolRegex.test(t)&&(e=t.split("://")[1]),e.split("/")[0].indexOf("..")>-1},n.isValidUriScheme=function(t){var e=t.match(this.uriSchemeRegex),r=e&&e[0].toLowerCase();return r!=="javascript:"&&r!=="vbscript:"},n.urlMatchDoesNotHaveProtocolOrDot=function(t,e){return!(!t||e&&this.hasFullProtocolRegex.test(e)||t.indexOf(".")!==-1)},n.urlMatchDoesNotHaveAtLeastOneWordChar=function(t,e){return!(!t||!e||this.hasFullProtocolRegex.test(e)||this.hasWordCharAfterProtocolRegex.test(t))},n.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,n.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,n.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+sT+"]"),n.ipRegex=/[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/,n}(),tD=(nT=new RegExp("[/?#](?:["+$t+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+$t+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Op(2),")","|","(","(//)?",/(?:www\.)/.source,Op(6),")","|","(","(//)?",Op(10)+"\\.",uT.source,"(?![-"+XR+"])",")",")","(?::[0-9]+)?","(?:"+nT.source+")?"].join(""),"gi")),eD=new RegExp("["+$t+"]"),dT=function(n){function t(e){var r=n.call(this,e)||this;return r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.matcherRegex=tD,r.wordCharRegExp=eD,r.stripPrefix=e.stripPrefix,r.stripTrailingSlash=e.stripTrailingSlash,r.decodePercentEncoding=e.decodePercentEncoding,r}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.stripPrefix,s=this.stripTrailingSlash,a=this.decodePercentEncoding,l=this.tagBuilder,u=[],c=function(){var h=r[0],p=r[1],f=r[4],m=r[5],g=r[9],E=r.index,A=m||g,v=e.charAt(E-1);if(!QR.isValid(h,p)||E>0&&v==="@"||E>0&&A&&d.wordCharRegExp.test(v))return"continue";if(/\?$/.test(h)&&(h=h.substr(0,h.length-1)),d.matchHasUnbalancedClosingParen(h))h=h.substr(0,h.length-1);else{var _=d.matchHasInvalidCharAfterTld(h,p);_>-1&&(h=h.substr(0,_))}var O=["http://","https://"].find(function(y){return!!p&&p.indexOf(y)!==-1});if(O){var T=h.indexOf(O);h=h.substr(T),p=p.substr(T),E+=T}var S=p?"scheme":f?"www":"tld",N=!!p;u.push(new _p({tagBuilder:l,matchedText:h,offset:E,urlMatchType:S,url:h,protocolUrlMatch:N,protocolRelativeMatch:!!A,stripPrefix:o,stripTrailingSlash:s,decodePercentEncoding:a}))},d=this;(r=i.exec(e))!==null;)c();return u},t.prototype.matchHasUnbalancedClosingParen=function(e){var r,i=e.charAt(e.length-1);if(i===")")r="(";else if(i==="]")r="[";else{if(i!=="}")return!1;r="{"}for(var o=0,s=0,a=e.length-1;s<a;s++){var l=e.charAt(s);l===r?o++:l===i&&(o=Math.max(o-1,0))}return o===0},t.prototype.matchHasInvalidCharAfterTld=function(e,r){if(!e)return-1;var i=0;r&&(i=e.indexOf(":"),e=e.slice(i));var o=new RegExp("^((.?//)?[-."+$t+"]*[-"+$t+"]\\.[-"+$t+"]+)").exec(e);return o===null?-1:(i+=o[1].length,e=e.slice(o[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?i:-1)},t}(Bo),nD=new RegExp("#[_"+$t+"]{1,139}(?![_"+$t+"])","g"),rD=new RegExp("[^"+$t+"]"),hT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegex=nD,r.nonWordCharRegex=rD,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.nonWordCharRegex,s=this.serviceName,a=this.tagBuilder,l=[];(r=i.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||o.test(c)){var d=r[0],h=r[0].slice(1);l.push(new rT({tagBuilder:a,matchedText:d,offset:u,serviceName:s,hashtag:h}))}}return l},t}(Bo),iD=new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source+"|"+/(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source,"g"),pT=function(n){function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.matcherRegex=iD,e}return zn(t,n),t.prototype.parseMatches=function(e){for(var r,i=this.matcherRegex,o=this.tagBuilder,s=[];(r=i.exec(e))!==null;){var a=r[0],l=a.replace(/[^0-9,;#]/g,""),u=!(!r[1]&&!r[2]),c=r.index==0?"":e.substr(r.index-1,1),d=e.substr(r.index+a.length,1),h=!c.match(/\d/)&&!d.match(/\d/);this.testMatch(r[3])&&this.testMatch(a)&&h&&s.push(new oT({tagBuilder:o,matchedText:a,offset:r.index,number:l,plusSign:u}))}return s},t.prototype.testMatch=function(e){return WR.test(e)},t}(Bo),oD=new RegExp("@[_"+$t+"]{1,50}(?![_"+$t+"])","g"),sD=new RegExp("@[_."+$t+"]{1,30}(?![_"+$t+"])","g"),aD=new RegExp("@[-_."+$t+"]{1,50}(?![-_"+$t+"])","g"),lD=new RegExp("[^"+$t+"]"),fT=function(n){function t(e){var r=n.call(this,e)||this;return r.serviceName="twitter",r.matcherRegexes={twitter:oD,instagram:sD,soundcloud:aD},r.nonWordCharRegex=lD,r.serviceName=e.serviceName,r}return zn(t,n),t.prototype.parseMatches=function(e){var r,i=this.serviceName,o=this.matcherRegexes[this.serviceName],s=this.nonWordCharRegex,a=this.tagBuilder,l=[];if(!o)return l;for(;(r=o.exec(e))!==null;){var u=r.index,c=e.charAt(u-1);if(u===0||s.test(c)){var d=r[0].replace(/\.+$/g,""),h=d.slice(1);l.push(new iT({tagBuilder:a,matchedText:d,offset:u,serviceName:i,mention:h}))}}return l},t}(Bo),Vn=function(n){n===void 0&&(n={}),this.idx=n.idx!==void 0?n.idx:-1,this.type=n.type||"tag",this.name=n.name||"",this.isOpening=!!n.isOpening,this.isClosing=!!n.isClosing},uD=function(){function n(t){t===void 0&&(t={}),this.version=n.version,this.urls={},this.email=!0,this.phone=!0,this.hashtag=!1,this.mention=!1,this.newWindow=!0,this.stripPrefix={scheme:!0,www:!0},this.stripTrailingSlash=!0,this.decodePercentEncoding=!0,this.truncate={length:0,location:"end"},this.className="",this.replaceFn=null,this.context=void 0,this.sanitizeHtml=!1,this.matchers=null,this.tagBuilder=null,this.urls=this.normalizeUrlsCfg(t.urls),this.email=typeof t.email=="boolean"?t.email:this.email,this.phone=typeof t.phone=="boolean"?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow=typeof t.newWindow=="boolean"?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash=typeof t.stripTrailingSlash=="boolean"?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=typeof t.decodePercentEncoding=="boolean"?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var e=this.mention;if(e!==!1&&e!=="twitter"&&e!=="instagram"&&e!=="soundcloud")throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(r!==!1&&r!=="twitter"&&r!=="facebook"&&r!=="instagram")throw new Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(t.truncate),this.className=t.className||this.className,this.replaceFn=t.replaceFn||this.replaceFn,this.context=t.context||this}return n.link=function(t,e){return new n(e).link(t)},n.parse=function(t,e){return new n(e).parse(t)},n.prototype.normalizeUrlsCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{schemeMatches:t,wwwMatches:t,tldMatches:t}:{schemeMatches:typeof t.schemeMatches!="boolean"||t.schemeMatches,wwwMatches:typeof t.wwwMatches!="boolean"||t.wwwMatches,tldMatches:typeof t.tldMatches!="boolean"||t.tldMatches}},n.prototype.normalizeStripPrefixCfg=function(t){return t==null&&(t=!0),typeof t=="boolean"?{scheme:t,www:t}:{scheme:typeof t.scheme!="boolean"||t.scheme,www:typeof t.www!="boolean"||t.www}},n.prototype.normalizeTruncateCfg=function(t){return typeof t=="number"?{length:t,location:"end"}:function(e,r){for(var i in r)r.hasOwnProperty(i)&&e[i]===void 0&&(e[i]=r[i]);return e}(t||{},{length:Number.POSITIVE_INFINITY,location:"end"})},n.prototype.parse=function(t){var e=this,r=["a","style","script"],i=0,o=[];return function(s,a){for(var l,u=a.onOpenTag,c=a.onCloseTag,d=a.onText,h=a.onComment,p=a.onDoctype,f=new Vn,m=0,g=s.length,E=0,A=0,v=f;m<g;){var _=s.charAt(m);switch(E){case 0:_==="<"&&q();break;case 1:O(_);break;case 2:S(_);break;case 3:T(_);break;case 4:N(_);break;case 5:y(_);break;case 6:w(_);break;case 7:b(_);break;case 8:I(_);break;case 9:P(_);break;case 10:k(_);break;case 11:B(_);break;case 12:$(_);break;case 13:s.substr(m,2)==="--"?(m+=2,v=new Vn(Mt(Mt({},v),{type:"comment"})),E=14):s.substr(m,7).toUpperCase()==="DOCTYPE"?(m+=7,v=new Vn(Mt(Mt({},v),{type:"doctype"})),E=20):x();break;case 14:U(_);break;case 15:V(_);break;case 16:L(_);break;case 17:Q(_);break;case 18:j(_);break;case 19:tt(_);break;case 20:it(_);break;default:Qy(E)}m++}function O(F){F==="!"?E=13:F==="/"?(E=2,v=new Vn(Mt(Mt({},v),{isClosing:!0}))):F==="<"?q():yp.test(F)?(E=3,v=new Vn(Mt(Mt({},v),{isOpening:!0}))):(E=0,v=f)}function T(F){Ni.test(F)?(v=new Vn(Mt(Mt({},v),{name:ut()})),E=4):F==="<"?q():F==="/"?(v=new Vn(Mt(Mt({},v),{name:ut()})),E=12):F===">"?(v=new Vn(Mt(Mt({},v),{name:ut()})),ot()):yp.test(F)||VR.test(F)||F===":"||x()}function S(F){F===">"?x():yp.test(F)?E=3:x()}function N(F){Ni.test(F)||(F==="/"?E=12:F===">"?ot():F==="<"?q():F==="="||Tp.test(F)||GR.test(F)?x():E=5)}function y(F){Ni.test(F)?E=6:F==="/"?E=12:F==="="?E=7:F===">"?ot():F==="<"?q():Tp.test(F)&&x()}function w(F){Ni.test(F)||(F==="/"?E=12:F==="="?E=7:F===">"?ot():F==="<"?q():Tp.test(F)?x():E=5)}function b(F){Ni.test(F)||(F==='"'?E=8:F==="'"?E=9:/[>=`]/.test(F)?x():F==="<"?q():E=10)}function I(F){F==='"'&&(E=11)}function P(F){F==="'"&&(E=11)}function k(F){Ni.test(F)?E=4:F===">"?ot():F==="<"&&q()}function B(F){Ni.test(F)?E=4:F==="/"?E=12:F===">"?ot():F==="<"?q():(E=4,m--)}function $(F){F===">"?(v=new Vn(Mt(Mt({},v),{isClosing:!0})),ot()):E=4}function U(F){F==="-"?E=15:F===">"?x():E=16}function V(F){F==="-"?E=18:F===">"?x():E=16}function L(F){F==="-"&&(E=17)}function Q(F){E=F==="-"?18:16}function j(F){F===">"?ot():F==="!"?E=19:F==="-"||(E=16)}function tt(F){F==="-"?E=17:F===">"?ot():E=16}function it(F){F===">"?ot():F==="<"&&q()}function x(){E=0,v=f}function q(){E=1,v=new Vn({idx:m})}function ot(){var F=s.slice(A,v.idx);F&&d(F,A),v.type==="comment"?h(v.idx):v.type==="doctype"?p(v.idx):(v.isOpening&&u(v.name,v.idx),v.isClosing&&c(v.name,v.idx)),x(),A=m+1}function ut(){var F=v.idx+(v.isClosing?2:1);return s.slice(F,m).toLowerCase()}A<m&&(l=s.slice(A,m),d(l,A),A=m+1)}(t,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=function(c,d){if(!d.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var h,p=[],f=0;h=d.exec(c);)p.push(c.substring(f,h.index)),p.push(h[0]),f=h.index+h[0].length;return p.push(c.substring(f)),p}(s,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),u=a;l.forEach(function(c,d){if(d%2==0){var h=e.parseText(c,u);o.push.apply(o,h)}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(s){},onDoctype:function(s){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},n.prototype.compactMatches=function(t){t.sort(function(l,u){return l.getOffset()-u.getOffset()});for(var e=0;e<t.length-1;e++){var r=t[e],i=r.getOffset(),o=r.getMatchedText().length,s=i+o;if(e+1<t.length){if(t[e+1].getOffset()===i){var a=t[e+1].getMatchedText().length>o?e:e+1;t.splice(a,1);continue}t[e+1].getOffset()<s&&t.splice(e+1,1)}}return t},n.prototype.removeUnwantedMatches=function(t){return this.hashtag||Si(t,function(e){return e.getType()==="hashtag"}),this.email||Si(t,function(e){return e.getType()==="email"}),this.phone||Si(t,function(e){return e.getType()==="phone"}),this.mention||Si(t,function(e){return e.getType()==="mention"}),this.urls.schemeMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="scheme"}),this.urls.wwwMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="www"}),this.urls.tldMatches||Si(t,function(e){return e.getType()==="url"&&e.getUrlMatchType()==="tld"}),t},n.prototype.parseText=function(t,e){e===void 0&&(e=0),e=e||0;for(var r=this.getMatchers(),i=[],o=0,s=r.length;o<s;o++){for(var a=r[o].parseMatches(t),l=0,u=a.length;l<u;l++)a[l].setOffset(e+a[l].getOffset());i.push.apply(i,a)}return i},n.prototype.link=function(t){if(!t)return"";this.sanitizeHtml&&(t=t.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var e=this.parse(t),r=[],i=0,o=0,s=e.length;o<s;o++){var a=e[o];r.push(t.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(t.substring(i)),r.join("")},n.prototype.createMatchReturnVal=function(t){var e;return this.replaceFn&&(e=this.replaceFn.call(this.context,t)),typeof e=="string"?e:e===!1?t.getMatchedText():e instanceof Ap?e.toAnchorString():t.buildTag().toAnchorString()},n.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var t=this.getTagBuilder(),e=[new hT({tagBuilder:t,serviceName:this.hashtag}),new cT({tagBuilder:t}),new pT({tagBuilder:t}),new fT({tagBuilder:t,serviceName:this.mention}),new dT({tagBuilder:t,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=e},n.prototype.getTagBuilder=function(){var t=this.tagBuilder;return t||(t=this.tagBuilder=new tT({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),t},n.version="3.14.3",n.AnchorTagBuilder=tT,n.HtmlTag=Ap,n.matcher={Email:cT,Hashtag:hT,Matcher:Bo,Mention:fT,Phone:pT,Url:dT},n.match={Email:vp,Hashtag:rT,Match:Po,Mention:iT,Phone:oT,Url:_p},n}();function mT(n,t=n){return{type:"autolink",url:n,text:t}}const cD=dr(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([n,t,e])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(t),e)),dD=dr(/<!!customemoji:(.*?)>/gm,([n,t])=>function(e){return{type:"customemoji",text:e}}(t)),gT=dr(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([n,t,e])=>function(r,i=[]){return{type:"link",url:r,children:i}}(t,[e])),hD=dr(/<actionlink:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=ET(t);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[e])}),pD=dr(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([n,t,e])=>{const{action:r,params:i}=ET(t);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[e])});function ET(n){const t=n.indexOf("?");return t===-1?{action:n,params:{}}:{action:n.slice(0,t),params:Object.fromEntries(new URLSearchParams(n.slice(t)))}}const fD=dr(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([n])=>function(t=[]){return{type:"bulletlist",children:t}}([n.startsWith(`
1316
1316
  `)?n.slice(1):n])),mD=dr(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,([n,t])=>({type:"bulletpoint",children:[t]})),gD=n=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let e=0;const r=[];for(const i of Uy(n,t)){const o=i[0],s=i[1],a=o.startsWith(s)?i.index:i.index+1;a-e>0&&r.push(n.substring(e,a));const l=mT("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(l),e=a+s.length}return e<n.length&&r.push(n.substring(e)),r},ED=n=>gT(n).flatMap(t=>typeof t=="string"?Sp(t):["<",...Sp(t.url),...Sp("|"+t.children[0]+">")]),Sp=n=>{const t=uD.parse(n,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),e=[];let r=0;for(const i of t){const o=i.getOffset(),s=i.getMatchedText(),a=s.length;let l=s;i instanceof vp?l="mailto:"+i.getEmail():i instanceof _p&&(l=i.getUrl()),o>r&&e.push(n.substring(r,o)),e.push(mT(l,s)),r=o+a}return r<n.length&&e.push(n.substring(r)),e},AD=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"],vD=function(){const n=RegExp(`[^
1317
1317
  ]+
1318
1318
  ?|
1319
- `,"g");return t=>Array.from(t.match(n)||[])}();function Np(n,t={except:[]}){let e=function(r,i){let o=[r];return o=Cp(o,i.multilineSteps),o=Cp(o,[vD]),o=Cp(o,i.singlelineSteps),o=vT(o),o}(n,function(r={except:[]}){var i;const o={multilineSteps:[],singlelineSteps:[]},s=(i=r.except)!=null?i:AD.filter(a=>!r.only.includes(a));return s.includes("BulletPoint")||o.multilineSteps.push(fD,mD),s.includes("Mention")||o.singlelineSteps.push(cD),s.includes("CustomEmoji")||o.singlelineSteps.push(dD),s.includes("Codespan")||o.multilineSteps.push(dr(/```([^]+?)```/g,([a,l])=>({type:"codespan",text:l}))),s.includes("FormattedLink")||o.singlelineSteps.push(gT),s.includes("Actions")||(o.singlelineSteps.push(hD),o.singlelineSteps.push(pD)),s.includes("Wikitext")||o.singlelineSteps.push(YR),s.includes("Autolink")||o.singlelineSteps.push(ED,gD),o}(t));return e=_T(e,!1),e}function AT(n){return Np(n,{except:["FormattedLink","Actions"]})}function Cp(n,t){return t.reduce((e,r)=>ia(e,r),n)}function vT(n){const t=[];let e=-1;for(const r of n)typeof r=="string"?typeof t[e]=="string"?t[e]+=r:t[++e]=r:t[++e]="children"in r?On(_t({},r),{children:vT(r.children)}):r;return t}function _T(n,t){const e=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i];typeof o=="string"?r.push(o):"children"in o?(r.length>0&&(e.push(r.join("")),r=[]),o.children=_T(o.children,t||o.type==="link"||o.type==="actionbutton"||o.type==="actionlink"),e.push(o)):o.type==="autolink"&&t?r.push(o.text):(r.length>0&&(e.push(r.join("")),r=[]),e.push(o))}return r.length>0&&(e.push(r.join("")),r=[]),e}let _D=class{constructor(n,t,e,r){this.emoji=n,this.messageId=t,this.conversationId=e,this._realtimeClient=r}get brandedMessageId(){return this.messageId}get brandedConversationId(){return this.conversationId}add(){return U(this,null,function*(){const n=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"messages",this.brandedMessageId,"reactions",this.emoji,this._realtimeClient.userId],{});xt(`Add ${this.emoji} reaction on message ${this.messageId} in conversation ${this.conversationId}`,n)})}remove(){return U(this,null,function*(){const n=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedMessageId,"reactions",this.emoji,this._realtimeClient.userId],{});(n.ok||n.where!=="server"||n.value.status!==404)&&xt(`Remove ${this.emoji} reaction from message ${this.messageId} in conversation ${this.conversationId}`,n)})}};class yT{constructor(t,e,r){this.id=t,this.conversationId=e,this._realtimeClient=r}get brandedId(){return this.id}get brandedConversationId(){return this.conversationId}reaction(t){if(typeof t!="string")throw new Error(`Creating ReactionRef failed because emoji "${t}" is not a string`);if(t==="")throw new Error(`Creating ReactionRef failed because emoji "${t}" is an empty string`);return new _D(t,this.brandedId,this.brandedConversationId,this._realtimeClient)}get(){return U(this,null,function*(){const t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"messages",this.brandedId],{});if(!t.ok&&t.where==="server"&&t.value.status===404||!t.ok&&t.where==="server"&&t.value.status===403&&t.value.errorCode==="NOT_A_PARTICIPANT")return null;const e=xt("Get message "+this.id,t),r=yield this._realtimeClient.createMessageSnapshot(e,this.brandedConversationId);return gp("Get message "+this.id,r)})}edit(t){return U(this,null,function*(){const e={content:yD(t),custom:typeof t=="string"?void 0:t.custom},r=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"messages",this.brandedId],e);xt(`Edit message ${this.id} in conversation ${this.conversationId}`,r)})}delete(){return U(this,null,function*(){const t=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedId],{});(t.ok||t.where!=="server"||t.value.status!==404)&&xt(`Delete message ${this.id} in conversation ${this.conversationId}`,t)})}}function yD(n){return typeof n=="string"?[{type:"text",children:Np(n)}]:"text"in n&&n.text?[{type:"text",children:Np(n.text)}]:"content"in n&&n.content?n.content:void 0}class TD{constructor(t,e){this.id=t,this._realtimeClient=e,this.uselessObjForTypeCheck={subject:null,photoUrl:null,welcomeMessages:null,custom:null,access:null,notify:null}}get brandedId(){return this.id}get brandedUserId(){return this._realtimeClient.userId}participant(t){if(typeof t=="string"){if(t==="")throw new Error(`Creating ParticipantRef failed because ID "${t}" is an empty string`);return new Ky(t,this.id,this._realtimeClient)}if("brandedId"in t)return new Ky(t.id,this.id,this._realtimeClient);throw new Error(`Creating ParticipantRef failed because user "${t}" is not a string or a UserRef`)}message(t){if(typeof t!="string")throw new Error(`Creating MessageRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating MessageRef failed because ID "${t}" is an empty string`);return new yT(t,this.brandedId,this._realtimeClient)}get(){return U(this,null,function*(){const t=this._realtimeClient.listMessages(this.brandedId,{limit:1}),e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedId],{});if(!e.ok&&e.where==="server"&&e.value.status===404)return null;const r=xt("Get conversation "+this.id,e),i=gp("Get last message in conversation "+this.id,yield t),o=i.length===0?null:i[0];return this._realtimeClient.createConversationSnapshotPreloaded(r,o)})}set(t){return U(this,null,function*(){const e=this._realtimeClient.call("PUT",["conversations",this.brandedId],t),r=this._realtimeClient.call("PUT",["conversations",this.brandedId,"participants",this.brandedUserId],t),i=yield e;!i.ok&&i.where==="server"&&i.value.status===403&&i.value.errorCode==="UNAUTHORIZED_TO_EDIT"&&function(s){return s.subject===void 0&&s.photoUrl===void 0&&s.welcomeMessages===void 0&&s.custom!==null&&(s.custom===void 0||!Object.values(s.custom).some(a=>a!==void 0))}(t)||xt("Set conversation "+this.id,i);const o=yield r;!o.ok&&o.where==="server"&&o.value.status===403&&o.value.errorCode==="UNAUTHORIZED_TO_EDIT_PARTICIPANT"&&function(s){return s.access===void 0&&s.notify===void 0}(t)||xt("Set your participation in conversation "+this.id,o)})}createIfNotExists(){return U(this,arguments,function*(t={}){const e=this._realtimeClient.call("POST",["conversations",this.brandedId],t),r=this._realtimeClient.call("POST",["conversations",this.brandedId,"participants",this.brandedUserId],t),i=yield e;(i.ok||i.where!=="server"||i.value.status!==409)&&xt("Create conversation "+this.id,yield e);const o=yield r;(o.ok||o.where!=="server"||o.value.status!==409)&&xt("Join conversation "+this.id,yield r)})}markAsRead(){return U(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"read"],{});xt(`Mark ${this.id} as read`,t)})}markAsUnread(){return U(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"unread"],{});xt(`Mark ${this.id} as unread`,t)})}send(t){return U(this,null,function*(){const e={content:OD(t),referencedMessageId:SD(t),custom:typeof t=="string"?void 0:t.custom,idempotencyKey:HR(new Date().getTime())},r=yield this._realtimeClient.call("POST",["conversations",this.brandedId,"messages"],e),i=xt("Send message to conversation "+this.id,r);return new yT(i.id,this.brandedId,this._realtimeClient)})}subscribeMessages(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"messages"],t)}subscribeParticipants(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"participants"],t)}subscribe(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId],t)}subscribeTyping(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"typing"],t)}markAsTyping(){return U(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"typing"],{});xt(`Set user as typing in ${this.id}`,t)})}}function OD(n){return typeof n=="string"?[{type:"text",children:AT(n)}]:"text"in n?[{type:"text",children:AT(n.text)}]:n.content}function SD(n){if(typeof n=="string")return;const t=n.referencedMessage;return t!==void 0?typeof t=="string"?t:t.id:void 0}class Ci{constructor(t,e,r){this.realtimeWsApiUrl=t,this.internalHttpApiUrl=e,this.restApiHttpUrl=r}getBokensUrl(t,e,r){return this.internalHttpApiUrl+`/${t}/bokens/${encodeURIComponent(e)}?signature=${encodeURIComponent(r!=null?r:"")}`}getRealtimeWsUrl(t,e,r,i,o){const s=encodeURIComponent(e);return this.realtimeWsApiUrl+`/${t}/realtime/${s}?talkjs-client-build=${o!=null?o:"standalone"}&talkjs-core=${r}&talkjs-client-id=${i}`}static fromHost(t){const e=new Ci("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!t)return e;if(t.endsWith("talkjs.com")){const r=t.match(/\w+-(\w+)\.talkjs\.com/);if(r){const i=r[1];return new Ci(`wss://realtime-${i}.talkjs.com/v1`,`https://app-${i}.talkjs.com/api/v0`,`https://api-${i}.talkjs.com/v1`)}return e}return t.includes("localhost")||t.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(t)?new Ci(`ws://${t}/public_api/v1`,`http://${t}/api/v0`,`http://${t}/public_api/v1`):new Ci(`wss://${t}/public_api/v1`,`https://${t}/api/v0`,`https://${t}/public_api/v1`)}}function Au({method:n,url:t,data:e,options:r,attempts:i,shouldRetry:o,authProvider:s}){var a;(!i||i<=0)&&(i=1);const l={"x-talkjs-client-build":"jssdk-dev","x-talkjs-client-date":"2025-08-28T08:53:22.349Z"};return e instanceof FormData||(l["Content-Type"]=(a=r==null?void 0:r.contentType)!=null?a:"application/json"),My(i,()=>U(this,null,function*(){if(s){const u=yield s.getToken();l.Authorization=`Bearer ${u}`}return fetch(t,{method:n,headers:l,body:e}).then(u=>{if(u.ok)return u;throw u})}),{initialDelay:.2,log:void 0,shouldRetry:u=>U(this,null,function*(){return s&&u.status===401?(vu.log(`401 error from ${n} ${t}, ${yield s.getToken()}`),s.refreshToken(),!0):o?o(u):!("status"in u&&u.status>=400&&u.status<500)})}).catch(u=>{if(Math.random()<.1&&!t.toString().startsWith("https://capture.trackjs.com")){const c=`Network Error for ${n} ${t}`;typeof window!="undefined"&&(u instanceof Response?u.clone().text().then(d=>vu.log(`${c} ${u.status} ${d} (10% logged)`)):vu.log(`${c} ${u} (10% logged)`)),console.error("[TalkJS]",c)}throw u})}const{cdnHost:JD,appHost:ND,restHost:ZD,realtimeHost:QD,appProtocol:tk,appWsProtocol:ek}=function(){if(typeof window=="undefined")return{cdnHost:"test-hostname",appHost:"test-hostname",appProtocol:"http:",appWsProtocol:"ws:"};const n=function(){if(document.currentScript)return document.currentScript.src;try{throw new Error}catch(l){const u=l.stack.match(/https?:\/\/.*\.(js|jsx|ts|tsx)/);return u?u[0]:""}}(),t=document.createElement("a");t.href=n;const e=t.host,r=(a=e).match(/^cdn[.-]/)?a.replace(/^cdn/,"app"):a==="talkjs.com"?"app.talkjs.com":a,i=function(l){return l.match(/^app[.-]/)?l.replace(/^app/,"api"):l+"/public_api"}(r),o=function(l){return l.match(/^app[.-]/)?l.replace(/^app/,"realtime"):l+"/public_api"}(r),s=t.protocol;var a;return{cdnHost:e,appHost:r,restHost:i,realtimeHost:o,appProtocol:s,appWsProtocol:s==="https:"?"wss:":"ws:"}}(),CD=ND.startsWith("app.talkjs.com"),vu=typeof window=="undefined"?{log:n=>Promise.resolve(),setData:n=>{}}:new class{constructor(n){this._timeCreated=Date.now(),this._enabled=CD,this._trackJSData={customer:{application:"",correlationId:"",sessionId:"",token:"",userId:"",version:"dev-2025-08-28T08:53:22.349Z"},entry:"direct",environment:{age:Date.now()-this._timeCreated,dependencies:{},originalUrl:window.location.href,referrer:document.referrer,userAgent:window.navigator.userAgent},metadata:[],nav:[],network:[],url:window.location.href,stack:"",timestamp:new Date().toISOString(),version:"dev-2025-08-28T08:53:22.349Z",throttled:0},this._url=`https://capture.trackjs.com/capture?token=${n}`,this._trackJSData.customer.token=n}setData({appId:n,meId:t,sessionId:e}){this._trackJSData.customer.userId=n,this._trackJSData.customer.sessionId=`${n}/${t}`,this._trackJSData.customer.correlationId=e}log(n){return U(this,null,function*(){try{if(!this._enabled)return Promise.resolve();const t=On(_t({},this._trackJSData),{message:n});yield Au({method:"POST",url:this._url,data:JSON.stringify(t),options:{contentType:"text/plain"}})}catch(t){console.error("[TalkJS] Failed when sending an error report. Error: ",t)}})}}("970cd0be0fb74630b75c8451051299dc");class bD{constructor(t,e={}){this._onSubscription=e,this._handlers={};for(const r in t)Object.hasOwnProperty.call(t,r)&&(this._handlers[r]=[])}emit(t,e){for(const r of this._handlers[t])try{r(e)}catch(i){console.error(`[TalkJS] '${String(t)}' handler threw an error:`,i)}}emitAsync(t,e){return U(this,null,function*(){try{const r=this._handlers[t].map(i=>i(e));yield Promise.all(r)}catch(r){console.error(`[TalkJS] '${String(t)}' handler threw an error:`,r)}})}supports(t){return t in this._handlers}on(t,e){var r,i;if(!this.supports(t))throw new Error(`Unknown event type '${String(t)}'`);(i=(r=this._onSubscription)[t])==null||i.call(r),this._handlers[t].push(e)}off(t,e){if(!Object.hasOwnProperty.call(this._handlers,t))throw new Error(`Unknown event type '${String(t)}'`);const r=this._handlers[t].indexOf(e);r!==-1&&this._handlers[t].splice(r,1)}removeAllListeners(){for(const t in this._handlers)this._handlers[t]=[]}handles(t){return this._handlers[t].length>0}subscribe(t,e){return this.on(t,e),{unsubscribe:()=>this.off(t,e)}}}class ID{constructor(t,e,r,i,o,s){if(this.appId=e,this.userId=r,this.tokenFetcher=o,this.usingBokens=!1,this.requestInProgress=!1,this.eventEmitter=new bD({tokenChanged(a){},tokenRefreshFailed(a){},tokenAccepted(a){}}),this.sessionExpiryWarningTimeoutId=void 0,s&&(i||o))throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");i?this.fetchToken(()=>i):(o||(this.usingBokens=!0,this.tokenFetcher=()=>this.sendBokenRequest(t,s)),this.refreshToken())}get canRefreshToken(){return this.usingBokens||!!this.tokenFetcher}getToken(){return this.token}refreshToken(){if(!this.requestInProgress){if(!this.tokenFetcher)throw this.emitTokenRefreshFailed("no `tokenFetcher` provided"),new Error("[TalkJS] Cannot refresh token, no `tokenFetcher` provided.");this.fetchToken(this.tokenFetcher)}}onTokenChanged(t){return this.eventEmitter.on("tokenChanged",t),()=>{this.eventEmitter.off("tokenChanged",t)}}emitTokenChanged(t){this.eventEmitter.emit("tokenChanged",t)}onTokenRefreshFailed(t){return this.eventEmitter.on("tokenRefreshFailed",t),()=>{this.eventEmitter.off("tokenRefreshFailed",t)}}emitTokenRefreshFailed(t){this.eventEmitter.emit("tokenRefreshFailed",t),console.error(`[TalkJS] Could not authenticate, cannot recover automatically: ${t}`)}onTokenAccepted(t){return this.eventEmitter.on("tokenAccepted",t),()=>{this.eventEmitter.off("tokenAccepted",t)}}emitTokenAccepted(t){this.eventEmitter.emit("tokenAccepted",t)}clearScheduledRefresh(){this.sessionExpiryWarningTimeoutId&&clearTimeout(this.sessionExpiryWarningTimeoutId)}scheduleRefresh(t){if(this.clearScheduledRefresh(),t===null)return;const e=this.tokenFetcher!==void 0;if(t<120&&!e?console.warn(`[TalkJS] TalkJS will stop working in ${t} seconds due to auth token expiry. Token expires in ${t} seconds, and cannot be refreshed because no \`tokenFetcher\` was provided when creating the session. Non-refreshable tokens are recommended to expire at least 24 hours in the future.`):t<120&&e?console.warn(`[TalkJS] TalkJS auth token will expire and need to be refreshed in ${t} seconds. Refreshable JWTs are recommended to expire at least 30 minutes in the future, to improve performance and reduce unnecessary refreshes.`):t<3300&&!e&&console.warn(`[TalkJS debug] TalkJS will stop working in ${Math.round(t/60)} minutes due to auth token expiry. Non-refreshable tokens are recommended to expire at least 24 hours in the future. Alternatively, provide a \`tokenFetcher\` when creating the session, so that tokens can be refreshed when they expire.`),this.tokenFetcher!==void 0){const r=t>600?t-300:t/2,i=Math.min(1728e6,1e3*r);this.sessionExpiryWarningTimeoutId=setTimeout(()=>{this.refreshToken()},i)}else t<2e6&&(this.sessionExpiryWarningTimeoutId=setTimeout(()=>{this.emitTokenRefreshFailed("Token has expired and no `tokenFetcher` was provided when creating the session, so it cannot be refreshed.")},1e3*t))}fetchToken(t){return U(this,null,function*(){if(this.requestInProgress)return;this.requestInProgress=!0;const e=()=>U(this,null,function*(){const r=yield t();return this.checkJwt(r),r});try{const r=this.token!==void 0;this.token=e(),yield this.token.then(i=>{r&&this.emitTokenChanged(i)}).catch(i=>{this.emitTokenRefreshFailed(i)})}catch(r){this.emitTokenRefreshFailed(r)}finally{this.requestInProgress=!1}})}checkJwt(t){(function(s){if(!(typeof s=="string"||s instanceof String))throw s===void 0?"Token was undefined":"Token must be a string, got: "+s})(t);const e=[];let r,i,o;if(typeof t=="string"?r=t:e.push(`Token type is ${typeof t} instead of a string.`),r)try{const s=function(a){const l=a.split(".");if(l.length!==3)throw"Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";return{header:TT(l[0]),payload:TT(l[1])}}(r);i=s.header,o=s.payload}catch(s){e.push(s)}if(i){const s=this.checkJwtHeader(i);e.push(...s)}if(o){const s=this.checkJwtPayload(o);e.push(...s)}if(e.length)if(this.usingBokens)vu.log(`JWT Errors detected by AuthProvider when using bokens: ${e.join(`
1320
- `)}`);else{console.warn("[TalkJS] Authentication token appears to be generated incorrectly. Will still attempt to authenticate, but TalkJS may not work as expected. See below for a description of any problems and how to fix them.");const s=e.length>1;e.forEach((a,l)=>{const u=s?`Reason ${l+1}:`:"Reason:";console.warn(`[TalkJS] ${u} ${a}`)}),console.warn(`[TalkJS]: Authentication token: "${t}"`)}}checkJwtHeader(t){const e=[],r=t.alg;return r===void 0?e.push('Token header must contain `"alg": "HS256"`, but no `alg` was specified.'):typeof r!="string"?e.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!=="HS256"&&e.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was set to "${r}" instead. HS256 is the only supported algorithm.`),e}checkJwtPayload(t){const e=[],r=t.iss;r===void 0?e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was missing.`):typeof r!="string"?e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!==this.appId&&e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was set to "${r}" instead.`);const i=t.sub;i===void 0?e.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`):typeof i!="string"?e.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof i} instead of a string. Make sure you wrap the value in "".`):i!==this.userId&&e.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${i}" instead.`);const o=t.tokenType;o===void 0?e.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.'):typeof o!="string"?e.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof o} instead of a string. Make sure you wrap the value in "".`):o!=="user"&&e.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${o}" instead.`);const s=t.exp;s===void 0||(typeof s!="number"?e.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof o} instead of a number. If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Don't wrap the value in "".`):s<1e9?e.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${s}, representing ${new Date(1e3*s).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01.`):s>1e11?e.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${s}, representing ${new Date(1e3*s).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`):s<new Date().getTime()/1e3&&e.push(`Token payload contains an \`exp\` claim, but \`exp\` (${s}, representing ${new Date(1e3*s).toLocaleDateString()}) appears to be in the past, meaning the token will be rejected. This error can also happen if your device's clock is set incorrectly, in which case the token will still work.`));const a=t.nbf;return a===void 0||(typeof a!="number"?e.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof o} instead of a number. If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01.`):a>1e11&&e.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${a}, representing ${new Date(1e3*a).toLocaleDateString()}). If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`)),e}sendBokenRequest(t,e){return U(this,null,function*(){let r=0;const i=t.getBokensUrl(this.appId,this.userId,e);return(yield(yield Au({method:"GET",url:i,attempts:1e4,shouldRetry:s=>{if(s instanceof Error)return!0;if(s.status===401)throw"Check that you provided a valid signature.";if(s.status===404)throw"Check that you specified the correct App ID.";if(s.status===429||s.status===502)return!0;if(s.status>=400&&s.status<500)throw`Unexpected HTTP ${s.status} response when fetching auth token. Check that you configured the session correctly.`;if(r++,r>=5)throw`Unexpected HTTP ${s.status} response when fetching auth token, retrying did not help.`;return!0}})).json()).boken})}}function TT(n){try{const t=n.replace(/-/g,"+").replace(/_/g,"/"),e=decodeURIComponent(atob(t).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(e)}catch(t){throw`Could not base64-decode and JSON-parse token section: ${n}. Check that you base-64 encoded the section correctly.`}}class wD{constructor(t){this.target=t}deref(){return this.target}}const OT=new class{constructor(){this.registry={}}getOrCreate(n){var t;const e=this.key(n),r=(t=this.registry[e])==null?void 0:t.deref();if(r)return r;const i=new ST(n),o=globalThis.WeakRef?new WeakRef(i):new wD(i);return this.registry[e]=o,i}deregister(n,t){const e=this.key({appId:n,userId:t});delete this.registry[e]}key({appId:n,userId:t}){return`${n}:${t}`}};class ST{constructor(t){(function(l){function u(c,d){if(!c)throw new Error("[TalkJS] TalkSession: "+d)}u(l&&typeof l=="object","Expected an object argument in TalkSession#constructor."),u(l.appId&&typeof l.appId=="string","The `appId` property of TalkSession#constructor is required and it must be a non-empty string."),u(typeof l.userId=="string","The `userId` property of TalkSession#constructor is required and it must be a string."),l.token!==void 0&&u(l.token&&typeof l.token=="string","The `token` property of TalkSession#constructor must be a non-empty string."),l.tokenFetcher!==void 0&&u(typeof l.tokenFetcher=="function","The `tokenFetcher` property of TalkSession#constructor must be a function.")})(t);const{appId:e,userId:r,token:i,tokenFetcher:o,signature:s}=t;this._appId=e,this._apiUrls=t.apiUrls?new Ci(t.apiUrls.realtimeWsApiUrl,t.apiUrls.internalHttpApiUrl,t.apiUrls.restApiHttpUrl):Ci.fromHost(t.host),this._authProvider=new ID(this._apiUrls,e,r,i,o,s);const a=Math.random().toString().split(".")[1];this._realtimeClient=new UR(this._apiUrls.getRealtimeWsUrl(e,r,"1.5.1",a,t.clientBuild),r,this._authProvider),this.currentUser=new Xy(this._realtimeClient.userId,this._realtimeClient),this._terminationReason=yi(),this._terminationReason.promise.then(l=>{console.error(`[TalkSession] ${l}`)}),function(l,u,c){return U(this,null,function*(){return Au({method:"GET",url:`${u}/${l}/app`,authProvider:c}).then(d=>d.status===200||d.status!==404&&(console.warn(`[TalkJS] Received unexpected ${d.status} status code when validating app ID. Assuming that the app ID is valid.`),!0)).catch(d=>{if(typeof d!="string"&&"status"in d){const h=d;return h.status===200||h.status!==404&&(console.warn(`[TalkJS] Received unexpected ${h.status} status code when validating app ID. Assuming that the app ID is valid.`),!0)}return console.warn("[TalkJS] Encountered network issues when validating app ID. Assuming that the app ID is valid."),!0})})}(this._appId,this._apiUrls.internalHttpApiUrl,this._authProvider).then(l=>{l||this.terminate(new Error(`The app ID ${this._appId} does not exist. Make sure you are using the correct app ID as found on the TalkJS dashboard. App IDs are case-sensitive.`))}),this._authProvider.onTokenRefreshFailed(l=>{this.terminate(new Error(`Could not authenticate, cannot recover automatically: ${l}`))})}onError(t){const e=yi();return Promise.race([e.promise,this._terminationReason.promise]).then(r=>{r!=="UNSUBSCRIBED"&&t(r)}),{unsubscribe:()=>e.resolve("UNSUBSCRIBED")}}user(t){if(typeof t!="string")throw new Error(`Creating UserRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating UserRef failed because ID "${t}" is an empty string`);return new Xy(t,this._realtimeClient)}conversation(t){if(typeof t!="string")throw new Error(`Creating ConversationRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating ConversationRef failed because ID "${t}" is an empty string`);return new TD(t,this._realtimeClient)}subscribeConversations(t){return this._realtimeClient.subscribe(["me","conversations"],t)}terminate(t){OT.deregister(this._appId,this.currentUser.id),this._terminationReason.resolve(t),this._realtimeClient.destroy()}_isConnected(){return this._realtimeClient.isConnected()}uploadFile(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,e)}uploadImage(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"image"},e))}uploadVideo(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"video"},e))}uploadAudio(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"audio"},e))}uploadVoice(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"voice"},e))}}function oa(n,t,e,r){return U(this,arguments,function*(i,o,s,{subtype:a,filename:l,width:u,height:c,duration:d}){const h=new FormData;return h.set("file",s,l),a!==void 0&&h.set("subtype",a),u!==void 0&&h.set("width",u.toString()),c!==void 0&&h.set("height",c.toString()),d!==void 0&&h.set("duration",d.toString()),Au({method:"POST",url:i,data:h,authProvider:o}).then(p=>p.json()).then(p=>p.attachmentToken).catch(p=>U(this,null,function*(){if(p instanceof Response){const f=yield p.json(),m=`Unexpected response when uploading file, status code ${p.status} ${f.errorCode}, ${f.reasons}`;throw new Error(m)}throw p}))})}function NT(n){return Object.keys(n)}class bp extends Error{constructor(t,e){const r=function(i){if(typeof i=="string")return i;if(Array.isArray(i))return i.join(`
1321
- `);try{return JSON.stringify(i)}catch(o){return String(i)}}(t);super(r),this.userMessage=e!=null?e:r,Object.setPrototypeOf&&Object.setPrototypeOf(this,new.target.prototype)}}const sa=console;class RD{constructor(t,e,r,i){this.apiUrls=t,this.appId=e,this.sessionId=r,this.authProvider=i,this._lastPutPromise=Promise.resolve()}async get(t,e={}){const r=this.endpointUrl(t,e),i=await aa(()=>this.fetchWithReauth(r),{retries:11});return await this.handleResponse(i,r)}async queuedPut(t,e){await this._lastPutPromise;const r=aa(()=>this._doPut(t,e));return this._lastPutPromise=r,r}put(t,e,r){const i=()=>this._doPut(t,e);return r?bT(i,r):aa(i,{retries:5})}post(t,e,r){const i=()=>this._doPost(t,e);return r?bT(i,r):aa(i,{retries:5})}delete(t,e={}){return aa(()=>this._doDelete(t,e),{retries:11})}endpointUrl(t,e={}){const r=new URL(this.apiUrls.internalHttpApiUrl);r.pathname+=`/${this.appId}/${t}`,r.searchParams.set("sessionId",this.sessionId);for(const[i,o]of Object.entries(e))r.searchParams.set(i,o);return r}async _doPut(t,e){const r=this.endpointUrl(t),i=await this.fetchWithReauth(r,{method:"PUT",body:JSON.stringify(e)});return await this.handleResponse(i,r)}async _doPost(t,e){const r=this.endpointUrl(t),i=await this.fetchWithReauth(r,{method:"POST",body:JSON.stringify(e)});return await this.handleResponse(i,r)}async _doDelete(t,e){const r=this.endpointUrl(t,e),i=await this.fetchWithReauth(r,{method:"DELETE"});return await this.handleResponse(i,r)}async handleResponse(t,e){if(t.status>=300){if(t.status===404)throw vc.error(`[${this.appId}][BackendRestClient] Couldn't find resource.`),new bp("Could not find app.",`Could not find given appId: "${this.appId}". You can find your appId on https://talkjs.com/dashboard.`);if(t.status===401){const r=await this.authProvider.getToken();throw vc.error(`[${this.appId}][BackendRestClient] Couldn't authenticate ${e} with token ${r}.`),new bp("User not authenticated.","Could not authenticate user. Check if your signature is calculated correctly.")}if(t.status>=300&&t.status<500){const{error:r}=await t.json();throw new bp(r)}{const r=await t.text();throw new Error(`Got non-success response (${r}) from the server for url: ${e}.`)}}return await t.json()}async fetchWithReauth(t,e){function r(s){const a={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${s}`};return fetch(t,{...e,headers:a})}const i=await this.authProvider.getToken(),o=await r(i);return o.status!==401?o:(sa.error(`401 error from ${e==null?void 0:e.method} ${t}, ${i}`),this.authProvider.refreshToken(),r(await this.authProvider.getToken()))}}function CT(n){return!n.userMessage}function aa(n,{retries:t=30}={}){return tp(t,n,{shouldRetry:CT,log:sa.warn.bind(sa),maxDelay:30,initialDelay:.2})}async function bT(n,t){try{return await n()}catch(r){if(!CT(r))throw r}let e=!1;return t.then(()=>{e=!0}),tp(1e3,n,{initialDelay:.2,maxDelay:30,shouldRetry:()=>!e,log:sa.warn.bind(sa)})}var Ip={exports:{}};(function(n,t){var e="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",o="[object Function]",s="[object Object]",a=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[i]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u[o]=u["[object Map]"]=u["[object Number]"]=u[s]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1;var c=typeof Ta=="object"&&Ta&&Ta.Object===Object&&Ta,d=typeof self=="object"&&self&&self.Object===Object&&self,h=c||d||Function("return this")(),p=t&&!t.nodeType&&t,f=p&&n&&!n.nodeType&&n,m=f&&f.exports===p,g=m&&c.process,E=function(){try{var w=f&&f.require&&f.require("util").types;return w||g&&g.binding&&g.binding("util")}catch(D){}}(),A=E&&E.isTypedArray,v,_=Array.prototype,O=Function.prototype,T=Object.prototype,S=h["__core-js_shared__"],N=O.toString,y=T.hasOwnProperty,I=(v=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",R=T.toString,b=N.call(Object),L=RegExp("^"+N.call(y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),k=m?h.Buffer:void 0,B=h.Symbol,j=h.Uint8Array;k&&k.allocUnsafe;var $,W,x=($=Object.getPrototypeOf,W=Object,function(w){return $(W(w))}),Q=Object.create,H=T.propertyIsEnumerable,nt=_.splice,ot=B?B.toStringTag:void 0,P=function(){try{var w=wi(Object,"defineProperty");return w({},"",{}),w}catch(D){}}(),V=k?k.isBuffer:void 0,it=Math.max,ut=Date.now,F=wi(h,"Map"),ct=wi(Object,"create"),yt=function(){function w(){}return function(D){if(!Ie(D))return{};if(Q)return Q(D);w.prototype=D;var Y=new w;return w.prototype=void 0,Y}}();function ee(w){var D=-1,Y=w==null?0:w.length;for(this.clear();++D<Y;){var Z=w[D];this.set(Z[0],Z[1])}}function jt(w){var D=-1,Y=w==null?0:w.length;for(this.clear();++D<Y;){var Z=w[D];this.set(Z[0],Z[1])}}function ue(w){var D=-1,Y=w==null?0:w.length;for(this.clear();++D<Y;){var Z=w[D];this.set(Z[0],Z[1])}}function Zt(w){var D=this.__data__=new jt(w);this.size=D.size}function gt(w,D){var Y=te(w),Z=!Y&&Qt(w),ht=!Y&&!Z&&ve(w),Yt=!Y&&!Z&&!ht&&$r(w),Dt=Y||Z||ht||Yt,we=Dt?function(de,mr){for(var Be=-1,$o=Array(de);++Be<de;)$o[Be]=mr(Be);return $o}(w.length,String):[],Pe=we.length;for(var zt in w)Dt&&(zt=="length"||ht&&(zt=="offset"||zt=="parent")||Yt&&(zt=="buffer"||zt=="byteLength"||zt=="byteOffset")||Fo(zt,Pe))||we.push(zt);return we}function Kt(w,D,Y){(Y!==void 0&&!Wn(w[D],Y)||Y===void 0&&!(D in w))&&qe(w,D,Y)}function Nt(w,D,Y){var Z=w[D];y.call(w,D)&&Wn(Z,Y)&&(Y!==void 0||D in w)||qe(w,D,Y)}function Rt(w,D){for(var Y=w.length;Y--;)if(Wn(w[Y][0],D))return Y;return-1}function qe(w,D,Y){D=="__proto__"&&P?P(w,D,{configurable:!0,enumerable:!0,value:Y,writable:!0}):w[D]=Y}ee.prototype.clear=function(){this.__data__=ct?ct(null):{},this.size=0},ee.prototype.delete=function(w){var D=this.has(w)&&delete this.__data__[w];return this.size-=D?1:0,D},ee.prototype.get=function(w){var D=this.__data__;if(ct){var Y=D[w];return Y===e?void 0:Y}return y.call(D,w)?D[w]:void 0},ee.prototype.has=function(w){var D=this.__data__;return ct?D[w]!==void 0:y.call(D,w)},ee.prototype.set=function(w,D){var Y=this.__data__;return this.size+=this.has(w)?0:1,Y[w]=ct&&D===void 0?e:D,this},jt.prototype.clear=function(){this.__data__=[],this.size=0},jt.prototype.delete=function(w){var D=this.__data__,Y=Rt(D,w);return!(Y<0)&&(Y==D.length-1?D.pop():nt.call(D,Y,1),--this.size,!0)},jt.prototype.get=function(w){var D=this.__data__,Y=Rt(D,w);return Y<0?void 0:D[Y][1]},jt.prototype.has=function(w){return Rt(this.__data__,w)>-1},jt.prototype.set=function(w,D){var Y=this.__data__,Z=Rt(Y,w);return Z<0?(++this.size,Y.push([w,D])):Y[Z][1]=D,this},ue.prototype.clear=function(){this.size=0,this.__data__={hash:new ee,map:new(F||jt),string:new ee}},ue.prototype.delete=function(w){var D=Hr(this,w).delete(w);return this.size-=D?1:0,D},ue.prototype.get=function(w){return Hr(this,w).get(w)},ue.prototype.has=function(w){return Hr(this,w).has(w)},ue.prototype.set=function(w,D){var Y=Hr(this,w),Z=Y.size;return Y.set(w,D),this.size+=Y.size==Z?0:1,this},Zt.prototype.clear=function(){this.__data__=new jt,this.size=0},Zt.prototype.delete=function(w){var D=this.__data__,Y=D.delete(w);return this.size=D.size,Y},Zt.prototype.get=function(w){return this.__data__.get(w)},Zt.prototype.has=function(w){return this.__data__.has(w)},Zt.prototype.set=function(w,D){var Y=this.__data__;if(Y instanceof jt){var Z=Y.__data__;if(!F||Z.length<199)return Z.push([w,D]),this.size=++Y.size,this;Y=this.__data__=new ue(Z)}return Y.set(w,D),this.size=Y.size,this};var hr=function(w,D,Y){for(var Z=-1,ht=Object(w),Yt=Y(w),Dt=Yt.length;Dt--;){var we=Yt[++Z];if(D(ht[we],we,ht)===!1)break}return w};function ne(w){return w==null?w===void 0?"[object Undefined]":"[object Null]":ot&&ot in Object(w)?function(D){var Y=y.call(D,ot),Z=D[ot];try{D[ot]=void 0;var ht=!0}catch(Dt){}var Yt=R.call(D);return ht&&(Y?D[ot]=Z:delete D[ot]),Yt}(w):function(D){return R.call(D)}(w)}function Ur(w){return Ze(w)&&ne(w)==i}function bi(w){return!(!Ie(w)||function(D){return!!I&&I in D}(w))&&(Je(w)?L:a).test(function(D){if(D!=null){try{return N.call(D)}catch(Y){}try{return D+""}catch(Y){}}return""}(w))}function pr(w){if(!Ie(w))return function(ht){var Yt=[];if(ht!=null)for(var Dt in Object(ht))Yt.push(Dt);return Yt}(w);var D=Uo(w),Y=[];for(var Z in w)(Z!="constructor"||!D&&y.call(w,Z))&&Y.push(Z);return Y}function re(w,D,Y,Z,ht){w!==D&&hr(D,function(Yt,Dt){if(ht||(ht=new Zt),Ie(Yt))(function(Pe,zt,de,mr,Be,$o,la){var Gn=Ri(Pe,de),Fe=Ri(zt,de),BT=la.get(Fe);if(BT)return void Kt(Pe,de,BT);var Qe=$o?$o(Gn,Fe,de+"",Pe,zt,la):void 0,ua=Qe===void 0;if(ua){var wp=te(Fe),Rp=!wp&&ve(Fe),FT=!wp&&!Rp&&$r(Fe);Qe=Fe,wp||Rp||FT?te(Gn)?Qe=Gn:Ze(UT=Gn)&&ce(UT)?Qe=function(oe,un){var _e=-1,tn=oe.length;for(un||(un=Array(tn));++_e<tn;)un[_e]=oe[_e];return un}(Gn):Rp?(ua=!1,Qe=Fe.slice()):FT?(ua=!1,Qe=function(oe){var un=(_e=oe.buffer,tn=new _e.constructor(_e.byteLength),new j(tn).set(new j(_e)),tn),_e,tn;return new oe.constructor(un,oe.byteOffset,oe.length)}(Fe)):Qe=[]:function(oe){if(!Ze(oe)||ne(oe)!=s)return!1;var un=x(oe);if(un===null)return!0;var _e=y.call(un,"constructor")&&un.constructor;return typeof _e=="function"&&_e instanceof _e&&N.call(_e)==b}(Fe)||Qt(Fe)?(Qe=Gn,Qt(Gn)?Qe=function(oe){return function(un,_e,tn){var YD=!tn;tn||(tn={});for(var HT=-1,zD=_e.length;++HT<zD;){var Dp=_e[HT],Tu=void 0;Tu===void 0&&(Tu=un[Dp]),YD?qe(tn,Dp,Tu):Nt(tn,Dp,Tu)}return tn}(oe,Me(oe))}(Gn):Ie(Gn)&&!Je(Gn)||(Qe=function(oe){return typeof oe.constructor!="function"||Uo(oe)?{}:yt(x(oe))}(Fe))):ua=!1}var UT;ua&&(la.set(Fe,Qe),Be(Qe,Fe,mr,$o,la),la.delete(Fe)),Kt(Pe,de,Qe)})(w,D,Dt,Y,re,Z,ht);else{var we=Z?Z(Ri(w,Dt),Yt,Dt+"",w,D,ht):void 0;we===void 0&&(we=Yt),Kt(w,Dt,we)}},Me)}function Ii(w,D){return Di(function(Y,Z,ht){return Z=it(Z===void 0?Y.length-1:Z,0),function(){for(var Yt=arguments,Dt=-1,we=it(Yt.length-Z,0),Pe=Array(we);++Dt<we;)Pe[Dt]=Yt[Z+Dt];Dt=-1;for(var zt=Array(Z+1);++Dt<Z;)zt[Dt]=Yt[Dt];return zt[Z]=ht(Pe),function(de,mr,Be){switch(Be.length){case 0:return de.call(mr);case 1:return de.call(mr,Be[0]);case 2:return de.call(mr,Be[0],Be[1]);case 3:return de.call(mr,Be[0],Be[1],Be[2])}return de.apply(mr,Be)}(Y,this,zt)}}(w,D,ie),w+"")}var fr=P?function(w,D){return P(w,"toString",{configurable:!0,enumerable:!1,value:(Y=D,function(){return Y}),writable:!0});var Y}:ie;function Hr(w,D){var Y,Z,ht=w.__data__;return((Z=typeof(Y=D))=="string"||Z=="number"||Z=="symbol"||Z=="boolean"?Y!=="__proto__":Y===null)?ht[typeof D=="string"?"string":"hash"]:ht.map}function wi(w,D){var Y=function(Z,ht){return Z==null?void 0:Z[ht]}(w,D);return bi(Y)?Y:void 0}function Fo(w,D){var Y=typeof w;return!!(D=D==null?r:D)&&(Y=="number"||Y!="symbol"&&l.test(w))&&w>-1&&w%1==0&&w<D}function Uo(w){var D=w&&w.constructor;return w===(typeof D=="function"&&D.prototype||T)}function Ri(w,D){if((D!=="constructor"||typeof w[D]!="function")&&D!="__proto__")return w[D]}var Di=function(w){var D=0,Y=0;return function(){var Z=ut(),ht=16-(Z-Y);if(Y=Z,ht>0){if(++D>=800)return arguments[0]}else D=0;return w.apply(void 0,arguments)}}(fr);function Wn(w,D){return w===D||w!=w&&D!=D}var Qt=Ur(function(){return arguments}())?Ur:function(w){return Ze(w)&&y.call(w,"callee")&&!H.call(w,"callee")},te=Array.isArray;function ce(w){return w!=null&&Ho(w.length)&&!Je(w)}var ve=V||function(){return!1};function Je(w){if(!Ie(w))return!1;var D=ne(w);return D==o||D=="[object GeneratorFunction]"||D=="[object AsyncFunction]"||D=="[object Proxy]"}function Ho(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=r}function Ie(w){var D=typeof w;return w!=null&&(D=="object"||D=="function")}function Ze(w){return w!=null&&typeof w=="object"}var $r=A?function(w){return function(D){return w(D)}}(A):function(w){return Ze(w)&&Ho(w.length)&&!!u[ne(w)]};function Me(w){return ce(w)?gt(w):pr(w)}var Sn,ki=(Sn=function(w,D,Y){re(w,D,Y)},Ii(function(w,D){var Y=-1,Z=D.length,ht=Z>1?D[Z-1]:void 0,Yt=Z>2?D[2]:void 0;for(ht=Sn.length>3&&typeof ht=="function"?(Z--,ht):void 0,Yt&&function(we,Pe,zt){if(!Ie(zt))return!1;var de=typeof Pe;return!!(de=="number"?ce(zt)&&Fo(Pe,zt.length):de=="string"&&Pe in zt)&&Wn(zt[Pe],we)}(D[0],D[1],Yt)&&(ht=Z<3?void 0:ht,Z=1),w=Object(w);++Y<Z;){var Dt=D[Y];Dt&&Sn(w,Dt,Y,ht)}return w}));function ie(w){return w}n.exports=ki})(Ip,Ip.exports);const DD=hO(Ip.exports);class kD{constructor(t,e,r,i){this.backendRestClient=new RD(t,e,r,i)}async getApp(t){return function(e){return{appMetadata:{...e.appMetadata,id:e.appMetadata.id},features:e.features,role:LD(e.configuration,e.features)}}(await this.backendRestClient.get("/app",{role_name:t}))}async checkIfAppExists(){return this.backendRestClient.get("/app").then(()=>!0).catch(t=>{if(t.message==="Could not find app.")return!1;throw t})}}function LD(n,t){const e={general:{enableFileTransfers:t.includes("file_sharing"),enableLocation:t.includes("location_sharing"),enableMentions:!1,showTypingIndicators:!0,enablePresence:!1,enableVoiceRecording:!1},theme:{version:"v2",name:"default"},permissions:{messages:{delete:"own",edit:"own",reply:"all",emojiReactions:"all"},messagesCustom:{},conversations:{leave:"none",markAsUnread:"none"},conversationsCustom:{}},generalNotificationSettings:{timeout:"15"},emailSettings:{enabled:!0,subject:"{{sender.name}} wants to chat with you on {{app.name}}",replySeparator:"--- Write ABOVE THIS LINE to post a reply via email ---",unsubscribeText:"Unsubscribe from all chat emails",senderName:"{{sender.name}} (via {{app.name}})",header:`Hi {{recipient.name}},
1319
+ `,"g");return t=>Array.from(t.match(n)||[])}();function Np(n,t={except:[]}){let e=function(r,i){let o=[r];return o=Cp(o,i.multilineSteps),o=Cp(o,[vD]),o=Cp(o,i.singlelineSteps),o=vT(o),o}(n,function(r={except:[]}){var i;const o={multilineSteps:[],singlelineSteps:[]},s=(i=r.except)!=null?i:AD.filter(a=>!r.only.includes(a));return s.includes("BulletPoint")||o.multilineSteps.push(fD,mD),s.includes("Mention")||o.singlelineSteps.push(cD),s.includes("CustomEmoji")||o.singlelineSteps.push(dD),s.includes("Codespan")||o.multilineSteps.push(dr(/```([^]+?)```/g,([a,l])=>({type:"codespan",text:l}))),s.includes("FormattedLink")||o.singlelineSteps.push(gT),s.includes("Actions")||(o.singlelineSteps.push(hD),o.singlelineSteps.push(pD)),s.includes("Wikitext")||o.singlelineSteps.push(YR),s.includes("Autolink")||o.singlelineSteps.push(ED,gD),o}(t));return e=_T(e,!1),e}function AT(n){return Np(n,{except:["FormattedLink","Actions"]})}function Cp(n,t){return t.reduce((e,r)=>ia(e,r),n)}function vT(n){const t=[];let e=-1;for(const r of n)typeof r=="string"?typeof t[e]=="string"?t[e]+=r:t[++e]=r:t[++e]="children"in r?On(_t({},r),{children:vT(r.children)}):r;return t}function _T(n,t){const e=[];let r=[];for(let i=0;i<n.length;i++){const o=n[i];typeof o=="string"?r.push(o):"children"in o?(r.length>0&&(e.push(r.join("")),r=[]),o.children=_T(o.children,t||o.type==="link"||o.type==="actionbutton"||o.type==="actionlink"),e.push(o)):o.type==="autolink"&&t?r.push(o.text):(r.length>0&&(e.push(r.join("")),r=[]),e.push(o))}return r.length>0&&(e.push(r.join("")),r=[]),e}let _D=class{constructor(n,t,e,r){this.emoji=n,this.messageId=t,this.conversationId=e,this._realtimeClient=r}get brandedMessageId(){return this.messageId}get brandedConversationId(){return this.conversationId}add(){return H(this,null,function*(){const n=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"messages",this.brandedMessageId,"reactions",this.emoji,this._realtimeClient.userId],{});xt(`Add ${this.emoji} reaction on message ${this.messageId} in conversation ${this.conversationId}`,n)})}remove(){return H(this,null,function*(){const n=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedMessageId,"reactions",this.emoji,this._realtimeClient.userId],{});(n.ok||n.where!=="server"||n.value.status!==404)&&xt(`Remove ${this.emoji} reaction from message ${this.messageId} in conversation ${this.conversationId}`,n)})}};class yT{constructor(t,e,r){this.id=t,this.conversationId=e,this._realtimeClient=r}get brandedId(){return this.id}get brandedConversationId(){return this.conversationId}reaction(t){if(typeof t!="string")throw new Error(`Creating ReactionRef failed because emoji "${t}" is not a string`);if(t==="")throw new Error(`Creating ReactionRef failed because emoji "${t}" is an empty string`);return new _D(t,this.brandedId,this.brandedConversationId,this._realtimeClient)}get(){return H(this,null,function*(){const t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"messages",this.brandedId],{});if(!t.ok&&t.where==="server"&&t.value.status===404||!t.ok&&t.where==="server"&&t.value.status===403&&t.value.errorCode==="NOT_A_PARTICIPANT")return null;const e=xt("Get message "+this.id,t),r=yield this._realtimeClient.createMessageSnapshot(e,this.brandedConversationId);return gp("Get message "+this.id,r)})}edit(t){return H(this,null,function*(){const e={content:yD(t),custom:typeof t=="string"?void 0:t.custom},r=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"messages",this.brandedId],e);xt(`Edit message ${this.id} in conversation ${this.conversationId}`,r)})}delete(){return H(this,null,function*(){const t=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedId],{});(t.ok||t.where!=="server"||t.value.status!==404)&&xt(`Delete message ${this.id} in conversation ${this.conversationId}`,t)})}}function yD(n){return typeof n=="string"?[{type:"text",children:Np(n)}]:"text"in n&&n.text?[{type:"text",children:Np(n.text)}]:"content"in n&&n.content?n.content:void 0}class TD{constructor(t,e){this.id=t,this._realtimeClient=e,this.uselessObjForTypeCheck={subject:null,photoUrl:null,welcomeMessages:null,custom:null,access:null,notify:null}}get brandedId(){return this.id}get brandedUserId(){return this._realtimeClient.userId}participant(t){if(typeof t=="string"){if(t==="")throw new Error(`Creating ParticipantRef failed because ID "${t}" is an empty string`);return new Ky(t,this.id,this._realtimeClient)}if("brandedId"in t)return new Ky(t.id,this.id,this._realtimeClient);throw new Error(`Creating ParticipantRef failed because user "${t}" is not a string or a UserRef`)}message(t){if(typeof t!="string")throw new Error(`Creating MessageRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating MessageRef failed because ID "${t}" is an empty string`);return new yT(t,this.brandedId,this._realtimeClient)}get(){return H(this,null,function*(){const t=this._realtimeClient.listMessages(this.brandedId,{limit:1}),e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedId],{});if(!e.ok&&e.where==="server"&&e.value.status===404)return null;const r=xt("Get conversation "+this.id,e),i=gp("Get last message in conversation "+this.id,yield t),o=i.length===0?null:i[0];return this._realtimeClient.createConversationSnapshotPreloaded(r,o)})}set(t){return H(this,null,function*(){const e=this._realtimeClient.call("PUT",["conversations",this.brandedId],t),r=this._realtimeClient.call("PUT",["conversations",this.brandedId,"participants",this.brandedUserId],t),i=yield e;!i.ok&&i.where==="server"&&i.value.status===403&&i.value.errorCode==="UNAUTHORIZED_TO_EDIT"&&function(s){return s.subject===void 0&&s.photoUrl===void 0&&s.welcomeMessages===void 0&&s.custom!==null&&(s.custom===void 0||!Object.values(s.custom).some(a=>a!==void 0))}(t)||xt("Set conversation "+this.id,i);const o=yield r;!o.ok&&o.where==="server"&&o.value.status===403&&o.value.errorCode==="UNAUTHORIZED_TO_EDIT_PARTICIPANT"&&function(s){return s.access===void 0&&s.notify===void 0}(t)||xt("Set your participation in conversation "+this.id,o)})}createIfNotExists(){return H(this,arguments,function*(t={}){const e=this._realtimeClient.call("POST",["conversations",this.brandedId],t),r=this._realtimeClient.call("POST",["conversations",this.brandedId,"participants",this.brandedUserId],t),i=yield e;(i.ok||i.where!=="server"||i.value.status!==409)&&xt("Create conversation "+this.id,yield e);const o=yield r;(o.ok||o.where!=="server"||o.value.status!==409)&&xt("Join conversation "+this.id,yield r)})}markAsRead(){return H(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"read"],{});xt(`Mark ${this.id} as read`,t)})}markAsUnread(){return H(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"unread"],{});xt(`Mark ${this.id} as unread`,t)})}send(t){return H(this,null,function*(){const e={content:OD(t),referencedMessageId:SD(t),custom:typeof t=="string"?void 0:t.custom,idempotencyKey:HR(new Date().getTime())},r=yield this._realtimeClient.call("POST",["conversations",this.brandedId,"messages"],e),i=xt("Send message to conversation "+this.id,r);return new yT(i.id,this.brandedId,this._realtimeClient)})}subscribeMessages(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"messages"],t)}subscribeParticipants(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"participants"],t)}subscribe(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId],t)}subscribeTyping(t){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"typing"],t)}markAsTyping(){return H(this,null,function*(){const t=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"typing"],{});xt(`Set user as typing in ${this.id}`,t)})}}function OD(n){return typeof n=="string"?[{type:"text",children:AT(n)}]:"text"in n?[{type:"text",children:AT(n.text)}]:n.content}function SD(n){if(typeof n=="string")return;const t=n.referencedMessage;return t!==void 0?typeof t=="string"?t:t.id:void 0}class Ci{constructor(t,e,r){this.realtimeWsApiUrl=t,this.internalHttpApiUrl=e,this.restApiHttpUrl=r}getBokensUrl(t,e,r){return this.internalHttpApiUrl+`/${t}/bokens/${encodeURIComponent(e)}?signature=${encodeURIComponent(r!=null?r:"")}`}getRealtimeWsUrl(t,e,r,i,o){const s=encodeURIComponent(e);return this.realtimeWsApiUrl+`/${t}/realtime/${s}?talkjs-client-build=${o!=null?o:"standalone"}&talkjs-core=${r}&talkjs-client-id=${i}`}static fromHost(t){const e=new Ci("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!t)return e;if(t.endsWith("talkjs.com")){const r=t.match(/\w+-(\w+)\.talkjs\.com/);if(r){const i=r[1];return new Ci(`wss://realtime-${i}.talkjs.com/v1`,`https://app-${i}.talkjs.com/api/v0`,`https://api-${i}.talkjs.com/v1`)}return e}return t.includes("localhost")||t.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(t)?new Ci(`ws://${t}/public_api/v1`,`http://${t}/api/v0`,`http://${t}/public_api/v1`):new Ci(`wss://${t}/public_api/v1`,`https://${t}/api/v0`,`https://${t}/public_api/v1`)}}function Au({method:n,url:t,data:e,options:r,attempts:i,shouldRetry:o,authProvider:s}){var a;(!i||i<=0)&&(i=1);const l={"x-talkjs-client-build":"jssdk-dev","x-talkjs-client-date":"2025-08-28T08:53:22.349Z"};return e instanceof FormData||(l["Content-Type"]=(a=r==null?void 0:r.contentType)!=null?a:"application/json"),My(i,()=>H(this,null,function*(){if(s){const u=yield s.getToken();l.Authorization=`Bearer ${u}`}return fetch(t,{method:n,headers:l,body:e}).then(u=>{if(u.ok)return u;throw u})}),{initialDelay:.2,log:void 0,shouldRetry:u=>H(this,null,function*(){return s&&u.status===401?(vu.log(`401 error from ${n} ${t}, ${yield s.getToken()}`),s.refreshToken(),!0):o?o(u):!("status"in u&&u.status>=400&&u.status<500)})}).catch(u=>{if(Math.random()<.1&&!t.toString().startsWith("https://capture.trackjs.com")){const c=`Network Error for ${n} ${t}`;typeof window!="undefined"&&(u instanceof Response?u.clone().text().then(d=>vu.log(`${c} ${u.status} ${d} (10% logged)`)):vu.log(`${c} ${u} (10% logged)`)),console.error("[TalkJS]",c)}throw u})}const{cdnHost:JD,appHost:ND,restHost:ZD,realtimeHost:QD,appProtocol:tk,appWsProtocol:ek}=function(){if(typeof window=="undefined")return{cdnHost:"test-hostname",appHost:"test-hostname",appProtocol:"http:",appWsProtocol:"ws:"};const n=function(){if(document.currentScript)return document.currentScript.src;try{throw new Error}catch(l){const u=l.stack.match(/https?:\/\/.*\.(js|jsx|ts|tsx)/);return u?u[0]:""}}(),t=document.createElement("a");t.href=n;const e=t.host,r=(a=e).match(/^cdn[.-]/)?a.replace(/^cdn/,"app"):a==="talkjs.com"?"app.talkjs.com":a,i=function(l){return l.match(/^app[.-]/)?l.replace(/^app/,"api"):l+"/public_api"}(r),o=function(l){return l.match(/^app[.-]/)?l.replace(/^app/,"realtime"):l+"/public_api"}(r),s=t.protocol;var a;return{cdnHost:e,appHost:r,restHost:i,realtimeHost:o,appProtocol:s,appWsProtocol:s==="https:"?"wss:":"ws:"}}(),CD=ND.startsWith("app.talkjs.com"),vu=typeof window=="undefined"?{log:n=>Promise.resolve(),setData:n=>{}}:new class{constructor(n){this._timeCreated=Date.now(),this._enabled=CD,this._trackJSData={customer:{application:"",correlationId:"",sessionId:"",token:"",userId:"",version:"dev-2025-08-28T08:53:22.349Z"},entry:"direct",environment:{age:Date.now()-this._timeCreated,dependencies:{},originalUrl:window.location.href,referrer:document.referrer,userAgent:window.navigator.userAgent},metadata:[],nav:[],network:[],url:window.location.href,stack:"",timestamp:new Date().toISOString(),version:"dev-2025-08-28T08:53:22.349Z",throttled:0},this._url=`https://capture.trackjs.com/capture?token=${n}`,this._trackJSData.customer.token=n}setData({appId:n,meId:t,sessionId:e}){this._trackJSData.customer.userId=n,this._trackJSData.customer.sessionId=`${n}/${t}`,this._trackJSData.customer.correlationId=e}log(n){return H(this,null,function*(){try{if(!this._enabled)return Promise.resolve();const t=On(_t({},this._trackJSData),{message:n});yield Au({method:"POST",url:this._url,data:JSON.stringify(t),options:{contentType:"text/plain"}})}catch(t){console.error("[TalkJS] Failed when sending an error report. Error: ",t)}})}}("970cd0be0fb74630b75c8451051299dc");class bD{constructor(t,e={}){this._onSubscription=e,this._handlers={};for(const r in t)Object.hasOwnProperty.call(t,r)&&(this._handlers[r]=[])}emit(t,e){for(const r of this._handlers[t])try{r(e)}catch(i){console.error(`[TalkJS] '${String(t)}' handler threw an error:`,i)}}emitAsync(t,e){return H(this,null,function*(){try{const r=this._handlers[t].map(i=>i(e));yield Promise.all(r)}catch(r){console.error(`[TalkJS] '${String(t)}' handler threw an error:`,r)}})}supports(t){return t in this._handlers}on(t,e){var r,i;if(!this.supports(t))throw new Error(`Unknown event type '${String(t)}'`);(i=(r=this._onSubscription)[t])==null||i.call(r),this._handlers[t].push(e)}off(t,e){if(!Object.hasOwnProperty.call(this._handlers,t))throw new Error(`Unknown event type '${String(t)}'`);const r=this._handlers[t].indexOf(e);r!==-1&&this._handlers[t].splice(r,1)}removeAllListeners(){for(const t in this._handlers)this._handlers[t]=[]}handles(t){return this._handlers[t].length>0}subscribe(t,e){return this.on(t,e),{unsubscribe:()=>this.off(t,e)}}}class ID{constructor(t,e,r,i,o,s){if(this.appId=e,this.userId=r,this.tokenFetcher=o,this.usingBokens=!1,this.requestInProgress=!1,this.eventEmitter=new bD({tokenChanged(a){},tokenRefreshFailed(a){},tokenAccepted(a){}}),this.sessionExpiryWarningTimeoutId=void 0,s&&(i||o))throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");i?this.fetchToken(()=>i):(o||(this.usingBokens=!0,this.tokenFetcher=()=>this.sendBokenRequest(t,s)),this.refreshToken())}get canRefreshToken(){return this.usingBokens||!!this.tokenFetcher}getToken(){return this.token}refreshToken(){if(!this.requestInProgress){if(!this.tokenFetcher)throw this.emitTokenRefreshFailed("no `tokenFetcher` provided"),new Error("[TalkJS] Cannot refresh token, no `tokenFetcher` provided.");this.fetchToken(this.tokenFetcher)}}onTokenChanged(t){return this.eventEmitter.on("tokenChanged",t),()=>{this.eventEmitter.off("tokenChanged",t)}}emitTokenChanged(t){this.eventEmitter.emit("tokenChanged",t)}onTokenRefreshFailed(t){return this.eventEmitter.on("tokenRefreshFailed",t),()=>{this.eventEmitter.off("tokenRefreshFailed",t)}}emitTokenRefreshFailed(t){this.eventEmitter.emit("tokenRefreshFailed",t),console.error(`[TalkJS] Could not authenticate, cannot recover automatically: ${t}`)}onTokenAccepted(t){return this.eventEmitter.on("tokenAccepted",t),()=>{this.eventEmitter.off("tokenAccepted",t)}}emitTokenAccepted(t){this.eventEmitter.emit("tokenAccepted",t)}clearScheduledRefresh(){this.sessionExpiryWarningTimeoutId&&clearTimeout(this.sessionExpiryWarningTimeoutId)}scheduleRefresh(t){if(this.clearScheduledRefresh(),t===null)return;const e=this.tokenFetcher!==void 0;if(t<120&&!e?console.warn(`[TalkJS] TalkJS will stop working in ${t} seconds due to auth token expiry. Token expires in ${t} seconds, and cannot be refreshed because no \`tokenFetcher\` was provided when creating the session. Non-refreshable tokens are recommended to expire at least 24 hours in the future.`):t<120&&e?console.warn(`[TalkJS] TalkJS auth token will expire and need to be refreshed in ${t} seconds. Refreshable JWTs are recommended to expire at least 30 minutes in the future, to improve performance and reduce unnecessary refreshes.`):t<3300&&!e&&console.warn(`[TalkJS debug] TalkJS will stop working in ${Math.round(t/60)} minutes due to auth token expiry. Non-refreshable tokens are recommended to expire at least 24 hours in the future. Alternatively, provide a \`tokenFetcher\` when creating the session, so that tokens can be refreshed when they expire.`),this.tokenFetcher!==void 0){const r=t>600?t-300:t/2,i=Math.min(1728e6,1e3*r);this.sessionExpiryWarningTimeoutId=setTimeout(()=>{this.refreshToken()},i)}else t<2e6&&(this.sessionExpiryWarningTimeoutId=setTimeout(()=>{this.emitTokenRefreshFailed("Token has expired and no `tokenFetcher` was provided when creating the session, so it cannot be refreshed.")},1e3*t))}fetchToken(t){return H(this,null,function*(){if(this.requestInProgress)return;this.requestInProgress=!0;const e=()=>H(this,null,function*(){const r=yield t();return this.checkJwt(r),r});try{const r=this.token!==void 0;this.token=e(),yield this.token.then(i=>{r&&this.emitTokenChanged(i)}).catch(i=>{this.emitTokenRefreshFailed(i)})}catch(r){this.emitTokenRefreshFailed(r)}finally{this.requestInProgress=!1}})}checkJwt(t){(function(s){if(!(typeof s=="string"||s instanceof String))throw s===void 0?"Token was undefined":"Token must be a string, got: "+s})(t);const e=[];let r,i,o;if(typeof t=="string"?r=t:e.push(`Token type is ${typeof t} instead of a string.`),r)try{const s=function(a){const l=a.split(".");if(l.length!==3)throw"Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";return{header:TT(l[0]),payload:TT(l[1])}}(r);i=s.header,o=s.payload}catch(s){e.push(s)}if(i){const s=this.checkJwtHeader(i);e.push(...s)}if(o){const s=this.checkJwtPayload(o);e.push(...s)}if(e.length)if(this.usingBokens)vu.log(`JWT Errors detected by AuthProvider when using bokens: ${e.join(`
1320
+ `)}`);else{console.warn("[TalkJS] Authentication token appears to be generated incorrectly. Will still attempt to authenticate, but TalkJS may not work as expected. See below for a description of any problems and how to fix them.");const s=e.length>1;e.forEach((a,l)=>{const u=s?`Reason ${l+1}:`:"Reason:";console.warn(`[TalkJS] ${u} ${a}`)}),console.warn(`[TalkJS]: Authentication token: "${t}"`)}}checkJwtHeader(t){const e=[],r=t.alg;return r===void 0?e.push('Token header must contain `"alg": "HS256"`, but no `alg` was specified.'):typeof r!="string"?e.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!=="HS256"&&e.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was set to "${r}" instead. HS256 is the only supported algorithm.`),e}checkJwtPayload(t){const e=[],r=t.iss;r===void 0?e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was missing.`):typeof r!="string"?e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!==this.appId&&e.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was set to "${r}" instead.`);const i=t.sub;i===void 0?e.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`):typeof i!="string"?e.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof i} instead of a string. Make sure you wrap the value in "".`):i!==this.userId&&e.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${i}" instead.`);const o=t.tokenType;o===void 0?e.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.'):typeof o!="string"?e.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof o} instead of a string. Make sure you wrap the value in "".`):o!=="user"&&e.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${o}" instead.`);const s=t.exp;s===void 0||(typeof s!="number"?e.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof o} instead of a number. If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Don't wrap the value in "".`):s<1e9?e.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${s}, representing ${new Date(1e3*s).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01.`):s>1e11?e.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${s}, representing ${new Date(1e3*s).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`):s<new Date().getTime()/1e3&&e.push(`Token payload contains an \`exp\` claim, but \`exp\` (${s}, representing ${new Date(1e3*s).toLocaleDateString()}) appears to be in the past, meaning the token will be rejected. This error can also happen if your device's clock is set incorrectly, in which case the token will still work.`));const a=t.nbf;return a===void 0||(typeof a!="number"?e.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof o} instead of a number. If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01.`):a>1e11&&e.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${a}, representing ${new Date(1e3*a).toLocaleDateString()}). If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`)),e}sendBokenRequest(t,e){return H(this,null,function*(){let r=0;const i=t.getBokensUrl(this.appId,this.userId,e);return(yield(yield Au({method:"GET",url:i,attempts:1e4,shouldRetry:s=>{if(s instanceof Error)return!0;if(s.status===401)throw"Check that you provided a valid signature.";if(s.status===404)throw"Check that you specified the correct App ID.";if(s.status===429||s.status===502)return!0;if(s.status>=400&&s.status<500)throw`Unexpected HTTP ${s.status} response when fetching auth token. Check that you configured the session correctly.`;if(r++,r>=5)throw`Unexpected HTTP ${s.status} response when fetching auth token, retrying did not help.`;return!0}})).json()).boken})}}function TT(n){try{const t=n.replace(/-/g,"+").replace(/_/g,"/"),e=decodeURIComponent(atob(t).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(e)}catch(t){throw`Could not base64-decode and JSON-parse token section: ${n}. Check that you base-64 encoded the section correctly.`}}class wD{constructor(t){this.target=t}deref(){return this.target}}const OT=new class{constructor(){this.registry={}}getOrCreate(n){var t;const e=this.key(n),r=(t=this.registry[e])==null?void 0:t.deref();if(r)return r;const i=new ST(n),o=globalThis.WeakRef?new WeakRef(i):new wD(i);return this.registry[e]=o,i}deregister(n,t){const e=this.key({appId:n,userId:t});delete this.registry[e]}key({appId:n,userId:t}){return`${n}:${t}`}};class ST{constructor(t){(function(l){function u(c,d){if(!c)throw new Error("[TalkJS] TalkSession: "+d)}u(l&&typeof l=="object","Expected an object argument in TalkSession#constructor."),u(l.appId&&typeof l.appId=="string","The `appId` property of TalkSession#constructor is required and it must be a non-empty string."),u(typeof l.userId=="string","The `userId` property of TalkSession#constructor is required and it must be a string."),l.token!==void 0&&u(l.token&&typeof l.token=="string","The `token` property of TalkSession#constructor must be a non-empty string."),l.tokenFetcher!==void 0&&u(typeof l.tokenFetcher=="function","The `tokenFetcher` property of TalkSession#constructor must be a function.")})(t);const{appId:e,userId:r,token:i,tokenFetcher:o,signature:s}=t;this._appId=e,this._apiUrls=t.apiUrls?new Ci(t.apiUrls.realtimeWsApiUrl,t.apiUrls.internalHttpApiUrl,t.apiUrls.restApiHttpUrl):Ci.fromHost(t.host),this._authProvider=new ID(this._apiUrls,e,r,i,o,s);const a=Math.random().toString().split(".")[1];this._realtimeClient=new UR(this._apiUrls.getRealtimeWsUrl(e,r,"1.5.1",a,t.clientBuild),r,this._authProvider),this.currentUser=new Xy(this._realtimeClient.userId,this._realtimeClient),this._terminationReason=yi(),this._terminationReason.promise.then(l=>{console.error(`[TalkSession] ${l}`)}),function(l,u,c){return H(this,null,function*(){return Au({method:"GET",url:`${u}/${l}/app`,authProvider:c}).then(d=>d.status===200||d.status!==404&&(console.warn(`[TalkJS] Received unexpected ${d.status} status code when validating app ID. Assuming that the app ID is valid.`),!0)).catch(d=>{if(typeof d!="string"&&"status"in d){const h=d;return h.status===200||h.status!==404&&(console.warn(`[TalkJS] Received unexpected ${h.status} status code when validating app ID. Assuming that the app ID is valid.`),!0)}return console.warn("[TalkJS] Encountered network issues when validating app ID. Assuming that the app ID is valid."),!0})})}(this._appId,this._apiUrls.internalHttpApiUrl,this._authProvider).then(l=>{l||this.terminate(new Error(`The app ID ${this._appId} does not exist. Make sure you are using the correct app ID as found on the TalkJS dashboard. App IDs are case-sensitive.`))}),this._authProvider.onTokenRefreshFailed(l=>{this.terminate(new Error(`Could not authenticate, cannot recover automatically: ${l}`))})}onError(t){const e=yi();return Promise.race([e.promise,this._terminationReason.promise]).then(r=>{r!=="UNSUBSCRIBED"&&t(r)}),{unsubscribe:()=>e.resolve("UNSUBSCRIBED")}}user(t){if(typeof t!="string")throw new Error(`Creating UserRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating UserRef failed because ID "${t}" is an empty string`);return new Xy(t,this._realtimeClient)}conversation(t){if(typeof t!="string")throw new Error(`Creating ConversationRef failed because ID "${t}" is not a string`);if(t==="")throw new Error(`Creating ConversationRef failed because ID "${t}" is an empty string`);return new TD(t,this._realtimeClient)}subscribeConversations(t){return this._realtimeClient.subscribe(["me","conversations"],t)}terminate(t){OT.deregister(this._appId,this.currentUser.id),this._terminationReason.resolve(t),this._realtimeClient.destroy()}_isConnected(){return this._realtimeClient.isConnected()}uploadFile(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,e)}uploadImage(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"image"},e))}uploadVideo(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"video"},e))}uploadAudio(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"audio"},e))}uploadVoice(t,e){return oa(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,t,_t({subtype:"voice"},e))}}function oa(n,t,e,r){return H(this,arguments,function*(i,o,s,{subtype:a,filename:l,width:u,height:c,duration:d}){const h=new FormData;return h.set("file",s,l),a!==void 0&&h.set("subtype",a),u!==void 0&&h.set("width",u.toString()),c!==void 0&&h.set("height",c.toString()),d!==void 0&&h.set("duration",d.toString()),Au({method:"POST",url:i,data:h,authProvider:o}).then(p=>p.json()).then(p=>p.attachmentToken).catch(p=>H(this,null,function*(){if(p instanceof Response){const f=yield p.json(),m=`Unexpected response when uploading file, status code ${p.status} ${f.errorCode}, ${f.reasons}`;throw new Error(m)}throw p}))})}function NT(n){return Object.keys(n)}class bp extends Error{constructor(t,e){const r=function(i){if(typeof i=="string")return i;if(Array.isArray(i))return i.join(`
1321
+ `);try{return JSON.stringify(i)}catch(o){return String(i)}}(t);super(r),this.userMessage=e!=null?e:r,Object.setPrototypeOf&&Object.setPrototypeOf(this,new.target.prototype)}}const sa=console;class RD{constructor(t,e,r,i){this.apiUrls=t,this.appId=e,this.sessionId=r,this.authProvider=i,this._lastPutPromise=Promise.resolve()}async get(t,e={}){const r=this.endpointUrl(t,e),i=await aa(()=>this.fetchWithReauth(r),{retries:11});return await this.handleResponse(i,r)}async queuedPut(t,e){await this._lastPutPromise;const r=aa(()=>this._doPut(t,e));return this._lastPutPromise=r,r}put(t,e,r){const i=()=>this._doPut(t,e);return r?bT(i,r):aa(i,{retries:5})}post(t,e,r){const i=()=>this._doPost(t,e);return r?bT(i,r):aa(i,{retries:5})}delete(t,e={}){return aa(()=>this._doDelete(t,e),{retries:11})}endpointUrl(t,e={}){const r=new URL(this.apiUrls.internalHttpApiUrl);r.pathname+=`/${this.appId}/${t}`,r.searchParams.set("sessionId",this.sessionId);for(const[i,o]of Object.entries(e))r.searchParams.set(i,o);return r}async _doPut(t,e){const r=this.endpointUrl(t),i=await this.fetchWithReauth(r,{method:"PUT",body:JSON.stringify(e)});return await this.handleResponse(i,r)}async _doPost(t,e){const r=this.endpointUrl(t),i=await this.fetchWithReauth(r,{method:"POST",body:JSON.stringify(e)});return await this.handleResponse(i,r)}async _doDelete(t,e){const r=this.endpointUrl(t,e),i=await this.fetchWithReauth(r,{method:"DELETE"});return await this.handleResponse(i,r)}async handleResponse(t,e){if(t.status>=300){if(t.status===404)throw vc.error(`[${this.appId}][BackendRestClient] Couldn't find resource.`),new bp("Could not find app.",`Could not find given appId: "${this.appId}". You can find your appId on https://talkjs.com/dashboard.`);if(t.status===401){const r=await this.authProvider.getToken();throw vc.error(`[${this.appId}][BackendRestClient] Couldn't authenticate ${e} with token ${r}.`),new bp("User not authenticated.","Could not authenticate user. Check if your signature is calculated correctly.")}if(t.status>=300&&t.status<500){const{error:r}=await t.json();throw new bp(r)}{const r=await t.text();throw new Error(`Got non-success response (${r}) from the server for url: ${e}.`)}}return await t.json()}async fetchWithReauth(t,e){function r(s){const a={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${s}`};return fetch(t,{...e,headers:a})}const i=await this.authProvider.getToken(),o=await r(i);return o.status!==401?o:(sa.error(`401 error from ${e==null?void 0:e.method} ${t}, ${i}`),this.authProvider.refreshToken(),r(await this.authProvider.getToken()))}}function CT(n){return!n.userMessage}function aa(n,{retries:t=30}={}){return tp(t,n,{shouldRetry:CT,log:sa.warn.bind(sa),maxDelay:30,initialDelay:.2})}async function bT(n,t){try{return await n()}catch(r){if(!CT(r))throw r}let e=!1;return t.then(()=>{e=!0}),tp(1e3,n,{initialDelay:.2,maxDelay:30,shouldRetry:()=>!e,log:sa.warn.bind(sa)})}var Ip={exports:{}};(function(n,t){var e="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",o="[object Function]",s="[object Object]",a=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[i]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u[o]=u["[object Map]"]=u["[object Number]"]=u[s]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1;var c=typeof Ta=="object"&&Ta&&Ta.Object===Object&&Ta,d=typeof self=="object"&&self&&self.Object===Object&&self,h=c||d||Function("return this")(),p=t&&!t.nodeType&&t,f=p&&n&&!n.nodeType&&n,m=f&&f.exports===p,g=m&&c.process,E=function(){try{var R=f&&f.require&&f.require("util").types;return R||g&&g.binding&&g.binding("util")}catch(D){}}(),A=E&&E.isTypedArray,v,_=Array.prototype,O=Function.prototype,T=Object.prototype,S=h["__core-js_shared__"],N=O.toString,y=T.hasOwnProperty,w=(v=/[^.]+$/.exec(S&&S.keys&&S.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",b=T.toString,I=N.call(Object),P=RegExp("^"+N.call(y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),k=m?h.Buffer:void 0,B=h.Symbol,$=h.Uint8Array;k&&k.allocUnsafe;var U,V,L=(U=Object.getPrototypeOf,V=Object,function(R){return U(V(R))}),Q=Object.create,j=T.propertyIsEnumerable,tt=_.splice,it=B?B.toStringTag:void 0,x=function(){try{var R=wi(Object,"defineProperty");return R({},"",{}),R}catch(D){}}(),q=k?k.isBuffer:void 0,ot=Math.max,ut=Date.now,F=wi(h,"Map"),ct=wi(Object,"create"),yt=function(){function R(){}return function(D){if(!Ie(D))return{};if(Q)return Q(D);R.prototype=D;var Y=new R;return R.prototype=void 0,Y}}();function ee(R){var D=-1,Y=R==null?0:R.length;for(this.clear();++D<Y;){var Z=R[D];this.set(Z[0],Z[1])}}function jt(R){var D=-1,Y=R==null?0:R.length;for(this.clear();++D<Y;){var Z=R[D];this.set(Z[0],Z[1])}}function ce(R){var D=-1,Y=R==null?0:R.length;for(this.clear();++D<Y;){var Z=R[D];this.set(Z[0],Z[1])}}function Zt(R){var D=this.__data__=new jt(R);this.size=D.size}function gt(R,D){var Y=te(R),Z=!Y&&Qt(R),pt=!Y&&!Z&&ve(R),Yt=!Y&&!Z&&!pt&&$r(R),Dt=Y||Z||pt||Yt,we=Dt?function(he,mr){for(var Be=-1,jo=Array(he);++Be<he;)jo[Be]=mr(Be);return jo}(R.length,String):[],Pe=we.length;for(var zt in R)Dt&&(zt=="length"||pt&&(zt=="offset"||zt=="parent")||Yt&&(zt=="buffer"||zt=="byteLength"||zt=="byteOffset")||Uo(zt,Pe))||we.push(zt);return we}function Kt(R,D,Y){(Y!==void 0&&!Wn(R[D],Y)||Y===void 0&&!(D in R))&&qe(R,D,Y)}function Nt(R,D,Y){var Z=R[D];y.call(R,D)&&Wn(Z,Y)&&(Y!==void 0||D in R)||qe(R,D,Y)}function Rt(R,D){for(var Y=R.length;Y--;)if(Wn(R[Y][0],D))return Y;return-1}function qe(R,D,Y){D=="__proto__"&&x?x(R,D,{configurable:!0,enumerable:!0,value:Y,writable:!0}):R[D]=Y}ee.prototype.clear=function(){this.__data__=ct?ct(null):{},this.size=0},ee.prototype.delete=function(R){var D=this.has(R)&&delete this.__data__[R];return this.size-=D?1:0,D},ee.prototype.get=function(R){var D=this.__data__;if(ct){var Y=D[R];return Y===e?void 0:Y}return y.call(D,R)?D[R]:void 0},ee.prototype.has=function(R){var D=this.__data__;return ct?D[R]!==void 0:y.call(D,R)},ee.prototype.set=function(R,D){var Y=this.__data__;return this.size+=this.has(R)?0:1,Y[R]=ct&&D===void 0?e:D,this},jt.prototype.clear=function(){this.__data__=[],this.size=0},jt.prototype.delete=function(R){var D=this.__data__,Y=Rt(D,R);return!(Y<0)&&(Y==D.length-1?D.pop():tt.call(D,Y,1),--this.size,!0)},jt.prototype.get=function(R){var D=this.__data__,Y=Rt(D,R);return Y<0?void 0:D[Y][1]},jt.prototype.has=function(R){return Rt(this.__data__,R)>-1},jt.prototype.set=function(R,D){var Y=this.__data__,Z=Rt(Y,R);return Z<0?(++this.size,Y.push([R,D])):Y[Z][1]=D,this},ce.prototype.clear=function(){this.size=0,this.__data__={hash:new ee,map:new(F||jt),string:new ee}},ce.prototype.delete=function(R){var D=Hr(this,R).delete(R);return this.size-=D?1:0,D},ce.prototype.get=function(R){return Hr(this,R).get(R)},ce.prototype.has=function(R){return Hr(this,R).has(R)},ce.prototype.set=function(R,D){var Y=Hr(this,R),Z=Y.size;return Y.set(R,D),this.size+=Y.size==Z?0:1,this},Zt.prototype.clear=function(){this.__data__=new jt,this.size=0},Zt.prototype.delete=function(R){var D=this.__data__,Y=D.delete(R);return this.size=D.size,Y},Zt.prototype.get=function(R){return this.__data__.get(R)},Zt.prototype.has=function(R){return this.__data__.has(R)},Zt.prototype.set=function(R,D){var Y=this.__data__;if(Y instanceof jt){var Z=Y.__data__;if(!F||Z.length<199)return Z.push([R,D]),this.size=++Y.size,this;Y=this.__data__=new ce(Z)}return Y.set(R,D),this.size=Y.size,this};var hr=function(R,D,Y){for(var Z=-1,pt=Object(R),Yt=Y(R),Dt=Yt.length;Dt--;){var we=Yt[++Z];if(D(pt[we],we,pt)===!1)break}return R};function ne(R){return R==null?R===void 0?"[object Undefined]":"[object Null]":it&&it in Object(R)?function(D){var Y=y.call(D,it),Z=D[it];try{D[it]=void 0;var pt=!0}catch(Dt){}var Yt=b.call(D);return pt&&(Y?D[it]=Z:delete D[it]),Yt}(R):function(D){return b.call(D)}(R)}function Ur(R){return Ze(R)&&ne(R)==i}function bi(R){return!(!Ie(R)||function(D){return!!w&&w in D}(R))&&(Je(R)?P:a).test(function(D){if(D!=null){try{return N.call(D)}catch(Y){}try{return D+""}catch(Y){}}return""}(R))}function pr(R){if(!Ie(R))return function(pt){var Yt=[];if(pt!=null)for(var Dt in Object(pt))Yt.push(Dt);return Yt}(R);var D=Ho(R),Y=[];for(var Z in R)(Z!="constructor"||!D&&y.call(R,Z))&&Y.push(Z);return Y}function re(R,D,Y,Z,pt){R!==D&&hr(D,function(Yt,Dt){if(pt||(pt=new Zt),Ie(Yt))(function(Pe,zt,he,mr,Be,jo,la){var Gn=Ri(Pe,he),Fe=Ri(zt,he),BT=la.get(Fe);if(BT)return void Kt(Pe,he,BT);var Qe=jo?jo(Gn,Fe,he+"",Pe,zt,la):void 0,ua=Qe===void 0;if(ua){var wp=te(Fe),Rp=!wp&&ve(Fe),FT=!wp&&!Rp&&$r(Fe);Qe=Fe,wp||Rp||FT?te(Gn)?Qe=Gn:Ze(UT=Gn)&&de(UT)?Qe=function(oe,un){var _e=-1,tn=oe.length;for(un||(un=Array(tn));++_e<tn;)un[_e]=oe[_e];return un}(Gn):Rp?(ua=!1,Qe=Fe.slice()):FT?(ua=!1,Qe=function(oe){var un=(_e=oe.buffer,tn=new _e.constructor(_e.byteLength),new $(tn).set(new $(_e)),tn),_e,tn;return new oe.constructor(un,oe.byteOffset,oe.length)}(Fe)):Qe=[]:function(oe){if(!Ze(oe)||ne(oe)!=s)return!1;var un=L(oe);if(un===null)return!0;var _e=y.call(un,"constructor")&&un.constructor;return typeof _e=="function"&&_e instanceof _e&&N.call(_e)==I}(Fe)||Qt(Fe)?(Qe=Gn,Qt(Gn)?Qe=function(oe){return function(un,_e,tn){var YD=!tn;tn||(tn={});for(var HT=-1,zD=_e.length;++HT<zD;){var Dp=_e[HT],Tu=void 0;Tu===void 0&&(Tu=un[Dp]),YD?qe(tn,Dp,Tu):Nt(tn,Dp,Tu)}return tn}(oe,Me(oe))}(Gn):Ie(Gn)&&!Je(Gn)||(Qe=function(oe){return typeof oe.constructor!="function"||Ho(oe)?{}:yt(L(oe))}(Fe))):ua=!1}var UT;ua&&(la.set(Fe,Qe),Be(Qe,Fe,mr,jo,la),la.delete(Fe)),Kt(Pe,he,Qe)})(R,D,Dt,Y,re,Z,pt);else{var we=Z?Z(Ri(R,Dt),Yt,Dt+"",R,D,pt):void 0;we===void 0&&(we=Yt),Kt(R,Dt,we)}},Me)}function Ii(R,D){return Di(function(Y,Z,pt){return Z=ot(Z===void 0?Y.length-1:Z,0),function(){for(var Yt=arguments,Dt=-1,we=ot(Yt.length-Z,0),Pe=Array(we);++Dt<we;)Pe[Dt]=Yt[Z+Dt];Dt=-1;for(var zt=Array(Z+1);++Dt<Z;)zt[Dt]=Yt[Dt];return zt[Z]=pt(Pe),function(he,mr,Be){switch(Be.length){case 0:return he.call(mr);case 1:return he.call(mr,Be[0]);case 2:return he.call(mr,Be[0],Be[1]);case 3:return he.call(mr,Be[0],Be[1],Be[2])}return he.apply(mr,Be)}(Y,this,zt)}}(R,D,ie),R+"")}var fr=x?function(R,D){return x(R,"toString",{configurable:!0,enumerable:!1,value:(Y=D,function(){return Y}),writable:!0});var Y}:ie;function Hr(R,D){var Y,Z,pt=R.__data__;return((Z=typeof(Y=D))=="string"||Z=="number"||Z=="symbol"||Z=="boolean"?Y!=="__proto__":Y===null)?pt[typeof D=="string"?"string":"hash"]:pt.map}function wi(R,D){var Y=function(Z,pt){return Z==null?void 0:Z[pt]}(R,D);return bi(Y)?Y:void 0}function Uo(R,D){var Y=typeof R;return!!(D=D==null?r:D)&&(Y=="number"||Y!="symbol"&&l.test(R))&&R>-1&&R%1==0&&R<D}function Ho(R){var D=R&&R.constructor;return R===(typeof D=="function"&&D.prototype||T)}function Ri(R,D){if((D!=="constructor"||typeof R[D]!="function")&&D!="__proto__")return R[D]}var Di=function(R){var D=0,Y=0;return function(){var Z=ut(),pt=16-(Z-Y);if(Y=Z,pt>0){if(++D>=800)return arguments[0]}else D=0;return R.apply(void 0,arguments)}}(fr);function Wn(R,D){return R===D||R!=R&&D!=D}var Qt=Ur(function(){return arguments}())?Ur:function(R){return Ze(R)&&y.call(R,"callee")&&!j.call(R,"callee")},te=Array.isArray;function de(R){return R!=null&&$o(R.length)&&!Je(R)}var ve=q||function(){return!1};function Je(R){if(!Ie(R))return!1;var D=ne(R);return D==o||D=="[object GeneratorFunction]"||D=="[object AsyncFunction]"||D=="[object Proxy]"}function $o(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=r}function Ie(R){var D=typeof R;return R!=null&&(D=="object"||D=="function")}function Ze(R){return R!=null&&typeof R=="object"}var $r=A?function(R){return function(D){return R(D)}}(A):function(R){return Ze(R)&&$o(R.length)&&!!u[ne(R)]};function Me(R){return de(R)?gt(R):pr(R)}var Sn,ki=(Sn=function(R,D,Y){re(R,D,Y)},Ii(function(R,D){var Y=-1,Z=D.length,pt=Z>1?D[Z-1]:void 0,Yt=Z>2?D[2]:void 0;for(pt=Sn.length>3&&typeof pt=="function"?(Z--,pt):void 0,Yt&&function(we,Pe,zt){if(!Ie(zt))return!1;var he=typeof Pe;return!!(he=="number"?de(zt)&&Uo(Pe,zt.length):he=="string"&&Pe in zt)&&Wn(zt[Pe],we)}(D[0],D[1],Yt)&&(pt=Z<3?void 0:pt,Z=1),R=Object(R);++Y<Z;){var Dt=D[Y];Dt&&Sn(R,Dt,Y,pt)}return R}));function ie(R){return R}n.exports=ki})(Ip,Ip.exports);const DD=hO(Ip.exports);class kD{constructor(t,e,r,i){this.backendRestClient=new RD(t,e,r,i)}async getApp(t){return function(e){return{appMetadata:{...e.appMetadata,id:e.appMetadata.id},features:e.features,role:LD(e.configuration,e.features)}}(await this.backendRestClient.get("/app",{role_name:t}))}async checkIfAppExists(){return this.backendRestClient.get("/app").then(()=>!0).catch(t=>{if(t.message==="Could not find app.")return!1;throw t})}}function LD(n,t){const e={general:{enableFileTransfers:t.includes("file_sharing"),enableLocation:t.includes("location_sharing"),enableMentions:!1,showTypingIndicators:!0,enablePresence:!1,enableVoiceRecording:!1},theme:{version:"v2",name:"default"},permissions:{messages:{delete:"own",edit:"own",reply:"all",emojiReactions:"all"},messagesCustom:{},conversations:{leave:"none",markAsUnread:"none"},conversationsCustom:{}},generalNotificationSettings:{timeout:"15"},emailSettings:{enabled:!0,subject:"{{sender.name}} wants to chat with you on {{app.name}}",replySeparator:"--- Write ABOVE THIS LINE to post a reply via email ---",unsubscribeText:"Unsubscribe from all chat emails",senderName:"{{sender.name}} (via {{app.name}})",header:`Hi {{recipient.name}},
1322
1322
  {{sender.name}} wants to chat with you on {{app.name}}:`,includeMessages:!0,inboxUrl:"{{app.custom.websiteUrl}}",inboxLinkText:"Join the chat",footer:`On behalf of {{sender.name}},
1323
1323
  The {{app.name}} team`,enableReplyToEmail:t.includes("reply_via_email"),emailThemeType:t.includes("email_templates")?"custom":"standard",emailTheme:"default_email",emailAttachmentMode:"enabledExcludingImages",htmlTemplate:`<div>
1324
1324
  Hi {{recipient.name}}, <br/>
@@ -1342,11 +1342,11 @@ var TalkChatbox=function(zo){"use strict";"use client";var Fp=function(n,t,e,r){
1342
1342
  {{app.custom.websiteUrl}} Join the chat
1343
1343
 
1344
1344
  On behalf of {{sender.name}},
1345
- The {{app.name}} team`},smsSettings:{enabled:t.includes("sms_notifications"),smsTemplate:'({{app.name}}) {{sender.name}}: "{{messages}}". Reply here: {{app.custom.websiteUrl}}',maximumSegments:"1",enableAutoOptOutText:!1,optOutText:"To stop receiving these messages, reply STOP."},suppressContactInfo:{mode:"off",suppressLinks:!0,suppressEmailAddresses:!0,suppressPhoneNumbers:!0},sameTabLinkRules:[]};return DD(e,n)}class Bo{constructor(t,e,r){this.realtimeWsApiUrl=t,this.internalHttpApiUrl=e,this.restApiHttpUrl=r}getBokensUrl(t,e,r){return this.internalHttpApiUrl+`/${t}/bokens/${encodeURIComponent(e)}?signature=${encodeURIComponent(r!=null?r:"")}`}getRealtimeWsUrl(t,e,r,i,o){const s=encodeURIComponent(e);return this.realtimeWsApiUrl+`/${t}/realtime/${s}?talkjs-client-build=${o!=null?o:"standalone"}&talkjs-core=${r}&talkjs-client-id=${i}`}static fromHost(t){var r;const e=new Bo("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!t)return e;if(t==="@currentHost"){if(typeof location=="undefined")throw new Error("You can only use @currentHost in a browser.");t=((r=window.top)!=null?r:window).location.host}if(t.endsWith("talkjs.com")){const i=t.match(/\w+-(\w+)\.talkjs\.com/);if(i){const o=i[1];return new Bo(`wss://realtime-${o}.talkjs.com/v1`,`https://app-${o}.talkjs.com/api/v0`,`https://api-${o}.talkjs.com/v1`)}return e}return t.includes("localhost")||t.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(t)?new Bo(`ws://${t}/public_api/v1`,`http://${t}/api/v0`,`http://${t}/public_api/v1`):new Bo(`wss://${t}/public_api/v1`,`https://${t}/api/v0`,`https://${t}/public_api/v1`)}}function IT(n,t){const e=t.appId,r=t.userId,i="conversationId"in t?t.conversationId:void 0,o=lt(()=>Bo.fromHost(t.host),[t.host]);he(()=>{n.updateThemeCustom(t.themeCustom)},[n,t.themeCustom]);const s=lt(()=>by(),[t.appId,t.userId,t.token,t.tokenFetcher]),a=function(u){return u.forceCreateNew?new ST(u):OT.getOrCreate(u)}({apiUrls:o,appId:e,userId:r,token:t.token,tokenFetcher:t.tokenFetcher});J(()=>n.listenForErrors(a,i),[a,n,i]);const l=lt(()=>new kD(o,e,s,a._authProvider),[e,s,a,o]);return J(()=>n.listenForAuthChanges(a,t.tokenFetcher),[a,n,t.tokenFetcher]),J(()=>n.listenForUserAndAppChanges(a,l),[n,l,a]),{session:a,restApi:l}}function _u(n,t,e){return rt(r=>{n&&n(r),(t==null?void 0:t.tagName)!=="T-CHATBOX"&&(t==null?void 0:t.tagName)!=="T-CONVERSATION-LIST"||function(i,o,s){for(const a of s){const l=new Event(a);Object.assign(l,o),i.dispatchEvent(l)}}(t,r,e)},[n,t,e])}function wT(n){J(()=>{if(window.cordova){const t=n.current;St.defined(t);const e=r=>{r.target instanceof HTMLAnchorElement&&(r.preventDefault(),function(i){const o=window;o.cordova.InAppBrowser?o.cordova.InAppBrowser.open(i,"_system"):window.open(i,"_system","location=yes")}(r.target.href))};return t.addEventListener("click",e),()=>t.removeEventListener("click",e)}},[n])}function RT(n,t,e){return n.clearRect(0,0,100,100),n.fillStyle=e,n.fillText(t,0,0),n.getImageData(0,0,1,1).data.join(",")}function DT(n){const t=function(){const i=document.createElement("canvas");i.width=i.height=1;const o=i.getContext("2d",{willReadFrequently:!0});return o.textBaseline="top",o.font='100px "Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',o.scale(.01,.01),o}(),e=RT(t,n,"#fff"),r=RT(t,n,"#000");return r===e&&!r.startsWith("0,0,0,")}function kT(){const[n,t]=et(!0);return J(()=>{t(!1)},[]),n}(function(n="Twemoji Country Flags",t="https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2"){if(typeof window<"u"&&DT("😊")&&!DT("🇨🇭")){const e=document.createElement("style");return e.textContent=`@font-face {
1345
+ The {{app.name}} team`},smsSettings:{enabled:t.includes("sms_notifications"),smsTemplate:'({{app.name}}) {{sender.name}}: "{{messages}}". Reply here: {{app.custom.websiteUrl}}',maximumSegments:"1",enableAutoOptOutText:!1,optOutText:"To stop receiving these messages, reply STOP."},suppressContactInfo:{mode:"off",suppressLinks:!0,suppressEmailAddresses:!0,suppressPhoneNumbers:!0},sameTabLinkRules:[]};return DD(e,n)}class Fo{constructor(t,e,r){this.realtimeWsApiUrl=t,this.internalHttpApiUrl=e,this.restApiHttpUrl=r}getBokensUrl(t,e,r){return this.internalHttpApiUrl+`/${t}/bokens/${encodeURIComponent(e)}?signature=${encodeURIComponent(r!=null?r:"")}`}getRealtimeWsUrl(t,e,r,i,o){const s=encodeURIComponent(e);return this.realtimeWsApiUrl+`/${t}/realtime/${s}?talkjs-client-build=${o!=null?o:"standalone"}&talkjs-core=${r}&talkjs-client-id=${i}`}static fromHost(t){var r;const e=new Fo("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!t)return e;if(t==="@currentHost"){if(typeof location=="undefined")throw new Error("You can only use @currentHost in a browser.");t=((r=window.top)!=null?r:window).location.host}if(t.endsWith("talkjs.com")){const i=t.match(/\w+-(\w+)\.talkjs\.com/);if(i){const o=i[1];return new Fo(`wss://realtime-${o}.talkjs.com/v1`,`https://app-${o}.talkjs.com/api/v0`,`https://api-${o}.talkjs.com/v1`)}return e}return t.includes("localhost")||t.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(t)?new Fo(`ws://${t}/public_api/v1`,`http://${t}/api/v0`,`http://${t}/public_api/v1`):new Fo(`wss://${t}/public_api/v1`,`https://${t}/api/v0`,`https://${t}/public_api/v1`)}}function IT(n,t){const e=t.appId,r=t.userId,i="conversationId"in t?t.conversationId:void 0,o=at(()=>Fo.fromHost(t.host),[t.host]),s=X(void 0),a=at(()=>{const d=s.current,h=typeof d!=typeof t.tokenFetcher?t.tokenFetcher:d;return s.current=h,h},[t.tokenFetcher]);se(()=>{n.updateThemeCustom(t.themeCustom)},[n,t.themeCustom]);const l=at(()=>by(),[t.appId,t.userId,t.token,a]),u=function(d){return d.forceCreateNew?new ST(d):OT.getOrCreate(d)}({apiUrls:o,appId:e,userId:r,token:t.token,tokenFetcher:a});J(()=>n.listenForErrors(u,i),[u,n,i]);const c=at(()=>new kD(o,e,l,u._authProvider),[e,l,u,o]);return J(()=>n.listenForAuthChanges(u,a),[u,n,a]),J(()=>n.listenForUserAndAppChanges(u,c),[n,c,u]),{session:u,restApi:c}}function _u(n,t,e){const r=X(n),i=X(e);return se(()=>{r.current=n,i.current=e}),rt(o=>{r.current&&r.current(o),(t==null?void 0:t.tagName)!=="T-CHATBOX"&&(t==null?void 0:t.tagName)!=="T-CONVERSATION-LIST"||function(s,a,l){for(const u of l){const c=new Event(u);Object.assign(c,a),s.dispatchEvent(c)}}(t,o,i.current)},[t])}function wT(n){J(()=>{if(window.cordova){const t=n.current;St.defined(t);const e=r=>{r.target instanceof HTMLAnchorElement&&(r.preventDefault(),function(i){const o=window;o.cordova.InAppBrowser?o.cordova.InAppBrowser.open(i,"_system"):window.open(i,"_system","location=yes")}(r.target.href))};return t.addEventListener("click",e),()=>t.removeEventListener("click",e)}},[n])}function RT(n,t,e){return n.clearRect(0,0,100,100),n.fillStyle=e,n.fillText(t,0,0),n.getImageData(0,0,1,1).data.join(",")}function DT(n){const t=function(){const i=document.createElement("canvas");i.width=i.height=1;const o=i.getContext("2d",{willReadFrequently:!0});return o.textBaseline="top",o.font='100px "Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',o.scale(.01,.01),o}(),e=RT(t,n,"#fff"),r=RT(t,n,"#000");return r===e&&!r.startsWith("0,0,0,")}function kT(){const[n,t]=nt(!0);return J(()=>{t(!1)},[]),n}(function(n="Twemoji Country Flags",t="https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2"){if(typeof window<"u"&&DT("😊")&&!DT("🇨🇭")){const e=document.createElement("style");return e.textContent=`@font-face {
1346
1346
  font-family: "${n}";
1347
1347
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
1348
1348
  U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
1349
1349
  src: url('${t}') format('woff2');
1350
1350
  font-display: swap;
1351
- }`,document.head.appendChild(e),!0}})(),$d(),function({observableFunctions:n,observableProperties:t,jsonReplacer:e,jsonReviver:r}){if(n)for(const i in n){const o=n[i];Ra.set(i,o),Gr.prototype[i]=function(...s){return o.call(this,this._node,...s)}}if(t)for(const i in t){const o=t[i];hc.set(i,o),Object.defineProperty(Gr.prototype,i,{configurable:!0,get(){return o.get.call(this,this._node)},set(s){return o.set.call(this,this._node,s)}})}e&&(It.replacer=e),r&&(It.reviver=r)}({observableFunctions:{child:(n,t)=>(St(typeof t=="string"||typeof t=="number","Key should be a string or a number"),wm.getProxy(n,t.toString()))}}),Jn.registerHandler(({level:n,data:t})=>{console[n]("[TalkJS]",...t)});const xD=tt(function(n,t){var O,T;const{onSendMessage:e,onDeleteMessage:r,beforeBrowserPermissionPrompt:i,onMissingBrowserPermission:o,messageFieldPlaceholder:s,messageFieldSpellcheck:a,__hostElement:l}=n;J(()=>{var S;(S=n.__internalOnLoaded)==null||S.call(n)},[]);const u=kT(),c=q(null);wT(c);const d=_u(r,l,["deleteMessage","delete-message","deletemessage","DeleteMessage"]),h=_u(e,l,["sendMessage","send-message","sendmessage","SendMessage"]),p={beforeBrowserPermissionPrompt:i,onMissingBrowserPermissionCallback:_u(o,l,["browserPermissionDenied","browser-permission-denied","browserpermissiondenied","BrowserPermissionDenied"])},{store:f,controller:m,editorInternals:g,session:E}=function(S,N,y){const I=S.appId,R=S.userId,b=S.conversationId,L=lt(()=>new zm,[S.appId]),{session:k,restApi:B}=IT(L,S),j=lt(()=>new yy(L.state$.editor,L.device$,L.state$.userPermissions),[L]),$=lt(()=>new rR(L,k,j,N,y),[k,L,j,N,y]);return j.controller=$,J(()=>{let W,x=!0;L.resetState(I,R,b);const Q=k.currentUser.subscribe(async V=>{if(x&&(L.errors$.unknownUser.set(!V),V&&(L.currentUser$.set(V),V.role!==W))){W=V.role;const it=await B.getApp(V.role);if(!x)return;L.app$.set(it)}}),H=k.conversation(b).subscribeMessages(async(V,it)=>{x&&V&&(await L.readyForNewMessagesPromise,L.storeMessages(b,V,it))});L.messageSubscription=H;const nt=k.conversation(b).subscribeParticipants(V=>{x&&V&&L.state$.participants.child(b).set(V)});L.participantSubscription=nt;const ot=k.conversation(b).subscribe(async V=>{x&&V&&L.state$.currentConversation.set(V)}),P=k.conversation(b).subscribeTyping(V=>{x&&V&&L.storeTyping(b,V)});return()=>{x=!1,Q.unsubscribe(),nt.unsubscribe(),ot.unsubscribe(),H.unsubscribe(),P.unsubscribe(),L.messageSubscription=null}},[b,R,I,B,k,L,$]),J(()=>{const W=L.state$.participants.child(b).onChange(({value:x})=>{if(!x)return;const Q=new Set;for(const H of x)Q.add(H.user.id);ls(()=>{var H;for(const nt of NT(L.onlineSubscriptions))Q.has(nt)||((H=L.onlineSubscriptions[nt])==null||H.unsubscribe(),delete L.onlineSubscriptions[nt],L.state$.isUserConnected.child(nt).set(!1))});for(const H of Q)L.onlineSubscriptions[H]||(L.onlineSubscriptions[H]=k.user(H).subscribeOnline(nt=>{nt&&L.state$.isUserConnected.child(H).set(nt.isConnected)}))},{initial:!0});return()=>{W();for(const x of NT(L.onlineSubscriptions))L.onlineSubscriptions[x].unsubscribe();L.onlineSubscriptions={},L.state$.isUserConnected.set({})}},[L,b,k]),{store:L,controller:$,editorInternals:j,session:k}}(n,h,d),A=rt(async()=>{const S=g.state$;if(S.isEmpty.peek()||S.atTextLimit.peek())return;const N=g.getText(),y=f.state$.referencedMessageId.peek();y&&m.setReferencedMessage(null),g.clearText(),f.state$.editor.showEmojiPicker.set(!1),await m.sendMessage({text:N,referencedMessage:y!=null?y:void 0})},[m,g,f]);J(()=>{var N;const S=(N=n.enterSendsMessage)!=null?N:!0;g.onEnter=S?A:void 0},[g,n.enterSendsMessage,A]),J(()=>{g.spellcheck$.set(a)},[g,a]),J(()=>{g.placeholder$.set(s)},[g,s]),qo(t,()=>({deleteMessage:S=>m.deleteMessage(S),setEditing:S=>m.setEditing(S),editMessage:(S,N)=>m.editMessage(S,N),sendMessage:S=>m.sendMessage(S),sendFileMessage:S=>m.sendFileMessage(S),sendLocationMessage:S=>m.sendLocationMessage(S),setReferencedMessage:S=>m.setReferencedMessage(S),getMessageFieldText:()=>g.getText(),setMessageFieldText:S=>g.setText(S)}));const v=rt(({error:S})=>C(ru,{appId:n.appId,chatboxState:{type:"unexpected-error",error:S}}),[n.appId]),_="t-chatbox"+(n.className?` ${n.className}`:"");return C("div",u?{className:_,style:n.style,ref:c}:{className:_,style:n.style,ref:c,children:C(Ay,{fallbackRender:v,children:C(Xf.Provider,{value:g,children:C(ec.Provider,{value:f,children:C(Gf.Provider,{value:n.theme,children:C(Kf.Provider,{value:p,children:C(nc.Provider,{value:m,children:C(qf.Provider,{value:E,children:C(CO.Provider,{value:{sendMessage:A},children:C(eR,{appId:n.appId,chatHeaderVisible:(O=n.chatHeaderVisible)!=null?O:!0,messageFieldVisible:(T=n.messageFieldVisible)!=null?T:!0})})})})})})})})})})});function MD({conversation:n}){const t=bt(),e=ts(),r=cn(),i=Pm(),o=Et(t.extCurrentConversationId$),[s,a]=et([]);return J(()=>{const l=e.conversation(n.id).subscribeParticipants(async u=>{u&&a(u)});return()=>l.unsubscribe()},[e,n.id]),s?C(r.ConversationListItem,{common:i,conversation:n,participants:s,isSelected:o===n.id}):null}function PD(){const n=bt(),t=q(null);J(()=>{let r=!0;const i=t.current;return async function(){var s;let o=0;for(;r&&n.conversationListSubscription&&i.scrollHeight===i.clientHeight&&o<2;)await((s=n.conversationListSubscription)==null?void 0:s.loadMore(20)),o+=1}(),()=>{r=!1}},[n]);const e=rt(r=>{const i=r.currentTarget;i.scrollHeight-i.clientHeight-i.scrollTop<15&&n.conversationListSubscription&&n.conversationListSubscription.loadMore(20)},[n]);return C("div",{className:"t-conversation-list-scrollable",ref:t,"t-menu-boundary":"",onScroll:e,children:C(Ac,{each:n.conversationsArray$,children:r=>C(MD,{conversation:r.get()})})})}function BD({appId:n}){bt();const t=function(){const e=bt(),r=Er(()=>{const s=e.currentUser$.get(),a=e.app$.get(),l=e.errors$.get(),u=e.authTokenState$.get();return l.serverError?"server-error":l.wrongAppId?"wrong-app-id":u==="loading"||u==="idle"?"loading-token":u==="invalid"?"invalid-token":u==="expired"?"expired-token":u==="valid"?l.unknownUser?"unknown-user":s&&a?"loaded":"loading-data":void St.unreachable()}),i=Er({type:"loading"});Zi(s=>{const a=r.get(),l=e.extUserId$.peek(),u=e.appId$.peek();switch(a){case"invalid-token":i.set({type:"auth-failed"});break;case"expired-token":i.set({type:"expired-token"});break;case"wrong-app-id":i.set({type:"wrong-app-id",appId:u});break;case"server-error":i.set({type:"server-error"});break;case"loading-data":case"loading-token":i.set({type:"loading"});break;case"loaded":i.set({type:"loaded",currentUser:e.currentUser$.peek()});break;case"unknown-user":s.onCleanup=function(c){i.set({type:"loading"});const d=setTimeout(()=>{i.set(c)},5e3);return()=>clearTimeout(d)}({type:"unknown-user",userId:l});break;default:St.never(a)}});const o=Er({type:"loading"});return Zi(s=>{if(i.type.get()==="loading"){o.set({type:"invisible-loading"});const a=setTimeout(()=>{o.set({type:"loading"})},1e3);s.onCleanup=()=>{clearTimeout(a)}}else o.set(i.get())}),Et(o)}();return t.type==="invisible-loading"?C(Vt,{}):t.type==="loading"?C(Oy,{}):t.type==="unknown-user"||t.type==="auth-failed"||t.type==="wrong-app-id"||t.type==="server-error"||t.type==="unexpected-error"?C(ru,{appId:n,chatboxState:t}):t.type=="expired-token"?C(Sy,{}):t.type==="loaded"?C(PD,{}):C(Vt,{})}class FD{constructor(t,e){this.store=t,this.onSelectConversation=e}selectConversation(t){if(t===this.store.extCurrentConversationId$.peek())return;this.store.extCurrentConversationId$.set(t);const e={currentUser:this.store.currentUser$.peek(),conversation:this.store.conversationsMap$.child(t).peek()};this.onSelectConversation(e)}}const UD=tt(function(n,t){J(()=>{var c;(c=n.__internalOnLoaded)==null||c.call(n)},[]);const e=kT(),r=q(null);wT(r);const i=_u(n.onSelectConversation,n.__hostElement,["selectConversation","select-conversation","selectconversation","SelectConversation"]),o=lt(()=>new K0,[n.appId]),{session:s}=IT(o,n);J(()=>{o.resetState(n.appId,n.userId)},[o,n.appId,n.userId]);const a=lt(()=>new FD(o,i),[o,i]);J(()=>o.listenForConversations(s),[o,s]),J(()=>{n.selectedConversationId!==void 0&&o.extCurrentConversationId$.set(n.selectedConversationId)},[o,n.selectedConversationId]),qo(t,()=>({selectConversation:c=>a.selectConversation(c)}));const l=rt(({error:c})=>C(ru,{appId:n.appId,chatboxState:{type:"unexpected-error",error:c}}),[n.appId]),u="t-conversation-list"+(n.className?` ${n.className}`:"");return C("div",e?{className:u,style:n.style,ref:r}:{className:u,style:n.style,ref:r,children:C(Ay,{fallbackRender:l,children:C(ec.Provider,{value:o,children:C(Gf.Provider,{value:n.theme,children:C(nc.Provider,{value:a,children:C(qf.Provider,{value:s,children:C(BD,{appId:n.appId})})})})})})})}),HD=new Promise(n=>{typeof document!="undefined"&&document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n,{once:!0}):n(void 0)});function LT(n,t,e,r){const i=new Map,o=[],s=[];for(const[d,h]of(a=e,Object.entries(a))){const p=[d,d.toLowerCase(),$D(d)];for(const f of p)i.set(f,d);["string","boolean","number"].includes(h.type)&&o.push(...p),h.required!==!1&&s.push(d)}var a;const c=class c extends HTMLElement{constructor(){super(),this._renderRequested=!1,this._props={},this._renderRoot=null,this._ref={current:null};for(const[h,p]of i){if(Object.hasOwnProperty.call(this,h)){const f=this[h];this.updateProp(p,f),delete this[h]}this.hasAttribute(h)&&this.syncAttributeToProp(h)}}updateProp(h,p){const{type:f}=e[h];if(f==="boolean"&&typeof p=="string"?p=p!=="false":f==="number"&&typeof p=="string"&&(p=Number(p)),p==null){const m=h in this._props;return delete this._props[h],m}{const m=this._props[h]!==p;return this._props[h]=p,m}}syncAttributeToProp(h){const p=i.get(h);St(p,`Attribute "${h}" should have matching prop`);const f=this.getAttribute(h);return this.updateProp(p,f)}async requestRender(){this._renderRequested||(this._renderRequested=!0,this._renderRequested=await!1,this.render())}render(){var h;this._renderRoot||(this._renderRoot=(h=this,{render:function(E){Gu(E,h)},unmount:function(){Ku(h)}}));const p=s.filter(E=>!(E in this._props));if(p.length>0)return r(p),void this._renderRoot.render(null);const f=Object.assign({},this._props),m=E=>{for(const[A,v]of Object.entries(E.current))typeof v=="function"&&(this[A]=(..._)=>E.current[A](..._))},g=n;this._renderRoot.render(C(g,{...f,ref:this._ref,__hostElement:this,__internalOnLoaded:()=>{m(this._ref)}}))}async connectedCallback(){await HD;for(const h of o)this.hasAttribute(h)&&this.syncAttributeToProp(h);this.requestRender()}disconnectedCallback(){this._renderRoot&&setTimeout(()=>{this._renderRoot&&(this._renderRoot.unmount(),this._renderRoot=null)})}attributeChangedCallback(h,p,f){p!==f&&this.syncAttributeToProp(h)&&this.requestRender()}};c.observedAttributes=o;let l=c;const u={};for(const[d,h]of i)u[d]={set(p){this.updateProp(h,p)&&this.requestRender()},get(){var p;return(p=this._props[h])!=null?p:null}};return Object.defineProperties(l.prototype,u),Object.defineProperty(l,"name",{value:t}),l}function $D(n){return n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,e)=>(e?"-":"")+t.toLowerCase())}function xT(n,t){const e=JSON.stringify(t).replace(",",", ");Jn.error(`Could not initialize ${n} because the following required props are missing: ${e}.`)}const MT=LT(function(n){return tt(function(t,e){var r;return C(xD,{...t,theme:(r=t.theme)!=null?r:n,ref:e})})}(Zh),"ChatboxHTMLElement",{__internalOnLoaded:{type:"function",required:!1},appId:{type:"string"},userId:{type:"string"},conversationId:{type:"string"},theme:{type:"object",required:!1},token:{type:"string",required:!1},tokenFetcher:{type:"function",required:!1},host:{type:"string",required:!1},enterSendsMessage:{type:"boolean",required:!1},chatHeaderVisible:{type:"boolean",required:!1},messageFieldVisible:{type:"boolean",required:!1},messageFieldSpellcheck:{type:"boolean",required:!1},messageFieldPlaceholder:{type:"string",required:!1},onSendMessage:{type:"function",required:!1},onDeleteMessage:{type:"function",required:!1},beforeBrowserPermissionPrompt:{type:"function",required:!1},onMissingBrowserPermission:{type:"function",required:!1},themeCustom:{type:"object",required:!1}},n=>xT("<t-chatbox>",n)),PT=function(n){const t=function(e){return tt(function(r,i){var o;return C(UD,{...r,theme:(o=r.theme)!=null?o:e,ref:i})})}(n);return LT(t,"ConversationListHTMLElement",{__internalOnLoaded:{type:"function",required:!1},appId:{type:"string"},userId:{type:"string"},selectedConversationId:{type:"string",required:!1},theme:{type:"object",required:!1},token:{type:"string",required:!1},tokenFetcher:{type:"function",required:!1},host:{type:"string",required:!1},themeCustom:{type:"object",required:!1}},e=>xT("<t-conversation-list>",e))}(Zh),jD=Zh;return customElements.get("t-chatbox")||customElements.define("t-chatbox",MT),customElements.get("t-conversation-list")||customElements.define("t-conversation-list",PT),zo.ChatboxHTMLElement=MT,zo.ConversationListHTMLElement=PT,zo.defaultTheme=jD,Object.defineProperty(zo,Symbol.toStringTag,{value:"Module"}),zo}({});
1351
+ }`,document.head.appendChild(e),!0}})(),$d(),function({observableFunctions:n,observableProperties:t,jsonReplacer:e,jsonReviver:r}){if(n)for(const i in n){const o=n[i];Ra.set(i,o),Gr.prototype[i]=function(...s){return o.call(this,this._node,...s)}}if(t)for(const i in t){const o=t[i];hc.set(i,o),Object.defineProperty(Gr.prototype,i,{configurable:!0,get(){return o.get.call(this,this._node)},set(s){return o.set.call(this,this._node,s)}})}e&&(It.replacer=e),r&&(It.reviver=r)}({observableFunctions:{child:(n,t)=>(St(typeof t=="string"||typeof t=="number","Key should be a string or a number"),wm.getProxy(n,t.toString()))}}),Jn.registerHandler(({level:n,data:t})=>{console[n]("[TalkJS]",...t)});const xD=et(function(n,t){var O,T;const{onSendMessage:e,onDeleteMessage:r,beforeBrowserPermissionPrompt:i,onMissingBrowserPermission:o,messageFieldPlaceholder:s,messageFieldSpellcheck:a,__hostElement:l}=n;J(()=>{var S;(S=n.__internalOnLoaded)==null||S.call(n)},[]);const u=kT(),c=X(null);wT(c);const d=_u(r,l,["deleteMessage","delete-message","deletemessage","DeleteMessage"]),h=_u(e,l,["sendMessage","send-message","sendmessage","SendMessage"]),p={beforeBrowserPermissionPrompt:i,onMissingBrowserPermissionCallback:_u(o,l,["browserPermissionDenied","browser-permission-denied","browserpermissiondenied","BrowserPermissionDenied"])},{store:f,controller:m,editorInternals:g,session:E}=function(S,N,y){const w=S.conversationId,b=at(()=>new zm(S.appId,S.userId),[]),{session:I,restApi:P}=IT(b,S),k=at(()=>new yy(b.state$.editor,b.device$,b.state$.userPermissions),[b]),B=at(()=>new rR(b,I,k,N,y),[I,b,k,N,y]);return k.controller=B,J(()=>{let $,U=!0;const V=I.currentUser.subscribe(async L=>{if(U&&(b.errors$.unknownUser.set(!L),L&&(b.currentUser$.set(L),L.role!==$))){$=L.role;const Q=await P.getApp(L.role);if(!U)return;b.app$.set(Q)}});return()=>{U=!1,V.unsubscribe()}},[P,I,b]),J(()=>{let $=!0;Vi(()=>{b.state$.extCurrentConversationId.set(w),b.state$.currentConversation.set(null),b.state$.referencedMessageId.set(null)});const U=I.conversation(w).subscribeMessages(async(tt,it)=>{$&&tt&&(await b.readyForNewMessagesPromise,b.storeMessages(w,tt,it))});b.messageSubscription=U;const V=I.conversation(w).subscribeParticipants(tt=>{$&&tt&&b.state$.participants.child(w).set(tt)});b.participantSubscription=V;const L=I.conversation(w).subscribe(async tt=>{$&&tt&&b.state$.currentConversation.set(tt)}),Q=I.conversation(w).subscribeTyping(tt=>{$&&tt&&b.storeTyping(w,tt)}),j=b.state$.participants.child(w).onChange(({value:tt})=>{if(!tt)return;const it=new Set;for(const x of tt)it.add(x.user.id);Vi(()=>{var x;for(const q of NT(b.onlineSubscriptions))it.has(q)||((x=b.onlineSubscriptions[q])==null||x.unsubscribe(),delete b.onlineSubscriptions[q],b.state$.isUserConnected.child(q).set(!1))});for(const x of it)b.onlineSubscriptions[x]||(b.onlineSubscriptions[x]=I.user(x).subscribeOnline(q=>{q&&b.state$.isUserConnected.child(x).set(q.isConnected)}))},{initial:!0});return()=>{$=!1,V.unsubscribe(),L.unsubscribe(),U.unsubscribe(),Q.unsubscribe(),b.messageSubscription=null,b.participantSubscription=null,j();for(const tt of NT(b.onlineSubscriptions))b.onlineSubscriptions[tt].unsubscribe();b.onlineSubscriptions={},b.state$.isUserConnected.set({})}},[b,w,I]),{store:b,controller:B,editorInternals:k,session:I}}(n,h,d),A=rt(async()=>{const S=g.state$;if(S.isEmpty.peek()||S.atTextLimit.peek())return;const N=g.getText(),y=f.state$.referencedMessageId.peek();y&&m.setReferencedMessage(null),g.clearText(),f.state$.editor.showEmojiPicker.set(!1),await m.sendMessage({text:N,referencedMessage:y!=null?y:void 0})},[m,g,f]);J(()=>{var N;const S=(N=n.enterSendsMessage)!=null?N:!0;g.onEnter=S?A:void 0},[g,n.enterSendsMessage,A]),J(()=>{g.spellcheck$.set(a)},[g,a]),J(()=>{g.placeholder$.set(s)},[g,s]),Jo(t,()=>({deleteMessage:S=>m.deleteMessage(S),setEditing:S=>m.setEditing(S),editMessage:(S,N)=>m.editMessage(S,N),sendMessage:S=>m.sendMessage(S),sendFileMessage:S=>m.sendFileMessage(S),sendLocationMessage:S=>m.sendLocationMessage(S),setReferencedMessage:S=>m.setReferencedMessage(S),getMessageFieldText:()=>g.getText(),setMessageFieldText:S=>g.setText(S)}));const v=rt(({error:S})=>C(ru,{appId:n.appId,chatboxState:{type:"unexpected-error",error:S}}),[n.appId]),_="t-chatbox"+(n.className?` ${n.className}`:"");return C("div",u?{className:_,style:n.style,ref:c}:{className:_,style:n.style,ref:c,children:C(Ay,{fallbackRender:v,children:C(Xf.Provider,{value:g,children:C(ec.Provider,{value:f,children:C(Gf.Provider,{value:n.theme,children:C(Kf.Provider,{value:p,children:C(nc.Provider,{value:m,children:C(qf.Provider,{value:E,children:C(CO.Provider,{value:{sendMessage:A},children:C(eR,{appId:n.appId,chatHeaderVisible:(O=n.chatHeaderVisible)!=null?O:!0,messageFieldVisible:(T=n.messageFieldVisible)!=null?T:!0})})})})})})})})})})});function MD({conversation:n}){const t=bt(),e=es(),r=cn(),i=Pm(),o=Et(t.extCurrentConversationId$),[s,a]=nt([]);return J(()=>{const l=e.conversation(n.id).subscribeParticipants(async u=>{u&&a(u)});return()=>l.unsubscribe()},[e,n.id]),s?C(r.ConversationListItem,{common:i,conversation:n,participants:s,isSelected:o===n.id}):null}function PD(){const n=bt(),t=X(null);J(()=>{let r=!0;const i=t.current;return async function(){var s;let o=0;for(;r&&n.conversationListSubscription&&i.scrollHeight===i.clientHeight&&o<2;)await((s=n.conversationListSubscription)==null?void 0:s.loadMore(20)),o+=1}(),()=>{r=!1}},[n]);const e=rt(r=>{const i=r.currentTarget;i.scrollHeight-i.clientHeight-i.scrollTop<15&&n.conversationListSubscription&&n.conversationListSubscription.loadMore(20)},[n]);return C("div",{className:"t-conversation-list-scrollable",ref:t,"t-menu-boundary":"",onScroll:e,children:C(Ac,{each:n.conversationsArray$,children:r=>C(MD,{conversation:r.get()})})})}function BD({appId:n}){bt();const t=function(){const e=bt(),r=Er(()=>{const s=e.currentUser$.get(),a=e.app$.get(),l=e.errors$.get(),u=e.authTokenState$.get();return l.serverError?"server-error":l.wrongAppId?"wrong-app-id":u==="loading"||u==="idle"?"loading-token":u==="invalid"?"invalid-token":u==="expired"?"expired-token":u==="valid"?l.unknownUser?"unknown-user":s&&a?"loaded":"loading-data":void St.unreachable()}),i=Er({type:"loading"});Qi(s=>{const a=r.get(),l=e.extUserId$.peek(),u=e.appId$.peek();switch(a){case"invalid-token":i.set({type:"auth-failed"});break;case"expired-token":i.set({type:"expired-token"});break;case"wrong-app-id":i.set({type:"wrong-app-id",appId:u});break;case"server-error":i.set({type:"server-error"});break;case"loading-data":case"loading-token":i.set({type:"loading"});break;case"loaded":i.set({type:"loaded",currentUser:e.currentUser$.peek()});break;case"unknown-user":s.onCleanup=function(c){i.set({type:"loading"});const d=setTimeout(()=>{i.set(c)},5e3);return()=>clearTimeout(d)}({type:"unknown-user",userId:l});break;default:St.never(a)}});const o=Er({type:"loading"});return Qi(s=>{if(i.type.get()==="loading"){o.set({type:"invisible-loading"});const a=setTimeout(()=>{o.set({type:"loading"})},1e3);s.onCleanup=()=>{clearTimeout(a)}}else o.set(i.get())}),Et(o)}();return t.type==="invisible-loading"?C(Vt,{}):t.type==="loading"?C(Oy,{}):t.type==="unknown-user"||t.type==="auth-failed"||t.type==="wrong-app-id"||t.type==="server-error"||t.type==="unexpected-error"?C(ru,{appId:n,chatboxState:t}):t.type=="expired-token"?C(Sy,{}):t.type==="loaded"?C(PD,{}):C(Vt,{})}class FD{constructor(t,e){this.store=t,this.onSelectConversation=e}selectConversation(t){if(t===this.store.extCurrentConversationId$.peek())return;this.store.extCurrentConversationId$.set(t);const e={currentUser:this.store.currentUser$.peek(),conversation:this.store.conversationsMap$.child(t).peek()};this.onSelectConversation(e)}}const UD=et(function(n,t){J(()=>{var c;(c=n.__internalOnLoaded)==null||c.call(n)},[]);const e=kT(),r=X(null);wT(r);const i=_u(n.onSelectConversation,n.__hostElement,["selectConversation","select-conversation","selectconversation","SelectConversation"]),o=at(()=>new K0(n.appId,n.userId),[]);J(()=>{Vi(()=>{o.extUserId$.set(n.userId),o.appId$.set(n.appId)})},[o,n.appId,n.userId]);const{session:s}=IT(o,n),a=at(()=>new FD(o,i),[o,i]);J(()=>o.listenForConversations(s),[o,s]),J(()=>{n.selectedConversationId!==void 0&&o.extCurrentConversationId$.set(n.selectedConversationId)},[o,n.selectedConversationId]),Jo(t,()=>({selectConversation:c=>a.selectConversation(c)}));const l=rt(({error:c})=>C(ru,{appId:n.appId,chatboxState:{type:"unexpected-error",error:c}}),[n.appId]),u="t-conversation-list"+(n.className?` ${n.className}`:"");return C("div",e?{className:u,style:n.style,ref:r}:{className:u,style:n.style,ref:r,children:C(Ay,{fallbackRender:l,children:C(ec.Provider,{value:o,children:C(Gf.Provider,{value:n.theme,children:C(nc.Provider,{value:a,children:C(qf.Provider,{value:s,children:C(BD,{appId:n.appId})})})})})})})}),HD=new Promise(n=>{typeof document!="undefined"&&document.readyState==="loading"?document.addEventListener("DOMContentLoaded",n,{once:!0}):n(void 0)});function LT(n,t,e,r){const i=new Map,o=[],s=[];for(const[d,h]of(a=e,Object.entries(a))){const p=[d,d.toLowerCase(),$D(d)];for(const f of p)i.set(f,d);["string","boolean","number"].includes(h.type)&&o.push(...p),h.required!==!1&&s.push(d)}var a;const c=class c extends HTMLElement{constructor(){super(),this._renderRequested=!1,this._props={},this._renderRoot=null,this._ref={current:null};for(const[h,p]of i){if(Object.hasOwnProperty.call(this,h)){const f=this[h];this.updateProp(p,f),delete this[h]}this.hasAttribute(h)&&this.syncAttributeToProp(h)}}updateProp(h,p){const{type:f}=e[h];if(f==="boolean"&&typeof p=="string"?p=p!=="false":f==="number"&&typeof p=="string"&&(p=Number(p)),p==null){const m=h in this._props;return delete this._props[h],m}{const m=this._props[h]!==p;return this._props[h]=p,m}}syncAttributeToProp(h){const p=i.get(h);St(p,`Attribute "${h}" should have matching prop`);const f=this.getAttribute(h);return this.updateProp(p,f)}async requestRender(){this._renderRequested||(this._renderRequested=!0,this._renderRequested=await!1,this.render())}render(){var h;this._renderRoot||(this._renderRoot=(h=this,{render:function(E){Gu(E,h)},unmount:function(){Ku(h)}}));const p=s.filter(E=>!(E in this._props));if(p.length>0)return r(p),void this._renderRoot.render(null);const f=Object.assign({},this._props),m=E=>{for(const[A,v]of Object.entries(E.current))typeof v=="function"&&(this[A]=(..._)=>E.current[A](..._))},g=n;this._renderRoot.render(C(g,{...f,ref:this._ref,__hostElement:this,__internalOnLoaded:()=>{m(this._ref)}}))}async connectedCallback(){await HD;for(const h of o)this.hasAttribute(h)&&this.syncAttributeToProp(h);this.requestRender()}disconnectedCallback(){this._renderRoot&&setTimeout(()=>{this._renderRoot&&(this._renderRoot.unmount(),this._renderRoot=null)})}attributeChangedCallback(h,p,f){p!==f&&this.syncAttributeToProp(h)&&this.requestRender()}};c.observedAttributes=o;let l=c;const u={};for(const[d,h]of i)u[d]={set(p){this.updateProp(h,p)&&this.requestRender()},get(){var p;return(p=this._props[h])!=null?p:null}};return Object.defineProperties(l.prototype,u),Object.defineProperty(l,"name",{value:t}),l}function $D(n){return n.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,e)=>(e?"-":"")+t.toLowerCase())}function xT(n,t){const e=JSON.stringify(t).replace(",",", ");Jn.error(`Could not initialize ${n} because the following required props are missing: ${e}.`)}const MT=function(n){const t=function(e){return et(function(r,i){var s,a;const o=`${(s=r.key)!=null?s:""}|${r.userId}|${r.appId}`;return ht(xD,{...r,key:o,theme:(a=r.theme)!=null?a:e,ref:i})})}(n);return LT(t,"ChatboxHTMLElement",{__internalOnLoaded:{type:"function",required:!1},appId:{type:"string"},userId:{type:"string"},conversationId:{type:"string"},theme:{type:"object",required:!1},token:{type:"string",required:!1},tokenFetcher:{type:"function",required:!1},host:{type:"string",required:!1},enterSendsMessage:{type:"boolean",required:!1},chatHeaderVisible:{type:"boolean",required:!1},messageFieldVisible:{type:"boolean",required:!1},messageFieldSpellcheck:{type:"boolean",required:!1},messageFieldPlaceholder:{type:"string",required:!1},onSendMessage:{type:"function",required:!1},onDeleteMessage:{type:"function",required:!1},beforeBrowserPermissionPrompt:{type:"function",required:!1},onMissingBrowserPermission:{type:"function",required:!1},themeCustom:{type:"object",required:!1}},e=>xT("<t-chatbox>",e))}(Zh),PT=function(n){const t=function(e){return et(function(r,i){var s,a;const o=`${(s=r.key)!=null?s:""}|${r.userId}|${r.appId}`;return ht(UD,{...r,key:o,theme:(a=r.theme)!=null?a:e,ref:i})})}(n);return LT(t,"ConversationListHTMLElement",{__internalOnLoaded:{type:"function",required:!1},appId:{type:"string"},userId:{type:"string"},selectedConversationId:{type:"string",required:!1},theme:{type:"object",required:!1},token:{type:"string",required:!1},tokenFetcher:{type:"function",required:!1},host:{type:"string",required:!1},themeCustom:{type:"object",required:!1}},e=>xT("<t-conversation-list>",e))}(Zh),jD=Zh;return customElements.get("t-chatbox")||customElements.define("t-chatbox",MT),customElements.get("t-conversation-list")||customElements.define("t-conversation-list",PT),Vo.ChatboxHTMLElement=MT,Vo.ConversationListHTMLElement=PT,Vo.defaultTheme=jD,Object.defineProperty(Vo,Symbol.toStringTag,{value:"Module"}),Vo}({});
1352
1352
  //# sourceMappingURL=default.standalone.js.map