@talkjs/web-components 0.0.10 → 0.0.12

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,7 +1,7 @@
1
- var TalkChatbox=function(e){"use strict";var t,n,r,i,s,o,a,u,l,c,h,d,p={},f=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,E=Array.isArray;function g(e,t){for(var n in t)e[n]=t[n];return e}function A(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function _(e,n,r){var i,s,o,a={};for(o in n)"key"==o?i=n[o]:"ref"==o?s=n[o]:a[o]=n[o];if(arguments.length>2&&(a.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)null==a[o]&&(a[o]=e.defaultProps[o]);return D(e,a,i,s,null)}function D(e,t,i,s,o){var a={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++r:o,__i:-1,__u:0};return null==o&&null!=n.vnode&&n.vnode(a),a}function v(){return{current:null}}function T(e){return e.children}function O(e,t){this.props=e,this.context=t}function S(e,t){if(null==t)return e.__?S(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?S(e):null}function C(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return C(e)}}function y(e){(!e.__d&&(e.__d=!0)&&i.push(e)&&!N.__r++||s!=n.debounceRendering)&&((s=n.debounceRendering)||o)(N)}function N(){for(var e,t,r,s,o,u,l,c=1;i.length;)i.length>c&&i.sort(a),e=i.shift(),c=i.length,e.__d&&(r=void 0,o=(s=(t=e).__v).__e,u=[],l=[],t.__P&&((r=g({},s)).__v=s.__v+1,n.vnode&&n.vnode(r),F(t.__P,r,s,t.__n,t.__P.namespaceURI,32&s.__u?[o]:null,u,null==o?S(s):o,!!(32&s.__u),l),r.__v=s.__v,r.__.__k[r.__i]=r,x(u,r,l),r.__e!=o&&C(r)));N.__r=0}function I(e,t,n,r,i,s,o,a,u,l,c){var h,d,m,g,A,_,v=r&&r.__k||f,O=t.length;for(u=function(e,t,n,r,i){var s,o,a,u,l,c=n.length,h=c,d=0;for(e.__k=new Array(i),s=0;s<i;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?(u=s+d,(o=e.__k[s]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?D(null,o,null,null,null):E(o)?D(T,{children:o},null,null,null):null==o.constructor&&o.__b>0?D(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,a=null,-1!=(l=o.__i=w(o,n,u,h))&&(h--,(a=n[l])&&(a.__u|=2)),null==a||null==a.__v?(-1==l&&(i>c?d--:i<c&&d++),"function"!=typeof o.type&&(o.__u|=4)):l!=u&&(l==u-1?d--:l==u+1?d++:(l>u?d--:d++,o.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<c;s++)null!=(a=n[s])&&!(2&a.__u)&&(a.__e==r&&(r=S(a)),U(a,a));return r}(n,t,v,u,O),h=0;h<O;h++)null!=(m=n.__k[h])&&(d=-1==m.__i?p:v[m.__i]||p,m.__i=h,_=F(e,m,d,i,s,o,a,u,l,c),g=m.__e,m.ref&&d.ref!=m.ref&&(d.ref&&P(d.ref,null,m),c.push(m.ref,m.__c||g,m)),null==A&&null!=g&&(A=g),4&m.__u||d.__k===m.__k?u=b(m,u,e):"function"==typeof m.type&&void 0!==_?u=_:g&&(u=g.nextSibling),m.__u&=-7);return n.__e=A,u}function b(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=b(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=S(e)),n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function R(e,t){return t=t||[],null==e||"boolean"==typeof e||(E(e)?e.some((function(e){R(e,t)})):t.push(e)),t}function w(e,t,n,r){var i,s,o=e.key,a=e.type,u=t[n];if(null===u&&null==e.key||u&&o==u.key&&a==u.type&&!(2&u.__u))return n;if(r>(null==u||2&u.__u?0:1))for(i=n-1,s=n+1;i>=0||s<t.length;){if(i>=0){if((u=t[i])&&!(2&u.__u)&&o==u.key&&a==u.type)return i;i--}if(s<t.length){if((u=t[s])&&!(2&u.__u)&&o==u.key&&a==u.type)return s;s++}}return-1}function k(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function L(e,t,n,r,i){var s,o;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||k(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||k(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(u,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=l,e.addEventListener(t,s?h:c,s)):e.removeEventListener(t,s?h:c,s);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function M(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=l++;else if(t.t<r.u)return;return r(n.event?n.event(t):t)}}}function F(e,r,i,s,o,a,u,l,c,h){var d,f,m,_,D,v,C,y,N,b,R,w,k,M,F,x,P,U=r.type;if(null!=r.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[l=r.__e=i.__e]),(d=n.__b)&&d(r);e:if("function"==typeof U)try{if(y=r.props,N="prototype"in U&&U.prototype.render,b=(d=U.contextType)&&s[d.__c],R=d?b?b.props.value:d.__:s,i.__c?C=(f=r.__c=i.__c).__=f.__E:(N?r.__c=f=new U(y,R):(r.__c=f=new O(y,R),f.constructor=U,f.render=H),b&&b.sub(f),f.props=y,f.state||(f.state={}),f.context=R,f.__n=s,m=f.__d=!0,f.__h=[],f._sb=[]),N&&null==f.__s&&(f.__s=f.state),N&&null!=U.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=g({},f.__s)),g(f.__s,U.getDerivedStateFromProps(y,f.__s))),_=f.props,D=f.state,f.__v=r,m)N&&null==U.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),N&&null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(N&&null==U.getDerivedStateFromProps&&y!==_&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(y,R),!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(y,f.__s,R)||r.__v==i.__v){for(r.__v!=i.__v&&(f.props=y,f.state=f.__s,f.__d=!1),r.__e=i.__e,r.__k=i.__k,r.__k.some((function(e){e&&(e.__=r)})),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[],f.__h.length&&u.push(f);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(y,f.__s,R),N&&null!=f.componentDidUpdate&&f.__h.push((function(){f.componentDidUpdate(_,D,v)}))}if(f.context=R,f.props=y,f.__P=e,f.__e=!1,k=n.__r,M=0,N){for(f.state=f.__s,f.__d=!1,k&&k(r),d=f.render(f.props,f.state,f.context),F=0;F<f._sb.length;F++)f.__h.push(f._sb[F]);f._sb=[]}else do{f.__d=!1,k&&k(r),d=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++M<25);f.state=f.__s,null!=f.getChildContext&&(s=g(g({},s),f.getChildContext())),N&&!m&&null!=f.getSnapshotBeforeUpdate&&(v=f.getSnapshotBeforeUpdate(_,D)),x=d,null!=d&&d.type===T&&null==d.key&&(x=B(d.props.children)),l=I(e,E(x)?x:[x],r,i,s,o,a,u,l,c,h),f.base=r.__e,r.__u&=-161,f.__h.length&&u.push(f),C&&(f.__E=f.__=null)}catch(e){if(r.__v=null,c||null!=a)if(e.then){for(r.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,r.__e=l}else for(P=a.length;P--;)A(a[P]);else r.__e=i.__e,r.__k=i.__k;n.__e(e,r,i)}else null==a&&r.__v==i.__v?(r.__k=i.__k,r.__e=i.__e):l=r.__e=function(e,r,i,s,o,a,u,l,c){var h,d,f,m,g,_,D,v=i.props,T=r.props,O=r.type;if("svg"==O?o="http://www.w3.org/2000/svg":"math"==O?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a)for(h=0;h<a.length;h++)if((g=a[h])&&"setAttribute"in g==!!O&&(O?g.localName==O:3==g.nodeType)){e=g,a[h]=null;break}if(null==e){if(null==O)return document.createTextNode(T);e=document.createElementNS(o,O,T.is&&T),l&&(n.__m&&n.__m(r,a),l=!1),a=null}if(null==O)v===T||l&&e.data==T||(e.data=T);else{if(a=a&&t.call(e.childNodes),v=i.props||p,!l&&null!=a)for(v={},h=0;h<e.attributes.length;h++)v[(g=e.attributes[h]).name]=g.value;for(h in v)if(g=v[h],"children"==h);else if("dangerouslySetInnerHTML"==h)f=g;else if(!(h in T)){if("value"==h&&"defaultValue"in T||"checked"==h&&"defaultChecked"in T)continue;L(e,h,null,g,o)}for(h in T)g=T[h],"children"==h?m=g:"dangerouslySetInnerHTML"==h?d=g:"value"==h?_=g:"checked"==h?D=g:l&&"function"!=typeof g||v[h]===g||L(e,h,g,v[h],o);if(d)l||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),r.__k=[];else if(f&&(e.innerHTML=""),I("template"==r.type?e.content:e,E(m)?m:[m],r,i,s,"foreignObject"==O?"http://www.w3.org/1999/xhtml":o,a,u,a?a[0]:i.__k&&S(i,0),l,c),null!=a)for(h=a.length;h--;)A(a[h]);l||(h="value","progress"==O&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[h]||"progress"==O&&!_||"option"==O&&_!=v[h])&&L(e,h,_,v[h],o),h="checked",null!=D&&D!=e[h]&&L(e,h,D,v[h],o))}return e}(i.__e,r,i,s,o,a,u,c,h);return(d=n.diffed)&&d(r),128&r.__u?void 0:l}function x(e,t,r){for(var i=0;i<r.length;i++)P(r[i],r[++i],r[++i]);n.__c&&n.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){n.__e(e,t.__v)}}))}function B(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:E(e)?e.map(B):g({},e)}function P(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){n.__e(e,r)}}function U(e,t,r){var i,s;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||P(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&U(i[s],t,r||"function"!=typeof e.type);r||A(e.__e),e.__c=e.__=e.__e=void 0}function H(e,t,n){return this.constructor(e,n)}function $(e,r,i){var s,o,a,u;r==document&&(r=document.documentElement),n.__&&n.__(e,r),o=(s="function"==typeof i)?null:i&&i.__k||r.__k,a=[],u=[],F(r,e=(!s&&i||r).__k=_(T,null,[e]),o||p,p,r.namespaceURI,!s&&i?[i]:o?null:r.firstChild?t.call(r.childNodes):null,a,!s&&i?i:o?o.__e:r.firstChild,s,u),x(a,e,u)}function j(e,t){$(e,t,j)}function Y(e,n,r){var i,s,o,a,u=g({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)"key"==o?i=n[o]:"ref"==o?s=n[o]:u[o]=null==n[o]&&null!=a?a[o]:n[o];return arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):r),D(e.type,u,i||e.key,s||e.ref,null)}function z(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach((function(e){e.__e=!0,y(e)}))},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+d++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}t=f.slice,n={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},r=0,O.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),y(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),y(this))},O.prototype.render=T,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},N.__r=0,u=/(PointerCapture)$|Capture$/i,l=0,c=M(!1),h=M(!0),d=0;var V,G,W,X,K=0,q=[],J=n,Z=J.__b,Q=J.__r,ee=J.diffed,te=J.__c,ne=J.unmount,re=J.__;function ie(e,t){J.__h&&J.__h(G,e,K||t),K=0;var n=G.__H||(G.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function se(e){return K=1,oe(Te,e)}function oe(e,t,n){var r=ie(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Te(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=G,!G.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!s||s.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s&&s.call(this,e,t,n)||o};G.__f=!0;var s=G.shouldComponentUpdate,o=G.componentWillUpdate;G.componentWillUpdate=function(e,t,n){if(this.__e){var r=s;s=void 0,i(e,t,n),s=r}o&&o.call(this,e,t,n)},G.shouldComponentUpdate=i}return r.__N||r.__}function ae(e,t){var n=ie(V++,3);!J.__s&&ve(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function ue(e,t){var n=ie(V++,4);!J.__s&&ve(n.__H,t)&&(n.__=e,n.u=t,G.__h.push(n))}function le(e){return K=5,he((function(){return{current:e}}),[])}function ce(e,t,n){K=6,ue((function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}}),null==n?n:n.concat(e))}function he(e,t){var n=ie(V++,7);return ve(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function de(e,t){return K=8,he((function(){return e}),t)}function pe(e){var t=G.context[e.__c],n=ie(V++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(G)),t.props.value):e.__}function fe(e,t){J.useDebugValue&&J.useDebugValue(t?t(e):e)}function me(){var e=ie(V++,11);if(!e.__){for(var t=G.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ee(){for(var e;e=q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_e),e.__H.__h.forEach(De),e.__H.__h=[]}catch(t){e.__H.__h=[],J.__e(t,e.__v)}}J.__b=function(e){G=null,Z&&Z(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),re&&re(e,t)},J.__r=function(e){Q&&Q(e),V=0;var t=(G=e.__c).__H;t&&(W===G?(t.__h=[],G.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.forEach(_e),t.__h.forEach(De),t.__h=[],V=0)),W=G},J.diffed=function(e){ee&&ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==q.push(t)&&X===J.requestAnimationFrame||((X=J.requestAnimationFrame)||Ae)(Ee)),t.__H.__.forEach((function(e){e.u&&(e.__H=e.u),e.u=void 0}))),W=G=null},J.__c=function(e,t){t.some((function(e){try{e.__h.forEach(_e),e.__h=e.__h.filter((function(e){return!e.__||De(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],J.__e(n,e.__v)}})),te&&te(e,t)},J.unmount=function(e){ne&&ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{_e(e)}catch(e){t=e}})),n.__H=void 0,t&&J.__e(t,n.__v))};var ge="function"==typeof requestAnimationFrame;function Ae(e){var t,n=function(){clearTimeout(r),ge&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ge&&(t=requestAnimationFrame(n))}function _e(e){var t=G,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),G=t}function De(e){var t=G;e.__c=e.__(),G=t}function ve(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Te(e,t){return"function"==typeof t?t(e):t}function Oe(e,t){for(var n in t)e[n]=t[n];return e}function Se(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function Ce(e,t){var n=t(),r=se({t:{__:n,u:t}}),i=r[0].t,s=r[1];return ue((function(){i.__=n,i.u=t,ye(i)&&s({t:i})}),[e,n,t]),ae((function(){return ye(i)&&s({t:i}),e((function(){ye(i)&&s({t:i})}))}),[e]),n}function ye(e){var t,n,r=e.u,i=e.__;try{var s=r();return!((t=i)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function Ne(e){e()}function Ie(e){return e}function be(){return[!1,Ne]}var Re=ue;function we(e,t){this.props=e,this.context=t}function ke(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Se(this.props,e)}function r(t){return this.shouldComponentUpdate=n,_(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(we.prototype=new O).isPureReactComponent=!0,we.prototype.shouldComponentUpdate=function(e,t){return Se(this.props,e)||Se(this.state,t)};var Le=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Le&&Le(e)};var Me="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Fe(e){function t(t){var n=Oe({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Me,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var xe=function(e,t){return null==e?null:R(R(e).map(t))},Be={map:xe,forEach:xe,count:function(e){return e?R(e).length:0},only:function(e){var t=R(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:R},Pe=n.__e;n.__e=function(e,t,n,r){if(e.then)for(var i,s=t;s=s.__;)if((i=s.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);Pe(e,t,n,r)};var Ue=n.unmount;function He(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=Oe({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return He(e,t,n)}))),e}function $e(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return $e(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function je(){this.__u=0,this.o=null,this.__b=null}function Ye(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ze(e){var t,n,r;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return _(n,i)}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}n.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ue&&Ue(e)},(je.prototype=new O).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=Ye(r.__v),s=!1,o=function(){s||(s=!0,n.__R=null,i?i(a):a())};n.__R=o;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=$e(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},je.prototype.componentWillUnmount=function(){this.o=[]},je.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=He(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&_(T,null,e.fallback);return i&&(i.__u&=-33),[_(T,null,t.__a?null:e.children),i]};var Ge=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function We(e){return this.getChildContext=function(){return e.context},e.children}function Xe(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){$(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}$(_(We,{context:t.context},e.__v),t.v)}function Ke(e,t){var n=_(Xe,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new O).__a=function(e){var t=this,n=Ye(t.__v),r=t.l.get(e);return r[0]++,function(i){var s=function(){t.props.revealOrder?(r.push(i),Ge(t,e,r)):i()};n?n(s):s()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=R(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){Ge(e,n,t)}))};var qe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Je=/^(?: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]/,Ze=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Qe=/[A-Z0-9]/g,et="undefined"!=typeof document,tt=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function nt(e,t,n){return null==t.__k&&(t.textContent=""),$(e,t),"function"==typeof n&&n(),e?e.__c:null}function rt(e,t,n){return j(e,t),"function"==typeof n&&n(),e?e.__c:null}O.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(O.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var it=n.event;function st(){}function ot(){return this.cancelBubble}function at(){return this.defaultPrevented}n.event=function(e){return it&&(e=it(e)),e.persist=st,e.isPropagationStopped=ot,e.isDefaultPrevented=at,e.nativeEvent=e};var ut,lt={enumerable:!1,configurable:!0,get:function(){return this.class}},ct=n.vnode;n.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},i=-1===n.indexOf("-");for(var s in t){var o=t[s];if(!("value"===s&&"defaultValue"in t&&null==o||et&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var a=s.toLowerCase();"defaultValue"===s&&"value"in t&&null==t.value?s="value":"download"===s&&!0===o?o="":"translate"===a&&"no"===o?o=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?s="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||tt(t.type)?"onfocus"===a?s="onfocusin":"onblur"===a?s="onfocusout":Ze.test(s)&&(s=a):a=s="oninput":i&&Je.test(s)?s=s.replace(Qe,"-$&").toLowerCase():null===o&&(o=void 0),"oninput"===a&&r[s=a]&&(s="oninputCapture"),r[s]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=R(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=R(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",lt)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=qe,ct&&ct(e)};var ht=n.__r;n.__r=function(e){ht&&ht(e),ut=e.__c};var dt=n.diffed;n.diffed=function(e){dt&&dt(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),ut=null};var pt={ReactCurrentDispatcher:{current:{readContext:function(e){return ut.__n[e.__c].props.value},useCallback:de,useContext:pe,useDebugValue:fe,useDeferredValue:Ie,useEffect:ae,useId:me,useImperativeHandle:ce,useInsertionEffect:Re,useLayoutEffect:ue,useMemo:he,useReducer:oe,useRef:le,useState:se,useSyncExternalStore:Ce,useTransition:be}}};function ft(e){return _.bind(null,e)}function mt(e){return!!e&&e.$$typeof===qe}function Et(e){return mt(e)&&e.type===T}function gt(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function At(e){return mt(e)?Y.apply(null,arguments):e}function _t(e){return!!e.__k&&($(null,e),!0)}function Dt(e){return e&&(e.base||1===e.nodeType&&e)||null}var vt=function(e,t){return e(t)},Tt=function(e,t){return e(t)},Ot=T,St=mt,Ct={useState:se,useId:me,useReducer:oe,useEffect:ae,useLayoutEffect:ue,useInsertionEffect:Re,useTransition:be,useDeferredValue:Ie,useSyncExternalStore:Ce,startTransition:Ne,useRef:le,useImperativeHandle:ce,useMemo:he,useCallback:de,useContext:pe,useDebugValue:fe,version:"18.3.1",Children:Be,render:nt,hydrate:rt,unmountComponentAtNode:_t,createPortal:Ke,createElement:_,createContext:z,createFactory:ft,cloneElement:At,createRef:v,Fragment:T,isValidElement:mt,isElement:St,isFragment:Et,isMemo:gt,findDOMNode:Dt,Component:O,PureComponent:we,memo:ke,forwardRef:Fe,flushSync:Tt,unstable_batchedUpdates:vt,StrictMode:Ot,Suspense:je,SuspenseList:Ve,lazy:ze,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pt};const yt=Object.freeze(Object.defineProperty({__proto__:null,Children:Be,Component:O,Fragment:T,PureComponent:we,StrictMode:Ot,Suspense:je,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pt,cloneElement:At,createContext:z,createElement:_,createFactory:ft,createPortal:Ke,createRef:v,default:Ct,findDOMNode:Dt,flushSync:Tt,forwardRef:Fe,hydrate:rt,isElement:St,isFragment:Et,isMemo:gt,isValidElement:mt,lazy:ze,memo:ke,render:nt,startTransition:Ne,unmountComponentAtNode:_t,unstable_batchedUpdates:vt,useCallback:de,useContext:pe,useDebugValue:fe,useDeferredValue:Ie,useEffect:ae,useErrorBoundary:function(e){var t=ie(V++,10),n=se();return t.__=e,G.componentDidCatch||(G.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:me,useImperativeHandle:ce,useInsertionEffect:Re,useLayoutEffect:ue,useMemo:he,useReducer:oe,useRef:le,useState:se,useSyncExternalStore:Ce,useTransition:be,version:"18.3.1"},Symbol.toStringTag,{value:"Module"}));var Nt=0;function It(e,t,r,i,s,o){t||(t={});var a,u,l=t;if("ref"in l)for(u in l={},t)"ref"==u?a=t[u]:l[u]=t[u];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nt,__i:-1,__u:0,__source:s,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(u in a)void 0===l[u]&&(l[u]=a[u]);return n.vnode&&n.vnode(c),c}const bt=z(null),Rt={didCatch:!1,error:null};class wt extends O{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Rt}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];null===(t=(n=this.props).onReset)||void 0===t||t.call(n,{args:i,reason:"imperative-api"}),this.setState(Rt)}}componentDidCatch(e,t){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;var i,s;n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(i=(s=this.props).onReset)||void 0===i||i.call(s,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Rt))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:s}=this.state;let o=e;if(i){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(n)o=_(n,e);else{if(void 0===r)throw s;o=r}}return _(bt.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},o)}}var kt=Object.prototype.hasOwnProperty;function Lt(e){return Array.isArray(e)}function Mt(e){return!(!e||"object"!=typeof e||e instanceof Date||Lt(e))}function Ft(e){return"function"==typeof e}function xt(e){const t=typeof e;return void 0!==e&&(Bt(e)||"object"!==t&&"function"!==t)}function Bt(e){return e instanceof Date}function Pt(e){return"boolean"==typeof e}function Ut(e){return e instanceof Promise}function Ht(e){return e instanceof Map}function $t(e){if(!e)return!1;if(Lt(e))return 0===e.length;for(const t in e)if(kt.call(e,t))return!1;return!0}function jt(e){return null==e}var Yt=new Set(["boolean","string","number"]);function zt(e){return!!e.parent}var Vt=Symbol.toPrimitive,Gt=Symbol("getNode"),Wt=Symbol("delete"),Xt=Symbol("opaque"),Kt=Symbol("optimized"),qt=Symbol("linked"),Jt={isLoadingLocal:!1,isMerging:!1,isLoadingRemote:!1,activateSyncedNode:void 0,pendingNodes:new Map,dirtyNodes:new Set,replacer:void 0,reviver:void 0};function Zt(e){return Lt(e)?"array":Ht(e)?"map":e instanceof Set?"set":"object"}function Qt(e,t){return Ht(t)?{__LSType:"Map",value:Array.from(t.entries())}:t instanceof Set?{__LSType:"Set",value:Array.from(t)}:(Jt.replacer&&(t=Jt.replacer(e,t)),t)}var en=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;function tn(e,t){if(t){if("string"==typeof t&&en.test(t))return new Date(t);if("object"==typeof t){if("Map"===t.__LSType)return new Map(t.value);if("Set"===t.__LSType)return new Set(t.value)}Jt.reviver&&(t=Jt.reviver(e,t))}return t}function nn(e){return e?JSON.stringify(e,Qt):e}function rn(e){return e?JSON.parse(e,tn):e}function sn(e){return rn(nn(e))}function on(e){return!!e&&!!e[Gt]}function an(e){return e&&e[Gt]}function un(e,t){var n,r,i;const s=null!=(n=e.parent)?n:e,o=e.parent?e.key:"_",a=t===Wt;a&&(t=void 0);const u=e.parent?dn(s):s.root,l=u[o],c=Ft(t);if(t=s.isAssigning||!c||Ft(l)?t:t(l),!Jt.isMerging||jt(l)||Ft(l)||!(null==(i=null==(r=e.parent)?void 0:r.functions)?void 0:i.get(o)))try{s.isSetting=(s.isSetting||0)+1;const e=Ht(u);a?e?u.delete(o):delete u[o]:Ht(u)?u.set(o,t):u[o]=t}finally{s.isSetting--}return{prevValue:l,newValue:t}}var ln=[];function cn(e){let t=0,n=e;for(;zt(n);)ln[t++]=n.key,n=n.parent;let r=e.root._;for(let i=t-1;r&&i>=0;i--){const e=ln[i];r="size"!==e&&(Ht(r)||r instanceof WeakMap)?r.get(e):r[e]}return r}function hn(e,t,n){var r,i;let s=null==(r=e.children)?void 0:r.get(t);return s||(s={root:e.root,parent:e,key:t,lazy:!0,numListenersRecursive:0},1===(null==(i=e.lazyFn)?void 0:i.length)&&(n=e.lazyFn.bind(e,t)),Ft(n)&&(s=Object.assign((()=>{}),s),s.lazyFn=n),e.children||(e.children=new Map),e.children.set(t,s)),s}function dn(e){let t=cn(e);return t&&!Ft(t)||(t=zt(e)?dn(e.parent)[e.key]={}:e.root._={}),t}function pn(e,t){var n,r;let i=on(e)?void 0:Mt(e)?"id"in e?"id":"key"in e?"key":"_id"in e?"_id":"__id"in e?"__id":void 0:void 0;if(!i&&t.parent){const e=t.key+"_keyExtractor",s=null!=(r=null==(n=t.functions)?void 0:n.get(e))?r:cn(t.parent)[t.key+"_keyExtractor"];s&&Ft(s)&&(i=s)}return i}function fn(e,t,n){e.functions||(e.functions=new Map),e.functions.set(t,n)}function mn(e,t){return e===t||Bt(e)&&Bt(t)&&+e==+t}function En(e,t,n){let r=e;return!on(r)&&Ft(r)&&(r=t?r(t):r()),on(r)&&!n?r.get():r}function gn(e){return e&&(e[Xt]=!0),e}var An,_n=(e,t)=>e&&e[t];function Dn(e,t,n,r,i,s,o){let a,u=e;if(t.length>0){let i=s;for(let s=0;s<t.length;s++){if(a=t[s],u[a]===Wt)return i&&(u[a]=i[a],null==o||o(t.slice(0,s+1),u[a])),e;if(void 0===u[a]&&void 0===r&&s===t.length-1)return e;void 0!==u[a]&&null!==u[a]||(u[a]=On(n[s])),s<t.length-1&&(u=u[a],i&&(i=i[a]))}}return void 0===a?e="merge"===i?vn(e,r):r:"merge"===i?u[a]=vn(u[a],r):Ht(u)?u.set(a,r):u[a]=r,e}function vn(e,t,n){var r;on(t)&&(t=t.peek());const i=on(e),s=i?e.peek():e,o=Lt(s);if(!o&&Mt(s)&&Mt(t)&&!$t(s)||o&&s.length>0){const n=Object.keys(t);for(let s=0;s<n.length;s++){const o=n[s],a=t[o];if(a===Wt)i&&(null==(r=e[o])?void 0:r.delete)?e[o].delete():delete e[o];else{const t=Mt(a),n=!t&&Lt(a),r=e[o];if(!t&&!n||!r||!i&&$t(r))if(i)r.set(a);else{const t=Mt(a)?{...a}:Lt(a)?[...a]:a;e[o]=t}else i||r&&(t?Mt(r):Lt(r))?vn(r,a):e[o]=a}}}else void 0!==t&&(i?e.set(t):e=t);return e}function Tn(e){return!(!e||(Mt(e)||Lt(e))&&$t(e))}function On(e){switch(e){case"array":return[];case"object":return{};case"map":return new Map;case"set":return new Set}}function Sn(e,t,n){const{path:r,valueAtPath:i,prevAtPath:s,pathTypes:o}=t;return Dn(e,r,o,s)}var Cn=0,yn=!1,Nn=!1,In=new Map;function bn(){In.size>0&&Bn(!0)}function Rn(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function wn(e,t){return function(){return function(e,t){try{return function(e,t){for(let n=0;n<t.length;n++)e=Sn(e,t[n]);return e}(e?sn(e):{},t)}catch(e){return}}(e,t)}}function kn(e,t,n,r,i){const s=new Map;Ln(s,e,Jt.isLoadingLocal,Jt.isLoadingRemote,t,[],[],t,n,!0,r,i),s.size&&Mn(s,!0);const o=In.get(e);o?o.value=t:In.set(e,{value:t,prev:n,level:r,whenOptimizedOnlyIf:i,remote:Jt.isLoadingRemote,loading:Jt.isLoadingLocal}),Cn<=0&&Fn()}function Ln(e,t,n,r,i,s,o,a,u,l,c,h){if(function(e,t,n,r,i,s,o,a,u,l,c,h){if(l?t.listenersImmediate:t.listeners){const l={path:s,pathTypes:o,valueAtPath:a,prevAtPath:u},d=e.get(t);if(d&&s.length>0){const{changes:e}=d;Rn(e[0].path,l.path)||e.push(l)}else e.set(t,{level:c,value:i,remote:r,loading:n,whenOptimizedOnlyIf:h,changes:[l]})}}(e,t,n,r,i,s,o,a,u,l,c,h),t.linkedFromNodes)for(const d of t.linkedFromNodes)Ln(e,Pn(d,s),n,r,a,[],[],a,u,l,0,h);if(t.parent){const d=t.parent;d&&Ln(e,d,n,r,cn(d),[t.key].concat(s),[Zt(i)].concat(o),a,u,l,c+1,h)}}function Mn(e,t){const n=new Set;e.forEach((({changes:e,level:r,value:i,loading:s,remote:o,whenOptimizedOnlyIf:a},u)=>{const l=t?u.listenersImmediate:u.listeners;if(l){let t;const u=Array.from(l);for(let l=0;l<u.length;l++){const c=u[l],{track:h,noArgs:d,listener:p}=c;n.has(p)||(!0===h?r<=0:h!==Kt||a&&r<=0)&&(d||t||(t={value:i,loading:s,remote:o,getPrevious:wn(i,e),changes:e}),h||n.add(p),p(t))}}}))}function Fn(){const e=Array.from(Jt.dirtyNodes);Jt.dirtyNodes.clear(),e.forEach((e=>{const t=e.dirtyFn;t&&(e.dirtyFn=void 0,t())}));const t=In;In=new Map;const n=new Map;t.forEach((({value:e,prev:t,level:r,loading:i,remote:s,whenOptimizedOnlyIf:o},a)=>{Ln(n,a,i,s,e,[],[],e,t,!1,r,o)})),n.size&&Mn(n,!1)}function xn(){Cn++,An||(An=setTimeout(bn,0))}function Bn(e){(--Cn<=0||e)&&(yn?Nn=!0:(An&&(clearTimeout(An),An=void 0),Cn=0,yn=!0,Fn(),yn=!1,Nn&&(Nn=!1,Bn(!0))))}function Pn(e,t){let n=e;for(let r=0;r<t.length;r++)n=hn(n,t[r]);return n}function Un(e,t,n,r,i){if(on(e))return e;const s=Ut(e);let o={root:{_:e},lazy:!0,numListenersRecursive:0};var a;Ft(e)&&(o=Object.assign((()=>{}),o),o.lazyFn=e);const u=(a=e,Yt.has(typeof a)?new i(o):r(o));return s&&(un(o,void 0),n(o,e)),u}function Hn(e,t,n={},r){var i;const{initial:s,immediate:o,noArgs:a}=n,{trackingType:u}=n;let l=o?e.listenersImmediate:e.listeners;l||(l=new Set,o?e.listenersImmediate=l:e.listeners=l);const c={listener:t,track:u,noArgs:a};if(l.add(c),s){const n=cn(e);t({value:n,loading:!0,remote:!1,changes:[{path:[],pathTypes:[],prevAtPath:n,valueAtPath:n}],getPrevious:()=>{}})}let h;function d(i,s=t,o){if(!(null==r?void 0:r.has(i))){r||(r=new Set),r.add(o||e),s||(s=t);const a={trackingType:!0,...n};h=[...h||[],Hn(i,s,a,r)]}}e.linkedToNode&&d(e.linkedToNode),null==(i=e.linkedFromNodes)||i.forEach((e=>d(e))),e.numListenersRecursive++;let p=e.parent,f=[e.key];for(;p;){if(p.linkedFromNodes)for(const e of p.linkedFromNodes)(null==r?void 0:r.has(e))||d(e,$n(e,f,t),p);p.numListenersRecursive++,f=[p.key,...f],p=p.parent}return()=>{l.delete(c),null==h||h.forEach((e=>e()));let t=e;for(;t;)t.numListenersRecursive--,t=t.parent}}function $n(e,t,n){let{valueAtPath:r}=jn(cn(e),t);return function({value:e,loading:i,remote:s}){const{valueAtPath:o}=jn(e,t);o!==r&&n({value:o,loading:i,remote:s,changes:[{path:[],pathTypes:[],prevAtPath:r,valueAtPath:o}],getPrevious:()=>r}),r=o}}function jn(e,t){let n=e;const r=[];for(let i=0;n&&i<t.length;i++)r.push(Lt(n)?"array":"object"),n=n[t[i]];return{valueAtPath:n,pathTypes:r}}var Yn=0,zn=[],Vn={current:void 0};function Gn(e,t){if(Yn){const n=Vn.current;if(n){n.nodes||(n.nodes=new Map);const r=n.nodes.get(e);r?(r.track=r.track||t,r.num++):n.nodes.set(e,{node:e,track:t,num:1})}}}function Wn(e,t,n,r,i){let s,o=t;zn.push(Vn.current),Yn++,Vn.current={};const a=e?En(e,n,null==r?void 0:r.fromComputed):e,u=Vn.current.nodes;return--Yn<0&&(Yn=0),Vn.current=zn.pop(),(null==n?void 0:n.cancel)||(s=function(e,t,n,r){let i=[];return null==e||e.forEach((e=>{const{node:n,track:s}=e;i.push(Hn(n,t,{trackingType:s,immediate:r,noArgs:false}))})),()=>{if(i){for(let e=0;e<i.length;e++)i[e]();i=void 0}}}(u,o,0,null==r?void 0:r.immediate)),{nodes:u,value:a,dispose:s,resubscribe:void 0}}function Xn(e,t,n){let r,i;Ft(t)?r=t:n=t;const s={num:0},o=function(){s.onCleanup&&(s.onCleanup(),s.onCleanup=void 0),xn(),delete s.value,null==i||i();const{dispose:t,value:a,nodes:u}=Wn(e,o,s,n);i=t,s.value=a,s.nodes=u,s.refresh=o,s.onCleanupReaction&&(s.onCleanupReaction(),s.onCleanupReaction=void 0),Bn(),r&&((null==n?void 0:n.fromComputed)||(s.num>0||!function(e){var t;return e&&(null==(t=e[Gt])?void 0:t.isEvent)}(e))&&(s.previous!==s.value||"object"==typeof s.value))&&r(s),s.previous=s.value,s.num++};return o(),()=>{var e,t;null==(e=s.onCleanup)||e.call(s),s.onCleanup=void 0,null==(t=s.onCleanupReaction)||t.call(s),s.onCleanupReaction=void 0,null==i||i()}}function Kn(e,t,n){if(Ut(e))return t?e.then(t):e;let r,i;return Xn((function(t){const i=En(e);if(!Ut(i))return!Ut(i)&&(n?Tn(i):i)&&(r=i,t.cancel=!0),r;r=i}),(function(){i=null==t?void 0:t(r)})),Ut(r)?t?r.then(t):r:void 0!==r?t?i:Promise.resolve(r):new Promise((e=>{if(t){const n=t;t=t=>{const r=n(t);e(Ut(r)?r.then((e=>e)):r)}}else t=e}))}function qn(e,t){return Kn(e,t,!1)}function Jn(e,t){return Kn(e,t,!0)}var Zn=new Set(["copyWithin","fill","from","pop","push","reverse","shift","sort","splice","unshift"]),Qn=new Set(["every","filter","find","findIndex","forEach","join","map","reduce","some"]),er=new Set(["filter","find"]),tr=new Map,nr=new Map([["get",mr],["set",cr],["peek",Er],["onChange",Hn],["assign",function(e,t){const n=ar(e);if(xn(),xt(e.root._)&&(e.root._={}),Ht(t)){const n=cn(e);Ht(n)&&t.forEach(((e,t)=>n.set(t,e)))}else{e.isAssigning=(e.isAssigning||0)+1;try{Object.assign(n,t)}finally{e.isAssigning--}}return Bn(),n}],["delete",function(e,t){void 0===t&&zt(e)&&(t=e.key,e=e.parent);const n=cn(e);Lt(n)?rr(e,n,"splice",t,1):hr(e,null!=t?t:"_",Wt,-1)}],["toggle",function(e){const t=cn(e);(null==t||Pt(t))&&cr(e,!t)}]]);function rr(e,t,n,...r){var i;if("push"!==n||1!==r.length){const s=t.slice(),o=t[n].apply(t,r);if(e){const n=zt(e),r=n?e.key:"_";(n?cn(e.parent):e.root)[r]=s,hr(null!=(i=e.parent)?i:e,r,t)}return o}hr(e,t.length+"",r[0])}function ir(e,t,n){return t?void 0:e?n?Array.from(e.keys()):Object.keys(e):[]}function sr(e,t,n){var r,i,s;if(Mt(t)&&t[Xt]||Mt(n)&&n[Xt]){const r=t!==n;return r&&(e.listeners||e.listenersImmediate)&&kn(e,t,n,0),r}const o=Lt(t);let a,u;const l=Ht(t),c=Ht(n),h=ir(t,o,l),d=ir(n,o,c),p=(null==(r=h||t)?void 0:r.length)||0,f=(null==(i=d||n)?void 0:i.length)||0;let m,E,g,A=!1;if(o&&Lt(n)){if(n.length>0){const r=n[0];if(void 0!==r&&(m=pn(r,e),m&&(E=Ft(m),a=new Map,u=[]),e.children))for(let i=0;i<n.length;i++){const r=n[i];if(r){const n=e.children.get(i+"");if(n&&(t[i]||or(n,r),m)){const e=E?m(r):r[m];a.set(e,n)}}}}}else if(n&&(!t||Mt(t))){const t=d.length;for(let r=0;r<t;r++){const t=d[r];if(!h.includes(t)){A=!0;const r=hn(e,t),i=c?n.get(t):n[t];void 0!==i&&or(r,i)}}}if(t&&!xt(t)){A=A||p!==f;const r=A;let i=!1;for(let d=0;d<p;d++){const p=o?d+"":h[d];let f=l?t.get(p):t[p];const g=c?null==n?void 0:n.get(p):null==n?void 0:n[p];let _=!mn(f,g);if(_){const c=m&&f?E?m(f):f[m]:void 0,h=null==(s=e.children)?void 0:s.get(p);if(on(f)){const e=an(f);if((null==h?void 0:h.linkedToNode)===e){const n=cn(e);l?t.set(p,n):t[p]=n;continue}const n=f;f=()=>n}let d=hn(e,p,f);if(d.lazy||!Ft(f)&&!on(f)||(_r(d,f),Ar(d)),o&&void 0!==c){const t=void 0!==c?null==a?void 0:a.get(c):void 0;if(t){if(void 0!==t&&t.key!==p){const s=n[t.key];r&&(d=t,e.children.delete(d.key),d.key=p,u.push([p,d])),i=!0,_=s!==f}}else A=!0}if(_)if(Ft(f)||on(f))fr(e,p,f);else if(xt(f))A=!0;else{const e=sr(d,f,g);A=A||e,_=e}(_||o&&!r)&&(d.listeners||d.listenersImmediate)&&kn(d,f,g,0,!r)}}if(u)for(let t=0;t<u.length;t++){const[n,r]=u[t];e.children.set(n,r)}g=A||i}else void 0!==n&&(g=!0);return null!=g&&g}function or(e,t){var n,r;null==(n=e.linkedToNodeDispose)||n.call(e),null==(r=e.activatedObserveDispose)||r.call(e),xt(t)||sr(e,void 0,t),(e.listeners||e.listenersImmediate)&&kn(e,void 0,t,0)}function ar(e,t,n){return void 0!==t&&(e=hn(e,t,n)),e.proxy||(e.proxy=new Proxy(e,lr))}function ur(){if(Jt.pendingNodes.size>0){const e=Array.from(Jt.pendingNodes.values());Jt.pendingNodes.clear(),e.forEach((e=>e()))}}var lr={get(e,t,n){var r,i;if(t===Vt)throw new Error("[legend-state] observable is not a primitive.");if(t===Gt)return e;if("apply"===t){const t=cn(e);if(Ft(t))return t.apply}let s=Ar(e,"get"===t||"peek"===t);const o=e.linkedToNode||(null==s?void 0:s[Gt]);if(o&&"onChange"!==t)return lr.get(o,t,n);if(Ht(s)||s instanceof WeakMap||s instanceof Set||s instanceof WeakSet){const n=function(e,t,n){const r=null==n?void 0:n[t];return"size"===t?ar(e,t):Ft(r)?function(r,i,s){const o=arguments.length,a=n;if("get"===t){if(o>0&&"boolean"!=typeof r&&r!==Kt)return ar(e,r)}else if("set"===t){if(2===o){const t=a.get(r),n=a.set(r,i);return t!==i&&dr(hn(e,r),i,t),n}1===o&&Ht(n)&&cr(e,r)}else if("delete"===t){if(o>0){const t=n.get?a.get(r):r,i=n.delete(r);return i&&dr(hn(e,r),void 0,t),i}}else{if("clear"===t){const t=new Map(a),r=a.size;return a.clear(),void(r&&dr(e,n,t))}if("add"===t){const i=new Set(n),s=n.add(r);return n.has(t)||kn(e,s,i,0),s}}const u=nr.get(t);if(!u)return n[t](r,i);switch(o){case 0:return u(e);case 1:return u(e,r);case 2:return u(e,r,i);default:return u(e,r,i,s)}}:void 0}(e,t,s);if(void 0!==n)return n}const a=nr.get(t);if(a)return"get"!==t&&"peek"!==t||ur(),function(t,n,r){switch(arguments.length){case 0:return a(e);case 1:return a(e,t);case 2:return a(e,t,n);default:return a(e,t,n,r)}};const u=tr.get(t);if(u)return u.get(e);let l=null==s?void 0:s[t];if(Mt(s)&&s[Xt])return l;const c=null==(r=e.functions)?void 0:r.get(t);if(c)return on(c)?c:ar(e,t,c);if(l=function(e,t){if(e){const n=Object.getOwnPropertyDescriptor(e,t);return(null==n?void 0:n.get)&&(delete e[t],e[t]=n.set?function(e){Ft(e)&&(e={get:e});const t=function(){return{[qt]:e}};return t.prototype[qt]=e,t}({get:n.get,set:({value:e})=>n.set(e)}):n.get),e[t]}}(s,t),jt(s)&&void 0===l&&(Zn.has(t)||Qn.has(t))&&(s=[],un(e,s),l=s[t]),Ft(l)){if(Lt(s)){if(Zn.has(t))return(...n)=>rr(e,s,t,...n);if(Qn.has(t))return Gn(e,!0),function(n,r){const i="reduce"===t,o=i?(t,r,i,s)=>n(t,ar(e,i+"",r),i,s):(t,r,i)=>n(ar(e,r+"",t),r,i);if(i||!er.has(t))return s[t](o,r);const a="find"===t,u=[];for(let t=0;t<s.length;t++)if(o(s[t],t,s)){const n=ar(e,t+"");if(a)return n;u.push(n)}return a?void 0:u}}fr(e,t,l);const n=null==(i=e.functions)?void 0:i.get(t);return n?ar(e,t,n):l.bind(s)}return xt(l)&&Lt(s)&&"length"===t?(Gn(e,!0),l):ar(e,t)},getPrototypeOf(e){const t=cn(e);return null!==t&&"object"==typeof t?Reflect.getPrototypeOf(t):null},ownKeys(e){Ar(e);const t=mr(e,!0);if(xt(t))return[];const n=t?Reflect.ownKeys(t):[];if(Lt(t)&&"length"===n[n.length-1]&&n.splice(n.length-1,1),Ft(e)){const t=Reflect.ownKeys(e);["caller","arguments","prototype"].forEach((e=>t.includes(e)&&n.push(e)))}return n},getOwnPropertyDescriptor(e,t){if("caller"===t||"arguments"===t||"prototype"===t)return{configurable:!1,enumerable:!1};const n=cn(e);return xt(n)?void 0:Reflect.getOwnPropertyDescriptor(n,t)},set(e,t,n){if(e.isSetting)return Reflect.set(e,t,n);if(e.isAssigning)return hr(e,t,n),!0;const r=tr.get(t);return!!r&&(r.set(e,n),!0)},deleteProperty:(e,t)=>!!e.isSetting&&Reflect.deleteProperty(e,t),has(e,t){const n=cn(e);return Reflect.has(n,t)},apply:(e,t,n)=>(on(t)&&(t=t.peek()),Reflect.apply(e.lazyFn||e,t,n))};function cr(e,t){e.parent?hr(e.parent,e.key,t):hr(e,"_",t)}function hr(e,t,n,r){const i=!e.parent&&"_"===t;!e.parent||cn(e)||Ft(n)||cr(e,{[t]:n});const s=i?e:hn(e,t,n);if(on(n))vr(s,n);else{const{newValue:o,prevValue:a}=un(s,n),u=xt(o)||o instanceof Date;mn(o,a)||dr(e,o,a,s,u,i,r),u||(s.needsExtract=!0),fr(e,t,o)}}function dr(e,t,n,r,i,s,o){r||(r=e),xn(),void 0===i&&(i=xt(t));let a=i,u=!1;(!i||n&&!xt(n))&&(a=sr(r,t,n),Lt(t)&&(u=(null==t?void 0:t.length)!==(null==n?void 0:n.length))),(i||!t||$t(t)&&!$t(n)?t!==n:a)&&kn(i&&s?e:r,t,n,(null!=o?o:void 0===n)?-1:a?0:1,u),Bn()}function pr(e,t,n){e.state||(e.state=Un({isLoaded:!1},0,pr,ar)),t.then((t=>{n?n({value:t}):cr(e,t),e.state.assign({isLoaded:!0,error:void 0})})).catch((t=>{e.state.error.set(t)}))}function fr(e,t,n){if(Ut(n)){const r=hn(e,t);return pr(r,n),void un(r,void 0)}if(on(n)){const r=()=>n;fn(e,t,r);const i=hn(e,t,r);return un(i,Er(an(n))),cn(i)}if("function"==typeof n)return fn(e,t,n),t}function mr(e,t){return Gn(e,t?Mt(t)?t.shallow:t:void 0),Er(e)}function Er(e){return Ar(e,!0)}var gr=!1;function Ar(e,t){var n;if(gr=!0,t&&(null==(n=e.dirtyChildren)?void 0:n.size)){const t=Array.from(e.dirtyChildren);e.dirtyChildren.clear(),t.forEach((e=>e.dirtyFn&&Ar(e)))}if(e.dirtyFn){const t=e.dirtyFn;e.dirtyFn=void 0,Jt.dirtyNodes.delete(e),t()}gr=!1;let r=cn(e);return r=function(e,t,n){const r=t,i=e.lazy;if(i){const n=e.lazyFn;if(delete e.lazy,Ft(n))if(1===n.length)t={};else{if(e.parent){const t=cn(e.parent);t?delete t[e.key]:e.root._=void 0}t=function(e,t){let n,r,i,s=!0;const o=t;let a,u,l=[];function c(){e.dirtyFn=u,Jt.dirtyNodes.add(e)}return e.activatedObserveDispose=Xn((()=>{var t,a,l,c;if(s)s=!1,un(e,void 0);else if(!gr&&u&&function(e,t){if(!gr){const n=function(e){var t,n;let r=e,i=e.numListenersRecursive>0;for(;r&&!i;)((null==(t=r.listeners)?void 0:t.size)||(null==(n=r.listenersImmediate)?void 0:n.size))&&(i=!0),r=r.parent;return i}(e);if(!n){t&&(e.dirtyFn=t);let n=e;for(;n;)n.dirtyChildren||(n.dirtyChildren=new Set),n.dirtyChildren.add(e),n=n.parent;return!0}}}(e,u))return void(i=!0);let h=o(),d=!1;on(h)&&(d=!0,h=vr(e,h)),Ft(h)&&(h=h());const p=on(h)||null==h?void 0:h[qt];if(p&&(e.activationState=p,h=void 0),i=!1,r=Ut(h),e.activated){if(e.activationState){const n=e.activationState;(null==(a=null==(t=e.state)?void 0:t.peek())?void 0:a.sync)?(e.state.sync(),i=!0):h=null!=(c=null==(l=n.get)?void 0:l.call(n))?c:n.initial}}else{e.activated=!0;let t=Dr;(null==p?void 0:p.synced)&&(t=Jt.activateSyncedNode,i=!0);const r=t(e,h);n=r.update;let s=r.value;!d&&on(s)&&(s=vr(e,s)),h=null!=s?s:null==p?void 0:p.initial}return r=r||Ut(h),h}),(t=>{const{value:s,nodes:o,refresh:h}=t;if(u=h,!i){if(!r||!Jt.isLoadingRemote)if(r)if(e.activationState){const{initial:t}=e.activationState;s&&Ut(s)&&pr(e,s,n),Ft(cn(e))&&un(e,null!=t?t:void 0)}else e.activated&&(pr(e,s,n),Ft(cn(e))&&un(e,void 0));else a=s,e.state.isLoaded.peek()?(e.isComputing=!0,cr(e,s),e.isComputing=!1):(un(e,s),e.state.assign({isLoaded:!0,error:void 0}));l.forEach((e=>e())),l=[],null==o||o.forEach((({node:e,track:t})=>{l.push(Hn(e,c,{immediate:!0,trackingType:t}))}))}t.cancel=!0}),{fromComputed:!0}),a}(e,n)}else on(t)&&(t=fr(e.parent,e.key,t))}return!i&&!e.needsExtract||on(t)||xt(t)||(n&&function(e,t){if((Mt(e)||Lt(e))&&!e[Xt]){const n=[],r=()=>{var e;let r=t;for(let t=0;t<n.length;t++){const{key:i}=n[t],s=null==(e=cn(r))?void 0:e[i];r=hn(r,i,Ft(s)?s:void 0),Ar(r)}return r};Tr(e,n,r)}}(t,e),e.parent&&fr(e.parent,e.key,r)),t}(e,r,!!t),r}function _r(e,t){var n,r;null==(n=e.activatedObserveDispose)||n.call(e),null==(r=e.linkedToNodeDispose)||r.call(e),e.activatedObserveDispose=e.linkedToNodeDispose=e.linkedToNode=void 0,e.lazyFn=t,e.lazy=!0}function Dr(e,t){if(e.state||(e.state=Un({isLoaded:!1},0,pr,ar)),e.activationState){const{set:n,get:r,initial:i}=e.activationState;if(null!=(t=null==r?void 0:r())&&null!==t||(t=i),n){let t,r=[],i=0;const s=s=>{if(r.length>0){let o,a,u,l=!1,c=!1;s?(o=s.changes,a=s.value,l=s.loading,c=s.remote,u=s.getPrevious):(o=r,a=t,u=wn(a,o)),r=[],t=void 0,Jt.pendingNodes.delete(e),i++;const h=i,d=()=>{h===i&&(e.isComputing=!0,n({value:a,changes:o,loading:l,remote:c,getPrevious:u}),e.isComputing=!1)};Jn(e.state.isLoaded,d)}};Hn(e,(({value:n,changes:i})=>{e.isComputing||(i.length>1||!Ft(i[0].prevAtPath))&&(t=n,r.length>0&&(i=i.filter((e=>!Rn(r[0].path,e.path)))),r.push(...i),Jt.pendingNodes.set(e,s))}),{immediate:!0}),Hn(e,s)}}return{update:({value:t})=>{e.isComputing||(e.isComputing=!0,cr(e,t),e.isComputing=!1)},value:t}}function vr(e,t){var n;const r=an(t);return r!==e&&(null==r?void 0:r.linkedToNode)!==e&&(e.linkedToNode=r,r.linkedFromNodes||(r.linkedFromNodes=new Set),r.linkedFromNodes.add(e),null==(n=e.linkedToNodeDispose)||n.call(e),e.linkedToNodeDispose=Hn(r,(()=>{t=Ar(r),cr(e,t)}),{initial:!0},new Set([e]))),t}function Tr(e,t,n){var r;if((Mt(e)||Lt(e))&&!e[Xt])for(const i in e)if(kt.call(e,i)){const s=e[i];if(on(s)){const e=n();fr(e,i,s),delete e.lazy}else{const e=Ft(s)&&(null==(r=s.prototype)?void 0:r[qt]);if(e){const t=e.activate;t&&"auto"!==t||Er(hn(n(),i,s))}}"object"==typeof s&&(t.push({key:i,value:s}),Tr(s,t,n),t.pop())}}var Or=["get","set","peek","onChange","toggle"];function Sr(e){this._node=e;for(let t=0;t<Or.length;t++){const e=Or[t];this[e]=this[e].bind(this)}}function Cr(e,t){Sr.prototype[e]=function(...e){return t.call(this,this._node,...e)}}function yr(e){return Un(e,0,pr,ar,Sr)}Cr("peek",(e=>(ur(),Er(e)))),Cr("get",((e,t)=>(ur(),mr(e,t)))),Cr("set",cr),Cr("onChange",Hn),Object.defineProperty(Sr.prototype,Gt,{configurable:!0,get(){return this._node}}),Sr.prototype.toggle=function(){const e=this.peek();(null==e||Pt(e))&&this.set(!e)},Sr.prototype.delete=function(){return this.set(void 0),this};var Nr={createPreviousHandler:wn,clone:sn,ensureNodeValue:dn,findIDKey:pn,get:mr,getNode:an,getNodeValue:cn,getPathType:Zt,getProxy:ar,getValueAtPath:function(e,t){return t.reduce(_n,e)},globalState:Jt,initializePathType:On,observableFns:nr,optimized:Kt,peek:Er,runWithRetry:function(e,t,n){const{waitFor:r}=e.activationState,{retry:i}=t,s={cancel:!1};let o;if(o=r?Jn(r,(()=>(e.activationState.waitFor=void 0,n(s)))):n(s),Ut(o)&&i){let r;return new Promise((a=>{const u=()=>{o.then((t=>{e.activationState.persistedRetry=!1,a(t)})).catch((()=>{t.attemptNum++,r&&clearTimeout(r),s.cancel||(r=function(e,t,n){const r=function(e,t){const{backoff:n,delay:r=1e3,infinite:i,times:s=3,maxDelay:o=3e4}=e;return i||t<s?Math.min(r*("constant"===n?1:2**t),o):null}(e,t);if(r)return setTimeout(n,r)}(i,t.attemptNum,(()=>{o=n(s),u()})))})).finally((()=>{e.activationState.persistedRetry=!1}))};u()}))}return o},safeParse:rn,safeStringify:nn,set:cr,setAtPath:Dn,setNodeValue:un,symbolLinked:qt,symbolDelete:Wt,tracking:Vn},Ir="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function br(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rr={exports:{}},wr={},kr=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}(yt),Lr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Mr=kr.useState,Fr=kr.useEffect,xr=kr.useLayoutEffect,Br=kr.useDebugValue;function Pr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lr(e,n)}catch(e){return!0}}var Ur="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=Mr({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return xr((function(){i.value=n,i.getSnapshot=t,Pr(i)&&s({inst:i})}),[e,n,t]),Fr((function(){return Pr(i)&&s({inst:i}),e((function(){Pr(i)&&s({inst:i})}))}),[e]),Br(n),n};wr.useSyncExternalStore=void 0!==kr.useSyncExternalStore?kr.useSyncExternalStore:Ur,Rr.exports=wr;var Hr=Rr.exports,$r={inObserver:!1},jr=void 0;function Yr(e,t){if($r.inObserver&&on(e)&&!(null==t?void 0:t.suspense))return En(e);let n;try{const r=pe(jr||(jr=z(null))),i=he((()=>function(e,t){let n,r,i,s,o,a=0;const u=()=>{null==r||r();const{value:e,dispose:t,resubscribe:n}=Wn(i,l,void 0,void 0);return r=t,e},l=({value:r})=>{if(null==t?void 0:t.peek()){const e=o;o=r,void 0===e&&qn((()=>!t.get()),(()=>{const e=o;o=void 0,l({value:e})}))}else{let t=null==e?void 0:e.skipCheck;if(!t){const e=u();(e!==s||!xt(e)&&e===r)&&(t=!0)}t&&(a++,null==n||n())}};return{subscribe:e=>(n=e,()=>{null==r||r(),r=void 0}),getVersion:()=>a,run:e=>(i=e,s=u())}}(t,r)),[]),{subscribe:s,getVersion:o,run:a}=i;n=a(e),Hr.useSyncExternalStore(s,o,o)}catch(e){throw e}if(null==t?void 0:t.suspense){const t=Ut(n);if(Ut(n)||!n&&on(e)){const r=t?n:qn(e);if(!Ct.use)throw r;Ct.use(r)}}return n}function zr({children:e}){return Yr((()=>En(En(e))),{skipCheck:!0})}var Vr="function"==typeof Symbol&&Symbol.for;function Gr(e,t,n,r){const i=Vr?Symbol.for("react.forward_ref"):Fe((e=>null)).$$typeof,s=Vr?Symbol.for("react.memo"):ke((e=>null)).$$typeof;if(e.__legend_proxied)return e;let o=!1,a=!1,u=e;s&&u.$$typeof===s&&u.type&&(a=!0,u=u.type),i&&u.$$typeof===i&&(o=!0,u=u.render);const l={apply(e,i,s){if(n){const e=s[0],t={},n=Object.keys(e);for(let i=0;i<n.length;i++){const s=n[i],o=e[s];if("children"===s&&(Ft(o)||on(o)))e[s]=Yr(o,{skipCheck:!0});else if(s.startsWith("$")||s.endsWith("$")){const n=s.endsWith("$")?s.slice(0,-1):s.slice(1),i=null==r?void 0:r[n],a=i&&on(o);if(t[n]=a&&(null==i?void 0:i.selector)?i.selector(t,o):Yr(o),a&&(void 0!==i.defaultValue&&void 0===t[n]&&(t[n]=i.defaultValue),i.handler&&i.getValue)){const n=t=>{var n;o.set(i.getValue(t)),null==(n=e[i.handler])||n.call(e,t)};t[i.handler]=de(n,[e[i.handler],r])}delete t[s]}else void 0===t[s]&&(t[s]=o)}s[0]=t}return t?Yr((()=>{$r.inObserver=!0;try{return Reflect.apply(e,i,s)}finally{$r.inObserver=!1}}),{skipCheck:!0}):Reflect.apply(e,i,s)}},c=new Proxy(u,l);let h;return o?(h=Fe(c),h.__legend_proxied=!0):h=c,t||a?ke(h):h}var{findIDKey:Wr,getNode:Xr,optimized:Kr}=Nr,qr=new Map;function Jr({each:e,optimized:t,item:n,itemProps:r,sortValues:i,children:s}){var o;if(!e)return null;const a=Yr((()=>e.get(!t||Kr)));if(!n&&s){const e=le();e.current=s,n=he((()=>{return t=({item$:t,id:n})=>e.current(t,n),Gr(t,!0);var t}),[])}else if(n.$$typeof!==Symbol.for("react.memo")){let e=qr.get(n);e||(e=ke(n),qr.set(n,e)),n=e}if(!a)return null;const u=[];if(Lt(a)){const t=a[0],i=Xr(e),s=a.length,l=s>0?i&&Wr(t,i)||(void 0!==t.id?"id":void 0!==t.key?"key":void 0):void 0,c=Ft(l);for(let h=0;h<s;h++)if(a[h]){const t=a[h],i=null!=(o=c?l(t):t[l])?o:h,s=e[h],d={key:i,id:i,item$:s,item:s};u.push(_(n,r?Object.assign(d,r):d))}}else{const t=Ht(a),s=t?Array.from(a.keys()):Object.keys(a);i&&s.sort(((e,n)=>i(t?a.get(e):a[e],t?a.get(n):a[n],e,n)));for(let i=0;i<s.length;i++){const o=s[i];if(t?a.get(o):a[o]){const i=t?e.get(o):e[o],s={key:o,id:o,item$:i,item:i};u.push(_(n,r?Object.assign(s,r):s))}}}return u}ke(zr,(()=>!0));var Zr=new Map,Qr=new Map;function ei({if:e,ifReady:t,else:n,wrap:r,children:i}){const s=Yr(null!=e?e:t),o=Yr((void 0!==t?Tn(s):s)?Ft(i)?()=>i(s):i:null!=n?n:null,{skipCheck:!0});return r?_(r,void 0,o):o}function ti(e,t){var n;const r=le({});if(r.current.value=e,!(null==(n=r.current)?void 0:n.obs$)){const t=e;r.current.obs$=yr(t)}return r.current.obs$}new Proxy({},{get(e,t){if(!e[t]){const n=Zr.get(t)||t,r=Fe(((e,t)=>{const r={...e};return!t||!Ft(t)&&$t(t)||(r.ref=t),_(n,r)}));e[t]=Gr(r,!1,!0,Qr.get(t))}return e[t]}});function ni(e,t,n){let r;Ft(t)?r=t:n=t;const i=le({selector:e});i.current={selector:e,reaction:r},function(e){ae((()=>{const t=e();if(!Ut(t))return t}),[])}((()=>Xn((e=>{const{selector:t}=i.current;return Ft(t)?t(e):t}),(e=>{var t,n;return null==(n=(t=i.current).reaction)?void 0:n.call(t,e)}),n)))}class ri extends Error{}function ii(e,t){if(!e)throw new ri(t??"Assertion failed")}const si=Object.assign(ii,{is:function(e,t,n){return ii(t,n)},unreachable:function(){throw new Error("Unreachable code")},keyNonNullable:function(e,t){if(!(t in e))throw new ri(`Missing key "${t}"`);if(null==e[t])throw new ri(`Key "${t}" is null or undefined`)},insideObservingContext:function(){if(!Vn.current)throw new Error("You aren't inside an observing context")},never:function(e){throw new Error("Unreachable")},defined:function(e){if(null==e)throw new ri("Value is not defined")}}),oi=z(void 0),ai=pi(oi),ui=z(void 0),li=pi(ui),ci=z(void 0),hi=pi(ci),di=z(void 0);function pi(e){return()=>{const t=pe(e);return si(void 0!==t),t}}z(di);const fi=["top","right","bottom","left"],mi=Math.min,Ei=Math.max,gi=Math.round,Ai=Math.floor,_i=e=>({x:e,y:e}),Di={left:"right",right:"left",bottom:"top",top:"bottom"},vi={start:"end",end:"start"};function Ti(e,t,n){return Ei(e,mi(t,n))}function Oi(e,t){return"function"==typeof e?e(t):e}function Si(e){return e.split("-")[0]}function Ci(e){return e.split("-")[1]}function yi(e){return"x"===e?"y":"x"}function Ni(e){return"y"===e?"height":"width"}function Ii(e){return["top","bottom"].includes(Si(e))?"y":"x"}function bi(e){return yi(Ii(e))}function Ri(e){return e.replace(/start|end/g,(e=>vi[e]))}function wi(e){return e.replace(/left|right|bottom|top/g,(e=>Di[e]))}function ki(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Li(e,t,n){let{reference:r,floating:i}=e;const s=Ii(t),o=bi(t),a=Ni(o),u=Si(t),l="y"===s,c=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let p;switch(u){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:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}switch(Ci(t)){case"start":p[o]-=d*(n&&l?-1:1);break;case"end":p[o]+=d*(n&&l?-1:1)}return p}async function Mi(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:h="floating",altBoundary:d=!1,padding:p=0}=Oi(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(p),m=a[d?"floating"===h?"reference":"floating":h],E=ki(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:u})),g="floating"===h?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,A=await(null==s.getOffsetParent?void 0:s.getOffsetParent(a.floating)),_=await(null==s.isElement?void 0:s.isElement(A))&&await(null==s.getScale?void 0:s.getScale(A))||{x:1,y:1},D=ki(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:A,strategy:u}):g);return{top:(E.top-D.top+f.top)/_.y,bottom:(D.bottom-E.bottom+f.bottom)/_.y,left:(E.left-D.left+f.left)/_.x,right:(D.right-E.right+f.right)/_.x}}function Fi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xi(e){return fi.some((t=>e[t]>=0))}function Bi(e){return Hi(e)?(e.nodeName||"").toLowerCase():"#document"}function Pi(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ui(e){var t;return null==(t=(Hi(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Hi(e){return e instanceof Node||e instanceof Pi(e).Node}function $i(e){return e instanceof Element||e instanceof Pi(e).Element}function ji(e){return e instanceof HTMLElement||e instanceof Pi(e).HTMLElement}function Yi(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Pi(e).ShadowRoot)}function zi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=qi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Vi(e){return["table","td","th"].includes(Bi(e))}function Gi(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Wi(e){const t=Xi(),n=$i(e)?qi(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Xi(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ki(e){return["html","body","#document"].includes(Bi(e))}function qi(e){return Pi(e).getComputedStyle(e)}function Ji(e){return $i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zi(e){if("html"===Bi(e))return e;const t=e.assignedSlot||e.parentNode||Yi(e)&&e.host||Ui(e);return Yi(t)?t.host:t}function Qi(e){const t=Zi(e);return Ki(t)?e.ownerDocument?e.ownerDocument.body:e.body:ji(t)&&zi(t)?t:Qi(t)}function es(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Qi(e),s=i===(null==(r=e.ownerDocument)?void 0:r.body),o=Pi(i);return s?t.concat(o,o.visualViewport||[],zi(i)?i:[],o.frameElement&&n?es(o.frameElement):[]):t.concat(i,es(i,[],n))}function ts(e){const t=qi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ji(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=gi(n)!==s||gi(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function ns(e){return $i(e)?e:e.contextElement}function rs(e){const t=ns(e);if(!ji(t))return _i(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=ts(t);let o=(s?gi(n.width):n.width)/r,a=(s?gi(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}const is=_i(0);function ss(e){const t=Pi(e);return Xi()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:is}function as(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),s=ns(e);let o=_i(1);t&&(r?$i(r)&&(o=rs(r)):o=rs(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Pi(e))&&t}(s,n,r)?ss(s):_i(0);let u=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,c=i.width/o.x,h=i.height/o.y;if(s){const e=Pi(s),t=r&&$i(r)?Pi(r):r;let n=e,i=n.frameElement;for(;i&&r&&t!==n;){const e=rs(i),t=i.getBoundingClientRect(),r=qi(i),s=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;u*=e.x,l*=e.y,c*=e.x,h*=e.y,u+=s,l+=o,n=Pi(i),i=n.frameElement}}return ki({width:c,height:h,x:u,y:l})}function us(e){return as(Ui(e)).left+Ji(e).scrollLeft}function ls(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Pi(e),r=Ui(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,u=0;if(i){s=i.width,o=i.height;const e=Xi();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,u=i.offsetTop)}return{width:s,height:o,x:a,y:u}}(e,n);else if("document"===t)r=function(e){const t=Ui(e),n=Ji(e),r=e.ownerDocument.body,i=Ei(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ei(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+us(e);const a=-n.scrollTop;return"rtl"===qi(r).direction&&(o+=Ei(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}(Ui(e));else if($i(t))r=function(e,t){const n=as(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ji(e)?rs(e):_i(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:r*s.y}}(t,n);else{const n=ss(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return ki(r)}function cs(e,t){const n=Zi(e);return!(n===t||!$i(n)||Ki(n))&&("fixed"===qi(n).position||cs(n,t))}function hs(e,t,n){const r=ji(t),i=Ui(t),s="fixed"===n,o=as(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=_i(0);if(r||!r&&!s)if(("body"!==Bi(t)||zi(i))&&(a=Ji(t)),r){const e=as(t,!0,s,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else i&&(u.x=us(i));return{x:o.left+a.scrollLeft-u.x,y:o.top+a.scrollTop-u.y,width:o.width,height:o.height}}function ds(e){return"static"===qi(e).position}function ps(e,t){return ji(e)&&"fixed"!==qi(e).position?t?t(e):e.offsetParent:null}function fs(e,t){const n=Pi(e);if(Gi(e))return n;if(!ji(e)){let t=Zi(e);for(;t&&!Ki(t);){if($i(t)&&!ds(t))return t;t=Zi(t)}return n}let r=ps(e,t);for(;r&&Vi(r)&&ds(r);)r=ps(r,t);return r&&Ki(r)&&ds(r)&&!Wi(r)?n:r||function(e){let t=Zi(e);for(;ji(t)&&!Ki(t);){if(Wi(t))return t;if(Gi(t))return null;t=Zi(t)}return null}(e)||n}const ms={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s="fixed"===i,o=Ui(r),a=!!t&&Gi(t.floating);if(r===o||a&&s)return n;let u={scrollLeft:0,scrollTop:0},l=_i(1);const c=_i(0),h=ji(r);if((h||!h&&!s)&&(("body"!==Bi(r)||zi(o))&&(u=Ji(r)),ji(r))){const e=as(r);l=rs(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+c.x,y:n.y*l.y-u.scrollTop*l.y+c.y}},getDocumentElement:Ui,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s="clippingAncestors"===n?Gi(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=es(e,[],!1).filter((e=>$i(e)&&"body"!==Bi(e))),i=null;const s="fixed"===qi(e).position;let o=s?Zi(e):e;for(;$i(o)&&!Ki(o);){const t=qi(o),n=Wi(o);n||"fixed"!==t.position||(i=null),(s?!n&&!i:!n&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||zi(o)&&!n&&cs(e,o))?r=r.filter((e=>e!==o)):i=t,o=Zi(o)}return t.set(e,r),r}(t,this._c):[].concat(n),o=[...s,r],a=o[0],u=o.reduce(((e,n)=>{const r=ls(t,n,i);return e.top=Ei(r.top,e.top),e.right=mi(r.right,e.right),e.bottom=mi(r.bottom,e.bottom),e.left=Ei(r.left,e.left),e}),ls(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:fs,getElementRects:async function(e){const t=this.getOffsetParent||fs,n=this.getDimensions,r=await n(e.floating);return{reference:hs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ts(e);return{width:t,height:n}},getScale:rs,isElement:$i,isRTL:function(e){return"rtl"===qi(e).direction}};const Es=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,u=await async function(e,t){const{placement:n,platform:r,elements:i}=e,s=await(null==r.isRTL?void 0:r.isRTL(i.floating)),o=Si(n),a=Ci(n),u="y"===Ii(n),l=["left","top"].includes(o)?-1:1,c=s&&u?-1:1,h=Oi(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:f}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&"number"==typeof f&&(p="end"===a?-1*f:f),u?{x:p*c,y:d*l}:{x:d*l,y:p*c}}(t,e);return o===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},gs=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=Oi(e,t),l={x:n,y:r},c=await Mi(t,u),h=Ii(Si(i)),d=yi(h);let p=l[d],f=l[h];if(s){const e="y"===d?"bottom":"right";p=Ti(p+c["y"===d?"top":"left"],p,p-c[e])}if(o){const e="y"===h?"bottom":"right";f=Ti(f+c["y"===h?"top":"left"],f,f-c[e])}const m=a.fn({...t,[d]:p,[h]:f});return{...m,data:{x:m.x-n,y:m.y-r}}}}},As=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:u,elements:l}=t,{mainAxis:c=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...E}=Oi(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const g=Si(i),A=Ii(a),_=Si(a)===a,D=await(null==u.isRTL?void 0:u.isRTL(l.floating)),v=d||(_||!m?[wi(a)]:function(e){const t=wi(e);return[Ri(e),t,Ri(t)]}(a)),T="none"!==f;!d&&T&&v.push(...function(e,t,n,r){const i=Ci(e);let s=function(e,t,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?s:o;default:return[]}}(Si(e),"start"===n,r);return i&&(s=s.map((e=>e+"-"+i)),t&&(s=s.concat(s.map(Ri)))),s}(a,m,f,D));const O=[a,...v],S=await Mi(t,E),C=[];let y=(null==(r=s.flip)?void 0:r.overflows)||[];if(c&&C.push(S[g]),h){const e=function(e,t,n){void 0===n&&(n=!1);const r=Ci(e),i=bi(e),s=Ni(i);let o="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=wi(o)),[o,wi(o)]}(i,o,D);C.push(S[e[0]],S[e[1]])}if(y=[...y,{placement:i,overflows:C}],!C.every((e=>e<=0))){var N,I;const e=((null==(N=s.flip)?void 0:N.index)||0)+1,t=O[e];if(t)return{data:{index:e,overflows:y},reset:{placement:t}};let n=null==(I=y.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:I.placement;if(!n)switch(p){case"bestFit":{var b;const e=null==(b=y.filter((e=>{if(T){const t=Ii(e.placement);return t===A||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:b[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},_s=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Oi(e,t);switch(r){case"referenceHidden":{const e=Fi(await Mi(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xi(e)}}}case"escaped":{const e=Fi(await Mi(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xi(e)}}}default:return{}}}}};function Ds({conversation$:e,message$:t,currentUser$:n,t$:r,scrollableParentRef:i,onScrollOutOfView:s,controller:o,theme:a,themeCustom:u}){const l=le(null),c=hi();return ni((e=>{const r=l.current,o=i.current;if(!r||!o)return;const a=t.id.get();if(!a)return;const u=c.messageToMessageActionMenuAnchorMap.get(a);if(!u)return;r.style.zIndex="2",r.style.width="max-content",r.style.position="absolute",r.style.top="0",r.style.left="0";const h=function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:u=!1}=r,l=ns(e),c=i||s?[...l?es(l):[],...es(t)]:[];c.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)}));const h=l&&a?function(e,t){let n,r=null;const i=Ui(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function o(a,u){void 0===a&&(a=!1),void 0===u&&(u=1),s();const{left:l,top:c,width:h,height:d}=e.getBoundingClientRect();if(a||t(),!h||!d)return;const p={rootMargin:-Ai(c)+"px "+-Ai(i.clientWidth-(l+h))+"px "+-Ai(i.clientHeight-(c+d))+"px "+-Ai(l)+"px",threshold:Ei(0,mi(1,u))||1};let f=!0;function m(e){const t=e[0].intersectionRatio;if(t!==u){if(!f)return o();t?o(!1,t):n=setTimeout((()=>{o(!1,1e-7)}),1e3)}f=!1}try{r=new IntersectionObserver(m,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(m,p)}r.observe(e)}(!0),s}(l,n):null;let d,p=-1,f=null;o&&(f=new ResizeObserver((e=>{let[r]=e;r&&r.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=f)||e.observe(t)}))),n()})),l&&!u&&f.observe(l),f.observe(t));let m=u?as(e):null;return u&&function t(){const r=as(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach((e=>{i&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)})),null==h||h(),null==(e=f)||e.disconnect(),f=null,u&&cancelAnimationFrame(d)}}(u,r,(()=>{((e,t,n)=>{const r=new Map,i={platform:ms,...n},s={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),u=await(null==o.isRTL?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:h}=Li(l,r,u),d=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:n,fn:s}=a[m],{x:E,y:g,data:A,reset:_}=await s({x:c,y:h,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});c=null!=E?E:c,h=null!=g?g:h,p={...p,[n]:{...p[n],...A}},_&&f<=50&&(f++,"object"==typeof _&&(_.placement&&(d=_.placement),_.rects&&(l=!0===_.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):_.rects),({x:c,y:h}=Li(l,d,u))),m=-1)}return{x:c,y:h,placement:d,strategy:i,middlewareData:p}})(e,t,{...i,platform:s})})(u,r,{placement:n.id.peek()===t.sender.id.peek()?"bottom-end":"bottom-start",middleware:[Es(6),As({boundary:o}),gs({padding:5,boundary:o}),_s({padding:5})]}).then((({x:e,y:t,middlewareData:n})=>{n.hide?.referenceHidden?s():(r.style.left=`${e}px`,r.style.top=`${t}px`)}))}));e.onCleanup=h})),It("div",{className:"t-message-action-menu-wrapper",ref:l,"t-message-action-menu-keep-open":"true",children:It(a.MessageActionMenu,{currentUser:n.get(),permissions:c.messagePermissions$(t.get()).get(),t:r.get(),chatbox:o,message:t.get(),conversation:e.get(),themeCustom:u})})}function vs(e){const t=le(),n=ai(),r=hi();return ae((()=>{if(t.current)return t.current.setAttribute("t-message-action-menu-keep-open","true"),r.messageToMessageActionMenuAnchorMap.set(e.message.id,t.current),()=>{r.messageToMessageActionMenuAnchorMap.delete(e.message.id)}}),[r,e.message.id]),It(n.Message,{...e,messageActionMenuAnchorRef:t})}class Ts{constructor(e={}){this._handlers=new Set,this._meta=e}meta(e){return new Ts(e)}_emit(e,t){for(const n of this._handlers)n({level:e,data:t,timestamp:Date.now(),meta:this._meta})}error(...e){return this._emit("error",e)}warn(...e){return this._emit("warn",e)}info(...e){return this._emit("info",e)}log(...e){return this._emit("log",e)}trace(...e){return this._emit("trace",e)}registerHandler(e){return this._handlers.add(e),()=>this._handlers.delete(e)}}const Os=new Ts,Ss=new Ts,Cs={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:e=>`${e} 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:(e,t)=>`Replying to ${e}: ${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"}},ys={code:"ar",name:"Arabic",translation:{YESTERDAY:"الأمس",TODAY:"اليوم",DAYS:"يوم",HOURS:"ساعة",MINUTES:"دقيقة",JUST_NOW:"فقط الآن",LOCATION:"الموقع",CANCEL:"إلغاء",INBOX:"علبة الوارد",DESKTOP_NOTIFICATIONS:"إشعارات المتصفح",DESKTOP_NOTIFICATIONS_ERROR:"لا يمكن تمكين إشعارات المتصفح لأن متصفحك يمنعها بشكل نشط. جرّب البحث في الإعدادات أو استخدام متصفح آخر.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:e=>`إعلام ${e} التجريبي`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ns={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:e=>`${e} демо известие`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Is={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},bs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Rs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ws={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ks={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:e=>`${e} Δοκιμαστική επίδειξη`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ls={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Fs={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:e=>`نوتیفیکیشن دمو ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},xs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Bs={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:e=>`Notification de démonstration ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ps={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:e=>`${e} הודעה על הדגמה`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Us={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:e=>`${e} डेमो अधिसूचना`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Hs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},$s={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},js={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:e=>`pemberitahuan demo ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ys={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},zs={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:e=>`${e} デモ通知`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Vs={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:e=>`${e} შეტყობინებების დემო ვერსია`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Gs={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:e=>`${e} 데모 알림`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Xs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ks={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},qs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Js={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:e=>`Notificare de debit ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Zs={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:e=>`${e} демо-оповещение`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Qs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},eo={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},to={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},no={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:e=>`Демо-повідомлення про ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ro={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},io={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:e=>`${e} 演示提醒`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},so={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:e=>`${e} 演示通知`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},oo={ar:ys,bg:Ns,bs:Is,ca:{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:e=>`Notificació de demostració de ${e}`,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:(e,t)=>`Responent a ${e}: ${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:bs,da:Rs,de:ws,el:ks,en:Cs,es:Ls,et:Ms,fa:Fs,fi:xs,fr:Bs,he:Ps,hi:Us,hr:Hs,hu:$s,id:js,is:{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:e=>`${e} 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:(e,t)=>`Svara ${e}: ${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"}},it:Ys,ja:zs,ka:Vs,ko:Gs,nb:Ws,nl:Xs,pl:Ks,pt:qs,ro:Js,ru:Zs,sq:Qs,sr:{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:e=>`${e} 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:(e,t)=>`Odgovarate korisniku ${e}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Izađi iz moda pisanja odgovora",STATUS_INDICATOR_ONLINE:"Aktivan",STATUS_INDICATOR_OFFLINE:"Neaktivan"}},sv:eo,tr:to,uk:no,vi:ro,zh:io,zhTw:so},ao={canReplyToMessage:!1,canDeleteMessage:!1};class uo{constructor(){this.messageSubscription=null,this.readyForNewMessagesPromise=Promise.resolve(),this.participantSubscription=null,this.state$=yr({extUserId:null,extCurrentConversationId:null,appId:null,editor:{isEmpty:!0,isTyping:!1,atTextLimit:!1,characterCount:0},referencedMessageId:null,currentUser:null,currentConversation:null,app:null,errors:{unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1},messages:{},participants:{},typing:{},ephemeralMessages:{},ephemeralMessageIdMapping:{},localFileBlobUrls:{},activeMessageActionMenu:null,authTokenState:"idle",userPermissions:()=>{const e=this.state$.app.role.general.get(),t=this.state$.app.role.permissions.get();return si.defined(e),si.defined(t),{showTypingIndicator:e.showTypingIndicators,canShareFile:e.enableFileTransfers,canShareLocation:e.enableLocation,canMention:e.enableMentions,showOnlineStatus:!1!==e.enablePresence,canSendVoiceMessage:e.enableVoiceRecording,canLeaveConversation:"all"===t.conversations.leave,canMarkConversationAsUnread:"all"===t.conversations.markAsUnread}},messagePermissions:()=>{const e=this.state$.app.role.permissions.get();si.defined(e);const t=this.state$.userPermissions.get();return{system:{...ao,...t},own:{canReplyToMessage:lo(e.messages.reply,!0),canDeleteMessage:lo(e.messages.delete,!0),...t},other:{canReplyToMessage:lo(e.messages.reply,!1),canDeleteMessage:lo(e.messages.delete,!1),...t}}},themeCustom:gn({value:void 0})}),this.messageToMessageActionMenuAnchorMap=new Map,this.locale$=yr((()=>{const e=this.state$.extUserId.get(),t=this.state$.app.appMetadata.defaultLocale.get(),n=this.state$.currentUser.locale.get();return(e&&n)??t??"en-US"})),this.t$=yr((()=>function(e){const t=e.replace(/_/g,"-").toLowerCase(),n=oo[t];if(n)return{...n.translation,locale:t};const r=t.slice(0,2),i=oo[r];return i?{...i.translation,locale:r}:(Ss.warn(`User locale '${e}' not supported; falling back to English.`),{...Cs.translation,locale:"en-US"})}(this.locale$.get()))),this.referencedMessage$=yr((()=>{const e=this.state$.extCurrentConversationId.get(),t=this.state$.referencedMessageId.get();return e&&t?this.state$.messages.child(e).lookup.child(t).get():null})),this.chatItems$=yr((()=>{const e=this.state$.extCurrentConversationId.get();if(!e)return[];const t=this.state$.currentConversation.readUntil.get(),n=this.state$.messages.child(e).state.get()??[],r=Object.values(this.state$.ephemeralMessages.child(e).get()??{}),i=0===r.length?n:r.concat(n).sort(((e,t)=>t.createdAt-e.createdAt)),s=i.map((t=>{const n=t.content[0],r=n?.type;if(!n||"file"!==r)return t;const i=n.size+","+n.filename,s=this.state$.localFileBlobUrls.child(e).child(i).url.get();return s?{...t,content:[{...n,url:s}]}:t}));let o=null,a=0,u=!1;const l=[];for(const c of s){const e=new Date(c.createdAt),n=new Date(e).setHours(0,0,0,0),r=a&&n!==a,i=e.getTime()>t,s=!(!u||i||o?.id.startsWith("ephemeral"));(s||r)&&l.push(new co({id:"border-before-"+c.id,isDayMarker:!!r,isReadMarker:!!s,timestamp:r?a:void 0})),l.push(c),u=i,a=n,o=c}return function(e,t){const n=[];let r=[];const i=Symbol("NO_KEY");let s=i;for(const o of e){const e=t(o);s===i||s===e?r.push(o):(n.push(r),r=[o]),s=e}return 0!==r.length&&n.push(r),n}(l,(e=>e instanceof co?e.id:e.sender?.id)).map((e=>(e.id=e.map((e=>e.id)).join(","),e)))}))}resetState(e,t,n){this.state$.assign({activeMessageActionMenu:null,referencedMessageId:null,errors:{unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1},extUserId:t,extCurrentConversationId:n,appId:e,currentUser:null,currentConversation:null})}storeTyping(e,t){this.state$.typing.child(e).set(t)}userPermissions$(){return this.state$.userPermissions}messagePermissions$(e){const t=this.state$.currentUser.get();if(!t)throw new Error("Unreachable");return e.sender?t.id===e.sender.id?this.state$.messagePermissions.own:this.state$.messagePermissions.other:this.state$.messagePermissions.system}storeMessages(e,t,n){!function(e){xn();try{e()}finally{Bn()}}((()=>{const r=t.reduce(((e,t)=>(e[t.id]=t,e)),{}),i=this.state$.extCurrentConversationId.peek(),s=this.state$.extUserId.peek();si(s&&i),this.state$.messages.child(e).set({state:t,lookup:r,loadedAll:n});const o=this.state$.activeMessageActionMenu.peek();o&&!r[o]&&this.state$.activeMessageActionMenu.set(null);const a=this.state$.ephemeralMessages.child(e);for(const n of t){const t=this.state$.ephemeralMessageIdMapping.child(e).child(n.id).peek();t&&a.child(t).delete();const r=n.content[0];if(n.sender?.id!==s||"file"!==r.type)continue;const o=r.size+","+r.filename,u=this.state$.localFileBlobUrls.child(i).child(o);if(!1!==u.fetching.peek())continue;const l=()=>u.delete();if("image"===r.subtype){u.fetching.set(!0);const e=document.createElement("img");e.addEventListener("load",l,{once:!0}),e.src=r.url}else if("video"===r.subtype){u.fetching.set(!0);const e=document.createElement("video");e.addEventListener("loaddata",l,{once:!0}),e.src=r.url}else if("audio"===r.subtype){u.fetching.set(!0);const e=document.createElement("audio");e.addEventListener("loaddata",l,{once:!0}),e.src=r.url}}}))}messageStatus(e){const t=this.state$.extCurrentConversationId.get(),n=this.state$.messages.child(t).lookup.child(e).get(),r=this.state$.ephemeralMessages.child(t).child(e).get();if(si(n||r,"Message ID should be present in the store"),n){const e=this.state$.currentConversation.everyoneReadUntil.peek();return n.createdAt<=e?"everyoneRead":"sent"}return"sending"}}function lo(e,t){return"all"===e||"own"===e&&t||"other"===e&&!t}class co{constructor({id:e,isDayMarker:t,isReadMarker:n,timestamp:r}){this.id=e,this.isDayMarker=t,this.isReadMarker=n,this.timestamp=t?r:void 0}}function ho({extConversationId:e,controller:t}){const n=hi(),r=ai(),i=le(null),s=le(!0),o=ti((()=>{const t=n.state$.activeMessageActionMenu.get();return t&&n.state$.messages.child(e).lookup.child(t).get()}));ue((()=>{s.current=i.current.scrollTop>-30})),ae((()=>{s.current&&(i.current.scrollTop=0)}));const a=de((e=>{const t=e.currentTarget;t.scrollHeight-t.clientHeight+t.scrollTop<90&&n.messageSubscription&&n.messageSubscription.loadMore(10)}),[n.messageSubscription]),u=Yr(n.state$.typing.child(e));return It("div",{className:"t-message-list",ref:i,onScroll:a,children:[u&&It(r.MessageListFooter,{typing:u,t:n.t$.get(),conversation:n.state$.currentConversation.get(),currentUser:n.state$.currentUser.get(),participants:n.state$.participants.child(e).get(),chatbox:t,themeCustom:n.state$.themeCustom.get().value}),It(Jr,{each:n.chatItems$,children:n=>It("div",{className:"t-message-group",children:It(Jr,{each:n,item:po,itemProps:{controller:t,extConversationId:e}})})}),It(ei,{if:o,children:()=>It(Ds,{currentUser$:n.state$.currentUser,message$:o,conversation$:n.state$.currentConversation,scrollableParentRef:i,t$:n.t$,onScrollOutOfView:()=>n.state$.activeMessageActionMenu.set(null),controller:t,theme:r,themeCustom:n.state$.themeCustom.get().value})})]})}function po({item$:e,controller:t,extConversationId:n}){const r=ai(),i=hi(),s=Yr(e);return It(zr,s instanceof co?{children:()=>It(r.MessageDivider,{timestamp:s.timestamp,isReadMarker:s.isReadMarker,isDayMarker:s.isDayMarker,app:i.state$.app.appMetadata.get(),currentUser:i.state$.currentUser.get(),conversation:i.state$.currentConversation.get(),t:i.t$.get(),themeCustom:i.state$.themeCustom.get().value})}:{children:()=>It(vs,{app:i.state$.app.appMetadata.get(),currentUser:i.state$.currentUser.get(),message:s,messageStatus:i.messageStatus(s.id),conversation:i.state$.currentConversation.get(),participants:i.state$.participants.child(n).get(),t:i.t$.get(),permissions:i.messagePermissions$(s).get(),chatbox:t,themeCustom:i.state$.themeCustom.get().value})})}function fo(){const e=hi(),t=ai(),n=Yr(e.t$),r=Yr(e.state$.themeCustom).value;return It(t.Icon,{type:"spinner","aria-label":n.LOADING,className:"t-loading-icon",themeCustom:r})}const mo=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function Eo({appId:e,chatboxState:t}){const n="t"===e.charAt(0)||mo.has(e);return ae((()=>{switch(t.type){case"auth-failed":Ss.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":Ss.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":Ss.error(t.error);break;case"wrong-app-id":Ss.error(`Could not find given appId: "${t.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:si.never(t)}}),[t]),It("div",{className:"t-panel t-error-panel",children:[It("span",{className:"t-heading",children:"Something went wrong."}),It("p",{children:"Please reload the page and try again."}),It("p",n?{style:{fontStyle:"italic"},children:["Developer note: check your browser's developer tools console for messages that may help solve the problem.",It("br",{}),It("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 go({t:e}){return It("div",{className:"t-panel t-error-panel",children:It("span",{className:"t-heading",style:{fontStyle:"italic"},children:e.CHAT_NOT_FOUND})})}function Ao(){return It("div",{className:"t-panel t-loading-panel",children:It(fo,{})})}function _o({t:e}){return It("div",{className:"t-panel t-error-panel",children:[It("span",{className:"t-heading",style:{fontStyle:"italic"},children:e.AUTH_EXPIRED_OVERLAY_TITLE}),It("p",{children:e.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}function Do(e){this.content=e}function vo(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),s=t.child(r);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let e=0;i.text[e]==s.text[e];e++)n++;return n}if(i.content.size||s.content.size){let e=vo(i.content,s.content,n+1);if(null!=e)return e}n+=i.nodeSize}else n+=i.nodeSize}}function To(e,t,n,r){for(let i=e.childCount,s=t.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:r};let o=e.child(--i),a=t.child(--s),u=o.nodeSize;if(o!=a){if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let e=0,t=Math.min(o.text.length,a.text.length);for(;e<t&&o.text[o.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let e=To(o.content,a.content,n-1,r-1);if(e)return e}n-=u,r-=u}else n-=u,r-=u}}Do.prototype={constructor:Do,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new Do(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Do(n)},addToStart:function(e,t){return new Do([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Do(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(-1==s?i.length:s,0,t,n),new Do(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Do.from(e)).size?new Do(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Do.from(e)).size?new Do(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Do.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},Do.from=function(e){if(e instanceof Do)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Do(t)};class Oo{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,i){for(let s=0,o=0;o<t;s++){let a=this.content[s],u=o+a.nodeSize;if(u>e&&!1!==n(a,r+o,i||null,s)&&a.content.size){let i=o+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",s=!0;return this.nodesBetween(e,t,((o,a)=>{let u=o.isText?o.text.slice(Math.max(e,a)-a,t-a):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=u}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Oo(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let o=this.content[i],a=s+o.nodeSize;a>e&&((s<e||a>t)&&(o=o.isText?o.cut(Math.max(0,e-s),Math.min(o.text.length,t-s)):o.cut(Math.max(0,e-s-1),Math.min(o.content.size,t-s-1))),n.push(o),r+=o.nodeSize),s=a}return new Oo(n,r)}cutByIndex(e,t){return e==t?Oo.empty:0==e&&t==this.content.length?this:new Oo(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Oo(r,i)}addToStart(e){return new Oo([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oo(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return vo(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return To(this,e,t,n)}findIndex(e,t=-1){if(0==e)return Co(0,e);if(e==this.size)return Co(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=r+this.child(n).nodeSize;if(i>=e)return i==e||t>0?Co(n+1,i):Co(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Oo.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oo(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oo.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Oo(t||e,n)}static from(e){if(!e)return Oo.empty;if(e instanceof Oo)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oo([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oo.empty=new Oo([],0);const So={index:0,offset:0};function Co(e,t){return So.index=e,So.offset=t,So}function yo(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!yo(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!yo(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class No{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&yo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return No.none;if(e instanceof No)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}No.none=[];class Io extends Error{}class bo{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=wo(this.content,e+this.openStart,t);return n&&new bo(n,this.openStart,this.openEnd)}removeBetween(e,t){return new bo(Ro(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return bo.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new bo(Oo.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)n++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new bo(e,n,r)}}function Ro(e,t,n){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r),{index:o,offset:a}=e.findIndex(n);if(i==t||s.isText){if(a!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(Ro(s.content,t-i-1,n-i-1)))}function wo(e,t,n,r){let{index:i,offset:s}=e.findIndex(t),o=e.maybeChild(i);if(s==t||o.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=wo(o.content,t-s-1,n);return a&&e.replaceChild(i,o.copy(a))}function ko(e,t,n){if(n.openStart>e.depth)throw new Io("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Io("Inconsistent open depths");return Lo(e,t,n,0)}function Lo(e,t,n,r){let i=e.index(r),s=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Lo(e,t,n,r+1);return s.copy(s.content.replaceChild(i,o))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:i,end:o}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)r=t.node(i).copy(Oo.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Po(s,Uo(e,i,o,t,r))}{let r=e.parent,i=r.content;return Po(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}}return Po(s,Ho(e,t,r))}function Mo(e,t){if(!t.type.compatibleContent(e.type))throw new Io("Cannot join "+t.type.name+" onto "+e.type.name)}function Fo(e,t,n){let r=e.node(n);return Mo(r,t.node(n)),r}function xo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Bo(e,t,n,r){let i=(t||e).node(n),s=0,o=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(xo(e.nodeAfter,r),s++));for(let a=s;a<o;a++)xo(i.child(a),r);t&&t.depth==n&&t.textOffset&&xo(t.nodeBefore,r)}function Po(e,t){return e.type.checkContent(t),e.copy(t)}function Uo(e,t,n,r,i){let s=e.depth>i&&Fo(e,t,i+1),o=r.depth>i&&Fo(n,r,i+1),a=[];return Bo(null,e,i,a),s&&o&&t.index(i)==n.index(i)?(Mo(s,o),xo(Po(s,Uo(e,t,n,r,i+1)),a)):(s&&xo(Po(s,Ho(e,t,i+1)),a),Bo(t,n,i,a),o&&xo(Po(o,Ho(n,r,i+1)),a)),Bo(r,null,i,a),new Oo(a)}function Ho(e,t,n){let r=[];return Bo(null,e,n,r),e.depth>n&&xo(Po(Fo(e,t,n+1),Ho(e,t,n+1)),r),Bo(t,null,n,r),new Oo(r)}bo.empty=new bo(Oo.empty,0,0);class $o{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let i=0;i<e;i++)r+=n.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return No.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Vo(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let s=e;;){let{index:e,offset:t}=s.content.findIndex(i),o=i-t;if(n.push(s,e,r+t),!o)break;if(s=s.child(e),s.isText)break;i=o-1,r+=t+1}return new $o(t,n,i)}static resolveCached(e,t){for(let r=0;r<jo.length;r++){let n=jo[r];if(n.pos==t&&n.doc==e)return n}let n=jo[Yo]=$o.resolve(e,t);return Yo=(Yo+1)%zo,n}}let jo=[],Yo=0,zo=12;class Vo{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 Go=Object.create(null);let Wo=class e{constructor(e,t,n,r=No.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Oo.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&yo(this.attrs,t||e.defaultAttrs||Go)&&No.sameSet(this.marks,n||No.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return bo.empty;let r=this.resolve(e),i=this.resolve(t),s=n?0:r.sharedDepth(t),o=r.start(s),a=r.node(s).content.cut(r.pos-o,i.pos-o);return new bo(a,r.depth-s,i.depth-s)}replace(e,t,n){return ko(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return $o.resolveCached(this,e)}resolveNoCache(e){return $o.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ko(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Oo.empty,r=0,i=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),s=i&&i.matchFragment(this.content,t);return!!s&&s.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=No.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!No.sameSet(e,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 e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Oo.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};Wo.prototype.text=void 0;class Xo extends Wo{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ko(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xo(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ko(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class qo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Jo(e,t);if(null==n.next)return qo.empty;let r=Zo(n);n.next&&n.err("Unexpected trailing text");let i=function(e){let t=Object.create(null);return function n(r){let i=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);ia(e,n).forEach((e=>{r||i.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let s=t[r.join(",")]=new qo(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(ra);s.next.push({type:i[e][0],next:t[r.join(",")]||n(r)})}return s}(ia(e,0))}(function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,s))),[]);if("seq"!=t.type){if("star"==t.type){let o=n();return r(s,o),i(e(t.expr,o),o),[r(o)]}if("plus"==t.type){let o=n();return i(e(t.expr,s),o),i(e(t.expr,o),o),[r(o)]}if("opt"==t.type)return[r(s)].concat(e(t.expr,s));if("range"==t.type){let o=s;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,o),r),o=r}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=n();r(o,s),i(e(t.expr,o),s),o=s}return[r(o)]}if("name"==t.type)return[r(s,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let o=e(t.exprs[r],s);if(r==t.exprs.length-1)return o;i(o,s=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];s.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(s,o){let a=s.matchFragment(e,n);if(a&&(!t||a.validEnd))return Oo.from(o.map((e=>e.createAndFill())));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let i=0;i<t.next.length;i++)r+=(i?", ":"")+t.next[i].type.name+"->"+e.indexOf(t.next[i].next);return r})).join("\n")}}qo.empty=new qo(!0);class Jo{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Zo(e){let t=[];do{t.push(Qo(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Qo(e){let t=[];do{t.push(ea(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function ea(e){let t=function(e){if(e.eat("(")){let t=Zo(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let s in n){let e=n[s];e.groups.indexOf(t)>-1&&i.push(e)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=na(e,t)}return t}function ta(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function na(e,t){let n=ta(e),r=n;return e.eat(",")&&(r="}"!=e.next?ta(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function ra(e,t){return t-e}function ia(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:s}=i[e];r||-1!=n.indexOf(s)||t(s)}}(t),n.sort(ra)}function sa(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function oa(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=t.default}n[r]=i}return n}function aa(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new la(e[n]);return t}let ua=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=aa(n.attrs),this.defaultAttrs=sa(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:oa(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wo(this,this.computeAttrs(e),Oo.from(t),No.setFrom(n))}createChecked(e=null,t,n){return t=Oo.from(t),this.checkContent(t),new Wo(this,this.computeAttrs(e),t,No.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Oo.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Oo.empty,!0);return i?new Wo(this,e,t.append(i),No.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:No.none:e}static compile(t,n){let r=Object.create(null);t.forEach(((t,i)=>r[t]=new e(t,n,i)));let i=n.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 e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class la{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ca{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=aa(r.attrs),this.excluded=null;let i=sa(this.attrs);this.instance=i?new No(this,i):null}create(e=null){return!e&&this.instance?this.instance:new No(this,oa(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,i)=>n[e]=new ca(e,r++,t,i))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}function ha(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],o=s;if(s)n.push(s);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class da{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new Aa(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Aa(this,t,!0);return n.addAll(e,t.from,t.to),bo.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(_a(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(!(0!=s.indexOf(e)||r.context&&!n.matchesContext(r.context)||s.length>e.length&&(61!=s.charCodeAt(e.length)||s.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach((e=>{n(e=Da(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)}))}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach((e=>{n(e=Da(e)),e.node||e.ignore||e.mark||(e.node=r)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new da(e,da.schemaRules(e)))}}const pa={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},fa={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ma={ol:!0,ul:!0};function Ea(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ga{constructor(e,t,n,r,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=No.none,this.stashMarks=[],this.match=s||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Oo.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Oo.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Oo.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):va(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Aa{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,i=t.topNode,s=Ea(null,t.preserveWhitespace,0)|(n?4:0);r=i?new ga(i.type,i.attrs,No.none,No.none,!0,t.topMatch||i.type.contentMatch,s):new ga(n?null:e.schema.topNodeType,null,No.none,No.none,!0,null,s),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){3==e.nodeType?this.addTextNode(e):1==e.nodeType&&this.addElement(e)}withStyleRules(e,t){let n=e.getAttribute("style");if(!n)return t();let r=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(n));if(!r)return;let[i,s]=r,o=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],o);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);t();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],o);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],i=e.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ma.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ma.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(i?i.ignore:fa.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let t,n=this.top,s=this.needsBlock;if(pa.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);i&&i.skip?this.addAll(e):this.withStyleRules(e,(()=>this.addAll(e))),t&&this.sync(n),this.needsBlock=s}else this.withStyleRules(e,(()=>{this.addElementByRule(e,i,!1===i.consuming?n:void 0)}))}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=No.none,n=No.none;for(let r=0;r<e.length;r+=2)for(let i;;){let s=this.parser.matchStyle(e[r],e[r+1],this,i);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{s.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),!1!==s.consuming)break;i=s}return[t,n]}addElementByRule(e,t,n){let r,i,s;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):r=this.enter(i,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let o=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(o)&&this.open--,s&&this.removePendingMark(s,o)}addAll(e,t,n){let r=t||0;for(let i=t?e.childNodes[t]:e.firstChild,s=null==n?null:e.childNodes[n];i!=s;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let i=this.nodes[r],s=i.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,n=i,!s.length))break;if(i.solid)break}if(!t)return!1;this.sync(n);for(let r=0;r<t.length;r++)this.enterInner(t[r],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=Ea(e,r,i.options);4&i.options&&0==i.content.length&&(s|=4),this.nodes.push(new ga(e,t,i.activeMarks,i.pendingMarks,n,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));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(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),s=(e,o)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(s(e-1,o))return!0;return!1}{let e=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;o--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function _a(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Da(e){let t={};for(let n in e)t[n]=e[n];return t}function va(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let s=[],o=e=>{s.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t)return!0;if(s.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class Ta{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Sa(t).createDocumentFragment());let r=n,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let n=0,s=0;for(;n<i.length&&s<e.marks.length;){let t=e.marks[s];if(this.marks[t.type.name]){if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,s++}else s++}for(;n<i.length;)r=i.pop()[1];for(;s<e.marks.length;){let n=e.marks[s++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Ta.renderSpec(Sa(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ta.renderSpec(Sa(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,i=t[0],s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o=n?e.createElementNS(n,i):e.createElement(i),a=t[1],u=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){u=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?o.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):o.setAttribute(e,a[e])}}for(let l=u;l<t.length;l++){let i=t[l];if(0===i){if(l<t.length-1||l>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:o,contentDOM:o}}{let{dom:t,contentDOM:s}=Ta.renderSpec(e,i,n);if(o.appendChild(t),s){if(r)throw new RangeError("Multiple content holes");r=s}}}return{dom:o,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ta(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Oa(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Oa(e.marks)}}function Oa(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Sa(e){return e.document||window.document}const Ca=Math.pow(2,16);function ya(e,t){return e+t*Ca}function Na(e){return 65535&e}let Ia=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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}},ba=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Na(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ca}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:ya(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new Ia(i,h,s)}r+=l-u}return n?e+r:new Ia(e+r,0,null)}touches(e,t){let n=0,r=Na(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};ba.empty=new ba([]);let Ra=class e{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(t=0,n=this.maps.length){return new e(this.maps,this.mirror,t,n)}copy(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let i=this.from;i<this.to;i++){let n=this.maps[i].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(i);if(null!=t&&t>i&&t<this.to){i=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new Ia(e,r,null)}};const wa=Object.create(null);let ka=class{getMap(){return ba.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=wa[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in wa)throw new RangeError("Duplicate use of step JSON ID "+e);return wa[e]=t,t.prototype.jsonID=e,t}},La=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Io)return e.fail(t.message);throw t}}};function Ma(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(Ma(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}let Fa=class e extends ka{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo(Ma(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return La.fromReplace(e,this.from,this.to,i)}invert(){return new xa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ka.jsonID("addMark",Fa);let xa=class e extends ka{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo(Ma(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return La.fromReplace(e,this.from,this.to,n)}invert(){return new Fa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ka.jsonID("removeMark",xa);let Ba=class e extends ka{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Pa(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ka.jsonID("addNodeMark",Ba);let Pa=class e extends ka{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Ba(this.pos,this.mark):this}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ka.jsonID("removeNodeMark",Pa);let Ua=class e extends ka{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&$a(e,this.from,this.to)?La.fail("Structure replace would overwrite content"):La.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ba([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof e)||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 n=this.slice.size+t.slice.size==0?bo.empty:new bo(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}}{let n=this.slice.size+t.slice.size==0?bo.empty:new bo(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,bo.fromJSON(t,n.slice),!!n.structure)}};ka.jsonID("replace",Ua);let Ha=class e extends ka{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&($a(e,this.from,this.gapFrom)||$a(e,this.gapTo,this.to)))return La.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return La.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?La.fromReplace(e,this.from,this.to,n):La.fail("Content does not fit in gap")}getMap(){return new ba([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),s=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new e(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,bo.fromJSON(t,n.slice),n.insert,!!n.structure)}};function $a(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ja(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ka.jsonID("replaceAround",Ha);let Ya=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Oo.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Oo.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new bo(i,s,o);return e>-1?new Ha(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Ua(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ga(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let s=this.depth;s>=0;s--){let e,{type:o,match:a}=this.frontier[s],u=null;if(1==t&&(i?a.matchType(i.type)||(u=a.fillBefore(Oo.from(i),!1)):r&&o.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:s,parent:r,inject:u};if(2==t&&i&&(e=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:s,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ga(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new bo(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ga(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new bo(za(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new bo(za(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,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 s=this.unplaced,o=n?n.content:s.content,a=s.openStart-e,u=0,l=[],{match:c,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));c=c.matchFragment(r)}let d=o.size+e-(s.content.size-s.openEnd);for(;u<o.childCount;){let e=o.child(u),t=c.matchType(e.type);if(!t)break;u++,(u>1||0==a||e.content.size)&&(c=t,l.push(Wa(e.mark(h.allowedMarks(e.marks)),1==u?a:0,u==o.childCount?d:-1)))}let p=u==o.childCount;p||(d=-1),this.placed=Va(this.placed,t,Oo.from(l)),this.frontier[t].match=c,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=o;f<d;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?bo.empty:new bo(za(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new bo(za(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Xa(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Xa(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Xa(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Va(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Va(this.placed,this.depth,Oo.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Oo.empty,!0);e.childCount&&(this.placed=Va(this.placed,this.frontier.length,e))}};function za(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(za(e.firstChild.content,t-1,n)))}function Va(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Va(e.lastChild.content,t-1,n)))}function Ga(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Wa(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Wa(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Oo.empty,!0)))),e.copy(r)}function Xa(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,s.content,o)?a:null}function Ka(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Ka(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Oo.empty,!0))}return e}function qa(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}let Ja=class e extends ka{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return ba.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}};ka.jsonID("attr",Ja);let Za=class e extends ka{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return La.ok(n)}getMap(){return ba.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}};ka.jsonID("docAttr",Za);let Qa=class extends Error{};Qa=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Qa.prototype=Object.create(Error.prototype)).constructor=Qa,Qa.prototype.name="TransformError";class eu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ra}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Qa(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=bo.empty){let r=function(e,t,n=t,r=bo.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return ja(i,s,r)?new Ua(t,n,r):new Ya(i,s,r).fit()}(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new bo(Oo.from(n),0,0))}delete(e,t){return this.replace(e,t,bo.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(ja(i,s,r))return e.step(new Ua(t,n,r));let o=qa(i,e.doc.resolve(n));0==o[o.length-1]&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let p=i.depth,f=i.pos-1;p>0;p--,f--){let e=i.node(p).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;o.indexOf(p)>-1?a=p:i.before(p)==f&&o.splice(1,0,-p)}let u=o.indexOf(a),l=[],c=r.openStart;for(let p=r.content,f=0;;f++){let e=p.firstChild;if(l.push(e),f==r.openStart)break;p=e.content}for(let p=c-1;p>=0;p--){let e=l[p],t=(h=e.type).spec.defining||h.spec.definingForContent;if(t&&!e.sameMarkup(i.node(Math.abs(a)-1)))c=p;else if(t||!e.type.isTextblock)break}var h;for(let p=r.openStart;p>=0;p--){let t=(p+c+1)%(r.openStart+1),a=l[t];if(a)for(let l=0;l<o.length;l++){let c=o[(l+u)%o.length],h=!0;c<0&&(h=!1,c=-c);let d=i.node(c-1),p=i.index(c-1);if(d.canReplaceWith(p,p,a.type,a.marks))return e.replace(i.before(c),h?s.after(c):n,new bo(Ka(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let p=o.length-1;p>=0&&(e.replace(t,n,r),!(e.steps.length>d));p--){let e=o[p];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let i=r.depth-1;i>=0;i--){let e=r.index(i);if(r.node(i).canReplaceWith(e,e,n))return r.before(i+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let e=r.indexAfter(i);if(r.node(i).canReplaceWith(e,e,n))return r.after(i+1);if(e<r.node(i).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new bo(Oo.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),s=qa(r,i);for(let o=0;o<s.length;o++){let t=s[o],n=o==s.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),i.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),i.indexAfter(t-1))))return e.delete(r.before(t),i.after(t))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:i,depth:s}=t,o=r.before(s+1),a=i.after(s+1),u=o,l=a,c=Oo.empty,h=0;for(let f=s,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=Oo.from(r.node(f).copy(c)),h++):u--;let d=Oo.empty,p=0;for(let f=s,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,d=Oo.from(i.node(f).copy(d)),p++):l++;e.step(new Ha(u,l,o,a,new bo(c.append(d),h,p),c.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=new Ua(t-n,t+n,bo.empty,!0);e.step(r)}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Oo.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let e=n[o].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Oo.from(n[o].type.create(n[o].attrs,r))}let i=t.start,s=t.end;e.step(new Ha(i,s,i,s,new bo(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(r,i)&&function(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(s).map(n),r)){e.clearIncompatible(e.mapping.slice(s).map(n,1),r);let o=e.mapping.slice(s),a=o.map(n,1),u=o.map(n+t.nodeSize,1);return e.step(new Ha(a,u,a+1,u-1,new bo(Oo.from(r.create(i,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Ha(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new bo(Oo.from(o),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ja(e,t,n)),this}setDocAttribute(e,t){return this.step(new Za(e,t)),this}addNodeMark(e,t){return this.step(new Ba(e,t)),this}removeNodeMark(e,t){if(!(t instanceof No)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new Pa(e,t)),this}split(e,t=1,n){return function(e,t,n=1,r){let i=e.doc.resolve(t),s=Oo.empty,o=Oo.empty;for(let a=i.depth,u=i.depth-n,l=n-1;a>u;a--,l--){s=Oo.from(i.node(a).copy(s));let e=r&&r[l];o=Oo.from(e?e.type.create(e.attrs,o):i.node(a).copy(o))}e.step(new Ua(t,t,new bo(s.append(o),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let i,s,o=[],a=[];e.doc.nodesBetween(t,n,((e,u,l)=>{if(!e.isInline)return;let c=e.marks;if(!r.isInSet(c)&&l.type.allowsMarkType(r.type)){let l=Math.max(u,t),h=Math.min(u+e.nodeSize,n),d=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(d)||(i&&i.to==l&&i.mark.eq(c[e])?i.to=h:o.push(i=new xa(l,h,c[e])));s&&s.to==l?s.to=h:a.push(s=new Fa(l,h,r))}})),o.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let i=[],s=0;e.doc.nodesBetween(t,n,((e,o)=>{if(!e.isInline)return;s++;let a=null;if(r instanceof ca){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,u=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&u.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:u,from:Math.max(o,t),to:r,step:s})}}})),i.forEach((t=>e.step(new xa(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,r=n.contentMatch){let i=e.doc.nodeAt(t),s=[],o=t+1;for(let a=0;a<i.childCount;a++){let t=i.child(a),u=o+t.nodeSize,l=r.matchType(t.type);if(l){r=l;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new xa(o,u,t.marks[r]));if(t.isText&&!n.spec.code){let e,r,i=/\r?\n|\r/g;for(;e=i.exec(t.text);)r||(r=new bo(Oo.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new Ua(o+e.index,o+e.index+e[0].length,r))}}else s.push(new Ua(o,u,bo.empty));o=u}if(!r.validEnd){let t=r.fillBefore(Oo.empty,!0);e.replace(o,o,new bo(t,0,0))}for(let a=s.length-1;a>=0;a--)e.step(s[a])}(this,e,t,n),this}}const tu=Object.create(null);class nu{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new ru(e.min(t),e.max(t))]}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 e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=bo.empty){let n=t.content.lastChild,r=null;for(let o=0;o<t.openEnd;o++)r=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:u}=s[o],l=e.mapping.slice(i);e.replaceRange(l.map(a.pos),l.map(u.pos),o?bo.empty:t),0==o&&pu(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],a=e.mapping.slice(n),u=a.map(s.pos),l=a.map(o.pos);i?e.deleteRange(u,l):(e.replaceRangeWith(u,l,t),pu(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new ou(e):du(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let i=e.depth-1;i>=0;i--){let r=t<0?du(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):du(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new cu(e.node(0))}static atStart(e){return du(e,e,0,0,1)||new cu(e)}static atEnd(e){return du(e,e,e.content.size,e.childCount,-1)||new cu(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=tu[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in tu)throw new RangeError("Duplicate use of selection JSON ID "+e);return tu[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ou.between(this.$anchor,this.$head).getBookmark()}}nu.prototype.visible=!0;class ru{constructor(e,t){this.$from=e,this.$to=t}}let iu=!1;function su(e){iu||e.parent.inlineContent||(iu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ou extends nu{constructor(e,t=e){su(e),su(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return nu.near(n);let r=e.resolve(t.map(this.anchor));return new ou(r.parent.inlineContent?r:n,n)}replace(e,t=bo.empty){if(super.replace(e,t),t==bo.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof ou&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new au(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new ou(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=nu.findFrom(t,n,!0)||nu.findFrom(t,-n,!0);if(!e)return nu.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(nu.findFrom(e,-n,!0)||nu.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new ou(e,t)}}nu.jsonID("text",ou);class au{constructor(e,t){this.anchor=e,this.head=t}map(e){return new au(e.map(this.anchor),e.map(this.head))}resolve(e){return ou.between(e.resolve(this.anchor),e.resolve(this.head))}}class uu extends nu{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?nu.near(i):new uu(i)}content(){return new bo(Oo.from(this.node),0,0)}eq(e){return e instanceof uu&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lu(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new uu(e.resolve(t.anchor))}static create(e,t){return new uu(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}uu.prototype.visible=!1,nu.jsonID("node",uu);class lu{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new au(n,n):new lu(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&uu.isSelectable(n)?new uu(t):nu.near(t)}}class cu extends nu{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=bo.empty){if(t==bo.empty){e.delete(0,e.doc.content.size);let t=nu.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new cu(e)}map(e){return new cu(e)}eq(e){return e instanceof cu}getBookmark(){return hu}}nu.jsonID("all",cu);const hu={map(){return this},resolve:e=>new cu(e)};function du(e,t,n,r,i,s=!1){if(t.inlineContent)return ou.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(r.isAtom){if(!s&&uu.isSelectable(r))return uu.create(e,n-(i<0?r.nodeSize:0))}else{let t=du(e,r,n+i,i<0?r.childCount:0,i,s);if(t)return t}n+=r.nodeSize*i}return null}function pu(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,s=e.steps[r];(s instanceof Ua||s instanceof Ha)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==i&&(i=r)})),e.setSelection(nu.near(e.doc.resolve(i),n)))}class fu extends eu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return No.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||No.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(nu.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function mu(e,t){return t&&e?e.bind(t):e}class Eu{constructor(e,t,n){this.name=e,this.init=mu(t.init,n),this.apply=mu(t.apply,n)}}const gu=[new Eu("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Eu("selection",{init:(e,t)=>e.selection||nu.atStart(t.doc),apply:e=>e.selection}),new Eu("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Eu("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class Au{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gu.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Eu(e.key,e.spec.state,e))}))}}class _u{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let a=r?r[s].n:0,u=r?r[s].state:this,l=a<t.length&&o.spec.appendTransaction.call(o,a?t.slice(a):t,u,n);if(l&&n.filterTransaction(l,s)){if(l.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<s?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[s]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new _u(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new fu(this)}static create(e){let t=new Au(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new _u(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new Au(this.schema,e.plugins),n=t.fields,r=new _u(t);for(let i=0;i<n.length;i++){let t=n[i].name;r[t]=this.hasOwnProperty(t)?this[t]:n[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Au(e.schema,e.plugins),i=new _u(r);return r.fields.forEach((r=>{if("doc"==r.name)i.doc=Wo.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=nu.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let s in n){let o=n[s],a=o.spec.state;if(o.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,s))return void(i[r.name]=a.fromJSON.call(o,e,t[s],i))}i[r.name]=r.init(e,i)}})),i}}function Du(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=Du(i,t,{})),n[r]=i}return n}class vu{constructor(e){this.spec=e,this.props={},e.props&&Du(e.props,this,this.props),this.key=e.key?e.key.key:Ou("plugin")}getState(e){return e[this.key]}}const Tu=Object.create(null);function Ou(e){return e in Tu?e+"$"+ ++Tu[e]:(Tu[e]=0,e+"$")}class Su{constructor(e="key"){this.key=Ou(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Cu=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},yu=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Nu=null;const Iu=function(e,t,n){let r=Nu||(Nu=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},bu=function(e,t,n,r){return n&&(wu(e,t,n,r,-1)||wu(e,t,n,r,1))},Ru=/^(img|br|input|textarea|hr)$/i;function wu(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ku(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Lu(e)||Ru.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Cu(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?ku(e):0}}}function ku(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Lu(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Mu=function(e){return e.focusNode&&bu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Fu(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const xu="undefined"!=typeof navigator?navigator:null,Bu="undefined"!=typeof document?document:null,Pu=xu&&xu.userAgent||"",Uu=/Edge\/(\d+)/.exec(Pu),Hu=/MSIE \d/.exec(Pu),$u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pu),ju=!!(Hu||$u||Uu),Yu=Hu?document.documentMode:$u?+$u[1]:Uu?+Uu[1]:0,zu=!ju&&/gecko\/(\d+)/i.test(Pu);zu&&(/Firefox\/(\d+)/.exec(Pu)||[0,0])[1];const Vu=!ju&&/Chrome\/(\d+)/.exec(Pu),Gu=!!Vu,Wu=Vu?+Vu[1]:0,Xu=!ju&&!!xu&&/Apple Computer/.test(xu.vendor),Ku=Xu&&(/Mobile\/\w+/.test(Pu)||!!xu&&xu.maxTouchPoints>2),qu=Ku||!!xu&&/Mac/.test(xu.platform),Ju=!!xu&&/Win/.test(xu.platform),Zu=/Android \d/.test(Pu),Qu=!!Bu&&"webkitFontSmoothing"in Bu.documentElement.style,el=Qu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tl(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function nl(e,t){return"number"==typeof e?e:e[t]}function rl(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function il(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let o=n||e.dom;o;o=yu(o)){if(1!=o.nodeType)continue;let e=o,n=e==s.body,a=n?tl(s):rl(e),u=0,l=0;if(t.top<a.top+nl(r,"top")?l=-(a.top-t.top+nl(i,"top")):t.bottom>a.bottom-nl(r,"bottom")&&(l=t.bottom-t.top>a.bottom-a.top?t.top+nl(i,"top")-a.top:t.bottom-a.bottom+nl(i,"bottom")),t.left<a.left+nl(r,"left")?u=-(a.left-t.left+nl(i,"left")):t.right>a.right-nl(r,"right")&&(u=t.right-a.right+nl(i,"right")),u||l)if(n)s.defaultView.scrollBy(u,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),u&&(e.scrollLeft+=u);let i=e.scrollLeft-n,s=e.scrollTop-r;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function sl(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=yu(r));return t}function ol(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let al=null;function ul(e,t){let n,r,i,s,o=2e8,a=0,u=t.top,l=t.top;for(let c=e.firstChild,h=0;c;c=c.nextSibling,h++){let e;if(1==c.nodeType)e=c.getClientRects();else{if(3!=c.nodeType)continue;e=Iu(c).getClientRects()}for(let d=0;d<e.length;d++){let p=e[d];if(p.top<=u&&p.bottom>=l){u=Math.max(p.bottom,u),l=Math.min(p.top,l);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<o){n=c,o=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==c.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=c,s={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&i&&(n=i,r=s,o=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let n=pl(r,1);if(n.top!=n.bottom&&ll(t,n))return{node:e,offset:i+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:e,offset:a}:ul(n,r)}function ll(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function cl(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let n=e.childNodes[s];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(ll(t,i))return cl(n,t,i)}}if((s=(s+1)%r)==i)break}return e}function hl(e,t){let n,r=e.dom.ownerDocument,i=0,s=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);s&&({node:n,offset:i}=s);let o,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!ll(t,n))return null;if(a=cl(e.dom,t,n),!a)return null}if(Xu)for(let l=a;n&&l;l=yu(l))l.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(zu&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let e,r=n.childNodes[i];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&i++}let r;Qu&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(o=function(e,t,n,r){let i=-1;for(let s=t,o=!1;s!=e.dom;){let t=e.docView.nearestDesc(s,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!o||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!o&&(o=!0,e.left>r.left||e.top>r.top?i=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(i=t.posAfter)),!t.contentDOM&&i<0&&!t.node.isText)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}s=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==o&&(o=function(e,t,n){let{node:r,offset:i}=ul(t,n),s=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();s=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}(e,a,t));let u=e.docView.nearestDesc(a,!0);return{pos:o,inside:u?u.posAtStart-u.border:-1}}function dl(e){return e.top<e.bottom||e.left<e.right}function pl(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(dl(e))return e}return Array.prototype.find.call(n,dl)||e.getBoundingClientRect()}const fl=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ml(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),o=Qu||zu;if(3==r.nodeType){if(!o||!fl.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let e=i,t=i,s=n<0?1:-1;return n<0&&!i?(t++,s=-1):n>=0&&i==r.nodeValue.length?(e--,s=1):n<0?e--:t++,El(pl(Iu(r,e,t),s),s<0)}{let e=pl(Iu(r,i,i),n);if(zu&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=pl(Iu(r,i-1,i-1),-1);if(t.top==e.top){let n=pl(Iu(r,i,i+1),-1);if(n.top!=e.top)return El(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==ku(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return gl(e.getBoundingClientRect(),!1)}if(null==s&&i<ku(r)){let e=r.childNodes[i];if(1==e.nodeType)return gl(e.getBoundingClientRect(),!0)}return gl(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==ku(r))){let e=r.childNodes[i-1],t=3==e.nodeType?Iu(e,ku(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return El(pl(t,1),!1)}if(null==s&&i<ku(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Iu(e,0,o?0:1):1==e.nodeType?e:null:null;if(t)return El(pl(t,-1),!0)}return El(pl(3==r.nodeType?Iu(r):r,-n),n>=0)}function El(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function gl(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Al(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}const _l=/[\u0590-\u08ac]/;let Dl=null,vl=null,Tl=!1;class Ol{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Cu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i,s=this.getDesc(r);if(s&&(!t||s.node)){if(!n||!(i=s.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return s;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let i=0;n<this.children.length;n++){let t=this.children[n],s=i+t.size;if(s>e||t instanceof Rl){r=e-i;break}i=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let i;n&&!(i=this.children[n-1]).size&&i instanceof Sl&&i.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Cu(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Cu(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=n,o=0;;o++){let n=this.children[o],a=s+n.size;if(-1==r&&e<=a){let i=s+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=s;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Cu(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||o==this.children.length-1)){t=a;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Cu(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,d=0;h<this.children.length;h++){let o=this.children[h],a=d+o.size;if(i>d&&s<a)return o.setSelection(e-d-o.border,t-d-o.border,n,r);d=a}let o=this.domFromPos(e,e?-1:1),a=t==e?o:this.domFromPos(t,t?-1:1),u=n.getSelection(),l=!1;if((zu||Xu)&&e==t){let{node:e,offset:t}=o;if(3==e.nodeType){if(l=!(!t||"\n"!=e.nodeValue[t-1]),l&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(o=a={node:n.parentNode,offset:Cu(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];l=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(zu&&u.focusNode&&u.focusNode!=a.node&&1==u.focusNode.nodeType){let e=u.focusNode.childNodes[u.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||l&&Xu)&&bu(o.node,o.offset,u.anchorNode,u.anchorOffset)&&bu(a.node,a.offset,u.focusNode,u.focusOffset))return;let c=!1;if((u.extend||e==t)&&!l){u.collapse(o.node,o.offset);try{e!=t&&u.extend(a.node,a.offset),c=!0}catch(e){}}if(!c){if(e>t){let e=o;o=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],s=n+i.size;if(n==s?e<=s&&t>=n:e<s&&t>n){let r=n+i.border,o=s-i.border;if(e>=r&&t<=o)return this.dirty=e==n||t==s?2:1,void(e!=r||t!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-r,t-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Sl extends Ol{constructor(e,t,n,r){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(n,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r))),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 Cl extends Ol{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class yl extends Ol{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=Ta.renderSpec(document,t.type.spec.toDOM(t,n))),new yl(e,t,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(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=yl.create(this.parent,this.mark,!0,n),i=this.children,s=this.size;t<s&&(i=Yl(i,t,s,n)),e>0&&(i=Yl(i,0,e,n));for(let o=0;o<i.length;o++)i[o].parent=r;return r.children=i,r}}class Nl extends Ol{constructor(e,t,n,r,i,s,o,a,u){super(e,[],i,s),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(e,t,n,r,i,s){let o,a=i.nodeViews[t.type.name],u=a&&a(t,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:s),n,r),l=u&&u.dom,c=u&&u.contentDOM;if(t.isText)if(l){if(3!=l.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else l=document.createTextNode(t.text);else l||({dom:l,contentDOM:c}=Ta.renderSpec(document,t.type.spec.toDOM(t)));c||t.isText||"BR"==l.nodeName||(l.hasAttribute("contenteditable")||(l.contentEditable="false"),t.type.spec.draggable&&(l.draggable=!0));let h=l;return l=Pl(l,n,t),u?o=new wl(e,t,n,r,l,c||null,h,u,i,s+1):t.isText?new bl(e,t,n,r,l,h,i):new Nl(e,t,n,r,l,c||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Oo.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ul(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,a=new $l(this,s&&s.node,e);!function(e,t,n,r){let i=t.locals(e),s=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(s,o),n),s+=o.nodeSize}return}let o=0,a=[],u=null;for(let l=0;;){let c,h,d,p;for(;o<i.length&&i[o].to==s;){let e=i[o++];e.widget&&(c?(h||(h=[c])).push(e):c=e)}if(c)if(h){h.sort(jl);for(let e=0;e<h.length;e++)n(h[e],l,!!u)}else n(c,l,!!u);if(u)p=-1,d=u,u=null;else{if(!(l<e.childCount))break;p=l,d=e.child(l++)}for(let e=0;e<a.length;e++)a[e].to<=s&&a.splice(e--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let f=s+d.nodeSize;if(d.isText){let e=f;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(u=d.cut(e-s),d=d.cut(0,e-s),f=e,p=-1)}else for(;o<i.length&&i[o].to<=f;)o++;let m=d.isInline&&!d.isLeaf?a.filter((e=>!e.inline)):a.slice();r(d,m,t.forChild(s,d),p),s=f}}(this.node,this.innerDeco,((t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?No.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)}),((t,s,u,l)=>{let c;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,s,u,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(c=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,s,u,c,e)||a.updateNextNode(t,s,u,e,l,r)||a.addNode(t,s,u,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),kl(this.contentDOM,this.children,e),Ku&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof ou)||n<t||r>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=ku(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,i=function(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let o=e.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;u+=t.text}if(s>=n){if(s>=r&&u.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?u.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&u.length>=r+t.length-a&&u.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:s,pos:i,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Cl(this,i,t,r);e.input.compositionNodes.push(s),this.children=Yl(this.children,n,n+r.length,e,s)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Ul(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=xl(this.dom,this.nodeDOM,Fl(this.outerDeco,this.node,t),Fl(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Il(e,t,n,r,i){Pl(r,t,e);let s=new Nl(void 0,e,t,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bl extends Nl{constructor(e,t,n,r,i,s,o){super(e,t,n,r,i,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new bl(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class Rl extends Ol{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class wl extends Nl{constructor(e,t,n,r,i,s,o,a,u,l){super(e,t,n,r,i,s,o,u,l),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kl(e,t,n){let r=e.firstChild,i=!1;for(let s=0;s<t.length;s++){let o=t[s],a=o.dom;if(a.parentNode==e){for(;a!=r;)r=Hl(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(a,r);if(o instanceof yl){let t=r?r.previousSibling:e.lastChild;kl(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Hl(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Ll=function(e){e&&(this.nodeName=e)};Ll.prototype=Object.create(null);const Ml=[new Ll];function Fl(e,t,n){if(0==e.length)return Ml;let r=n?Ml[0]:new Ll,i=[r];for(let s=0;s<e.length;s++){let o=e[s].type.attrs;if(o){o.nodeName&&i.push(r=new Ll(o.nodeName));for(let e in o){let s=o[e];null!=s&&(n&&1==i.length&&i.push(r=new Ll(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+s:"style"==e?r.style=(r.style?r.style+";":"")+s:"nodeName"!=e&&(r[e]=s))}}}return i}function xl(e,t,n,r){if(n==Ml&&r==Ml)return t;let i=t;for(let s=0;s<r.length;s++){let t=r[s],o=n[s];if(s){let n;o&&o.nodeName==t.nodeName&&i!=e&&(n=i.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(i),o=Ml[0]),i=n}Bl(i,o||Ml[0],t)}return i}function Bl(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Pl(e,t,n){return xl(e,e,Ml,Fl(t,n,1!=e.nodeType))}function Ul(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Hl(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class $l{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof yl)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=e.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=yl.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let i,s=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))s=this.top.children.indexOf(i,this.index);else for(let o=this.index,a=Math.min(this.top.children.length,o+5);o<a;o++){let r=this.top.children[o];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){s=o;break}}return!(s<0||(this.destroyBetween(this.index,s),this.index++,0))}updateNodeAt(e,t,n,r,i){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,i,s){for(let o=this.index;o<this.top.children.length;o++){let a=this.top.children[o];if(a instanceof Nl){let u=this.preMatch.matched.get(a);if(null!=u&&u!=i)return!1;let l,c=a.dom,h=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Ul(t,a.outerDeco));if(!h&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(l=this.recreateWrapper(a,e,t,n,r,s)))return this.top.children[this.index]=l,l.contentDOM&&(l.dirty=2,l.updateChildren(r,s+1),l.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let o=Nl.create(this.top,t,n,r,i,s);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let s=Nl.create(this.top,e,t,n,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Sl(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof yl;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof bl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Xu||Gu)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Rl(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function jl(e,t){return e.type.side-t.type.side}function Yl(e,t,n,r,i){let s=[];for(let o=0,a=0;o<e.length;o++){let u=e[o],l=a,c=a+=u.size;l>=n||c<=t?s.push(u):(l<t&&s.push(u.slice(0,t-l,r)),i&&(s.push(i),i=void 0),c>n&&s.push(u.slice(n-l,u.size,r)))}return s}function zl(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a,u,l=r.resolve(o);if(Mu(n)){for(a=l;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&uu.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,i=t==ku(e);r||i;){if(e==n)return!0;let t=Cu(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==ku(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new uu(o==e?l:r.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;a=r.resolve(t)}return u||(u=Ql(e,a,l,"pointer"==t||e.state.selection.head<l.pos&&!s?1:-1)),u}function Vl(e){return e.editable?e.hasFocus():tc(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Gl(e,t=!1){let n=e.state.selection;if(Jl(e,n),Vl(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Gu){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&bu(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Cu(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&ju&&Yu<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let r,i,{anchor:s,head:o}=n;!Wl||n instanceof ou||(n.$from.parent.inlineContent||(r=Xl(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Xl(e,n.to))),e.docView.setSelection(s,o,e.root,t),Wl&&(r&&ql(r),i&&ql(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Vl(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Wl=Xu||Gu&&Wu<63;function Xl(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Xu&&i&&"false"==i.contentEditable)return Kl(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Kl(i);if(s)return Kl(s)}}function Kl(e){return e.contentEditable="true",Xu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ql(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Jl(e,t){if(t instanceof uu){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Zl(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Zl(e)}function Zl(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ql(e,t,n,r){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||ou.between(t,n,r)}function ec(e){return!(e.editable&&!e.hasFocus())&&tc(e)}function tc(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nc(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&nu.findFrom(s,t)}function rc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function ic(e,t,n){let r=e.state.selection;if(!(r instanceof ou)){if(r instanceof uu&&r.node.isInline)return rc(e,new ou(t>0?r.$to:r.$from));{let n=nc(e.state,t);return!!n&&rc(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return rc(e,new ou(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=nc(e.state,t);return!!(n&&n instanceof uu)&&rc(e,n)}if(!(qu&&n.indexOf("m")>-1)){let n,i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let o=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(o))&&!n.contentDOM)&&(uu.isSelectable(s)?rc(e,new uu(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!Qu&&rc(e,new ou(e.state.doc.resolve(t<0?o:o+s.nodeSize))))}}function sc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function oc(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ac(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=!1;for(zu&&1==n.nodeType&&r<sc(n)&&oc(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(oc(e,-1))i=n,s=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(uc(n))break;{let t=n.previousSibling;for(;t&&oc(t,-1);)i=n.parentNode,s=Cu(t),t=t.previousSibling;if(t)n=t,r=sc(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?lc(e,n,r):i&&lc(e,i,s)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=sc(n);for(;;)if(r<o){if(1!=n.nodeType)break;if(!oc(n.childNodes[r],1))break;i=n,s=++r}else{if(uc(n))break;{let t=n.nextSibling;for(;t&&oc(t,1);)i=t.parentNode,s=Cu(t)+1,t=t.nextSibling;if(t)n=t,r=0,o=sc(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&lc(e,i,s)}(e)}function uc(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function lc(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Lu(e);)t=Cu(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Lu(e);)t=Cu(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(Mu(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Gl(e)}),50)}function cc(e,t){let n=e.state.doc.resolve(t);if(!Gu&&!Ju&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function hc(e,t,n){let r=e.state.selection;if(r instanceof ou&&!r.empty||n.indexOf("s")>-1)return!1;if(qu&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nc(e.state,t);if(n&&n instanceof uu)return rc(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,o=r instanceof cu?nu.near(n,t):nu.findFrom(n,t);return!!o&&rc(e,o)}return!1}function dc(e,t){if(!(e.state.selection instanceof ou))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function pc(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function fc(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let o=e.someProp("clipboardSerializer")||Ta.fromSchema(e.state.schema),a=Sc(),u=a.createElement("div");u.appendChild(o.serializeFragment(r,{document:a}));let l,c=u.firstChild,h=0;for(;c&&1==c.nodeType&&(l=Tc[c.nodeName.toLowerCase()]);){for(let e=l.length-1;e>=0;e--){let t=a.createElement(l[e]);for(;u.firstChild;)t.appendChild(u.firstChild);u.appendChild(t),h++}c=u.firstChild}c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n");return{dom:u,text:d}}function mc(e,t,n,r,i){let s,o,a=i.parent.type.spec.code;if(!n&&!t)return null;let u=t&&(r||a||!n);if(u){if(e.someProp("transformPastedText",(n=>{t=n(t,a||r,e)})),a)return t?new bo(Oo.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):bo.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,i,r,e)));if(n)o=n;else{let n=i.marks(),{schema:r}=e.state,o=Ta.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(o.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Sc().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);if((n=i&&Tc[i[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let s=0;s<n.length;s++)r=r.querySelector(n[s])||r;return r}(n),Qu&&function(e){let t=e.querySelectorAll(Gu?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let h=+c[3];h>0;h--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!o){let t=e.someProp("clipboardParser")||e.someProp("domParser")||da.fromSchema(e.state.schema);o=t.parseSlice(s,{preserveWhitespace:!(!u&&!c),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ec.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(c)o=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:o}=e;for(let a=n.length-2;a>=0;a-=2){let e=r.nodes[n[a]];if(!e||e.hasRequiredAttrs())break;i=Oo.from(e.create(n[a+1],i)),s++,o++}return new bo(i,s,o)}(vc(o,+c[1],+c[2]),c[4]);else if(o=bo.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach((e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&Ac(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=_c(s[s.length-1],r.length));let t=gc(e,n);s.push(t),i=i.matchType(t.type),r=n}})),s)return Oo.from(s)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,t=0;for(let n=o.content.firstChild;e<o.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=o.content.lastChild;t<o.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);o=vc(o,e,t)}return e.someProp("transformPasted",(t=>{o=t(o,e)})),o}const Ec=/^(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 gc(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Oo.from(e));return e}function Ac(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=Ac(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Oo.from(gc(n,e,i+1))))}}function _c(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,_c(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Oo.empty,!0);return e.copy(n.append(r))}function Dc(e,t,n,r,i,s){let o=t<0?e.firstChild:e.lastChild,a=o.content;return e.childCount>1&&(s=0),i<r-1&&(a=Dc(a,t,n,r,i+1,s)),i>=n&&(a=t<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(Oo.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(a))}function vc(e,t,n){return t<e.openStart&&(e=new bo(Dc(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new bo(Dc(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Tc={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 Oc=null;function Sc(){return Oc||(Oc=document.implementation.createHTMLDocument("title"))}const Cc={},yc={},Nc={touchstart:!0,touchmove:!0};class Ic{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 bc(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Rc(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>wc(e,t))}))}function wc(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function kc(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Lc(e){return{left:e.clientX,top:e.clientY}}function Mc(e,t,n,r,i){if(-1==r)return!1;let s=e.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(e.someProp(t,(t=>o>s.depth?t(e,n,s.nodeAfter,s.before(o),i,!0):t(e,n,s.node(o),s.before(o),i,!1))))return!0;return!1}function Fc(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function xc(e,t,n,r){return Mc(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function Bc(e,t,n,r){return Mc(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(n=>n(e,t,r)))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Fc(e,ou.create(r,0,r.content.size)),!0);let i=r.resolve(t);for(let s=i.depth+1;s>0;s--){let t=s>i.depth?i.nodeAfter:i.node(s),n=i.before(s);if(t.inlineContent)Fc(e,ou.create(r,n+1,n+1+t.content.size));else{if(!uu.isSelectable(t))continue;Fc(e,uu.create(r,n))}return!0}}(e,n,r)}function Pc(e){return Vc(e)}yc.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!$c(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Zu||!Gu||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Ku||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||qu&&72==n&&"c"==r)return dc(e,-1)||ac(e,-1);if(46==n&&!t.shiftKey||qu&&68==n&&"c"==r)return dc(e,1)||ac(e,1);if(13==n||27==n)return!0;if(37==n||qu&&66==n&&"c"==r){let t=37==n?"ltr"==cc(e,e.state.selection.from)?-1:1:-1;return ic(e,t,r)||ac(e,t)}if(39==n||qu&&70==n&&"c"==r){let t=39==n?"ltr"==cc(e,e.state.selection.from)?1:-1:1;return ic(e,t,r)||ac(e,t)}return 38==n||qu&&80==n&&"c"==r?hc(e,-1,r)||ac(e,-1):40==n||qu&&78==n&&"c"==r?function(e){if(!Xu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;pc(e,n,"true"),setTimeout((()=>pc(e,n,"false")),20)}return!1}(e)||hc(e,1,r)||ac(e,1):r==(qu?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():bc(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},yc.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},yc.keypress=(e,t)=>{let n=t;if($c(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||qu&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof ou&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,r.$from.pos,r.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const Uc=qu?"metaKey":"ctrlKey";Cc.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Pc(e),i=Date.now(),s="singleClick";i-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Uc]&&("singleClick"==e.input.lastClick.type?s="doubleClick":"doubleClick"==e.input.lastClick.type&&(s="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=e.posAtCoords(Lc(n));o&&("singleClick"==s?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Hc(e,o,n,!!r)):("doubleClick"==s?xc:Bc)(e,o.pos,o.inside,n)?n.preventDefault():bc(e,"pointer"))};class Hc{constructor(e,t,n,r){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Uc],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const o=r?null:n.target,a=o?e.docView.nearestDesc(o,!0):null;this.target=a?a.dom:null;let{selection:u}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||u instanceof uu&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!zu||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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),bc(e,"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((()=>Gl(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Lc(e))),this.updateAllowDefault(e),this.allowDefault||!t?bc(this.view,"pointer"):function(e,t,n,r,i){return Mc(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(n=>n(e,t,r)))||(i?function(e,t){if(-1==t)return!1;let n,r,i=e.state.selection;i instanceof uu&&(n=i.node);let s=e.state.doc.resolve(t);for(let o=s.depth+1;o>0;o--){let e=o>s.depth?s.nodeAfter:s.node(o);if(uu.isSelectable(e)){r=n&&i.$from.depth>0&&o>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(o);break}}return null!=r&&(Fc(e,uu.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&uu.isSelectable(r))&&(Fc(e,new uu(n)),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Xu&&this.mightDrag&&!this.mightDrag.node.isAtom||Gu&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Fc(this.view,nu.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):bc(this.view,"pointer")}move(e){this.updateAllowDefault(e),bc(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function $c(e,t){return!!e.composing||!!(Xu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Cc.touchstart=e=>{e.input.lastTouch=Date.now(),Pc(e),bc(e,"pointer")},Cc.touchmove=e=>{e.input.lastTouch=Date.now(),bc(e,"pointer")},Cc.contextmenu=e=>Pc(e);const jc=Zu?5e3:-1;function Yc(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Vc(e)),t))}function zc(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Vc(e,t=!1){if(!(Zu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),zc(e),t||e.docView&&e.docView.dirty){let t=zl(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}yc.compositionstart=yc.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Vc(e,!0),e.markCursor=null;else if(Vc(e),zu&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Yc(e,jc)},yc.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Yc(e,20))};const Gc=ju&&Yu<15||Ku&&el<604;function Wc(e,t,n,r,i){let s=mc(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,i,s||bo.empty))))return!0;if(!s)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),a=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xc(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Cc.copy=yc.cut=(e,t)=>{let n=t,r=e.state.selection,i="cut"==n.type;if(r.empty)return;let s=Gc?null:n.clipboardData,o=r.content(),{dom:a,text:u}=fc(e,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",u)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},yc.paste=(e,t)=>{let n=t;if(e.composing&&!Zu)return;let r=Gc?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Wc(e,Xc(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Wc(e,r.value,null,i,t):Wc(e,r.textContent,r.innerHTML,i,t)}),50)}(e,n)};class Kc{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const qc=qu?"altKey":"ctrlKey";Cc.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,s=e.state.selection,o=s.empty?null:e.posAtCoords(Lc(n));if(o&&o.pos>=s.from&&o.pos<=(s instanceof uu?s.to-1:s.to));else if(r&&r.mightDrag)i=uu.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(i=uu.create(e.state.doc,t.posBefore))}let a=(i||e.state.selection).content(),{dom:u,text:l}=fc(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Gc?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Gc||n.dataTransfer.setData("text/plain",l),e.dragging=new Kc(a,!n[qc],i)},Cc.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},yc.dragover=yc.dragenter=(e,t)=>t.preventDefault(),yc.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(Lc(n));if(!i)return;let s=e.state.doc.resolve(i.pos),o=r&&r.slice;o?e.someProp("transformPasted",(t=>{o=t(o,e)})):o=mc(e,Xc(n.dataTransfer),Gc?null:n.dataTransfer.getData("text/html"),!1,s);let a=!(!r||n[qc]);if(e.someProp("handleDrop",(t=>t(e,n,o||bo.empty,a))))return void n.preventDefault();if(!o)return;n.preventDefault();let u=o?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),o=r.node(e),a=!1;if(1==s)a=o.canReplace(n,n,i);else{let e=o.contentMatchAt(n).findWrapping(i.firstChild.type);a=e&&o.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}(e.state.doc,s.pos,o):s.pos;null==u&&(u=s.pos);let l=e.state.tr;if(a){let{node:e}=r;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(u),h=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,d=l.doc;if(h?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let p=l.doc.resolve(c);if(h&&uu.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new uu(p));else{let t=l.mapping.map(u);l.mapping.maps[l.mapping.maps.length-1].forEach(((e,n,r,i)=>t=i)),l.setSelection(Ql(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))},Cc.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Gl(e)}),20))},Cc.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Cc.beforeinput=(e,t)=>{if(Gu&&Zu&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,Fu(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let os in yc)Cc[os]=yc[os];function Jc(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Zc{constructor(e,t){this.toDOM=e,this.spec=t||rh,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new th(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Zc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Jc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qc{constructor(e,t){this.attrs=e,this.spec=t||rh}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new th(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Qc&&Jc(this.attrs,e.attrs)&&Jc(this.spec,e.spec)}static is(e){return e.type instanceof Qc}destroy(){}}class eh{constructor(e,t){this.attrs=e,this.spec=t||rh}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new th(i.pos-n,s.pos-n,this)}valid(e,t){let n,{index:r,offset:i}=e.content.findIndex(t.from);return i==t.from&&!(n=e.child(r)).isText&&i+n.nodeSize==t.to}eq(e){return this==e||e instanceof eh&&Jc(this.attrs,e.attrs)&&Jc(this.spec,e.spec)}destroy(){}}class th{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new th(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new th(e,e,new Zc(t,n))}static inline(e,t,n,r){return new th(e,t,new Qc(n,r))}static node(e,t,n,r){return new th(e,t,new eh(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Qc}get widget(){return this.type instanceof Zc}}const nh=[],rh={};class ih{constructor(e,t){this.local=e.length?e:nh,this.children=t.length?t:nh}static create(e,t){return t.length?ch(t,e,0,rh):sh}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==sh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||rh)}mapInner(e,t,n,r,i){let s;for(let o=0;o<this.local.length;o++){let a=this.local[o].map(e,n,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,n,r,i,s,o){let a=e.slice();for(let l=0,c=s;l<n.maps.length;l++){let e=0;n.maps[l].forEach(((t,n,r,i)=>{let s=i-r-(n-t);for(let o=0;o<a.length;o+=3){let r=a[o+1];if(r<0||t>r+c-e)continue;let i=a[o]+c-e;n>=i?a[o+1]=t<=i?-2:-1:t>=c&&s&&(a[o]+=s,a[o+1]+=s)}e+=s})),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(-2==a[l+1]){u=!0,a[l+1]=-1;continue}let t=n.map(e[l]+s),c=t-i;if(c<0||c>=r.content.size){u=!0;continue}let h=n.map(e[l+1]+s,-1)-i,{index:d,offset:p}=r.content.findIndex(c),f=r.maybeChild(d);if(f&&p==c&&p+f.nodeSize==h){let r=a[l+2].mapInner(n,f,t+1,e[l]+s+1,o);r!=sh?(a[l]=c,a[l+1]=h,a[l+2]=r):(a[l+1]=-2,u=!0)}else u=!0}if(u){let u=function(e,t,n,r,i,s,o){function a(e,t){for(let s=0;s<e.local.length;s++){let a=e.local[s].map(r,i,t);a?n.push(a):o.onRemove&&o.onRemove(e.local[s].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let u=0;u<e.length;u+=3)-1==e[u+1]&&a(e[u+2],t[u]+s+1);return n}(a,e,t,n,i,s,o),l=ch(u,r,0,o);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new ih(t.sort(hh),a)}(this.children,s||[],e,t,n,r,i):s?new ih(s.sort(hh),nh):sh}add(e,t){return t.length?this==sh?ih.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach(((e,s)=>{let o,a=s+n;if(o=uh(t,e,a)){for(r||(r=this.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(e,o,a+1):r.splice(i,0,s,s+e.nodeSize,ch(o,e,a+1,rh)),i+=3}}));let s=ah(i?lh(t):t,-n);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new ih(s.length?this.local.concat(s).sort(hh):this.local,r||this.children)}remove(e){return 0==e.length||this==sh?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let i=0;i<n.length;i+=3){let r,s=n[i]+t,o=n[i+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>s&&t.to<o&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[i+2].removeInner(r,s+1);a!=sh?n[i+2]=a:(n.splice(i,3),i-=3)}if(r.length)for(let i,s=0;s<e.length;s++)if(i=e[s])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ih(r,n):sh}forChild(e,t){if(this==sh)return this;if(t.isLeaf)return ih.empty;let n,r;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(n=this.children[o+2]);break}let i=e+1,s=i+t.content.size;for(let o=0;o<this.local.length;o++){let e=this.local[o];if(e.from<s&&e.to>i&&e.type instanceof Qc){let t=Math.max(i,e.from)-i,n=Math.min(s,e.to)-i;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new ih(r.sort(hh),nh);return n?new oh([e,n]):e}return n||sh}eq(e){if(this==e)return!0;if(!(e instanceof ih)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return dh(this.localsInner(e))}localsInner(e){if(this==sh)return nh;if(e.inlineContent||!this.local.some(Qc.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Qc||t.push(this.local[n]);return t}}ih.empty=new ih([],[]),ih.removeOverlap=dh;const sh=ih.empty;class oh{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,rh)));return oh.from(n)}forChild(e,t){if(t.isLeaf)return ih.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=sh&&(i instanceof oh?n=n.concat(i.members):n.push(i))}return oh.from(n)}eq(e){if(!(e instanceof oh)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?dh(n?t:t.sort(hh)):nh}static from(e){switch(e.length){case 0:return sh;case 1:return e[0];default:return new oh(e.every((e=>e instanceof ih))?e:e.reduce(((e,t)=>e.concat(t instanceof ih?t:t.members)),[]))}}}function ah(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new th(i.from+t,i.to+t,i.type))}return n}function uh(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let s,o=0;o<e.length;o++)(s=e[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),e[o]=null);return i}function lh(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ch(e,t,n,r){let i=[],s=!1;t.forEach(((t,o)=>{let a=uh(e,t,o+n);if(a){s=!0;let e=ch(a,t,n+o+1,r);e!=sh&&i.push(o,o+t.nodeSize,e)}}));let o=ah(s?lh(e):e,-n).sort(hh);for(let a=0;a<o.length;a++)o[a].type.valid(t,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ih(o,i):sh}function hh(e,t){return e.from-t.from||e.to-t.to}function dh(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let s=t[i];if(s.from!=r.from){s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),ph(t,i,r.copy(s.from,r.to)));break}s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),ph(t,i+1,s.copy(r.to,s.to)))}}return t}function ph(e,t,n){for(;t<e.length&&hh(n,e[t])>0;)t++;e.splice(t,0,n)}function fh(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=sh&&t.push(r)})),e.cursorWrapper&&t.push(ih.create(e.state.doc,[e.cursorWrapper.deco])),oh.from(t)}const mh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Eh=ju&&Yu<=11;class gh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Ah{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);ju&&Yu<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Eh&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,mh)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(ec(this.view)){if(this.suppressingSelectionUpdates)return Gl(this.view);if(ju&&Yu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&bu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let i=e.focusNode;i;i=yu(i))n.add(i);for(let i=e.anchorNode;i;i=yu(i))if(n.has(i)){t=i;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ec(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,o=!1,a=[];if(e.editable)for(let l=0;l<t.length;l++){let e=this.registerMutation(t[l],a);e&&(i=i<0?e.from:Math.min(e.from,i),s=s<0?e.to:Math.max(e.to,s),e.typeOver&&(o=!0))}if(zu&&a.length>1){let e=a.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Mu(n)&&(u=zl(e))&&u.eq(nu.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Gl(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!_h.has(e)&&(_h.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=zu,Dh)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."),Dh=!0}}(e)),this.handleDOMChange(i,s,o,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Gl(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ju&&Yu<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:s}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!s||Array.prototype.indexOf.call(e.addedNodes,s)<0)&&(i=s)}let s=r&&r.parentNode==e.target?Cu(r)+1:0,o=n.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Cu(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let _h=new WeakMap,Dh=!1;function vh(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Xu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||Xu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Th=/^(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 Oh(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ql(e,t.resolve(n.anchor),t.resolve(n.head))}function Sh(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Ch(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class yh{constructor(e,t){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 Ic,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=bh(this),Ih(this),this.nodeViews=Rh(this),this.docView=Il(this.state.doc,Nh(this),fh(this),this.dom,this),this.domObserver=new Ah(this,((e,t,n,r)=>function(e,t,n,r,i){let s=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=zl(e,t);if(n&&!e.state.selection.eq(n)){if(Gu&&Zu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),s&&r.setMeta("composition",s),e.dispatch(r)}return}let o=e.state.doc.resolve(t),a=o.sharedDepth(n);t=o.before(a+1),n=e.state.doc.resolve(n).after(a+1);let u,l,c=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:o,from:a,to:u}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c=l.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(r=[{node:c,offset:l.anchorOffset}],Mu(l)||r.push({node:l.focusNode,offset:l.focusOffset})),Gu&&8===e.input.lastKeyCode)for(let E=o;E>s;E--){let e=i.childNodes[E-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){o=E;break}if(!t||t.size)break}let h=e.state.doc,d=e.someProp("domParser")||da.fromSchema(e.state.schema),p=h.resolve(a),f=null,m=d.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:vh,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:u}}(e,t,n),d=e.state.doc,p=d.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(u=e.state.selection.to,l="end"):(u=e.state.selection.from,l="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,i){let s=e.findDiffStart(t,n);if(null==s)return null;let{a:o,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i&&(r-=o+Math.max(0,s-Math.min(o,a))-s),o<s&&e.size<t.size){let e=r<=s&&r>=o?s-r:0;s-=e,s&&s<t.size&&Ch(t.textBetween(s-1,s+1))&&(s+=e?1:-1),a=s+(a-o),o=s}else if(a<s){let t=r<=s&&r>=a?s-r:0;s-=t,s&&s<e.size&&Ch(e.textBetween(s-1,s+1))&&(s+=t?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}(p.content,h.doc.content,h.from,u,l);if((Ku&&e.input.lastIOSEnter>Date.now()-225||Zu)&&i.some((e=>1==e.nodeType&&!Th.test(e.nodeName)))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof ou&&!c.empty&&c.$head.sameParent(c.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=Oh(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);s&&n.setMeta("composition",s),e.dispatch(n)}}return}f={start:c.from,endA:c.to,endB:c.to}}if(Gu&&e.cursorWrapper&&h.sel&&h.sel.anchor==e.cursorWrapper.deco.from&&h.sel.head==h.sel.anchor){let e=f.endB-f.start;h.sel={anchor:h.sel.anchor+e,head:h.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof ou&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),ju&&Yu<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>h.from&&"  "==h.doc.textBetween(f.start-h.from-1,f.start-h.from+1)&&(f.start--,f.endA--,f.endB--);let m,E=h.doc.resolveNoCache(f.start-h.from),g=h.doc.resolveNoCache(f.endB-h.from),A=d.resolve(f.start),_=E.sameParent(g)&&E.parent.inlineContent&&A.end()>=f.endA;if((Ku&&e.input.lastIOSEnter>Date.now()-225&&(!_||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!_&&E.pos<h.doc.content.size&&!E.sameParent(g)&&(m=nu.findFrom(h.doc.resolve(E.pos+1),1,!0))&&m.head==g.pos)&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||Sh(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=e.resolve(Sh(s,!0,!0));return!(!o.parent.isTextblock||o.pos>n||Sh(o,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(o.parent.content)}(d,f.start,f.endA,E,g)&&e.someProp("handleKeyDown",(t=>t(e,Fu(8,"Backspace")))))return void(Zu&&Gu&&e.domObserver.suppressSelectionUpdates());Gu&&Zu&&f.endB==f.start&&(e.input.lastAndroidDelete=Date.now()),Zu&&!_&&E.start()!=g.start()&&0==g.parentOffset&&E.depth==g.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,g=h.doc.resolveNoCache(f.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,Fu(13,"Enter"))}))}),20));let D,v,T,O=f.start,S=f.endA;if(_)if(E.pos==g.pos)ju&&Yu<=11&&0==E.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Gl(e)),20)),D=e.state.tr.delete(O,S),v=d.resolve(f.start).marksAcross(d.resolve(f.endA));else if(f.endA==f.endB&&(T=function(e,t){let n,r,i,s=e.firstChild.marks,o=t.firstChild.marks,a=s,u=o;for(let c=0;c<o.length;c++)a=o[c].removeFromSet(a);for(let c=0;c<s.length;c++)u=s[c].removeFromSet(u);if(1==a.length&&0==u.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=u.length)return null;r=u[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let l=[];for(let c=0;c<t.childCount;c++)l.push(i(t.child(c)));if(Oo.from(l).eq(e))return{mark:r,type:n}}(E.parent.content.cut(E.parentOffset,g.parentOffset),A.parent.content.cut(A.parentOffset,f.endA-A.start()))))D=e.state.tr,"add"==T.type?D.addMark(O,S,T.mark):D.removeMark(O,S,T.mark);else if(E.parent.child(E.index()).isText&&E.index()==g.index()-(g.textOffset?0:1)){let t=E.parent.textBetween(E.parentOffset,g.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,O,S,t))))return;D=e.state.tr.insertText(t,O,S)}if(D||(D=e.state.tr.replace(O,S,h.doc.slice(f.start-h.from,f.endB-h.from))),h.sel){let t=Oh(e,D.doc,h.sel);t&&!(Gu&&Zu&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==O||t.head==D.mapping.map(S)-1)||ju&&t.empty&&t.head==O)&&D.setSelection(t)}v&&D.ensureMarks(v),s&&D.setMeta("composition",s),e.dispatch(D.scrollIntoView())}(this,e,t,n,r))),this.domObserver.start(),function(e){for(let t in Cc){let n=Cc[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!kc(e,t)||wc(e,t)||!e.editable&&t.type in yc||n(e,t)},Nc[t]?{passive:!0}:void 0)}Xu&&e.dom.addEventListener("input",(()=>null)),Rc(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rc(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zc(this),s=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(o||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Rh(this);(function(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||t.handleDOMEvents!=this._props.handleDOMEvents)&&Rc(this),this.editable=bh(this),Ih(this);let a=fh(this),u=Nh(this),l=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",c=i||!this.docView.matchesNode(e.doc,u,a);!c&&e.selection.eq(r.selection)||(s=!0);let h="preserve"==l&&s&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let s=(r.left+r.right)/2,o=i+1;o<Math.min(innerHeight,r.bottom);o+=5){let r=e.root.elementFromPoint(s,o);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:sl(e.dom)}}(this);if(s){this.domObserver.stop();let t=c&&(ju||Gu)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(c){let n=Gu?this.trackWrites=this.domSelectionRange().focusNode:null;!i&&this.docView.update(e.doc,u,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Il(e.doc,u,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return bu(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Gl(this,t):(Jl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;ol(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof uu){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&il(this,t.getBoundingClientRect(),e)}else il(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Kc(e.slice,e.move,r<0?void 0:uu.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let s=0;s<this.directPlugins.length;s++){let r=this.directPlugins[s].props[e];if(null!=r&&(n=t?t(r):r))return n}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let r=i[s].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(ju){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(al)return e.focus(al);let t=sl(e);e.focus(null==al?{get preventScroll(){return al={preventScroll:!0},!0}}:void 0),al||(al=!1,ol(t,0))}(this.dom),Gl(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return hl(this,e)}coordsAtPos(e,t=1){return ml(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return Dl==t&&vl==n?Tl:(Dl=t,vl=n,Tl="up"==n||"down"==n?function(e,t,n){let r=t.selection,i="up"==n?r.$from:r.$to;return Al(e,t,(()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=ml(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Iu(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=e.domSelection();return _l.test(r.parent.textContent)&&a.modify?Al(e,t,(()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:o}=e.domSelectionRange(),u=a.caretBidiLevel;a.modify("move",n,"character");let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:h}=e.domSelectionRange(),d=c&&!l.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==h;try{a.collapse(s,o),t&&(t!=s||i!=o)&&a.extend&&a.extend(t,i)}catch(e){}return null!=u&&(a.caretBidiLevel=u),d})):"left"==n||"backward"==n?s:o}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return Wc(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Wc(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){wc(e,t)||!Cc[t.type]||!e.editable&&t.type in yc||Cc[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Xu&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,i=t.startOffset,s=t.endContainer,o=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return bu(a.node,a.offset,s,o)&&([r,i,s,o]=[s,o,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Nh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[th.node(0,e.state.doc.content.size,t)]}function Ih(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:th.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function bh(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function Rh(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function wh(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const kh=new class{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Do.from(e.nodes),t.marks=Do.from(e.marks||{}),this.nodes=ua.compile(this.spec.nodes,this),this.marks=ca.compile(this.spec.marks,this);let n=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 e=this.nodes[r],t=e.spec.content||"",i=e.spec.marks;e.contentMatch=n[t]||(n[t]=qo.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==i?null:i?ha(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:ha(this,t.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(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ua))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Xo(n,n.defaultAttrs,e,No.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Wo.fromJSON(this,e)}markFromJSON(e){return No.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);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:e=>["span",{"data-mention-id":e.attrs.id},`@${e.attrs.name}`],parseDOM:[{tag:"span[data-mention-id]",getAttrs:e=>({id:e.dataset["mention-id"]})}]}},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:e=>["span",{"data-emoji":e.attrs.emoji},e.attrs.emoji],parseDOM:[{tag:"span[data-emoji]",getAttrs:e=>({emoji:e.dataset.emoji})}]}}}),Lh=new Su("placeholder"),Mh=new vu({key:Lh,props:{decorations(e){if(Fh(e.doc))return;const t=e.doc.firstChild,n=th.node(0,t.nodeSize,{class:"empty-node","data-placeholder":Lh.getState(e)});return ih.create(e.doc,[n])}},state:{init:()=>"",apply:(e,t)=>e.getMeta(Lh)??t}});function Fh(e){return 1!==e.childCount||0!==e.firstChild.childCount}for(var xh={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"},Bh={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"},Ph="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Uh="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),Hh="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),$h="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),jh="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Yh=Ph&&($h||+Ph[1]<57)||Hh&&$h,zh=0;zh<10;zh++)xh[48+zh]=xh[96+zh]=String(zh);for(zh=1;zh<=24;zh++)xh[zh+111]="F"+zh;for(zh=65;zh<=90;zh++)xh[zh]=String.fromCharCode(zh+32),Bh[zh]=String.fromCharCode(zh);for(var Vh in xh)Bh.hasOwnProperty(Vh)||(Bh[Vh]=xh[Vh]);const Gh="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Wh(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let a=0;a<s.length-1;a++){let e=s[a];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);Gh?i=!0:n=!0}}return t&&(o="Alt-"+o),n&&(o="Ctrl-"+o),i&&(o="Meta-"+o),r&&(o="Shift-"+o),o}function Xh(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Kh(e){return new vu({props:{handleKeyDown:qh(e)}})}function qh(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Wh(n)]=e[n];return t}(e);return function(e,n){let r,i=function(e){var t=!(Yh&&(e.ctrlKey||e.altKey||e.metaKey)||(Uh||jh)&&e.shiftKey&&e.key&&1==e.key.length)&&e.key||(e.shiftKey?Bh:xh)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),s=t[Xh(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[Xh(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(r=xh[n.keyCode])&&r!=i){let i=t[Xh(r,n)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}var Jh=200,Zh=function(){};Zh.prototype.append=function(e){return e.length?(e=Zh.from(e),!this.length&&e||e.length<Jh&&this.leafAppend(e)||this.length<Jh&&e.leafPrepend(this)||this.appendInner(e)):this},Zh.prototype.prepend=function(e){return e.length?Zh.from(e).append(this):this},Zh.prototype.appendInner=function(e){return new ed(this,e)},Zh.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Zh.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Zh.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Zh.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Zh.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},Zh.from=function(e){return e instanceof Zh?e:e&&e.length?new Qh(e):Zh.empty};var Qh=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Jh)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Jh)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Zh);Zh.empty=new Qh([]);var ed=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.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,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,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}(Zh),td=Zh;const nd=Math.pow(2,16);function rd(e,t){return e+t*nd}function id(e){return 65535&e}let sd=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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}},od=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=id(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/nd}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:rd(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new sd(i,h,s)}r+=l-u}return n?e+r:new sd(e+r,0,null)}touches(e,t){let n=0,r=id(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};od.empty=new od([]);class ad{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new ad(this.maps,this.mirror,e,t)}copy(){return new ad(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ad;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let i=this.from;i<this.to;i++){let n=this.maps[i].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(i);if(null!=t&&t>i&&t<this.to){i=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new sd(e,r,null)}}const ud=Object.create(null);let ld=class{getMap(){return od.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ud[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ud)throw new RangeError("Duplicate use of step JSON ID "+e);return ud[e]=t,t.prototype.jsonID=e,t}},cd=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Io)return e.fail(t.message);throw t}}};function hd(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(hd(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}let dd=class e extends ld{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo(hd(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return cd.fromReplace(e,this.from,this.to,i)}invert(){return new pd(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ld.jsonID("addMark",dd);let pd=class e extends ld{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo(hd(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return cd.fromReplace(e,this.from,this.to,n)}invert(){return new dd(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ld.jsonID("removeMark",pd);let fd=class e extends ld{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new md(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ld.jsonID("addNodeMark",fd);let md=class e extends ld{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new fd(this.pos,this.mark):this}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};function Ed(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}ld.jsonID("removeNodeMark",md),ld.jsonID("replace",class e extends ld{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ed(e,this.from,this.to)?cd.fail("Structure replace would overwrite content"):cd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new od([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof e)||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 n=this.slice.size+t.slice.size==0?bo.empty:new bo(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}}{let n=this.slice.size+t.slice.size==0?bo.empty:new bo(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,bo.fromJSON(t,n.slice),!!n.structure)}}),ld.jsonID("replaceAround",class e extends ld{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Ed(e,this.from,this.gapFrom)||Ed(e,this.gapTo,this.to)))return cd.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cd.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?cd.fromReplace(e,this.from,this.to,n):cd.fail("Content does not fit in gap")}getMap(){return new od([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),s=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new e(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,bo.fromJSON(t,n.slice),n.insert,!!n.structure)}}),ld.jsonID("attr",class e extends ld{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return od.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}}),ld.jsonID("docAttr",class e extends ld{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return cd.ok(n)}getMap(){return od.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}});let gd=class extends Error{};gd=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(gd.prototype=Object.create(Error.prototype)).constructor=gd,gd.prototype.name="TransformError";class Ad{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}t&&(n=this.remapping(i,this.items.length),r=n.maps.length);let s,o,a=e.tr,u=[],l=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(i,t+1),r=n.maps.length),r--,void l.push(e);if(n){l.push(new _d(e.map));let t,i=e.step.map(n.slice(r));i&&a.maybeStep(i).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],u.push(new _d(t,void 0,void 0,u.length+l.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(s=n?e.selection.map(n.slice(r)):e.selection,o=new Ad(this.items.slice(0,i).append(l.reverse().concat(u)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:a,selection:s}}addTransform(e,t,n,r){let i=[],s=this.eventCount,o=this.items,a=!r&&o.length?o.get(o.length-1):null;for(let l=0;l<e.steps.length;l++){let n,u=e.steps[l].invert(e.docs[l]),c=new _d(e.mapping.maps[l],u,t);(n=a&&a.merge(c))&&(c=n,l?i.pop():o=o.slice(0,o.length-1)),i.push(c),t&&(s++,t=void 0),r||(a=c)}let u=s-n.depth;return u>vd&&(o=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(o,u),s-=u),new Ad(o.append(i),s)}remapping(e,t){let n=new ad;return this.items.forEach(((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new Ad(this.items.append(e.map((e=>new _d(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),r);let a=t;this.items.forEach((t=>{let r=i.getMirror(--a);if(null==r)return;s=Math.min(s,r);let u=i.maps[r];if(t.step){let s=e.steps[r].invert(e.docs[r]),l=t.selection&&t.selection.map(i.slice(a+1,r));l&&o++,n.push(new _d(u,s,l))}else n.push(new _d(u))}),r);let u=[];for(let h=t;h<s;h++)u.push(new _d(i.maps[h]));let l=this.items.slice(0,r).append(u).append(n),c=new Ad(l,o);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach(((s,o)=>{if(o>=e)r.push(s),s.selection&&i++;else if(s.step){let e=s.step.map(t.slice(n)),o=e&&e.getMap();if(n--,o&&t.appendMap(o,n),e){let a=s.selection&&s.selection.map(t.slice(n));a&&i++;let u,l=new _d(o.invert(),e,a),c=r.length-1;(u=r.length&&r[c].merge(l))?r[c]=u:r.push(l)}}else s.map&&n--}),this.items.length,0),new Ad(td.from(r.reverse()),i)}}Ad.empty=new Ad(td.empty,0);class _d{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _d(t.getMap().invert(),t,this.selection)}}}class Dd{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const vd=20;function Td(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,i)=>t.push(r,i)));return t}function Od(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}let Sd=!1,Cd=null;function yd(e){let t=e.plugins;if(Cd!=t){Sd=!1,Cd=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Sd=!0;break}}return Sd}const Nd=new Su("history"),Id=new Su("closeHistory");function bd(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new vu({key:Nd,state:{init:()=>new Dd(Ad.empty,Ad.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let i,s=n.getMeta(Nd);if(s)return s.historyState;n.getMeta(Id)&&(e=new Dd(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(o&&o.getMeta(Nd))return o.getMeta(Nd).redo?new Dd(e.done.addTransform(n,void 0,r,yd(t)),e.undone,Td(n.mapping.maps),e.prevTime,e.prevComposition):new Dd(e.done,e.undone.addTransform(n,void 0,r,yd(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Dd(e.done.rebased(n,i),e.undone.rebased(n,i),Od(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Dd(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Od(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),s=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)})),n}(n,e.prevRanges)),a=o?Od(e.prevRanges,n.mapping):Td(n.mapping.maps);return new Dd(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,yd(t)),Ad.empty,a,n.time,null==i?e.prevComposition:i)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?wd:"historyRedo"==n?kd:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Rd(e,t){return(n,r)=>{let i=Nd.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let s=function(e,t,n){let r=yd(t),i=Nd.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),u=new Dd(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Nd,{redo:n,historyState:u})}(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}const wd=Rd(!1,!0),kd=Rd(!0,!0),Ld=Math.pow(2,16);function Md(e,t){return e+t*Ld}function Fd(e){return 65535&e}class xd{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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 Bd{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Bd.empty)return Bd.empty}recover(e){let t=0,n=Fd(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ld}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:Md(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new xd(i,h,s)}r+=l-u}return n?e+r:new xd(e+r,0,null)}touches(e,t){let n=0,r=Fd(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new Bd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Bd.empty:new Bd(e<0?[0,-e,0]:[0,0,e])}}Bd.empty=new Bd([]);const Pd=Object.create(null);class Ud{getMap(){return Bd.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Pd[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Pd)throw new RangeError("Duplicate use of step JSON ID "+e);return Pd[e]=t,t.prototype.jsonID=e,t}}class Hd{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Hd(e,null)}static fail(e){return new Hd(null,e)}static fromReplace(e,t,n,r){try{return Hd.ok(e.replace(t,n,r))}catch(e){if(e instanceof Io)return Hd.fail(e.message);throw e}}}function $d(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy($d(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}class jd extends Ud{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo($d(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return Hd.fromReplace(e,this.from,this.to,i)}invert(){return new Yd(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new jd(t.pos,n.pos,this.mark)}merge(e){return e instanceof jd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new jd(t.from,t.to,e.markFromJSON(t.mark))}}Ud.jsonID("addMark",jd);class Yd extends Ud{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo($d(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return Hd.fromReplace(e,this.from,this.to,n)}invert(){return new jd(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Yd(t.pos,n.pos,this.mark)}merge(e){return e instanceof Yd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Yd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Yd(t.from,t.to,e.markFromJSON(t.mark))}}Ud.jsonID("removeMark",Yd);class zd extends Ud{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new zd(this.pos,t.marks[n]);return new zd(this.pos,this.mark)}}return new Vd(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zd(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new zd(t.pos,e.markFromJSON(t.mark))}}Ud.jsonID("addNodeMark",zd);class Vd extends Ud{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new zd(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Vd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Vd(t.pos,e.markFromJSON(t.mark))}}Ud.jsonID("removeNodeMark",Vd);class Gd extends Ud{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Xd(e,this.from,this.to)?Hd.fail("Structure replace would overwrite content"):Hd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Bd([this.from,this.to-this.from,this.slice.size])}invert(e){return new Gd(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Gd(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof Gd)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?bo.empty:new bo(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Gd(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?bo.empty:new bo(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Gd(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Gd(t.from,t.to,bo.fromJSON(e,t.slice),!!t.structure)}}Ud.jsonID("replace",Gd);class Wd extends Ud{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Xd(e,this.from,this.gapFrom)||Xd(e,this.gapTo,this.to)))return Hd.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Hd.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Hd.fromReplace(e,this.from,this.to,n):Hd.fail("Content does not fit in gap")}getMap(){return new Bd([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Wd(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new Wd(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Wd(t.from,t.to,t.gapFrom,t.gapTo,bo.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Xd(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Kd(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function qd(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),i=e.$from.index(n),s=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,s,t))return n;if(0==n||r.type.spec.isolating||!Kd(r,i,s))break}return null}function Jd(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,c=n-2;l>s;l--,c--){let e=i.node(l),t=i.index(l);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),s=r&&r[c+1];s&&(n=n.replaceChild(0,s.type.create(s.attrs)));let o=r&&r[c]||e;if(!e.canReplace(t+1,e.childCount)||!o.type.validContent(n))return!1}let a=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(a,a,u?u.type:i.node(s+1).type)}function Zd(e,t){let n=e.resolve(t),r=n.index();return function(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),o=s.type==r?e.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n)return!1;if(!e.type.allowsMarks(s.marks))return!1}return n.validEnd}(e,t))}(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Qd(e,t,n=t,r=bo.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return function(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}(i,s,r)?new Gd(t,n,r):new ep(i,s,r).fit()}Ud.jsonID("replaceAround",Wd);class ep{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Oo.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Oo.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new bo(i,s,o);return e>-1?new Wd(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Gd(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=rp(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let s=this.depth;s>=0;s--){let e,{type:o,match:a}=this.frontier[s],u=null;if(1==t&&(i?a.matchType(i.type)||(u=a.fillBefore(Oo.from(i),!1)):r&&o.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:s,parent:r,inject:u};if(2==t&&i&&(e=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:s,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=rp(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new bo(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=rp(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new bo(tp(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new bo(tp(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,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 s=this.unplaced,o=n?n.content:s.content,a=s.openStart-e,u=0,l=[],{match:c,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));c=c.matchFragment(r)}let d=o.size+e-(s.content.size-s.openEnd);for(;u<o.childCount;){let e=o.child(u),t=c.matchType(e.type);if(!t)break;u++,(u>1||0==a||e.content.size)&&(c=t,l.push(ip(e.mark(h.allowedMarks(e.marks)),1==u?a:0,u==o.childCount?d:-1)))}let p=u==o.childCount;p||(d=-1),this.placed=np(this.placed,t,Oo.from(l)),this.frontier[t].match=c,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=o;f<d;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?bo.empty:new bo(tp(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new bo(tp(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!sp(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=sp(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=sp(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=np(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=np(this.placed,this.depth,Oo.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Oo.empty,!0);e.childCount&&(this.placed=np(this.placed,this.frontier.length,e))}}function tp(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(tp(e.firstChild.content,t-1,n)))}function np(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(np(e.lastChild.content,t-1,n)))}function rp(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function ip(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,ip(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Oo.empty,!0)))),e.copy(r)}function sp(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,s.content,o)?a:null}class op extends Ud{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return Bd.empty}invert(e){return new op(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new op(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new op(t.pos,t.attr,t.value)}}Ud.jsonID("attr",op);class ap extends Ud{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Hd.ok(n)}getMap(){return Bd.empty}invert(e){return new ap(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ap(t.attr,t.value)}}Ud.jsonID("docAttr",ap);let up=class extends Error{};up=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(up.prototype=Object.create(Error.prototype)).constructor=up,up.prototype.name="TransformError";const lp=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function cp(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function hp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function dp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function pp(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function fp(e,t,n,r){let i,s,o=t.nodeBefore,a=t.nodeAfter,u=o.type.spec.isolating||a.type.spec.isolating;if(!u&&function(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!Zd(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let l=!u&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(i=(s=o.contentMatchAt(o.childCount)).findWrapping(a.type))&&s.matchType(i[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=Oo.empty;for(let e=i.length-1;e>=0;e--)s=Oo.from(i[e].create(null,s));s=Oo.from(o.copy(s));let u=e.tr.step(new Wd(t.pos-1,r,t.pos,r,new bo(s,1,0),i.length,!0)),l=u.doc.resolve(r+2*i.length);l.nodeAfter&&l.nodeAfter.type==o.type&&Zd(u.doc,l.pos)&&u.join(l.pos),n(u.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&u?null:nu.findFrom(t,1),h=c&&c.$from.blockRange(c.$to),d=h&&qd(h);if(null!=d&&d>=t.depth)return n&&n(e.tr.lift(h,d).scrollIntoView()),!0;if(l&&cp(a,"start",!0)&&cp(o,"end")){let r=o,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let s=a,u=1;for(;!s.isTextblock;s=s.firstChild)u++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=Oo.empty;for(let e=i.length-1;e>=0;e--)r=Oo.from(i[e].copy(r));n(e.tr.step(new Wd(t.pos-i.length,t.pos+a.nodeSize,t.pos+u,t.pos+a.nodeSize-u,new bo(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function mp(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(ou.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}const Ep=mp(-1),gp=mp(1);function Ap(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let _p=Ap(lp,((e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!r)return!1;let i=hp(r);if(!i){let n=r.blockRange(),i=n&&qd(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let s=i.nodeBefore;if(fp(e,i,t,-1))return!0;if(0==r.parent.content.size&&(cp(s,"end")||uu.isSelectable(s)))for(let o=r.depth;;o--){let n=Qd(e.doc,r.before(o),r.after(o),bo.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cp(s,"end")?nu.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):uu.create(r.doc,i.pos-s.nodeSize)),t(r.scrollIntoView())}return!0}if(1==o||r.node(o-1).childCount>1)break}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=hp(r)}let o=s&&s.nodeBefore;return!(!o||!uu.isSelectable(o)||(t&&t(e.tr.setSelection(uu.create(e.doc,s.pos-o.nodeSize)).scrollIntoView()),0))})),Dp=Ap(lp,((e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let i=dp(r);if(!i)return!1;let s=i.nodeAfter;if(fp(e,i,t,1))return!0;if(0==r.parent.content.size&&(cp(s,"start")||uu.isSelectable(s))){let n=Qd(e.doc,r.before(),r.after(),bo.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cp(s,"start")?nu.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):uu.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=dp(r)}let o=s&&s.nodeAfter;return!(!o||!uu.isSelectable(o)||(t&&t(e.tr.setSelection(uu.create(e.doc,s.pos)).scrollIntoView()),0))}));const vp={Enter:Ap(((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}),((e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof cu||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=pp(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,s.createAndFill());o.setSelection(ou.create(o.doc,n+1)),t(o.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Jd(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&qd(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof uu&&e.selection.node.isBlock)return!(!n.parentOffset||!Jd(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let i,s,o=[],a=!1,u=!1;for(let d=n.depth;;d--){if(n.node(d).isBlock){a=n.end(d)==n.pos+(n.depth-d),u=n.start(d)==n.pos-(n.depth-d),s=pp(n.node(d-1).contentMatchAt(n.indexAfter(d-1))),o.unshift(a&&s?{type:s}:null),i=d;break}if(1==d)return!1;o.unshift(null)}let l=e.tr;(e.selection instanceof ou||e.selection instanceof cu)&&l.deleteSelection();let c=l.mapping.map(n.pos),h=Jd(l.doc,c,o.length,o);if(h||(o[0]=s?{type:s}:null,h=Jd(l.doc,c,o.length,o)),l.split(c,o.length,o),!a&&u&&n.node(i).type!=s){let e=l.mapping.map(n.before(i)),t=l.doc.resolve(e);s&&n.node(i-1).canReplaceWith(t.index(),t.index()+1,s)&&l.setNodeMarkup(l.mapping.map(n.before(i)),s)}return t&&t(l.scrollIntoView()),!0})),"Mod-Enter":(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=pp(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(nu.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Backspace:_p,"Mod-Backspace":_p,"Shift-Backspace":_p,Delete:Dp,"Mod-Delete":Dp,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new cu(e.doc))),!0)},Tp={"Ctrl-h":vp.Backspace,"Alt-Backspace":vp["Mod-Backspace"],"Ctrl-d":vp.Delete,"Ctrl-Alt-Backspace":vp["Mod-Delete"],"Alt-Delete":vp["Mod-Delete"],"Alt-d":vp["Mod-Delete"],"Ctrl-a":Ep,"Ctrl-e":gp};for(let os in vp)Tp[os]=vp[os];const Op=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?Tp:vp;function Sp(e,t){return e.reduce(((e,n,r)=>e.concat(t(n,r))),[])}var Cp={};function yp(e){return String.fromCharCode(parseInt(e.slice(1),16))}Object.defineProperty(Cp,"__esModule",{value:!0});var Np=Cp.encode=function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,yp))};function Ip(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Cp.decode=function(e){return decodeURIComponent(Array.from(atob(e),Ip).join(""))};const bp=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/;function Rp(e){const t=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(e)%Fp.length;return Fp[t]}function wp(e,t){const n=t.lastIndex;let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return t.lastIndex=n,i}function kp(e,t,n){let r=0;const i=[];for(const s of t)s.offset<r||(s.offset>r&&i.push(e.substring(r,s.offset)),i.push(...n(s)),r=s.offset+s.matchedText.length);return r<e.length&&i.push(e.substring(r)),i}function Lp(e){{const t=document.createElement("a");return t.href=e,t.hostname}}function Mp(e){const t=e.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}const Fp=["#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"],xp=(e,t,n=void 0)=>Sp(e,(e=>{if("string"==typeof e)return t(e,n);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:e.type,children:xp(e.children,t,e.type)}];case"link":return[{type:e.type,url:e.url,children:xp(e.children,t,e.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:e.type,action:e.action,params:e.params,children:xp(e.children,t,e.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[e]}}));function Bp(e,t){return n=>{const r=n;let i=0;const s=[];for(const o of wp(n,e)){o.index-i>0&&s.push(r.substring(i,o.index));const e=t(o);Array.isArray(e)?s.push(...e):s.push(e),i=o.index+o[0].length}return i<n.length&&s.push(n.substring(i)),s}}const Pp="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Up=(e=>(e[e.italic=1]="italic",e[e.strikethrough=2]="strikethrough",e[e.bold=4]="bold",e))(Up||{});const Hp=[0,1,2,3,4,5,6].map((e=>{const t=[];return 1&e||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&e||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&e||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map((e=>e.source)).join("|"),"g")})),$p={_:1,"*":4,"~":2};function jp(e){return Yp(e,0)}function Yp(e,t=0){const n=Hp[t],r=n?function(e){const t=Bp(zp.getOrCompute(e,(()=>new RegExp(`(?:^|[\\s${Pp}])(?:${e.source})(?=[\\s${Pp}]|$)`,"g"))),(e=>{const t=e[0][1],n=e[1]||e[2]||e[3]||e[4]||e[5]||e[6];return[" ",{type:Up[$p[t]],children:[n]}]}));return e=>{const[n,...r]=t(" "+e);return n.length>1&&r.unshift(n.substring(1)),r}}(n):()=>[e];return xp(r(e),((e,n)=>"bold"===n||"italic"===n||"strikethrough"===n?Yp(e,t|Up[n]):[e]))}const zp=function(){const e=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(t,n){if(e.has(t))return e.get(t);const r=n();return e.set(t,r),r}}}();function Vp(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function Gp(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function Wp(e){throw new Error("Unhandled case for value: '"+e+"'")}var Xp=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);t=s.shift();)-1===Vp(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);i.length&&(t=s.shift());){var o=Vp(i,t);-1!==o&&i.splice(o,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}(),Kp=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new Xp({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,s=r.length;i<s;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n=t.length,r=t.location;return"smart"===r?function(e,t,n){var r,i;null==n?(n="&hellip;",i=3,r=8):(i=n.length,r=n.length);var s=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},o=function(e,t){var r=t/2,i=Math.ceil(r),s=-1*Math.floor(r),o="";return s<0&&(o=e.substr(s)),e.substr(0,i)+n+o};if(e.length<=t)return e;var a=t-i,u=function(e){var t={},n=e,r=n.match(/^([a-z]+):\/\//i);return r&&(t.scheme=r[1],n=n.substr(r[0].length)),(r=n.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=r[1],n=n.substr(r[0].length)),(r=n.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=r[1],n=n.substr(r[0].length)),(r=n.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=r[1],n=n.substr(r[0].length)),(r=n.match(/^#(.*?)$/i))&&(t.fragment=r[1]),t}(e);if(u.query){var l=u.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);l&&(u.query=u.query.substr(0,l[1].length),e=s(u))}if(e.length<=t)return e;if(u.host&&(u.host=u.host.replace(/^www\./,""),e=s(u)),e.length<=t)return e;var c="";if(u.host&&(c+=u.host),c.length>=a)return u.host.length==t?(u.host.substr(0,t-i)+n).substr(0,a+r):o(c,a).substr(0,a+r);var h="";if(u.path&&(h+="/"+u.path),u.query&&(h+="?"+u.query),h){if((c+h).length>=a)return(c+h).length==t?(c+h).substr(0,t):(c+o(h,a-c.length)).substr(0,a+r);c+=h}if(u.fragment){var d="#"+u.fragment;if((c+d).length>=a)return(c+d).length==t?(c+d).substr(0,t):(c+o(d,a-c.length)).substr(0,a+r);c+=d}if(u.scheme&&u.host){var p=u.scheme+"://";if((c+p).length<a)return(p+c).substr(0,t)}if(c.length<=t)return c;var f="";return a>0&&(f=c.substr(-1*Math.floor(a/2))),(c.substr(0,Math.ceil(a/2))+n+f).substr(0,a+r)}(e,n):"middle"===r?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="&hellip;",r=8,i=3):(r=n.length,i=n.length);var s=t-i,o="";return s>0&&(o=e.substr(-1*Math.floor(s/2))),(e.substr(0,Math.ceil(s/2))+n+o).substr(0,s+r)}(e,n):function(e,t){return function(e,t,n){var r;return e.length>t&&(null==n?(n="&hellip;",r=3):r=n.length,e=e.substring(0,t-r)+n),e}(e,t,void 0)}(e,n)},e}(),qp=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),Jp=function(e,t){return Jp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Jp(e,t)};function Zp(e,t){function n(){this.constructor=e}Jp(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Qp,ef=function(){return ef=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ef.apply(this,arguments)},tf=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return Zp(t,e),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}(qp),nf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return Zp(t,e),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,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(qp),rf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return Zp(t,e),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 t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(qp),sf=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return Zp(t,e),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}(qp),of=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return Zp(t,e),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 t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}},t}(qp),af=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},uf=/[A-Za-z]/,lf=/[\d]/,cf=/[\D]/,hf=/\s/,df=/['"]/,pf=/[\x00-\x1F\x7F]/,ff=/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,mf=ff+/\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,Ef=/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,gf=mf+Ef,Af=mf+Ef,_f="(?:["+Ef+"]{1,3}\\.){3}["+Ef+"]{1,3}",Df="["+Af+"](?:["+Af+"\\-]{0,61}["+Af+"])?",vf=function(e){return"(?=("+Df+"))\\"+e},Tf=function(e){return"(?:"+vf(e)+"(?:\\."+vf(e+1)+"){0,126}|"+_f+")"},Of=new RegExp("["+Af+"]"),Sf=/(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,Cf=new RegExp("["+Af+"!#$%&'*+/=?^_`{|}~-]"),yf=new RegExp("^"+Sf.source+"$"),Nf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=Cf,t.strictTldRegex=yf,t}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],s=e.length,o=new If,a={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},u=0,l=0,c=o;u<s;){var h=e.charAt(u);switch(l){case 0:d(h);break;case 1:p(e.charAt(u-1),h);break;case 2:f(h);break;case 3:m(h);break;case 4:E(h);break;case 5:g(h);break;case 6:A(h);break;case 7:_(h);break;default:Wp(l)}u++}return T(),i;function d(e){"m"===e?D(1):n.test(e)&&D()}function p(e,t){":"===e?n.test(t)?(l=2,c=new If(ef(ef({},c),{hasMailtoPrefix:!0}))):v():a[e]===t||(n.test(t)?l=2:"."===t?l=3:"@"===t?l=4:v())}function f(e){"."===e?l=3:"@"===e?l=4:n.test(e)||v()}function m(e){"."===e||"@"===e?v():n.test(e)?l=2:v()}function E(e){Of.test(e)?l=5:v()}function g(e){"."===e?l=7:"-"===e?l=6:Of.test(e)||T()}function A(e){"-"===e||"."===e?T():Of.test(e)?l=5:T()}function _(e){"."===e||"-"===e?T():Of.test(e)?(l=5,c=new If(ef(ef({},c),{hasDomainDot:!0}))):T()}function D(e){void 0===e&&(e=2),l=e,c=new If({idx:u})}function v(){l=0,c=o}function T(){if(c.hasDomainDot){var n=e.slice(c.idx,u);/[-.]$/.test(n)&&(n=n.slice(0,-1));var s=c.hasMailtoPrefix?n.slice(7):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(s)&&i.push(new tf({tagBuilder:t,matchedText:n,offset:c.idx,email:s}))}v()}},t}(af),If=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},bf=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t||this.hasFullProtocolRegex.test(t)||this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+ff+"]"),e.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]*)?\/?$/,e}(),Rf=(Qp=new RegExp("[/?#](?:["+Af+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Af+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Tf(2),")","|","(","(//)?",/(?:www\.)/.source,Tf(6),")","|","(","(//)?",Tf(10)+"\\.",Sf.source,"(?![-"+gf+"])",")",")","(?::[0-9]+)?","(?:"+Qp.source+")?"].join(""),"gi")),wf=new RegExp("["+Af+"]"),kf=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=Rf,n.wordCharRegExp=wf,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,s=this.decodePercentEncoding,o=this.tagBuilder,a=[],u=function(){var n=t[0],u=t[1],c=t[4],h=t[5],d=t[9],p=t.index,f=h||d,m=e.charAt(p-1);if(!bf.isValid(n,u))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),l.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var E=l.matchHasInvalidCharAfterTld(n,u);E>-1&&(n=n.substr(0,E))}var g=["http://","https://"].find((function(e){return!!u&&-1!==u.indexOf(e)}));if(g){var A=n.indexOf(g);n=n.substr(A),u=u.substr(A),p+=A}var _=u?"scheme":c?"www":"tld",D=!!u;a.push(new of({tagBuilder:o,matchedText:n,offset:p,urlMatchType:_,url:n,protocolUrlMatch:D,protocolRelativeMatch:!!f,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:s}))},l=this;null!==(t=n.exec(e));)u();return a},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,s=e.length-1;i<s;i++){var o=e.charAt(i);o===t?r++:o===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+Af+"]*[-"+Af+"]\\.[-"+Af+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(af),Lf=new RegExp("#[_"+Af+"]{1,139}(?![_"+Af+"])","g"),Mf=new RegExp("[^"+Af+"]"),Ff=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Lf,n.nonWordCharRegex=Mf,n.serviceName=t.serviceName,n}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,s=this.tagBuilder,o=[];null!==(t=n.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||r.test(u)){var l=t[0],c=t[0].slice(1);o.push(new nf({tagBuilder:s,matchedText:l,offset:a,serviceName:i,hashtag:c}))}}return o},t}(af),xf=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"),Bf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=xf,t}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var s=t[0],o=s.replace(/[^0-9,;#]/g,""),a=!(!t[1]&&!t[2]),u=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+s.length,1),c=!u.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(s)&&c&&i.push(new sf({tagBuilder:r,matchedText:s,offset:t.index,number:o,plusSign:a}))}return i},t.prototype.testMatch=function(e){return cf.test(e)},t}(af),Pf=new RegExp("@[_"+Af+"]{1,50}(?![_"+Af+"])","g"),Uf=new RegExp("@[_."+Af+"]{1,30}(?![_"+Af+"])","g"),Hf=new RegExp("@[-_."+Af+"]{1,50}(?![-_"+Af+"])","g"),$f=new RegExp("[^"+Af+"]"),jf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:Pf,instagram:Uf,soundcloud:Hf},n.nonWordCharRegex=$f,n.serviceName=t.serviceName,n}return Zp(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,s=this.tagBuilder,o=[];if(!r)return o;for(;null!==(t=r.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||i.test(u)){var l=t[0].replace(/\.+$/g,""),c=l.slice(1);o.push(new rf({tagBuilder:s,matchedText:l,offset:a,serviceName:n,mention:c}))}}return o},t}(af);var Yf=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},zf=function(){function e(t){void 0===t&&(t={}),this.version=e.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="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&"twitter"!==n&&"instagram"!==n&&"soundcloud"!==n)throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(!1!==r&&"twitter"!==r&&"facebook"!==r&&"instagram"!==r)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 e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return function(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,s=t.onText,o=t.onComment,a=t.onDoctype,u=new Yf,l=0,c=e.length,h=0,d=0,p=u;l<c;){var f=e.charAt(l);switch(h){case 0:m(f);break;case 1:E(f);break;case 2:A(f);break;case 3:g(f);break;case 4:_(f);break;case 5:D(f);break;case 6:v(f);break;case 7:T(f);break;case 8:O(f);break;case 9:S(f);break;case 10:C(f);break;case 11:y(f);break;case 12:N(f);break;case 13:I();break;case 14:b(f);break;case 15:R(f);break;case 16:w(f);break;case 17:k(f);break;case 18:L(f);break;case 19:M(f);break;case 20:F(f);break;default:Wp(h)}l++}function m(e){"<"===e&&B()}function E(e){"!"===e?h=13:"/"===e?(h=2,p=new Yf(ef(ef({},p),{isClosing:!0}))):"<"===e?B():uf.test(e)?(h=3,p=new Yf(ef(ef({},p),{isOpening:!0}))):(h=0,p=u)}function g(e){hf.test(e)?(p=new Yf(ef(ef({},p),{name:U()})),h=4):"<"===e?B():"/"===e?(p=new Yf(ef(ef({},p),{name:U()})),h=12):">"===e?(p=new Yf(ef(ef({},p),{name:U()})),P()):uf.test(e)||lf.test(e)||":"===e||x()}function A(e){">"===e?x():uf.test(e)?h=3:x()}function _(e){hf.test(e)||("/"===e?h=12:">"===e?P():"<"===e?B():"="===e||df.test(e)||pf.test(e)?x():h=5)}function D(e){hf.test(e)?h=6:"/"===e?h=12:"="===e?h=7:">"===e?P():"<"===e?B():df.test(e)&&x()}function v(e){hf.test(e)||("/"===e?h=12:"="===e?h=7:">"===e?P():"<"===e?B():df.test(e)?x():h=5)}function T(e){hf.test(e)||('"'===e?h=8:"'"===e?h=9:/[>=`]/.test(e)?x():"<"===e?B():h=10)}function O(e){'"'===e&&(h=11)}function S(e){"'"===e&&(h=11)}function C(e){hf.test(e)?h=4:">"===e?P():"<"===e&&B()}function y(e){hf.test(e)?h=4:"/"===e?h=12:">"===e?P():"<"===e?B():(h=4,l--)}function N(e){">"===e?(p=new Yf(ef(ef({},p),{isClosing:!0})),P()):h=4}function I(t){"--"===e.substr(l,2)?(l+=2,p=new Yf(ef(ef({},p),{type:"comment"})),h=14):"DOCTYPE"===e.substr(l,7).toUpperCase()?(l+=7,p=new Yf(ef(ef({},p),{type:"doctype"})),h=20):x()}function b(e){"-"===e?h=15:">"===e?x():h=16}function R(e){"-"===e?h=18:">"===e?x():h=16}function w(e){"-"===e&&(h=17)}function k(e){h="-"===e?18:16}function L(e){">"===e?P():"!"===e?h=19:"-"===e||(h=16)}function M(e){"-"===e?h=17:">"===e?P():h=16}function F(e){">"===e?P():"<"===e&&B()}function x(){h=0,p=u}function B(){h=1,p=new Yf({idx:l})}function P(){var t=e.slice(d,p.idx);t&&s(t,d),"comment"===p.type?o(p.idx):"doctype"===p.type?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),x(),d=l+1}function U(){var t=p.idx+(p.isClosing?2:1);return e.slice(t,l).toLowerCase()}d<l&&(n=e.slice(d,l),s(n,d),d=l+1)}(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var s=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),o=n;s.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,o);i.push.apply(i,r)}o+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,s=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>i?t:t+1;e.splice(o,1);continue}e[t+1].getOffset()<s&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||Gp(e,(function(e){return"hashtag"===e.getType()})),this.email||Gp(e,(function(e){return"email"===e.getType()})),this.phone||Gp(e,(function(e){return"phone"===e.getType()})),this.mention||Gp(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||Gp(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||Gp(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||Gp(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,s=n.length;i<s;i++){for(var o=n[i].parseMatches(e),a=0,u=o.length;a<u;a++)o[a].setOffset(t+o[a].getOffset());r.push.apply(r,o)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var t=this.parse(e),n=[],r=0,i=0,s=t.length;i<s;i++){var o=t[i];n.push(e.substring(r,o.getOffset())),n.push(this.createMatchReturnVal(o)),r=o.getOffset()+o.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof Xp?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Ff({tagBuilder:e,serviceName:this.hashtag}),new Nf({tagBuilder:e}),new Bf({tagBuilder:e}),new jf({tagBuilder:e,serviceName:this.mention}),new kf({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new Kp({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=Kp,e.HtmlTag=Xp,e.matcher={Email:Nf,Hashtag:Ff,Matcher:af,Mention:jf,Phone:Bf,Url:kf},e.match={Email:tf,Hashtag:nf,Match:qp,Mention:rf,Phone:sf,Url:of},e}();function Vf(e,t=e){return{type:"autolink",url:e,text:t}}const Gf=Bp(/<!!mention:([^>\s]*?)\|(.*?)>/gm,(([e,t,n])=>function(e,t){return{type:"mention",id:e,text:t}}(decodeURIComponent(t),n))),Wf=Bp(/<!!customemoji:(.*?)>/gm,(([e,t])=>function(e){return{type:"customemoji",text:e}}(t))),Xf=Bp(/<((?:https?|mailto):.*?)\|(.*?)>/gi,(([e,t,n])=>function(e,t=[]){return{type:"link",url:e,children:t}}(t,[n]))),Kf=Bp(/<actionlink:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Jf(t);return function(e,t,n=[]){return{type:"actionlink",action:e,params:t,children:n}}(r,i,[n])})),qf=Bp(/<actionbutton:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Jf(t);return function(e,t,n=[]){return{type:"actionbutton",action:e,params:t,children:n}}(r,i,[n])}));function Jf(e){const t=e.indexOf("?");return-1===t?{action:e,params:{}}:{action:e.slice(0,t),params:Object.fromEntries(new URLSearchParams(e.slice(t)))}}const Zf=Bp(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,(([e])=>function(e=[]){return{type:"bulletlist",children:e}}([e.startsWith("\n")?e.slice(1):e]))),Qf=Bp(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,(([e,t])=>({type:"bulletpoint",children:[t]}))),em=e=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let n=0;const r=[];for(const i of wp(e,t)){const t=i[0],s=i[1],o=t.startsWith(s)?i.index:i.index+1;o-n>0&&r.push(e.substring(n,o));const a=Vf("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(a),n=o+s.length}return n<e.length&&r.push(e.substring(n)),r},tm=e=>Xf(e).flatMap((e=>"string"==typeof e?nm(e):["<",...nm(e.url),...nm("|"+e.children[0]+">")])),nm=e=>{const t=zf.parse(e,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),n=[];let r=0;for(const i of t){const t=i.getOffset(),s=i.getMatchedText(),o=s.length;let a=s;i instanceof tf?a="mailto:"+i.getEmail():i instanceof of&&(a=i.getUrl()),t>r&&n.push(e.substring(r,t)),n.push(Vf(a,s)),r=t+o}return r<e.length&&n.push(e.substring(r)),n},rm=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"];const im=function(){const e=RegExp("[^\n]+\n?|\n","g");return t=>Array.from(t.match(e)||[])}();function sm(e,t={except:[]}){let n=function(e,t){let n=[e];return n=om(n,t.multilineSteps),n=om(n,[im]),n=om(n,t.singlelineSteps),n=am(n),n}(e,function(e={except:[]}){const t={multilineSteps:[],singlelineSteps:[]},n=e.except??rm.filter((t=>!e.only.includes(t)));return n.includes("BulletPoint")||t.multilineSteps.push(Zf,Qf),n.includes("Mention")||t.singlelineSteps.push(Gf),n.includes("CustomEmoji")||t.singlelineSteps.push(Wf),n.includes("Codespan")||t.multilineSteps.push(Bp(/```([^]+?)```/g,(([e,t])=>({type:"codespan",text:t})))),n.includes("FormattedLink")||t.singlelineSteps.push(Xf),n.includes("Actions")||(t.singlelineSteps.push(Kf),t.singlelineSteps.push(qf)),n.includes("Wikitext")||t.singlelineSteps.push(jp),n.includes("Autolink")||t.singlelineSteps.push(tm,em),t}(t));return n=um(n,!1),n}function om(e,t){return t.reduce(((e,t)=>xp(e,t)),e)}function am(e){const t=[];let n=-1;for(const r of e)"string"==typeof r?"string"==typeof t[n]?t[n]+=r:t[++n]=r:t[++n]="children"in r?{...r,children:am(r.children)}:r;return t}function um(e,t){const n=[];let r=[];for(let i=0;i<e.length;i++){const s=e[i];"string"==typeof s?r.push(s):"children"in s?(r.length>0&&(n.push(r.join("")),r=[]),s.children=um(s.children,t||"link"===s.type||"actionbutton"===s.type||"actionlink"===s.type),n.push(s)):"autolink"===s.type&&t?r.push(s.text):(r.length>0&&(n.push(r.join("")),r=[]),n.push(s))}return r.length>0&&(n.push(r.join("")),r=[]),n}function lm(e,t,n,r=0,i=[]){for(const s of n)if("string"==typeof s){for(const n of i)e.addMark(t+r,t+r+s.length,n.create());r+=s.length}else if("bold"===s.type||"italic"===s.type||"strikethrough"===s.type){r+=1;const n=kh.marks[s.type],o=[...i,n];[e,r]=lm(e,t,s.children,r,o),r+=1}else si.unreachable();return[e,r]}function cm(e){return(t,n)=>{if(!n)return!0;let r=t.tr;const i=ou.between(t.selection.$from,t.selection.$to);return r=r.replaceRangeWith(i.from,i.from,kh.text(e,r.storedMarks)),r=r.replaceRangeWith(i.to+1,i.to+1,kh.text(e,r.storedMarks)),r=r.setSelection(ou.near(r.doc.resolve(i.to+1))),n(r),!0}}function hm({placeholder:e,disabled:t,className:n="",characterLimit:r,spellcheck:i}){const s=li(),o=le(),a=le(null);return ae((()=>(o.current=function(e,t,n,r){const i=_u.create({schema:kh,plugins:[...[].filter(pm),bd(),Kh({...Op,"Mod-z":wd,"Mod-y":kd,"Mod-b":cm("*"),"Mod-i":cm("_"),"Mod-Enter":Op.Enter,"Shift-Enter":Op.Enter,Enter:n}),Kh({Enter:Op.Enter}),Mh]}),s=function(){let e,t=0;return n=>{const r=(r=Date.now())=>{window.clearTimeout(e),e=void 0,t=r;const i=function(e){(e=(e=(e=e.removeMark(0,e.doc.content.size,kh.marks.bold)).removeMark(0,e.doc.content.size,kh.marks.italic)).removeMark(0,e.doc.content.size,kh.marks.strikethrough)).doc.firstChild;const t=function(e){const t=[];let n,r="";return e.descendants(((e,i)=>(e.isText?(r+=e.text,n??=i):r&&void 0!==n&&(t.push({text:r,pos:n}),r="",n=void 0),e.type!==kh.nodes.mention))),r&&void 0!==n&&t.push({text:r,pos:n}),t}(e.doc);for(const{text:n,pos:r}of t){const t=sm(n,{only:["Wikitext"]});[e]=lm(e,r,t)}return e}(n.state.tr);n.dispatch(i)},i=Date.now();i-t<300?e||(e=window.setTimeout(r,300)):r(i)}}(),o=new yh(e,{handlePaste:(e,t,n)=>function(e,t,n){const r=t.clipboardData;if(!r)return!1;const i=function(e){const t=e.items||[],n={"image/gif":"gif","image/png":"png","image/jpeg":"jpg","image/svg+xml":"svg"},r=Array.from(t).filter((e=>"file"===e.kind&&n[e.type]));if(0===r.length)return;if(e.types.includes("text/rtf"))return;const i=r[0];let s=i.getAsFile();if(!s.name){const e="image."+n[i.type];s=new File([s],e,{type:i.type,lastModified:Date.now()})}return s}(r);return i?n(i):function(e,t){const n=e.state.tr.insertText(t).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");e.dispatch(n)}(e,r.getData("text/plain")),!0}(e,t,r),clipboardTextSerializer(e){const t=[];return e.content.forEach((e=>{e&&t.push(e.textContent.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1"))})),t.join()},state:i,dispatchTransaction(e){e=(e=e.removeStoredMark(kh.marks.literal)).removeStoredMark(kh.marks.emoji);const n=o.state.apply(e);o.state.doc.eq(n.doc)||t(new dm(n.doc)),o.updateState(n),e.steps.some((e=>e instanceof Gd))&&setTimeout((()=>s(o)),0)}});return o}(a.current,(e=>s.onChange(e)),(()=>!!s.onEnter&&(s.onEnter(),!0)),(e=>s.onPasteImage(e))),s.editorView=o.current,()=>{s.editorView=void 0,o.current?.destroy()})),[s]),ae((()=>{o.current?.setProps({editable:()=>!t})}),[t]),ae((()=>Xn((()=>o.current?.setProps({attributes:{spellcheck:String(s.spellcheck$.get()??i??!1),class:"t-text-input","aria-label":"Message Field",role:"textbox"}})))),[s,i]),ae((()=>Xn((()=>{const t=o.current;t?.dispatch(t.state.tr.setMeta(Mh,s.placeholder$.get()??e))}))),[s,e]),ae((()=>{r&&Number.isInteger(r)&&s.setMaxLength(r)}),[r,s]),It("div",{className:`t-editor ${n}`,ref:a})}class dm{constructor(e){this.doc=e,this.size=this.doc.content.size,this.hasContent=Fh(this.doc)}static{this.EMPTY=new dm(kh.topNodeType.create())}asText(){return this.doc.textContent.replace(/\xa0/g," ")}}function pm(e){return null!=e}class fm{constructor(e,t,n,r){this.send=t,this.attachFile=n,this.shareLocation=r,this.isEmpty=e.isEmpty,this.isTyping=e.isTyping,this.atTextLimit=e.atTextLimit,this.characterCount=e.characterCount}}class mm{constructor(e){this.state$=e,this.currentDoc=dm.EMPTY,this.maxLength=1e3,this.markAsTyping=function(e){let t=!1;return(...n)=>{if(!t)return t=!0,setTimeout((()=>{t=!1}),5e3),e(...n)}}((()=>{this.controller?.markAsTyping()})),this.spellcheck$=yr(),this.placeholder$=yr()}onPasteImage(e){si.defined(this.uploadFile),this.uploadFile(e)}onChange(e){this.currentDoc=e;const t=e.asText(),n=e.size>this.maxLength&&t.length>this.maxLength;e.hasContent&&this.markAsTyping(),this.state$.assign({isTyping:e.hasContent,atTextLimit:n,isEmpty:!e.hasContent||0===t.trim().length,characterCount:0===e.size?0:e.size-2})}setMaxLength(e){this.maxLength=e}focus(){this.editorView?.dom.focus()}setText(e){this.editorView&&function(e,t){const n=e.state.doc.content.size,r=t.split(/(<!!(?:mention|customemoji):.*?>)/g).filter((e=>e||e.length)).map((e=>kh.text(e))),i=e.state.tr.replaceWith(0,n,r);e.dispatch(i)}(this.editorView,e)}typeText(e){this.editorView&&function(e,t,n="replace"){const r=e.state.doc.content.size,i="insert"==n?e.state.tr.insertText(t):e.state.tr.insertText(t,0,r);e.dispatch(i)}(this.editorView,e,"insert")}getText(){return this.currentDoc.asText().trim()}clearText(){this.editorView&&function(e){const t=e.state.doc.content.size,n=e.state.tr.insertText("",0,t);e.dispatch(n)}(this.editorView)}}const Em=()=>!0;async function gm(e,t,{initialDelay:n,maxDelay:r,log:i,shouldRetry:s=Em}){return t().catch((async o=>{if(i&&i(`[TalkJS] Retries left: ${e}. Error: ${JSON.stringify(o)}.`),0===e)throw o;if(!(await s(o)))throw o;const a=1e3*n*1.2,u=(r?Math.min(1e3*r,a):a)*(1-.05+2*Math.random()*.05);return function(e){return e<=0?Promise.resolve():new Promise((t=>setTimeout(t,e)))}(u).then((()=>gm(e-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:s})))}))}function Am(){const e={},t=new Promise((function(t,n){e.resolve=t,e.reject=n}));return e.promise=t,e}function _m(e,t,n){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=pe(di);return de((async()=>{function n(t){"denied"===t&&i({type:e})}if(!r||!(await async function(e){if(!("permissions"in navigator))return!1;const t=e;try{return"prompt"===(await navigator.permissions.query({name:t})).state}catch(e){return!1}}(e)))return t((e=>{n(e)}));const s=Am(),o=Am(),a={type:e,showPrompt:async()=>(o.resolve({cancelled:!1}),await s.promise),cancel:()=>{o.resolve({cancelled:!0})}};try{r(a)}catch(e){Ss.error("Your beforeBrowserPermissionPrompt callback threw an error: ",e),o.resolve({cancelled:!0})}const{cancelled:u}=await o.promise;return u?void 0:t((e=>{s.resolve(e),n(e)}))}),[r,i,e,t,...n])}async function Dm(e,t,n){const r=document.createElement(e);try{return r.src=URL.createObjectURL(t),await new Promise(((t,i)=>{const s="img"===e?"load":"loadedmetadata";r.addEventListener(s,(()=>{try{t(n(r))}catch(e){i(e)}}),{once:!0})}))}finally{URL.revokeObjectURL(r.src)}}var vm=function(e,t,n,r){var i;t[0]=0;for(var s=1;s<t.length;s++){var o=t[s++],a=t[s]?(t[0]|=o?1:2,n[t[s++]]):t[++s];3===o?r[0]=a:4===o?r[1]=Object.assign(r[1]||{},a):5===o?(r[1]=r[1]||{})[t[++s]]=a:6===o?r[1][t[++s]]+=a+"":o?(i=e.apply(a,vm(e,a,n,["",null])),r.push(i),a[0]?t[0]|=2:(t[s-2]=0,t[s]=i)):r.push(a)}return r},Tm=new Map;function Om(e){var t=Tm.get(this);return t||(t=new Map,Tm.set(this,t)),(t=vm(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i="",s="",o=[0],a=function(e){1===r&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?o.push(0,e,i):3===r&&(e||i)?(o.push(3,e,i),r=2):2===r&&"..."===i&&e?o.push(4,e,0):2===r&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&5===r)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=""},u=0;u<e.length;u++){u&&(1===r&&a(),a(u));for(var l=0;l<e[u].length;l++)t=e[u][l],1===r?"<"===t?(a(),o=[o],r=3):i+=t:4===r?"--"===i&&">"===t?(r=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(a(),r=1):r&&("="===t?(r=5,n=i,i=""):"/"===t&&(r<5||">"===e[u][l+1])?(a(),3===r&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),r=2):i+=t),3===r&&"!--"===i&&(r=4,o=o[0])}return a(),o}(e)),t),arguments,[])).length>1?t:t[0]}const Sm={TALK_GMK:"AIzaSyAs_WXNLlj31EHJI_Lw8siO2B3ZJLUzBH0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}.TALK_GMK;function Cm(e){e=Math.floor(e);const t=Math.floor(e/3600);e%=3600;const n=Math.floor(e/60);e%=60;const r=e=>e.toString().padStart(2,"0");let i=`${r(n)}:${r(e)}`;return t>0&&(i=`${r(t)}:${i}`),i}const ym=36e5,Nm=864e5;function Im(e,t,n){return new Intl.RelativeTimeFormat(n).format(-e,t)}function bm(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Rm(e,t){return n=>{if(e&&e(n),!n.defaultPrevented)return t(n)}}function wm(e){return"boolean"==typeof e}function km(e){return!(!e||"[object Function]"!={}.toString.call(e))}function Lm(e,t){if(null!=e)if(km(e))e(t);else try{e.current=t}catch(n){throw new Error(`Cannot assign value "${t}" to ref "${e}"`)}}function Mm(...e){return de((t=>{for(let n of e)Lm(n,t)}),e)}function Fm(e){return bm()?e?e.ownerDocument:document:null}function xm(e){return"which"in e?3===e.which:"button"in e&&2===e.button}function Bm(...e){return e.filter((e=>null!=e)).join("--")}function Pm(){}function Um(){let[,e]=se(Object.create(null));return de((()=>{e(Object.create(null))}),[])}var Hm=bm()?ue:ae;function $m(e){const t=le(null);return ae((()=>{t.current=e}),[e]),t.current}var jm=({children:e,type:t="reach-portal",containerRef:n})=>{let r=le(null),i=le(null),s=Um();return ae((()=>{null!=n&&("object"==typeof n&&"current"in n?null==n.current&&console.warn("@reach/portal: A ref was passed to the `containerRef` prop of a `Portal`, but no DOM node was attached to it. Be sure to pass the ref to a DOM component.\n\nIf you are forwarding the ref from another component, be sure to use the React.forwardRef API. See https://reactjs.org/docs/forwarding-refs.html."):console.warn("@reach/portal: Invalid value passed to the `containerRef` of a `Portal`. The portal will be appended to the document body, but if you want to attach it to another DOM node you must pass a valid React ref object to `containerRef`."))}),[n]),Hm((()=>{if(!r.current)return;let e=r.current.ownerDocument,o=n?.current||e.body;return i.current=e?.createElement(t),o.appendChild(i.current),s(),()=>{i.current&&o&&o.removeChild(i.current)}}),[t,s,n]),i.current?Ke(e,i.current):_("span",{ref:r})},Ym=({unstable_skipInitialRender:e,...t})=>{let[n,r]=se(!1);return ae((()=>{e&&r(!0)}),[e]),e&&!n?null:_(jm,{...t})};Ym.displayName="Portal";var zm,Vm=["bottom","height","left","right","top","width"],Gm=new Map,Wm=function e(){var t=[];Gm.forEach((function(e,n){var r=n.getBoundingClientRect();(function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),Vm.some((function(n){return e[n]!==t[n]}))})(r,e.rect)&&(e.rect=r,t.push(e))})),t.forEach((function(e){e.callbacks.forEach((function(t){return t(e.rect)}))})),zm=window.requestAnimationFrame(e)};function Xm(e,t,n){let r,i;wm(t)?r=t:(r=t?.observe??!0,i=t?.onChange),km(n)&&(i=n),ae((()=>{wm(t)&&console.warn("Passing `observe` as the second argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `observe` property as the second argument (`useRect(ref, { observe })`).\nSee https://reach.tech/rect#userect-observe")}),[t]),ae((()=>{km(n)&&console.warn("Passing `onChange` as the third argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `onChange` property as the second argument (`useRect(ref, { onChange })`).\nSee https://reach.tech/rect#userect-onchange")}),[n]);let[s,o]=se(e.current),a=le(!1),u=le(!1),[l,c]=se(null),h=le(i);return Hm((()=>{h.current=i,e.current!==s&&o(e.current)})),Hm((()=>{s&&!a.current&&(a.current=!0,c(s.getBoundingClientRect()))}),[s]),Hm((()=>{if(!r)return;let t=s;if(u.current||(u.current=!0,t=e.current),!t)return void console.warn("You need to place the ref");let n=(i=t,o=e=>{h.current?.(e),c(e)},{observe:function(){var e=0===Gm.size;Gm.has(i)?Gm.get(i).callbacks.push(o):Gm.set(i,{rect:void 0,hasRectChanged:!1,callbacks:[o]}),e&&Wm()},unobserve:function(){var e=Gm.get(i);if(e){var t=e.callbacks.indexOf(o);t>=0&&e.callbacks.splice(t,1),e.callbacks.length||Gm.delete(i),Gm.size||cancelAnimationFrame(zm)}}});var i,o;return n.observe(),()=>{n.unobserve()}}),[r,s,e]),l}var Km=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),qm="undefined"==typeof Element,Jm=qm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Zm=!qm&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Qm=function e(t,n,r){for(var i=[],s=Array.from(t);s.length;){var o=s.shift();if("SLOT"===o.tagName){var a=o.assignedElements(),u=e(a.length?a:o.children,!0,r);r.flatten?i.push.apply(i,u):i.push({scope:o,candidates:u})}else{Jm.call(o,Km)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),c=!r.shadowRootFilter||r.shadowRootFilter(o);if(l&&c){var h=e(!0===l?o.children:l.children,!0,r);r.flatten?i.push.apply(i,h):i.push({scope:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},eE=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},tE=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},nE=function(e){return"INPUT"===e.tagName},rE=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},iE=function(e,t){return!(function(e){return function(e){return nE(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Zm(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var i=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!i||i===e}(e)}(t)||eE(t)<0||!function(e,t){return!(t.disabled||function(e){return nE(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var i=Jm.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Jm.call(i,"details:not([open]) *"))return!0;var s=Zm(e).host,o=(null==s?void 0:s.ownerDocument.contains(s))||e.ownerDocument.contains(e);if(n&&"full"!==n){if("non-zero-area"===n)return rE(e)}else{if("function"==typeof r){for(var a=e;e;){var u=e.parentElement,l=Zm(e);if(u&&!u.shadowRoot&&!0===r(u))return rE(e);e=e.assignedSlot?e.assignedSlot:u||l===e.ownerDocument?u:l.host}e=a}if(o)return!e.getClientRects().length}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Jm.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))}(e,t))},sE=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},oE=function e(t){var n=[],r=[];return t.forEach((function(t,i){var s=!!t.scope,o=s?t.scope:t,a=eE(o,s),u=s?e(t.candidates):o;0===a?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:a,item:t,isScope:s,content:u})})),r.sort(tE).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},aE=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Qm([e],t.includeContainer,{filter:iE.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:sE}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(Km));return t&&Jm.call(e,Km)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,iE.bind(null,t)),oE(n)},uE=Fe((function({unstable_skipInitialPortalRender:e,...t},n){return _(Ym,{unstable_skipInitialRender:e},_(lE,{ref:n,...t}))}));uE.displayName="Popover";var lE=Fe((function({as:e="div",targetRef:t,position:n=dE,unstable_observableRefs:r=[],...i},s){const o=le(null),a=Xm(o,{observe:!i.hidden}),u=Xm(t,{observe:!0}),l=Mm(o,s);return function(e,t){const n=Fm(e.current);function r(e){"Tab"===e.key&&t.current&&0===aE(t.current).length||("Tab"===e.key&&e.shiftKey?function(e){if(!e.shiftKey)return;const t=i();return e.target===t}(e)?function(e){const n=t.current&&aE(t.current),r=n&&n[n.length-1];r&&(e.preventDefault(),r.focus())}(e):function(e){const n=t.current&&aE(t.current);return!!n&&0!==n.length&&e.target===n[0]}(e)?o(e):function(e){return e.target===aE(n)[0]}(e)&&u():"Tab"===e.key&&(s()?function(e){const n=t.current&&aE(t.current);n&&n[0]&&(e.preventDefault(),n[0].focus())}(e):function(){if(t.current&&t.current.contains(n.activeElement||null)){const e=t.current&&aE(t.current);return Boolean(e&&e[e.length-1]===n.activeElement)}return!1}()?function(e){const t=i();t&&(e.preventDefault(),t.focus())}(e):function(e){const r=t.current?aE(n).filter((e=>!t.current.contains(e))):null;return!!r&&e.target===r[r.length-1]}(e)&&u()))}function i(){const r=aE(n),i=r&&e.current?r.indexOf(e.current):-1,s=r&&r[i+1];return(!t.current||!t.current.contains(s||null))&&s}function s(){return!!e.current&&e.current===n.activeElement}function o(t){t.preventDefault(),e.current?.focus()}ae((()=>(n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)})),[]);let a=[];function u(){const e=t.current&&aE(t.current);e&&(e.forEach((e=>{a.push([e,e.tabIndex]),e.tabIndex=-1})),n.addEventListener("focusin",l))}function l(){n.removeEventListener("focusin",l),a.forEach((([e,t])=>{e.tabIndex=t}))}}(t,o),_(e,{"data-reach-popover":"",ref:l,...i,style:{position:"absolute",...cE(n,u,a,...r),...i.style}})}));function cE(e,t,n,...r){return n?e(t,n,...r.map((e=>e.current))):{visibility:"hidden"}}function hE(e,t,n){return{top:n?`${e.top-t.height+window.pageYOffset}px`:`${e.top+e.height+window.pageYOffset}px`}}lE.displayName="PopoverImpl";var dE=(e,t)=>{if(!e||!t)return{};const{directionRight:n,directionUp:r}=function(e,t,n=0,r=0){const i={top:e.top-t.height<0,right:window.innerWidth<e.left+t.width-n,bottom:window.innerHeight<e.bottom+t.height-r,left:e.left+e.width-t.width<0};return{directionRight:i.right&&!i.left,directionLeft:i.left&&!i.right,directionUp:i.bottom&&!i.top,directionDown:i.top&&!i.bottom}}(e,t);return{left:n?`${e.right-t.width+window.pageXOffset}px`:`${e.left+window.pageXOffset}px`,...hE(e,t,r)}},pE=!1,fE=0;function mE(){return++fE}var EE=yt["useId".toString()];function gE({context:e,children:t,items:n,set:r}){let i=de((({element:e,index:t,...n})=>e?(r((r=>{if(null!=t&&-1!==t)return _E(r,{element:e,index:t,...n},t);if(0===r.length)return[{...n,element:e,index:0}];if(r.find((t=>t.element===e)))return console.warn("[reach-ui]: `useDescendant` was called with an element that was already registered.\n\nIf you are using the `@reach/descendants` package directly, make sure to only register descendants once. Registering a descendant more than once will lead to bugs in your app.\n\nIf you are using another `reach-ui` package, this is probably our bug!\n\nTo report a bug, open a new issue:\n\n https://github.com/reach/reach-ui/issues/new?assignees=&labels=&template=Bug_report.md\n\nIMPORTANT: this check will only run in the development build, so if you see this warning please be aware that your app may crash when deployed."),function(e){return e.sort(((e,t)=>e.element&&t.element?AE(e.element,t.element)?-1:1:0)).map(((e,t)=>({...e,index:t})))}(r);let i,s=function(e,t){if(!t)return-1;if(!e.length)return-1;let n=e.length;for(;n--;){let r=e[n].element;if(r&&AE(r,t))return n+1}return-1}(r,e);return i=-1===s?[...r,{...n,element:e,index:r.length}]:_E(r,{...n,element:e,index:s},s),i})),()=>{e&&r((t=>t.filter((t=>e!==t.element))))}):Pm),[]);return _(e.Provider,{value:he((()=>({descendants:n,registerDescendant:i})),[n,i])},t)}function AE(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function _E(e,t,n){return null!=n&&n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}var DE="CLEAR_SELECTION_INDEX",vE="CLICK_MENU_ITEM",TE="CLOSE_MENU",OE="OPEN_MENU_AT_INDEX",SE="OPEN_MENU_CLEARED",CE="SEARCH_FOR_ITEM",yE="SELECT_ITEM_AT_INDEX",NE="SET_BUTTON_ID",IE=function(e,t={}){let n=z({descendants:[],registerDescendant:()=>Pm,...t});return n.displayName=e,n}("DropdownDescendantContext"),[bE,RE]=function(e){let t=z(void 0);function n(e){let{children:n,...r}=e,i=he((()=>r),Object.values(r));return _(t.Provider,{value:i},n)}return t.displayName=`${e}Context`,n.displayName=`${e}Provider`,[n,function(n){let r=pe(t);if(r)return r;throw Error(`${n} must be rendered inside of a ${e} component.`)}]}("Dropdown"),wE={triggerId:null,isExpanded:!1,typeaheadQuery:"",selectionIndex:-1},kE=({id:e,children:t})=>{let n=le(null),r=le(null),i=le(null),[s,o]=se([]),a=function(e){if(void 0!==EE){let t=EE();return e??t}let t=e??(pE?mE():null),[n,r]=se(t);return Hm((()=>{null===n&&r(mE())}),[]),ae((()=>{!1===pE&&(pE=!0)}),[]),e??n??void 0}(e),u=e||Bm("menu",a),l=Bm("menu-button",u),[c,h]=oe(YE,{...wE,triggerId:l}),d=le(!1),p=le([]),f=le(!1),m=le({x:0,y:0});return ae((()=>{c.isExpanded?(window.__REACH_DISABLE_TOOLTIPS=!0,window.requestAnimationFrame((()=>{jE(r.current)}))):window.__REACH_DISABLE_TOOLTIPS=!1}),[c.isExpanded]),_(gE,{context:IE,items:s,set:o},_(bE,{dispatch:h,dropdownId:u,dropdownRef:r,mouseDownStartPosRef:m,popoverRef:i,readyToSelect:f,selectCallbacks:p,state:c,triggerClickedRef:d,triggerRef:n},km(t)?t({isExpanded:c.isExpanded,isOpen:c.isExpanded}):t))};function LE({onKeyDown:e,onMouseDown:t,id:n,ref:r,...i}){let{dispatch:s,dropdownId:o,mouseDownStartPosRef:a,triggerClickedRef:u,triggerRef:l,state:{triggerId:c,isExpanded:h}}=RE("useDropdownTrigger"),d=Mm(l,r),p=zE(),f=he((()=>p.findIndex((e=>!e.disabled))),[p]);return ae((()=>{null!=n&&n!==c&&s({type:NE,payload:n})}),[c,s,n]),ae((()=>{null==n&&s({type:NE,payload:Bm("menu-button",o)})}),[o,s,n]),{data:{isExpanded:h,controls:o},props:{...i,ref:d,id:c||void 0,onKeyDown:Rm(e,(function(e){switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),s({type:OE,payload:{index:f}});break;case"Enter":case" ":s({type:OE,payload:{index:f}})}})),onMouseDown:Rm(t,(function(e){xm(e.nativeEvent)||(a.current={x:e.clientX,y:e.clientY},h||(u.current=!0),s(h?{type:TE}:{type:SE}))})),type:"button"}}}kE.displayName="DropdownProvider";var ME=Fe((({as:e="button",...t},n)=>{let{props:r}=LE({...t,ref:n});return _(e,{"data-reach-dropdown-trigger":"",...r})}));function FE({index:e,isLink:t=!1,onClick:n,onDragStart:r,onMouseDown:i,onMouseEnter:s,onMouseLeave:o,onMouseMove:a,onMouseUp:u,onSelect:l,disabled:c,onFocus:h,valueText:d,ref:p,...f}){let{dispatch:m,dropdownRef:E,mouseDownStartPosRef:g,readyToSelect:A,selectCallbacks:_,triggerRef:D,state:{selectionIndex:v,isExpanded:T}}=RE("useDropdownItem"),O=le(null),[S,C]=se(d||""),y=de((e=>{!d&&e?.textContent&&C(e.textContent)}),[d]),N=le(!1),[I,b]=function(e){let[t,n]=se(null);return[t,de((t=>{e.current=t,n(t)}),[])]}(O),R=function(e,t,n){let r=Um(),{registerDescendant:i,descendants:s}=pe(t),o=n??s.findIndex((t=>t.element===e.element));return Hm((()=>(e.element||r(),i({...e,index:o}))),[e,r,o,i,...Object.values(e)]),o}(he((()=>({element:I,key:S,disabled:c,isLink:t})),[c,I,t,S]),IE,e),w=R===v&&!c,k=Mm(p,b,y);function L(){jE(D.current),l&&l(),m({type:vE})}return _.current[R]=l,ae((()=>{if(T){let e=window.setTimeout((()=>{A.current=!0}),400);return()=>{window.clearTimeout(e)}}A.current=!1}),[T,A]),ae((()=>{let e=Fm(O.current);return e.addEventListener("mouseup",t),()=>{e.removeEventListener("mouseup",t)};function t(){N.current=!1}}),[]),{data:{disabled:c},props:{id:$E(R),tabIndex:-1,...f,ref:k,"data-disabled":c?"":void 0,"data-selected":w?"":void 0,"data-valuetext":S,onClick:Rm(n,(function(e){xm(e.nativeEvent)||t&&(c?e.preventDefault():L())})),onDragStart:Rm(r,(function(e){t&&e.preventDefault()})),onMouseDown:Rm(i,(function(e){xm(e.nativeEvent)||(t?N.current=!0:e.preventDefault())})),onMouseEnter:Rm(s,(function(e){let t=Fm(E.current);w||null==R||c||(E?.current&&E.current!==t.activeElement&&O.current!==t.activeElement&&E.current.focus(),m({type:yE,payload:{index:R}}))})),onMouseLeave:Rm(o,(function(e){m({type:DE})})),onMouseMove:Rm(a,(function(e){if(!A.current){let t=8,n=Math.abs(e.clientX-g.current.x),r=Math.abs(e.clientY-g.current.y);(n>t||r>t)&&(A.current=!0)}w||null==R||c||m({type:yE,payload:{index:R,dropdownRef:E}})})),onFocus:Rm(h,(function(){A.current=!0,w||null==R||c||m({type:yE,payload:{index:R}})})),onMouseUp:Rm(u,(function(e){xm(e.nativeEvent)||(A.current?t?N.current?N.current=!1:O.current&&O.current.click():c||L():A.current=!0)}))}}}ME.displayName="DropdownTrigger";var xE=Fe((({as:e="div",...t},n)=>{let{props:r}=FE({...t,ref:n});return _(e,{"data-reach-dropdown-item":"",...r})}));function BE({id:e,onKeyDown:t,ref:n,...r}){let{dispatch:i,triggerRef:s,dropdownRef:o,selectCallbacks:a,dropdownId:u,state:{isExpanded:l,triggerId:c,selectionIndex:h,typeaheadQuery:d}}=RE("useDropdownItems"),p=zE(),f=Mm(o,n);ae((()=>{let e=function(e,t=""){if(!t)return null;let n=e.find((e=>!e.disabled&&e.element?.dataset?.valuetext?.toLowerCase().startsWith(t)));return n?e.indexOf(n):null}(p,d);d&&null!=e&&i({type:yE,payload:{index:e,dropdownRef:o}});let t=window.setTimeout((()=>d&&i({type:CE,payload:""})),1e3);return()=>window.clearTimeout(t)}),[i,p,d,o]);let m=$m(p.length),E=$m(p[h]),g=$m(h);ae((()=>{h>p.length-1?i({type:yE,payload:{index:p.length-1,dropdownRef:o}}):m!==p.length&&h>-1&&E&&g===h&&p[h]!==E&&i({type:yE,payload:{index:p.findIndex((e=>e.key===E?.key)),dropdownRef:o}})}),[o,i,p,m,E,g,h]);let A=Rm((function(e){let{key:t}=e;if(l)switch(t){case"Enter":case" ":let n=p.find((e=>e.index===h));n&&!n.disabled&&(e.preventDefault(),n.isLink&&n.element?n.element.click():(jE(s.current),a.current[n.index]&&a.current[n.index](),i({type:vE})));break;case"Escape":jE(s.current),i({type:TE});break;case"Tab":e.preventDefault();break;default:if("string"==typeof t&&1===t.length){let e=d+t.toLowerCase();i({type:CE,payload:e})}}}),function(e,t){let{descendants:n}=pe(e),{callback:r,currentIndex:i,filter:s,key:o="index",orientation:a="vertical",rotate:u=!0,rtl:l=!1}=t;return function(e){if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(e.key))return;let t=i??-1,c=s?n.filter(s):n;if(!c.length)return;let h=c.findIndex((e=>e.index===i));function d(){return t===m().index?u?f():c[h]:c[(h+1)%c.length]}function p(){return t===f().index?u?m():c[h]:c[(h-1+c.length)%c.length]}function f(){return c[0]}function m(){return c[c.length-1]}switch(e.key){case"ArrowDown":if("vertical"===a||"both"===a){e.preventDefault();let t=d();r("option"===o?t:t[o])}break;case"ArrowUp":if("vertical"===a||"both"===a){e.preventDefault();let t=p();r("option"===o?t:t[o])}break;case"ArrowLeft":if("horizontal"===a||"both"===a){e.preventDefault();let t=(l?d:p)();r("option"===o?t:t[o])}break;case"ArrowRight":if("horizontal"===a||"both"===a){e.preventDefault();let t=(l?p:d)();r("option"===o?t:t[o])}break;case"PageUp":e.preventDefault();let t=(e.ctrlKey?p:f)();r("option"===o?t:t[o]);break;case"Home":e.preventDefault();let n=f();r("option"===o?n:n[o]);break;case"PageDown":e.preventDefault();let i=(e.ctrlKey?d:m)();r("option"===o?i:i[o]);break;case"End":e.preventDefault();let s=m();r("option"===o?s:s[o])}}}(IE,{currentIndex:h,orientation:"vertical",rotate:!1,filter:e=>!e.disabled,callback:e=>{i({type:yE,payload:{index:e,dropdownRef:o}})},key:"index"}));return{data:{activeDescendant:$E(h)||void 0,triggerId:c},props:{tabIndex:-1,...r,ref:f,id:u,onKeyDown:Rm(t,A)}}}xE.displayName="DropdownItem";var PE=Fe((({as:e="div",...t},n)=>{let{props:r}=BE({...t,ref:n});return _(e,{"data-reach-dropdown-items":"",...r})}));function UE({onBlur:e,portal:t=!0,position:n,ref:r,...i}){let{triggerRef:s,triggerClickedRef:o,dispatch:a,dropdownRef:u,popoverRef:l,state:{isExpanded:c}}=RE("useDropdownPopover"),h=Mm(l,r);return ae((()=>{if(!c)return;let e=Fm(l.current);function t(e){var t,n;o.current?o.current=!1:(t=l.current,n=e.target,t&&t.contains(n)||a({type:TE}))}return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}}),[o,s,a,u,l,c]),{data:{portal:t,position:n,targetRef:s,isExpanded:c},props:{ref:h,hidden:!c,onBlur:Rm(e,(e=>{e.currentTarget.contains(e.relatedTarget)||a({type:TE})})),...i}}}PE.displayName="DropdownItems";var HE=Fe((({as:e="div",...t},n)=>{let{data:{portal:r,targetRef:i,position:s},props:o}=UE({...t,ref:n}),a={"data-reach-dropdown-popover":""};return r?_(uE,{...o,...a,as:e,targetRef:i,position:s,unstable_skipInitialPortalRender:!0}):_(e,{...o,...a})}));function $E(e){let{dropdownId:t}=RE("useItemId");return null!=e&&e>-1?Bm(`option-${e}`,t):void 0}function jE(e){e&&e.focus()}function YE(e,t={}){switch(t.type){case vE:case TE:return{...e,isExpanded:!1,selectionIndex:-1};case"OPEN_MENU_AT_FIRST_ITEM":return{...e,isExpanded:!0,selectionIndex:0};case OE:return{...e,isExpanded:!0,selectionIndex:t.payload.index};case SE:return{...e,isExpanded:!0,selectionIndex:-1};case yE:{let{dropdownRef:n={current:null}}=t.payload;if(t.payload.index>=0&&t.payload.index!==e.selectionIndex){if(n.current){let e=Fm(n.current);n.current!==e?.activeElement&&n.current.focus()}return{...e,selectionIndex:null!=t.payload.max?Math.min(Math.max(t.payload.index,0),t.payload.max):Math.max(t.payload.index,0)}}return e}case DE:return{...e,selectionIndex:-1};case NE:return{...e,triggerId:t.payload};case CE:return void 0!==t.payload?{...e,typeaheadQuery:t.payload}:e;default:return e}}function zE(){return pe(IE).descendants}HE.displayName="DropdownPopover";var VE={exports:{}},GE={},WE=Symbol.for("react.transitional.element"),XE=Symbol.for("react.portal"),KE=Symbol.for("react.fragment"),qE=Symbol.for("react.strict_mode"),JE=Symbol.for("react.profiler"),ZE=Symbol.for("react.consumer"),QE=Symbol.for("react.context"),eg=Symbol.for("react.forward_ref"),tg=Symbol.for("react.suspense"),ng=Symbol.for("react.suspense_list"),rg=Symbol.for("react.memo"),ig=Symbol.for("react.lazy"),sg=Symbol.for("react.offscreen"),og=Symbol.for("react.client.reference");function ag(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case WE:switch(e=e.type){case KE:case JE:case qE:case tg:case ng:return e;default:switch(e=e&&e.$$typeof){case QE:case eg:case ig:case rg:case ZE:return e;default:return t}}case XE:return t}}}GE.ContextConsumer=ZE,GE.ContextProvider=QE,GE.Element=WE,GE.ForwardRef=eg,GE.Fragment=KE,GE.Lazy=ig,GE.Memo=rg,GE.Portal=XE,GE.Profiler=JE,GE.StrictMode=qE,GE.Suspense=tg,GE.SuspenseList=ng,GE.isContextConsumer=function(e){return ag(e)===ZE},GE.isContextProvider=function(e){return ag(e)===QE},GE.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===WE},GE.isForwardRef=function(e){return ag(e)===eg},GE.isFragment=function(e){return ag(e)===KE},GE.isLazy=function(e){return ag(e)===ig},GE.isMemo=function(e){return ag(e)===rg},GE.isPortal=function(e){return ag(e)===XE},GE.isProfiler=function(e){return ag(e)===JE},GE.isStrictMode=function(e){return ag(e)===qE},GE.isSuspense=function(e){return ag(e)===tg},GE.isSuspenseList=function(e){return ag(e)===ng},GE.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===KE||e===JE||e===qE||e===tg||e===ng||e===sg||"object"==typeof e&&null!==e&&(e.$$typeof===ig||e.$$typeof===rg||e.$$typeof===QE||e.$$typeof===ZE||e.$$typeof===eg||e.$$typeof===og||void 0!==e.getModuleId)},GE.typeOf=ag,VE.exports=GE;var ug=VE.exports,lg=Fe((({as:e=T,id:t,children:n,...r},i)=>{let s=he((()=>{try{return ug.isFragment(_(e,null))}catch(e){return!1}}),[e])?{}:{ref:i,id:t,"data-reach-menu":"",...r};return _(e,{...s},_(kE,{id:t,children:n}))}));lg.displayName="Menu";var cg=Fe((({as:e="button",...t},n)=>{let{data:{isExpanded:r,controls:i},props:s}=LE({...t,ref:n});return _(e,{"aria-expanded":!!r||void 0,"aria-haspopup":!0,"aria-controls":i,...s,"data-reach-menu-button":""})}));cg.displayName="MenuButton";var hg=Fe((({as:e="div",...t},n)=>{let{data:{disabled:r},props:i}=FE({...t,ref:n});return _(e,{role:"menuitem",...i,"aria-disabled":r||void 0,"data-reach-menu-item":""})}));hg.displayName="MenuItemImpl";var dg=Fe((({as:e="div",...t},n)=>_(hg,{...t,ref:n,as:e})));dg.displayName="MenuItem";var pg=Fe((({as:e="div",...t},n)=>{let{data:{activeDescendant:r,triggerId:i},props:s}=BE({...t,ref:n});return _(e,{"aria-activedescendant":r,"aria-labelledby":i||void 0,role:"menu",...s,"data-reach-menu-items":""})}));pg.displayName="MenuItems";var fg=Fe((({as:e="a",component:t,onSelect:n,...r},i)=>(ae((()=>{t&&console.warn("[@reach/menu-button]: Please use the `as` prop instead of `component`")}),[t]),_(hg,{...r,ref:i,"data-reach-menu-link":"",as:e,isLink:!0,onSelect:n||Pm}))));fg.displayName="MenuLink";var mg=Fe((({portal:e=!0,...t},n)=>_(Eg,{portal:e},_(pg,{...t,ref:n,"data-reach-menu-list":""}))));mg.displayName="MenuList";var Eg=Fe((({as:e="div",...t},n)=>{let{data:{portal:r,targetRef:i,position:s},props:o}=UE({...t,ref:n}),a={"data-reach-menu-popover":""};return r?_(uE,{...o,...a,as:e,targetRef:i,position:s,unstable_skipInitialPortalRender:!0}):_(e,{...o,...a})}));Eg.displayName="MenuPopover";var gg=[],Ag=function(e){return void 0===e},_g=/\s*(\.\d+|\d+(?:\.\d+)?)(%|deg)?\s*/,Dg=/\s*(\.\d+|100|\d?\d(?:\.\d+)?)%\s*/,vg=new RegExp("^(rgb|hsl|hsv)a?\\("+_g.source+"[, ]"+_g.source+"[, ]"+_g.source+"(?:[,/]"+_g.source+")?\\)$","i");function Tg(e,t,n){return"%"===e?100:"deg"===e||n&&0===t?360:e?void 0:255}function Og(e){if(Array.isArray(e)){if("string"==typeof e[0]&&"function"==typeof Og[e[0]])return new Og[e[0]](e.slice(1,e.length));if(4===e.length)return new Og.RGB(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}else if("string"==typeof e){var t=e.toLowerCase();Og.namedColors[t]&&(e="#"+Og.namedColors[t]),"transparent"===t&&(e="rgba(0,0,0,0)");var n=e.match(vg);if(n){var r=n[1].toUpperCase(),i="H"===r[0];if(Ag(Og[r]))throw new Error("color."+r+" is not installed.");let e=Ag(n[8])?1:void 0;return void 0===e&&(e="%"===n[9]?parseFloat(n[8])/100:parseFloat(n[8])),new Og[r](parseFloat(n[2])/Tg(n[3],0,i),parseFloat(n[4])/Tg(n[5],1,i),parseFloat(n[6])/Tg(n[7],2,i),e)}e.length<6&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,"$1$1$2$2$3$3$4$4"));var s=e.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])?$/i);if(s)return new Og.RGB(parseInt(s[1],16)/255,parseInt(s[2],16)/255,parseInt(s[3],16)/255,s[4]?parseInt(s[4],16)/255:1);if(Og.CMYK){var o=e.match(new RegExp("^cmyk\\("+Dg.source+","+Dg.source+","+Dg.source+","+Dg.source+"\\)$","i"));if(o)return new Og.CMYK(parseFloat(o[1])/100,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(o[4])/100)}}else if("object"==typeof e&&e.isColor)return e;return!1}Og.namedColors={},Og.installColorSpace=function(e,t,n){Og[e]=function(n){var r=Array.isArray(n)?n:arguments;t.forEach((function(n,i){var s=r[i];if("alpha"===n)this._alpha=isNaN(s)||s>1?1:s<0?0:s;else{if(isNaN(s))throw new Error("["+e+"]: Invalid color: ("+t.join(",")+")");"hue"===n?this._hue=s<0?s-Math.floor(s):s%1:this["_"+n]=s<0?0:s>1?1:s}}),this)},Og[e].propertyNames=t;var r=Og[e].prototype;for(var i in["valueOf","hex","hexa","css","cssa"].forEach((function(t){r[t]=r[t]||("RGB"===e?r.hex:function(){return this.rgb()[t]()})})),r.isColor=!0,r.equals=function(n,r){Ag(r)&&(r=1e-10),n=n[e.toLowerCase()]();for(var i=0;i<t.length;i+=1)if(Math.abs(this["_"+t[i]]-n["_"+t[i]])>r)return!1;return!0},r.toJSON=function(){return[e].concat(t.map((function(e){return this["_"+e]}),this))},n)if(Object.prototype.hasOwnProperty.call(n,i)){var s=i.match(/^from(.*)$/);s?Og[s[1].toUpperCase()].prototype[e.toLowerCase()]=n[i]:r[i]=n[i]}function o(e,t){var n={};for(var r in n[t.toLowerCase()]=function(){return this.rgb()[t.toLowerCase()]()},Og[t].propertyNames.forEach((function(e){var r="black"===e?"k":e.charAt(0);n[e]=n[r]=function(n,r){return this[t.toLowerCase()]()[e](n,r)}})),n)Object.prototype.hasOwnProperty.call(n,r)&&void 0===Og[e].prototype[r]&&(Og[e].prototype[r]=n[r])}return r[e.toLowerCase()]=function(){return this},r.toString=function(){return"["+e+" "+t.map((function(e){return this["_"+e]}),this).join(", ")+"]"},t.forEach((function(e){var n="black"===e?"k":e.charAt(0);r[e]=r[n]=function(n,r){return void 0===n?this["_"+e]:r?new this.constructor(t.map((function(t){return this["_"+t]+(e===t?n:0)}),this)):new this.constructor(t.map((function(t){return e===t?n:this["_"+t]}),this))}})),gg.forEach((function(t){o(e,t),o(t,e)})),gg.push(e),Og},Og.pluginList=[],Og.use=function(e){return-1===Og.pluginList.indexOf(e)&&(this.pluginList.push(e),e(Og)),Og},Og.installMethod=function(e,t){return gg.forEach((function(n){Og[n].prototype[e]=t})),this},Og.installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var e=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=Math.round(255*this._alpha).toString(16);return this.hex()+"00".substr(0,2-e.length)+e},css:function(){return"rgb("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+")"},cssa:function(){return"rgba("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+","+this._alpha+")"}});var Sg=function(e){e.installColorSpace("XYZ",["x","y","z","alpha"],{fromRgb:function(){var t=function(e){return e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92},n=t(this._red),r=t(this._green),i=t(this._blue);return new e.XYZ(.4124564*n+.3575761*r+.1804375*i,.2126729*n+.7151522*r+.072175*i,.0193339*n+.119192*r+.9503041*i,this._alpha)},rgb:function(){var t=this._x,n=this._y,r=this._z,i=function(e){return e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e};return new e.RGB(i(3.2404542*t+-1.5371385*n+-.4985314*r),i(-.969266*t+1.8760108*n+.041556*r),i(.0556434*t+-.2040259*n+1.0572252*r),this._alpha)},lab:function(){var t=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},n=t(this._x/95.047),r=t(this._y/100),i=t(this._z/108.883);return new e.LAB(116*r-16,500*(n-r),200*(r-i),this._alpha)}})},Cg=function(e){e.installColorSpace("HSV",["hue","saturation","value","alpha"],{rgb:function(){var t,n,r,i=this._hue,s=this._saturation,o=this._value,a=Math.min(5,Math.floor(6*i)),u=6*i-a,l=o*(1-s),c=o*(1-u*s),h=o*(1-(1-u)*s);switch(a){case 0:t=o,n=h,r=l;break;case 1:t=c,n=o,r=l;break;case 2:t=l,n=o,r=h;break;case 3:t=l,n=c,r=o;break;case 4:t=h,n=l,r=o;break;case 5:t=o,n=l,r=c}return new e.RGB(t,n,r,this._alpha)},hsl:function(){var t,n=(2-this._saturation)*this._value,r=this._saturation*this._value,i=n<=1?n:2-n;return t=i<1e-9?0:r/i,new e.HSL(this._hue,t,n/2,this._alpha)},fromRgb:function(){var t,n=this._red,r=this._green,i=this._blue,s=Math.max(n,r,i),o=s-Math.min(n,r,i),a=0===s?0:o/s,u=s;if(0===o)t=0;else switch(s){case n:t=(r-i)/o/6+(r<i?1:0);break;case r:t=(i-n)/o/6+1/3;break;case i:t=(n-r)/o/6+2/3}return new e.HSV(t,a,u,this._alpha)}})},yg=function(e){e.use(Cg),e.installColorSpace("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var t,n=2*this._lightness,r=this._saturation*(n<=1?n:2-n);return t=n+r<1e-9?0:2*r/(n+r),new e.HSV(this._hue,t,(n+r)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}})},Ng=function(e){function t(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}e.installMethod("luminance",(function(){var e=this.rgb();return.2126*t(e._red)+.7152*t(e._green)+.0722*t(e._blue)}))},Ig=function(e){e.installMethod("isDark",(function(){var e=this.rgb();return(255*e._red*299+255*e._green*587+255*e._blue*114)/1e3<128}))},bg=Og.use(Sg).use((function(e){e.use(Sg),e.installColorSpace("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var t=function(e){var t=Math.pow(e,3);return t>.008856?t:(e-16/116)/7.87},n=(this._l+16)/116,r=this._a/500+n,i=n-this._b/200;return new e.XYZ(95.047*t(r),100*t(n),108.883*t(i),this._alpha)}})})).use(Cg).use(yg).use((function(e){e.installColorSpace("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new e.RGB(1-this._cyan*(1-this._black)-this._black,1-this._magenta*(1-this._black)-this._black,1-this._yellow*(1-this._black)-this._black,this._alpha)},fromRgb:function(){var t=this._red,n=this._green,r=this._blue,i=1-t,s=1-n,o=1-r,a=1;return t||n||r?(i=(i-(a=Math.min(i,Math.min(s,o))))/(1-a),s=(s-a)/(1-a),o=(o-a)/(1-a)):a=1,new e.CMYK(i,s,o,a,this._alpha)}})})).use((function(e){e.namedColors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}})).use((function(e){e.installMethod("clearer",(function(e){return this.alpha(isNaN(e)?-.1:-e,!0)}))})).use((function(e){e.use(Ng),e.installMethod("contrast",(function(e){var t=this.luminance(),n=e.luminance();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)}))})).use((function(e){e.use(yg),e.installMethod("darken",(function(e){return this.lightness(isNaN(e)?-.1:-e,!0)}))})).use((function(e){e.use(yg),e.installMethod("desaturate",(function(e){return this.saturation(isNaN(e)?-.1:-e,!0)}))})).use((function(e){function t(){var t=this.rgb(),n=.3*t._red+.59*t._green+.11*t._blue;return new e.RGB(n,n,n,t._alpha)}e.installMethod("greyscale",t).installMethod("grayscale",t)})).use(Ig).use((function(e){e.use(Ig),e.installMethod("isLight",(function(){return!this.isDark()}))})).use((function(e){e.use(yg),e.installMethod("lighten",(function(e){return this.lightness(isNaN(e)?.1:e,!0)}))})).use(Ng).use((function(e){e.installMethod("mix",(function(t,n){t=e(t).rgb();var r=2*(n=1-(isNaN(n)?.5:n))-1,i=this._alpha-t._alpha,s=((r*i==-1?r:(r+i)/(1+r*i))+1)/2,o=1-s,a=this.rgb();return new e.RGB(a._red*s+t._red*o,a._green*s+t._green*o,a._blue*s+t._blue*o,a._alpha*n+t._alpha*(1-n))}))})).use((function(e){e.installMethod("negate",(function(){var t=this.rgb();return new e.RGB(1-t._red,1-t._green,1-t._blue,this._alpha)}))})).use((function(e){e.installMethod("opaquer",(function(e){return this.alpha(isNaN(e)?.1:e,!0)}))})).use((function(e){e.use(yg),e.installMethod("rotate",(function(e){return this.hue((e||0)/360,!0)}))})).use((function(e){e.use(yg),e.installMethod("saturate",(function(e){return this.saturation(isNaN(e)?.1:e,!0)}))})).use((function(e){e.installMethod("toAlpha",(function(e){var t=this.rgb(),n=e(e).rgb(),r=new e.RGB(0,0,0,t._alpha),i=["_red","_green","_blue"];return i.forEach((function(e){t[e]<1e-10?r[e]=t[e]:t[e]>n[e]?r[e]=(t[e]-n[e])/(1-n[e]):t[e]>n[e]?r[e]=(n[e]-t[e])/n[e]:r[e]=0})),r._red>r._green?r._red>r._blue?t._alpha=r._red:t._alpha=r._blue:r._green>r._blue?t._alpha=r._green:t._alpha=r._blue,t._alpha<1e-10||(i.forEach((function(e){t[e]=(t[e]-n[e])/t._alpha+n[e]})),t._alpha*=r._alpha),t}))}));const Rg=br(bg);function wg(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function a(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;let kg=class{constructor(){this.listeners={}}on(e,t,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),null==n?void 0:n.once){const n=()=>{this.un(e,n),this.un(e,t)};return this.on(e,n),n}return()=>this.un(e,t)}un(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}};const Lg={decode:function(e,t){return wg(this,void 0,void 0,(function*(){const n=new AudioContext({sampleRate:t});return n.decodeAudioData(e).finally((()=>n.close()))}))},createBuffer:function(e,t){return"number"==typeof e[0]&&(e=[e]),function(e){const t=e[0];if(t.some((e=>e>1||e<-1))){const n=t.length;let r=0;for(let e=0;e<n;e++){const n=Math.abs(t[e]);n>r&&(r=n)}for(const t of e)for(let e=0;e<n;e++)t[e]/=r}}(e),{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:t=>null==e?void 0:e[t],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Mg(e,t){const n=t.xmlns?document.createElementNS(t.xmlns,e):document.createElement(e);for(const[r,i]of Object.entries(t))if("children"===r)for(const[e,s]of Object.entries(t))"string"==typeof s?n.appendChild(document.createTextNode(s)):n.appendChild(Mg(e,s));else"style"===r?Object.assign(n.style,i):"textContent"===r?n.textContent=i:n.setAttribute(r,i.toString());return n}function Fg(e,t,n){const r=Mg(e,t||{});return null==n||n.appendChild(r),r}var xg=Object.freeze({__proto__:null,createElement:Fg,default:Fg});const Bg={fetchBlob:function(e,t,n){return wg(this,void 0,void 0,(function*(){const r=yield fetch(e,n);if(r.status>=400)throw new Error(`Failed to fetch ${e}: ${r.status} (${r.statusText})`);return function(e,t){wg(this,void 0,void 0,(function*(){if(!e.body||!e.headers)return;const n=e.body.getReader(),r=Number(e.headers.get("Content-Length"))||0;let i=0;const s=e=>wg(this,void 0,void 0,(function*(){i+=(null==e?void 0:e.length)||0;const n=Math.round(i/r*100);t(n)})),o=()=>wg(this,void 0,void 0,(function*(){let e;try{e=yield n.read()}catch(e){return}e.done||(s(e.value),yield o())}));o()}))}(r.clone(),t),r.blob()}))}};let Pg=class extends kg{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),null!=e.playbackRate&&this.onMediaEvent("canplay",(()=>{null!=e.playbackRate&&(this.media.playbackRate=e.playbackRate)}),{once:!0})}onMediaEvent(e,t,n){return this.media.addEventListener(e,t,n),()=>this.media.removeEventListener(e,t,n)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}canPlayType(e){return""!==this.media.canPlayType(e)}setSrc(e,t){const n=this.getSrc();if(e&&n===e)return;this.revokeSrc();const r=t instanceof Blob&&(this.canPlayType(t.type)||!e)?URL.createObjectURL(t):e;try{this.media.src=r}catch(t){this.media.src=e}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return wg(this,void 0,void 0,(function*(){return this.media.play()}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(e,t){null!=t&&(this.media.preservesPitch=t),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}},Ug=class e extends kg{constructor(e,t){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,i]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=i.querySelector(".scroll"),this.wrapper=i.querySelector(".wrapper"),this.canvasWrapper=i.querySelector(".canvases"),this.progressWrapper=i.querySelector(".progress"),this.cursor=i.querySelector(".cursor"),t&&i.appendChild(t),this.initEvents()}parentFromOptionsContainer(e){let t;if("string"==typeof e?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("Container not found");return t}initEvents(){const e=e=>{const t=this.wrapper.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;return[n/t.width,r/t.height]};if(this.wrapper.addEventListener("click",(t=>{const[n,r]=e(t);this.emit("click",n,r)})),this.wrapper.addEventListener("dblclick",(t=>{const[n,r]=e(t);this.emit("dblclick",n,r)})),!0!==this.options.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:e,scrollWidth:t,clientWidth:n}=this.scrollContainer,r=e/t,i=(e+n)/t;this.emit("scroll",r,i,e,e+n)})),"function"==typeof ResizeObserver){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{e().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const e=this.parent.clientWidth;e===this.lastContainerWidth&&"auto"!==this.options.height||(this.lastContainerWidth=e,this.reRender())}initDrag(){this.subscriptions.push(function(e,t,n,r,i=3,s=0,o=100){if(!e)return()=>{};const a=matchMedia("(pointer: coarse)").matches;let u=()=>{};const l=l=>{if(l.button!==s)return;l.preventDefault(),l.stopPropagation();let c=l.clientX,h=l.clientY,d=!1;const p=Date.now(),f=r=>{if(r.preventDefault(),r.stopPropagation(),a&&Date.now()-p<o)return;const s=r.clientX,u=r.clientY,l=s-c,f=u-h;if(d||Math.abs(l)>i||Math.abs(f)>i){const r=e.getBoundingClientRect(),{left:i,top:o}=r;d||(null==n||n(c-i,h-o),d=!0),t(l,f,s-i,u-o),c=s,h=u}},m=t=>{if(d){const n=t.clientX,i=t.clientY,s=e.getBoundingClientRect(),{left:o,top:a}=s;null==r||r(n-o,i-a)}u()},E=e=>{e.relatedTarget&&e.relatedTarget!==document.documentElement||m(e)},g=e=>{d&&(e.stopPropagation(),e.preventDefault())},A=e=>{d&&e.preventDefault()};document.addEventListener("pointermove",f),document.addEventListener("pointerup",m),document.addEventListener("pointerout",E),document.addEventListener("pointercancel",E),document.addEventListener("touchmove",A,{passive:!1}),document.addEventListener("click",g,{capture:!0}),u=()=>{document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",m),document.removeEventListener("pointerout",E),document.removeEventListener("pointercancel",E),document.removeEventListener("touchmove",A),setTimeout((()=>{document.removeEventListener("click",g,{capture:!0})}),10)}};return e.addEventListener("pointerdown",l),()=>{u(),e.removeEventListener("pointerdown",l)}}(this.wrapper,((e,t,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))}),(e=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))}),(e=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))})))}getHeight(e,t){var n;const r=(null===(n=this.audioData)||void 0===n?void 0:n.numberOfChannels)||1;if(null==e)return 128;if(!isNaN(Number(e)))return Number(e);if("auto"===e){const e=this.parent.clientHeight||128;return(null==t?void 0:t.every((e=>!e.overlay)))?e/r:e}return 128}initHtml(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"});return t.innerHTML=`\n <style>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases" part="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[e,t]}setOptions(e){if(this.options.container!==e.container){const t=this.parentFromOptionsContainer(e.container);t.appendChild(this.container),this.parent=t}!0!==e.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(e){this.scrollContainer.scrollLeft=e}setScrollPercentage(e){const{scrollWidth:t}=this.scrollContainer,n=t*e;this.setScroll(n)}destroy(){var e,t;this.subscriptions.forEach((e=>e())),this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(t=this.unsubscribeOnScroll)||void 0===t||t.call(this)}createDelay(e=10){let t,n;const r=()=>{t&&clearTimeout(t),n&&n()};return this.timeouts.push(r),()=>new Promise(((i,s)=>{r(),n=s,t=setTimeout((()=>{t=void 0,n=void 0,i()}),e)}))}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const t=document.createElement("canvas"),n=t.getContext("2d"),r=t.height*(window.devicePixelRatio||1),i=n.createLinearGradient(0,0,0,r),s=1/(e.length-1);return e.forEach(((e,t)=>{const n=t*s;i.addColorStop(n,e)})),i}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(e,t,n,r){const i=e[0],s=e[1]||e[0],o=i.length,{width:a,height:u}=n.canvas,l=u/2,c=this.getPixelRatio(),h=t.barWidth?t.barWidth*c:1,d=t.barGap?t.barGap*c:t.barWidth?h/2:0,p=t.barRadius||0,f=a/(h+d)/o,m=p&&"roundRect"in n?"roundRect":"rect";n.beginPath();let E=0,g=0,A=0;for(let _=0;_<=o;_++){const e=Math.round(_*f);if(e>E){const i=Math.round(g*l*r),s=i+Math.round(A*l*r)||1;let o=l-i;"top"===t.barAlign?o=0:"bottom"===t.barAlign&&(o=u-s),n[m](E*(h+d),o,h,s,p),E=e,g=0,A=0}const o=Math.abs(i[_]||0),a=Math.abs(s[_]||0);o>g&&(g=o),a>A&&(A=a)}n.fill(),n.closePath()}renderLineWaveform(e,t,n,r){const i=t=>{const i=e[t]||e[0],s=i.length,{height:o}=n.canvas,a=o/2,u=n.canvas.width/s;n.moveTo(0,a);let l=0,c=0;for(let e=0;e<=s;e++){const s=Math.round(e*u);if(s>l){const e=a+(Math.round(c*a*r)||1)*(0===t?-1:1);n.lineTo(l,e),l=s,c=0}const o=Math.abs(i[e]||0);o>c&&(c=o)}n.lineTo(l,a)};n.beginPath(),i(0),i(1),n.fill(),n.closePath()}renderWaveform(e,t,n){if(n.fillStyle=this.convertColorValues(t.waveColor),t.renderFunction)return void t.renderFunction(e,n);let r=t.barHeight||1;if(t.normalize){const t=Array.from(e[0]).reduce(((e,t)=>Math.max(e,Math.abs(t))),0);r=t?1/t:1}t.barWidth||t.barGap||t.barAlign?this.renderBarWaveform(e,t,n,r):this.renderLineWaveform(e,t,n,r)}renderSingleCanvas(e,t,n,r,i,s,o){const a=this.getPixelRatio(),u=document.createElement("canvas");u.width=Math.round(n*a),u.height=Math.round(r*a),u.style.width=`${n}px`,u.style.height=`${r}px`,u.style.left=`${Math.round(i)}px`,s.appendChild(u);const l=u.getContext("2d");if(this.renderWaveform(e,t,l),u.width>0&&u.height>0){const e=u.cloneNode(),n=e.getContext("2d");n.drawImage(u,0,0),n.globalCompositeOperation="source-in",n.fillStyle=this.convertColorValues(t.progressColor),n.fillRect(0,0,u.width,u.height),o.appendChild(e)}}renderMultiCanvas(t,n,r,i,s,o){const a=this.getPixelRatio(),{clientWidth:u}=this.scrollContainer;if(u*a>=r)return void this.renderSingleCanvas(t,n,u,i,0,s,o);const l=r/a;let c=Math.min(e.MAX_CANVAS_WIDTH,u,l),h={};if(n.barWidth||n.barGap){const e=n.barWidth||.5,t=e+(n.barGap||e/2);c%t!=0&&(c=Math.floor(c/t)*t)}const d=e=>{if(e<0||e>=p)return;if(h[e])return;h[e]=!0;const r=e*c,a=Math.min(l-r,c);if(a<=0)return;const u=t.map((e=>{const t=Math.floor(r/l*e.length),n=Math.floor((r+a)/l*e.length);return e.slice(t,n)}));this.renderSingleCanvas(u,n,a,i,r,s,o)},p=Math.ceil(l/c),f=this.scrollContainer.scrollLeft/l,m=Math.floor(f*p);d(m-1),d(m),d(m+1),p>1&&(this.unsubscribeOnScroll=this.on("scroll",(()=>{const{scrollLeft:t}=this.scrollContainer,n=Math.floor(t/l*p);Object.keys(h).length>e.MAX_NODES&&(s.innerHTML="",o.innerHTML="",h={}),d(n-1),d(n),d(n+1)})))}renderChannel(e,t,n,r){var{overlay:i}=t,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["overlay"]);const o=document.createElement("div"),a=this.getHeight(s.height,s.splitChannels);o.style.height=`${a}px`,i&&r>0&&(o.style.marginTop=`-${a}px`),this.canvasWrapper.style.minHeight=`${a}px`,this.canvasWrapper.appendChild(o);const u=o.cloneNode();this.progressWrapper.appendChild(u),this.renderMultiCanvas(e,s,n,a,o,u)}render(e){return wg(this,void 0,void 0,(function*(){var t;this.timeouts.forEach((e=>e())),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const n=this.getPixelRatio(),r=this.scrollContainer.clientWidth,i=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrollable=i>r;const s=this.options.fillParent&&!this.isScrollable,o=(s?r:i)*n;if(this.wrapper.style.width=s?"100%":`${i}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=e,this.emit("render"),this.options.splitChannels)for(let a=0;a<e.numberOfChannels;a++){const n=Object.assign(Object.assign({},this.options),null===(t=this.options.splitChannels)||void 0===t?void 0:t[a]);this.renderChannel([e.getChannelData(a)],n,o,a)}else{const t=[e.getChannelData(0)];e.numberOfChannels>1&&t.push(e.getChannelData(1)),this.renderChannel(t,this.options,o,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){var e;if(null===(e=this.unsubscribeOnScroll)||void 0===e||e.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:n}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:e}=this.progressWrapper.getBoundingClientRect();let t=e-n;t*=2,t=t<0?Math.floor(t):Math.ceil(t),t/=2,this.scrollContainer.scrollLeft+=t}}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,t=!1){const{scrollLeft:n,scrollWidth:r,clientWidth:i}=this.scrollContainer,s=e*r,o=n,a=n+i,u=i/2;if(this.isDragging){const e=30;s+e>a?this.scrollContainer.scrollLeft+=e:s-e<o&&(this.scrollContainer.scrollLeft-=e)}else{(s<o||s>a)&&(this.scrollContainer.scrollLeft=s-(this.options.autoCenter?u:0));const e=s-n-u;t&&this.options.autoCenter&&e>0&&(this.scrollContainer.scrollLeft+=Math.min(e,10))}{const e=this.scrollContainer.scrollLeft,t=e/r,n=(e+i)/r;this.emit("scroll",t,n,e,e+i)}}renderProgress(e,t){if(isNaN(e))return;const n=100*e;this.canvasWrapper.style.clipPath=`polygon(${n}% 0, 100% 0, 100% 100%, ${n}% 100%)`,this.progressWrapper.style.width=`${n}%`,this.cursor.style.left=`${n}%`,this.cursor.style.transform=`translateX(-${100===Math.round(n)?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(e,t)}exportImage(e,t,n){return wg(this,void 0,void 0,(function*(){const r=this.canvasWrapper.querySelectorAll("canvas");if(!r.length)throw new Error("No waveform data");if("dataURL"===n){const n=Array.from(r).map((n=>n.toDataURL(e,t)));return Promise.resolve(n)}return Promise.all(Array.from(r).map((n=>new Promise(((r,i)=>{n.toBlob((e=>{e?r(e):i(new Error("Could not export image"))}),e,t)})))))}))}};Ug.MAX_CANVAS_WIDTH=8e3,Ug.MAX_NODES=10;let Hg=class extends kg{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}},$g=class extends kg{constructor(e=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=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return wg(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(e){if(this.currentSrc=e,this._duration=void 0,!e)return this.buffer=null,void this.emit("emptied");fetch(e).then((t=>{if(t.status>=400)throw new Error(`Failed to fetch ${e}: ${t.status} (${t.statusText})`);return t.arrayBuffer()})).then((t=>this.currentSrc!==e?null:this.audioContext.decodeAudioData(t))).then((t=>{this.currentSrc===e&&(this.buffer=t,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())}))}_play(){var e;if(!this.paused)return;this.paused=!1,null===(e=this.bufferNode)||void 0===e||e.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 e;this.paused=!0,null===(e=this.bufferNode)||void 0===e||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return wg(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(e){var t,n;const r=e-this.currentTime;null===(t=this.bufferNode)||void 0===t||t.stop(this.audioContext.currentTime+r),null===(n=this.bufferNode)||void 0===n||n.addEventListener("ended",(()=>{this.bufferNode=null,this.pause()}),{once:!0})}setSinkId(e){return wg(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(e)}))}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e,this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(e){const t=!this.paused;t&&this._pause(),this.playedDuration=e/this._playbackRate,t&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var e,t;return null!==(e=this._duration)&&void 0!==e?e:(null===(t=this.buffer)||void 0===t?void 0:t.duration)||0}set duration(e){this._duration=e}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(e){return/^(audio|video)\//.test(e)}getGainNode(){return this.gainNode}getChannelData(){const e=[];if(!this.buffer)return e;const t=this.buffer.numberOfChannels;for(let n=0;n<t;n++)e.push(this.buffer.getChannelData(n));return e}};const jg={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};let Yg=class e extends Pg{static create(t){return new e(t)}constructor(e){const t=e.media||("WebAudio"===e.backend?new $g:void 0);super({media:t,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},jg,e),this.timer=new Hg;const n=t?void 0:this.getMediaElement();this.renderer=new Ug(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");const{peaks:e,duration:t}=this.options;(r||e&&t)&&this.load(r,e,t).catch((()=>null))}))}updateProgress(e=this.getCurrentTime()){return this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),e}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const e=this.updateProgress();this.emit("timeupdate",e),this.emit("audioprocess",e)}})))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const e=this.updateProgress();this.emit("timeupdate",e)})),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",(e=>{this.emit("error",e.error)})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((e,t)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,t))})),this.renderer.on("dblclick",((e,t)=>{this.emit("dblclick",e,t)})),this.renderer.on("scroll",((e,t,n,r)=>{const i=this.getDuration();this.emit("scroll",e*i,t*i,n,r)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(e=>{this.emit("dragstart",e)})),this.renderer.on("dragend",(e=>{this.emit("dragend",e)})));{let e;this.subscriptions.push(this.renderer.on("drag",(t=>{if(!this.options.interact)return;let n;this.renderer.renderProgress(t),clearTimeout(e),this.isPlaying()?n=0:!0===this.options.dragToSeek?n=200:"object"==typeof this.options.dragToSeek&&void 0!==this.options.dragToSeek&&(n=this.options.dragToSeek.debounceTime),e=setTimeout((()=>{this.seekTo(t)}),n),this.emit("interaction",t*this.getDuration()),this.emit("drag",t)})))}}initPlugins(){var e;(null===(e=this.options.plugins)||void 0===e?void 0:e.length)&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((e=>e())),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),null!=e.mediaControls&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e._init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",(()=>{this.plugins=this.plugins.filter((t=>t!==e))}))),e}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(e){return this.renderer.setScroll(e)}setScrollTime(e){const t=e/this.getDuration();this.renderer.setScrollPercentage(t)}getActivePlugins(){return this.plugins}loadAudio(e,t,n,r){return wg(this,void 0,void 0,(function*(){var i;if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!t&&!n){const n=this.options.fetchParams||{};window.AbortController&&!n.signal&&(this.abortController=new AbortController,n.signal=null===(i=this.abortController)||void 0===i?void 0:i.signal);const r=e=>this.emit("loading",e);t=yield Bg.fetchBlob(e,r,n)}this.setSrc(e,t);const s=yield new Promise((e=>{const t=r||this.getDuration();t?e(t):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>e(this.getDuration())),{once:!0}))}));if(!e&&!t){const e=this.getMediaElement();e instanceof $g&&(e.duration=s)}if(n)this.decodedData=Lg.createBuffer(n,s||0);else if(t){const e=yield t.arrayBuffer();this.decodedData=yield Lg.decode(e,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(e,t,n){return wg(this,void 0,void 0,(function*(){try{return yield this.loadAudio(e,void 0,t,n)}catch(e){throw this.emit("error",e),e}}))}loadBlob(e,t,n){return wg(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",e,t,n)}catch(e){throw this.emit("error",e),e}}))}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:t=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),i=[];for(let s=0;s<r;s++){const e=this.decodedData.getChannelData(s),r=[],o=e.length/t;for(let i=0;i<t;i++){const t=e.slice(Math.floor(i*o),Math.ceil((i+1)*o));let s=0;for(let e=0;e<t.length;e++){const n=t[e];Math.abs(n)>Math.abs(s)&&(s=n)}r.push(Math.round(s*n)/n)}i.push(r)}return i}getDuration(){let e=super.getDuration()||0;return 0!==e&&e!==1/0||!this.decodedData||(e=this.decodedData.duration),e}toggleInteraction(e){this.options.interact=e}setTime(e){super.setTime(e),this.updateProgress(e),this.emit("timeupdate",e)}seekTo(e){const t=this.getDuration()*e;this.setTime(t)}playPause(){return wg(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(e){this.setTime(this.getCurrentTime()+e)}empty(){this.load("",[[0]],.001)}setMediaElement(e){this.unsubscribePlayerEvents(),super.setMediaElement(e),this.initPlayerEvents()}exportImage(){return wg(this,arguments,void 0,(function*(e="image/png",t=1,n="dataURL"){return this.renderer.exportImage(e,t,n)}))}destroy(){var e;this.emit("destroy"),null===(e=this.abortController)||void 0===e||e.abort(),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}};function zg({src:e,onError:t,filename:n,className:r=""}){const i=ai(),s=hi(),o=le(null),a=le(),u=le(),[l,c]=se(!1),[h,d]=se(0),[p,f]=se(1),m=le(),[E,g]=se(!1);ae((()=>{a.current=new Audio;const r={normalize:!0,height:50,container:o.current};function i(){const e=a.current;e&&("PIPELINE_ERROR_READ: FFmpegDemuxer: demuxer seek failed"===e.error.message?(e.load(),c(!1)):(g(!0),c(!1),t?.()))}const s=n.slice(n.lastIndexOf(".")+1);if(function(e){return/(?:^|\/)talkjs_audio_message_[0-9]+_([0-9]+)[.](?:mp3|webm)$/.test(e)}(n)&&"webm"===s&&!a.current.canPlayType("audio/webm;codecs=opus"))r.backend="WebAudio",u.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"),u.current.controls=!1;else{const t=a.current;t.addEventListener("error",i),t.src=e,t.preload="auto",t.preservesPitch=!0,r.media=t}m.current=function(e){if(!e.container)return;const t=getComputedStyle(e.container);let n=Rg(t.color);return n||(n=Rg("rgb(255,255,255)")),Yg.create({...e,barGap:e.barGap??2,barRadius:e.barRadius??0,barWidth:e.barWidth??2,barHeight:e.barHeight,hideScrollbar:!0,cursorWidth:e.cursorWidth??0,cursorColor:e.cursorColor,height:e.height??24,progressColor:e.progressColor??n.cssa(),waveColor:e.waveColor??n.alpha(n.alpha()/2).cssa()})}(r);const l=m.current;return l.on("finish",(()=>{a.current.loop=!0,c(!1)})),l.on("ready",(e=>d(Math.trunc(e)))),l.on("timeupdate",(e=>d(Math.trunc(e)))),"WebAudio"===r.backend&&l.load(e).catch((()=>{g(!0),c(!1),t?.()})),()=>{a.current?.removeEventListener("error",i),a.current=void 0,l.destroy(),m.current=void 0}}),[e,n,t]);const A=de((()=>{if("WebAudio"===m.current.options.backend)m.current.isPlaying()||u.current.play(),m.current.playPause(),c(m.current.isPlaying()??!1);else{const e=a.current;e.paused?e.play():e.pause(),e.loop=!1,!e.paused&&e.ended&&(e.load(),e.play()),c(!e.paused)}}),[]),_=de((e=>{m.current.setPlaybackRate(e),f(e)}),[]);return It("div",E?{}:{className:`t-audio-player ${r}`,children:[It("button",{onClick:A,children:It(i.Icon,{className:"t-play-pause-icon",type:l?"pause":"play","aria-label":l?"pause audio":"play audio",themeCustom:s.state$.themeCustom.peek().value})}),It("div",{className:"t-waveform",ref:o}),It("div",{className:"t-duration",children:Cm(h)}),It(lg,{as:"div",children:({isExpanded:e})=>It(T,{children:[It(cg,{className:"t-playback-speed","aria-label":"set playback speed",children:[p,"x",It(i.Icon,{type:"updown","aria-hidden":!0,className:"t-up-down-icon",themeCustom:s.state$.themeCustom.peek().value})]}),e&&It(Eg,{children:It(pg,{className:"t-action-menu",children:[It("div",{className:"t-playback-heading",children:"Playback Speed"}),[.25,.5,.75,1,1.25,1.5,2].map(((e,t)=>It(dg,{onSelect:()=>_(e),children:[It("span",{className:"t-playback-checkmark",children:p==e?"✓":""}),e,"x"]},t)))]})})]})})]})}function Vg(e,t){e()||t||(t=e.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}Yg.BasePlugin=class extends kg{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((e=>e()))}},Yg.dom=xg,(e=>{function t(e,t){(function(e,t){switch(t){case"undefined":return void 0===e;case String:return"string"==typeof e||e instanceof String;case Boolean:return"boolean"==typeof e||e instanceof Boolean;case Number:return"number"==typeof e||e instanceof Number;default:return e instanceof t}})(e,t)||(t.name,String(e))}e.defined=function(e){},e.has=function(e,t){e[t]},e.is=t,e.equals=function(e,t){},e.oneOf=function(e,t){t.includes(e)||JSON.stringify(t)},e.isArray=function(e,n){t(e,Array),e&&e.length>0&&t(e[0],n)},e.optional=function(e,n){void 0!==e&&t(e,n)},e.falsy=function(e){},e.never=function(e){}})(Vg||(Vg={}));const Gg=Vg,Wg=/^\/.*[^\\]\/[im]*$/;function Xg(e){return!!Wg.test(e)&&!Kg(e).test("")}function Kg(e){const t=e.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${e} to be a (non-empty) regex`);let n=t[2]||"";return n=n.replace(/[^im]/g,"")+"g",new RegExp(t[1],n)}function qg(e){const t=e.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp("^"+t+"$","i")}function Jg(e,t){const n=Lp(t),r=qg(e);return void 0!==n&&r.test(n)}const Zg=/^[]/g;function Qg(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}class eA{constructor({mode:e,allowedHostnames:t,allowedPhoneNrs:n,allowedMatches:r,forbiddenMatches:i,suppressLinks:s,suppressEmailAddresses:o,suppressPhoneNumbers:a,replacement:u}){Gg.oneOf(e,["all","otherOnly","off"]),this.mode=e,this.suppressLinks=!1!==s,this.suppressEmailAddresses=!1!==o,this.suppressPhoneNumbers=!1!==a,this.allowedHostnames=t||[],this.allowedPhoneNrs=(n||[]).filter((e=>e)).map((e=>e.replace(/[^0-9]/g,""))),this.allowedMatches=(r||[]).filter(Xg).map((e=>Kg(e))),this.forbiddenMatches=(i||[]).filter(Xg).map((e=>Kg(e))),Gg((()=>this.allowedMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),Gg((()=>this.forbiddenMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u?.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:e}){return"all"===this.mode||"otherOnly"===this.mode&&!e}}const tA=new RegExp(":arslan:|"+/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g.source,"g"),nA=/\uFE0F/g,rA=String.fromCharCode(8205);function iA(e){if(":arslan:"===e)return"https://cdn.talkjs.com/__assets/5461191341cea882b3f227c085d5772c.gif";const t=function(e){const t=[];let n=0,r=0,i=0;for(;i<e.length;)n=e.charCodeAt(i++),r?(t.push((65536+(r-55296<<10)+(n-56320)).toString(16)),r=0):55296<=n&&n<=56319?r=n:t.push(n.toString(16));return t.join("-")}((n=e).indexOf(rA)<0?n.replace(nA,""):n);var n;return`https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/${t}.svg`}function sA(e){let t="";return e.t&&(t=`(${e.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:e.formattedLinks??"plaintext",markup:e.markup??!1,useFallbackMentions:e.useFallbackMentions??!1,sameTabLinkRules:e.sameTabLinkRules??[],enableEmojiImageFallback:e.enableEmojiImageFallback??!1,highlight:e.highlight??[],contactInfo:e.contactInfo??!1,suppression:e.suppression??new eA({mode:"off"}),contactInfoHiddenText:e.contactInfoHiddenText??e.suppression?.replacement??t,customEmojiUrls:e.customEmojiUrls??{}}}function oA(e,t){return aA(e,sA(t))}function aA(e,t){return e.flatMap((e=>{if("string"==typeof e){let n=[e];return n=uA(n,(e=>function(e,t){const{suppression:{forbiddenMatches:n,allowedMatches:r}}=t,i=Sp(n,(t=>wp(e,t))).filter((([e])=>!r.some((t=>null!==e.match(t))))).map((e=>({offset:e.index,matchedText:e[0]})));return kp(e,i,(()=>[{type:"suppressed",text:"CONTACT_INFORMATION_HIDDEN"}]))}(e,t))),n=uA(n,(e=>function(e){return kp(e,function(e){const t=[];let n;for(;n=tA.exec(e);){const e=n[0],r=n.index;t.push({offset:r,matchedText:e})}return t}(e),(e=>[{type:"emoji",text:e.matchedText}]))}(e))),n}switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return{type:e.type,children:aA(e.children,t)};case"codespan":case"codeSpan":case"codeblock":case"codeBlock":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return e;case"mention":return{type:"mention",id:e.id,text:e.text};case"autolink":case"autoLink":return function(e,t){return"link"===t.contactInfo?e:"suppress"===t.contactInfo?function(e,t){if(t.allowedMatches.some((t=>null!==e.match(t))))return!0;if(t.forbiddenMatches.some((t=>null!==e.match(t))))return!1;if(e.startsWith("mailto:")){const n=e.substring(7).replace(/^.*@/,"");return!t.suppressEmailAddresses||lA(t.allowedHostnames,n)}if(e.startsWith("tel:")){const n=e.substring(4).replace(/[^0-9]/g,"");return!t.suppressPhoneNumbers||t.allowedPhoneNrs.some((e=>n.endsWith(e)))}return!t.suppressLinks||lA(t.allowedHostnames,Lp(e))}(e.url,t.suppression)?e:{type:"suppressed",text:"CONTACT_INFORMATION_HIDDEN"}:e.text}(e,t);case"link":return{type:"link",url:e.url,children:aA(e.children,t)};case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return{type:e.type,action:e.action,params:e.params,children:aA(e.children,t)}}}))}function uA(e,t){return Sp(e,(e=>"string"==typeof e?t(e):[e]))}function lA(e,t){for(const n of e)if(qg(n).test(t))return!0;return!1}const cA=()=>{const e=document.createElement("canvas");e.width=e.height=1;const t=e.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},hA=(e,t)=>{const n=cA();return n.fillStyle=t,n.fillText(e,0,0),n.getImageData(0,0,1,1).data};function dA(e,t){return e.flatMap((e=>{if("string"==typeof e)return pA(e,t.highlight);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletpoint":case"bulletPoint":return fA(e,t);case"bulletlist":case"bulletList":return[Ct.createElement("ul",null,...dA(e.children,t))];case"autolink":case"autoLink":return mA(e,t);case"link":return gA(e,t);case"codeblock":case"codeBlock":return[It("code",{"data-language":e.language,children:pA(e.text,t.highlight)})];case"codespan":case"codeSpan":return It("code",{children:pA((n=e.text,n.replace(/^\s*\n/m,"").replace(/\n\s*$/m,"")),t.highlight)});case"mention":return t.useFallbackMentions?It("span",{className:"mention",children:["@",e.text]}):It("div",{"data-name":"mention","data-text":e.text});case"suppressed":return[It("i",{children:t.contactInfoHiddenText})];case"emoji":return t.enableEmojiImageFallback?[It(EA,{unicode:e.text})]:[e.text];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return AA(e,t);case"customemoji":case"customEmoji":return e.text;default:Gg.never(e)}var n}))}function pA(e,t){if(0===t.length)return[e];const n=function(e){const t=e.map((e=>e.trim())).filter((e=>e));if(0===t.length)return Zg;const n=t.map(Qg).join("|");return new RegExp(n,"gi")}(t);return kp(e,wp(e,n).map((e=>({offset:e.index,matchedText:e[0]}))),(({matchedText:e})=>[It("span",{className:"highlighted-text",children:e})]))}const fA=(e,t)=>{const n={bold:"strong",italic:"em",strikethrough:"del",blockquote:"blockquote",bulletpoint:"li",bulletPoint:"li"}[e.type];return[Ct.createElement(n,null,...dA(e.children,t))]},mA=(e,t)=>[It("a",{target:_A(t.sameTabLinkRules,e.url),href:e.url,rel:"noreferrer",children:e.text})];function EA({unicode:e}){const[t,n]=se((()=>":arslan:"!==e));return ae((()=>{t&&!function(e){try{return function(e){const t=hA(e,"#000"),n=hA(e,"#fff"),r=(e=>!e.includes("‍")||cA().measureText(e).width<160)(e);return t&&n&&r&&((e,t)=>{const n=[...e].join(",");return n===[...t].join(",")&&!n.startsWith("0,0,0,")})(t,n)}(e)}catch(e){return!0}}(e)&&n(!1)}),[]),t?It("span",{className:"t-emoji",children:e}):It("img",{className:"t-emoji",src:iA(e),alt:e})}const gA=(e,t)=>{switch(t.formattedLinks){case"link":return[_("a",{target:_A(t.sameTabLinkRules,e.url),href:e.url},...dA(e.children,t))];case"plaintext":case!1:return[Ct.createElement("span",null,...dA(e.children,t))];default:Gg.never(t.formattedLinks)}},AA=(e,t)=>[_("button",{"data-type":e.type,"data-action":e.action,"data-params":JSON.stringify(e.params),disabled:!0},...dA(e.children,t))];function _A(e,t){for(const n of e)if(Wg.test(n)){if(Kg(n).test(t))return"_top"}else if(Jg(n,t))return"_top";return"_blank"}function DA({block:e,className:t=""}){return _("span",{className:`t-text ${t}`},...function(e,t={}){return dA(e,sA(t))}(oA(e.children,{contactInfo:"link"}),{enableEmojiImageFallback:!0}))}function vA(e){const t=ai(),n=hi(),{className:r="",...i}=e,s=Yr((()=>n.state$.messages.child(n.state$.extCurrentConversationId.get()).lookup.child(e.message.id).content.child(0).url.get()));return It("div",{className:`t-message-content ${r}`,children:e.message.content.map((n=>It(TA,{block:n,theme:t,downloadUrl:s,...i},e.message.createdAt+(e.message.editedAt??0))))})}function TA({block:e,currentUser:t,message:n,t:r,theme:i,themeCustom:s,downloadUrl:o}){const a=function(e,t){switch(t.type){case"text":return e.TextBlock;case"location":return e.LocationBlock;case"file":switch(t.subtype){case"image":return e.ImageBlock;case"video":return e.VideoBlock;case"voice":return e.VoiceBlock;case"audio":return e.AudioBlock;default:return e.FileBlock}default:si.never(t)}}(i,e);return It(a,{block:e,t:r,currentUser:t,message:n,themeCustom:s,downloadUrl:o})}function OA(e){return Rp(e)}function SA(e){return e.photoUrl??function(e,t){const n=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">\n <rect x="0" y="0" width="100" height="100" fill="${Rp(e)}"/>\n <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">${t}</text> \n </svg>`.replace(/\s+/g," ");return"data:image/svg+xml;base64,"+Np(n)}(e.id,(e=>e.split(bp).filter((e=>e)).map((e=>e[0])).join("")||e[Symbol.iterator]().next().value||"")(e.name))}function CA(e){const t=1048576,n=1024*t,r=1024*n;return e<1024?e+" B":e<t?Math.floor(e/1024)+" KB":e<n?Math.floor(e/t)+" MB":e<r?Math.floor(e/n)+" GB":Math.floor(e/r)+" TB"}function yA({latitude:e,longitude:t}){const n=e+","+t;return{imageUrl:`https://maps.googleapis.com/maps/api/staticmap?center=${n}&zoom=15&size=300x200&scale=2&maptype=roadmap&markers=${n}&key=${Sm}`,linkUrl:`https://maps.google.com/maps?q=${n}&z=15`}}function NA(e,...t){const n=Om.bind(Ct.createElement)(e,...t);return Array.isArray(n)?Ct.createElement(Ct.Fragment,{},...n):n}function IA({children:e,className:t,...n}){return It("div",{className:"t-attach-overlay "+t,...n,children:e})}function bA({uploadState:e}){ai();const t=e.error,n=e.uploaded;!function(e,t=!0){const n=de((t=>{27===t.keyCode&&e()}),[e]);ae((()=>{if(t)return window.addEventListener("keydown",n,!0),()=>window.removeEventListener("keydown",n,!0)}),[t,n])}((()=>e.closePreview("cancel")));const r=le(null);ae((()=>{n&&r.current.focus()}),[n]);const i=Yr(hi().t$);return It(IA,{className:"t-upload-preview",children:It("div",{className:"t-preview",children:[It(RA,{upload:e.upload,uploaded:n}),void 0!==t&&It("div",{className:"t-error-row",children:t}),It("div",{className:"t-send-row",children:[It("button",{className:"t-cancel",onClick:()=>e.closePreview("cancel"),children:i.CANCEL}),void 0===t&&n&&It("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>e.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function RA({upload:e,uploaded:t}){const n=Yr(hi().t$);return"location"!==e.type?It(T,{children:[It(kA,{upload:e}),It(LA,{upload:e,uploaded:t,t:n})]}):t?It(wA,{location:e.location}):It("div",{className:"t-loading",children:It(fo,{})})}function wA({location:e}){const{imageUrl:t,linkUrl:n}=yA(e);return It("a",{href:n,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(t)}) center center / cover no-repeat`}})}const kA=Ct.memo((function({upload:e}){let t=null;const n=e.file;if("video"===e.type){const r=/[.]ts/i.test(n.name)?"mpegts":"native";t=It("div",{className:"video-container",children:It(MA,{src:e.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else"image"===e.type?t=It("div",{className:"t-img-container",children:It("img",{src:URL.createObjectURL(n)})}):"audio"===e.type&&(t=It(zg,{src:URL.createObjectURL(n),filename:n.name}));return t})),LA=Ct.memo((function({uploaded:e,upload:t,t:n}){let r;r=e?t.metadata.filename:n.UPLOAD_IN_PROGRESS;let i="",s="";return"file"===t.type&&(i="is-file",e&&(s="file-block")),It("div",{className:`t-filename-row ${i}`,children:It("div",{className:s,children:r})})}));function MA(e){const{videoType:t,...n}=e;return It("video",{...n})}function FA({controller:e,appId:t,chatHeaderVisible:n,messageFieldVisible:r,session:i,sendMessage:s}){const o=ai(),a=hi(),u=li(),l=function(e){const t=ti((()=>{const t=e.state$.extUserId.get(),n=e.state$.errors.get(),r=e.state$.authTokenState.get(),i=t&&e.state$.currentUser.get(),s=e.state$.currentConversation.get(),o=e.state$.extCurrentConversationId.get(),a=o&&e.state$.participants.child(o).get(),u=e.state$.app.get();return n.serverError?"server-error":n.wrongAppId?"wrong-app-id":"loading"===r||"idle"===r?"loading-token":"invalid"===r?"invalid-token":"expired"===r?"expired-token":"valid"===r?n.unknownUser?"unknown-user":n.unknownConversation?"loading-conv-failed":Boolean(i&&s&&a&&u)?"loaded":"loading-data":void si.unreachable()})),n=ti({type:"loading"});ni((r=>{const i=t.get(),s=e.state$.extCurrentConversationId.peek(),o=e.state$.extUserId.peek(),a=e.state$.appId.peek();function u(e){n.set({type:"loading"});const t=setTimeout((()=>{n.set(e)}),5e3);return()=>clearTimeout(t)}switch(i){case"invalid-token":n.set({type:"auth-failed"});break;case"expired-token":n.set({type:"expired-token"});break;case"wrong-app-id":n.set({type:"wrong-app-id",appId:a});break;case"server-error":n.set({type:"server-error"});break;case"loading-data":case"loading-token":n.set({type:"loading"});break;case"loaded":n.set({type:"loaded",conversationId:s,userId:o});break;case"loading-conv-failed":r.onCleanup=u({type:"inaccessible-conversation",userId:o,conversationId:s});break;case"unknown-user":r.onCleanup=u({type:"unknown-user",userId:o});break;default:si.never(i)}}));const r=ti({type:"loading"});return ni((e=>{if("loading"===n.type.get()){r.set({type:"invisible-loading"});const t=setTimeout((()=>{r.set({type:"loading"})}),1e3);e.onCleanup=()=>{clearTimeout(t)}}else r.set(n.get())})),r}(a),c=Yr(l),{attachFile:h,shareLocation:d,uploadState:p}=function(e,t,n){const[r,i]=se(null),s=de((async r=>{try{if(r||(r=(await new Promise((e=>{const t=document.createElement("input");t.type="file",t.multiple=!1,t.addEventListener("change",(()=>{e([...t.files])})),t.addEventListener("cancel",(()=>{e([])})),t.click()})))[0]),!r)return;const{uploadPromise:s,upload:o}=await async function(e,t){const n=e.name;if(function(e){return/\.(mp4|ts|mov|webm|ogv)$/i.test(e)}(e.name)){const r=await Dm("video",e,(e=>({width:e.videoWidth,height:e.videoHeight,duration:e.duration,filename:n}))),i=t.uploadVideo(e,r),s=function(e){switch(e.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"}}(e);return{uploadPromise:i,upload:{type:"video",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e],{type:s}))}}}if(function(e){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(e)}(e.name)){const r=await Dm("audio",e,(e=>({duration:e.duration,filename:n})));return{uploadPromise:t.uploadAudio(e,r),upload:{type:"audio",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}if(function(e){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(e)}(e.name)){const r=await Dm("img",e,(e=>({width:e.naturalWidth,height:e.naturalHeight,filename:n})));return{uploadPromise:t.uploadImage(e,r),upload:{type:"image",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}const r={filename:n};return{uploadPromise:t.uploadFile(e,r),upload:{type:"file",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}(r,e),a=o.file.size+","+o.file.name;n.state$.localFileBlobUrls.child(n.state$.extCurrentConversationId.peek()).child(a).set({url:o.temporaryBlobUrl,fetching:!1}),n.latestFileUpload=o;const u=Am(),l={upload:o,closePreview:u.resolve,uploaded:!1};let c;i(l);try{c=await s,i({...l,uploaded:!0})}catch(e){i((n=>({...n,error:e.toString()})))}if("cancel"===await u.promise)return;si.defined(c),t.sendFileMessage({fileToken:c})}finally{i(null)}}),[t,e,i,n]);return{attachFile:s,shareLocation:_m("geolocation",(async e=>{try{const n=Am(),r={upload:{type:"location",location:void 0},uploaded:!1,closePreview:n.resolve};i(r);const{permissionResult:s,location:o}=await new Promise((e=>{navigator.geolocation.getCurrentPosition((t=>{const n={latitude:t.coords.latitude,longitude:t.coords.longitude};e({permissionResult:"granted",location:n})}),(t=>{1===t.code?e({permissionResult:"denied"}):e({permissionResult:"granted"})}))}));if(e(s),!o)return;if(i({...r,upload:{type:"location",location:o},uploaded:!0}),"cancel"===await n.promise)return;t.sendLocationMessage({location:o})}finally{i(null)}}),[t,i]),uploadState:r}}(i,e,a);ae((()=>{u.uploadFile=h}),[u,h]);const[f,m]=se(!1),E=de((e=>{h(e.dataTransfer.files[0]),e.preventDefault(),m(!1)}),[h]),g=de((e=>{e.preventDefault(),m(!0)}),[]),A=de((e=>{e.preventDefault(),m(!1)}),[]);return"invisible-loading"===c.type?It(T,{}):"loading"===c.type?It(Ao,{}):"inaccessible-conversation"===c.type?It(go,{t:a.t$.peek()}):"unknown-user"===c.type||"auth-failed"===c.type||"wrong-app-id"===c.type||"server-error"===c.type||"unexpected-error"===c.type?It(Eo,{appId:t,chatboxState:c}):"expired-token"==c.type?It(_o,{t:a.t$.peek()}):"loaded"===c.type?It("div",{className:"t-chatbox-content",onDragOver:g,onDragLeave:A,onDrop:E,children:It(zr,{children:()=>It(T,{children:[n&&It(o.ChatHeader,{conversation:a.state$.currentConversation.get(),currentUser:a.state$.currentUser.get(),participants:a.state$.participants.child(c.conversationId).get(),t:a.t$.get(),chatbox:e,themeCustom:a.state$.themeCustom.get().value}),It(ho,{extConversationId:c.conversationId,controller:e}),r&&It(o.MessageField,{conversation:a.state$.currentConversation.get(),currentUser:a.state$.currentUser.get(),participants:a.state$.participants.child(c.conversationId).get(),referencedMessage:a.referencedMessage$.get(),permissions:a.userPermissions$().get(),t:a.t$.get(),chatbox:e,editor:new fm(u.state$.get(),s,h,d),themeCustom:a.state$.themeCustom.get().value}),p&&It(bA,{uploadState:p}),f&&It(IA,{className:"t-drop-overlay",children:It(o.Icon,{type:"attach",themeCustom:a.state$.themeCustom.get().value})})]})})}):It(T,{})}class xA extends Error{constructor(e,t){const n=function(e){if("string"==typeof e)return e;if(Array.isArray(e))return e.join("\n");try{return JSON.stringify(e)}catch(t){return String(e)}}(e);super(n),this.userMessage=t??n,Object.setPrototypeOf&&Object.setPrototypeOf(this,new.target.prototype)}}const BA=console;class PA{constructor(e,t,n,r){this.apiUrls=e,this.appId=t,this.sessionId=n,this.authProvider=r,this._lastPutPromise=Promise.resolve()}async get(e,t={}){const n=this.endpointUrl(e,t),r=await HA((()=>this.fetchWithReauth(n)),{retries:11});return await this.handleResponse(r,n)}async queuedPut(e,t){await this._lastPutPromise;const n=HA((()=>this._doPut(e,t)));return this._lastPutPromise=n,n}put(e,t,n){const r=()=>this._doPut(e,t);return n?$A(r,n):HA(r,{retries:5})}post(e,t,n){const r=()=>this._doPost(e,t);return n?$A(r,n):HA(r,{retries:5})}delete(e,t={}){return HA((()=>this._doDelete(e,t)),{retries:11})}endpointUrl(e,t={}){const n=new URL(this.apiUrls.internalHttpApiUrl);n.pathname+=`/${this.appId}/${e}`,n.searchParams.set("sessionId",this.sessionId);for(const[r,i]of Object.entries(t))n.searchParams.set(r,i);return n}async _doPut(e,t){const n=this.endpointUrl(e),r=await this.fetchWithReauth(n,{method:"PUT",body:JSON.stringify(t)});return await this.handleResponse(r,n)}async _doPost(e,t){const n=this.endpointUrl(e),r=await this.fetchWithReauth(n,{method:"POST",body:JSON.stringify(t)});return await this.handleResponse(r,n)}async _doDelete(e,t){const n=this.endpointUrl(e,t),r=await this.fetchWithReauth(n,{method:"DELETE"});return await this.handleResponse(r,n)}async handleResponse(e,t){if(e.status>=300){if(404===e.status)throw Os.error(`[${this.appId}][BackendRestClient] Couldn't find resource.`),new xA("Could not find app.",`Could not find given appId: "${this.appId}". You can find your appId on https://talkjs.com/dashboard.`);if(401===e.status){const e=await this.authProvider.getToken();throw Os.error(`[${this.appId}][BackendRestClient] Couldn't authenticate ${t} with token ${e}.`),new xA("User not authenticated.","Could not authenticate user. Check if your signature is calculated correctly.")}if(e.status>=300&&e.status<500){const{error:t}=await e.json();throw new xA(t)}{const n=await e.text();throw new Error(`Got non-success response (${n}) from the server for url: ${t}.`)}}return await e.json()}async fetchWithReauth(e,t){function n(n){const r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${n}`};return fetch(e,{...t,headers:r})}const r=await this.authProvider.getToken(),i=await n(r);return 401!==i.status?i:(BA.error(`401 error from ${t?.method} ${e}, ${r}`),this.authProvider.refreshToken(),n(await this.authProvider.getToken()))}}function UA(e){return!e.userMessage}function HA(e,{retries:t=30}={}){return gm(t,e,{shouldRetry:UA,log:BA.warn.bind(BA),maxDelay:30,initialDelay:.2})}async function $A(e,t){try{return await e()}catch(e){if(!UA(e))throw e}let n=!1;return t.then((()=>{n=!0})),gm(1e3,e,{initialDelay:.2,maxDelay:30,shouldRetry:()=>!n,log:BA.warn.bind(BA)})}var jA={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Function]",o="[object Object]",a=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[i]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[s]=l["[object Map]"]=l["[object Number]"]=l[o]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var c,h="object"==typeof Ir&&Ir&&Ir.Object===Object&&Ir,d="object"==typeof self&&self&&self.Object===Object&&self,p=h||d||Function("return this")(),f=t&&!t.nodeType&&t,m=f&&e&&!e.nodeType&&e,E=m&&m.exports===f,g=E&&h.process,A=function(){try{return m&&m.require&&m.require("util").types||g&&g.binding&&g.binding("util")}catch(e){}}(),_=A&&A.isTypedArray,D=Array.prototype,v=Function.prototype,T=Object.prototype,O=p["__core-js_shared__"],S=v.toString,C=T.hasOwnProperty,y=(c=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",N=T.toString,I=S.call(Object),b=RegExp("^"+S.call(C).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=E?p.Buffer:void 0,w=p.Symbol,k=p.Uint8Array;R&&R.allocUnsafe;var L,M,F=(L=Object.getPrototypeOf,M=Object,function(e){return L(M(e))}),x=Object.create,B=T.propertyIsEnumerable,P=D.splice,U=w?w.toStringTag:void 0,H=function(){try{var e=oe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),$=R?R.isBuffer:void 0,j=Math.max,Y=Date.now,z=oe(p,"Map"),V=oe(Object,"create"),G=function(){function e(){}return function(t){if(!Ae(t))return{};if(x)return x(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function W(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function q(e){var t=this.__data__=new X(e);this.size=t.size}function J(e,t,n){(void 0!==n&&!he(e[t],n)||void 0===n&&!(t in e))&&ee(e,t,n)}function Z(e,t,n){var r=e[t];C.call(e,t)&&he(r,n)&&(void 0!==n||t in e)||ee(e,t,n)}function Q(e,t){for(var n=e.length;n--;)if(he(e[n][0],t))return n;return-1}function ee(e,t,n){"__proto__"==t&&H?H(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}W.prototype.clear=function(){this.__data__=V?V(null):{},this.size=0},W.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},W.prototype.get=function(e){var t=this.__data__;if(V){var r=t[e];return r===n?void 0:r}return C.call(t,e)?t[e]:void 0},W.prototype.has=function(e){var t=this.__data__;return V?void 0!==t[e]:C.call(t,e)},W.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=V&&void 0===t?n:t,this},X.prototype.clear=function(){this.__data__=[],this.size=0},X.prototype.delete=function(e){var t=this.__data__,n=Q(t,e);return!(n<0||(n==t.length-1?t.pop():P.call(t,n,1),--this.size,0))},X.prototype.get=function(e){var t=this.__data__,n=Q(t,e);return n<0?void 0:t[n][1]},X.prototype.has=function(e){return Q(this.__data__,e)>-1},X.prototype.set=function(e,t){var n=this.__data__,r=Q(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},K.prototype.clear=function(){this.size=0,this.__data__={hash:new W,map:new(z||X),string:new W}},K.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},K.prototype.get=function(e){return se(this,e).get(e)},K.prototype.has=function(e){return se(this,e).has(e)},K.prototype.set=function(e,t){var n=se(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},q.prototype.clear=function(){this.__data__=new X,this.size=0},q.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},q.prototype.get=function(e){return this.__data__.get(e)},q.prototype.has=function(e){return this.__data__.has(e)},q.prototype.set=function(e,t){var n=this.__data__;if(n instanceof X){var r=n.__data__;if(!z||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new K(r)}return n.set(e,t),this.size=n.size,this};function te(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":U&&U in Object(e)?function(e){var t=C.call(e,U),n=e[U];try{e[U]=void 0;var r=!0}catch(e){}var i=N.call(e);return r&&(t?e[U]=n:delete e[U]),i}(e):function(e){return N.call(e)}(e)}function ne(e){return _e(e)&&te(e)==i}function re(e,t,n,r,i){e!==t&&function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var a=s[++r];if(!1===t(i[a],a,i))break}}(t,(function(s,a){if(i||(i=new q),Ae(s))!function(e,t,n,r,i,s,a){var u=le(e,n),l=le(t,n),c=a.get(l);if(c)J(e,n,c);else{var h,d=s?s(u,l,n+"",e,t,a):void 0,p=void 0===d;if(p){var f=pe(l),m=!f&&me(l),E=!f&&!m&&De(l);d=l,f||m||E?pe(u)?d=u:_e(h=u)&&fe(h)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(u):m?(p=!1,d=l.slice()):E?(p=!1,d=function(e){var t,n,r=(n=new(t=e.buffer).constructor(t.byteLength),new k(n).set(new k(t)),n);return new e.constructor(r,e.byteOffset,e.length)}(l)):d=[]:function(e){if(!_e(e)||te(e)!=o)return!1;var t=F(e);if(null===t)return!0;var n=C.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&S.call(n)==I}(l)||de(l)?(d=u,de(u)?d=function(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],a=void 0;void 0===a&&(a=e[o]),r?ee(n,o,a):Z(n,o,a)}return n}(e,ve(e))}(u):Ae(u)&&!Ee(u)||(d=function(e){return"function"!=typeof e.constructor||ue(e)?{}:G(F(e))}(l))):p=!1}p&&(a.set(l,d),i(d,l,r,s,a),a.delete(l)),J(e,n,d)}}(e,t,a,n,re,r,i);else{var u=r?r(le(e,a),s,a+"",e,t,i):void 0;void 0===u&&(u=s),J(e,a,u)}}),ve)}var ie=H?function(e,t){return H(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Se;function se(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function oe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ae(e)||function(e){return!!y&&y in e}(e))&&(Ee(e)?b:a).test(function(e){if(null!=e){try{return S.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ae(e,t){var n=typeof e;return!!(t=null==t?r:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||T)}function le(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ce=function(e){var t=0,n=0;return function(){var r=Y(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ie);function he(e,t){return e===t||e!=e&&t!=t}var de=ne(function(){return arguments}())?ne:function(e){return _e(e)&&C.call(e,"callee")&&!B.call(e,"callee")},pe=Array.isArray;function fe(e){return null!=e&&ge(e.length)&&!Ee(e)}var me=$||function(){return!1};function Ee(e){if(!Ae(e))return!1;var t=te(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Ae(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var De=_?function(e){return function(t){return e(t)}}(_):function(e){return _e(e)&&ge(e.length)&&!!l[te(e)]};function ve(e){return fe(e)?function(e){var t=pe(e),n=!t&&de(e),r=!t&&!n&&me(e),i=!t&&!n&&!r&&De(e),s=t||n||r||i,o=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=o.length;for(var u in e)s&&("length"==u||r&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ae(u,a))||o.push(u);return o}(e):function(e){if(!Ae(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&C.call(e,r))&&n.push(r);return n}(e)}var Te,Oe=(Te=function(e,t,n){re(e,t,n)},function(e,t){return ce(function(e,t,n){return t=j(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=j(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,Se),e+"")}((function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Te.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!Ae(n))return!1;var r=typeof t;return!!("number"==r?fe(n)&&ae(t,n.length):"string"==r&&t in n)&&he(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Te(e,o,n)}return e})));function Se(e){return e}e.exports=Oe}(jA,jA.exports);const YA=br(jA.exports);class zA{constructor(e,t,n,r){this.backendRestClient=new PA(e,t,n,r)}async getApp(e){return function(e){return{appMetadata:{...e.appMetadata,id:e.appMetadata.id},features:e.features,role:VA(e.configuration,e.features)}}(await this.backendRestClient.get("/app",{role_name:e}))}async checkIfAppExists(){return this.backendRestClient.get("/app").then((()=>!0)).catch((e=>{if("Could not find app."===e.message)return!1;throw e}))}}function VA(e,t){const n={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}},\n {{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}},\n The {{app.name}} team",enableReplyToEmail:t.includes("reply_via_email"),emailThemeType:t.includes("email_templates")?"custom":"standard",emailTheme:"default_email",emailAttachmentMode:"enabledExcludingImages",htmlTemplate:'<div>\n Hi {{recipient.name}}, <br/>\n <br/>\n {{sender.name}} wants to chat with you on {{app.name}}:<br/>\n <br/>\n {{messages.all}}\n <br/>\n <a href="{{app.custom.websiteUrl}}">Join the chat</a>\n <br/>\n <br/>\n On behalf of {{sender.name}},<br/>\n The {{app.name}} team<br/>\n <br/>\n</div>',textTemplate:"Hi {{recipient.name}},\n\n{{sender.name}} wants to chat with you on {{app.name}}:\n\n{{messages.all}}\n\n{{app.custom.websiteUrl}} Join the chat\n\nOn behalf of {{sender.name}},\nThe {{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 YA(n,e)}function GA(e,t){const n=e.map((e=>function(e,t){if("text"===e.type)return function(e,t){return WA(e,sA(t))}(e.children,t);if("file"===e.type&&"video"===e.subtype)return`🎥 ${Mp(e.url)}`;if("file"===e.type&&"image"===e.subtype)return`📷 ${Mp(e.url)}`;if("file"===e.type&&"audio"===e.subtype)return`🎧 ${Mp(e.url)}`;if("file"===e.type&&"voice"===e.subtype){const t=e.duration;return void 0===t?"🎙️":`🎙️ (${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")})`}return"file"===e.type?(e.subtype,`📎 ${Mp(e.url)}`):"location"===e.type?"📍":""}(e,t)));return n.join("\n\n")}function WA(e,t){return e.flatMap((e=>{if("string"==typeof e)return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return WA(e.children,t);case"bulletlist":case"bulletList":return"\n"+WA(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+WA(e.children,t)+"\n";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 XA(){const e="undefined"!=typeof window?window.crypto:void 0,t=e?()=>e.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 KA{constructor(e,t,n,r,i){this.store=e,this.talkSession=t,this.editorInternals=n,this.onSendMessage=r,this.onDeleteMessage=i}async deleteMessage(e){const t=this.store.state$.extCurrentConversationId.peek(),n=this.store.state$.messages.child(t).lookup.child(e).peek(),r=this.talkSession.conversation(t).message(e),[i]=await Promise.all([n??r.get(),r.delete()]);if(i){const e={currentUser:this.store.state$.currentUser.peek(),conversation:this.store.state$.currentConversation.peek(),message:n};this.onDeleteMessage(e)}}async editMessage(e,t){const n=this.store.state$.extCurrentConversationId.peek();await this.talkSession.conversation(n).message(e).edit(t)}setReferencedMessage(e){this.store.state$.referencedMessageId.set(e)}sendMessage(e){return this._send({text:e.text,custom:e.custom,referencedMessage:e.referencedMessageId})}sendFileMessage(e){const t={type:"file",fileToken:e.fileToken};return this._send({content:[t],custom:e.custom})}sendLocationMessage(e){const t={type:"location",latitude:e.location.latitude,longitude:e.location.longitude};return this._send({content:[t],custom:e.custom})}async _send(e){const t=this.store.state$.extCurrentConversationId.peek(),n=await async function(e,t){const n=e.state$.extCurrentConversationId.peek(),r=e.state$.messages.child(n),i="string"==typeof t.referencedMessage?r.lookup.child(t.referencedMessage).peek():await(t.referencedMessage?.get()??null),s=i&&{...i,type:"UserMessage",sender:i.sender,referencedMessageId:i.referencedMessage?.id??null};s&&delete s.referencedMessage;const o=e.latestFileUpload,a="content"in t?[qA(o,t.content[0])]:[{type:"text",children:[t.text]}],u="text"in t?t.text:GA(t.content.map((e=>qA(o,e))),{});return{id:"ephemeral-"+XA(),type:"UserMessage",sender:e.state$.currentUser.peek(),createdAt:Date.now(),editedAt:null,custom:t.custom??{},origin:"web",referencedMessage:s,content:a,plaintext:u}}(this.store,e);this.store.state$.ephemeralMessages.child(t).child(n.id).set(n);const r=Am();this.store.readyForNewMessagesPromise=r.promise;const i=await this.talkSession.conversation(t).send(e);this.store.state$.ephemeralMessageIdMapping.child(t).child(i.id).set(n.id),r.resolve(),this.onSendMessage({message:await i.get(),currentUser:this.store.state$.currentUser.peek(),conversation:this.store.state$.currentConversation.peek()})}closeMessageActionMenu(){this.store.state$.activeMessageActionMenu.set(null)}openMessageActionMenu(e){this.store.state$.activeMessageActionMenu.set(e)}closeMessageActionMenusOnWindowClick(){const e=e=>{e.target.closest("[t-message-action-menu-keep-open]")||this.closeMessageActionMenu()};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}getMessageFieldText(){return this.editorInternals.getText()}setMessageFieldText(e){this.editorInternals.setText(e)}markAsTyping(){const e=this.store.state$.extCurrentConversationId.peek();this.talkSession.conversation(e).markAsTyping()}}function qA(e,t){switch(t.type){case"text":case"location":return t;case"file":return function(e,t){return{type:"file",subtype:"file"===e.type?void 0:e.type,...e.metadata,size:e.file.size,filename:e.file.name,fileToken:t.fileToken,url:e.temporaryBlobUrl}}(e,t)}}class JA{constructor(e,t,n){this.realtimeWsApiUrl=e,this.internalHttpApiUrl=t,this.restApiHttpUrl=n}getBokensUrl(e,t,n){return this.internalHttpApiUrl+`/${e}/bokens/${encodeURIComponent(t)}?signature=${encodeURIComponent(n??"")}`}getRealtimeWsUrl(e,t,n,r,i){const s=encodeURIComponent(t);return this.realtimeWsApiUrl+`/${e}/realtime/${s}?talkjs-client-build=${i??"standalone"}&talkjs-core=${n}&talkjs-client-id=${r}`}static fromHost(e){const t=new JA("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!e)return t;if(e.endsWith("talkjs.com")){const n=e.match(/\w+-(\w+)\.talkjs\.com/);if(n){const e=n[1];return new JA(`wss://realtime-${e}.talkjs.com/v1`,`https://app-${e}.talkjs.com/api/v0`,`https://api-${e}.talkjs.com/v1`)}return t}return e.includes("localhost")||e.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e)?new JA(`ws://${e}/public_api/v1`,`http://${e}/api/v0`,`http://${e}/public_api/v1`):new JA(`wss://${e}/public_api/v1`,`https://${e}/api/v0`,`https://${e}/public_api/v1`)}}var ZA,QA=Object.defineProperty,e_=Object.defineProperties,t_=Object.getOwnPropertyDescriptors,n_=Object.getOwnPropertySymbols,r_=Object.prototype.hasOwnProperty,i_=Object.prototype.propertyIsEnumerable,s_=(e,t,n)=>t in e?QA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o_=(e,t)=>{for(var n in t||(t={}))r_.call(t,n)&&s_(e,n,t[n]);if(n_)for(var n of n_(t))i_.call(t,n)&&s_(e,n,t[n]);return e},a_=(e,t)=>e_(e,t_(t)),u_=(e,t)=>{var n={};for(var r in e)r_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&n_)for(var r of n_(e))t.indexOf(r)<0&&i_.call(e,r)&&(n[r]=e[r]);return n},l_=(e,t,n)=>new Promise(((r,i)=>{var s=e=>{try{a(n.next(e))}catch(e){i(e)}},o=e=>{try{a(n.throw(e))}catch(e){i(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,o);a((n=n.apply(e,t)).next())}));function c_(e,t){if(t.ok)return t.value.data;if("SESSION_DESTROYED"===t.value)throw new Error(`${e} failed because the session was destroyed`);if("server"===t.where)throw new Error(h_(e,t.value));throw"unreachable"}function h_(e,t){let n;return n=Array.isArray(t.reasons)?t.reasons.join():JSON.stringify(t.reasons),`${e} failed, got status ${t.status} ${t.errorCode}, reasons: ${n}`}function d_(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if("*"!==t[n]&&e[n]!==t[n])return!1;return!0}function p_(e){return e<=0?Promise.resolve():new Promise((t=>setTimeout(t,e)))}function f_(e,t){return e*(1-t+2*Math.random()*t)}const m_=()=>!0;function E_(e,t,n){return l_(this,arguments,(function*(e,t,{initialDelay:n,maxDelay:r,log:i,shouldRetry:s=m_}){return t().catch((o=>l_(this,null,(function*(){if(0===e)throw o;if(!(yield s(o)))throw o;const a=1e3*n*1.2,u=f_(r?Math.min(1e3*r,a):a,.05);return p_(u).then((()=>E_(e-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:s})))}))))}))}function g_(){const e={},t=new Promise((function(t,n){e.resolve=t,e.reject=n}));return e.promise=t,e}class A_{constructor(e,t,n){this.layer=e,this.states=t,this.transitions=n,this._state=t[0]}get state(){return this._state}transition(e){const t=this.transitions[e];if(!t)return;if(!this.canTransition(e))return;const n=this.state;this._state=t.to,t.afterTransition({from:n,to:this.state})}canTransition(e){const t=this.transitions[e];return!!t&&("ANY"===t.from||t.from.includes(this.state))}}function __(e){return{ok:!0,value:e}}function D_(e){return{ok:!1,where:"client",value:e}}function v_(e){return{ok:!1,where:"server",value:e}}function T_(){const e={},t=new Promise((t=>{e.ok=e=>l_(this,null,(function*(){return t(__(e))})),e.clientErr=e=>t(D_(e)),e.serverErr=e=>t(v_(e)),e.resolve=e=>t(e)}));return e.promise=t,e}class O_{constructor(e,t){this.realtimeUrl=e,this.handlers=t,this.socket=null,this.stateMachine=new A_("ReconnectingSocket",["STOPPED","CONNECTING","READY","DISCONNECTED","TERMINATED"],{startWs:{from:["STOPPED","DISCONNECTED"],to:"CONNECTING",afterTransition:()=>{const e=new(function(){if(globalThis.WebSocket)return globalThis.WebSocket;throw new Error("Missing WebSocket implementation")}())(this.realtimeUrl+"&talkjs-time="+Date.now());this.socket=e,e.addEventListener("open",(()=>{this.socket===e&&this.stateMachine.transition("onOpen")})),e.addEventListener("close",(()=>{this.socket===e&&this.stateMachine.transition("onClose")})),e.addEventListener("message",(t=>{this.socket===e&&this.handlers.onMessage(t)}))}},onOpen:{from:["CONNECTING"],to:"READY",afterTransition:()=>{this.handlers.onOpen()}},onClose:{from:["CONNECTING","READY"],to:"DISCONNECTED",afterTransition:e=>l_(this,[e],(function*({from:e}){"READY"===e&&this.handlers.onClose(),this.socket=null;const t=f_(1e4,.5);setTimeout((()=>{"DISCONNECTED"===this.stateMachine.state&&this.stateMachine.transition("startWs")}),t)}))},stopWs:{from:["CONNECTING","DISCONNECTED","READY"],to:"STOPPED",afterTransition:({from:e})=>{"READY"===e&&this.handlers.onClose();const t=this.socket;this.socket=null,null==t||t.close(1e3)}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{const e=this.socket;this.socket=null,null==e||e.close(1e3)}}})}stopWs(){this.stateMachine.transition("stopWs")}startWs(){this.stateMachine.transition("startWs")}send(e){return"READY"===this.stateMachine.state?(this.socket.send(e),__(void 0)):D_("SOCKET_NOT_READY")}terminate(){const e=this.socket;this.stateMachine.canTransition("onClose")&&this.stateMachine.transition("onClose"),e&&("terminate"in e?e.terminate():e.close(1e3))}destroy(){this.stateMachine.transition("destroy")}}class S_{constructor(e,t){this.handlers=t,this.socket=new O_(e,{onOpen:()=>this.handlers.onOpen(),onClose:()=>this.handlers.onClose(),onMessage:e=>this.onWebSocketMessage(e)})}call(e,t,n,r){const i=`/${n.map((e=>encodeURIComponent(e))).join("/")}`,s=JSON.stringify([e,t,i,r]);return this.socket.send(s)}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.socket.destroy()}terminate(){this.socket.terminate()}onWebSocketMessage(e){if("Auth token expired"!==e.data)try{const t=JSON.parse(e.data);if("PUBLISH"===t[1]){const e=t[0],n=JSON.stringify([e,"ACK"]);this.socket.send(n);const r=t.slice(2),i=[];r.forEach((e=>{"session.expired"===e.type?this.handlers.onAuthExpired():"upstream.restarting"===e.type?this.handlers.onUpstreamRestarting():i.push(e)})),i.length>0&&this.handlers.onPublish(e,i)}else{const e=t[0],n=t[1],r=t[2];this.handlers.onResponse(e,n,r)}}catch(e){}else this.handlers.onAuthExpired()}}class C_{constructor(e){this.delayMs=e,this.timeout=void 0}schedule(e){this.stop(),this.timeout=setTimeout((()=>{void 0!==this.timeout&&(this.stop(),e())}),this.delayMs)}stop(){void 0!==this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}}class y_{constructor(){this.i=-1}next(){return this.i++,this.i}reset(){this.i=-1}}class N_{constructor(e,t){this.handlers=t,this.seqCounter=new y_,this.responseHandlers={},this.heartbeats=new I_(this),this.socket=new S_(e,{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((e=>{e.clientErr("WEBSOCKET_DISCONNECTED")})),this.responseHandlers={},this.seqCounter.reset(),this.handlers.onNotReady()},onResponse:(e,t,n)=>{this.heartbeats.serverActive(),this.onResponse(e,t,n)},onPublish:(e,t)=>{this.heartbeats.serverActive(),this.handlers.onPublish(e,t),this.heartbeats.clientActive()},onAuthExpired:()=>{this.heartbeats.serverActive(),this.handlers.onAuthExpired()}})}call(e,t,n){const r=this.seqCounter.next(),i=T_();this.responseHandlers[r]=i;const s=this.socket.call(r,e,t,n);return s.ok||i.resolve(s),this.heartbeats.clientActive(),i.promise}onResponse(e,t,n){return l_(this,null,(function*(){const r=this.responseHandlers[e];r&&(200===t?r.ok({status:t,data:n}):r.serverErr({status:t,errorCode:n.errorCode,reasons:n.reasons}),delete this.responseHandlers[e])}))}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.heartbeats.stop(),Object.values(this.responseHandlers).forEach((e=>{e.clientErr("WEBSOCKET_DISCONNECTED")})),this.responseHandlers={},this.socket.destroy()}terminate(){this.socket.terminate()}}class I_{constructor(e){this.connection=e,this.clientInactivityTimer=new C_(25e3),this.serverInactivityTimer=new C_(1e4),this.serverTimeoutTimer=new C_(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 b_{constructor(e,t,n){this.authProvider=t,this.handlers=n,this.stateMachine=new A_("AuthenticatedConnection",["WAITING_FOR_WS","LOGGING_IN","RENEWING_SESSION","READY","TERMINATED"],{logIn:{from:["WAITING_FOR_WS"],to:"LOGGING_IN",afterTransition:()=>l_(this,null,(function*(){yield this.renewSession()}))},logInFailed:{from:["LOGGING_IN"],to:"LOGGING_IN",afterTransition:()=>l_(this,null,(function*(){this.authProvider.refreshToken(),yield this.renewSession()}))},scheduledReauth:{from:["READY"],to:"RENEWING_SESSION",afterTransition:()=>l_(this,null,(function*(){yield this.renewSession()}))},scheduledReauthFailed:{from:["RENEWING_SESSION"],to:"RENEWING_SESSION",afterTransition:()=>l_(this,null,(function*(){this.authProvider.refreshToken(),yield this.renewSession()}))},authenticated:{from:["LOGGING_IN","RENEWING_SESSION"],to:"READY",afterTransition:({from:e})=>{"LOGGING_IN"===e&&this.handlers.onReady()}},authExpired:{from:["READY","RENEWING_SESSION"],to:"LOGGING_IN",afterTransition:()=>l_(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:e})=>{"READY"!==e&&"RENEWING_SESSION"!==e||this.handlers.onNotReady(),this.authProvider.clearScheduledRefresh()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.authProvider.clearScheduledRefresh(),this.connection.destroy()}}}),this.connection=new N_(e,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onReady:()=>this.stateMachine.transition("logIn"),onNotReady:()=>{this.stateMachine.transition("wsDisconnected")},onAuthExpired:()=>{this.stateMachine.transition("authExpired")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}}),t.onTokenChanged((()=>{"READY"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauth")}))}call(e,t,n){const r=this.connection.call(e,t,n);return r.then((e=>{e.ok||"server"!==e.where||401!==e.value.status||"READY"!==this.stateMachine.state&&"RENEWING_SESSION"!==this.stateMachine.state||this.stateMachine.transition("authExpired")})),r}stopWs(){this.connection.stopWs()}startWs(){this.connection.startWs()}destroy(){this.stateMachine.transition("destroy")}renewSession(){return l_(this,null,(function*(){const e=yield this.authProvider.getToken(),t=yield this.connection.call("POST",["session","renew"],{token:e});if(!t.ok&&"client"===t.where)return;const n=t.value;if(n.status,200===n.status){const t=n.data.expiresInSeconds;return void(null!==t&&t<120?(console.warn(`[TalkJS] Authenticated with a token that expires in ${t}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`),"LOGGING_IN"===this.stateMachine.state?this.stateMachine.transition("logInFailed"):"RENEWING_SESSION"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauthFailed")):(this.authProvider.scheduleRefresh(t),this.authProvider.emitTokenAccepted(e),this.stateMachine.canTransition("authenticated")&&this.stateMachine.transition("authenticated")))}if(401===n.status)return void("LOGGING_IN"===this.stateMachine.state?this.stateMachine.transition("logInFailed"):"RENEWING_SESSION"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauthFailed"));if(400===n.status)return void this.authProvider.emitTokenRefreshFailed(h_("Authentication",n));if(402===n.status)return void this.authProvider.emitTokenRefreshFailed(h_("Authentication",n));const r=5e3*Math.random()+5e3;setTimeout((()=>{this.call("POST",["session","renew"],{token:e}).catch((()=>{}))}),r)}))}}class R_{constructor(e,t,n){this.handlers=n,this.stateMachine=new A_("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 C_(3e3),this.connection=new b_(e,t,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("ready")},onNotReady:()=>{"READY"===this.stateMachine.state&&this.stateMachine.transition("unexpectedDisconnect")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}get inactive(){return 0===this.pendingCalls&&0===this.activeSubscriptions}ensureStarted(){this.stateMachine.canTransition("start")&&this.stateMachine.transition("start")}call(e,t,n){return l_(this,null,(function*(){this.inactivityTimer.stop(),this.pendingCalls++;const r=yield this.connection.call(e,t,n);return this.pendingCalls--,"SUBSCRIBE"===e&&r.ok?this.activeSubscriptions++:"UNSUBSCRIBE"===e&&r.ok&&this.activeSubscriptions--,this.inactive&&this.inactivityTimer.schedule((()=>{this.stateMachine.transition("stop")})),r}))}destroy(){this.stateMachine.transition("destroy")}isConnected(){return"READY"===this.stateMachine.state}}class w_{constructor(e,t,n){this.handlers=n,this.stateMachine=new A_("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((e=>e.deferred.ok({status:200,data:{}}))),this.subscribeQueue={},this.handlers.onSubscriptionsLost()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{for(var e;this.callQueue.length;){const t=null==(e=this.callQueue.shift())?void 0:e.deferred;null==t||t.clientErr("SESSION_DESTROYED")}this.connection.destroy()}}}),this.subscribeQueue={},this.callQueue=[],this.connection=new R_(e,t,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("processQueue")},onNotReady:()=>{this.stateMachine.transition("notReady")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}call(e,t,n){return"READY"===this.stateMachine.state?this.connection.call(e,t,n):("NOT_READY"===this.stateMachine.state&&this.connection.ensureStarted(),"SUBSCRIBE"===e||"UNSUBSCRIBE"===e?this._subscribe(e,t,n):this._call(e,t,n))}_subscribe(e,t,n){const r=t.join("/"),i=this.subscribeQueue[r];if(i&&i.method===e)return i.deferred.promise;i&&i.method!==e&&(i.deferred.ok({status:200,data:{}}),delete this.subscribeQueue[r]);const s={deferred:T_(),method:e,path:t,data:n};return this.subscribeQueue[r]=s,s.deferred.promise}_call(e,t,n){const r={deferred:T_(),method:e,path:t,data:n};return this.callQueue.push(r),r.deferred.promise}dequeue(){for(const e in this.subscribeQueue){const t=this.subscribeQueue[e];return delete this.subscribeQueue[e],t}return this.callQueue.shift()}destroy(){this.stateMachine.transition("destroy")}sendQueuedCalls(){return l_(this,null,(function*(){let e=0;for(;"PROCESSING_QUEUE"===this.stateMachine.state;){e++;const t=this.dequeue();if(!t)return void this.stateMachine.transition("ready");this.connection.call(t.method,t.path,t.data).then((e=>{t.deferred.resolve(e)})),e>50&&(yield new Promise((e=>setTimeout(e,100))))}}))}isConnected(){return"READY"===this.stateMachine.state||"PROCESSING_QUEUE"===this.stateMachine.state}}const k_="undefined"!=typeof window&&null!=(ZA=window.queueMicrotask)?ZA:setTimeout;class L_{constructor(e,t){this.clearPendingBatch=e,this.sendCalls=t,this.sent=!1,k_((()=>this.send()))}send(){this.sent||(this.sent=!0,this.clearPendingBatch(),this.sendCalls())}destroy(){this.sent=!0}}class M_ extends L_{constructor(e,t){super(t,(()=>{this.sendSubscribe(),this.sendGet()})),this.connection=e,this.getCalls=[],this.subscribeCalls=[]}canPush(e,t){return M_.isCorrectBatchTypeFor(e,t)}static isCorrectBatchTypeFor(e,t){return d_(t,["users","*"])&&("GET"===e||"SUBSCRIBE"===e)}push(e,t,n){const r=t[1],i=T_();return"GET"===e?this.getCalls.push({userId:r,deferred:i}):this.subscribeCalls.push({userId:r,deferred:i}),1e3!==this.getCalls.length&&1e3!==this.subscribeCalls.length||this.send(),i.promise}sendGet(){return l_(this,null,(function*(){if(0===this.getCalls.length)return;const e=[...new Set(this.getCalls.map((e=>e.userId)))],t=yield this.connection.call("GET",["users"],{ids:e,includePrivateFields:!1});if(t.ok)for(const n of this.getCalls){const e=t.value.data[n.userId];e?n.deferred.ok({status:200,data:e}):n.deferred.serverErr({status:404,errorCode:"NOT_FOUND",reasons:["No user with that ID exists"]})}else this.getCalls.forEach((e=>e.deferred.resolve(t)))}))}sendSubscribe(){if(0===this.subscribeCalls.length)return;const e=[...new Set(this.subscribeCalls.map((e=>e.userId)))];this.connection.call("SUBSCRIBE",["users"],{ids:e}).then((e=>this.subscribeCalls.forEach((t=>t.deferred.resolve(e)))))}}class F_ extends L_{constructor(e,t,n){super(n,(()=>this.sendMutate())),this.conversationId=e,this.connection=t,this.calls=[]}canPush(e,t){return!!F_.isCorrectBatchTypeFor(e,t)&&t[1]===this.conversationId}static isCorrectBatchTypeFor(e,t){return d_(t,["conversations","*","participants","*"])&&("PUT"===e||"POST"===e||"PATCH"===e)}push(e,t,n){const r=t[3],i=T_();return this.calls.push({action:{id:r,method:e,params:n},deferred:i}),100===this.calls.length&&this.send(),i.promise}sendMutate(){return l_(this,null,(function*(){const e=this.calls.map((e=>e.action)),t=yield this.connection.call("POST",["conversations",this.conversationId,"participants"],{actions:e});if(!t.ok)return void this.calls.forEach((e=>e.deferred.resolve(t)));const n=t.value.data.responses;for(let r=0;r<n.length;r++){const e=this.calls[r].deferred,t=n[r];200===t.status?e.ok(a_(o_({},t),{data:{}})):e.serverErr(t)}}))}}class x_{constructor(e,t,n){this.pendingBatch=null,this.connection=new w_(e,t,n)}call(e,t,n){return l_(this,null,(function*(){var r;if(null==(r=this.pendingBatch)?void 0:r.canPush(e,t))return this.pendingBatch.push(e,t,n);this.pendingBatch&&this.pendingBatch.send();const i=this.createEmptyBatchFor(e,t);return i?(this.pendingBatch=i,i.push(e,t,n)):this.connection.call(e,t,n)}))}destroy(){var e;this.connection.destroy(),null==(e=this.pendingBatch)||e.destroy()}isConnected(){return this.connection.isConnected()}createEmptyBatchFor(e,t){if(M_.isCorrectBatchTypeFor(e,t))return new M_(this.connection,(()=>this.pendingBatch=null));if(F_.isCorrectBatchTypeFor(e,t)){const e=t[1];return new F_(e,this.connection,(()=>this.pendingBatch=null))}return null}}const B_={200:"RESOLVE",400:"RESOLVE",401:"RETRY",402:"RESOLVE",403:"RESOLVE",404:"RESOLVE",405:"RESOLVE",409:"RESOLVE",429:"DELAY",500:"DELAY"};class P_{constructor(e,t,n){this.throttler=new U_,this.alive=!0,this.connection=new x_(e,t,n)}call(e,t,n){return l_(this,null,(function*(){let r=0;for(;this.alive;){const i=yield this.connection.call(e,t,n);if((i.ok||"client"!==i.where||"SOCKET_NOT_READY"!==i.value)&&(i.ok||"server"!==i.where||500!==i.value.status)||r++,10===r)return i;if(i.ok||"client"!==i.where){const e=i.value,t=e.status,n=B_[t];if("RESOLVE"===n)return this.throttler.resetDelay(),i;if("RETRY"===n)continue;if("DELAY"===n){yield this.throttler.wait();continue}return console.warn("[TalkJS] Unexpected status code",t),e}if("SESSION_DESTROYED"===i.value)return D_("SESSION_DESTROYED");"WEBSOCKET_DISCONNECTED"!==i.value&&("SOCKET_NOT_READY"!==i.value?i.value:yield this.throttler.wait())}return D_("SESSION_DESTROYED")}))}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}}class U_{constructor(){this.initialDelayMs=200,this.exponentialFactor=1.2,this.maxDelayMs=3e4,this.currentDelayMs=this.initialDelayMs,this.lastCall=0}getCurrentDelay(){return this.currentDelayMs}wait(){const e=(new Date).getTime(),t=f_(this.currentDelayMs,.05),n=this.lastCall+t,r=Math.max(0,n-e);return this.lastCall=e+r,this.currentDelayMs=Math.min(t*this.exponentialFactor,this.maxDelayMs),p_(r)}resetDelay(){this.currentDelayMs=this.initialDelayMs}}function H_(e){return e.map((e=>encodeURIComponent(e))).join()}class $_{constructor(){this.paths={}}add(e){this.paths[H_(e)]=e}delete(e){delete this.paths[H_(e)]}has(e){return Object.hasOwnProperty.call(this.paths,H_(e))}clear(){this.paths={}}forEach(e){Object.values(this.paths).forEach((t=>e(t)))}}class j_{constructor(e,t,n){this.handlers=n,this.targetSubscriptions=new $_,this.connection=new P_(e,t,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onSubscriptionsLost:()=>{this.targetSubscriptions.forEach((e=>{this.resubscribe(e)})),this.handlers.onResubscribeSent()},onReady:()=>this.handlers.onReady(),onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}call(e,t,n){return this.connection.call(e,t,n)}subscribe(e){return l_(this,null,(function*(){return this.targetSubscriptions.add(e),this.connection.call("SUBSCRIBE",e,{})}))}unsubscribe(e){return l_(this,null,(function*(){return this.targetSubscriptions.delete(e),this.connection.call("UNSUBSCRIBE",e,{})}))}resubscribe(e){return l_(this,null,(function*(){const t=yield this.connection.call("SUBSCRIBE",e,{});t.ok||this.handlers.onResubscribeError(e,t)}))}destroy(){this.targetSubscriptions.clear(),this.connection.destroy()}isConnected(){return this.connection.isConnected()}}function Y_(e,t){return void 0===t?e:t}function z_(e,t){if(void 0===t)return e;if(null===t)return{};const n=o_({},e);for(const r in t){const e=t[r];null===e?delete n[r]:n[r]=e}return n}function V_(e,t){if(e===t)return!0;if(!e||!t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!V_(e[n],t[n]))return!1}else{const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n){if(!Object.hasOwnProperty.call(t,r))return!1;if(!V_(e[r],t[r]))return!1}}return!0}class G_{constructor(){this.prev=Promise.resolve()}runExclusive(e){return l_(this,null,(function*(){const t=this.prev.then((()=>e()));return this.prev=t,t}))}}class W_{constructor(e){this.initialised=!1,this.getPointer=void 0,this.pendingStates=[e],e.resultPromise.then((()=>this.initialised=!0))}get pendingPointer(){if(0!==this.pendingStates.length)return this.pendingStates[this.pendingStates.length-1]}get mostRecentState(){var e;return null!=(e=this.pendingPointer)?e:this.getPointer}canAppendState(e){var t,n;const r=null==(t=this.getPointer)?void 0:t.seq;if(void 0!==r&&e<=r)return!1;const i=null==(n=this.pendingPointer)?void 0:n.seq;return!(void 0!==i&&e<i)}set(e){if(!this.canAppendState(e.seq))throw"Appending in the past";this.pendingStates.push(e)}mutate(e,t){if(!this.initialised)return;if(!this.canAppendState(e))throw"Mutating in the past";const n=this.mostRecentState.resultPromise.then((e=>e.ok?t(e):e));this.pendingStates.push({seq:e,resultPromise:n})}get(e){for(;this.pendingStates.length>0&&(void 0===this.getPointer||this.pendingStates[0].seq<=e);)this.getPointer=this.pendingStates.shift();return this.getPointer}}class X_ extends W_{constructor(e,t){super(e),this.onTeardown=t,this._error=null,this._lastGoodState=Promise.resolve(void 0)}get error(){return this._error}get lastGoodState(){return this._lastGoodState}mutate(e,t){super.mutate(e,t),this.registerNewState(this.mostRecentState.resultPromise)}set(e){super.set(e),this.registerNewState(this.mostRecentState.resultPromise)}registerNewState(e){const t=this.lastGoodState;this._lastGoodState=e.then((e=>e.ok?e.value:t)),e.then((e=>{e.ok||this.setError(e)}))}setError(e){var t;this._error||(this._error=e,null==(t=this.onTeardown)||t.call(this,e),this.lastGoodState.then((e=>{void 0!==e&&this.teardownNested(e)})))}}class K_ extends X_{constructor(e,t){const n=new Promise((e=>setTimeout(e))).then((()=>this.fetchInitial(e)));super({seq:e,resultPromise:n},t),this.initialSeq=e,this.getDeepMutex=new G_,this.lastDeep=void 0}refetchInitial(e){return l_(this,null,(function*(){const t=this.mostRecentState.resultPromise,n=this.fetchInitial(e),[r,i]=yield Promise.all([t,n]);return void 0!==r&&r.ok&&i.ok&&this.equal(r.value,i.value)?r:i}))}refetch(e){if(null!==this.error)return;const t={seq:e,resultPromise:this.refetchInitial(e)};this.set(t)}changedBetween(e,t){return l_(this,null,(function*(){if(e>=t)return!1;const n=this.get(t),r=yield n.resultPromise;return!!r.ok&&(r.value.lastChanged>Math.max(this.initialSeq,e)&&r.value.lastChanged<=t||(yield this.anyChildChanged(e,t,r.value)))}))}getDeep(e){return l_(this,null,(function*(){return this.getDeepMutex.runExclusive((()=>l_(this,null,(function*(){var t;if(null!==this.error)return this.error;const n=null==(t=this.lastDeep)?void 0:t.seq;if(e===n)return this.lastDeep.deep;if(void 0!==n){if(e<n)throw`Trying to load seq ${e} when we have previously loaded seq ${n}`;if(!(yield this.changedBetween(n,e)))return this.lastDeep.seq=e,this.lastDeep.deep}const r=this.get(e).resultPromise,i=r.then((t=>t.ok?this.loadNested(e,t.value):t));this.lastDeep={seq:e,shallow:r,deep:i};const s=yield i;return s.ok||this.setError(s),s}))))}))}}class q_ extends K_{constructor(e,t,n){super(e,n),this.emitMutex=t,this.unsubscribeTimer=new J_,this.referencedByOtherStores=0,this.listeners=[],this.lastEmitSeq=void 0,this.lastEmitResult=void 0,t.runExclusive((()=>l_(this,null,(function*(){yield this.emit(e)}))))}registerInternalSubscription(){this.referencedByOtherStores++;let e=!0;return()=>{e&&(e=!1,this.referencedByOtherStores--,this.startUnsubscribeTimerIfOrphan())}}get onlyUsedInternally(){return 0===this.listeners.length}listen(e){return this.unsubscribeTimer.stop(),this.listeners.push(e),void 0!==this.lastEmitResult&&e(this.lastEmitResult),()=>{this.listeners=this.listeners.filter((t=>t!==e)),this.startUnsubscribeTimerIfOrphan()}}startUnsubscribeTimerIfOrphan(){0===this.referencedByOtherStores&&0===this.listeners.length&&this.unsubscribeTimer.restart((()=>{this.setError(D_("UNSUBSCRIBED"))}),this.unsubscribeDebounceMs)}getLoadMoreSeq(){var e;const t=null!=(e=this.lastEmitSeq)?e:0,n=this.mostRecentState.seq;return Math.max(t,n)+1e-6}emit(e){return l_(this,null,(function*(){var t;if(this.onlyUsedInternally)return;if(this.lastEmitSeq&&this.lastEmitSeq>=e)return;if(!1===(null==(t=this.lastEmitResult)?void 0:t.ok))return;this.lastEmitSeq=e;const n=yield this.getDeep(e);n!==this.lastEmitResult&&(this.lastEmitResult=n,this.listeners.forEach((e=>e(n))))}))}}class J_{constructor(){this.timerId=void 0}restart(e,t){void 0!==this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout((()=>e()),t)}stop(){clearTimeout(this.timerId)}}class Z_ extends q_{constructor(e,t,n,r,i){super(e,r,i),this.userId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e4}fetchInitial(e){return l_(this,null,(function*(){const t=yield this.realtimeClient.call("GET",["users",this.userId],{includePrivateFields:!1},{bypassCache:!0});return t.ok?__({snapshot:this.realtimeClient.createUserSnapshot(t.value.data),lastChanged:e}):"server"===t.where&&404===t.value.status?__({snapshot:null,lastChanged:e}):t}))}equal(e,t){return V_(e.snapshot,t.snapshot)}loadNested(e,t){return l_(this,null,(function*(){return __(t)}))}userCreated(e,t){this.mutate(e,(n=>null!==n.value.snapshot?n:__({snapshot:this.realtimeClient.createUserSnapshot(t.state),lastChanged:e})))}userEdited(e,t){this.mutate(e,(n=>{const r=n.value.snapshot;return null===r?(console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."),n):__({snapshot:{id:r.id,name:Y_(r.name,t.diff.name),custom:z_(r.custom,t.diff.custom),locale:Y_(r.locale,t.diff.locale),photoUrl:Y_(r.photoUrl,t.diff.photoUrl),role:Y_(r.role,t.diff.role),welcomeMessage:Y_(r.welcomeMessage,t.diff.welcomeMessage)},lastChanged:e})}))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok?null===e.value.snapshot?v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["That user does not exist yet"]}):__({status:200,data:{id:e.value.snapshot.id,name:e.value.snapshot.name,custom:e.value.snapshot.custom,locale:e.value.snapshot.locale,photoUrl:e.value.snapshot.photoUrl,role:e.value.snapshot.role,welcomeMessage:e.value.snapshot.welcomeMessage}}):D_("NOT_IN_CACHE")}))}teardownNested(e){}anyChildChanged(e,t,n){return l_(this,null,(function*(){return!1}))}}var Q_,eD={};function tD(e,t){const n=t.lastIndex;let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return t.lastIndex=n,i}function nD(e){const t=e.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function rD(e,t){e()||t||(t=e.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}!function(){if(Q_)return eD;function e(e){return String.fromCharCode(parseInt(e.slice(1),16))}function t(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Q_=1,Object.defineProperty(eD,"__esModule",{value:!0}),eD.encode=function(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,e))},eD.decode=function(e){return decodeURIComponent(Array.from(atob(e),t).join(""))}}(),(e=>{function t(e,t){(function(e,t){switch(t){case"undefined":return void 0===e;case String:return"string"==typeof e||e instanceof String;case Boolean:return"boolean"==typeof e||e instanceof Boolean;case Number:return"number"==typeof e||e instanceof Number;default:return e instanceof t}})(e,t)||(t.name,String(e))}e.defined=function(e){},e.has=function(e,t){e[t]},e.is=t,e.equals=function(e,t){},e.oneOf=function(e,t){t.includes(e)||JSON.stringify(t)},e.isArray=function(e,n){t(e,Array),e&&e.length>0&&t(e[0],n)},e.optional=function(e,n){void 0!==e&&t(e,n)},e.falsy=function(e){},e.never=function(e){}})(rD||(rD={}));const iD=rD,sD=/^\/.*[^\\]\/[im]*$/;function oD(e){return!!sD.test(e)&&!aD(e).test("")}function aD(e){const t=e.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${e} to be a (non-empty) regex`);let n=t[2]||"";return n=n.replace(/[^im]/g,"")+"g",new RegExp(t[1],n)}class uD{constructor({mode:e,allowedHostnames:t,allowedPhoneNrs:n,allowedMatches:r,forbiddenMatches:i,suppressLinks:s,suppressEmailAddresses:o,suppressPhoneNumbers:a,replacement:u}){iD.oneOf(e,["all","otherOnly","off"]),this.mode=e,this.suppressLinks=!1!==s,this.suppressEmailAddresses=!1!==o,this.suppressPhoneNumbers=!1!==a,this.allowedHostnames=t||[],this.allowedPhoneNrs=(n||[]).filter((e=>e)).map((e=>e.replace(/[^0-9]/g,""))),this.allowedMatches=(r||[]).filter(oD).map((e=>aD(e))),this.forbiddenMatches=(i||[]).filter(oD).map((e=>aD(e))),iD((()=>this.allowedMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),iD((()=>this.forbiddenMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=null==u?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:e}){return"all"===this.mode||"otherOnly"===this.mode&&!e}}function lD(e,t){return e.map((e=>function(e,t){if("text"===e.type)return cD(e.children,function(e){var t,n,r,i,s,o,a,u,l,c,h,d;let p="";return e.t&&(p=`(${e.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:null!=(t=e.formattedLinks)?t:"plaintext",markup:null!=(n=e.markup)&&n,useFallbackMentions:null!=(r=e.useFallbackMentions)&&r,sameTabLinkRules:null!=(i=e.sameTabLinkRules)?i:[],enableEmojiImageFallback:null!=(s=e.enableEmojiImageFallback)&&s,highlight:null!=(o=e.highlight)?o:[],contactInfo:null!=(a=e.contactInfo)&&a,suppression:null!=(u=e.suppression)?u:new uD({mode:"off"}),contactInfoHiddenText:null!=(h=null!=(c=e.contactInfoHiddenText)?c:null==(l=e.suppression)?void 0:l.replacement)?h:p,customEmojiUrls:null!=(d=e.customEmojiUrls)?d:{}}}(t));if("file"===e.type&&"video"===e.subtype)return`🎥 ${nD(e.url)}`;if("file"===e.type&&"image"===e.subtype)return`📷 ${nD(e.url)}`;if("file"===e.type&&"audio"===e.subtype)return`🎧 ${nD(e.url)}`;if("file"===e.type&&"voice"===e.subtype){const t=e.duration;return void 0===t?"🎙️":`🎙️ (${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")})`}return"file"===e.type?(e.subtype,`📎 ${nD(e.url)}`):"location"===e.type?"📍":""}(e,t))).join("\n\n")}function cD(e,t){return e.flatMap((e=>{if("string"==typeof e)return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return cD(e.children,t);case"bulletlist":case"bulletList":return"\n"+cD(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+cD(e.children,t)+"\n";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 hD extends K_{constructor(e,t,n,r){super(e),this.conversationId=t,this.message=n,this.realtimeClient=r}get messageId(){return"string"==typeof this.message?this.message:this.message.id}fetchInitial(e){return l_(this,null,(function*(){let t;if("object"==typeof this.message)t=this.message;else{const e=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"messages",this.message],{},{bypassCache:!0});if(!e.ok)return e;t=e.value.data}return __({lastChanged:e,sender:null===t.senderId?null:this.realtimeClient.internalSubscribe(["users",t.senderId]),data:{id:t.id,type:t.type,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,referencedMessageId:t.referencedMessageId,origin:t.origin,plaintext:lD(t.content,{}),content:t.content}})}))}refetch(e){throw"Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){return V_(e.data,t.data)}teardownNested(e){var t;null==(t=e.sender)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;const i=null==(r=n.sender)?void 0:r.store;return!0===(yield null==i?void 0:i.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){var n,r,i;const s=yield null==(r=null==(n=t.sender)?void 0:n.store)?void 0:r.getDeep(e);if(!1===(null==s?void 0:s.ok))return s;if(null===t.data)return __({snapshot:null});const o=null==s?void 0:s.value;return __({snapshot:{sender:null!=(i=null==o?void 0:o.snapshot)?i:null,id:t.data.id,type:t.data.type,custom:t.data.custom,createdAt:t.data.createdAt,editedAt:t.data.editedAt,origin:t.data.origin,plaintext:lD(t.data.content,{}),content:t.data.content,referencedMessageId:t.data.referencedMessageId}})}))}messageEdited(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,sender:n.value.sender,data:{id:n.value.data.id,type:n.value.data.type,createdAt:n.value.data.createdAt,origin:n.value.data.origin,referencedMessageId:n.value.data.referencedMessageId,editedAt:Y_(n.value.data.editedAt,t.diff.editedAt),custom:z_(n.value.data.custom,t.diff.custom),content:Y_(n.value.data.content,t.diff.content)}})))}messageDeleted(e,t){this.mutate(e,(n=>null===n.value.data?n:this.messageId===t.messageId?(this.teardownNested(n.value),__({lastChanged:e,sender:null,data:null})):n.value.data.referencedMessageId===t.messageId?__({lastChanged:e,sender:n.value.sender,data:{id:n.value.data.id,type:n.value.data.type,createdAt:n.value.data.createdAt,origin:n.value.data.origin,referencedMessageId:null,editedAt:n.value.data.editedAt,custom:n.value.data.custom,content:n.value.data.content}}):n))}getFromCache(){return l_(this,null,(function*(){var e;const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.data)return v_({status:404,errorCode:"MESSAGE_NOT_FOUND",reasons:["No message with that ID exists"]});const n=t.value,{sender:r}=n,i=u_(n,["sender"]);return __({status:200,data:a_(o_({},i.data),{senderId:null!=(e=null==r?void 0:r.store.userId)?e:null})})}))}}class dD extends K_{constructor(e,t,n,r){super(e),this.createdAt=t,this.dataStore=n,this.referencedDataStore=r}get messageId(){return this.dataStore.messageId}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,dataStore:this.dataStore,referencedDataStore:this.referencedDataStore})}))}refetch(e){throw"Do not call refetch on message stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){return!0}teardownNested(e){}anyChildChanged(e,t,n){return l_(this,arguments,(function*(e,t,{dataStore:n,referencedDataStore:r}){return!0===(yield n.changedBetween(e,t))||!0===(yield null==r?void 0:r.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){var n,r,i;const s=yield t.dataStore.getDeep(e);if(!s.ok)return s;const o=s.value;if(null===o.snapshot)return __({snapshot:null});const a=yield null==(n=t.referencedDataStore)?void 0:n.getDeep(e);if(a&&!a.ok)return a;const u=null!=(r=null==a?void 0:a.value)?r:null,l=null!=(i=null==u?void 0:u.snapshot)?i:null;return __({snapshot:{id:o.snapshot.id,type:o.snapshot.type,sender:o.snapshot.sender,custom:o.snapshot.custom,createdAt:o.snapshot.createdAt,editedAt:o.snapshot.editedAt,referencedMessage:l,origin:o.snapshot.origin,plaintext:o.snapshot.plaintext,content:o.snapshot.content}})}))}}class pD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}listen(e){return this.onlyUsedInternally&&this.mostRecentState.resultPromise.then((e=>{if(e.ok&&null!==e.value.inWindow){const t=30-e.value.inWindow.length;t>0&&this._loadMoreMessages(t)}})),super.listen(e)}fetchInitial(e){return l_(this,null,(function*(){const t=this.onlyUsedInternally?1:30,n=yield fD({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:t});return n.ok?null===n.value.messages?__({lastChanged:e,lastMessageChanged:e,stores:null,inWindow:null,windowEnd:null}):mD({seq:e,messages:n.value.messages,cursor:n.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):n}))}teardownNested(e){if(e.stores){const t=D_("TERMINATED");Object.values(e.stores).forEach((e=>e.setError(t))),e.inWindow.forEach((e=>e.setError(t)))}}anyChildChanged(e,t,n){return l_(this,null,(function*(){for(const r in n.stores){const i=n.stores[r];if(!0===(yield null==i?void 0:i.changedBetween(e,t)))return!0}return!1}))}lastMessageChangedBetween(e,t){return l_(this,null,(function*(){if(e>=t)return!1;const n=yield this.get(t).resultPromise;if(!n.ok)return!1;if(n.value.lastMessageChanged>e)return!0;if(null===n.value.stores)return!1;const r=n.value.inWindow[0];return void 0!==r&&!0===(yield r.changedBetween(e,t))}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&!!V_(e.inWindow.map((e=>e.messageId)),t.inWindow.map((e=>e.messageId)))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:null,loadedAll:!0});const n=yield Promise.all(t.inWindow.map((t=>t.getDeep(e)))),r=n.find((e=>!e.ok));return r||__({snapshot:n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot)),loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreMessages(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreMessages(e=30){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield fD({count:e,cursor:n,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.messages?(console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."),e):mD({seq:i,prevState:e.value,messages:r.value.messages,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}messageCreated(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."),n;if(n.value.windowEnd&&t.state.createdAt<n.value.windowEnd.oldestMessageTs)return n;if(Object.hasOwnProperty.call(n.value.stores,t.state.id))return n;const r=o_({},n.value.stores),i=new hD(e,this.conversationId,t.state,this.realtimeClient);r[t.state.id]=i;const s=t.state.referencedMessageId;let o;null===s?o=null:s in r?o=r[s]:(o=new hD(e,this.conversationId,s,this.realtimeClient),r[s]=o);const a=new dD(e,t.state.createdAt,i,o),u=[...n.value.inWindow,a];u.sort(((e,t)=>t.createdAt-e.createdAt));const l=u[0].messageId===t.messageId?e:n.value.lastMessageChanged;return __({lastChanged:e,lastMessageChanged:l,stores:r,inWindow:u,windowEnd:n.value.windowEnd})}))}messageEdited(e,t){this.mutate(e,(n=>{var r;return null===n.value.stores?(console.warn("[TalkJS] Received a 'message.edited' event for a nonexistent conversation."),n):(null==(r=n.value.stores[t.messageId])||r.messageEdited(e,t),n)}))}messageDeleted(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'message.deleted' event for a conversation that we thought didn't exist."),n;if(Object.values(n.value.stores).forEach((n=>n.messageDeleted(e,t))),void 0===n.value.stores[t.messageId])return n;const r=o_({},n.value.stores);delete r[t.messageId];const i=n.value.inWindow.filter((e=>e.messageId!==t.messageId));if(t.newLastMessage&&0===i.length){const n=new hD(e,this.conversationId,t.newLastMessage,this.realtimeClient);r[n.messageId]=n;const s=t.newLastMessage.referencedMessageId;let o;null===s?o=null:s in r?o=r[s]:(o=new hD(e,this.conversationId,s,this.realtimeClient),r[s]=o);const a=new dD(e,t.newLastMessage.createdAt,n,o);i.push(a)}const s=void 0!==t.newLastMessage?e:n.value.lastMessageChanged;return __({lastChanged:e,lastMessageChanged:s,stores:r,inWindow:i,windowEnd:n.value.windowEnd})}))}conversationCleared(e,t){this.mutate(e,(t=>{var n;return 0===(null==(n=t.value.inWindow)?void 0:n.length)&&null===t.value.windowEnd?t:(this.teardownNested(t.value),__({lastChanged:e,lastMessageChanged:e,stores:{},inWindow:[],windowEnd:null}))}))}sideCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.stores?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.stores?t:(this.teardownNested(t.value),__({lastChanged:e,lastMessageChanged:e,stores:null,inWindow:null,windowEnd:null}))))}getMessageFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return D_("NOT_IN_CACHE");const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.getFromCache()}))}}function fD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,conversationId:n,count:r}){const i={limit:r,cursor:e},s=yield t.call("GET",["me","conversations",n,"messages"],i,{bypassCache:!0});if(s.ok){const{data:e,cursor:t}=s.value.data;return __({messages:e,nextCursor:t})}return!s.ok&&"server"===s.where&&404===s.value.status||!s.ok&&"server"===s.where&&403===s.value.status&&"NOT_A_PARTICIPANT"===s.value.errorCode?__({messages:null,nextCursor:null}):s}))}function mD({seq:e,prevState:t,messages:n,cursor:r,conversationId:i,realtimeClient:s}){var o,a,u,l;const c=t?o_({},t.stores):{};for(const p of n)if(void 0===c[p.id]){const t=new hD(e,i,p,s);c[t.messageId]=t}for(const p of n){const t=p.referencedMessageId;if(t&&void 0===c[t]){const n=new hD(e,i,t,s);c[n.messageId]=n}}const h=t?[...t.inWindow]:[];for(const p of n)h.push(new dD(e,p.createdAt,c[p.id],p.referencedMessageId?c[p.referencedMessageId]:null));h.sort(((e,t)=>t.createdAt-e.createdAt));const d=(null==(a=null==(o=null==t?void 0:t.inWindow)?void 0:o[0])?void 0:a.messageId)===(null==(u=null==h?void 0:h[0])?void 0:u.messageId)&&null!=(l=null==t?void 0:t.lastMessageChanged)?l:e;return __(null===r?{lastChanged:e,lastMessageChanged:d,stores:c,inWindow:h,windowEnd:null}:{lastChanged:e,lastMessageChanged:d,stores:c,inWindow:h,windowEnd:{cursor:r,oldestMessageTs:n[n.length-1].createdAt}})}class ED extends q_{constructor(e,t,n,r,i){super(e,r,i),this.convDataStore=t,this.realtimeClient=n,this.unsubscribeDebounceMs=0}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,store:this.convDataStore})}))}teardownNested(e){e.store.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return n.store.store.changedBetween(e,t)}))}equal(e,t){return!0}loadNested(e,t){return l_(this,null,(function*(){return t.store.store.getDeep(e)}))}getFromCache(){return l_(this,null,(function*(){return this.convDataStore.store.getFromCache()}))}}function gD(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(e[n],n)}function AD(e,t){return function(e){let n={};return gD(e,((e,r)=>{const[i,s]=(([e,n])=>[e,t(n,e)])([r,e]);n[i]=s})),n}(e)}class _D extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e4}fetchInitial(e){return l_(this,null,(function*(){const t=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"typing"],{},{bypassCache:!0});if(!t.ok&&"server"===t.where&&404===t.value.status)return __({data:null,lastChanged:e});if(!t.ok&&"server"===t.where&&403===t.value.status&&"NOT_A_PARTICIPANT"===t.value.errorCode)return __({data:null,lastChanged:e});if(!t.ok)return t;const n=t.value.data;return n.many?__({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:e}):__({data:n,userSubscriptions:AD(n.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t]))),lastChanged:e})}))}equal(e,t){return V_(e.data,t.data)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.data)return __({snapshot:null,lastChanged:t.lastChanged});if(t.data.many)return __({snapshot:{many:!0},lastChanged:t.lastChanged});const n=Object.entries(t.data.usersTyping).sort((([e,t],[n,r])=>t-r)).map((([e,t])=>e)).map((n=>t.userSubscriptions[n].store.getDeep(e))),r=yield Promise.all(n),i=r.find((e=>!e.ok));if(i)return i;const s=r.map((e=>e.value)),o=s.map((e=>e.snapshot)),a=s.map((e=>e.lastChanged));return __({snapshot:{users:o,many:!1},lastChanged:Math.max(t.lastChanged,...a)})}))}typingAvailable(e,t){this.mutate(e,(()=>__({data:t.state,userSubscriptions:t.state.many?{}:AD(t.state.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t]))),lastChanged:e})))}typingChanged(e,t){this.mutate(e,(n=>{if(null===n.value.data)return n;if(void 0===t.diff.many){if(!0===n.value.data.many)return n;const r=o_({},n.value.data.usersTyping),i=o_({},n.value.userSubscriptions);return gD(t.diff.usersTyping,((e,t)=>{var n;"number"==typeof e?(r[t]=e,i[t]=this.realtimeClient.internalSubscribe(["users",t])):null===e&&(delete r[t],null==(n=i[t])||n.unsubscribe(),delete i[t])})),__({data:{usersTyping:r,many:!1},userSubscriptions:i,lastChanged:e})}if(!0===t.diff.many)return n.value.data.many?n:__({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:e});if(!1===t.diff.many){if(!1===n.value.data.many)return n;const r=AD(t.diff.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t])));return __({data:t.diff,userSubscriptions:r,lastChanged:e})}throw t.diff,"Unreachable"}))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.data?t:__({data:null,lastChanged:e})))}teardownNested(e){e.data&&gD(e.userSubscriptions,(e=>e.unsubscribe()))}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;if(null===n.data)return!1;for(const i in n.userSubscriptions){const s=n.userSubscriptions[i];if(!0===(yield null==(r=null==s?void 0:s.store)?void 0:r.changedBetween(e,t)))return!0}return!1}))}}class DD extends K_{constructor(e,t,n,r){super(e),this.conversationId=t,this.participantData=n,this.realtimeClient=r}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,user:this.realtimeClient.internalSubscribe(["users",this.participantData.id]),data:this.participantData})}))}refetch(e){throw"Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){var n,r,i,s;return(null==(r=null==(n=e.user)?void 0:n.store)?void 0:r.userId)===(null==(s=null==(i=t.user)?void 0:i.store)?void 0:s.userId)&&V_(e.data,t.data)}teardownNested(e){var t;null==(t=e.user)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;const i=null==(r=n.user)?void 0:r.store;return!0===(yield null==i?void 0:i.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){if(null===t.data)return __({snapshot:null});const n=yield t.user.store.getDeep(e);if(!1===n.ok)return n;const r=n.value.snapshot;return __({snapshot:this.realtimeClient.createParticipantSnapshotPreloaded(t.data,r)})}))}participantEdited(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,user:n.value.user,data:{id:n.value.data.id,access:Y_(n.value.data.access,t.diff.access),notify:Y_(n.value.data.notify,t.diff.notify),joinedAt:n.value.data.joinedAt}})))}participantDeleted(e,t){this.mutate(e,(t=>null===t.value.data?t:(this.teardownNested(t.value),__({lastChanged:e,user:null,data:null}))))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok?null===e.value.data?v_({status:404,errorCode:"PARTICIPANT_NOT_FOUND",reasons:["No participant with that ID exists"]}):__({status:200,data:e.value.data}):D_("NOT_IN_CACHE")}))}}class vD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(e){return l_(this,null,(function*(){const t=yield TD({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:10});return t.ok?null===t.value.participants?__({lastChanged:e,stores:null,inWindow:null,windowEnd:null}):OD({seq:e,participants:t.value.participants,cursor:t.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):t}))}teardownNested(e){if(e.stores){const t=D_("TERMINATED");Object.values(e.stores).forEach((e=>e.setError(t)))}}anyChildChanged(e,t,n){return l_(this,null,(function*(){for(const r in n.stores){const i=n.stores[r];if(!0===(yield null==i?void 0:i.changedBetween(e,t)))return!0}return!1}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:null,loadedAll:!0});const n=yield Promise.all(Object.values(t.stores).map((t=>t.getDeep(e)))),r=n.find((e=>!e.ok));if(r)return r;const i=n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot));return i.sort(((e,t)=>t.joinedAt-e.joinedAt)),__({snapshot:i,loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreParticipants(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreParticipants(e=10){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield TD({count:e,cursor:n,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.participants?(console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."),e):OD({seq:i,prevStores:e.value.stores,participants:r.value.participants,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}participantCreated(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."),n;if(n.value.windowEnd&&t.state.joinedAt<n.value.windowEnd.oldestParticipantTs)return n;if(Object.hasOwnProperty.call(n.value.stores,t.state.id))return n;const r=o_({},n.value.stores),i=new DD(e,this.conversationId,t.state,this.realtimeClient);return r[t.state.id]=i,__({lastChanged:e,stores:r,windowEnd:n.value.windowEnd})}))}participantEdited(e,t){this.mutate(e,(n=>{var r;return null===n.value.stores?(console.warn("[TalkJS] Received a 'participant.edited' event for a nonexistent conversation."),n):(null==(r=n.value.stores[t.userId])||r.participantEdited(e,t),n)}))}participantDeleted(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."),n;const r=n.value.stores[t.userId];if(void 0===r)return n;r.participantDeleted(e,t);const i=o_({},n.value.stores);return delete i[t.userId],__({lastChanged:e,stores:i,windowEnd:n.value.windowEnd})}))}sideCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.stores?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.stores?t:(this.teardownNested(t.value),__({lastChanged:e,stores:null,inWindow:null,windowEnd:null}))))}getParticipantFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return D_("NOT_IN_CACHE");const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.getFromCache()}))}}function TD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,conversationId:n,count:r}){const i={limit:r,cursor:e},s=yield t.call("GET",["me","conversations",n,"participants"],i,{bypassCache:!0});if(s.ok){const{data:e,cursor:t}=s.value.data;return __({participants:e,nextCursor:t})}return!s.ok&&"server"===s.where&&404===s.value.status||!s.ok&&"server"===s.where&&403===s.value.status&&"NOT_A_PARTICIPANT"===s.value.errorCode?__({participants:null,nextCursor:null}):s}))}function OD({seq:e,prevStores:t,participants:n,cursor:r,conversationId:i,realtimeClient:s}){const o=t?o_({},t):{};for(const a of n)if(void 0===o[a.id]){const t=new DD(e,i,a,s);o[a.id]=t}return __(null===r?{lastChanged:e,stores:o,windowEnd:null}:{lastChanged:e,stores:o,windowEnd:{cursor:r,oldestParticipantTs:n[n.length-1].joinedAt}})}class SD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.getConvDataStore=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(e){return l_(this,null,(function*(){const t=yield CD({realtimeClient:this.realtimeClient,count:20});return t.ok?null===t.value.conversations?__({lastChanged:e,stores:null,windowEnd:null}):yD({seq:e,conversations:t.value.conversations,cursor:t.value.nextCursor,getConvDataStore:this.getConvDataStore}):t}))}teardownNested(e){null!==e.stores&&Object.values(e.stores).forEach((e=>e.unsubscribe()))}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;for(const i in n.stores){const s=n.stores[i];if(!0===(yield null==(r=null==s?void 0:s.store)?void 0:r.changedBetween(e,t)))return!0}return!1}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:[],loadedAll:!0});const n=yield Promise.all(Object.values(t.stores).map((t=>t.store.getDeep(e)))),r=n.find((e=>!e.ok));if(r)return r;const i=n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot));return i.sort(((e,t)=>{var n,r,i,s;const o=null!=(r=null==(n=e.lastMessage)?void 0:n.createdAt)?r:e.joinedAt;return(null!=(s=null==(i=t.lastMessage)?void 0:i.createdAt)?s:t.joinedAt)-o})),__({snapshot:i,loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreConversations(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreConversations(e=20){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield CD({count:e,cursor:n,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.conversations?(console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."),e):yD({seq:i,prevStores:e.value.stores,conversations:r.value.conversations,cursor:r.value.nextCursor,getConvDataStore:this.getConvDataStore}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}getConvFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.store.getFromCache()}))}userCreated(e,t){this.mutate(e,(e=>null!==e.value.stores?e:__({lastChanged:e.value.lastChanged,stores:{},windowEnd:null})))}sideCreated(e,t){const n=this.getConvDataStore(t.state);this.mutate(e,(r=>Object.hasOwnProperty.call(r.value.stores,t.conversationId)?(n.unsubscribe(),r):__({lastChanged:e,stores:a_(o_({},r.value.stores),{[t.conversationId]:n}),windowEnd:r.value.windowEnd})))}sideDeleted(e,t){this.mutate(e,(n=>{var r;if(!Object.hasOwnProperty.call(n.value.stores,t.conversationId))return n;const i=o_({},n.value.stores);return null==(r=i[t.conversationId])||r.unsubscribe(),delete i[t.conversationId],__({lastChanged:e,stores:i,windowEnd:n.value.windowEnd})}))}sideEdited(e,t){const n=t.diff.lastMessageAt;void 0!==n&&this.mutate(e,(r=>{var i;if(null===r.value.stores)return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."),r;if(null===r.value.windowEnd)return r;const s=Object.hasOwnProperty.call(r.value.stores,t.conversationId);if(s&&n<r.value.windowEnd.oldestMessageTs){const n=o_({},r.value.stores);return null==(i=n[t.conversationId])||i.unsubscribe(),delete n[t.conversationId],__({lastChanged:e,stores:n,windowEnd:r.value.windowEnd})}if(!s&&n>=r.value.windowEnd.oldestMessageTs){const n=this.getConvDataStore(t.conversationId);return __({lastChanged:e,stores:a_(o_({},r.value.stores),{[t.conversationId]:n}),windowEnd:r.value.windowEnd})}return r}))}}function CD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,count:n}){const r={limit:n,cursor:e},i=yield t.call("GET",["me","conversations"],r,{bypassCache:!0});if(i.ok){const{data:e,cursor:t}=i.value.data;return __({conversations:e,nextCursor:t})}return i.ok||"server"!==i.where||404!==i.value.status||"USER_NOT_FOUND"!==i.value.errorCode?i:__({conversations:null,nextCursor:null})}))}function yD({seq:e,prevStores:t,conversations:n,cursor:r,getConvDataStore:i}){const s=t?o_({},t):{};for(const o of n)void 0===s[o.id]&&(s[o.id]=i(o));return __(null===r?{lastChanged:e,stores:s,windowEnd:null}:{lastChanged:e,stores:s,windowEnd:{cursor:r,oldestMessageTs:Math.min(...n.map((e=>e.lastMessageAt)))}})}class ND extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversation=t,this.realtimeClient=n,this.unsubscribeDebounceMs=5e3}get conversationId(){return"string"==typeof this.conversation?this.conversation:this.conversation.id}fetchInitial(e){return l_(this,null,(function*(){const t=this.realtimeClient.internalSubscribe(["me","conversations",this.conversationId,"messages"]);if("object"==typeof this.conversation)return __({lastChanged:e,snapshot:this.conversation,messageWindowStore:t});const n=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId],{},{bypassCache:!0});let r;if(n.ok)r=n.value.data;else if("server"===n.where&&404===n.value.status)r=null;else{if("server"!==n.where||403!==n.value.status||"NOT_A_PARTICIPANT"!==n.value.errorCode)return t.unsubscribe(),n;r=null}return __({lastChanged:e,snapshot:r,messageWindowStore:t})}))}teardownNested(e){var t;null==(t=e.messageWindowStore)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return!0===(yield n.messageWindowStore.store.lastMessageChangedBetween(e,t))}))}equal(e,t){return V_(e.snapshot,t.snapshot)}loadNested(e,t){return l_(this,null,(function*(){var n;if(!t.snapshot)return __({snapshot:null,loadedAll:!0});const r=yield t.messageWindowStore.store.getDeep(e);if(!r.ok)return r;const i=r.value.snapshot,s=null!=(n=null==i?void 0:i[0])?n:null;return __({snapshot:a_(o_({},t.snapshot),{lastMessage:s})})}))}participantEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}conversationEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}sideEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}sideCreated(e,t){this.mutate(e,(n=>n.value.snapshot?n:__({lastChanged:e,snapshot:t.state,messageWindowStore:n.value.messageWindowStore})))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.snapshot?t:__({lastChanged:e,snapshot:null,messageWindowStore:t.value.messageWindowStore})))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok&&e.value.snapshot?__({status:200,data:e.value.snapshot}):D_("NOT_IN_CACHE")}))}}function ID(e,t){const n=t;return{id:e.id,createdAt:e.createdAt,subject:Y_(e.subject,n.subject),photoUrl:Y_(e.photoUrl,n.photoUrl),welcomeMessages:Y_(e.welcomeMessages,n.welcomeMessages),custom:z_(e.custom,n.custom),lastMessageAt:Y_(e.lastMessageAt,n.lastMessageAt),unreadMessageCount:Y_(e.unreadMessageCount,n.unreadMessageCount),isUnread:Y_(e.isUnread,n.isUnread),access:Y_(e.access,n.access),notify:Y_(e.notify,n.notify),readUntil:Y_(e.readUntil,n.readUntil),everyoneReadUntil:Y_(e.everyoneReadUntil,n.everyoneReadUntil),joinedAt:e.joinedAt}}class bD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.userId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3}fetchInitial(e){return l_(this,null,(function*(){const t=this.realtimeClient.internalSubscribe(["users",this.userId]),n=yield this.realtimeClient.call("GET",["users",this.userId,"online"],{},{bypassCache:!0});return n.ok||"server"!==n.where||404!==n.value.status||"USER_NOT_FOUND"!==n.value.errorCode?n.ok?__({lastChanged:e,user:t,data:n.value.data}):n:__({lastChanged:e,user:t,data:null})}))}equal(e,t){return V_(e.data,t.data)}teardownNested(e){e.user.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return n.user.store.changedBetween(e,t)}))}loadNested(e,t){return l_(this,null,(function*(){const n=yield t.user.store.getDeep(e);if(!n.ok)return n;const r=n.value.snapshot;return null===t.data||null===r?__({snapshot:null}):__({snapshot:o_({user:r},t.data)})}))}userCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.data?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}userOnlineChanged(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,user:n.value.user,data:t.diff})))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok)return D_("NOT_IN_CACHE");if(null===e.value.data)return v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const t=e.value,n=u_(t,["user"]);return __({status:200,data:o_({},n.data)})}))}}class RD{constructor(e,t,n){this.realtimeClient=n,this.convDataStores={},this.storeMap={},this.emitMutex=new G_,this.seqOffset=0,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss=!0,this.connection=new j_(e,t,{onUpstreamRestarting:()=>{this.refetchOnNextNetworkLoss=!1},onReady:()=>{this.refetchOnNextNetworkLoss=!0},onResubscribeSent:()=>{if(this.seqOffset+=this.seq,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss){this.seqOffset++;const e=this.seq;this.refetchAll(e),this.emitAll(e)}},onResubscribeError:(e,t)=>{var n;null==(n=this.storeMap[wD(e)])||n.setError(t)},onPublish:(e,t)=>{this.seqInThisConnection=e;const n=this.seq;for(const r of t)this.handlePublish(n,r);this.emitAll(n)}})}get seq(){return this.seqOffset+this.seqInThisConnection}refetchAll(e){Object.values(this.storeMap).forEach((t=>null==t?void 0:t.refetch(e)))}emitAll(e){return this.emitMutex.runExclusive((()=>l_(this,null,(function*(){const t=Object.values(this.storeMap).map((t=>null==t?void 0:t.emit(e)));yield Promise.all(t)}))))}handlePublish(e,t){var n,r,i,s,o,a,u,l,c,h,d,p,f,m,E,g,A,_,D,v,T,O,S,C,y,N,I;switch(t.type){case"user.created":return null==(n=this.storeMap[`/users/${t.userId}`])||n.userCreated(e,t),null==(r=this.storeMap["/me/conversations"])||r.userCreated(e,t),void(null==(i=this.storeMap[`/users/${t.userId}/online`])||i.userCreated(e,t));case"user.edited":return void(null==(s=this.storeMap[`/users/${t.userId}`])||s.userEdited(e,t));case"side.created":return null==(o=this.convDataStores[t.conversationId])||o.sideCreated(e,t),null==(a=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||a.sideCreated(e,t),null==(u=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||u.sideCreated(e,t),void(null==(l=this.storeMap["/me/conversations"])||l.sideCreated(e,t));case"side.edited":return null==(c=this.convDataStores[t.conversationId])||c.sideEdited(e,t),void(null==(h=this.storeMap["/me/conversations"])||h.sideEdited(e,t));case"side.deleted":return null==(d=this.convDataStores[t.conversationId])||d.sideDeleted(e,t),null==(p=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||p.sideDeleted(e,t),null==(f=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||f.sideDeleted(e,t),null==(m=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||m.sideDeleted(e,t),void(null==(E=this.storeMap["/me/conversations"])||E.sideDeleted(e,t));case"conversation.edited":return void(null==(g=this.convDataStores[t.conversationId])||g.conversationEdited(e,t));case"message.created":return void(null==(A=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||A.messageCreated(e,t));case"message.edited":return void(null==(_=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||_.messageEdited(e,t));case"message.deleted":return void(null==(D=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||D.messageDeleted(e,t));case"typing.available":return void(null==(v=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||v.typingAvailable(e,t));case"typing.changed":return void(null==(T=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||T.typingChanged(e,t));case"conversation.cleared":return void(null==(O=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||O.conversationCleared(e,t));case"participant.edited":return null==(S=this.convDataStores[t.conversationId])||S.participantEdited(e,t),void(null==(C=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||C.participantEdited(e,t));case"participant.created":return void(null==(y=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||y.participantCreated(e,t));case"participant.deleted":return void(null==(N=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||N.participantDeleted(e,t));case"user.online.changed":return void(null==(I=this.storeMap[`/users/${t.userId}/online`])||I.userOnlineChanged(e,t))}}call(e,t,n,r){return l_(this,null,(function*(){if(!r.bypassCache&&"GET"===e){const e=wD(t);if(e in this.storeMap){const t=e,n=this.storeMap[t];if(n&&"getFromCache"in n){const e=yield n.getFromCache();if("NOT_IN_CACHE"!==e.value)return e}}else if(d_(t,["me","conversations","*","messages","*"])){const e=this.storeMap[`/me/conversations/${t[2]}/messages`];if(e){const n=yield e.getMessageFromCache(t[4]);if("NOT_IN_CACHE"!==n.value)return n}}else if(d_(t,["me","conversations","*","participants","*"])){const e=this.storeMap[`/me/conversations/${t[2]}/participants`];if(e){const n=yield e.getParticipantFromCache(t[4]);if("NOT_IN_CACHE"!==n.value)return n}}else if(d_(t,["me","conversations","*"])){const e=this.storeMap["/me/conversations"];if(e){const n=yield e.getConvFromCache(t[2]);if("NOT_IN_CACHE"!==n.value)return n}}}return this.connection.call(e,t,n)}))}subscribe(e,t){const n=this.getOrCreateStore(e),r=g_(),i=g_();r.promise.catch((()=>{})),i.promise.catch((()=>{}));const s={state:{type:"pending",latestSnapshot:void 0},connected:r.promise,terminated:i.promise,loadMore:e=>l_(this,null,(function*(){"loadMore"in n&&(yield n.loadMore(e))})),unsubscribe:()=>{}},o=n.listen((n=>{if(n.ok){const e=!("loadedAll"in n.value)||n.value.loadedAll,i={type:"active",latestSnapshot:n.value.snapshot,loadedAll:e};s.state=i,null==t||t(n.value.snapshot,e),r.resolve(i)}else if("pending"===s.state.type||"active"===s.state.type){if("server"===n.where){const t={type:"error",error:new Error(h_(`Subscribe to ${e.join("/")}`,n.value))};return s.state=t,i.resolve(t),void r.reject("Subscription encountered an error during initial connection")}if("SESSION_DESTROYED"===n.value){const e={type:"error",error:new Error("Session was destroyed causing all subscriptions to be terminated")};return s.state=e,i.resolve(e),void r.reject("Subscription encountered an error during initial connection")}if("UNSUBSCRIBED"===n.value)return;if("TERMINATED"===n.value)return;n.value}}));return s.unsubscribe=()=>{if("pending"===s.state.type||"active"===s.state.type){o();const e={type:"unsubscribed"};s.state=e,i.resolve(e),r.reject("Subscription was unsubscribed before connecting")}},s}getOrCreateStore(e){const t=wD(e);if(t in this.storeMap)return this.storeMap[t];this.connection.subscribe(e).then((e=>{e.ok||n.setError(e)}));const n=this.instantiateStore(e,(()=>{delete this.storeMap[t],this.connection.unsubscribe(e)}));return this.storeMap[t]=n,n}destroy(){this.storeMap={},this.convDataStores={},this.connection.destroy()}isConnected(){return this.connection.isConnected()}instantiateStore(e,t){if(d_(e,["users","*"]))return new Z_(this.seq,e[1],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*"]))return new ED(this.seq,this.subscribeConvData(e[2]),this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","messages"]))return new pD(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","participants"]))return new vD(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","typing"]))return new _D(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations"]))return new SD(this.seq,(e=>this.subscribeConvData(e)),this.realtimeClient,this.emitMutex,t);if(d_(e,["users","*","online"]))return new bD(this.seq,e[1],this.realtimeClient,this.emitMutex,t);throw"Unreachable"}subscribeConvData(e){const t="string"==typeof e?e:e.id;if(Object.hasOwnProperty.call(this.convDataStores,t)){const e=this.convDataStores[t];return{store:e,unsubscribe:e.registerInternalSubscription()}}const n=new ND(this.seq,e,this.realtimeClient,this.emitMutex,(()=>{delete this.convDataStores[t]}));return this.convDataStores[t]=n,{store:n,unsubscribe:n.registerInternalSubscription()}}}function wD(e){return`/${e.join("/")}`}class kD{constructor(e,t,n){this.userId=t,this.alive=!0,this.connection=new RD(e,n,this),n.onTokenRefreshFailed((()=>{this.destroy()}))}call(e,t,n){return l_(this,arguments,(function*(e,t,n,r={}){return this.alive?this.connection.call(e,t,n,r):D_("SESSION_DESTROYED")}))}subscribe(e,t){return this.connection.subscribe(e,t)}internalSubscribe(e){const t=this.connection.getOrCreateStore(e);return{store:t,unsubscribe:t.registerInternalSubscription()}}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}listMessages(e,t){return l_(this,null,(function*(){const n=yield this.call("GET",["me","conversations",e,"messages"],t);if(!n.ok)return LD(n,"Listing messages in "+e);const r=n.value.data.data,i=yield Promise.all(r.map((t=>this.createMessageSnapshot(t,e)))),s=i.find((e=>!e.ok));return void 0===s||s.ok?__(i.map((({value:e})=>e))):s}))}createConversationSnapshotPreloaded(e,t){return{id:e.id,subject:e.subject,photoUrl:e.photoUrl,welcomeMessages:e.welcomeMessages,custom:e.custom,createdAt:e.createdAt,joinedAt:e.joinedAt,lastMessageAt:e.lastMessageAt,unreadMessageCount:e.unreadMessageCount,isUnread:e.isUnread,access:e.access,notify:e.notify,lastMessage:t,readUntil:e.readUntil,everyoneReadUntil:e.everyoneReadUntil}}createUserSnapshot(e){return{id:e.id,name:e.name,custom:e.custom,locale:e.locale,photoUrl:e.photoUrl,role:e.role,welcomeMessage:e.welcomeMessage}}createParticipantSnapshotPreloaded(e,t){return{user:t,access:e.access,notify:e.notify,joinedAt:e.joinedAt}}createMessageSnapshot(e,t){return l_(this,null,(function*(){const n=null===e.senderId?Promise.resolve(__(null)):this.getUser(e.senderId),r=null===e.referencedMessageId?Promise.resolve(__(null)):this.getReferencedMessage(t,e.referencedMessageId),i=yield n;if(!i.ok)return i;const s=yield r;return s.ok?__(this.createMessageSnapshotPreloaded(e,i.value,s.value)):s}))}getReferencedMessage(e,t){return l_(this,null,(function*(){const n=yield this.call("GET",["me","conversations",e,"messages",t],{});if(!n.ok&&"server"===n.where&&404===n.value.status)return __(null);if(!n.ok&&"server"===n.where&&403===n.value.status&&"NOT_A_PARTICIPANT"===n.value.errorCode)return __(null);if(!n.ok)return LD(n,`Fetching referenced message ${t} in conversation ${e}`);const r=n.value.data,i=yield this.getUser(r.senderId);if(!i.ok)return i;const s=i.value;return __(this.createReferencedMessageSnapshotPreloaded(r,s))}))}getUser(e){return l_(this,null,(function*(){const t=yield this.call("GET",["users",e],{includePrivateFields:!1});return t.ok||"server"!==t.where||404!==t.value.status?t.ok?__(this.createUserSnapshot(t.value.data)):LD(t,"Get user "+e):__(null)}))}createMessageSnapshotPreloaded(e,t,n){return{id:e.id,type:e.type,sender:t,referencedMessage:n,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,origin:e.origin,content:e.content,plaintext:lD(e.content,{})}}createReferencedMessageSnapshotPreloaded(e,t){return{id:e.id,type:e.type,sender:t,referencedMessageId:e.referencedMessageId,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,origin:e.origin,content:e.content,plaintext:lD(e.content,{})}}}function LD(e,t){return"server"===e.where?v_(a_(o_({},e.value),{operation:t})):e}function MD(e,t){var n;if(t.ok)return t.value;throw"SESSION_DESTROYED"===t.value?new Error(`${e} failed because the session was destroyed`):new Error(h_(null!=(n=t.value.operation)?n:e,t.value))}class FD{constructor(e,t){this.id=e,this._realtimeClient=t}get brandedId(){return this.id}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.getUser(this.brandedId);return MD("Get user "+this.id,e)}))}set(e){return l_(this,null,(function*(){null===e.role&&(e.role="default");const t="string"==typeof e.email?[e.email]:e.email,n="string"==typeof e.phone?[e.phone]:e.phone,r=yield this._realtimeClient.call("PUT",["users",this.brandedId],a_(o_({},e),{email:t,phone:n}));c_("Set user "+this.id,r)}))}createIfNotExists(e){return l_(this,null,(function*(){void 0===e.role&&(e.role="default");const t="string"==typeof e.email?[e.email]:e.email,n="string"==typeof e.phone?[e.phone]:e.phone,r=yield this._realtimeClient.call("POST",["users",this.brandedId],a_(o_({},e),{email:t,phone:n}));(r.ok||"server"!==r.where||409!=r.value.status)&&c_(`Create user ${this.id} if not exists`,r)}))}subscribe(e){return this._realtimeClient.subscribe(["users",this.brandedId],e)}subscribeOnline(e){return this._realtimeClient.subscribe(["users",this.brandedId,"online"],e)}}class xD{constructor(e,t,n){this.userId=e,this.conversationId=t,this._realtimeClient=n}get brandedUserId(){return this.userId}get brandedConversationId(){return this.conversationId}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"participants",this.brandedUserId],{}),t=yield this._realtimeClient.call("GET",["users",this.brandedUserId],{includePrivateFields:!1}),[n,r]=yield Promise.all([e,t]);if(!n.ok&&"server"===n.where&&404===n.value.status)return null;if(!r.ok&&"server"===r.where&&404===r.value.status)return null;const i=c_(`Get participant ${this.userId} in conversation ${this.conversationId}`,n),s=c_(`Get user ${this.userId}`,r),o=this._realtimeClient.createUserSnapshot(s);return this._realtimeClient.createParticipantSnapshotPreloaded(i,o)}))}set(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);c_(`Set participant ${this.userId} in conversation ${this.conversationId}`,t)}))}edit(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);c_(`Edit participant ${this.userId} in conversation ${this.conversationId}`,t)}))}createIfNotExists(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("POST",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);(t.ok||"server"!==t.where||409!==t.value.status)&&c_(`Add participant ${this.userId} to conversation ${this.conversationId}`,t)}))}delete(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"participants",this.brandedUserId],{});(e.ok||"server"!==e.where||404!==e.value.status)&&c_(`Remove participant ${this.userId} from conversation ${this.conversationId}`,e)}))}}function BD(e){const t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";let n=0;const r=[],i=e===n;n=e;const s=new Array(8);for(let a=7;a>=0;a--)s[a]=t.charAt(e%64),e=Math.floor(e/64);if(0!==e)throw new Error("We should have converted the entire timestamp.");let o=s.join("");if(i){let e;for(e=11;e>=0&&63===r[e];e--)r[e]=0;r[e]++}else for(let a=0;a<12;a++)r[a]=Math.floor(64*Math.random());for(let a=0;a<12;a++)o+=t.charAt(r[a]);if(20!=o.length)throw new Error("Length should be 20.");return o}const PD=(e,t,n=void 0)=>e.reduce(((e,r,i)=>e.concat((e=>{if("string"==typeof e)return t(e,n);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:e.type,children:PD(e.children,t,e.type)}];case"link":return[{type:e.type,url:e.url,children:PD(e.children,t,e.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:e.type,action:e.action,params:e.params,children:PD(e.children,t,e.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[e]}})(r))),[]);function UD(e,t){return n=>{const r=n;let i=0;const s=[];for(const o of tD(n,e)){o.index-i>0&&s.push(r.substring(i,o.index));const e=t(o);Array.isArray(e)?s.push(...e):s.push(e),i=o.index+o[0].length}return i<n.length&&s.push(n.substring(i)),s}}const HD="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var $D,jD=(($D=jD||{})[$D.italic=1]="italic",$D[$D.strikethrough=2]="strikethrough",$D[$D.bold=4]="bold",$D);const YD=[0,1,2,3,4,5,6].map((e=>{const t=[];return 1&e||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&e||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&e||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map((e=>e.source)).join("|"),"g")})),zD={_:1,"*":4,"~":2};function VD(e){return GD(e,0)}function GD(e,t=0){const n=YD[t],r=n?function(e){const t=UD(WD.getOrCompute(e,(()=>new RegExp(`(?:^|[\\s${HD}])(?:${e.source})(?=[\\s${HD}]|$)`,"g"))),(e=>{const t=e[0][1],n=e[1]||e[2]||e[3]||e[4]||e[5]||e[6];return[" ",{type:jD[zD[t]],children:[n]}]}));return e=>{const[n,...r]=t(" "+e);return n.length>1&&r.unshift(n.substring(1)),r}}(n):()=>[e];return PD(r(e),((e,n)=>"bold"===n||"italic"===n||"strikethrough"===n?GD(e,t|jD[n]):[e]))}const WD=function(){const e=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(t,n){if(e.has(t))return e.get(t);const r=n();return e.set(t,r),r}}}();function XD(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function KD(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function qD(e){throw new Error("Unhandled case for value: '"+e+"'")}var JD=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);t=s.shift();)-1===XD(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);i.length&&(t=s.shift());){var o=XD(i,t);-1!==o&&i.splice(o,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}(),ZD=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new JD({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,s=r.length;i<s;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n,r,i,s,o=t.length,a=t.location;return"smart"===a?function(e,t,n){var r,i;null==n?(n="&hellip;",i=3,r=8):(i=n.length,r=n.length);var s=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},o=function(e,t){var r=t/2,i=Math.ceil(r),s=-1*Math.floor(r),o="";return s<0&&(o=e.substr(s)),e.substr(0,i)+n+o};if(e.length<=t)return e;var a,u,l,c=t-i,h=(a={},(l=(u=e).match(/^([a-z]+):\/\//i))&&(a.scheme=l[1],u=u.substr(l[0].length)),(l=u.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(a.host=l[1],u=u.substr(l[0].length)),(l=u.match(/^\/(.*?)(?=(\?|#|$))/i))&&(a.path=l[1],u=u.substr(l[0].length)),(l=u.match(/^\?(.*?)(?=(#|$))/i))&&(a.query=l[1],u=u.substr(l[0].length)),(l=u.match(/^#(.*?)$/i))&&(a.fragment=l[1]),a);if(h.query){var d=h.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);d&&(h.query=h.query.substr(0,d[1].length),e=s(h))}if(e.length<=t)return e;if(h.host&&(h.host=h.host.replace(/^www\./,""),e=s(h)),e.length<=t)return e;var p="";if(h.host&&(p+=h.host),p.length>=c)return h.host.length==t?(h.host.substr(0,t-i)+n).substr(0,c+r):o(p,c).substr(0,c+r);var f="";if(h.path&&(f+="/"+h.path),h.query&&(f+="?"+h.query),f){if((p+f).length>=c)return(p+f).length==t?(p+f).substr(0,t):(p+o(f,c-p.length)).substr(0,c+r);p+=f}if(h.fragment){var m="#"+h.fragment;if((p+m).length>=c)return(p+m).length==t?(p+m).substr(0,t):(p+o(m,c-p.length)).substr(0,c+r);p+=m}if(h.scheme&&h.host){var E=h.scheme+"://";if((p+E).length<c)return(E+p).substr(0,t)}if(p.length<=t)return p;var g="";return c>0&&(g=p.substr(-1*Math.floor(c/2))),(p.substr(0,Math.ceil(c/2))+n+g).substr(0,c+r)}(e,o):"middle"===a?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="&hellip;",r=8,i=3):(r=n.length,i=n.length);var s=t-i,o="";return s>0&&(o=e.substr(-1*Math.floor(s/2))),(e.substr(0,Math.ceil(s/2))+n+o).substr(0,s+r)}(e,o):(r=o,i=void 0,(n=e).length>r&&(null==i?(i="&hellip;",s=3):s=i.length,n=n.substring(0,r-s)+i),n)},e}(),QD=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),ev=function(e,t){return(ev=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function tv(e,t){function n(){this.constructor=e}ev(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var nv,rv=function(){return rv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},rv.apply(this,arguments)},iv=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return tv(t,e),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}(QD),sv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return tv(t,e),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,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(QD),ov=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return tv(t,e),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 t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(QD),av=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return tv(t,e),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}(QD),uv=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return tv(t,e),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 t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}},t}(QD),lv=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},cv=/[A-Za-z]/,hv=/[\d]/,dv=/[\D]/,pv=/\s/,fv=/['"]/,mv=/[\x00-\x1F\x7F]/,Ev=/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,gv=Ev+/\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,Av=/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,_v=gv+Av,Dv=gv+Av,vv="(?:["+Av+"]{1,3}\\.){3}["+Av+"]{1,3}",Tv="["+Dv+"](?:["+Dv+"\\-]{0,61}["+Dv+"])?",Ov=function(e){return"(?=("+Tv+"))\\"+e},Sv=function(e){return"(?:"+Ov(e)+"(?:\\."+Ov(e+1)+"){0,126}|"+vv+")"},Cv=new RegExp("["+Dv+"]"),yv=/(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,Nv=new RegExp("["+Dv+"!#$%&'*+/=?^_`{|}~-]"),Iv=new RegExp("^"+yv.source+"$"),bv=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=Nv,t.strictTldRegex=Iv,t}return tv(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],s=e.length,o=new Rv,a={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},u=0,l=0,c=o;u<s;){var h=e.charAt(u);switch(l){case 0:"m"===(d=h)?D(1):n.test(d)&&D();break;case 1:p(e.charAt(u-1),h);break;case 2:f(h);break;case 3:m(h);break;case 4:E(h);break;case 5:g(h);break;case 6:A(h);break;case 7:_(h);break;default:qD(l)}u++}var d;return T(),i;function p(e,t){":"===e?n.test(t)?(l=2,c=new Rv(rv(rv({},c),{hasMailtoPrefix:!0}))):v():a[e]===t||(n.test(t)?l=2:"."===t?l=3:"@"===t?l=4:v())}function f(e){"."===e?l=3:"@"===e?l=4:n.test(e)||v()}function m(e){"."===e||"@"===e?v():n.test(e)?l=2:v()}function E(e){Cv.test(e)?l=5:v()}function g(e){"."===e?l=7:"-"===e?l=6:Cv.test(e)||T()}function A(e){"-"===e||"."===e?T():Cv.test(e)?l=5:T()}function _(e){"."===e||"-"===e?T():Cv.test(e)?(l=5,c=new Rv(rv(rv({},c),{hasDomainDot:!0}))):T()}function D(e){void 0===e&&(e=2),l=e,c=new Rv({idx:u})}function v(){l=0,c=o}function T(){if(c.hasDomainDot){var n=e.slice(c.idx,u);/[-.]$/.test(n)&&(n=n.slice(0,-1));var s=c.hasMailtoPrefix?n.slice(7):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(s)&&i.push(new iv({tagBuilder:t,matchedText:n,offset:c.idx,email:s}))}v()}},t}(lv),Rv=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},wv=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t||this.hasFullProtocolRegex.test(t)||this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+Ev+"]"),e.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]*)?\/?$/,e}(),kv=(nv=new RegExp("[/?#](?:["+Dv+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Dv+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Sv(2),")","|","(","(//)?",/(?:www\.)/.source,Sv(6),")","|","(","(//)?",Sv(10)+"\\.",yv.source,"(?![-"+_v+"])",")",")","(?::[0-9]+)?","(?:"+nv.source+")?"].join(""),"gi")),Lv=new RegExp("["+Dv+"]"),Mv=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=kv,n.wordCharRegExp=Lv,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,s=this.decodePercentEncoding,o=this.tagBuilder,a=[],u=function(){var n=t[0],u=t[1],c=t[4],h=t[5],d=t[9],p=t.index,f=h||d,m=e.charAt(p-1);if(!wv.isValid(n,u))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),l.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var E=l.matchHasInvalidCharAfterTld(n,u);E>-1&&(n=n.substr(0,E))}var g=["http://","https://"].find((function(e){return!!u&&-1!==u.indexOf(e)}));if(g){var A=n.indexOf(g);n=n.substr(A),u=u.substr(A),p+=A}var _=u?"scheme":c?"www":"tld",D=!!u;a.push(new uv({tagBuilder:o,matchedText:n,offset:p,urlMatchType:_,url:n,protocolUrlMatch:D,protocolRelativeMatch:!!f,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:s}))},l=this;null!==(t=n.exec(e));)u();return a},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,s=e.length-1;i<s;i++){var o=e.charAt(i);o===t?r++:o===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+Dv+"]*[-"+Dv+"]\\.[-"+Dv+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(lv),Fv=new RegExp("#[_"+Dv+"]{1,139}(?![_"+Dv+"])","g"),xv=new RegExp("[^"+Dv+"]"),Bv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Fv,n.nonWordCharRegex=xv,n.serviceName=t.serviceName,n}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,s=this.tagBuilder,o=[];null!==(t=n.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||r.test(u)){var l=t[0],c=t[0].slice(1);o.push(new sv({tagBuilder:s,matchedText:l,offset:a,serviceName:i,hashtag:c}))}}return o},t}(lv),Pv=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"),Uv=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=Pv,t}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var s=t[0],o=s.replace(/[^0-9,;#]/g,""),a=!(!t[1]&&!t[2]),u=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+s.length,1),c=!u.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(s)&&c&&i.push(new av({tagBuilder:r,matchedText:s,offset:t.index,number:o,plusSign:a}))}return i},t.prototype.testMatch=function(e){return dv.test(e)},t}(lv),Hv=new RegExp("@[_"+Dv+"]{1,50}(?![_"+Dv+"])","g"),$v=new RegExp("@[_."+Dv+"]{1,30}(?![_"+Dv+"])","g"),jv=new RegExp("@[-_."+Dv+"]{1,50}(?![-_"+Dv+"])","g"),Yv=new RegExp("[^"+Dv+"]"),zv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:Hv,instagram:$v,soundcloud:jv},n.nonWordCharRegex=Yv,n.serviceName=t.serviceName,n}return tv(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,s=this.tagBuilder,o=[];if(!r)return o;for(;null!==(t=r.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||i.test(u)){var l=t[0].replace(/\.+$/g,""),c=l.slice(1);o.push(new ov({tagBuilder:s,matchedText:l,offset:a,serviceName:n,mention:c}))}}return o},t}(lv),Vv=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Gv=function(){function e(t){void 0===t&&(t={}),this.version=e.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="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&"twitter"!==n&&"instagram"!==n&&"soundcloud"!==n)throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(!1!==r&&"twitter"!==r&&"facebook"!==r&&"instagram"!==r)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 e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return function(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,s=t.onText,o=t.onComment,a=t.onDoctype,u=new Vv,l=0,c=e.length,h=0,d=0,p=u;l<c;){var f=e.charAt(l);switch(h){case 0:"<"===f&&F();break;case 1:m(f);break;case 2:g(f);break;case 3:E(f);break;case 4:A(f);break;case 5:_(f);break;case 6:D(f);break;case 7:v(f);break;case 8:T(f);break;case 9:O(f);break;case 10:S(f);break;case 11:C(f);break;case 12:y(f);break;case 13:"--"===e.substr(l,2)?(l+=2,p=new Vv(rv(rv({},p),{type:"comment"})),h=14):"DOCTYPE"===e.substr(l,7).toUpperCase()?(l+=7,p=new Vv(rv(rv({},p),{type:"doctype"})),h=20):M();break;case 14:N(f);break;case 15:I(f);break;case 16:b(f);break;case 17:R(f);break;case 18:w(f);break;case 19:k(f);break;case 20:L(f);break;default:qD(h)}l++}function m(e){"!"===e?h=13:"/"===e?(h=2,p=new Vv(rv(rv({},p),{isClosing:!0}))):"<"===e?F():cv.test(e)?(h=3,p=new Vv(rv(rv({},p),{isOpening:!0}))):(h=0,p=u)}function E(e){pv.test(e)?(p=new Vv(rv(rv({},p),{name:B()})),h=4):"<"===e?F():"/"===e?(p=new Vv(rv(rv({},p),{name:B()})),h=12):">"===e?(p=new Vv(rv(rv({},p),{name:B()})),x()):cv.test(e)||hv.test(e)||":"===e||M()}function g(e){">"===e?M():cv.test(e)?h=3:M()}function A(e){pv.test(e)||("/"===e?h=12:">"===e?x():"<"===e?F():"="===e||fv.test(e)||mv.test(e)?M():h=5)}function _(e){pv.test(e)?h=6:"/"===e?h=12:"="===e?h=7:">"===e?x():"<"===e?F():fv.test(e)&&M()}function D(e){pv.test(e)||("/"===e?h=12:"="===e?h=7:">"===e?x():"<"===e?F():fv.test(e)?M():h=5)}function v(e){pv.test(e)||('"'===e?h=8:"'"===e?h=9:/[>=`]/.test(e)?M():"<"===e?F():h=10)}function T(e){'"'===e&&(h=11)}function O(e){"'"===e&&(h=11)}function S(e){pv.test(e)?h=4:">"===e?x():"<"===e&&F()}function C(e){pv.test(e)?h=4:"/"===e?h=12:">"===e?x():"<"===e?F():(h=4,l--)}function y(e){">"===e?(p=new Vv(rv(rv({},p),{isClosing:!0})),x()):h=4}function N(e){"-"===e?h=15:">"===e?M():h=16}function I(e){"-"===e?h=18:">"===e?M():h=16}function b(e){"-"===e&&(h=17)}function R(e){h="-"===e?18:16}function w(e){">"===e?x():"!"===e?h=19:"-"===e||(h=16)}function k(e){"-"===e?h=17:">"===e?x():h=16}function L(e){">"===e?x():"<"===e&&F()}function M(){h=0,p=u}function F(){h=1,p=new Vv({idx:l})}function x(){var t=e.slice(d,p.idx);t&&s(t,d),"comment"===p.type?o(p.idx):"doctype"===p.type?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),M(),d=l+1}function B(){var t=p.idx+(p.isClosing?2:1);return e.slice(t,l).toLowerCase()}d<l&&(n=e.slice(d,l),s(n,d),d=l+1)}(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var s=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),o=n;s.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,o);i.push.apply(i,r)}o+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,s=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>i?t:t+1;e.splice(o,1);continue}e[t+1].getOffset()<s&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||KD(e,(function(e){return"hashtag"===e.getType()})),this.email||KD(e,(function(e){return"email"===e.getType()})),this.phone||KD(e,(function(e){return"phone"===e.getType()})),this.mention||KD(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||KD(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||KD(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||KD(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,s=n.length;i<s;i++){for(var o=n[i].parseMatches(e),a=0,u=o.length;a<u;a++)o[a].setOffset(t+o[a].getOffset());r.push.apply(r,o)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var t=this.parse(e),n=[],r=0,i=0,s=t.length;i<s;i++){var o=t[i];n.push(e.substring(r,o.getOffset())),n.push(this.createMatchReturnVal(o)),r=o.getOffset()+o.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof JD?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Bv({tagBuilder:e,serviceName:this.hashtag}),new bv({tagBuilder:e}),new Uv({tagBuilder:e}),new zv({tagBuilder:e,serviceName:this.mention}),new Mv({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new ZD({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=ZD,e.HtmlTag=JD,e.matcher={Email:bv,Hashtag:Bv,Matcher:lv,Mention:zv,Phone:Uv,Url:Mv},e.match={Email:iv,Hashtag:sv,Match:QD,Mention:ov,Phone:av,Url:uv},e}();function Wv(e,t=e){return{type:"autolink",url:e,text:t}}const Xv=UD(/<!!mention:([^>\s]*?)\|(.*?)>/gm,(([e,t,n])=>function(e,t){return{type:"mention",id:e,text:t}}(decodeURIComponent(t),n))),Kv=UD(/<!!customemoji:(.*?)>/gm,(([e,t])=>function(e){return{type:"customemoji",text:e}}(t))),qv=UD(/<((?:https?|mailto):.*?)\|(.*?)>/gi,(([e,t,n])=>function(e,t=[]){return{type:"link",url:e,children:t}}(t,[n]))),Jv=UD(/<actionlink:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Qv(t);return function(e,t,n=[]){return{type:"actionlink",action:e,params:t,children:n}}(r,i,[n])})),Zv=UD(/<actionbutton:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Qv(t);return function(e,t,n=[]){return{type:"actionbutton",action:e,params:t,children:n}}(r,i,[n])}));function Qv(e){const t=e.indexOf("?");return-1===t?{action:e,params:{}}:{action:e.slice(0,t),params:Object.fromEntries(new URLSearchParams(e.slice(t)))}}const eT=UD(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,(([e])=>function(e=[]){return{type:"bulletlist",children:e}}([e.startsWith("\n")?e.slice(1):e]))),tT=UD(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,(([e,t])=>({type:"bulletpoint",children:[t]}))),nT=e=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let n=0;const r=[];for(const i of tD(e,t)){const t=i[0],s=i[1],o=t.startsWith(s)?i.index:i.index+1;o-n>0&&r.push(e.substring(n,o));const a=Wv("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(a),n=o+s.length}return n<e.length&&r.push(e.substring(n)),r},rT=e=>qv(e).flatMap((e=>"string"==typeof e?iT(e):["<",...iT(e.url),...iT("|"+e.children[0]+">")])),iT=e=>{const t=Gv.parse(e,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),n=[];let r=0;for(const i of t){const t=i.getOffset(),s=i.getMatchedText(),o=s.length;let a=s;i instanceof iv?a="mailto:"+i.getEmail():i instanceof uv&&(a=i.getUrl()),t>r&&n.push(e.substring(r,t)),n.push(Wv(a,s)),r=t+o}return r<e.length&&n.push(e.substring(r)),n},sT=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"],oT=function(){const e=RegExp("[^\n]+\n?|\n","g");return t=>Array.from(t.match(e)||[])}();function aT(e,t={except:[]}){let n=function(e,t){let n=[e];return n=uT(n,t.multilineSteps),n=uT(n,[oT]),n=uT(n,t.singlelineSteps),n=lT(n),n}(e,function(e={except:[]}){var t;const n={multilineSteps:[],singlelineSteps:[]},r=null!=(t=e.except)?t:sT.filter((t=>!e.only.includes(t)));return r.includes("BulletPoint")||n.multilineSteps.push(eT,tT),r.includes("Mention")||n.singlelineSteps.push(Xv),r.includes("CustomEmoji")||n.singlelineSteps.push(Kv),r.includes("Codespan")||n.multilineSteps.push(UD(/```([^]+?)```/g,(([e,t])=>({type:"codespan",text:t})))),r.includes("FormattedLink")||n.singlelineSteps.push(qv),r.includes("Actions")||(n.singlelineSteps.push(Jv),n.singlelineSteps.push(Zv)),r.includes("Wikitext")||n.singlelineSteps.push(VD),r.includes("Autolink")||n.singlelineSteps.push(rT,nT),n}(t));return n=cT(n,!1),n}function uT(e,t){return t.reduce(((e,t)=>PD(e,t)),e)}function lT(e){const t=[];let n=-1;for(const r of e)"string"==typeof r?"string"==typeof t[n]?t[n]+=r:t[++n]=r:t[++n]="children"in r?a_(o_({},r),{children:lT(r.children)}):r;return t}function cT(e,t){const n=[];let r=[];for(let i=0;i<e.length;i++){const s=e[i];"string"==typeof s?r.push(s):"children"in s?(r.length>0&&(n.push(r.join("")),r=[]),s.children=cT(s.children,t||"link"===s.type||"actionbutton"===s.type||"actionlink"===s.type),n.push(s)):"autolink"===s.type&&t?r.push(s.text):(r.length>0&&(n.push(r.join("")),r=[]),n.push(s))}return r.length>0&&(n.push(r.join("")),r=[]),n}class hT{constructor(e,t,n){this.id=e,this.conversationId=t,this._realtimeClient=n}get brandedId(){return this.id}get brandedConversationId(){return this.conversationId}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"messages",this.brandedId],{});if(!e.ok&&"server"===e.where&&404===e.value.status)return null;if(!e.ok&&"server"===e.where&&403===e.value.status&&"NOT_A_PARTICIPANT"===e.value.errorCode)return null;const t=c_("Get message "+this.id,e),n=yield this._realtimeClient.createMessageSnapshot(t,this.brandedConversationId);return MD("Get message "+this.id,n)}))}edit(e){return l_(this,null,(function*(){const t={content:dT(e),custom:"string"==typeof e?void 0:e.custom},n=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"messages",this.brandedId],t);c_(`Edit message ${this.id} in conversation ${this.conversationId}`,n)}))}delete(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedId],{});(e.ok||"server"!==e.where||404!==e.value.status)&&c_(`Delete message ${this.id} in conversation ${this.conversationId}`,e)}))}}function dT(e){return"string"==typeof e?[{type:"text",children:aT(e)}]:"text"in e&&e.text?[{type:"text",children:aT(e.text)}]:"content"in e&&e.content?e.content:void 0}class pT{constructor(e,t){this.id=e,this._realtimeClient=t,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(e){return new xD("string"==typeof e?e:e.id,this.id,this._realtimeClient)}message(e){return new hT(e,this.brandedId,this._realtimeClient)}get(){return l_(this,null,(function*(){const e=this._realtimeClient.listMessages(this.brandedId,{limit:1}),t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedId],{});if(!t.ok&&"server"===t.where&&404===t.value.status)return null;const n=c_("Get conversation "+this.id,t),r=MD("Get last message in conversation "+this.id,yield e),i=0===r.length?null:r[0];return this._realtimeClient.createConversationSnapshotPreloaded(n,i)}))}set(e){return l_(this,null,(function*(){const t=this._realtimeClient.call("PUT",["conversations",this.brandedId],e),n=this._realtimeClient.call("PUT",["conversations",this.brandedId,"participants",this.brandedUserId],e),r=yield t;!r.ok&&"server"===r.where&&403===r.value.status&&"UNAUTHORIZED_TO_EDIT"===r.value.errorCode&&function(e){return void 0===e.subject&&void 0===e.photoUrl&&void 0===e.welcomeMessages&&null!==e.custom&&(void 0===e.custom||!Object.values(e.custom).some((e=>void 0!==e)))}(e)||c_("Set conversation "+this.id,r);const i=yield n;!i.ok&&"server"===i.where&&403===i.value.status&&"UNAUTHORIZED_TO_EDIT_PARTICIPANT"===i.value.errorCode&&function(e){return void 0===e.access&&void 0===e.notify}(e)||c_("Set your participation in conversation "+this.id,i)}))}createIfNotExists(){return l_(this,arguments,(function*(e={}){const t=this._realtimeClient.call("POST",["conversations",this.brandedId],e),n=this._realtimeClient.call("POST",["conversations",this.brandedId,"participants",this.brandedUserId],e),r=yield t;(r.ok||"server"!==r.where||409!==r.value.status)&&c_("Create conversation "+this.id,yield t);const i=yield n;(i.ok||"server"!==i.where||409!==i.value.status)&&c_("Join conversation "+this.id,yield n)}))}markAsRead(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"read"],{});c_(`Mark ${this.id} as read`,e)}))}markAsUnread(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"unread"],{});c_(`Mark ${this.id} as unread`,e)}))}send(e){return l_(this,null,(function*(){const t={content:fT(e),referencedMessageId:mT(e),custom:"string"==typeof e?void 0:e.custom,idempotencyKey:BD((new Date).getTime())},n=yield this._realtimeClient.call("POST",["conversations",this.brandedId,"messages"],t),r=c_("Send message to conversation "+this.id,n);return new hT(r.id,this.brandedId,this._realtimeClient)}))}subscribeMessages(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"messages"],e)}subscribeParticipants(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"participants"],e)}subscribe(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId],e)}subscribeTyping(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"typing"],e)}markAsTyping(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"typing"],{});c_(`Set user as typing in ${this.id}`,e)}))}}function fT(e){return"string"==typeof e?[{type:"text",children:aT(e)}]:"text"in e?[{type:"text",children:aT(e.text)}]:e.content}function mT(e){if("string"==typeof e)return;const t=e.referencedMessage;return void 0!==t?"string"==typeof t?t:t.id:void 0}class ET{constructor(e,t,n){this.realtimeWsApiUrl=e,this.internalHttpApiUrl=t,this.restApiHttpUrl=n}getBokensUrl(e,t,n){return this.internalHttpApiUrl+`/${e}/bokens/${encodeURIComponent(t)}?signature=${encodeURIComponent(null!=n?n:"")}`}getRealtimeWsUrl(e,t,n,r,i){const s=encodeURIComponent(t);return this.realtimeWsApiUrl+`/${e}/realtime/${s}?talkjs-client-build=${null!=i?i:"standalone"}&talkjs-core=${n}&talkjs-client-id=${r}`}static fromHost(e){const t=new ET("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!e)return t;if(e.endsWith("talkjs.com")){const n=e.match(/\w+-(\w+)\.talkjs\.com/);if(n){const e=n[1];return new ET(`wss://realtime-${e}.talkjs.com/v1`,`https://app-${e}.talkjs.com/api/v0`,`https://api-${e}.talkjs.com/v1`)}return t}return e.includes("localhost")||e.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e)?new ET(`ws://${e}/public_api/v1`,`http://${e}/api/v0`,`http://${e}/public_api/v1`):new ET(`wss://${e}/public_api/v1`,`https://${e}/api/v0`,`https://${e}/public_api/v1`)}}function gT({method:e,url:t,data:n,options:r,attempts:i,shouldRetry:s,authProvider:o}){var a;(!i||i<=0)&&(i=1);const u={"x-talkjs-client-build":"jssdk-dev","x-talkjs-client-date":"2025-07-28T07:10:12.745Z"};return n instanceof FormData||(u["Content-Type"]=null!=(a=null==r?void 0:r.contentType)?a:"application/json"),E_(i,(()=>l_(this,null,(function*(){if(o){const e=yield o.getToken();u.Authorization=`Bearer ${e}`}return fetch(t,{method:e,headers:u,body:n}).then((e=>{if(e.ok)return e;throw e}))}))),{initialDelay:.2,log:void 0,shouldRetry:n=>l_(this,null,(function*(){return o&&401===n.status?(CT.log(`401 error from ${e} ${t}, ${yield o.getToken()}`),o.refreshToken(),!0):s?s(n):!("status"in n&&n.status>=400&&n.status<500)}))}).catch((n=>{if(Math.random()<.1&&!t.toString().startsWith("https://capture.trackjs.com")){const r=`Network Error for ${e} ${t}`;"undefined"!=typeof window&&(n instanceof Response?n.clone().text().then((e=>CT.log(`${r} ${n.status} ${e} (10% logged)`))):CT.log(`${r} ${n} (10% logged)`)),console.error("[TalkJS]",r)}throw n}))}const{cdnHost:AT,appHost:_T,restHost:DT,realtimeHost:vT,appProtocol:TT,appWsProtocol:OT}=function(){if("undefined"==typeof window)return{cdnHost:"test-hostname",appHost:"test-hostname",appProtocol:"http:",appWsProtocol:"ws:"};const e=function(){if(document.currentScript)return document.currentScript.src;try{throw new Error}catch(e){const n=e.stack.match(/https?:\/\/.*\.(js|jsx|ts|tsx)/);return n?n[0]:""}}(),t=document.createElement("a");t.href=e;const n=t.host,r=(a=n).match(/^cdn[.-]/)?a.replace(/^cdn/,"app"):"talkjs.com"===a?"app.talkjs.com":a,i=function(e){return e.match(/^app[.-]/)?e.replace(/^app/,"api"):e+"/public_api"}(r),s=function(e){return e.match(/^app[.-]/)?e.replace(/^app/,"realtime"):e+"/public_api"}(r),o=t.protocol;var a;return{cdnHost:n,appHost:r,restHost:i,realtimeHost:s,appProtocol:o,appWsProtocol:"https:"===o?"wss:":"ws:"}}(),ST=_T.startsWith("app.talkjs.com"),CT="undefined"==typeof window?{log:e=>Promise.resolve(),setData:e=>{}}:new class{constructor(e){this._timeCreated=Date.now(),this._enabled=ST,this._trackJSData={customer:{application:"",correlationId:"",sessionId:"",token:"",userId:"",version:"dev-2025-07-28T07:10:12.745Z"},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-07-28T07:10:12.745Z",throttled:0},this._url=`https://capture.trackjs.com/capture?token=${e}`,this._trackJSData.customer.token=e}setData({appId:e,meId:t,sessionId:n}){this._trackJSData.customer.userId=e,this._trackJSData.customer.sessionId=`${e}/${t}`,this._trackJSData.customer.correlationId=n}log(e){return l_(this,null,(function*(){try{if(!this._enabled)return Promise.resolve();const t=a_(o_({},this._trackJSData),{message:e});yield gT({method:"POST",url:this._url,data:JSON.stringify(t),options:{contentType:"text/plain"}})}catch(e){console.error("[TalkJS] Failed when sending an error report. Error: ",e)}}))}}("970cd0be0fb74630b75c8451051299dc");class yT{constructor(e,t={}){this._onSubscription=t,this._handlers={};for(const n in e)Object.hasOwnProperty.call(e,n)&&(this._handlers[n]=[])}emit(e,t){for(const n of this._handlers[e])try{n(t)}catch(t){console.error(`[TalkJS] '${String(e)}' handler threw an error:`,t)}}emitAsync(e,t){return l_(this,null,(function*(){try{const n=this._handlers[e].map((e=>e(t)));yield Promise.all(n)}catch(t){console.error(`[TalkJS] '${String(e)}' handler threw an error:`,t)}}))}supports(e){return e in this._handlers}on(e,t){var n,r;if(!this.supports(e))throw new Error(`Unknown event type '${String(e)}'`);null==(r=(n=this._onSubscription)[e])||r.call(n),this._handlers[e].push(t)}off(e,t){if(!Object.hasOwnProperty.call(this._handlers,e))throw new Error(`Unknown event type '${String(e)}'`);const n=this._handlers[e].indexOf(t);-1!==n&&this._handlers[e].splice(n,1)}removeAllListeners(){for(const e in this._handlers)this._handlers[e]=[]}handles(e){return this._handlers[e].length>0}subscribe(e,t){return this.on(e,t),{unsubscribe:()=>this.off(e,t)}}}class NT{constructor(e,t,n,r,i,s){if(this.appId=t,this.userId=n,this.tokenFetcher=i,this.usingBokens=!1,this.requestInProgress=!1,this.eventEmitter=new yT({tokenChanged(e){},tokenRefreshFailed(e){},tokenAccepted(e){}}),this.sessionExpiryWarningTimeoutId=void 0,s&&(r||i))throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");r?this.fetchToken((()=>r)):(i||(this.usingBokens=!0,this.tokenFetcher=()=>this.sendBokenRequest(e,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(e){return this.eventEmitter.on("tokenChanged",e),()=>{this.eventEmitter.off("tokenChanged",e)}}emitTokenChanged(e){this.eventEmitter.emit("tokenChanged",e)}onTokenRefreshFailed(e){return this.eventEmitter.on("tokenRefreshFailed",e),()=>{this.eventEmitter.off("tokenRefreshFailed",e)}}emitTokenRefreshFailed(e){this.eventEmitter.emit("tokenRefreshFailed",e),console.error(`[TalkJS] Could not authenticate, cannot recover automatically: ${e}`)}onTokenAccepted(e){return this.eventEmitter.on("tokenAccepted",e),()=>{this.eventEmitter.off("tokenAccepted",e)}}emitTokenAccepted(e){this.eventEmitter.emit("tokenAccepted",e)}clearScheduledRefresh(){this.sessionExpiryWarningTimeoutId&&clearTimeout(this.sessionExpiryWarningTimeoutId)}scheduleRefresh(e){if(this.clearScheduledRefresh(),null===e)return;const t=void 0!==this.tokenFetcher;if(e<120&&!t?console.warn(`[TalkJS] TalkJS will stop working in ${e} seconds due to auth token expiry. Token expires in ${e} 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.`):e<120&&t?console.warn(`[TalkJS] TalkJS auth token will expire and need to be refreshed in ${e} seconds. Refreshable JWTs are recommended to expire at least 30 minutes in the future, to improve performance and reduce unnecessary refreshes.`):e<3300&&!t&&console.warn(`[TalkJS debug] TalkJS will stop working in ${Math.round(e/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.`),void 0!==this.tokenFetcher){const t=e>600?e-300:e/2,n=Math.min(1728e6,1e3*t);this.sessionExpiryWarningTimeoutId=setTimeout((()=>{this.refreshToken()}),n)}else e<2e6&&(this.sessionExpiryWarningTimeoutId=setTimeout((()=>{this.emitTokenRefreshFailed("Token has expired and no `tokenFetcher` was provided when creating the session, so it cannot be refreshed.")}),1e3*e))}fetchToken(e){return l_(this,null,(function*(){if(this.requestInProgress)return;this.requestInProgress=!0;const t=()=>l_(this,null,(function*(){const t=yield e();return this.checkJwt(t),t}));try{const e=void 0!==this.token;this.token=t(),yield this.token.then((t=>{e&&this.emitTokenChanged(t)})).catch((e=>{this.emitTokenRefreshFailed(e)}))}catch(e){this.emitTokenRefreshFailed(e)}finally{this.requestInProgress=!1}}))}checkJwt(e){!function(e){if(!("string"==typeof e||e instanceof String)){if(void 0===e)throw"Token was undefined";throw"Token must be a string, got: "+e}}(e);const t=[];let n,r,i;if("string"==typeof e?n=e:t.push(`Token type is ${typeof e} instead of a string.`),n)try{const e=function(e){const t=e.split(".");if(3!==t.length)throw"Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";return{header:IT(t[0]),payload:IT(t[1])}}(n);r=e.header,i=e.payload}catch(e){t.push(e)}if(r){const e=this.checkJwtHeader(r);t.push(...e)}if(i){const e=this.checkJwtPayload(i);t.push(...e)}if(t.length)if(this.usingBokens)CT.log(`JWT Errors detected by AuthProvider when using bokens: ${t.join("\n")}`);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 n=t.length>1;t.forEach(((e,t)=>{const r=n?`Reason ${t+1}:`:"Reason:";console.warn(`[TalkJS] ${r} ${e}`)})),console.warn(`[TalkJS]: Authentication token: "${e}"`)}}checkJwtHeader(e){const t=[],n=e.alg;return void 0===n?t.push('Token header must contain `"alg": "HS256"`, but no `alg` was specified.'):"string"!=typeof n?t.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was ${typeof n} instead of a string. Make sure you wrap the value in "".`):"HS256"!==n&&t.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was set to "${n}" instead. HS256 is the only supported algorithm.`),t}checkJwtPayload(e){const t=[],n=e.iss;void 0===n?t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was missing.`):"string"!=typeof n?t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was ${typeof n} instead of a string. Make sure you wrap the value in "".`):n!==this.appId&&t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was set to "${n}" instead.`);const r=e.sub;void 0===r?t.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`):"string"!=typeof r?t.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!==this.userId&&t.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${r}" instead.`);const i=e.tokenType;void 0===i?t.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.'):"string"!=typeof i?t.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof i} instead of a string. Make sure you wrap the value in "".`):"user"!==i&&t.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${i}" instead.`);const s=e.exp;void 0===s||("number"!=typeof s?t.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof i} 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?t.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?t.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&&t.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 o=e.nbf;return void 0===o||("number"!=typeof o?t.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof i} 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.`):o>1e11&&t.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${o}, representing ${new Date(1e3*o).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.`)),t}sendBokenRequest(e,t){return l_(this,null,(function*(){let n=0;const r=e.getBokensUrl(this.appId,this.userId,t),i=yield gT({method:"GET",url:r,attempts:1e4,shouldRetry:e=>{if(e instanceof Error)return!0;if(401===e.status)throw"Check that you provided a valid signature.";if(404===e.status)throw"Check that you specified the correct App ID.";if(429===e.status||502===e.status)return!0;if(e.status>=400&&e.status<500)throw`Unexpected HTTP ${e.status} response when fetching auth token. Check that you configured the session correctly.`;if(n++,n>=5)throw`Unexpected HTTP ${e.status} response when fetching auth token, retrying did not help.`;return!0}});return(yield i.json()).boken}))}}function IT(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}catch(t){throw`Could not base64-decode and JSON-parse token section: ${e}. Check that you base-64 encoded the section correctly.`}}class bT{constructor(e){this.target=e}deref(){return this.target}}const RT=new class{constructor(){this.registry={}}getOrCreate(e){var t;const n=this.key(e),r=null==(t=this.registry[n])?void 0:t.deref();if(r)return r;const i=new wT(e),s=globalThis.WeakRef?new WeakRef(i):new bT(i);return this.registry[n]=s,i}deregister(e,t){const n=this.key({appId:e,userId:t});delete this.registry[n]}key({appId:e,userId:t}){return`${e}:${t}`}};class wT{constructor(e){!function(e){function t(e,t){if(!e)throw new Error("[TalkJS] TalkSession: "+t)}t(e&&"object"==typeof e,"Expected an object argument in TalkSession#constructor."),t(e.appId&&"string"==typeof e.appId,"The `appId` property of TalkSession#constructor is required and it must be a non-empty string."),t("string"==typeof e.userId,"The `userId` property of TalkSession#constructor is required and it must be a string."),void 0!==e.token&&t(e.token&&"string"==typeof e.token,"The `token` property of TalkSession#constructor must be a non-empty string."),void 0!==e.tokenFetcher&&t("function"==typeof e.tokenFetcher,"The `tokenFetcher` property of TalkSession#constructor must be a function.")}(e);const{appId:t,userId:n,token:r,tokenFetcher:i,signature:s}=e;this._appId=t,this._apiUrls=e.apiUrls?new ET(e.apiUrls.realtimeWsApiUrl,e.apiUrls.internalHttpApiUrl,e.apiUrls.restApiHttpUrl):ET.fromHost(e.host),this._authProvider=new NT(this._apiUrls,t,n,r,i,s);const o=Math.random().toString().split(".")[1];this._realtimeClient=new kD(this._apiUrls.getRealtimeWsUrl(t,n,"1.4.1",o,e.clientBuild),n,this._authProvider),this.currentUser=new FD(this._realtimeClient.userId,this._realtimeClient),this._terminationReason=g_(),this._terminationReason.promise.then((e=>{console.error(`[TalkSession] ${e}`)})),function(e,t,n){return l_(this,null,(function*(){return gT({method:"GET",url:`${t}/${e}/app`,authProvider:n}).then((e=>200===e.status||404!==e.status&&(console.warn(`[TalkJS] Received unexpected ${e.status} status code when validating app ID. Assuming that the app ID is valid.`),!0))).catch((e=>{if("string"!=typeof e&&"status"in e){const t=e;return 200===t.status||404!==t.status&&(console.warn(`[TalkJS] Received unexpected ${t.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((e=>{e||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((e=>{this.terminate(new Error(`Could not authenticate, cannot recover automatically: ${e}`))}))}onError(e){const t=g_();return Promise.race([t.promise,this._terminationReason.promise]).then((t=>{"UNSUBSCRIBED"!==t&&e(t)})),{unsubscribe:()=>t.resolve("UNSUBSCRIBED")}}user(e){return new FD(e,this._realtimeClient)}conversation(e){return new pT(e,this._realtimeClient)}subscribeConversations(e){return this._realtimeClient.subscribe(["me","conversations"],e)}terminate(e){RT.deregister(this._appId,this.currentUser.id),this._terminationReason.resolve(e),this._realtimeClient.destroy()}_isConnected(){return this._realtimeClient.isConnected()}uploadFile(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,t)}uploadImage(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"image"},t))}uploadVideo(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"video"},t))}uploadAudio(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"audio"},t))}uploadVoice(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"voice"},t))}}function kT(e,t,n,r){return l_(this,arguments,(function*(e,t,n,{subtype:r,filename:i,width:s,height:o,duration:a}){const u=new FormData;return u.set("file",n,i),void 0!==r&&u.set("subtype",r),void 0!==s&&u.set("width",s.toString()),void 0!==o&&u.set("height",o.toString()),void 0!==a&&u.set("duration",a.toString()),gT({method:"POST",url:e,data:u,authProvider:t}).then((e=>e.json())).then((e=>e.attachmentToken)).catch((e=>l_(this,null,(function*(){if(e instanceof Response){const t=yield e.json(),n=`Unexpected response when uploading file, status code ${e.status} ${t.errorCode}, ${t.reasons}`;throw new Error(n)}throw e}))))}))}function LT(e,t,n){return de((r=>{e&&e(r);const i=t.current?.parentElement;"T-CHATBOX"===i?.tagName&&function(e,t,n){for(const r of n){const n=new Event(r);Object.assign(n,t),e.dispatchEvent(n)}}(i,r,n)}),[e,t,n])}!function({observableFunctions:e,observableProperties:t,jsonReplacer:n,jsonReviver:r}){if(e)for(const i in e){const t=e[i];nr.set(i,t),Sr.prototype[i]=function(...e){return t.call(this,this._node,...e)}}if(t)for(const i in t){const e=t[i];tr.set(i,e),Object.defineProperty(Sr.prototype,i,{configurable:!0,get(){return e.get.call(this,this._node)},set(t){return e.set.call(this,this._node,t)}})}n&&(Jt.replacer=n),r&&(Jt.reviver=r)}({observableFunctions:{child:(e,t)=>(si("string"==typeof t||"number"==typeof t,"Key should be a string or a number"),Nr.getProxy(e,t.toString()))}}),Ss.registerHandler((({level:e,data:t})=>{console[e]("[TalkJS]",...t)}));const MT=Fe((function(e,t){const{onSendMessage:n,onDeleteMessage:r,beforeBrowserPermissionPrompt:i,onMissingBrowserPermission:s,messageFieldPlaceholder:o,messageFieldSpellcheck:a}=e;ae((()=>{e.__internalOnLoaded?.()}),[]);const[u,l]=se(!0);ae((()=>{l(!1)}),[]);const c=le(null);!function(e){ae((()=>{if(window.cordova){const t=e.current;si.defined(t);const n=e=>{e.target instanceof HTMLAnchorElement&&(e.preventDefault(),function(e){const t=window;t.cordova.InAppBrowser?t.cordova.InAppBrowser.open(e,"_system"):window.open(e,"_system","location=yes")}(e.target.href))};return t.addEventListener("click",n),()=>t.removeEventListener("click",n)}}),[e])}(c);const h=LT(r,c,["deleteMessage","delete-message","deletemessage","DeleteMessage"]),d=LT(n,c,["sendMessage","send-message","sendmessage","SendMessage"]),p={beforeBrowserPermissionPrompt:i,onMissingBrowserPermissionCallback:LT(s,c,["browserPermissionDenied","browser-permission-denied","browserpermissiondenied","BrowserPermissionDenied"])},{store:f,controller:m,editorInternals:E,session:g}=function(e,t,n){const r=e.appId,i=e.userId,s=e.conversationId,o=he((()=>JA.fromHost(e.host)),[e.host]),a=he((()=>new uo),[e.appId]);ue((()=>{a.state$.themeCustom.set(gn({value:e.themeCustom}))}),[a,e.themeCustom]);const u=he((()=>XA()),[e.appId,e.userId,e.token,e.tokenFetcher]),l=function(e){return e.forceCreateNew?new wT(e):RT.getOrCreate(e)}({apiUrls:o,appId:r,userId:i,token:e.token,tokenFetcher:e.tokenFetcher});ae((()=>{const e=l.onError((e=>{Ss.error(e.message),a.state$.errors.serverError.set(!0)}));return()=>e.unsubscribe()}),[l,a]);const c=he((()=>new zA(o,r,u,l._authProvider)),[r,u,l,o]),h=he((()=>new mm(a.state$.editor)),[a]),d=he((()=>new KA(a,l,h,t,n)),[l,a,h,t,n]);return h.controller=d,ae((()=>{"loading"!==a.state$.authTokenState.peek()&&a.state$.authTokenState.set("loading"),l._authProvider.getToken().then((()=>{a.state$.authTokenState.set("valid")}));const t=l._authProvider.onTokenRefreshFailed((()=>{a.state$.authTokenState.set(e.tokenFetcher?"invalid":"expired")}));return()=>{t()}}),[l,a,e.tokenFetcher]),ae((()=>{let e=!0;a.resetState(r,i,s);let t=null;const n=l.currentUser.subscribe((async n=>{if(e&&(a.state$.errors.unknownUser.set(!n),n&&(a.state$.currentUser.set(n),n.role!==t))){t=n.role;const r=await c.getApp(n.role);if(!e)return;a.state$.app.set(r)}})),o=l.conversation(s).subscribeMessages((async(t,n)=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&(await a.readyForNewMessagesPromise,a.storeMessages(s,t,n)))}));a.messageSubscription=o;const u=l.conversation(s).subscribeParticipants((t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.state$.participants.child(s).set(t))}));a.participantSubscription=u;const h=l.conversation(s).subscribe((async t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.state$.currentConversation.set(t))})),d=l.conversation(s).subscribeTyping((t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.storeTyping(s,t))}));return()=>{e=!1,n.unsubscribe(),u.unsubscribe(),h.unsubscribe(),o.unsubscribe(),d.unsubscribe(),a.messageSubscription=null}}),[s,i,r,c,l,a,d]),ae((()=>d.closeMessageActionMenusOnWindowClick()),[d]),{store:a,controller:d,editorInternals:h,session:l}}(e,d,h),A=de((async()=>{const e=E.state$;if(e.isEmpty.peek()||e.atTextLimit.peek())return;const t=E.getText(),n=f.state$.referencedMessageId.peek();n&&m.setReferencedMessage(null),E.clearText(),await m.sendMessage({text:t,referencedMessageId:n??void 0})}),[m,E,f]);ae((()=>{const t=e.enterSendsMessage??!0;E.onEnter=t?A:void 0}),[E,e.enterSendsMessage,A]),ae((()=>{E.spellcheck$.set(a)}),[E,a]),ae((()=>{E.placeholder$.set(o)}),[E,o]),ce(t,(()=>({deleteMessage:e=>m.deleteMessage(e),editMessage:(e,t)=>m.editMessage(e,t),sendMessage:e=>m.sendMessage(e),sendFileMessage:e=>m.sendFileMessage(e),sendLocationMessage:e=>m.sendLocationMessage(e),setReferencedMessage:e=>m.setReferencedMessage(e),openMessageActionMenu:e=>m.openMessageActionMenu(e),closeMessageActionMenu:()=>m.closeMessageActionMenu(),getMessageFieldText:()=>E.getText(),setMessageFieldText:e=>E.setText(e)})));const _=de((({error:t})=>It(Eo,{appId:e.appId,chatboxState:{type:"unexpected-error",error:t}})),[e.appId]);return It("div",u?{className:"t-chatbox",ref:c}:{className:"t-chatbox",ref:c,children:It(wt,{fallbackRender:_,children:It(ui.Provider,{value:E,children:It(ci.Provider,{value:f,children:It(oi.Provider,{value:e.theme,children:It(di.Provider,{value:p,children:It(FA,{controller:m,appId:e.appId,chatHeaderVisible:e.chatHeaderVisible??!0,messageFieldVisible:e.messageFieldVisible??!0,session:g,sendMessage:A})})})})})})})}));function FT({photoUrl:e,float:t}){return NA`
1
+ var TalkChatbox=function(e){"use strict";var t,n,r,i,s,o,a,u,l,c,h,d,p={},f=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,E=Array.isArray;function g(e,t){for(var n in t)e[n]=t[n];return e}function A(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function _(e,n,r){var i,s,o,a={};for(o in n)"key"==o?i=n[o]:"ref"==o?s=n[o]:a[o]=n[o];if(arguments.length>2&&(a.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)null==a[o]&&(a[o]=e.defaultProps[o]);return D(e,a,i,s,null)}function D(e,t,i,s,o){var a={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++r:o,__i:-1,__u:0};return null==o&&null!=n.vnode&&n.vnode(a),a}function v(){return{current:null}}function T(e){return e.children}function O(e,t){this.props=e,this.context=t}function S(e,t){if(null==t)return e.__?S(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?S(e):null}function C(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return C(e)}}function y(e){(!e.__d&&(e.__d=!0)&&i.push(e)&&!N.__r++||s!=n.debounceRendering)&&((s=n.debounceRendering)||o)(N)}function N(){for(var e,t,r,s,o,u,l,c=1;i.length;)i.length>c&&i.sort(a),e=i.shift(),c=i.length,e.__d&&(r=void 0,o=(s=(t=e).__v).__e,u=[],l=[],t.__P&&((r=g({},s)).__v=s.__v+1,n.vnode&&n.vnode(r),F(t.__P,r,s,t.__n,t.__P.namespaceURI,32&s.__u?[o]:null,u,null==o?S(s):o,!!(32&s.__u),l),r.__v=s.__v,r.__.__k[r.__i]=r,x(u,r,l),r.__e!=o&&C(r)));N.__r=0}function I(e,t,n,r,i,s,o,a,u,l,c){var h,d,m,g,A,_,v=r&&r.__k||f,O=t.length;for(u=function(e,t,n,r,i){var s,o,a,u,l,c=n.length,h=c,d=0;for(e.__k=new Array(i),s=0;s<i;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?(u=s+d,(o=e.__k[s]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?D(null,o,null,null,null):E(o)?D(T,{children:o},null,null,null):null==o.constructor&&o.__b>0?D(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,a=null,-1!=(l=o.__i=w(o,n,u,h))&&(h--,(a=n[l])&&(a.__u|=2)),null==a||null==a.__v?(-1==l&&(i>c?d--:i<c&&d++),"function"!=typeof o.type&&(o.__u|=4)):l!=u&&(l==u-1?d--:l==u+1?d++:(l>u?d--:d++,o.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<c;s++)null!=(a=n[s])&&!(2&a.__u)&&(a.__e==r&&(r=S(a)),U(a,a));return r}(n,t,v,u,O),h=0;h<O;h++)null!=(m=n.__k[h])&&(d=-1==m.__i?p:v[m.__i]||p,m.__i=h,_=F(e,m,d,i,s,o,a,u,l,c),g=m.__e,m.ref&&d.ref!=m.ref&&(d.ref&&P(d.ref,null,m),c.push(m.ref,m.__c||g,m)),null==A&&null!=g&&(A=g),4&m.__u||d.__k===m.__k?u=b(m,u,e):"function"==typeof m.type&&void 0!==_?u=_:g&&(u=g.nextSibling),m.__u&=-7);return n.__e=A,u}function b(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=b(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=S(e)),n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function R(e,t){return t=t||[],null==e||"boolean"==typeof e||(E(e)?e.some((function(e){R(e,t)})):t.push(e)),t}function w(e,t,n,r){var i,s,o=e.key,a=e.type,u=t[n];if(null===u&&null==e.key||u&&o==u.key&&a==u.type&&!(2&u.__u))return n;if(r>(null==u||2&u.__u?0:1))for(i=n-1,s=n+1;i>=0||s<t.length;){if(i>=0){if((u=t[i])&&!(2&u.__u)&&o==u.key&&a==u.type)return i;i--}if(s<t.length){if((u=t[s])&&!(2&u.__u)&&o==u.key&&a==u.type)return s;s++}}return-1}function k(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function L(e,t,n,r,i){var s,o;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||k(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||k(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(u,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=l,e.addEventListener(t,s?h:c,s)):e.removeEventListener(t,s?h:c,s);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function M(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=l++;else if(t.t<r.u)return;return r(n.event?n.event(t):t)}}}function F(e,r,i,s,o,a,u,l,c,h){var d,f,m,_,D,v,C,y,N,b,R,w,k,M,F,x,P,U=r.type;if(null!=r.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[l=r.__e=i.__e]),(d=n.__b)&&d(r);e:if("function"==typeof U)try{if(y=r.props,N="prototype"in U&&U.prototype.render,b=(d=U.contextType)&&s[d.__c],R=d?b?b.props.value:d.__:s,i.__c?C=(f=r.__c=i.__c).__=f.__E:(N?r.__c=f=new U(y,R):(r.__c=f=new O(y,R),f.constructor=U,f.render=H),b&&b.sub(f),f.props=y,f.state||(f.state={}),f.context=R,f.__n=s,m=f.__d=!0,f.__h=[],f._sb=[]),N&&null==f.__s&&(f.__s=f.state),N&&null!=U.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=g({},f.__s)),g(f.__s,U.getDerivedStateFromProps(y,f.__s))),_=f.props,D=f.state,f.__v=r,m)N&&null==U.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),N&&null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(N&&null==U.getDerivedStateFromProps&&y!==_&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(y,R),!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(y,f.__s,R)||r.__v==i.__v){for(r.__v!=i.__v&&(f.props=y,f.state=f.__s,f.__d=!1),r.__e=i.__e,r.__k=i.__k,r.__k.some((function(e){e&&(e.__=r)})),w=0;w<f._sb.length;w++)f.__h.push(f._sb[w]);f._sb=[],f.__h.length&&u.push(f);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(y,f.__s,R),N&&null!=f.componentDidUpdate&&f.__h.push((function(){f.componentDidUpdate(_,D,v)}))}if(f.context=R,f.props=y,f.__P=e,f.__e=!1,k=n.__r,M=0,N){for(f.state=f.__s,f.__d=!1,k&&k(r),d=f.render(f.props,f.state,f.context),F=0;F<f._sb.length;F++)f.__h.push(f._sb[F]);f._sb=[]}else do{f.__d=!1,k&&k(r),d=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++M<25);f.state=f.__s,null!=f.getChildContext&&(s=g(g({},s),f.getChildContext())),N&&!m&&null!=f.getSnapshotBeforeUpdate&&(v=f.getSnapshotBeforeUpdate(_,D)),x=d,null!=d&&d.type===T&&null==d.key&&(x=B(d.props.children)),l=I(e,E(x)?x:[x],r,i,s,o,a,u,l,c,h),f.base=r.__e,r.__u&=-161,f.__h.length&&u.push(f),C&&(f.__E=f.__=null)}catch(e){if(r.__v=null,c||null!=a)if(e.then){for(r.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,r.__e=l}else for(P=a.length;P--;)A(a[P]);else r.__e=i.__e,r.__k=i.__k;n.__e(e,r,i)}else null==a&&r.__v==i.__v?(r.__k=i.__k,r.__e=i.__e):l=r.__e=function(e,r,i,s,o,a,u,l,c){var h,d,f,m,g,_,D,v=i.props,T=r.props,O=r.type;if("svg"==O?o="http://www.w3.org/2000/svg":"math"==O?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a)for(h=0;h<a.length;h++)if((g=a[h])&&"setAttribute"in g==!!O&&(O?g.localName==O:3==g.nodeType)){e=g,a[h]=null;break}if(null==e){if(null==O)return document.createTextNode(T);e=document.createElementNS(o,O,T.is&&T),l&&(n.__m&&n.__m(r,a),l=!1),a=null}if(null==O)v===T||l&&e.data==T||(e.data=T);else{if(a=a&&t.call(e.childNodes),v=i.props||p,!l&&null!=a)for(v={},h=0;h<e.attributes.length;h++)v[(g=e.attributes[h]).name]=g.value;for(h in v)if(g=v[h],"children"==h);else if("dangerouslySetInnerHTML"==h)f=g;else if(!(h in T)){if("value"==h&&"defaultValue"in T||"checked"==h&&"defaultChecked"in T)continue;L(e,h,null,g,o)}for(h in T)g=T[h],"children"==h?m=g:"dangerouslySetInnerHTML"==h?d=g:"value"==h?_=g:"checked"==h?D=g:l&&"function"!=typeof g||v[h]===g||L(e,h,g,v[h],o);if(d)l||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),r.__k=[];else if(f&&(e.innerHTML=""),I("template"==r.type?e.content:e,E(m)?m:[m],r,i,s,"foreignObject"==O?"http://www.w3.org/1999/xhtml":o,a,u,a?a[0]:i.__k&&S(i,0),l,c),null!=a)for(h=a.length;h--;)A(a[h]);l||(h="value","progress"==O&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[h]||"progress"==O&&!_||"option"==O&&_!=v[h])&&L(e,h,_,v[h],o),h="checked",null!=D&&D!=e[h]&&L(e,h,D,v[h],o))}return e}(i.__e,r,i,s,o,a,u,c,h);return(d=n.diffed)&&d(r),128&r.__u?void 0:l}function x(e,t,r){for(var i=0;i<r.length;i++)P(r[i],r[++i],r[++i]);n.__c&&n.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){n.__e(e,t.__v)}}))}function B(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:E(e)?e.map(B):g({},e)}function P(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){n.__e(e,r)}}function U(e,t,r){var i,s;if(n.unmount&&n.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||P(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){n.__e(e,t)}i.base=i.__P=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&U(i[s],t,r||"function"!=typeof e.type);r||A(e.__e),e.__c=e.__=e.__e=void 0}function H(e,t,n){return this.constructor(e,n)}function $(e,r,i){var s,o,a,u;r==document&&(r=document.documentElement),n.__&&n.__(e,r),o=(s="function"==typeof i)?null:i&&i.__k||r.__k,a=[],u=[],F(r,e=(!s&&i||r).__k=_(T,null,[e]),o||p,p,r.namespaceURI,!s&&i?[i]:o?null:r.firstChild?t.call(r.childNodes):null,a,!s&&i?i:o?o.__e:r.firstChild,s,u),x(a,e,u)}function j(e,t){$(e,t,j)}function Y(e,n,r){var i,s,o,a,u=g({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)"key"==o?i=n[o]:"ref"==o?s=n[o]:u[o]=null==n[o]&&null!=a?a[o]:n[o];return arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):r),D(e.type,u,i||e.key,s||e.ref,null)}function z(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach((function(e){e.__e=!0,y(e)}))},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+d++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}t=f.slice,n={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},r=0,O.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),y(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),y(this))},O.prototype.render=T,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},N.__r=0,u=/(PointerCapture)$|Capture$/i,l=0,c=M(!1),h=M(!0),d=0;var V,G,W,X,K=0,q=[],J=n,Z=J.__b,Q=J.__r,ee=J.diffed,te=J.__c,ne=J.unmount,re=J.__;function ie(e,t){J.__h&&J.__h(G,e,K||t),K=0;var n=G.__H||(G.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function se(e){return K=1,oe(Te,e)}function oe(e,t,n){var r=ie(V++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Te(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=G,!G.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return!!e.__c}));if(i.every((function(e){return!e.__N})))return!s||s.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s&&s.call(this,e,t,n)||o};G.__f=!0;var s=G.shouldComponentUpdate,o=G.componentWillUpdate;G.componentWillUpdate=function(e,t,n){if(this.__e){var r=s;s=void 0,i(e,t,n),s=r}o&&o.call(this,e,t,n)},G.shouldComponentUpdate=i}return r.__N||r.__}function ae(e,t){var n=ie(V++,3);!J.__s&&ve(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function ue(e,t){var n=ie(V++,4);!J.__s&&ve(n.__H,t)&&(n.__=e,n.u=t,G.__h.push(n))}function le(e){return K=5,he((function(){return{current:e}}),[])}function ce(e,t,n){K=6,ue((function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}}),null==n?n:n.concat(e))}function he(e,t){var n=ie(V++,7);return ve(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function de(e,t){return K=8,he((function(){return e}),t)}function pe(e){var t=G.context[e.__c],n=ie(V++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(G)),t.props.value):e.__}function fe(e,t){J.useDebugValue&&J.useDebugValue(t?t(e):e)}function me(){var e=ie(V++,11);if(!e.__){for(var t=G.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ee(){for(var e;e=q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(_e),e.__H.__h.forEach(De),e.__H.__h=[]}catch(t){e.__H.__h=[],J.__e(t,e.__v)}}J.__b=function(e){G=null,Z&&Z(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),re&&re(e,t)},J.__r=function(e){Q&&Q(e),V=0;var t=(G=e.__c).__H;t&&(W===G?(t.__h=[],G.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.forEach(_e),t.__h.forEach(De),t.__h=[],V=0)),W=G},J.diffed=function(e){ee&&ee(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==q.push(t)&&X===J.requestAnimationFrame||((X=J.requestAnimationFrame)||Ae)(Ee)),t.__H.__.forEach((function(e){e.u&&(e.__H=e.u),e.u=void 0}))),W=G=null},J.__c=function(e,t){t.some((function(e){try{e.__h.forEach(_e),e.__h=e.__h.filter((function(e){return!e.__||De(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],J.__e(n,e.__v)}})),te&&te(e,t)},J.unmount=function(e){ne&&ne(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{_e(e)}catch(e){t=e}})),n.__H=void 0,t&&J.__e(t,n.__v))};var ge="function"==typeof requestAnimationFrame;function Ae(e){var t,n=function(){clearTimeout(r),ge&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ge&&(t=requestAnimationFrame(n))}function _e(e){var t=G,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),G=t}function De(e){var t=G;e.__c=e.__(),G=t}function ve(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Te(e,t){return"function"==typeof t?t(e):t}function Oe(e,t){for(var n in t)e[n]=t[n];return e}function Se(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function Ce(e,t){var n=t(),r=se({t:{__:n,u:t}}),i=r[0].t,s=r[1];return ue((function(){i.__=n,i.u=t,ye(i)&&s({t:i})}),[e,n,t]),ae((function(){return ye(i)&&s({t:i}),e((function(){ye(i)&&s({t:i})}))}),[e]),n}function ye(e){var t,n,r=e.u,i=e.__;try{var s=r();return!((t=i)===(n=s)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}function Ne(e){e()}function Ie(e){return e}function be(){return[!1,Ne]}var Re=ue;function we(e,t){this.props=e,this.context=t}function ke(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Se(this.props,e)}function r(t){return this.shouldComponentUpdate=n,_(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(we.prototype=new O).isPureReactComponent=!0,we.prototype.shouldComponentUpdate=function(e,t){return Se(this.props,e)||Se(this.state,t)};var Le=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Le&&Le(e)};var Me="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Fe(e){function t(t){var n=Oe({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=Me,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var xe=function(e,t){return null==e?null:R(R(e).map(t))},Be={map:xe,forEach:xe,count:function(e){return e?R(e).length:0},only:function(e){var t=R(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:R},Pe=n.__e;n.__e=function(e,t,n,r){if(e.then)for(var i,s=t;s=s.__;)if((i=s.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);Pe(e,t,n,r)};var Ue=n.unmount;function He(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=Oe({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return He(e,t,n)}))),e}function $e(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return $e(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function je(){this.__u=0,this.o=null,this.__b=null}function Ye(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ze(e){var t,n,r;function i(i){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return _(n,i)}return i.displayName="Lazy",i.__f=!0,i}function Ve(){this.i=null,this.l=null}n.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ue&&Ue(e)},(je.prototype=new O).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=Ye(r.__v),s=!1,o=function(){s||(s=!0,n.__R=null,i?i(a):a())};n.__R=o;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=$e(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},je.prototype.componentWillUnmount=function(){this.o=[]},je.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=He(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&_(T,null,e.fallback);return i&&(i.__u&=-33),[_(T,null,t.__a?null:e.children),i]};var Ge=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function We(e){return this.getChildContext=function(){return e.context},e.children}function Xe(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){$(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}$(_(We,{context:t.context},e.__v),t.v)}function Ke(e,t){var n=_(Xe,{__v:e,h:t});return n.containerInfo=t,n}(Ve.prototype=new O).__a=function(e){var t=this,n=Ye(t.__v),r=t.l.get(e);return r[0]++,function(i){var s=function(){t.props.revealOrder?(r.push(i),Ge(t,e,r)):i()};n?n(s):s()}},Ve.prototype.render=function(e){this.i=null,this.l=new Map;var t=R(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ve.prototype.componentDidUpdate=Ve.prototype.componentDidMount=function(){var e=this;this.l.forEach((function(t,n){Ge(e,n,t)}))};var qe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Je=/^(?: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]/,Ze=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Qe=/[A-Z0-9]/g,et="undefined"!=typeof document,tt=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function nt(e,t,n){return null==t.__k&&(t.textContent=""),$(e,t),"function"==typeof n&&n(),e?e.__c:null}function rt(e,t,n){return j(e,t),"function"==typeof n&&n(),e?e.__c:null}O.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(O.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var it=n.event;function st(){}function ot(){return this.cancelBubble}function at(){return this.defaultPrevented}n.event=function(e){return it&&(e=it(e)),e.persist=st,e.isPropagationStopped=ot,e.isDefaultPrevented=at,e.nativeEvent=e};var ut,lt={enumerable:!1,configurable:!0,get:function(){return this.class}},ct=n.vnode;n.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},i=-1===n.indexOf("-");for(var s in t){var o=t[s];if(!("value"===s&&"defaultValue"in t&&null==o||et&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var a=s.toLowerCase();"defaultValue"===s&&"value"in t&&null==t.value?s="value":"download"===s&&!0===o?o="":"translate"===a&&"no"===o?o=!1:"o"===a[0]&&"n"===a[1]?"ondoubleclick"===a?s="ondblclick":"onchange"!==a||"input"!==n&&"textarea"!==n||tt(t.type)?"onfocus"===a?s="onfocusin":"onblur"===a?s="onfocusout":Ze.test(s)&&(s=a):a=s="oninput":i&&Je.test(s)?s=s.replace(Qe,"-$&").toLowerCase():null===o&&(o=void 0),"oninput"===a&&r[s=a]&&(s="oninputCapture"),r[s]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=R(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=R(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",lt)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=qe,ct&&ct(e)};var ht=n.__r;n.__r=function(e){ht&&ht(e),ut=e.__c};var dt=n.diffed;n.diffed=function(e){dt&&dt(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),ut=null};var pt={ReactCurrentDispatcher:{current:{readContext:function(e){return ut.__n[e.__c].props.value},useCallback:de,useContext:pe,useDebugValue:fe,useDeferredValue:Ie,useEffect:ae,useId:me,useImperativeHandle:ce,useInsertionEffect:Re,useLayoutEffect:ue,useMemo:he,useReducer:oe,useRef:le,useState:se,useSyncExternalStore:Ce,useTransition:be}}};function ft(e){return _.bind(null,e)}function mt(e){return!!e&&e.$$typeof===qe}function Et(e){return mt(e)&&e.type===T}function gt(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function At(e){return mt(e)?Y.apply(null,arguments):e}function _t(e){return!!e.__k&&($(null,e),!0)}function Dt(e){return e&&(e.base||1===e.nodeType&&e)||null}var vt=function(e,t){return e(t)},Tt=function(e,t){return e(t)},Ot=T,St=mt,Ct={useState:se,useId:me,useReducer:oe,useEffect:ae,useLayoutEffect:ue,useInsertionEffect:Re,useTransition:be,useDeferredValue:Ie,useSyncExternalStore:Ce,startTransition:Ne,useRef:le,useImperativeHandle:ce,useMemo:he,useCallback:de,useContext:pe,useDebugValue:fe,version:"18.3.1",Children:Be,render:nt,hydrate:rt,unmountComponentAtNode:_t,createPortal:Ke,createElement:_,createContext:z,createFactory:ft,cloneElement:At,createRef:v,Fragment:T,isValidElement:mt,isElement:St,isFragment:Et,isMemo:gt,findDOMNode:Dt,Component:O,PureComponent:we,memo:ke,forwardRef:Fe,flushSync:Tt,unstable_batchedUpdates:vt,StrictMode:Ot,Suspense:je,SuspenseList:Ve,lazy:ze,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pt};const yt=Object.freeze(Object.defineProperty({__proto__:null,Children:Be,Component:O,Fragment:T,PureComponent:we,StrictMode:Ot,Suspense:je,SuspenseList:Ve,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pt,cloneElement:At,createContext:z,createElement:_,createFactory:ft,createPortal:Ke,createRef:v,default:Ct,findDOMNode:Dt,flushSync:Tt,forwardRef:Fe,hydrate:rt,isElement:St,isFragment:Et,isMemo:gt,isValidElement:mt,lazy:ze,memo:ke,render:nt,startTransition:Ne,unmountComponentAtNode:_t,unstable_batchedUpdates:vt,useCallback:de,useContext:pe,useDebugValue:fe,useDeferredValue:Ie,useEffect:ae,useErrorBoundary:function(e){var t=ie(V++,10),n=se();return t.__=e,G.componentDidCatch||(G.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:me,useImperativeHandle:ce,useInsertionEffect:Re,useLayoutEffect:ue,useMemo:he,useReducer:oe,useRef:le,useState:se,useSyncExternalStore:Ce,useTransition:be,version:"18.3.1"},Symbol.toStringTag,{value:"Module"}));var Nt=0;function It(e,t,r,i,s,o){t||(t={});var a,u,l=t;if("ref"in l)for(u in l={},t)"ref"==u?a=t[u]:l[u]=t[u];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nt,__i:-1,__u:0,__source:s,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(u in a)void 0===l[u]&&(l[u]=a[u]);return n.vnode&&n.vnode(c),c}const bt=z(null),Rt={didCatch:!1,error:null};class wt extends O{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Rt}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,n,r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];null===(t=(n=this.props).onReset)||void 0===t||t.call(n,{args:i,reason:"imperative-api"}),this.setState(Rt)}}componentDidCatch(e,t){var n,r;null===(n=(r=this.props).onError)||void 0===n||n.call(r,e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;var i,s;n&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some(((e,n)=>!Object.is(e,t[n])))}(e.resetKeys,r)&&(null===(i=(s=this.props).onReset)||void 0===i||i.call(s,{next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Rt))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:s}=this.state;let o=e;if(i){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)o=t(e);else if(n)o=_(n,e);else{if(void 0===r)throw s;o=r}}return _(bt.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},o)}}var kt=Object.prototype.hasOwnProperty;function Lt(e){return Array.isArray(e)}function Mt(e){return!(!e||"object"!=typeof e||e instanceof Date||Lt(e))}function Ft(e){return"function"==typeof e}function xt(e){const t=typeof e;return void 0!==e&&(Bt(e)||"object"!==t&&"function"!==t)}function Bt(e){return e instanceof Date}function Pt(e){return"boolean"==typeof e}function Ut(e){return e instanceof Promise}function Ht(e){return e instanceof Map}function $t(e){if(!e)return!1;if(Lt(e))return 0===e.length;for(const t in e)if(kt.call(e,t))return!1;return!0}function jt(e){return null==e}var Yt=new Set(["boolean","string","number"]);function zt(e){return!!e.parent}var Vt=Symbol.toPrimitive,Gt=Symbol("getNode"),Wt=Symbol("delete"),Xt=Symbol("opaque"),Kt=Symbol("optimized"),qt=Symbol("linked"),Jt={isLoadingLocal:!1,isMerging:!1,isLoadingRemote:!1,activateSyncedNode:void 0,pendingNodes:new Map,dirtyNodes:new Set,replacer:void 0,reviver:void 0};function Zt(e){return Lt(e)?"array":Ht(e)?"map":e instanceof Set?"set":"object"}function Qt(e,t){return Ht(t)?{__LSType:"Map",value:Array.from(t.entries())}:t instanceof Set?{__LSType:"Set",value:Array.from(t)}:(Jt.replacer&&(t=Jt.replacer(e,t)),t)}var en=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/;function tn(e,t){if(t){if("string"==typeof t&&en.test(t))return new Date(t);if("object"==typeof t){if("Map"===t.__LSType)return new Map(t.value);if("Set"===t.__LSType)return new Set(t.value)}Jt.reviver&&(t=Jt.reviver(e,t))}return t}function nn(e){return e?JSON.stringify(e,Qt):e}function rn(e){return e?JSON.parse(e,tn):e}function sn(e){return rn(nn(e))}function on(e){return!!e&&!!e[Gt]}function an(e){return e&&e[Gt]}function un(e,t){var n,r,i;const s=null!=(n=e.parent)?n:e,o=e.parent?e.key:"_",a=t===Wt;a&&(t=void 0);const u=e.parent?dn(s):s.root,l=u[o],c=Ft(t);if(t=s.isAssigning||!c||Ft(l)?t:t(l),!Jt.isMerging||jt(l)||Ft(l)||!(null==(i=null==(r=e.parent)?void 0:r.functions)?void 0:i.get(o)))try{s.isSetting=(s.isSetting||0)+1;const e=Ht(u);a?e?u.delete(o):delete u[o]:Ht(u)?u.set(o,t):u[o]=t}finally{s.isSetting--}return{prevValue:l,newValue:t}}var ln=[];function cn(e){let t=0,n=e;for(;zt(n);)ln[t++]=n.key,n=n.parent;let r=e.root._;for(let i=t-1;r&&i>=0;i--){const e=ln[i];r="size"!==e&&(Ht(r)||r instanceof WeakMap)?r.get(e):r[e]}return r}function hn(e,t,n){var r,i;let s=null==(r=e.children)?void 0:r.get(t);return s||(s={root:e.root,parent:e,key:t,lazy:!0,numListenersRecursive:0},1===(null==(i=e.lazyFn)?void 0:i.length)&&(n=e.lazyFn.bind(e,t)),Ft(n)&&(s=Object.assign((()=>{}),s),s.lazyFn=n),e.children||(e.children=new Map),e.children.set(t,s)),s}function dn(e){let t=cn(e);return t&&!Ft(t)||(t=zt(e)?dn(e.parent)[e.key]={}:e.root._={}),t}function pn(e,t){var n,r;let i=on(e)?void 0:Mt(e)?"id"in e?"id":"key"in e?"key":"_id"in e?"_id":"__id"in e?"__id":void 0:void 0;if(!i&&t.parent){const e=t.key+"_keyExtractor",s=null!=(r=null==(n=t.functions)?void 0:n.get(e))?r:cn(t.parent)[t.key+"_keyExtractor"];s&&Ft(s)&&(i=s)}return i}function fn(e,t,n){e.functions||(e.functions=new Map),e.functions.set(t,n)}function mn(e,t){return e===t||Bt(e)&&Bt(t)&&+e==+t}function En(e,t,n){let r=e;return!on(r)&&Ft(r)&&(r=t?r(t):r()),on(r)&&!n?r.get():r}function gn(e){return e&&(e[Xt]=!0),e}var An,_n=(e,t)=>e&&e[t];function Dn(e,t,n,r,i,s,o){let a,u=e;if(t.length>0){let i=s;for(let s=0;s<t.length;s++){if(a=t[s],u[a]===Wt)return i&&(u[a]=i[a],null==o||o(t.slice(0,s+1),u[a])),e;if(void 0===u[a]&&void 0===r&&s===t.length-1)return e;void 0!==u[a]&&null!==u[a]||(u[a]=On(n[s])),s<t.length-1&&(u=u[a],i&&(i=i[a]))}}return void 0===a?e="merge"===i?vn(e,r):r:"merge"===i?u[a]=vn(u[a],r):Ht(u)?u.set(a,r):u[a]=r,e}function vn(e,t,n){var r;on(t)&&(t=t.peek());const i=on(e),s=i?e.peek():e,o=Lt(s);if(!o&&Mt(s)&&Mt(t)&&!$t(s)||o&&s.length>0){const n=Object.keys(t);for(let s=0;s<n.length;s++){const o=n[s],a=t[o];if(a===Wt)i&&(null==(r=e[o])?void 0:r.delete)?e[o].delete():delete e[o];else{const t=Mt(a),n=!t&&Lt(a),r=e[o];if(!t&&!n||!r||!i&&$t(r))if(i)r.set(a);else{const t=Mt(a)?{...a}:Lt(a)?[...a]:a;e[o]=t}else i||r&&(t?Mt(r):Lt(r))?vn(r,a):e[o]=a}}}else void 0!==t&&(i?e.set(t):e=t);return e}function Tn(e){return!(!e||(Mt(e)||Lt(e))&&$t(e))}function On(e){switch(e){case"array":return[];case"object":return{};case"map":return new Map;case"set":return new Set}}function Sn(e,t,n){const{path:r,valueAtPath:i,prevAtPath:s,pathTypes:o}=t;return Dn(e,r,o,s)}var Cn=0,yn=!1,Nn=!1,In=new Map;function bn(){In.size>0&&Bn(!0)}function Rn(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function wn(e,t){return function(){return function(e,t){try{return function(e,t){for(let n=0;n<t.length;n++)e=Sn(e,t[n]);return e}(e?sn(e):{},t)}catch(e){return}}(e,t)}}function kn(e,t,n,r,i){const s=new Map;Ln(s,e,Jt.isLoadingLocal,Jt.isLoadingRemote,t,[],[],t,n,!0,r,i),s.size&&Mn(s,!0);const o=In.get(e);o?o.value=t:In.set(e,{value:t,prev:n,level:r,whenOptimizedOnlyIf:i,remote:Jt.isLoadingRemote,loading:Jt.isLoadingLocal}),Cn<=0&&Fn()}function Ln(e,t,n,r,i,s,o,a,u,l,c,h){if(function(e,t,n,r,i,s,o,a,u,l,c,h){if(l?t.listenersImmediate:t.listeners){const l={path:s,pathTypes:o,valueAtPath:a,prevAtPath:u},d=e.get(t);if(d&&s.length>0){const{changes:e}=d;Rn(e[0].path,l.path)||e.push(l)}else e.set(t,{level:c,value:i,remote:r,loading:n,whenOptimizedOnlyIf:h,changes:[l]})}}(e,t,n,r,i,s,o,a,u,l,c,h),t.linkedFromNodes)for(const d of t.linkedFromNodes)Ln(e,Pn(d,s),n,r,a,[],[],a,u,l,0,h);if(t.parent){const d=t.parent;d&&Ln(e,d,n,r,cn(d),[t.key].concat(s),[Zt(i)].concat(o),a,u,l,c+1,h)}}function Mn(e,t){const n=new Set;e.forEach((({changes:e,level:r,value:i,loading:s,remote:o,whenOptimizedOnlyIf:a},u)=>{const l=t?u.listenersImmediate:u.listeners;if(l){let t;const u=Array.from(l);for(let l=0;l<u.length;l++){const c=u[l],{track:h,noArgs:d,listener:p}=c;n.has(p)||(!0===h?r<=0:h!==Kt||a&&r<=0)&&(d||t||(t={value:i,loading:s,remote:o,getPrevious:wn(i,e),changes:e}),h||n.add(p),p(t))}}}))}function Fn(){const e=Array.from(Jt.dirtyNodes);Jt.dirtyNodes.clear(),e.forEach((e=>{const t=e.dirtyFn;t&&(e.dirtyFn=void 0,t())}));const t=In;In=new Map;const n=new Map;t.forEach((({value:e,prev:t,level:r,loading:i,remote:s,whenOptimizedOnlyIf:o},a)=>{Ln(n,a,i,s,e,[],[],e,t,!1,r,o)})),n.size&&Mn(n,!1)}function xn(){Cn++,An||(An=setTimeout(bn,0))}function Bn(e){(--Cn<=0||e)&&(yn?Nn=!0:(An&&(clearTimeout(An),An=void 0),Cn=0,yn=!0,Fn(),yn=!1,Nn&&(Nn=!1,Bn(!0))))}function Pn(e,t){let n=e;for(let r=0;r<t.length;r++)n=hn(n,t[r]);return n}function Un(e,t,n,r,i){if(on(e))return e;const s=Ut(e);let o={root:{_:e},lazy:!0,numListenersRecursive:0};var a;Ft(e)&&(o=Object.assign((()=>{}),o),o.lazyFn=e);const u=(a=e,Yt.has(typeof a)?new i(o):r(o));return s&&(un(o,void 0),n(o,e)),u}function Hn(e,t,n={},r){var i;const{initial:s,immediate:o,noArgs:a}=n,{trackingType:u}=n;let l=o?e.listenersImmediate:e.listeners;l||(l=new Set,o?e.listenersImmediate=l:e.listeners=l);const c={listener:t,track:u,noArgs:a};if(l.add(c),s){const n=cn(e);t({value:n,loading:!0,remote:!1,changes:[{path:[],pathTypes:[],prevAtPath:n,valueAtPath:n}],getPrevious:()=>{}})}let h;function d(i,s=t,o){if(!(null==r?void 0:r.has(i))){r||(r=new Set),r.add(o||e),s||(s=t);const a={trackingType:!0,...n};h=[...h||[],Hn(i,s,a,r)]}}e.linkedToNode&&d(e.linkedToNode),null==(i=e.linkedFromNodes)||i.forEach((e=>d(e))),e.numListenersRecursive++;let p=e.parent,f=[e.key];for(;p;){if(p.linkedFromNodes)for(const e of p.linkedFromNodes)(null==r?void 0:r.has(e))||d(e,$n(e,f,t),p);p.numListenersRecursive++,f=[p.key,...f],p=p.parent}return()=>{l.delete(c),null==h||h.forEach((e=>e()));let t=e;for(;t;)t.numListenersRecursive--,t=t.parent}}function $n(e,t,n){let{valueAtPath:r}=jn(cn(e),t);return function({value:e,loading:i,remote:s}){const{valueAtPath:o}=jn(e,t);o!==r&&n({value:o,loading:i,remote:s,changes:[{path:[],pathTypes:[],prevAtPath:r,valueAtPath:o}],getPrevious:()=>r}),r=o}}function jn(e,t){let n=e;const r=[];for(let i=0;n&&i<t.length;i++)r.push(Lt(n)?"array":"object"),n=n[t[i]];return{valueAtPath:n,pathTypes:r}}var Yn=0,zn=[],Vn={current:void 0};function Gn(e,t){if(Yn){const n=Vn.current;if(n){n.nodes||(n.nodes=new Map);const r=n.nodes.get(e);r?(r.track=r.track||t,r.num++):n.nodes.set(e,{node:e,track:t,num:1})}}}function Wn(e,t,n,r,i){let s,o=t;zn.push(Vn.current),Yn++,Vn.current={};const a=e?En(e,n,null==r?void 0:r.fromComputed):e,u=Vn.current.nodes;return--Yn<0&&(Yn=0),Vn.current=zn.pop(),(null==n?void 0:n.cancel)||(s=function(e,t,n,r){let i=[];return null==e||e.forEach((e=>{const{node:n,track:s}=e;i.push(Hn(n,t,{trackingType:s,immediate:r,noArgs:false}))})),()=>{if(i){for(let e=0;e<i.length;e++)i[e]();i=void 0}}}(u,o,0,null==r?void 0:r.immediate)),{nodes:u,value:a,dispose:s,resubscribe:void 0}}function Xn(e,t,n){let r,i;Ft(t)?r=t:n=t;const s={num:0},o=function(){s.onCleanup&&(s.onCleanup(),s.onCleanup=void 0),xn(),delete s.value,null==i||i();const{dispose:t,value:a,nodes:u}=Wn(e,o,s,n);i=t,s.value=a,s.nodes=u,s.refresh=o,s.onCleanupReaction&&(s.onCleanupReaction(),s.onCleanupReaction=void 0),Bn(),r&&((null==n?void 0:n.fromComputed)||(s.num>0||!function(e){var t;return e&&(null==(t=e[Gt])?void 0:t.isEvent)}(e))&&(s.previous!==s.value||"object"==typeof s.value))&&r(s),s.previous=s.value,s.num++};return o(),()=>{var e,t;null==(e=s.onCleanup)||e.call(s),s.onCleanup=void 0,null==(t=s.onCleanupReaction)||t.call(s),s.onCleanupReaction=void 0,null==i||i()}}function Kn(e,t,n){if(Ut(e))return t?e.then(t):e;let r,i;return Xn((function(t){const i=En(e);if(!Ut(i))return!Ut(i)&&(n?Tn(i):i)&&(r=i,t.cancel=!0),r;r=i}),(function(){i=null==t?void 0:t(r)})),Ut(r)?t?r.then(t):r:void 0!==r?t?i:Promise.resolve(r):new Promise((e=>{if(t){const n=t;t=t=>{const r=n(t);e(Ut(r)?r.then((e=>e)):r)}}else t=e}))}function qn(e,t){return Kn(e,t,!1)}function Jn(e,t){return Kn(e,t,!0)}var Zn=new Set(["copyWithin","fill","from","pop","push","reverse","shift","sort","splice","unshift"]),Qn=new Set(["every","filter","find","findIndex","forEach","join","map","reduce","some"]),er=new Set(["filter","find"]),tr=new Map,nr=new Map([["get",mr],["set",cr],["peek",Er],["onChange",Hn],["assign",function(e,t){const n=ar(e);if(xn(),xt(e.root._)&&(e.root._={}),Ht(t)){const n=cn(e);Ht(n)&&t.forEach(((e,t)=>n.set(t,e)))}else{e.isAssigning=(e.isAssigning||0)+1;try{Object.assign(n,t)}finally{e.isAssigning--}}return Bn(),n}],["delete",function(e,t){void 0===t&&zt(e)&&(t=e.key,e=e.parent);const n=cn(e);Lt(n)?rr(e,n,"splice",t,1):hr(e,null!=t?t:"_",Wt,-1)}],["toggle",function(e){const t=cn(e);(null==t||Pt(t))&&cr(e,!t)}]]);function rr(e,t,n,...r){var i;if("push"!==n||1!==r.length){const s=t.slice(),o=t[n].apply(t,r);if(e){const n=zt(e),r=n?e.key:"_";(n?cn(e.parent):e.root)[r]=s,hr(null!=(i=e.parent)?i:e,r,t)}return o}hr(e,t.length+"",r[0])}function ir(e,t,n){return t?void 0:e?n?Array.from(e.keys()):Object.keys(e):[]}function sr(e,t,n){var r,i,s;if(Mt(t)&&t[Xt]||Mt(n)&&n[Xt]){const r=t!==n;return r&&(e.listeners||e.listenersImmediate)&&kn(e,t,n,0),r}const o=Lt(t);let a,u;const l=Ht(t),c=Ht(n),h=ir(t,o,l),d=ir(n,o,c),p=(null==(r=h||t)?void 0:r.length)||0,f=(null==(i=d||n)?void 0:i.length)||0;let m,E,g,A=!1;if(o&&Lt(n)){if(n.length>0){const r=n[0];if(void 0!==r&&(m=pn(r,e),m&&(E=Ft(m),a=new Map,u=[]),e.children))for(let i=0;i<n.length;i++){const r=n[i];if(r){const n=e.children.get(i+"");if(n&&(t[i]||or(n,r),m)){const e=E?m(r):r[m];a.set(e,n)}}}}}else if(n&&(!t||Mt(t))){const t=d.length;for(let r=0;r<t;r++){const t=d[r];if(!h.includes(t)){A=!0;const r=hn(e,t),i=c?n.get(t):n[t];void 0!==i&&or(r,i)}}}if(t&&!xt(t)){A=A||p!==f;const r=A;let i=!1;for(let d=0;d<p;d++){const p=o?d+"":h[d];let f=l?t.get(p):t[p];const g=c?null==n?void 0:n.get(p):null==n?void 0:n[p];let _=!mn(f,g);if(_){const c=m&&f?E?m(f):f[m]:void 0,h=null==(s=e.children)?void 0:s.get(p);if(on(f)){const e=an(f);if((null==h?void 0:h.linkedToNode)===e){const n=cn(e);l?t.set(p,n):t[p]=n;continue}const n=f;f=()=>n}let d=hn(e,p,f);if(d.lazy||!Ft(f)&&!on(f)||(_r(d,f),Ar(d)),o&&void 0!==c){const t=void 0!==c?null==a?void 0:a.get(c):void 0;if(t){if(void 0!==t&&t.key!==p){const s=n[t.key];r&&(d=t,e.children.delete(d.key),d.key=p,u.push([p,d])),i=!0,_=s!==f}}else A=!0}if(_)if(Ft(f)||on(f))fr(e,p,f);else if(xt(f))A=!0;else{const e=sr(d,f,g);A=A||e,_=e}(_||o&&!r)&&(d.listeners||d.listenersImmediate)&&kn(d,f,g,0,!r)}}if(u)for(let t=0;t<u.length;t++){const[n,r]=u[t];e.children.set(n,r)}g=A||i}else void 0!==n&&(g=!0);return null!=g&&g}function or(e,t){var n,r;null==(n=e.linkedToNodeDispose)||n.call(e),null==(r=e.activatedObserveDispose)||r.call(e),xt(t)||sr(e,void 0,t),(e.listeners||e.listenersImmediate)&&kn(e,void 0,t,0)}function ar(e,t,n){return void 0!==t&&(e=hn(e,t,n)),e.proxy||(e.proxy=new Proxy(e,lr))}function ur(){if(Jt.pendingNodes.size>0){const e=Array.from(Jt.pendingNodes.values());Jt.pendingNodes.clear(),e.forEach((e=>e()))}}var lr={get(e,t,n){var r,i;if(t===Vt)throw new Error("[legend-state] observable is not a primitive.");if(t===Gt)return e;if("apply"===t){const t=cn(e);if(Ft(t))return t.apply}let s=Ar(e,"get"===t||"peek"===t);const o=e.linkedToNode||(null==s?void 0:s[Gt]);if(o&&"onChange"!==t)return lr.get(o,t,n);if(Ht(s)||s instanceof WeakMap||s instanceof Set||s instanceof WeakSet){const n=function(e,t,n){const r=null==n?void 0:n[t];return"size"===t?ar(e,t):Ft(r)?function(r,i,s){const o=arguments.length,a=n;if("get"===t){if(o>0&&"boolean"!=typeof r&&r!==Kt)return ar(e,r)}else if("set"===t){if(2===o){const t=a.get(r),n=a.set(r,i);return t!==i&&dr(hn(e,r),i,t),n}1===o&&Ht(n)&&cr(e,r)}else if("delete"===t){if(o>0){const t=n.get?a.get(r):r,i=n.delete(r);return i&&dr(hn(e,r),void 0,t),i}}else{if("clear"===t){const t=new Map(a),r=a.size;return a.clear(),void(r&&dr(e,n,t))}if("add"===t){const i=new Set(n),s=n.add(r);return n.has(t)||kn(e,s,i,0),s}}const u=nr.get(t);if(!u)return n[t](r,i);switch(o){case 0:return u(e);case 1:return u(e,r);case 2:return u(e,r,i);default:return u(e,r,i,s)}}:void 0}(e,t,s);if(void 0!==n)return n}const a=nr.get(t);if(a)return"get"!==t&&"peek"!==t||ur(),function(t,n,r){switch(arguments.length){case 0:return a(e);case 1:return a(e,t);case 2:return a(e,t,n);default:return a(e,t,n,r)}};const u=tr.get(t);if(u)return u.get(e);let l=null==s?void 0:s[t];if(Mt(s)&&s[Xt])return l;const c=null==(r=e.functions)?void 0:r.get(t);if(c)return on(c)?c:ar(e,t,c);if(l=function(e,t){if(e){const n=Object.getOwnPropertyDescriptor(e,t);return(null==n?void 0:n.get)&&(delete e[t],e[t]=n.set?function(e){Ft(e)&&(e={get:e});const t=function(){return{[qt]:e}};return t.prototype[qt]=e,t}({get:n.get,set:({value:e})=>n.set(e)}):n.get),e[t]}}(s,t),jt(s)&&void 0===l&&(Zn.has(t)||Qn.has(t))&&(s=[],un(e,s),l=s[t]),Ft(l)){if(Lt(s)){if(Zn.has(t))return(...n)=>rr(e,s,t,...n);if(Qn.has(t))return Gn(e,!0),function(n,r){const i="reduce"===t,o=i?(t,r,i,s)=>n(t,ar(e,i+"",r),i,s):(t,r,i)=>n(ar(e,r+"",t),r,i);if(i||!er.has(t))return s[t](o,r);const a="find"===t,u=[];for(let t=0;t<s.length;t++)if(o(s[t],t,s)){const n=ar(e,t+"");if(a)return n;u.push(n)}return a?void 0:u}}fr(e,t,l);const n=null==(i=e.functions)?void 0:i.get(t);return n?ar(e,t,n):l.bind(s)}return xt(l)&&Lt(s)&&"length"===t?(Gn(e,!0),l):ar(e,t)},getPrototypeOf(e){const t=cn(e);return null!==t&&"object"==typeof t?Reflect.getPrototypeOf(t):null},ownKeys(e){Ar(e);const t=mr(e,!0);if(xt(t))return[];const n=t?Reflect.ownKeys(t):[];if(Lt(t)&&"length"===n[n.length-1]&&n.splice(n.length-1,1),Ft(e)){const t=Reflect.ownKeys(e);["caller","arguments","prototype"].forEach((e=>t.includes(e)&&n.push(e)))}return n},getOwnPropertyDescriptor(e,t){if("caller"===t||"arguments"===t||"prototype"===t)return{configurable:!1,enumerable:!1};const n=cn(e);return xt(n)?void 0:Reflect.getOwnPropertyDescriptor(n,t)},set(e,t,n){if(e.isSetting)return Reflect.set(e,t,n);if(e.isAssigning)return hr(e,t,n),!0;const r=tr.get(t);return!!r&&(r.set(e,n),!0)},deleteProperty:(e,t)=>!!e.isSetting&&Reflect.deleteProperty(e,t),has(e,t){const n=cn(e);return Reflect.has(n,t)},apply:(e,t,n)=>(on(t)&&(t=t.peek()),Reflect.apply(e.lazyFn||e,t,n))};function cr(e,t){e.parent?hr(e.parent,e.key,t):hr(e,"_",t)}function hr(e,t,n,r){const i=!e.parent&&"_"===t;!e.parent||cn(e)||Ft(n)||cr(e,{[t]:n});const s=i?e:hn(e,t,n);if(on(n))vr(s,n);else{const{newValue:o,prevValue:a}=un(s,n),u=xt(o)||o instanceof Date;mn(o,a)||dr(e,o,a,s,u,i,r),u||(s.needsExtract=!0),fr(e,t,o)}}function dr(e,t,n,r,i,s,o){r||(r=e),xn(),void 0===i&&(i=xt(t));let a=i,u=!1;(!i||n&&!xt(n))&&(a=sr(r,t,n),Lt(t)&&(u=(null==t?void 0:t.length)!==(null==n?void 0:n.length))),(i||!t||$t(t)&&!$t(n)?t!==n:a)&&kn(i&&s?e:r,t,n,(null!=o?o:void 0===n)?-1:a?0:1,u),Bn()}function pr(e,t,n){e.state||(e.state=Un({isLoaded:!1},0,pr,ar)),t.then((t=>{n?n({value:t}):cr(e,t),e.state.assign({isLoaded:!0,error:void 0})})).catch((t=>{e.state.error.set(t)}))}function fr(e,t,n){if(Ut(n)){const r=hn(e,t);return pr(r,n),void un(r,void 0)}if(on(n)){const r=()=>n;fn(e,t,r);const i=hn(e,t,r);return un(i,Er(an(n))),cn(i)}if("function"==typeof n)return fn(e,t,n),t}function mr(e,t){return Gn(e,t?Mt(t)?t.shallow:t:void 0),Er(e)}function Er(e){return Ar(e,!0)}var gr=!1;function Ar(e,t){var n;if(gr=!0,t&&(null==(n=e.dirtyChildren)?void 0:n.size)){const t=Array.from(e.dirtyChildren);e.dirtyChildren.clear(),t.forEach((e=>e.dirtyFn&&Ar(e)))}if(e.dirtyFn){const t=e.dirtyFn;e.dirtyFn=void 0,Jt.dirtyNodes.delete(e),t()}gr=!1;let r=cn(e);return r=function(e,t,n){const r=t,i=e.lazy;if(i){const n=e.lazyFn;if(delete e.lazy,Ft(n))if(1===n.length)t={};else{if(e.parent){const t=cn(e.parent);t?delete t[e.key]:e.root._=void 0}t=function(e,t){let n,r,i,s=!0;const o=t;let a,u,l=[];function c(){e.dirtyFn=u,Jt.dirtyNodes.add(e)}return e.activatedObserveDispose=Xn((()=>{var t,a,l,c;if(s)s=!1,un(e,void 0);else if(!gr&&u&&function(e,t){if(!gr){const n=function(e){var t,n;let r=e,i=e.numListenersRecursive>0;for(;r&&!i;)((null==(t=r.listeners)?void 0:t.size)||(null==(n=r.listenersImmediate)?void 0:n.size))&&(i=!0),r=r.parent;return i}(e);if(!n){t&&(e.dirtyFn=t);let n=e;for(;n;)n.dirtyChildren||(n.dirtyChildren=new Set),n.dirtyChildren.add(e),n=n.parent;return!0}}}(e,u))return void(i=!0);let h=o(),d=!1;on(h)&&(d=!0,h=vr(e,h)),Ft(h)&&(h=h());const p=on(h)||null==h?void 0:h[qt];if(p&&(e.activationState=p,h=void 0),i=!1,r=Ut(h),e.activated){if(e.activationState){const n=e.activationState;(null==(a=null==(t=e.state)?void 0:t.peek())?void 0:a.sync)?(e.state.sync(),i=!0):h=null!=(c=null==(l=n.get)?void 0:l.call(n))?c:n.initial}}else{e.activated=!0;let t=Dr;(null==p?void 0:p.synced)&&(t=Jt.activateSyncedNode,i=!0);const r=t(e,h);n=r.update;let s=r.value;!d&&on(s)&&(s=vr(e,s)),h=null!=s?s:null==p?void 0:p.initial}return r=r||Ut(h),h}),(t=>{const{value:s,nodes:o,refresh:h}=t;if(u=h,!i){if(!r||!Jt.isLoadingRemote)if(r)if(e.activationState){const{initial:t}=e.activationState;s&&Ut(s)&&pr(e,s,n),Ft(cn(e))&&un(e,null!=t?t:void 0)}else e.activated&&(pr(e,s,n),Ft(cn(e))&&un(e,void 0));else a=s,e.state.isLoaded.peek()?(e.isComputing=!0,cr(e,s),e.isComputing=!1):(un(e,s),e.state.assign({isLoaded:!0,error:void 0}));l.forEach((e=>e())),l=[],null==o||o.forEach((({node:e,track:t})=>{l.push(Hn(e,c,{immediate:!0,trackingType:t}))}))}t.cancel=!0}),{fromComputed:!0}),a}(e,n)}else on(t)&&(t=fr(e.parent,e.key,t))}return!i&&!e.needsExtract||on(t)||xt(t)||(n&&function(e,t){if((Mt(e)||Lt(e))&&!e[Xt]){const n=[],r=()=>{var e;let r=t;for(let t=0;t<n.length;t++){const{key:i}=n[t],s=null==(e=cn(r))?void 0:e[i];r=hn(r,i,Ft(s)?s:void 0),Ar(r)}return r};Tr(e,n,r)}}(t,e),e.parent&&fr(e.parent,e.key,r)),t}(e,r,!!t),r}function _r(e,t){var n,r;null==(n=e.activatedObserveDispose)||n.call(e),null==(r=e.linkedToNodeDispose)||r.call(e),e.activatedObserveDispose=e.linkedToNodeDispose=e.linkedToNode=void 0,e.lazyFn=t,e.lazy=!0}function Dr(e,t){if(e.state||(e.state=Un({isLoaded:!1},0,pr,ar)),e.activationState){const{set:n,get:r,initial:i}=e.activationState;if(null!=(t=null==r?void 0:r())&&null!==t||(t=i),n){let t,r=[],i=0;const s=s=>{if(r.length>0){let o,a,u,l=!1,c=!1;s?(o=s.changes,a=s.value,l=s.loading,c=s.remote,u=s.getPrevious):(o=r,a=t,u=wn(a,o)),r=[],t=void 0,Jt.pendingNodes.delete(e),i++;const h=i,d=()=>{h===i&&(e.isComputing=!0,n({value:a,changes:o,loading:l,remote:c,getPrevious:u}),e.isComputing=!1)};Jn(e.state.isLoaded,d)}};Hn(e,(({value:n,changes:i})=>{e.isComputing||(i.length>1||!Ft(i[0].prevAtPath))&&(t=n,r.length>0&&(i=i.filter((e=>!Rn(r[0].path,e.path)))),r.push(...i),Jt.pendingNodes.set(e,s))}),{immediate:!0}),Hn(e,s)}}return{update:({value:t})=>{e.isComputing||(e.isComputing=!0,cr(e,t),e.isComputing=!1)},value:t}}function vr(e,t){var n;const r=an(t);return r!==e&&(null==r?void 0:r.linkedToNode)!==e&&(e.linkedToNode=r,r.linkedFromNodes||(r.linkedFromNodes=new Set),r.linkedFromNodes.add(e),null==(n=e.linkedToNodeDispose)||n.call(e),e.linkedToNodeDispose=Hn(r,(()=>{t=Ar(r),cr(e,t)}),{initial:!0},new Set([e]))),t}function Tr(e,t,n){var r;if((Mt(e)||Lt(e))&&!e[Xt])for(const i in e)if(kt.call(e,i)){const s=e[i];if(on(s)){const e=n();fr(e,i,s),delete e.lazy}else{const e=Ft(s)&&(null==(r=s.prototype)?void 0:r[qt]);if(e){const t=e.activate;t&&"auto"!==t||Er(hn(n(),i,s))}}"object"==typeof s&&(t.push({key:i,value:s}),Tr(s,t,n),t.pop())}}var Or=["get","set","peek","onChange","toggle"];function Sr(e){this._node=e;for(let t=0;t<Or.length;t++){const e=Or[t];this[e]=this[e].bind(this)}}function Cr(e,t){Sr.prototype[e]=function(...e){return t.call(this,this._node,...e)}}function yr(e){return Un(e,0,pr,ar,Sr)}Cr("peek",(e=>(ur(),Er(e)))),Cr("get",((e,t)=>(ur(),mr(e,t)))),Cr("set",cr),Cr("onChange",Hn),Object.defineProperty(Sr.prototype,Gt,{configurable:!0,get(){return this._node}}),Sr.prototype.toggle=function(){const e=this.peek();(null==e||Pt(e))&&this.set(!e)},Sr.prototype.delete=function(){return this.set(void 0),this};var Nr={createPreviousHandler:wn,clone:sn,ensureNodeValue:dn,findIDKey:pn,get:mr,getNode:an,getNodeValue:cn,getPathType:Zt,getProxy:ar,getValueAtPath:function(e,t){return t.reduce(_n,e)},globalState:Jt,initializePathType:On,observableFns:nr,optimized:Kt,peek:Er,runWithRetry:function(e,t,n){const{waitFor:r}=e.activationState,{retry:i}=t,s={cancel:!1};let o;if(o=r?Jn(r,(()=>(e.activationState.waitFor=void 0,n(s)))):n(s),Ut(o)&&i){let r;return new Promise((a=>{const u=()=>{o.then((t=>{e.activationState.persistedRetry=!1,a(t)})).catch((()=>{t.attemptNum++,r&&clearTimeout(r),s.cancel||(r=function(e,t,n){const r=function(e,t){const{backoff:n,delay:r=1e3,infinite:i,times:s=3,maxDelay:o=3e4}=e;return i||t<s?Math.min(r*("constant"===n?1:2**t),o):null}(e,t);if(r)return setTimeout(n,r)}(i,t.attemptNum,(()=>{o=n(s),u()})))})).finally((()=>{e.activationState.persistedRetry=!1}))};u()}))}return o},safeParse:rn,safeStringify:nn,set:cr,setAtPath:Dn,setNodeValue:un,symbolLinked:qt,symbolDelete:Wt,tracking:Vn},Ir="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function br(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rr={exports:{}},wr={},kr=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}(yt),Lr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Mr=kr.useState,Fr=kr.useEffect,xr=kr.useLayoutEffect,Br=kr.useDebugValue;function Pr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lr(e,n)}catch(e){return!0}}var Ur="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=Mr({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return xr((function(){i.value=n,i.getSnapshot=t,Pr(i)&&s({inst:i})}),[e,n,t]),Fr((function(){return Pr(i)&&s({inst:i}),e((function(){Pr(i)&&s({inst:i})}))}),[e]),Br(n),n};wr.useSyncExternalStore=void 0!==kr.useSyncExternalStore?kr.useSyncExternalStore:Ur,Rr.exports=wr;var Hr=Rr.exports,$r={inObserver:!1},jr=void 0;function Yr(e,t){if($r.inObserver&&on(e)&&!(null==t?void 0:t.suspense))return En(e);let n;try{const r=pe(jr||(jr=z(null))),i=he((()=>function(e,t){let n,r,i,s,o,a=0;const u=()=>{null==r||r();const{value:e,dispose:t,resubscribe:n}=Wn(i,l,void 0,void 0);return r=t,e},l=({value:r})=>{if(null==t?void 0:t.peek()){const e=o;o=r,void 0===e&&qn((()=>!t.get()),(()=>{const e=o;o=void 0,l({value:e})}))}else{let t=null==e?void 0:e.skipCheck;if(!t){const e=u();(e!==s||!xt(e)&&e===r)&&(t=!0)}t&&(a++,null==n||n())}};return{subscribe:e=>(n=e,()=>{null==r||r(),r=void 0}),getVersion:()=>a,run:e=>(i=e,s=u())}}(t,r)),[]),{subscribe:s,getVersion:o,run:a}=i;n=a(e),Hr.useSyncExternalStore(s,o,o)}catch(e){throw e}if(null==t?void 0:t.suspense){const t=Ut(n);if(Ut(n)||!n&&on(e)){const r=t?n:qn(e);if(!Ct.use)throw r;Ct.use(r)}}return n}function zr({children:e}){return Yr((()=>En(En(e))),{skipCheck:!0})}var Vr="function"==typeof Symbol&&Symbol.for;function Gr(e,t,n,r){const i=Vr?Symbol.for("react.forward_ref"):Fe((e=>null)).$$typeof,s=Vr?Symbol.for("react.memo"):ke((e=>null)).$$typeof;if(e.__legend_proxied)return e;let o=!1,a=!1,u=e;s&&u.$$typeof===s&&u.type&&(a=!0,u=u.type),i&&u.$$typeof===i&&(o=!0,u=u.render);const l={apply(e,i,s){if(n){const e=s[0],t={},n=Object.keys(e);for(let i=0;i<n.length;i++){const s=n[i],o=e[s];if("children"===s&&(Ft(o)||on(o)))e[s]=Yr(o,{skipCheck:!0});else if(s.startsWith("$")||s.endsWith("$")){const n=s.endsWith("$")?s.slice(0,-1):s.slice(1),i=null==r?void 0:r[n],a=i&&on(o);if(t[n]=a&&(null==i?void 0:i.selector)?i.selector(t,o):Yr(o),a&&(void 0!==i.defaultValue&&void 0===t[n]&&(t[n]=i.defaultValue),i.handler&&i.getValue)){const n=t=>{var n;o.set(i.getValue(t)),null==(n=e[i.handler])||n.call(e,t)};t[i.handler]=de(n,[e[i.handler],r])}delete t[s]}else void 0===t[s]&&(t[s]=o)}s[0]=t}return t?Yr((()=>{$r.inObserver=!0;try{return Reflect.apply(e,i,s)}finally{$r.inObserver=!1}}),{skipCheck:!0}):Reflect.apply(e,i,s)}},c=new Proxy(u,l);let h;return o?(h=Fe(c),h.__legend_proxied=!0):h=c,t||a?ke(h):h}var{findIDKey:Wr,getNode:Xr,optimized:Kr}=Nr,qr=new Map;function Jr({each:e,optimized:t,item:n,itemProps:r,sortValues:i,children:s}){var o;if(!e)return null;const a=Yr((()=>e.get(!t||Kr)));if(!n&&s){const e=le();e.current=s,n=he((()=>{return t=({item$:t,id:n})=>e.current(t,n),Gr(t,!0);var t}),[])}else if(n.$$typeof!==Symbol.for("react.memo")){let e=qr.get(n);e||(e=ke(n),qr.set(n,e)),n=e}if(!a)return null;const u=[];if(Lt(a)){const t=a[0],i=Xr(e),s=a.length,l=s>0?i&&Wr(t,i)||(void 0!==t.id?"id":void 0!==t.key?"key":void 0):void 0,c=Ft(l);for(let h=0;h<s;h++)if(a[h]){const t=a[h],i=null!=(o=c?l(t):t[l])?o:h,s=e[h],d={key:i,id:i,item$:s,item:s};u.push(_(n,r?Object.assign(d,r):d))}}else{const t=Ht(a),s=t?Array.from(a.keys()):Object.keys(a);i&&s.sort(((e,n)=>i(t?a.get(e):a[e],t?a.get(n):a[n],e,n)));for(let i=0;i<s.length;i++){const o=s[i];if(t?a.get(o):a[o]){const i=t?e.get(o):e[o],s={key:o,id:o,item$:i,item:i};u.push(_(n,r?Object.assign(s,r):s))}}}return u}ke(zr,(()=>!0));var Zr=new Map,Qr=new Map;function ei({if:e,ifReady:t,else:n,wrap:r,children:i}){const s=Yr(null!=e?e:t),o=Yr((void 0!==t?Tn(s):s)?Ft(i)?()=>i(s):i:null!=n?n:null,{skipCheck:!0});return r?_(r,void 0,o):o}function ti(e,t){var n;const r=le({});if(r.current.value=e,!(null==(n=r.current)?void 0:n.obs$)){const t=e;r.current.obs$=yr(t)}return r.current.obs$}new Proxy({},{get(e,t){if(!e[t]){const n=Zr.get(t)||t,r=Fe(((e,t)=>{const r={...e};return!t||!Ft(t)&&$t(t)||(r.ref=t),_(n,r)}));e[t]=Gr(r,!1,!0,Qr.get(t))}return e[t]}});function ni(e,t,n){let r;Ft(t)?r=t:n=t;const i=le({selector:e});i.current={selector:e,reaction:r},function(e){ae((()=>{const t=e();if(!Ut(t))return t}),[])}((()=>Xn((e=>{const{selector:t}=i.current;return Ft(t)?t(e):t}),(e=>{var t,n;return null==(n=(t=i.current).reaction)?void 0:n.call(t,e)}),n)))}class ri extends Error{}function ii(e,t){if(!e)throw new ri(t??"Assertion failed")}const si=Object.assign(ii,{is:function(e,t,n){return ii(t,n)},unreachable:function(){throw new Error("Unreachable code")},keyNonNullable:function(e,t){if(!(t in e))throw new ri(`Missing key "${t}"`);if(null==e[t])throw new ri(`Key "${t}" is null or undefined`)},insideObservingContext:function(){if(!Vn.current)throw new Error("You aren't inside an observing context")},never:function(e){throw new Error("Unreachable")},defined:function(e){if(null==e)throw new ri("Value is not defined")}}),oi=z(void 0),ai=pi(oi),ui=z(void 0),li=pi(ui),ci=z(void 0),hi=pi(ci),di=z(void 0);function pi(e){return()=>{const t=pe(e);return si(void 0!==t),t}}z(di);const fi=["top","right","bottom","left"],mi=Math.min,Ei=Math.max,gi=Math.round,Ai=Math.floor,_i=e=>({x:e,y:e}),Di={left:"right",right:"left",bottom:"top",top:"bottom"},vi={start:"end",end:"start"};function Ti(e,t,n){return Ei(e,mi(t,n))}function Oi(e,t){return"function"==typeof e?e(t):e}function Si(e){return e.split("-")[0]}function Ci(e){return e.split("-")[1]}function yi(e){return"x"===e?"y":"x"}function Ni(e){return"y"===e?"height":"width"}function Ii(e){return["top","bottom"].includes(Si(e))?"y":"x"}function bi(e){return yi(Ii(e))}function Ri(e){return e.replace(/start|end/g,(e=>vi[e]))}function wi(e){return e.replace(/left|right|bottom|top/g,(e=>Di[e]))}function ki(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Li(e,t,n){let{reference:r,floating:i}=e;const s=Ii(t),o=bi(t),a=Ni(o),u=Si(t),l="y"===s,c=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let p;switch(u){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:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}switch(Ci(t)){case"start":p[o]-=d*(n&&l?-1:1);break;case"end":p[o]+=d*(n&&l?-1:1)}return p}async function Mi(e,t){var n;void 0===t&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:u}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:h="floating",altBoundary:d=!1,padding:p=0}=Oi(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(p),m=a[d?"floating"===h?"reference":"floating":h],E=ki(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(m)))||n?m:m.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:u})),g="floating"===h?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,A=await(null==s.getOffsetParent?void 0:s.getOffsetParent(a.floating)),_=await(null==s.isElement?void 0:s.isElement(A))&&await(null==s.getScale?void 0:s.getScale(A))||{x:1,y:1},D=ki(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:A,strategy:u}):g);return{top:(E.top-D.top+f.top)/_.y,bottom:(D.bottom-E.bottom+f.bottom)/_.y,left:(E.left-D.left+f.left)/_.x,right:(D.right-E.right+f.right)/_.x}}function Fi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xi(e){return fi.some((t=>e[t]>=0))}function Bi(e){return Hi(e)?(e.nodeName||"").toLowerCase():"#document"}function Pi(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ui(e){var t;return null==(t=(Hi(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Hi(e){return e instanceof Node||e instanceof Pi(e).Node}function $i(e){return e instanceof Element||e instanceof Pi(e).Element}function ji(e){return e instanceof HTMLElement||e instanceof Pi(e).HTMLElement}function Yi(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Pi(e).ShadowRoot)}function zi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=qi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Vi(e){return["table","td","th"].includes(Bi(e))}function Gi(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Wi(e){const t=Xi(),n=$i(e)?qi(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Xi(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ki(e){return["html","body","#document"].includes(Bi(e))}function qi(e){return Pi(e).getComputedStyle(e)}function Ji(e){return $i(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zi(e){if("html"===Bi(e))return e;const t=e.assignedSlot||e.parentNode||Yi(e)&&e.host||Ui(e);return Yi(t)?t.host:t}function Qi(e){const t=Zi(e);return Ki(t)?e.ownerDocument?e.ownerDocument.body:e.body:ji(t)&&zi(t)?t:Qi(t)}function es(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Qi(e),s=i===(null==(r=e.ownerDocument)?void 0:r.body),o=Pi(i);return s?t.concat(o,o.visualViewport||[],zi(i)?i:[],o.frameElement&&n?es(o.frameElement):[]):t.concat(i,es(i,[],n))}function ts(e){const t=qi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ji(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=gi(n)!==s||gi(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function ns(e){return $i(e)?e:e.contextElement}function rs(e){const t=ns(e);if(!ji(t))return _i(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=ts(t);let o=(s?gi(n.width):n.width)/r,a=(s?gi(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}const is=_i(0);function ss(e){const t=Pi(e);return Xi()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:is}function as(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),s=ns(e);let o=_i(1);t&&(r?$i(r)&&(o=rs(r)):o=rs(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Pi(e))&&t}(s,n,r)?ss(s):_i(0);let u=(i.left+a.x)/o.x,l=(i.top+a.y)/o.y,c=i.width/o.x,h=i.height/o.y;if(s){const e=Pi(s),t=r&&$i(r)?Pi(r):r;let n=e,i=n.frameElement;for(;i&&r&&t!==n;){const e=rs(i),t=i.getBoundingClientRect(),r=qi(i),s=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;u*=e.x,l*=e.y,c*=e.x,h*=e.y,u+=s,l+=o,n=Pi(i),i=n.frameElement}}return ki({width:c,height:h,x:u,y:l})}function us(e){return as(Ui(e)).left+Ji(e).scrollLeft}function ls(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Pi(e),r=Ui(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,u=0;if(i){s=i.width,o=i.height;const e=Xi();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,u=i.offsetTop)}return{width:s,height:o,x:a,y:u}}(e,n);else if("document"===t)r=function(e){const t=Ui(e),n=Ji(e),r=e.ownerDocument.body,i=Ei(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ei(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+us(e);const a=-n.scrollTop;return"rtl"===qi(r).direction&&(o+=Ei(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}(Ui(e));else if($i(t))r=function(e,t){const n=as(e,!0,"fixed"===t),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ji(e)?rs(e):_i(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:r*s.y}}(t,n);else{const n=ss(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return ki(r)}function cs(e,t){const n=Zi(e);return!(n===t||!$i(n)||Ki(n))&&("fixed"===qi(n).position||cs(n,t))}function hs(e,t,n){const r=ji(t),i=Ui(t),s="fixed"===n,o=as(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=_i(0);if(r||!r&&!s)if(("body"!==Bi(t)||zi(i))&&(a=Ji(t)),r){const e=as(t,!0,s,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else i&&(u.x=us(i));return{x:o.left+a.scrollLeft-u.x,y:o.top+a.scrollTop-u.y,width:o.width,height:o.height}}function ds(e){return"static"===qi(e).position}function ps(e,t){return ji(e)&&"fixed"!==qi(e).position?t?t(e):e.offsetParent:null}function fs(e,t){const n=Pi(e);if(Gi(e))return n;if(!ji(e)){let t=Zi(e);for(;t&&!Ki(t);){if($i(t)&&!ds(t))return t;t=Zi(t)}return n}let r=ps(e,t);for(;r&&Vi(r)&&ds(r);)r=ps(r,t);return r&&Ki(r)&&ds(r)&&!Wi(r)?n:r||function(e){let t=Zi(e);for(;ji(t)&&!Ki(t);){if(Wi(t))return t;if(Gi(t))return null;t=Zi(t)}return null}(e)||n}const ms={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s="fixed"===i,o=Ui(r),a=!!t&&Gi(t.floating);if(r===o||a&&s)return n;let u={scrollLeft:0,scrollTop:0},l=_i(1);const c=_i(0),h=ji(r);if((h||!h&&!s)&&(("body"!==Bi(r)||zi(o))&&(u=Ji(r)),ji(r))){const e=as(r);l=rs(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-u.scrollLeft*l.x+c.x,y:n.y*l.y-u.scrollTop*l.y+c.y}},getDocumentElement:Ui,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s="clippingAncestors"===n?Gi(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=es(e,[],!1).filter((e=>$i(e)&&"body"!==Bi(e))),i=null;const s="fixed"===qi(e).position;let o=s?Zi(e):e;for(;$i(o)&&!Ki(o);){const t=qi(o),n=Wi(o);n||"fixed"!==t.position||(i=null),(s?!n&&!i:!n&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||zi(o)&&!n&&cs(e,o))?r=r.filter((e=>e!==o)):i=t,o=Zi(o)}return t.set(e,r),r}(t,this._c):[].concat(n),o=[...s,r],a=o[0],u=o.reduce(((e,n)=>{const r=ls(t,n,i);return e.top=Ei(r.top,e.top),e.right=mi(r.right,e.right),e.bottom=mi(r.bottom,e.bottom),e.left=Ei(r.left,e.left),e}),ls(t,a,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:fs,getElementRects:async function(e){const t=this.getOffsetParent||fs,n=this.getDimensions,r=await n(e.floating);return{reference:hs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ts(e);return{width:t,height:n}},getScale:rs,isElement:$i,isRTL:function(e){return"rtl"===qi(e).direction}};const Es=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,u=await async function(e,t){const{placement:n,platform:r,elements:i}=e,s=await(null==r.isRTL?void 0:r.isRTL(i.floating)),o=Si(n),a=Ci(n),u="y"===Ii(n),l=["left","top"].includes(o)?-1:1,c=s&&u?-1:1,h=Oi(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:f}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&"number"==typeof f&&(p="end"===a?-1*f:f),u?{x:p*c,y:d*l}:{x:d*l,y:p*c}}(t,e);return o===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},gs=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=Oi(e,t),l={x:n,y:r},c=await Mi(t,u),h=Ii(Si(i)),d=yi(h);let p=l[d],f=l[h];if(s){const e="y"===d?"bottom":"right";p=Ti(p+c["y"===d?"top":"left"],p,p-c[e])}if(o){const e="y"===h?"bottom":"right";f=Ti(f+c["y"===h?"top":"left"],f,f-c[e])}const m=a.fn({...t,[d]:p,[h]:f});return{...m,data:{x:m.x-n,y:m.y-r}}}}},As=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:u,elements:l}=t,{mainAxis:c=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...E}=Oi(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const g=Si(i),A=Ii(a),_=Si(a)===a,D=await(null==u.isRTL?void 0:u.isRTL(l.floating)),v=d||(_||!m?[wi(a)]:function(e){const t=wi(e);return[Ri(e),t,Ri(t)]}(a)),T="none"!==f;!d&&T&&v.push(...function(e,t,n,r){const i=Ci(e);let s=function(e,t,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?s:o;default:return[]}}(Si(e),"start"===n,r);return i&&(s=s.map((e=>e+"-"+i)),t&&(s=s.concat(s.map(Ri)))),s}(a,m,f,D));const O=[a,...v],S=await Mi(t,E),C=[];let y=(null==(r=s.flip)?void 0:r.overflows)||[];if(c&&C.push(S[g]),h){const e=function(e,t,n){void 0===n&&(n=!1);const r=Ci(e),i=bi(e),s=Ni(i);let o="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=wi(o)),[o,wi(o)]}(i,o,D);C.push(S[e[0]],S[e[1]])}if(y=[...y,{placement:i,overflows:C}],!C.every((e=>e<=0))){var N,I;const e=((null==(N=s.flip)?void 0:N.index)||0)+1,t=O[e];if(t)return{data:{index:e,overflows:y},reset:{placement:t}};let n=null==(I=y.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:I.placement;if(!n)switch(p){case"bestFit":{var b;const e=null==(b=y.filter((e=>{if(T){const t=Ii(e.placement);return t===A||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:b[0];e&&(n=e);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},_s=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Oi(e,t);switch(r){case"referenceHidden":{const e=Fi(await Mi(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xi(e)}}}case"escaped":{const e=Fi(await Mi(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xi(e)}}}default:return{}}}}};function Ds({conversation$:e,message$:t,currentUser$:n,t$:r,scrollableParentRef:i,onScrollOutOfView:s,controller:o,theme:a,themeCustom:u}){const l=le(null),c=hi();return ni((e=>{const r=l.current,o=i.current;if(!r||!o)return;const a=t.id.get();if(!a)return;const u=c.messageToMessageActionMenuAnchorMap.get(a);if(!u)return;r.style.zIndex="2",r.style.width="max-content",r.style.position="absolute",r.style.top="0",r.style.left="0";const h=function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:u=!1}=r,l=ns(e),c=i||s?[...l?es(l):[],...es(t)]:[];c.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),s&&e.addEventListener("resize",n)}));const h=l&&a?function(e,t){let n,r=null;const i=Ui(e);function s(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function o(a,u){void 0===a&&(a=!1),void 0===u&&(u=1),s();const{left:l,top:c,width:h,height:d}=e.getBoundingClientRect();if(a||t(),!h||!d)return;const p={rootMargin:-Ai(c)+"px "+-Ai(i.clientWidth-(l+h))+"px "+-Ai(i.clientHeight-(c+d))+"px "+-Ai(l)+"px",threshold:Ei(0,mi(1,u))||1};let f=!0;function m(e){const t=e[0].intersectionRatio;if(t!==u){if(!f)return o();t?o(!1,t):n=setTimeout((()=>{o(!1,1e-7)}),1e3)}f=!1}try{r=new IntersectionObserver(m,{...p,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(m,p)}r.observe(e)}(!0),s}(l,n):null;let d,p=-1,f=null;o&&(f=new ResizeObserver((e=>{let[r]=e;r&&r.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=f)||e.observe(t)}))),n()})),l&&!u&&f.observe(l),f.observe(t));let m=u?as(e):null;return u&&function t(){const r=as(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach((e=>{i&&e.removeEventListener("scroll",n),s&&e.removeEventListener("resize",n)})),null==h||h(),null==(e=f)||e.disconnect(),f=null,u&&cancelAnimationFrame(d)}}(u,r,(()=>{((e,t,n)=>{const r=new Map,i={platform:ms,...n},s={...i.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),u=await(null==o.isRTL?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:h}=Li(l,r,u),d=r,p={},f=0;for(let m=0;m<a.length;m++){const{name:n,fn:s}=a[m],{x:E,y:g,data:A,reset:_}=await s({x:c,y:h,initialPlacement:r,placement:d,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});c=null!=E?E:c,h=null!=g?g:h,p={...p,[n]:{...p[n],...A}},_&&f<=50&&(f++,"object"==typeof _&&(_.placement&&(d=_.placement),_.rects&&(l=!0===_.rects?await o.getElementRects({reference:e,floating:t,strategy:i}):_.rects),({x:c,y:h}=Li(l,d,u))),m=-1)}return{x:c,y:h,placement:d,strategy:i,middlewareData:p}})(e,t,{...i,platform:s})})(u,r,{placement:n.id.peek()===t.sender.id.peek()?"bottom-end":"bottom-start",middleware:[Es(6),As({boundary:o}),gs({padding:5,boundary:o}),_s({padding:5})]}).then((({x:e,y:t,middlewareData:n})=>{n.hide?.referenceHidden?s():(r.style.left=`${e}px`,r.style.top=`${t}px`)}))}));e.onCleanup=h})),It("div",{className:"t-message-action-menu-wrapper",ref:l,"t-message-action-menu-keep-open":"true",children:It(a.MessageActionMenu,{currentUser:n.get(),permissions:c.messagePermissions$(t.get()).get(),t:r.get(),chatbox:o,message:t.get(),conversation:e.get(),themeCustom:u})})}function vs(e){const t=le(),n=ai(),r=hi();return ae((()=>{if(t.current)return t.current.setAttribute("t-message-action-menu-keep-open","true"),r.messageToMessageActionMenuAnchorMap.set(e.message.id,t.current),()=>{r.messageToMessageActionMenuAnchorMap.delete(e.message.id)}}),[r,e.message.id]),It(n.Message,{...e,messageActionMenuAnchorRef:t})}class Ts{constructor(e={}){this._handlers=new Set,this._meta=e}meta(e){return new Ts(e)}_emit(e,t){for(const n of this._handlers)n({level:e,data:t,timestamp:Date.now(),meta:this._meta})}error(...e){return this._emit("error",e)}warn(...e){return this._emit("warn",e)}info(...e){return this._emit("info",e)}log(...e){return this._emit("log",e)}trace(...e){return this._emit("trace",e)}registerHandler(e){return this._handlers.add(e),()=>this._handlers.delete(e)}}const Os=new Ts,Ss=new Ts,Cs={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:e=>`${e} 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:(e,t)=>`Replying to ${e}: ${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"}},ys={code:"ar",name:"Arabic",translation:{YESTERDAY:"الأمس",TODAY:"اليوم",DAYS:"يوم",HOURS:"ساعة",MINUTES:"دقيقة",JUST_NOW:"فقط الآن",LOCATION:"الموقع",CANCEL:"إلغاء",INBOX:"علبة الوارد",DESKTOP_NOTIFICATIONS:"إشعارات المتصفح",DESKTOP_NOTIFICATIONS_ERROR:"لا يمكن تمكين إشعارات المتصفح لأن متصفحك يمنعها بشكل نشط. جرّب البحث في الإعدادات أو استخدام متصفح آخر.",DESKTOP_NOTIFICATIONS_DEMO_TITLE:e=>`إعلام ${e} التجريبي`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ns={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:e=>`${e} демо известие`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Is={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},bs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Rs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ws={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ks={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:e=>`${e} Δοκιμαστική επίδειξη`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ls={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Fs={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:e=>`نوتیفیکیشن دمو ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},xs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Bs={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:e=>`Notification de démonstration ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ps={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:e=>`${e} הודעה על הדגמה`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Us={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:e=>`${e} डेमो अधिसूचना`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Hs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},$s={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},js={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:e=>`pemberitahuan demo ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ys={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},zs={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:e=>`${e} デモ通知`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Vs={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:e=>`${e} შეტყობინებების დემო ვერსია`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Gs={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:e=>`${e} 데모 알림`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Xs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Ks={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},qs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Js={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:e=>`Notificare de debit ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Zs={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:e=>`${e} демо-оповещение`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},Qs={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},eo={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},to={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},no={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:e=>`Демо-повідомлення про ${e}`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},ro={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:e=>`${e} 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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},io={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:e=>`${e} 演示提醒`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},so={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:e=>`${e} 演示通知`,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:Cs.translation.REPLY_TO_ARIA_LABEL,REPLY_MODE_LEAVE_ARIA_LABEL:Cs.translation.REPLY_MODE_LEAVE_ARIA_LABEL,STATUS_INDICATOR_ONLINE:Cs.translation.STATUS_INDICATOR_ONLINE,STATUS_INDICATOR_OFFLINE:Cs.translation.STATUS_INDICATOR_OFFLINE}},oo={ar:ys,bg:Ns,bs:Is,ca:{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:e=>`Notificació de demostració de ${e}`,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:(e,t)=>`Responent a ${e}: ${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:bs,da:Rs,de:ws,el:ks,en:Cs,es:Ls,et:Ms,fa:Fs,fi:xs,fr:Bs,he:Ps,hi:Us,hr:Hs,hu:$s,id:js,is:{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:e=>`${e} 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:(e,t)=>`Svara ${e}: ${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"}},it:Ys,ja:zs,ka:Vs,ko:Gs,nb:Ws,nl:Xs,pl:Ks,pt:qs,ro:Js,ru:Zs,sq:Qs,sr:{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:e=>`${e} 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:(e,t)=>`Odgovarate korisniku ${e}: ${t}`,REPLY_MODE_LEAVE_ARIA_LABEL:"Izađi iz moda pisanja odgovora",STATUS_INDICATOR_ONLINE:"Aktivan",STATUS_INDICATOR_OFFLINE:"Neaktivan"}},sv:eo,tr:to,uk:no,vi:ro,zh:io,zhTw:so},ao={canReplyToMessage:!1,canDeleteMessage:!1};class uo{constructor(){this.messageSubscription=null,this.readyForNewMessagesPromise=Promise.resolve(),this.participantSubscription=null,this.state$=yr({extUserId:null,extCurrentConversationId:null,appId:null,editor:{isEmpty:!0,isTyping:!1,atTextLimit:!1,characterCount:0},referencedMessageId:null,currentUser:null,currentConversation:null,app:null,errors:{unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1},messages:{},participants:{},typing:{},ephemeralMessages:{},ephemeralMessageIdMapping:{},localFileBlobUrls:{},activeMessageActionMenu:null,authTokenState:"idle",userPermissions:()=>{const e=this.state$.app.role.general.get(),t=this.state$.app.role.permissions.get();return si.defined(e),si.defined(t),{showTypingIndicator:e.showTypingIndicators,canShareFile:e.enableFileTransfers,canShareLocation:e.enableLocation,canMention:e.enableMentions,showOnlineStatus:!1!==e.enablePresence,canSendVoiceMessage:e.enableVoiceRecording,canLeaveConversation:"all"===t.conversations.leave,canMarkConversationAsUnread:"all"===t.conversations.markAsUnread}},messagePermissions:()=>{const e=this.state$.app.role.permissions.get();si.defined(e);const t=this.state$.userPermissions.get();return{system:{...ao,...t},own:{canReplyToMessage:lo(e.messages.reply,!0),canDeleteMessage:lo(e.messages.delete,!0),...t},other:{canReplyToMessage:lo(e.messages.reply,!1),canDeleteMessage:lo(e.messages.delete,!1),...t}}},themeCustom:gn({value:void 0})}),this.messageToMessageActionMenuAnchorMap=new Map,this.locale$=yr((()=>{const e=this.state$.extUserId.get(),t=this.state$.app.appMetadata.defaultLocale.get(),n=this.state$.currentUser.locale.get();return(e&&n)??t??"en-US"})),this.t$=yr((()=>function(e){const t=e.replace(/_/g,"-").toLowerCase(),n=oo[t];if(n)return{...n.translation,locale:t};const r=t.slice(0,2),i=oo[r];return i?{...i.translation,locale:r}:(Ss.warn(`User locale '${e}' not supported; falling back to English.`),{...Cs.translation,locale:"en-US"})}(this.locale$.get()))),this.referencedMessage$=yr((()=>{const e=this.state$.extCurrentConversationId.get(),t=this.state$.referencedMessageId.get();return e&&t?this.state$.messages.child(e).lookup.child(t).get():null})),this.chatItems$=yr((()=>{const e=this.state$.extCurrentConversationId.get();if(!e)return[];const t=this.state$.currentConversation.readUntil.get(),n=this.state$.messages.child(e).state.get()??[],r=Object.values(this.state$.ephemeralMessages.child(e).get()??{}),i=0===r.length?n:r.concat(n).sort(((e,t)=>t.createdAt-e.createdAt)),s=i.map((t=>{const n=t.content[0],r=n?.type;if(!n||"file"!==r)return t;const i=n.size+","+n.filename,s=this.state$.localFileBlobUrls.child(e).child(i).url.get();return s?{...t,content:[{...n,url:s}]}:t}));let o=null,a=0,u=!1;const l=[];for(const c of s){const e=new Date(c.createdAt),n=new Date(e).setHours(0,0,0,0),r=a&&n!==a,i=e.getTime()>t,s=!(!u||i||o?.id.startsWith("ephemeral"));(s||r)&&l.push(new co({id:"border-before-"+c.id,isDayMarker:!!r,isReadMarker:!!s,timestamp:r?a:void 0})),l.push(c),u=i,a=n,o=c}return function(e,t){const n=[];let r=[];const i=Symbol("NO_KEY");let s=i;for(const o of e){const e=t(o);s===i||s===e?r.push(o):(n.push(r),r=[o]),s=e}return 0!==r.length&&n.push(r),n}(l,(e=>e instanceof co?e.id:e.sender?.id)).map((e=>(e.id=e.map((e=>e.id)).join(","),e)))}))}resetState(e,t,n){this.state$.assign({activeMessageActionMenu:null,referencedMessageId:null,errors:{unknownConversation:!1,unknownUser:!1,wrongAppId:!1,serverError:!1},extUserId:t,extCurrentConversationId:n,appId:e,currentUser:null,currentConversation:null})}storeTyping(e,t){this.state$.typing.child(e).set(t)}userPermissions$(){return this.state$.userPermissions}messagePermissions$(e){const t=this.state$.currentUser.get();if(!t)throw new Error("Unreachable");return e.sender?t.id===e.sender.id?this.state$.messagePermissions.own:this.state$.messagePermissions.other:this.state$.messagePermissions.system}storeMessages(e,t,n){!function(e){xn();try{e()}finally{Bn()}}((()=>{const r=t.reduce(((e,t)=>(e[t.id]=t,e)),{}),i=this.state$.extCurrentConversationId.peek(),s=this.state$.extUserId.peek();si(s&&i),this.state$.messages.child(e).set({state:t,lookup:r,loadedAll:n});const o=this.state$.activeMessageActionMenu.peek();o&&!r[o]&&this.state$.activeMessageActionMenu.set(null);const a=this.state$.ephemeralMessages.child(e);for(const n of t){const t=this.state$.ephemeralMessageIdMapping.child(e).child(n.id).peek();t&&a.child(t).delete();const r=n.content[0];if(n.sender?.id!==s||"file"!==r.type)continue;const o=r.size+","+r.filename,u=this.state$.localFileBlobUrls.child(i).child(o);if(!1!==u.fetching.peek())continue;const l=()=>u.delete();if("image"===r.subtype){u.fetching.set(!0);const e=document.createElement("img");e.addEventListener("load",l,{once:!0}),e.src=r.url}else if("video"===r.subtype){u.fetching.set(!0);const e=document.createElement("video");e.addEventListener("loaddata",l,{once:!0}),e.src=r.url}else if("audio"===r.subtype){u.fetching.set(!0);const e=document.createElement("audio");e.addEventListener("loaddata",l,{once:!0}),e.src=r.url}}}))}messageStatus(e){const t=this.state$.extCurrentConversationId.get(),n=this.state$.messages.child(t).lookup.child(e).get(),r=this.state$.ephemeralMessages.child(t).child(e).get();if(si(n||r,"Message ID should be present in the store"),n){const e=this.state$.currentConversation.everyoneReadUntil.peek();return n.createdAt<=e?"everyoneRead":"sent"}return"sending"}}function lo(e,t){return"all"===e||"own"===e&&t||"other"===e&&!t}class co{constructor({id:e,isDayMarker:t,isReadMarker:n,timestamp:r}){this.id=e,this.isDayMarker=t,this.isReadMarker=n,this.timestamp=t?r:void 0}}function ho({extConversationId:e,controller:t}){const n=hi(),r=ai(),i=le(null),s=le(!0),o=ti((()=>{const t=n.state$.activeMessageActionMenu.get();return t&&n.state$.messages.child(e).lookup.child(t).get()}));ue((()=>{s.current=i.current.scrollTop>-30})),ae((()=>{s.current&&(i.current.scrollTop=0)}));const a=de((e=>{const t=e.currentTarget;t.scrollHeight-t.clientHeight+t.scrollTop<90&&n.messageSubscription&&n.messageSubscription.loadMore(10)}),[n.messageSubscription]),u=Yr(n.state$.typing.child(e));return It("div",{className:"t-message-list",ref:i,onScroll:a,children:[u&&It(r.MessageListFooter,{typing:u,t:n.t$.get(),conversation:n.state$.currentConversation.get(),currentUser:n.state$.currentUser.get(),participants:n.state$.participants.child(e).get(),chatbox:t,themeCustom:n.state$.themeCustom.get().value}),It(Jr,{each:n.chatItems$,children:n=>It("div",{className:"t-message-group",children:It(Jr,{each:n,item:po,itemProps:{controller:t,extConversationId:e}})})}),It(ei,{if:o,children:()=>It(Ds,{currentUser$:n.state$.currentUser,message$:o,conversation$:n.state$.currentConversation,scrollableParentRef:i,t$:n.t$,onScrollOutOfView:()=>n.state$.activeMessageActionMenu.set(null),controller:t,theme:r,themeCustom:n.state$.themeCustom.get().value})})]})}function po({item$:e,controller:t,extConversationId:n}){const r=ai(),i=hi(),s=Yr(e);return It(zr,s instanceof co?{children:()=>It(r.MessageDivider,{timestamp:s.timestamp,isReadMarker:s.isReadMarker,isDayMarker:s.isDayMarker,app:i.state$.app.appMetadata.get(),currentUser:i.state$.currentUser.get(),conversation:i.state$.currentConversation.get(),t:i.t$.get(),themeCustom:i.state$.themeCustom.get().value})}:{children:()=>It(vs,{app:i.state$.app.appMetadata.get(),currentUser:i.state$.currentUser.get(),message:s,messageStatus:i.messageStatus(s.id),conversation:i.state$.currentConversation.get(),participants:i.state$.participants.child(n).get(),t:i.t$.get(),permissions:i.messagePermissions$(s).get(),chatbox:t,themeCustom:i.state$.themeCustom.get().value})})}function fo(){const e=hi(),t=ai(),n=Yr(e.t$),r=Yr(e.state$.themeCustom).value;return It(t.Icon,{type:"spinner","aria-label":n.LOADING,className:"t-loading-icon",themeCustom:r})}const mo=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function Eo({appId:e,chatboxState:t}){const n="t"===e.charAt(0)||mo.has(e);return ae((()=>{switch(t.type){case"auth-failed":Ss.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":Ss.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":Ss.error(t.error);break;case"wrong-app-id":Ss.error(`Could not find given appId: "${t.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:si.never(t)}}),[t]),It("div",{className:"t-panel t-error-panel",children:[It("span",{className:"t-heading",children:"Something went wrong."}),It("p",{children:"Please reload the page and try again."}),It("p",n?{style:{fontStyle:"italic"},children:["Developer note: check your browser's developer tools console for messages that may help solve the problem.",It("br",{}),It("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 go({t:e}){return It("div",{className:"t-panel t-error-panel",children:It("span",{className:"t-heading",style:{fontStyle:"italic"},children:e.CHAT_NOT_FOUND})})}function Ao(){return It("div",{className:"t-panel t-loading-panel",children:It(fo,{})})}function _o({t:e}){return It("div",{className:"t-panel t-error-panel",children:[It("span",{className:"t-heading",style:{fontStyle:"italic"},children:e.AUTH_EXPIRED_OVERLAY_TITLE}),It("p",{children:e.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}function Do(e){this.content=e}function vo(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),s=t.child(r);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let e=0;i.text[e]==s.text[e];e++)n++;return n}if(i.content.size||s.content.size){let e=vo(i.content,s.content,n+1);if(null!=e)return e}n+=i.nodeSize}else n+=i.nodeSize}}function To(e,t,n,r){for(let i=e.childCount,s=t.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:r};let o=e.child(--i),a=t.child(--s),u=o.nodeSize;if(o!=a){if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let e=0,t=Math.min(o.text.length,a.text.length);for(;e<t&&o.text[o.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let e=To(o.content,a.content,n-1,r-1);if(e)return e}n-=u,r-=u}else n-=u,r-=u}}Do.prototype={constructor:Do,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),s=r.content.slice();return-1==i?s.push(n||e,t):(s[i+1]=t,n&&(s[i]=n)),new Do(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Do(n)},addToStart:function(e,t){return new Do([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Do(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),s=r.find(e);return i.splice(-1==s?i.length:s,0,t,n),new Do(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Do.from(e)).size?new Do(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Do.from(e)).size?new Do(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Do.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},Do.from=function(e){if(e instanceof Do)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Do(t)};class Oo{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,i){for(let s=0,o=0;o<t;s++){let a=this.content[s],u=o+a.nodeSize;if(u>e&&!1!==n(a,r+o,i||null,s)&&a.content.size){let i=o+1;a.nodesBetween(Math.max(0,e-i),Math.min(a.content.size,t-i),n,r+i)}o=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",s=!0;return this.nodesBetween(e,t,((o,a)=>{let u=o.isText?o.text.slice(Math.max(e,a)-a,t-a):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&u||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=u}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Oo(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let o=this.content[i],a=s+o.nodeSize;a>e&&((s<e||a>t)&&(o=o.isText?o.cut(Math.max(0,e-s),Math.min(o.text.length,t-s)):o.cut(Math.max(0,e-s-1),Math.min(o.content.size,t-s-1))),n.push(o),r+=o.nodeSize),s=a}return new Oo(n,r)}cutByIndex(e,t){return e==t?Oo.empty:0==e&&t==this.content.length?this:new Oo(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Oo(r,i)}addToStart(e){return new Oo([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Oo(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return vo(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return To(this,e,t,n)}findIndex(e,t=-1){if(0==e)return Co(0,e);if(e==this.size)return Co(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=r+this.child(n).nodeSize;if(i>=e)return i==e||t>0?Co(n+1,i):Co(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Oo.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Oo(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Oo.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Oo(t||e,n)}static from(e){if(!e)return Oo.empty;if(e instanceof Oo)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Oo([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Oo.empty=new Oo([],0);const So={index:0,offset:0};function Co(e,t){return So.index=e,So.offset=t,So}function yo(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!yo(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!yo(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class No{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&yo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return No.none;if(e instanceof No)return[e];let t=e.slice();return t.sort(((e,t)=>e.type.rank-t.type.rank)),t}}No.none=[];class Io extends Error{}class bo{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=wo(this.content,e+this.openStart,t);return n&&new bo(n,this.openStart,this.openEnd)}removeBetween(e,t){return new bo(Ro(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return bo.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new bo(Oo.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)n++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new bo(e,n,r)}}function Ro(e,t,n){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r),{index:o,offset:a}=e.findIndex(n);if(i==t||s.isText){if(a!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(Ro(s.content,t-i-1,n-i-1)))}function wo(e,t,n,r){let{index:i,offset:s}=e.findIndex(t),o=e.maybeChild(i);if(s==t||o.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=wo(o.content,t-s-1,n);return a&&e.replaceChild(i,o.copy(a))}function ko(e,t,n){if(n.openStart>e.depth)throw new Io("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Io("Inconsistent open depths");return Lo(e,t,n,0)}function Lo(e,t,n,r){let i=e.index(r),s=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Lo(e,t,n,r+1);return s.copy(s.content.replaceChild(i,o))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:i,end:o}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)r=t.node(i).copy(Oo.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Po(s,Uo(e,i,o,t,r))}{let r=e.parent,i=r.content;return Po(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}}return Po(s,Ho(e,t,r))}function Mo(e,t){if(!t.type.compatibleContent(e.type))throw new Io("Cannot join "+t.type.name+" onto "+e.type.name)}function Fo(e,t,n){let r=e.node(n);return Mo(r,t.node(n)),r}function xo(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Bo(e,t,n,r){let i=(t||e).node(n),s=0,o=t?t.index(n):i.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(xo(e.nodeAfter,r),s++));for(let a=s;a<o;a++)xo(i.child(a),r);t&&t.depth==n&&t.textOffset&&xo(t.nodeBefore,r)}function Po(e,t){return e.type.checkContent(t),e.copy(t)}function Uo(e,t,n,r,i){let s=e.depth>i&&Fo(e,t,i+1),o=r.depth>i&&Fo(n,r,i+1),a=[];return Bo(null,e,i,a),s&&o&&t.index(i)==n.index(i)?(Mo(s,o),xo(Po(s,Uo(e,t,n,r,i+1)),a)):(s&&xo(Po(s,Ho(e,t,i+1)),a),Bo(t,n,i,a),o&&xo(Po(o,Ho(n,r,i+1)),a)),Bo(r,null,i,a),new Oo(a)}function Ho(e,t,n){let r=[];return Bo(null,e,n,r),e.depth>n&&xo(Po(Fo(e,t,n+1),Ho(e,t,n+1)),r),Bo(t,null,n,r),new Oo(r)}bo.empty=new bo(Oo.empty,0,0);class $o{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let i=0;i<e;i++)r+=n.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return No.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Vo(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let s=e;;){let{index:e,offset:t}=s.content.findIndex(i),o=i-t;if(n.push(s,e,r+t),!o)break;if(s=s.child(e),s.isText)break;i=o-1,r+=t+1}return new $o(t,n,i)}static resolveCached(e,t){for(let r=0;r<jo.length;r++){let n=jo[r];if(n.pos==t&&n.doc==e)return n}let n=jo[Yo]=$o.resolve(e,t);return Yo=(Yo+1)%zo,n}}let jo=[],Yo=0,zo=12;class Vo{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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 Go=Object.create(null);let Wo=class e{constructor(e,t,n,r=No.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Oo.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&yo(this.attrs,t||e.defaultAttrs||Go)&&No.sameSet(this.marks,n||No.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return bo.empty;let r=this.resolve(e),i=this.resolve(t),s=n?0:r.sharedDepth(t),o=r.start(s),a=r.node(s).content.cut(r.pos-o,i.pos-o);return new bo(a,r.depth-s,i.depth-s)}replace(e,t,n){return ko(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return $o.resolveCached(this,e)}resolveNoCache(e){return $o.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(r=!0),!r))),r}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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ko(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Oo.empty,r=0,i=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,i),o=s&&s.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),s=i&&i.matchFragment(this.content,t);return!!s&&s.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=No.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!No.sameSet(e,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 e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Oo.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};Wo.prototype.text=void 0;class Xo extends Wo{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ko(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xo(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ko(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class qo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Jo(e,t);if(null==n.next)return qo.empty;let r=Zo(n);n.next&&n.err("Unexpected trailing text");let i=function(e){let t=Object.create(null);return function n(r){let i=[];r.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);ia(e,n).forEach((e=>{r||i.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)}))}))}));let s=t[r.join(",")]=new qo(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(ra);s.next.push({type:i[e][0],next:t[r.join(",")]||n(r)})}return s}(ia(e,0))}(function(e){let t=[[]];return i(function e(t,s){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(e(n,s))),[]);if("seq"!=t.type){if("star"==t.type){let o=n();return r(s,o),i(e(t.expr,o),o),[r(o)]}if("plus"==t.type){let o=n();return i(e(t.expr,s),o),i(e(t.expr,o),o),[r(o)]}if("opt"==t.type)return[r(s)].concat(e(t.expr,s));if("range"==t.type){let o=s;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,o),r),o=r}if(-1==t.max)i(e(t.expr,o),o);else for(let s=t.min;s<t.max;s++){let s=n();r(o,s),i(e(t.expr,o),s),o=s}return[r(o)]}if("name"==t.type)return[r(s,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let o=e(t.exprs[r],s);if(r==t.exprs.length-1)return o;i(o,s=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach((e=>e.to=t))}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,s=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];s.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(s,o){let a=s.matchFragment(e,n);if(a&&(!t||a.validEnd))return Oo.from(o.map((e=>e.createAndFill())));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:s,next:o}=i.next[e];s.isLeaf||s.hasRequiredAttrs()||s.name in t||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),t[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let i=0;i<t.next.length;i++)r+=(i?", ":"")+t.next[i].type.name+"->"+e.indexOf(t.next[i].next);return r})).join("\n")}}qo.empty=new qo(!0);class Jo{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Zo(e){let t=[];do{t.push(Qo(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Qo(e){let t=[];do{t.push(ea(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function ea(e){let t=function(e){if(e.eat("(")){let t=Zo(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let s in n){let e=n[s];e.groups.indexOf(t)>-1&&i.push(e)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=na(e,t)}return t}function ta(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function na(e,t){let n=ta(e),r=n;return e.eat(",")&&(r="}"!=e.next?ta(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function ra(e,t){return t-e}function ia(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:s}=i[e];r||-1!=n.indexOf(s)||t(s)}}(t),n.sort(ra)}function sa(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function oa(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=t.default}n[r]=i}return n}function aa(e){let t=Object.create(null);if(e)for(let n in e)t[n]=new la(e[n]);return t}let ua=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=aa(n.attrs),this.defaultAttrs=sa(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:oa(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wo(this,this.computeAttrs(e),Oo.from(t),No.setFrom(n))}createChecked(e=null,t,n){return t=Oo.from(t),this.checkContent(t),new Wo(this,this.computeAttrs(e),t,No.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Oo.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Oo.empty,!0);return i?new Wo(this,e,t.append(i),No.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:No.none:e}static compile(t,n){let r=Object.create(null);t.forEach(((t,i)=>r[t]=new e(t,n,i)));let i=n.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 e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class la{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ca{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=aa(r.attrs),this.excluded=null;let i=sa(this.attrs);this.instance=i?new No(this,i):null}create(e=null){return!e&&this.instance?this.instance:new No(this,oa(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach(((e,i)=>n[e]=new ca(e,r++,t,i))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}function ha(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e.marks[i],o=s;if(s)n.push(s);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class da{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach((e=>{e.tag?this.tags.push(e):e.style&&this.styles.push(e)})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new Aa(this,t,!1);return n.addAll(e,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Aa(this,t,!0);return n.addAll(e,t.from,t.to),bo.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(_a(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(!(0!=s.indexOf(e)||r.context&&!n.matchesContext(r.context)||s.length>e.length&&(61!=s.charCodeAt(e.length)||s.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach((e=>{n(e=Da(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)}))}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach((e=>{n(e=Da(e)),e.node||e.ignore||e.mark||(e.node=r)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new da(e,da.schemaRules(e)))}}const pa={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},fa={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ma={ol:!0,ul:!0};function Ea(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class ga{constructor(e,t,n,r,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.pendingMarks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=No.none,this.stashMarks=[],this.match=s||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Oo.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Oo.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Oo.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,n=this.pendingMarks;t<n.length;t++){let r=n[t];(this.type?this.type.allowsMarkType(r.type):va(r.type,e))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Aa{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0;let r,i=t.topNode,s=Ea(null,t.preserveWhitespace,0)|(n?4:0);r=i?new ga(i.type,i.attrs,No.none,No.none,!0,t.topMatch||i.type.contentMatch,s):new ga(n?null:e.schema.topNodeType,null,No.none,No.none,!0,null,s),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){3==e.nodeType?this.addTextNode(e):1==e.nodeType&&this.addElement(e)}withStyleRules(e,t){let n=e.getAttribute("style");if(!n)return t();let r=this.readStyles(function(e){let t,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;t=n.exec(e);)r.push(t[1],t[2].trim());return r}(n));if(!r)return;let[i,s]=r,o=this.top;for(let a=0;a<s.length;a++)this.removePendingMark(s[a],o);for(let a=0;a<i.length;a++)this.addPendingMark(i[a]);t();for(let a=0;a<i.length;a++)this.removePendingMark(i[a],o);for(let a=0;a<s.length;a++)this.addPendingMark(s[a])}addTextNode(e){let t=e.nodeValue,n=this.top;if(2&n.options||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(1&n.options)t=2&n.options?t.replace(/\r\n?/g,"\n"):t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],i=e.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let n,r=e.nodeName.toLowerCase();ma.hasOwnProperty(r)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&ma.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(n=this.parser.matchTag(e,this,t));if(i?i.ignore:fa.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let t,n=this.top,s=this.needsBlock;if(pa.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),t=!0,n.type||(this.needsBlock=!0);else if(!e.firstChild)return void this.leafFallback(e);i&&i.skip?this.addAll(e):this.withStyleRules(e,(()=>this.addAll(e))),t&&this.sync(n),this.needsBlock=s}else this.withStyleRules(e,(()=>{this.addElementByRule(e,i,!1===i.consuming?n:void 0)}))}leafFallback(e){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"))}ignoreFallback(e){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=No.none,n=No.none;for(let r=0;r<e.length;r+=2)for(let i;;){let s=this.parser.matchStyle(e[r],e[r+1],this,i);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((e=>{s.clearMark(e)&&(n=e.addToSet(n))})):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),!1!==s.consuming)break;i=s}return[t,n]}addElementByRule(e,t,n){let r,i,s;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):r=this.enter(i,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let o=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e)));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n)}r&&this.sync(o)&&this.open--,s&&this.removePendingMark(s,o)}addAll(e,t,n){let r=t||0;for(let i=t?e.childNodes[t]:e.firstChild,s=null==n?null:e.childNodes[n];i!=s;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i);this.findAtPoint(e,r)}findPlace(e){let t,n;for(let r=this.open;r>=0;r--){let i=this.nodes[r],s=i.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,n=i,!s.length))break;if(i.solid)break}if(!t)return!1;this.sync(n);for(let r=0;r<t.length;r++)this.enterInner(t[r],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&this.enterInner(e)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let n=t.activeMarks;for(let r=0;r<e.marks.length;r++)t.type&&!t.type.allowsMarkType(e.marks[r].type)||(n=e.marks[r].addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n){let r=this.findPlace(e.create(t));return r&&this.enterInner(e,t,!0,n),r}enterInner(e,t=null,n=!1,r){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let s=Ea(e,r,i.options);4&i.options&&0==i.content.length&&(s|=4),this.nodes.push(new ga(e,t,i.activeMarks,i.pendingMarks,n,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));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(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),s=(e,o)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;o>=i;o--)if(s(e-1,o))return!0;return!1}{let e=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=a&&-1==e.groups.indexOf(a))return!1;o--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}addPendingMark(e){let t=function(e,t){for(let n=0;n<t.length;n++)if(e.eq(t[n]))return t[n]}(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(e)>-1)r.pendingMarks=e.removeFromSet(r.pendingMarks);else{r.activeMarks=e.removeFromSet(r.activeMarks);let t=r.popFromStashMark(e);t&&r.type&&r.type.allowsMarkType(t.type)&&(r.activeMarks=t.addToSet(r.activeMarks))}if(r==t)break}}}function _a(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Da(e){let t={};for(let n in e)t[n]=e[n];return t}function va(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let s=[],o=e=>{s.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t)return!0;if(s.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class Ta{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Sa(t).createDocumentFragment());let r=n,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let n=0,s=0;for(;n<i.length&&s<e.marks.length;){let t=e.marks[s];if(this.marks[t.type.name]){if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,s++}else s++}for(;n<i.length;)r=i.pop()[1];for(;s<e.marks.length;){let n=e.marks[s++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Ta.renderSpec(Sa(t),this.nodes[e.type.name](e));if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ta.renderSpec(Sa(n),r(e,t))}static renderSpec(e,t,n=null){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,i=t[0],s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let o=n?e.createElementNS(n,i):e.createElement(i),a=t[1],u=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){u=2;for(let e in a)if(null!=a[e]){let t=e.indexOf(" ");t>0?o.setAttributeNS(e.slice(0,t),e.slice(t+1),a[e]):o.setAttribute(e,a[e])}}for(let l=u;l<t.length;l++){let i=t[l];if(0===i){if(l<t.length-1||l>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:o,contentDOM:o}}{let{dom:t,contentDOM:s}=Ta.renderSpec(e,i,n);if(o.appendChild(t),s){if(r)throw new RangeError("Multiple content holes");r=s}}}return{dom:o,contentDOM:r}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ta(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Oa(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Oa(e.marks)}}function Oa(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Sa(e){return e.document||window.document}const Ca=Math.pow(2,16);function ya(e,t){return e+t*Ca}function Na(e){return 65535&e}let Ia=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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}},ba=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=Na(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ca}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:ya(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new Ia(i,h,s)}r+=l-u}return n?e+r:new Ia(e+r,0,null)}touches(e,t){let n=0,r=Na(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};ba.empty=new ba([]);let Ra=class e{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(t=0,n=this.maps.length){return new e(this.maps,this.mirror,t,n)}copy(){return new e(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let i=this.from;i<this.to;i++){let n=this.maps[i].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(i);if(null!=t&&t>i&&t<this.to){i=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new Ia(e,r,null)}};const wa=Object.create(null);let ka=class{getMap(){return ba.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=wa[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in wa)throw new RangeError("Duplicate use of step JSON ID "+e);return wa[e]=t,t.prototype.jsonID=e,t}},La=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Io)return e.fail(t.message);throw t}}};function Ma(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(Ma(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}let Fa=class e extends ka{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo(Ma(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return La.fromReplace(e,this.from,this.to,i)}invert(){return new xa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ka.jsonID("addMark",Fa);let xa=class e extends ka{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo(Ma(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return La.fromReplace(e,this.from,this.to,n)}invert(){return new Fa(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ka.jsonID("removeMark",xa);let Ba=class e extends ka{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Pa(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ka.jsonID("addNodeMark",Ba);let Pa=class e extends ka{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Ba(this.pos,this.mark):this}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ka.jsonID("removeNodeMark",Pa);let Ua=class e extends ka{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&$a(e,this.from,this.to)?La.fail("Structure replace would overwrite content"):La.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ba([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof e)||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 n=this.slice.size+t.slice.size==0?bo.empty:new bo(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}}{let n=this.slice.size+t.slice.size==0?bo.empty:new bo(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,bo.fromJSON(t,n.slice),!!n.structure)}};ka.jsonID("replace",Ua);let Ha=class e extends ka{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&($a(e,this.from,this.gapFrom)||$a(e,this.gapTo,this.to)))return La.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return La.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?La.fromReplace(e,this.from,this.to,n):La.fail("Content does not fit in gap")}getMap(){return new ba([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),s=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new e(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,bo.fromJSON(t,n.slice),n.insert,!!n.structure)}};function $a(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function ja(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ka.jsonID("replaceAround",Ha);let Ya=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Oo.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Oo.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new bo(i,s,o);return e>-1?new Ha(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Ua(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ga(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let s=this.depth;s>=0;s--){let e,{type:o,match:a}=this.frontier[s],u=null;if(1==t&&(i?a.matchType(i.type)||(u=a.fillBefore(Oo.from(i),!1)):r&&o.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:s,parent:r,inject:u};if(2==t&&i&&(e=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:s,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ga(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new bo(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ga(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new bo(za(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new bo(za(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,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 s=this.unplaced,o=n?n.content:s.content,a=s.openStart-e,u=0,l=[],{match:c,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));c=c.matchFragment(r)}let d=o.size+e-(s.content.size-s.openEnd);for(;u<o.childCount;){let e=o.child(u),t=c.matchType(e.type);if(!t)break;u++,(u>1||0==a||e.content.size)&&(c=t,l.push(Wa(e.mark(h.allowedMarks(e.marks)),1==u?a:0,u==o.childCount?d:-1)))}let p=u==o.childCount;p||(d=-1),this.placed=Va(this.placed,t,Oo.from(l)),this.frontier[t].match=c,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=o;f<d;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?bo.empty:new bo(za(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new bo(za(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Xa(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Xa(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Xa(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Va(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Va(this.placed,this.depth,Oo.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Oo.empty,!0);e.childCount&&(this.placed=Va(this.placed,this.frontier.length,e))}};function za(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(za(e.firstChild.content,t-1,n)))}function Va(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Va(e.lastChild.content,t-1,n)))}function Ga(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Wa(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Wa(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Oo.empty,!0)))),e.copy(r)}function Xa(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,s.content,o)?a:null}function Ka(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Ka(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Oo.empty,!0))}return e}function qa(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}let Ja=class e extends ka{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return La.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return La.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return ba.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}};ka.jsonID("attr",Ja);let Za=class e extends ka{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return La.ok(n)}getMap(){return ba.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}};ka.jsonID("docAttr",Za);let Qa=class extends Error{};Qa=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Qa.prototype=Object.create(Error.prototype)).constructor=Qa,Qa.prototype.name="TransformError";class eu{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ra}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Qa(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=bo.empty){let r=function(e,t,n=t,r=bo.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return ja(i,s,r)?new Ua(t,n,r):new Ya(i,s,r).fit()}(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new bo(Oo.from(n),0,0))}delete(e,t){return this.replace(e,t,bo.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),s=e.doc.resolve(n);if(ja(i,s,r))return e.step(new Ua(t,n,r));let o=qa(i,e.doc.resolve(n));0==o[o.length-1]&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let p=i.depth,f=i.pos-1;p>0;p--,f--){let e=i.node(p).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;o.indexOf(p)>-1?a=p:i.before(p)==f&&o.splice(1,0,-p)}let u=o.indexOf(a),l=[],c=r.openStart;for(let p=r.content,f=0;;f++){let e=p.firstChild;if(l.push(e),f==r.openStart)break;p=e.content}for(let p=c-1;p>=0;p--){let e=l[p],t=(h=e.type).spec.defining||h.spec.definingForContent;if(t&&!e.sameMarkup(i.node(Math.abs(a)-1)))c=p;else if(t||!e.type.isTextblock)break}var h;for(let p=r.openStart;p>=0;p--){let t=(p+c+1)%(r.openStart+1),a=l[t];if(a)for(let l=0;l<o.length;l++){let c=o[(l+u)%o.length],h=!0;c<0&&(h=!1,c=-c);let d=i.node(c-1),p=i.index(c-1);if(d.canReplaceWith(p,p,a.type,a.marks))return e.replace(i.before(c),h?s.after(c):n,new bo(Ka(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let p=o.length-1;p>=0&&(e.replace(t,n,r),!(e.steps.length>d));p--){let e=o[p];e<0||(t=i.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let i=r.depth-1;i>=0;i--){let e=r.index(i);if(r.node(i).canReplaceWith(e,e,n))return r.before(i+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let e=r.indexAfter(i);if(r.node(i).canReplaceWith(e,e,n))return r.after(i+1);if(e<r.node(i).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new bo(Oo.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n),s=qa(r,i);for(let o=0;o<s.length;o++){let t=s[o],n=o==s.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),i.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),i.indexAfter(t-1))))return e.delete(r.before(t),i.after(t))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:i,depth:s}=t,o=r.before(s+1),a=i.after(s+1),u=o,l=a,c=Oo.empty,h=0;for(let f=s,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=Oo.from(r.node(f).copy(c)),h++):u--;let d=Oo.empty,p=0;for(let f=s,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,d=Oo.from(i.node(f).copy(d)),p++):l++;e.step(new Ha(u,l,o,a,new bo(c.append(d),h,p),c.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=new Ua(t-n,t+n,bo.empty,!0);e.step(r)}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Oo.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let e=n[o].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Oo.from(n[o].type.create(n[o].attrs,r))}let i=t.start,s=t.end;e.step(new Ha(i,s,i,s,new bo(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{if(t.isTextblock&&!t.hasMarkup(r,i)&&function(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(s).map(n),r)){e.clearIncompatible(e.mapping.slice(s).map(n,1),r);let o=e.mapping.slice(s),a=o.map(n,1),u=o.map(n+t.nodeSize,1);return e.step(new Ha(a,u,a+1,u-1,new bo(Oo.from(r.create(i,null,t.marks)),0,0),1,!0)),!1}}))}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,i){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Ha(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new bo(Oo.from(o),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ja(e,t,n)),this}setDocAttribute(e,t){return this.step(new Za(e,t)),this}addNodeMark(e,t){return this.step(new Ba(e,t)),this}removeNodeMark(e,t){if(!(t instanceof No)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new Pa(e,t)),this}split(e,t=1,n){return function(e,t,n=1,r){let i=e.doc.resolve(t),s=Oo.empty,o=Oo.empty;for(let a=i.depth,u=i.depth-n,l=n-1;a>u;a--,l--){s=Oo.from(i.node(a).copy(s));let e=r&&r[l];o=Oo.from(e?e.type.create(e.attrs,o):i.node(a).copy(o))}e.step(new Ua(t,t,new bo(s.append(o),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let i,s,o=[],a=[];e.doc.nodesBetween(t,n,((e,u,l)=>{if(!e.isInline)return;let c=e.marks;if(!r.isInSet(c)&&l.type.allowsMarkType(r.type)){let l=Math.max(u,t),h=Math.min(u+e.nodeSize,n),d=r.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(d)||(i&&i.to==l&&i.mark.eq(c[e])?i.to=h:o.push(i=new xa(l,h,c[e])));s&&s.to==l?s.to=h:a.push(s=new Fa(l,h,r))}})),o.forEach((t=>e.step(t))),a.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let i=[],s=0;e.doc.nodesBetween(t,n,((e,o)=>{if(!e.isInline)return;s++;let a=null;if(r instanceof ca){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,u=a[e];for(let e=0;e<i.length;e++){let t=i[e];t.step==s-1&&u.eq(i[e].style)&&(n=t)}n?(n.to=r,n.step=s):i.push({style:u,from:Math.max(o,t),to:r,step:s})}}})),i.forEach((t=>e.step(new xa(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,r=n.contentMatch){let i=e.doc.nodeAt(t),s=[],o=t+1;for(let a=0;a<i.childCount;a++){let t=i.child(a),u=o+t.nodeSize,l=r.matchType(t.type);if(l){r=l;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new xa(o,u,t.marks[r]));if(t.isText&&!n.spec.code){let e,r,i=/\r?\n|\r/g;for(;e=i.exec(t.text);)r||(r=new bo(Oo.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new Ua(o+e.index,o+e.index+e[0].length,r))}}else s.push(new Ua(o,u,bo.empty));o=u}if(!r.validEnd){let t=r.fillBefore(Oo.empty,!0);e.replace(o,o,new bo(t,0,0))}for(let a=s.length-1;a>=0;a--)e.step(s[a])}(this,e,t,n),this}}const tu=Object.create(null);class nu{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new ru(e.min(t),e.max(t))]}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 e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=bo.empty){let n=t.content.lastChild,r=null;for(let o=0;o<t.openEnd;o++)r=n,n=n.lastChild;let i=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:u}=s[o],l=e.mapping.slice(i);e.replaceRange(l.map(a.pos),l.map(u.pos),o?bo.empty:t),0==o&&pu(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:o}=r[i],a=e.mapping.slice(n),u=a.map(s.pos),l=a.map(o.pos);i?e.deleteRange(u,l):(e.replaceRangeWith(u,l,t),pu(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new ou(e):du(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let i=e.depth-1;i>=0;i--){let r=t<0?du(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):du(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new cu(e.node(0))}static atStart(e){return du(e,e,0,0,1)||new cu(e)}static atEnd(e){return du(e,e,e.content.size,e.childCount,-1)||new cu(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=tu[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in tu)throw new RangeError("Duplicate use of selection JSON ID "+e);return tu[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ou.between(this.$anchor,this.$head).getBookmark()}}nu.prototype.visible=!0;class ru{constructor(e,t){this.$from=e,this.$to=t}}let iu=!1;function su(e){iu||e.parent.inlineContent||(iu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ou extends nu{constructor(e,t=e){su(e),su(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return nu.near(n);let r=e.resolve(t.map(this.anchor));return new ou(r.parent.inlineContent?r:n,n)}replace(e,t=bo.empty){if(super.replace(e,t),t==bo.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof ou&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new au(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new ou(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=nu.findFrom(t,n,!0)||nu.findFrom(t,-n,!0);if(!e)return nu.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(nu.findFrom(e,-n,!0)||nu.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new ou(e,t)}}nu.jsonID("text",ou);class au{constructor(e,t){this.anchor=e,this.head=t}map(e){return new au(e.map(this.anchor),e.map(this.head))}resolve(e){return ou.between(e.resolve(this.anchor),e.resolve(this.head))}}class uu extends nu{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?nu.near(i):new uu(i)}content(){return new bo(Oo.from(this.node),0,0)}eq(e){return e instanceof uu&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lu(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new uu(e.resolve(t.anchor))}static create(e,t){return new uu(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}uu.prototype.visible=!1,nu.jsonID("node",uu);class lu{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new au(n,n):new lu(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&uu.isSelectable(n)?new uu(t):nu.near(t)}}class cu extends nu{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=bo.empty){if(t==bo.empty){e.delete(0,e.doc.content.size);let t=nu.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new cu(e)}map(e){return new cu(e)}eq(e){return e instanceof cu}getBookmark(){return hu}}nu.jsonID("all",cu);const hu={map(){return this},resolve:e=>new cu(e)};function du(e,t,n,r,i,s=!1){if(t.inlineContent)return ou.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(r.isAtom){if(!s&&uu.isSelectable(r))return uu.create(e,n-(i<0?r.nodeSize:0))}else{let t=du(e,r,n+i,i<0?r.childCount:0,i,s);if(t)return t}n+=r.nodeSize*i}return null}function pu(e,t,n){let r=e.steps.length-1;if(r<t)return;let i,s=e.steps[r];(s instanceof Ua||s instanceof Ha)&&(e.mapping.maps[r].forEach(((e,t,n,r)=>{null==i&&(i=r)})),e.setSelection(nu.near(e.doc.resolve(i),n)))}class fu extends eu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.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(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return No.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||No.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(nu.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function mu(e,t){return t&&e?e.bind(t):e}class Eu{constructor(e,t,n){this.name=e,this.init=mu(t.init,n),this.apply=mu(t.apply,n)}}const gu=[new Eu("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Eu("selection",{init:(e,t)=>e.selection||nu.atStart(t.doc),apply:e=>e.selection}),new Eu("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Eu("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class Au{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gu.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Eu(e.key,e.spec.state,e))}))}}class _u{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let a=r?r[s].n:0,u=r?r[s].state:this,l=a<t.length&&o.spec.appendTransaction.call(o,a?t.slice(a):t,u,n);if(l&&n.filterTransaction(l,s)){if(l.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<s?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[s]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new _u(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new fu(this)}static create(e){let t=new Au(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new _u(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new Au(this.schema,e.plugins),n=t.fields,r=new _u(t);for(let i=0;i<n.length;i++){let t=n[i].name;r[t]=this.hasOwnProperty(t)?this[t]:n[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new Au(e.schema,e.plugins),i=new _u(r);return r.fields.forEach((r=>{if("doc"==r.name)i.doc=Wo.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=nu.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let s in n){let o=n[s],a=o.spec.state;if(o.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,s))return void(i[r.name]=a.fromJSON.call(o,e,t[s],i))}i[r.name]=r.init(e,i)}})),i}}function Du(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=Du(i,t,{})),n[r]=i}return n}class vu{constructor(e){this.spec=e,this.props={},e.props&&Du(e.props,this,this.props),this.key=e.key?e.key.key:Ou("plugin")}getState(e){return e[this.key]}}const Tu=Object.create(null);function Ou(e){return e in Tu?e+"$"+ ++Tu[e]:(Tu[e]=0,e+"$")}class Su{constructor(e="key"){this.key=Ou(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Cu=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},yu=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Nu=null;const Iu=function(e,t,n){let r=Nu||(Nu=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},bu=function(e,t,n,r){return n&&(wu(e,t,n,r,-1)||wu(e,t,n,r,1))},Ru=/^(img|br|input|textarea|hr)$/i;function wu(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ku(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Lu(e)||Ru.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Cu(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(i<0?-1:0)]).contentEditable)return!1;t=i<0?ku(e):0}}}function ku(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Lu(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Mu=function(e){return e.focusNode&&bu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Fu(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const xu="undefined"!=typeof navigator?navigator:null,Bu="undefined"!=typeof document?document:null,Pu=xu&&xu.userAgent||"",Uu=/Edge\/(\d+)/.exec(Pu),Hu=/MSIE \d/.exec(Pu),$u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pu),ju=!!(Hu||$u||Uu),Yu=Hu?document.documentMode:$u?+$u[1]:Uu?+Uu[1]:0,zu=!ju&&/gecko\/(\d+)/i.test(Pu);zu&&(/Firefox\/(\d+)/.exec(Pu)||[0,0])[1];const Vu=!ju&&/Chrome\/(\d+)/.exec(Pu),Gu=!!Vu,Wu=Vu?+Vu[1]:0,Xu=!ju&&!!xu&&/Apple Computer/.test(xu.vendor),Ku=Xu&&(/Mobile\/\w+/.test(Pu)||!!xu&&xu.maxTouchPoints>2),qu=Ku||!!xu&&/Mac/.test(xu.platform),Ju=!!xu&&/Win/.test(xu.platform),Zu=/Android \d/.test(Pu),Qu=!!Bu&&"webkitFontSmoothing"in Bu.documentElement.style,el=Qu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tl(e){return{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function nl(e,t){return"number"==typeof e?e:e[t]}function rl(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function il(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let o=n||e.dom;o;o=yu(o)){if(1!=o.nodeType)continue;let e=o,n=e==s.body,a=n?tl(s):rl(e),u=0,l=0;if(t.top<a.top+nl(r,"top")?l=-(a.top-t.top+nl(i,"top")):t.bottom>a.bottom-nl(r,"bottom")&&(l=t.bottom-t.top>a.bottom-a.top?t.top+nl(i,"top")-a.top:t.bottom-a.bottom+nl(i,"bottom")),t.left<a.left+nl(r,"left")?u=-(a.left-t.left+nl(i,"left")):t.right>a.right-nl(r,"right")&&(u=t.right-a.right+nl(i,"right")),u||l)if(n)s.defaultView.scrollBy(u,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),u&&(e.scrollLeft+=u);let i=e.scrollLeft-n,s=e.scrollTop-r;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function sl(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=yu(r));return t}function ol(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:s}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let al=null;function ul(e,t){let n,r,i,s,o=2e8,a=0,u=t.top,l=t.top;for(let c=e.firstChild,h=0;c;c=c.nextSibling,h++){let e;if(1==c.nodeType)e=c.getClientRects();else{if(3!=c.nodeType)continue;e=Iu(c).getClientRects()}for(let d=0;d<e.length;d++){let p=e[d];if(p.top<=u&&p.bottom>=l){u=Math.max(p.bottom,u),l=Math.min(p.top,l);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<o){n=c,o=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==c.nodeType&&e&&(a=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=c,s={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=h+1)}}return!n&&i&&(n=i,r=s,o=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(e,i+1),r.setStart(e,i);let n=pl(r,1);if(n.top!=n.bottom&&ll(t,n))return{node:e,offset:i+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||o&&1==n.nodeType?{node:e,offset:a}:ul(n,r)}function ll(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function cl(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let n=e.childNodes[s];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(ll(t,i))return cl(n,t,i)}}if((s=(s+1)%r)==i)break}return e}function hl(e,t){let n,r=e.dom.ownerDocument,i=0,s=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,t.left,t.top);s&&({node:n,offset:i}=s);let o,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!ll(t,n))return null;if(a=cl(e.dom,t,n),!a)return null}if(Xu)for(let l=a;n&&l;l=yu(l))l.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(zu&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let e,r=n.childNodes[i];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&i++}let r;Qu&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(o=function(e,t,n,r){let i=-1;for(let s=t,o=!1;s!=e.dom;){let t=e.docView.nearestDesc(s,!0);if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent&&!o||!t.contentDOM)){let e=t.dom.getBoundingClientRect();if(t.node.isBlock&&t.parent&&!o&&(o=!0,e.left>r.left||e.top>r.top?i=t.posBefore:(e.right<r.left||e.bottom<r.top)&&(i=t.posAfter)),!t.contentDOM&&i<0&&!t.node.isText)return(t.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?t.posBefore:t.posAfter}s=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==o&&(o=function(e,t,n){let{node:r,offset:i}=ul(t,n),s=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();s=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,s)}(e,a,t));let u=e.docView.nearestDesc(a,!0);return{pos:o,inside:u?u.posAtStart-u.border:-1}}function dl(e){return e.top<e.bottom||e.left<e.right}function pl(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(dl(e))return e}return Array.prototype.find.call(n,dl)||e.getBoundingClientRect()}const fl=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ml(e,t,n){let{node:r,offset:i,atom:s}=e.docView.domFromPos(t,n<0?-1:1),o=Qu||zu;if(3==r.nodeType){if(!o||!fl.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let e=i,t=i,s=n<0?1:-1;return n<0&&!i?(t++,s=-1):n>=0&&i==r.nodeValue.length?(e--,s=1):n<0?e--:t++,El(pl(Iu(r,e,t),s),s<0)}{let e=pl(Iu(r,i,i),n);if(zu&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=pl(Iu(r,i-1,i-1),-1);if(t.top==e.top){let n=pl(Iu(r,i,i+1),-1);if(n.top!=e.top)return El(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==ku(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return gl(e.getBoundingClientRect(),!1)}if(null==s&&i<ku(r)){let e=r.childNodes[i];if(1==e.nodeType)return gl(e.getBoundingClientRect(),!0)}return gl(r.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==ku(r))){let e=r.childNodes[i-1],t=3==e.nodeType?Iu(e,ku(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return El(pl(t,1),!1)}if(null==s&&i<ku(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Iu(e,0,o?0:1):1==e.nodeType?e:null:null;if(t)return El(pl(t,-1),!0)}return El(pl(3==r.nodeType?Iu(r):r,-n),n>=0)}function El(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function gl(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Al(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}const _l=/[\u0590-\u08ac]/;let Dl=null,vl=null,Tl=!1;class Ol{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Cu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i,s=this.getDesc(r);if(s&&(!t||s.node)){if(!n||!(i=s.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return s;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let i=0;n<this.children.length;n++){let t=this.children[n],s=i+t.size;if(s>e||t instanceof Rl){r=e-i;break}i=s}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let i;n&&!(i=this.children[n-1]).size&&i instanceof Sl&&i.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Cu(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Cu(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=n,o=0;;o++){let n=this.children[o],a=s+n.size;if(-1==r&&e<=a){let i=s+n.border;if(e>=i&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=s;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Cu(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||o==this.children.length-1)){t=a;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Cu(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,d=0;h<this.children.length;h++){let o=this.children[h],a=d+o.size;if(i>d&&s<a)return o.setSelection(e-d-o.border,t-d-o.border,n,r);d=a}let o=this.domFromPos(e,e?-1:1),a=t==e?o:this.domFromPos(t,t?-1:1),u=n.getSelection(),l=!1;if((zu||Xu)&&e==t){let{node:e,offset:t}=o;if(3==e.nodeType){if(l=!(!t||"\n"!=e.nodeValue[t-1]),l&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(o=a={node:n.parentNode,offset:Cu(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];l=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(zu&&u.focusNode&&u.focusNode!=a.node&&1==u.focusNode.nodeType){let e=u.focusNode.childNodes[u.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||l&&Xu)&&bu(o.node,o.offset,u.anchorNode,u.anchorOffset)&&bu(a.node,a.offset,u.focusNode,u.focusOffset))return;let c=!1;if((u.extend||e==t)&&!l){u.collapse(o.node,o.offset);try{e!=t&&u.extend(a.node,a.offset),c=!0}catch(e){}}if(!c){if(e>t){let e=o;o=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(o.node,o.offset),u.removeAllRanges(),u.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],s=n+i.size;if(n==s?e<=s&&t>=n:e<s&&t>n){let r=n+i.border,o=s-i.border;if(e>=r&&t<=o)return this.dirty=e==n||t==s?2:1,void(e!=r||t!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-r,t-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Sl extends Ol{constructor(e,t,n,r){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(n,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r))),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||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 Cl extends Ol{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class yl extends Ol{constructor(e,t,n,r){super(e,[],n,r),this.mark=t}static create(e,t,n,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,n);return s&&s.dom||(s=Ta.renderSpec(document,t.type.spec.toDOM(t,n))),new yl(e,t,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(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=yl.create(this.parent,this.mark,!0,n),i=this.children,s=this.size;t<s&&(i=Yl(i,t,s,n)),e>0&&(i=Yl(i,0,e,n));for(let o=0;o<i.length;o++)i[o].parent=r;return r.children=i,r}}class Nl extends Ol{constructor(e,t,n,r,i,s,o,a,u){super(e,[],i,s),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(e,t,n,r,i,s){let o,a=i.nodeViews[t.type.name],u=a&&a(t,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:s),n,r),l=u&&u.dom,c=u&&u.contentDOM;if(t.isText)if(l){if(3!=l.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else l=document.createTextNode(t.text);else l||({dom:l,contentDOM:c}=Ta.renderSpec(document,t.type.spec.toDOM(t)));c||t.isText||"BR"==l.nodeName||(l.hasAttribute("contenteditable")||(l.contentEditable="false"),t.type.spec.draggable&&(l.draggable=!0));let h=l;return l=Pl(l,n,t),u?o=new wl(e,t,n,r,l,c||null,h,u,i,s+1):t.isText?new bl(e,t,n,r,l,h,i):new Nl(e,t,n,r,l,c||null,h,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Oo.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ul(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,o=i&&i.pos<0,a=new $l(this,s&&s.node,e);!function(e,t,n,r){let i=t.locals(e),s=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(s,o),n),s+=o.nodeSize}return}let o=0,a=[],u=null;for(let l=0;;){let c,h,d,p;for(;o<i.length&&i[o].to==s;){let e=i[o++];e.widget&&(c?(h||(h=[c])).push(e):c=e)}if(c)if(h){h.sort(jl);for(let e=0;e<h.length;e++)n(h[e],l,!!u)}else n(c,l,!!u);if(u)p=-1,d=u,u=null;else{if(!(l<e.childCount))break;p=l,d=e.child(l++)}for(let e=0;e<a.length;e++)a[e].to<=s&&a.splice(e--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let f=s+d.nodeSize;if(d.isText){let e=f;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(u=d.cut(e-s),d=d.cut(0,e-s),f=e,p=-1)}else for(;o<i.length&&i[o].to<=f;)o++;let m=d.isInline&&!d.isLeaf?a.filter((e=>!e.inline)):a.slice();r(d,m,t.forChild(s,d),p),s=f}}(this.node,this.innerDeco,((t,i,s)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!s&&a.syncToMarks(i==this.node.childCount?No.none:this.node.child(i).marks,n,e),a.placeWidget(t,e,r)}),((t,s,u,l)=>{let c;a.syncToMarks(t.marks,n,e),a.findNodeMatch(t,s,u,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(c=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(t,s,u,c,e)||a.updateNextNode(t,s,u,e,l,r)||a.addNode(t,s,u,e,r),r+=t.nodeSize})),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),kl(this.contentDOM,this.children,e),Ku&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof ou)||n<t||r>t+this.node.content.size)return null;let i=e.domSelectionRange(),s=function(e,t){for(;;){if(3==e.nodeType)return e;if(1==e.nodeType&&t>0){if(e.childNodes.length>t&&3==e.childNodes[t].nodeType)return e.childNodes[t];t=ku(e=e.childNodes[t-1])}else{if(!(1==e.nodeType&&t<e.childNodes.length))return null;e=e.childNodes[t],t=0}}}(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let e=s.nodeValue,i=function(e,t,n,r){for(let i=0,s=0;i<e.childCount&&s<=r;){let o=e.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;u+=t.text}if(s>=n){if(s>=r&&u.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?u.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&u.length>=r+t.length-a&&u.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:s,pos:i,text:e}}return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Cl(this,i,t,r);e.input.compositionNodes.push(s),this.children=Yl(this.children,n,n+r.length,e,s)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Ul(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=xl(this.dom,this.nodeDOM,Fl(this.outerDeco,this.node,t),Fl(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}}function Il(e,t,n,r,i){Pl(r,t,e);let s=new Nl(void 0,e,t,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bl extends Nl{constructor(e,t,n,r,i,s,o){super(e,t,n,r,i,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new bl(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class Rl extends Ol{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class wl extends Nl{constructor(e,t,n,r,i,s,o,a,u,l){super(e,t,n,r,i,s,o,u,l),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function kl(e,t,n){let r=e.firstChild,i=!1;for(let s=0;s<t.length;s++){let o=t[s],a=o.dom;if(a.parentNode==e){for(;a!=r;)r=Hl(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(a,r);if(o instanceof yl){let t=r?r.previousSibling:e.lastChild;kl(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Hl(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const Ll=function(e){e&&(this.nodeName=e)};Ll.prototype=Object.create(null);const Ml=[new Ll];function Fl(e,t,n){if(0==e.length)return Ml;let r=n?Ml[0]:new Ll,i=[r];for(let s=0;s<e.length;s++){let o=e[s].type.attrs;if(o){o.nodeName&&i.push(r=new Ll(o.nodeName));for(let e in o){let s=o[e];null!=s&&(n&&1==i.length&&i.push(r=new Ll(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+s:"style"==e?r.style=(r.style?r.style+";":"")+s:"nodeName"!=e&&(r[e]=s))}}}return i}function xl(e,t,n,r){if(n==Ml&&r==Ml)return t;let i=t;for(let s=0;s<r.length;s++){let t=r[s],o=n[s];if(s){let n;o&&o.nodeName==t.nodeName&&i!=e&&(n=i.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(i),o=Ml[0]),i=n}Bl(i,o||Ml[0],t)}return i}function Bl(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Pl(e,t,n){return xl(e,e,Ml,Fl(t,n,1!=e.nodeType))}function Ul(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Hl(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class $l{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof yl)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=e.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let r=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;r<s&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=yl.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let i,s=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))s=this.top.children.indexOf(i,this.index);else for(let o=this.index,a=Math.min(this.top.children.length,o+5);o<a;o++){let r=this.top.children[o];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){s=o;break}}return!(s<0||(this.destroyBetween(this.index,s),this.index++,0))}updateNodeAt(e,t,n,r,i){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,i,s){for(let o=this.index;o<this.top.children.length;o++){let a=this.top.children[o];if(a instanceof Nl){let u=this.preMatch.matched.get(a);if(null!=u&&u!=i)return!1;let l,c=a.dom,h=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Ul(t,a.outerDeco));if(!h&&a.update(e,t,n,r))return this.destroyBetween(this.index,o),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(l=this.recreateWrapper(a,e,t,n,r,s)))return this.top.children[this.index]=l,l.contentDOM&&(l.dirty=2,l.updateChildren(r,s+1),l.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content))return null;let o=Nl.create(this.top,t,n,r,i,s);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let s=Nl.create(this.top,e,t,n,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Sl(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof yl;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof bl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Xu||Gu)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Rl(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function jl(e,t){return e.type.side-t.type.side}function Yl(e,t,n,r,i){let s=[];for(let o=0,a=0;o<e.length;o++){let u=e[o],l=a,c=a+=u.size;l>=n||c<=t?s.push(u):(l<t&&s.push(u.slice(0,t-l,r)),i&&(s.push(i),i=void 0),c>n&&s.push(u.slice(n-l,u.size,r)))}return s}function zl(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a,u,l=r.resolve(o);if(Mu(n)){for(a=l;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&uu.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,i=t==ku(e);r||i;){if(e==n)return!0;let t=Cu(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==ku(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;u=new uu(o==e?l:r.resolve(e))}}else{let t=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(t<0)return null;a=r.resolve(t)}return u||(u=Ql(e,a,l,"pointer"==t||e.state.selection.head<l.pos&&!s?1:-1)),u}function Vl(e){return e.editable?e.hasFocus():tc(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Gl(e,t=!1){let n=e.state.selection;if(Jl(e,n),Vl(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Gu){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&bu(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange(),r=e.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Cu(r)+1):n.setEnd(r,0),n.collapse(!1),t.removeAllRanges(),t.addRange(n),!i&&!e.state.selection.visible&&ju&&Yu<=11&&(r.disabled=!0,r.disabled=!1)}(e);else{let r,i,{anchor:s,head:o}=n;!Wl||n instanceof ou||(n.$from.parent.inlineContent||(r=Xl(e,n.from)),n.empty||n.$from.parent.inlineContent||(i=Xl(e,n.to))),e.docView.setSelection(s,o,e.root,t),Wl&&(r&&ql(r),i&&ql(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Vl(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Wl=Xu||Gu&&Wu<63;function Xl(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Xu&&i&&"false"==i.contentEditable)return Kl(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return Kl(i);if(s)return Kl(s)}}function Kl(e){return e.contentEditable="true",Xu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ql(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Jl(e,t){if(t instanceof uu){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Zl(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Zl(e)}function Zl(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ql(e,t,n,r){return e.someProp("createSelectionBetween",(r=>r(e,t,n)))||ou.between(t,n,r)}function ec(e){return!(e.editable&&!e.hasFocus())&&tc(e)}function tc(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function nc(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&nu.findFrom(s,t)}function rc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function ic(e,t,n){let r=e.state.selection;if(!(r instanceof ou)){if(r instanceof uu&&r.node.isInline)return rc(e,new ou(t>0?r.$to:r.$from));{let n=nc(e.state,t);return!!n&&rc(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return rc(e,new ou(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=nc(e.state,t);return!!(n&&n instanceof uu)&&rc(e,n)}if(!(qu&&n.indexOf("m")>-1)){let n,i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let o=t<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=e.docView.descAt(o))&&!n.contentDOM)&&(uu.isSelectable(s)?rc(e,new uu(t<0?e.state.doc.resolve(i.pos-s.nodeSize):i)):!!Qu&&rc(e,new ou(e.state.doc.resolve(t<0?o:o+s.nodeSize))))}}function sc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function oc(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ac(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=!1;for(zu&&1==n.nodeType&&r<sc(n)&&oc(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(oc(e,-1))i=n,s=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(uc(n))break;{let t=n.previousSibling;for(;t&&oc(t,-1);)i=n.parentNode,s=Cu(t),t=t.previousSibling;if(t)n=t,r=sc(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?lc(e,n,r):i&&lc(e,i,s)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,s,o=sc(n);for(;;)if(r<o){if(1!=n.nodeType)break;if(!oc(n.childNodes[r],1))break;i=n,s=++r}else{if(uc(n))break;{let t=n.nextSibling;for(;t&&oc(t,1);)i=t.parentNode,s=Cu(t)+1,t=t.nextSibling;if(t)n=t,r=0,o=sc(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&lc(e,i,s)}(e)}function uc(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function lc(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Lu(e);)t=Cu(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Lu(e);)t=Cu(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(Mu(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Gl(e)}),50)}function cc(e,t){let n=e.state.doc.resolve(t);if(!Gu&&!Ju&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function hc(e,t,n){let r=e.state.selection;if(r instanceof ou&&!r.empty||n.indexOf("s")>-1)return!1;if(qu&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nc(e.state,t);if(n&&n instanceof uu)return rc(e,n)}if(!i.parent.inlineContent){let n=t<0?i:s,o=r instanceof cu?nu.near(n,t):nu.findFrom(n,t);return!!o&&rc(e,o)}return!1}function dc(e,t){if(!(e.state.selection instanceof ou))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=e.state.tr;return t<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),e.dispatch(r),!0}return!1}function pc(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function fc(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:r,openStart:i,openEnd:s}=t;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let o=e.someProp("clipboardSerializer")||Ta.fromSchema(e.state.schema),a=Sc(),u=a.createElement("div");u.appendChild(o.serializeFragment(r,{document:a}));let l,c=u.firstChild,h=0;for(;c&&1==c.nodeType&&(l=Tc[c.nodeName.toLowerCase()]);){for(let e=l.length-1;e>=0;e--){let t=a.createElement(l[e]);for(;u.firstChild;)t.appendChild(u.firstChild);u.appendChild(t),h++}c=u.firstChild}c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n");return{dom:u,text:d}}function mc(e,t,n,r,i){let s,o,a=i.parent.type.spec.code;if(!n&&!t)return null;let u=t&&(r||a||!n);if(u){if(e.someProp("transformPastedText",(n=>{t=n(t,a||r,e)})),a)return t?new bo(Oo.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):bo.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,i,r,e)));if(n)o=n;else{let n=i.marks(),{schema:r}=e.state,o=Ta.fromSchema(r);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=s.appendChild(document.createElement("p"));e&&t.appendChild(o.serializeNode(r.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),s=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Sc().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);if((n=i&&Tc[i[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join("")),r.innerHTML=e,n)for(let s=0;s<n.length;s++)r=r.querySelector(n[s])||r;return r}(n),Qu&&function(e){let t=e.querySelectorAll(Gu?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let h=+c[3];h>0;h--){let e=s.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;s=e}if(!o){let t=e.someProp("clipboardParser")||e.someProp("domParser")||da.fromSchema(e.state.schema);o=t.parseSlice(s,{preserveWhitespace:!(!u&&!c),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ec.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(c)o=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:i,openStart:s,openEnd:o}=e;for(let a=n.length-2;a>=0;a-=2){let e=r.nodes[n[a]];if(!e||e.hasRequiredAttrs())break;i=Oo.from(e.create(n[a+1],i)),s++,o++}return new bo(i,s,o)}(vc(o,+c[1],+c[2]),c[4]);else if(o=bo.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,i=t.node(n).contentMatchAt(t.index(n)),s=[];if(e.forEach((e=>{if(!s)return;let t,n=i.findWrapping(e.type);if(!n)return s=null;if(t=s.length&&r.length&&Ac(n,r,e,s[s.length-1],0))s[s.length-1]=t;else{s.length&&(s[s.length-1]=_c(s[s.length-1],r.length));let t=gc(e,n);s.push(t),i=i.matchType(t.type),r=n}})),s)return Oo.from(s)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,t=0;for(let n=o.content.firstChild;e<o.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=o.content.lastChild;t<o.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);o=vc(o,e,t)}return e.someProp("transformPasted",(t=>{o=t(o,e)})),o}const Ec=/^(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 gc(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Oo.from(e));return e}function Ac(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let s=Ac(e,t,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Oo.from(gc(n,e,i+1))))}}function _c(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,_c(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Oo.empty,!0);return e.copy(n.append(r))}function Dc(e,t,n,r,i,s){let o=t<0?e.firstChild:e.lastChild,a=o.content;return e.childCount>1&&(s=0),i<r-1&&(a=Dc(a,t,n,r,i+1,s)),i>=n&&(a=t<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(Oo.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(a))}function vc(e,t,n){return t<e.openStart&&(e=new bo(Dc(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new bo(Dc(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Tc={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 Oc=null;function Sc(){return Oc||(Oc=document.implementation.createHTMLDocument("title"))}const Cc={},yc={},Nc={touchstart:!0,touchmove:!0};class Ic{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 bc(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Rc(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>wc(e,t))}))}function wc(e,t){return e.someProp("handleDOMEvents",(n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)}))}function kc(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Lc(e){return{left:e.clientX,top:e.clientY}}function Mc(e,t,n,r,i){if(-1==r)return!1;let s=e.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(e.someProp(t,(t=>o>s.depth?t(e,n,s.nodeAfter,s.before(o),i,!0):t(e,n,s.node(o),s.before(o),i,!1))))return!0;return!1}function Fc(e,t,n){e.focused||e.focus();let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function xc(e,t,n,r){return Mc(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",(n=>n(e,t,r)))}function Bc(e,t,n,r){return Mc(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",(n=>n(e,t,r)))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Fc(e,ou.create(r,0,r.content.size)),!0);let i=r.resolve(t);for(let s=i.depth+1;s>0;s--){let t=s>i.depth?i.nodeAfter:i.node(s),n=i.before(s);if(t.inlineContent)Fc(e,ou.create(r,n+1,n+1+t.content.size));else{if(!uu.isSelectable(t))continue;Fc(e,uu.create(r,n))}return!0}}(e,n,r)}function Pc(e){return Vc(e)}yc.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!$c(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Zu||!Gu||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Ku||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||qu&&72==n&&"c"==r)return dc(e,-1)||ac(e,-1);if(46==n&&!t.shiftKey||qu&&68==n&&"c"==r)return dc(e,1)||ac(e,1);if(13==n||27==n)return!0;if(37==n||qu&&66==n&&"c"==r){let t=37==n?"ltr"==cc(e,e.state.selection.from)?-1:1:-1;return ic(e,t,r)||ac(e,t)}if(39==n||qu&&70==n&&"c"==r){let t=39==n?"ltr"==cc(e,e.state.selection.from)?1:-1:1;return ic(e,t,r)||ac(e,t)}return 38==n||qu&&80==n&&"c"==r?hc(e,-1,r)||ac(e,-1):40==n||qu&&78==n&&"c"==r?function(e){if(!Xu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;pc(e,n,"true"),setTimeout((()=>pc(e,n,"false")),20)}return!1}(e)||hc(e,1,r)||ac(e,1):r==(qu?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():bc(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},yc.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},yc.keypress=(e,t)=>{let n=t;if($c(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||qu&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof ou&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,r.$from.pos,r.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const Uc=qu?"metaKey":"ctrlKey";Cc.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Pc(e),i=Date.now(),s="singleClick";i-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Uc]&&("singleClick"==e.input.lastClick.type?s="doubleClick":"doubleClick"==e.input.lastClick.type&&(s="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=e.posAtCoords(Lc(n));o&&("singleClick"==s?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Hc(e,o,n,!!r)):("doubleClick"==s?xc:Bc)(e,o.pos,o.inside,n)?n.preventDefault():bc(e,"pointer"))};class Hc{constructor(e,t,n,r){let i,s;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Uc],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,s=n.depth?n.before():0}const o=r?null:n.target,a=o?e.docView.nearestDesc(o,!0):null;this.target=a?a.dom:null;let{selection:u}=e.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||u instanceof uu&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!zu||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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),bc(e,"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((()=>Gl(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Lc(e))),this.updateAllowDefault(e),this.allowDefault||!t?bc(this.view,"pointer"):function(e,t,n,r,i){return Mc(e,"handleClickOn",t,n,r)||e.someProp("handleClick",(n=>n(e,t,r)))||(i?function(e,t){if(-1==t)return!1;let n,r,i=e.state.selection;i instanceof uu&&(n=i.node);let s=e.state.doc.resolve(t);for(let o=s.depth+1;o>0;o--){let e=o>s.depth?s.nodeAfter:s.node(o);if(uu.isSelectable(e)){r=n&&i.$from.depth>0&&o>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(o);break}}return null!=r&&(Fc(e,uu.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&uu.isSelectable(r))&&(Fc(e,new uu(n)),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Xu&&this.mightDrag&&!this.mightDrag.node.isAtom||Gu&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Fc(this.view,nu.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):bc(this.view,"pointer")}move(e){this.updateAllowDefault(e),bc(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function $c(e,t){return!!e.composing||!!(Xu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Cc.touchstart=e=>{e.input.lastTouch=Date.now(),Pc(e),bc(e,"pointer")},Cc.touchmove=e=>{e.input.lastTouch=Date.now(),bc(e,"pointer")},Cc.contextmenu=e=>Pc(e);const jc=Zu?5e3:-1;function Yc(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Vc(e)),t))}function zc(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Vc(e,t=!1){if(!(Zu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),zc(e),t||e.docView&&e.docView.dirty){let t=zl(e);return t&&!t.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(t)):e.updateState(e.state),!0}return!1}}yc.compositionstart=yc.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Vc(e,!0),e.markCursor=null;else if(Vc(e),zu&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){e.domSelection().collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Yc(e,jc)},yc.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Yc(e,20))};const Gc=ju&&Yu<15||Ku&&el<604;function Wc(e,t,n,r,i){let s=mc(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,i,s||bo.empty))))return!0;if(!s)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(s),a=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xc(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Cc.copy=yc.cut=(e,t)=>{let n=t,r=e.state.selection,i="cut"==n.type;if(r.empty)return;let s=Gc?null:n.clipboardData,o=r.content(),{dom:a,text:u}=fc(e,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",u)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},yc.paste=(e,t)=>{let n=t;if(e.composing&&!Zu)return;let r=Gc?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Wc(e,Xc(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Wc(e,r.value,null,i,t):Wc(e,r.textContent,r.innerHTML,i,t)}),50)}(e,n)};class Kc{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const qc=qu?"altKey":"ctrlKey";Cc.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,s=e.state.selection,o=s.empty?null:e.posAtCoords(Lc(n));if(o&&o.pos>=s.from&&o.pos<=(s instanceof uu?s.to-1:s.to));else if(r&&r.mightDrag)i=uu.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(i=uu.create(e.state.doc,t.posBefore))}let a=(i||e.state.selection).content(),{dom:u,text:l}=fc(e,a);n.dataTransfer.clearData(),n.dataTransfer.setData(Gc?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Gc||n.dataTransfer.setData("text/plain",l),e.dragging=new Kc(a,!n[qc],i)},Cc.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},yc.dragover=yc.dragenter=(e,t)=>t.preventDefault(),yc.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let i=e.posAtCoords(Lc(n));if(!i)return;let s=e.state.doc.resolve(i.pos),o=r&&r.slice;o?e.someProp("transformPasted",(t=>{o=t(o,e)})):o=mc(e,Xc(n.dataTransfer),Gc?null:n.dataTransfer.getData("text/html"),!1,s);let a=!(!r||n[qc]);if(e.someProp("handleDrop",(t=>t(e,n,o||bo.empty,a))))return void n.preventDefault();if(!o)return;n.preventDefault();let u=o?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),o=r.node(e),a=!1;if(1==s)a=o.canReplace(n,n,i);else{let e=o.contentMatchAt(n).findWrapping(i.firstChild.type);a=e&&o.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}(e.state.doc,s.pos,o):s.pos;null==u&&(u=s.pos);let l=e.state.tr;if(a){let{node:e}=r;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(u),h=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,d=l.doc;if(h?l.replaceRangeWith(c,c,o.content.firstChild):l.replaceRange(c,c,o),l.doc.eq(d))return;let p=l.doc.resolve(c);if(h&&uu.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))l.setSelection(new uu(p));else{let t=l.mapping.map(u);l.mapping.maps[l.mapping.maps.length-1].forEach(((e,n,r,i)=>t=i)),l.setSelection(Ql(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))},Cc.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Gl(e)}),20))},Cc.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Cc.beforeinput=(e,t)=>{if(Gu&&Zu&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,Fu(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let os in yc)Cc[os]=yc[os];function Jc(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Zc{constructor(e,t){this.toDOM=e,this.spec=t||rh,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new th(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Zc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Jc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qc{constructor(e,t){this.attrs=e,this.spec=t||rh}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=s?null:new th(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Qc&&Jc(this.attrs,e.attrs)&&Jc(this.spec,e.spec)}static is(e){return e.type instanceof Qc}destroy(){}}class eh{constructor(e,t){this.attrs=e,this.spec=t||rh}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new th(i.pos-n,s.pos-n,this)}valid(e,t){let n,{index:r,offset:i}=e.content.findIndex(t.from);return i==t.from&&!(n=e.child(r)).isText&&i+n.nodeSize==t.to}eq(e){return this==e||e instanceof eh&&Jc(this.attrs,e.attrs)&&Jc(this.spec,e.spec)}destroy(){}}class th{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new th(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new th(e,e,new Zc(t,n))}static inline(e,t,n,r){return new th(e,t,new Qc(n,r))}static node(e,t,n,r){return new th(e,t,new eh(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Qc}get widget(){return this.type instanceof Zc}}const nh=[],rh={};class ih{constructor(e,t){this.local=e.length?e:nh,this.children=t.length?t:nh}static create(e,t){return t.length?ch(t,e,0,rh):sh}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==sh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||rh)}mapInner(e,t,n,r,i){let s;for(let o=0;o<this.local.length;o++){let a=this.local[o].map(e,n,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,t,n,r,i,s,o){let a=e.slice();for(let l=0,c=s;l<n.maps.length;l++){let e=0;n.maps[l].forEach(((t,n,r,i)=>{let s=i-r-(n-t);for(let o=0;o<a.length;o+=3){let r=a[o+1];if(r<0||t>r+c-e)continue;let i=a[o]+c-e;n>=i?a[o+1]=t<=i?-2:-1:t>=c&&s&&(a[o]+=s,a[o+1]+=s)}e+=s})),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(-2==a[l+1]){u=!0,a[l+1]=-1;continue}let t=n.map(e[l]+s),c=t-i;if(c<0||c>=r.content.size){u=!0;continue}let h=n.map(e[l+1]+s,-1)-i,{index:d,offset:p}=r.content.findIndex(c),f=r.maybeChild(d);if(f&&p==c&&p+f.nodeSize==h){let r=a[l+2].mapInner(n,f,t+1,e[l]+s+1,o);r!=sh?(a[l]=c,a[l+1]=h,a[l+2]=r):(a[l+1]=-2,u=!0)}else u=!0}if(u){let u=function(e,t,n,r,i,s,o){function a(e,t){for(let s=0;s<e.local.length;s++){let a=e.local[s].map(r,i,t);a?n.push(a):o.onRemove&&o.onRemove(e.local[s].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let u=0;u<e.length;u+=3)-1==e[u+1]&&a(e[u+2],t[u]+s+1);return n}(a,e,t,n,i,s,o),l=ch(u,r,0,o);t=l.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<l.children.length;e+=3){let n=l.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,l.children[e],l.children[e+1],l.children[e+2])}}return new ih(t.sort(hh),a)}(this.children,s||[],e,t,n,r,i):s?new ih(s.sort(hh),nh):sh}add(e,t){return t.length?this==sh?ih.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach(((e,s)=>{let o,a=s+n;if(o=uh(t,e,a)){for(r||(r=this.children.slice());i<r.length&&r[i]<s;)i+=3;r[i]==s?r[i+2]=r[i+2].addInner(e,o,a+1):r.splice(i,0,s,s+e.nodeSize,ch(o,e,a+1,rh)),i+=3}}));let s=ah(i?lh(t):t,-n);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new ih(s.length?this.local.concat(s).sort(hh):this.local,r||this.children)}remove(e){return 0==e.length||this==sh?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let i=0;i<n.length;i+=3){let r,s=n[i]+t,o=n[i+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>s&&t.to<o&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[i+2].removeInner(r,s+1);a!=sh?n[i+2]=a:(n.splice(i,3),i-=3)}if(r.length)for(let i,s=0;s<e.length;s++)if(i=e[s])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new ih(r,n):sh}forChild(e,t){if(this==sh)return this;if(t.isLeaf)return ih.empty;let n,r;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(n=this.children[o+2]);break}let i=e+1,s=i+t.content.size;for(let o=0;o<this.local.length;o++){let e=this.local[o];if(e.from<s&&e.to>i&&e.type instanceof Qc){let t=Math.max(i,e.from)-i,n=Math.min(s,e.to)-i;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new ih(r.sort(hh),nh);return n?new oh([e,n]):e}return n||sh}eq(e){if(this==e)return!0;if(!(e instanceof ih)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return dh(this.localsInner(e))}localsInner(e){if(this==sh)return nh;if(e.inlineContent||!this.local.some(Qc.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Qc||t.push(this.local[n]);return t}}ih.empty=new ih([],[]),ih.removeOverlap=dh;const sh=ih.empty;class oh{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,rh)));return oh.from(n)}forChild(e,t){if(t.isLeaf)return ih.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=sh&&(i instanceof oh?n=n.concat(i.members):n.push(i))}return oh.from(n)}eq(e){if(!(e instanceof oh)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?dh(n?t:t.sort(hh)):nh}static from(e){switch(e.length){case 0:return sh;case 1:return e[0];default:return new oh(e.every((e=>e instanceof ih))?e:e.reduce(((e,t)=>e.concat(t instanceof ih?t:t.members)),[]))}}}function ah(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new th(i.from+t,i.to+t,i.type))}return n}function uh(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let s,o=0;o<e.length;o++)(s=e[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),e[o]=null);return i}function lh(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function ch(e,t,n,r){let i=[],s=!1;t.forEach(((t,o)=>{let a=uh(e,t,o+n);if(a){s=!0;let e=ch(a,t,n+o+1,r);e!=sh&&i.push(o,o+t.nodeSize,e)}}));let o=ah(s?lh(e):e,-n).sort(hh);for(let a=0;a<o.length;a++)o[a].type.valid(t,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ih(o,i):sh}function hh(e,t){return e.from-t.from||e.to-t.to}function dh(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let s=t[i];if(s.from!=r.from){s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),ph(t,i,r.copy(s.from,r.to)));break}s.to!=r.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,r.to),ph(t,i+1,s.copy(r.to,s.to)))}}return t}function ph(e,t,n){for(;t<e.length&&hh(n,e[t])>0;)t++;e.splice(t,0,n)}function fh(e){let t=[];return e.someProp("decorations",(n=>{let r=n(e.state);r&&r!=sh&&t.push(r)})),e.cursorWrapper&&t.push(ih.create(e.state.doc,[e.cursorWrapper.deco])),oh.from(t)}const mh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Eh=ju&&Yu<=11;class gh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Ah{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new gh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);ju&&Yu<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Eh&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,mh)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(ec(this.view)){if(this.suppressingSelectionUpdates)return Gl(this.view);if(ju&&Yu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&bu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let i=e.focusNode;i;i=yu(i))n.add(i);for(let i=e.anchorNode;i;i=yu(i))if(n.has(i)){t=i;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ec(e)&&!this.ignoreSelectionChange(n),i=-1,s=-1,o=!1,a=[];if(e.editable)for(let l=0;l<t.length;l++){let e=this.registerMutation(t[l],a);e&&(i=i<0?e.from:Math.min(e.from,i),s=s<0?e.to:Math.max(e.to,s),e.typeOver&&(o=!0))}if(zu&&a.length>1){let e=a.filter((e=>"BR"==e.nodeName));if(2==e.length){let t=e[0],n=e[1];t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Mu(n)&&(u=zl(e))&&u.eq(nu.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Gl(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),function(e){if(!_h.has(e)&&(_h.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=zu,Dh)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."),Dh=!0}}(e)),this.handleDOMChange(i,s,o,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Gl(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++)t.push(e.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ju&&Yu<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:s}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!s||Array.prototype.indexOf.call(e.addedNodes,s)<0)&&(i=s)}let s=r&&r.parentNode==e.target?Cu(r)+1:0,o=n.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Cu(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let _h=new WeakMap,Dh=!1;function vh(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Xu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||Xu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Th=/^(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 Oh(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ql(e,t.resolve(n.anchor),t.resolve(n.head))}function Sh(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Ch(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class yh{constructor(e,t){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 Ic,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=bh(this),Ih(this),this.nodeViews=Rh(this),this.docView=Il(this.state.doc,Nh(this),fh(this),this.dom,this),this.domObserver=new Ah(this,((e,t,n,r)=>function(e,t,n,r,i){let s=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=zl(e,t);if(n&&!e.state.selection.eq(n)){if(Gu&&Zu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),s&&r.setMeta("composition",s),e.dispatch(r)}return}let o=e.state.doc.resolve(t),a=o.sharedDepth(n);t=o.before(a+1),n=e.state.doc.resolve(n).after(a+1);let u,l,c=e.state.selection,h=function(e,t,n){let r,{node:i,fromOffset:s,toOffset:o,from:a,to:u}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c=l.anchorNode;if(c&&e.dom.contains(1==c.nodeType?c:c.parentNode)&&(r=[{node:c,offset:l.anchorOffset}],Mu(l)||r.push({node:l.focusNode,offset:l.focusOffset})),Gu&&8===e.input.lastKeyCode)for(let E=o;E>s;E--){let e=i.childNodes[E-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){o=E;break}if(!t||t.size)break}let h=e.state.doc,d=e.someProp("domParser")||da.fromSchema(e.state.schema),p=h.resolve(a),f=null,m=d.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:vh,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:u}}(e,t,n),d=e.state.doc,p=d.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(u=e.state.selection.to,l="end"):(u=e.state.selection.from,l="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,i){let s=e.findDiffStart(t,n);if(null==s)return null;let{a:o,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==i&&(r-=o+Math.max(0,s-Math.min(o,a))-s),o<s&&e.size<t.size){let e=r<=s&&r>=o?s-r:0;s-=e,s&&s<t.size&&Ch(t.textBetween(s-1,s+1))&&(s+=e?1:-1),a=s+(a-o),o=s}else if(a<s){let t=r<=s&&r>=a?s-r:0;s-=t,s&&s<e.size&&Ch(e.textBetween(s-1,s+1))&&(s+=t?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}(p.content,h.doc.content,h.from,u,l);if((Ku&&e.input.lastIOSEnter>Date.now()-225||Zu)&&i.some((e=>1==e.nodeType&&!Th.test(e.nodeName)))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof ou&&!c.empty&&c.$head.sameParent(c.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=Oh(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);s&&n.setMeta("composition",s),e.dispatch(n)}}return}f={start:c.from,endA:c.to,endB:c.to}}if(Gu&&e.cursorWrapper&&h.sel&&h.sel.anchor==e.cursorWrapper.deco.from&&h.sel.head==h.sel.anchor){let e=f.endB-f.start;h.sel={anchor:h.sel.anchor+e,head:h.sel.anchor+e}}e.input.domChangeCount++,e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof ou&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),ju&&Yu<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>h.from&&"  "==h.doc.textBetween(f.start-h.from-1,f.start-h.from+1)&&(f.start--,f.endA--,f.endB--);let m,E=h.doc.resolveNoCache(f.start-h.from),g=h.doc.resolveNoCache(f.endB-h.from),A=d.resolve(f.start),_=E.sameParent(g)&&E.parent.inlineContent&&A.end()>=f.endA;if((Ku&&e.input.lastIOSEnter>Date.now()-225&&(!_||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!_&&E.pos<h.doc.content.size&&!E.sameParent(g)&&(m=nu.findFrom(h.doc.resolve(E.pos+1),1,!0))&&m.head==g.pos)&&e.someProp("handleKeyDown",(t=>t(e,Fu(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,i){if(!r.parent.isTextblock||n-t<=i.pos-r.pos||Sh(r,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=e.resolve(Sh(s,!0,!0));return!(!o.parent.isTextblock||o.pos>n||Sh(o,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(o.parent.content)}(d,f.start,f.endA,E,g)&&e.someProp("handleKeyDown",(t=>t(e,Fu(8,"Backspace")))))return void(Zu&&Gu&&e.domObserver.suppressSelectionUpdates());Gu&&Zu&&f.endB==f.start&&(e.input.lastAndroidDelete=Date.now()),Zu&&!_&&E.start()!=g.start()&&0==g.parentOffset&&E.depth==g.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,g=h.doc.resolveNoCache(f.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,Fu(13,"Enter"))}))}),20));let D,v,T,O=f.start,S=f.endA;if(_)if(E.pos==g.pos)ju&&Yu<=11&&0==E.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Gl(e)),20)),D=e.state.tr.delete(O,S),v=d.resolve(f.start).marksAcross(d.resolve(f.endA));else if(f.endA==f.endB&&(T=function(e,t){let n,r,i,s=e.firstChild.marks,o=t.firstChild.marks,a=s,u=o;for(let c=0;c<o.length;c++)a=o[c].removeFromSet(a);for(let c=0;c<s.length;c++)u=s[c].removeFromSet(u);if(1==a.length&&0==u.length)r=a[0],n="add",i=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=u.length)return null;r=u[0],n="remove",i=e=>e.mark(r.removeFromSet(e.marks))}let l=[];for(let c=0;c<t.childCount;c++)l.push(i(t.child(c)));if(Oo.from(l).eq(e))return{mark:r,type:n}}(E.parent.content.cut(E.parentOffset,g.parentOffset),A.parent.content.cut(A.parentOffset,f.endA-A.start()))))D=e.state.tr,"add"==T.type?D.addMark(O,S,T.mark):D.removeMark(O,S,T.mark);else if(E.parent.child(E.index()).isText&&E.index()==g.index()-(g.textOffset?0:1)){let t=E.parent.textBetween(E.parentOffset,g.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,O,S,t))))return;D=e.state.tr.insertText(t,O,S)}if(D||(D=e.state.tr.replace(O,S,h.doc.slice(f.start-h.from,f.endB-h.from))),h.sel){let t=Oh(e,D.doc,h.sel);t&&!(Gu&&Zu&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastAndroidDelete<Date.now()-100)&&(t.head==O||t.head==D.mapping.map(S)-1)||ju&&t.empty&&t.head==O)&&D.setSelection(t)}v&&D.ensureMarks(v),s&&D.setMeta("composition",s),e.dispatch(D.scrollIntoView())}(this,e,t,n,r))),this.domObserver.start(),function(e){for(let t in Cc){let n=Cc[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!kc(e,t)||wc(e,t)||!e.editable&&t.type in yc||n(e,t)},Nc[t]?{passive:!0}:void 0)}Xu&&e.dom.addEventListener("input",(()=>null)),Rc(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Rc(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(zc(this),s=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(o||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Rh(this);(function(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||t.handleDOMEvents!=this._props.handleDOMEvents)&&Rc(this),this.editable=bh(this),Ih(this);let a=fh(this),u=Nh(this),l=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",c=i||!this.docView.matchesNode(e.doc,u,a);!c&&e.selection.eq(r.selection)||(s=!0);let h="preserve"==l&&s&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let s=(r.left+r.right)/2,o=i+1;o<Math.min(innerHeight,r.bottom);o+=5){let r=e.root.elementFromPoint(s,o);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=i-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:sl(e.dom)}}(this);if(s){this.domObserver.stop();let t=c&&(ju||Gu)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(c){let n=Gu?this.trackWrites=this.domSelectionRange().focusNode:null;!i&&this.docView.update(e.doc,u,a,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Il(e.doc,u,a,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return bu(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Gl(this,t):(Jl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==l?this.dom.scrollTop=0:"to selection"==l?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;ol(n,0==r?0:r-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof uu){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&il(this,t.getBoundingClientRect(),e)}else il(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Kc(e.slice,e.move,r<0?void 0:uu.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let s=0;s<this.directPlugins.length;s++){let r=this.directPlugins[s].props[e];if(null!=r&&(n=t?t(r):r))return n}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let r=i[s].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(ju){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(al)return e.focus(al);let t=sl(e);e.focus(null==al?{get preventScroll(){return al={preventScroll:!0},!0}}:void 0),al||(al=!1,ol(t,0))}(this.dom),Gl(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return hl(this,e)}coordsAtPos(e,t=1){return ml(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){return Dl==t&&vl==n?Tl:(Dl=t,vl=n,Tl="up"==n||"down"==n?function(e,t,n){let r=t.selection,i="up"==n?r.$from:r.$to;return Al(e,t,(()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=ml(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Iu(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=e.domSelection();return _l.test(r.parent.textContent)&&a.modify?Al(e,t,(()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:o}=e.domSelectionRange(),u=a.caretBidiLevel;a.modify("move",n,"character");let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:h}=e.domSelectionRange(),d=c&&!l.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==h;try{a.collapse(s,o),t&&(t!=s||i!=o)&&a.extend&&a.extend(t,i)}catch(e){}return null!=u&&(a.caretBidiLevel=u),d})):"left"==n||"backward"==n?s:o}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return Wc(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Wc(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){wc(e,t)||!Cc[t.type]||!e.editable&&t.type in yc||Cc[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Xu&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function(e){let t;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0);let r=t.startContainer,i=t.startOffset,s=t.endContainer,o=t.endOffset,a=e.domAtPos(e.state.selection.anchor);return bu(a.node,a.offset,s,o)&&([r,i,s,o]=[s,o,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function Nh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[th.node(0,e.state.doc.content.size,t)]}function Ih(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:th.widget(e.state.selection.head,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function bh(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function Rh(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function wh(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const kh=new class{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Do.from(e.nodes),t.marks=Do.from(e.marks||{}),this.nodes=ua.compile(this.spec.nodes,this),this.marks=ca.compile(this.spec.marks,this);let n=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 e=this.nodes[r],t=e.spec.content||"",i=e.spec.marks;e.contentMatch=n[t]||(n[t]=qo.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.markSet="_"==i?null:i?ha(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:ha(this,t.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(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ua))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Xo(n,n.defaultAttrs,e,No.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Wo.fromJSON(this,e)}markFromJSON(e){return No.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);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:e=>["span",{"data-mention-id":e.attrs.id},`@${e.attrs.name}`],parseDOM:[{tag:"span[data-mention-id]",getAttrs:e=>({id:e.dataset["mention-id"]})}]}},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:e=>["span",{"data-emoji":e.attrs.emoji},e.attrs.emoji],parseDOM:[{tag:"span[data-emoji]",getAttrs:e=>({emoji:e.dataset.emoji})}]}}}),Lh=new Su("placeholder"),Mh=new vu({key:Lh,props:{decorations(e){if(Fh(e.doc))return;const t=e.doc.firstChild,n=th.node(0,t.nodeSize,{class:"empty-node","data-placeholder":Lh.getState(e)});return ih.create(e.doc,[n])}},state:{init:()=>"",apply:(e,t)=>e.getMeta(Lh)??t}});function Fh(e){return 1!==e.childCount||0!==e.firstChild.childCount}for(var xh={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"},Bh={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"},Ph="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),Uh="undefined"!=typeof navigator&&/Apple Computer/.test(navigator.vendor),Hh="undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),$h="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),jh="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Yh=Ph&&($h||+Ph[1]<57)||Hh&&$h,zh=0;zh<10;zh++)xh[48+zh]=xh[96+zh]=String(zh);for(zh=1;zh<=24;zh++)xh[zh+111]="F"+zh;for(zh=65;zh<=90;zh++)xh[zh]=String.fromCharCode(zh+32),Bh[zh]=String.fromCharCode(zh);for(var Vh in xh)Bh.hasOwnProperty(Vh)||(Bh[Vh]=xh[Vh]);const Gh="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Wh(e){let t,n,r,i,s=e.split(/-(?!$)/),o=s[s.length-1];"Space"==o&&(o=" ");for(let a=0;a<s.length-1;a++){let e=s[a];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);Gh?i=!0:n=!0}}return t&&(o="Alt-"+o),n&&(o="Ctrl-"+o),i&&(o="Meta-"+o),r&&(o="Shift-"+o),o}function Xh(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Kh(e){return new vu({props:{handleKeyDown:qh(e)}})}function qh(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Wh(n)]=e[n];return t}(e);return function(e,n){let r,i=function(e){var t=!(Yh&&(e.ctrlKey||e.altKey||e.metaKey)||(Uh||jh)&&e.shiftKey&&e.key&&1==e.key.length)&&e.key||(e.shiftKey?Bh:xh)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),s=t[Xh(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[Xh(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(r=xh[n.keyCode])&&r!=i){let i=t[Xh(r,n)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}var Jh=200,Zh=function(){};Zh.prototype.append=function(e){return e.length?(e=Zh.from(e),!this.length&&e||e.length<Jh&&this.leafAppend(e)||this.length<Jh&&e.leafPrepend(this)||this.appendInner(e)):this},Zh.prototype.prepend=function(e){return e.length?Zh.from(e).append(this):this},Zh.prototype.appendInner=function(e){return new ed(this,e)},Zh.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Zh.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Zh.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Zh.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Zh.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},Zh.from=function(e){return e instanceof Zh?e:e&&e.length?new Qh(e):Zh.empty};var Qh=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Jh)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Jh)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Zh);Zh.empty=new Qh([]);var ed=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.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,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,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}(Zh),td=Zh;const nd=Math.pow(2,16);function rd(e,t){return e+t*nd}function id(e){return 65535&e}let sd=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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}},od=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=id(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/nd}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:rd(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new sd(i,h,s)}r+=l-u}return n?e+r:new sd(e+r,0,null)}touches(e,t){let n=0,r=id(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};od.empty=new od([]);class ad{constructor(e=[],t,n=0,r=e.length){this.maps=e,this.mirror=t,this.from=n,this.to=r}slice(e=0,t=this.maps.length){return new ad(this.maps,this.mirror,e,t)}copy(){return new ad(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),null!=t&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,n=this.maps.length;t<e.maps.length;t++){let r=e.getMirror(t);this.appendMap(e.maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this.maps.length+e.maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ad;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this.maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let i=this.from;i<this.to;i++){let n=this.maps[i].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(i);if(null!=t&&t>i&&t<this.to){i=t,e=this.maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new sd(e,r,null)}}const ud=Object.create(null);let ld=class{getMap(){return od.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=ud[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ud)throw new RangeError("Duplicate use of step JSON ID "+e);return ud[e]=t,t.prototype.jsonID=e,t}},cd=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Io)return e.fail(t.message);throw t}}};function hd(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy(hd(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}let dd=class e extends ld{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo(hd(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return cd.fromReplace(e,this.from,this.to,i)}invert(){return new pd(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ld.jsonID("addMark",dd);let pd=class e extends ld{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo(hd(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return cd.fromReplace(e,this.from,this.to,n)}invert(){return new dd(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(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,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};ld.jsonID("removeMark",pd);let fd=class e extends ld{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new md(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};ld.jsonID("addNodeMark",fd);let md=class e extends ld{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new fd(this.pos,this.mark):this}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new e(n.pos,t.markFromJSON(n.mark))}};function Ed(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}ld.jsonID("removeNodeMark",md),ld.jsonID("replace",class e extends ld{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ed(e,this.from,this.to)?cd.fail("Structure replace would overwrite content"):cd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new od([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new e(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof e)||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 n=this.slice.size+t.slice.size==0?bo.empty:new bo(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}}{let n=this.slice.size+t.slice.size==0?bo.empty:new bo(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new e(n.from,n.to,bo.fromJSON(t,n.slice),!!n.structure)}}),ld.jsonID("replaceAround",class e extends ld{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Ed(e,this.from,this.gapFrom)||Ed(e,this.gapTo,this.to)))return cd.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cd.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?cd.fromReplace(e,this.from,this.to,n):cd.fail("Content does not fit in gap")}getMap(){return new od([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),s=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new e(n.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(n.from,n.to,n.gapFrom,n.gapTo,bo.fromJSON(t,n.slice),n.insert,!!n.structure)}}),ld.jsonID("attr",class e extends ld{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return cd.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return cd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return od.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}}),ld.jsonID("docAttr",class e extends ld{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return cd.ok(n)}getMap(){return od.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}});let gd=class extends Error{};gd=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(gd.prototype=Object.create(Error.prototype)).constructor=gd,gd.prototype.name="TransformError";class Ad{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}t&&(n=this.remapping(i,this.items.length),r=n.maps.length);let s,o,a=e.tr,u=[],l=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(i,t+1),r=n.maps.length),r--,void l.push(e);if(n){l.push(new _d(e.map));let t,i=e.step.map(n.slice(r));i&&a.maybeStep(i).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],u.push(new _d(t,void 0,void 0,u.length+l.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(s=n?e.selection.map(n.slice(r)):e.selection,o=new Ad(this.items.slice(0,i).append(l.reverse().concat(u)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:a,selection:s}}addTransform(e,t,n,r){let i=[],s=this.eventCount,o=this.items,a=!r&&o.length?o.get(o.length-1):null;for(let l=0;l<e.steps.length;l++){let n,u=e.steps[l].invert(e.docs[l]),c=new _d(e.mapping.maps[l],u,t);(n=a&&a.merge(c))&&(c=n,l?i.pop():o=o.slice(0,o.length-1)),i.push(c),t&&(s++,t=void 0),r||(a=c)}let u=s-n.depth;return u>vd&&(o=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(o,u),s-=u),new Ad(o.append(i),s)}remapping(e,t){let n=new ad;return this.items.forEach(((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new Ad(this.items.append(e.map((e=>new _d(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),r);let a=t;this.items.forEach((t=>{let r=i.getMirror(--a);if(null==r)return;s=Math.min(s,r);let u=i.maps[r];if(t.step){let s=e.steps[r].invert(e.docs[r]),l=t.selection&&t.selection.map(i.slice(a+1,r));l&&o++,n.push(new _d(u,s,l))}else n.push(new _d(u))}),r);let u=[];for(let h=t;h<s;h++)u.push(new _d(i.maps[h]));let l=this.items.slice(0,r).append(u).append(n),c=new Ad(l,o);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach(((s,o)=>{if(o>=e)r.push(s),s.selection&&i++;else if(s.step){let e=s.step.map(t.slice(n)),o=e&&e.getMap();if(n--,o&&t.appendMap(o,n),e){let a=s.selection&&s.selection.map(t.slice(n));a&&i++;let u,l=new _d(o.invert(),e,a),c=r.length-1;(u=r.length&&r[c].merge(l))?r[c]=u:r.push(l)}}else s.map&&n--}),this.items.length,0),new Ad(td.from(r.reverse()),i)}}Ad.empty=new Ad(td.empty,0);class _d{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _d(t.getMap().invert(),t,this.selection)}}}class Dd{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const vd=20;function Td(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,i)=>t.push(r,i)));return t}function Od(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),s=t.map(e[r+1],-1);i<=s&&n.push(i,s)}return n}let Sd=!1,Cd=null;function yd(e){let t=e.plugins;if(Cd!=t){Sd=!1,Cd=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Sd=!0;break}}return Sd}const Nd=new Su("history"),Id=new Su("closeHistory");function bd(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new vu({key:Nd,state:{init:()=>new Dd(Ad.empty,Ad.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let i,s=n.getMeta(Nd);if(s)return s.historyState;n.getMeta(Id)&&(e=new Dd(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(o&&o.getMeta(Nd))return o.getMeta(Nd).redo?new Dd(e.done.addTransform(n,void 0,r,yd(t)),e.undone,Td(n.mapping.maps),e.prevTime,e.prevComposition):new Dd(e.done,e.undone.addTransform(n,void 0,r,yd(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Dd(e.done.rebased(n,i),e.undone.rebased(n,i),Od(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Dd(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Od(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),s=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)})),n}(n,e.prevRanges)),a=o?Od(e.prevRanges,n.mapping):Td(n.mapping.maps);return new Dd(e.done.addTransform(n,s?t.selection.getBookmark():void 0,r,yd(t)),Ad.empty,a,n.time,null==i?e.prevComposition:i)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?wd:"historyRedo"==n?kd:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Rd(e,t){return(n,r)=>{let i=Nd.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let s=function(e,t,n){let r=yd(t),i=Nd.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),i,r),u=new Dd(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Nd,{redo:n,historyState:u})}(i,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}const wd=Rd(!1,!0),kd=Rd(!0,!0),Ld=Math.pow(2,16);function Md(e,t){return e+t*Ld}function Fd(e){return 65535&e}class xd{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}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 Bd{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Bd.empty)return Bd.empty}recover(e){let t=0,n=Fd(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ld}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let a=this.ranges[o]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[o+i],l=this.ranges[o+s],c=a+u;if(e<=c){let i=a+r+((u?e==a?-1:e==c?1:t:t)<0?0:l);if(n)return i;let s=e==(t<0?a:c)?null:Md(o/3,e-a),h=e==a?2:e==c?1:4;return(t<0?e!=a:e!=c)&&(h|=8),new xd(i,h,s)}r+=l-u}return n?e+r:new xd(e+r,0,null)}touches(e,t){let n=0,r=Fd(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let t=this.ranges[o]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[o+i];if(e<=t+a&&o==3*r)return!0;n+=this.ranges[o+s]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],l=this.ranges[r+n];e(o,o+u,a,a+l),i+=l-u}}invert(){return new Bd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Bd.empty:new Bd(e<0?[0,-e,0]:[0,0,e])}}Bd.empty=new Bd([]);const Pd=Object.create(null);class Ud{getMap(){return Bd.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Pd[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Pd)throw new RangeError("Duplicate use of step JSON ID "+e);return Pd[e]=t,t.prototype.jsonID=e,t}}class Hd{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Hd(e,null)}static fail(e){return new Hd(null,e)}static fromReplace(e,t,n,r){try{return Hd.ok(e.replace(t,n,r))}catch(e){if(e instanceof Io)return Hd.fail(e.message);throw e}}}function $d(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let s=e.child(i);s.content.size&&(s=s.copy($d(s.content,t,s))),s.isInline&&(s=t(s,n,i)),r.push(s)}return Oo.fromArray(r)}class jd extends Ud{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new bo($d(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),r),t.openStart,t.openEnd);return Hd.fromReplace(e,this.from,this.to,i)}invert(){return new Yd(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new jd(t.pos,n.pos,this.mark)}merge(e){return e instanceof jd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new jd(t.from,t.to,e.markFromJSON(t.mark))}}Ud.jsonID("addMark",jd);class Yd extends Ud{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new bo($d(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return Hd.fromReplace(e,this.from,this.to,n)}invert(){return new jd(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Yd(t.pos,n.pos,this.mark)}merge(e){return e instanceof Yd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Yd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Yd(t.from,t.to,e.markFromJSON(t.mark))}}Ud.jsonID("removeMark",Yd);class zd extends Ud{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new zd(this.pos,t.marks[n]);return new zd(this.pos,this.mark)}}return new Vd(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zd(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new zd(t.pos,e.markFromJSON(t.mark))}}Ud.jsonID("addNodeMark",zd);class Vd extends Ud{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new zd(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Vd(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Vd(t.pos,e.markFromJSON(t.mark))}}Ud.jsonID("removeNodeMark",Vd);class Gd extends Ud{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Xd(e,this.from,this.to)?Hd.fail("Structure replace would overwrite content"):Hd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Bd([this.from,this.to-this.from,this.slice.size])}invert(e){return new Gd(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Gd(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof Gd)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?bo.empty:new bo(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Gd(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?bo.empty:new bo(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Gd(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Gd(t.from,t.to,bo.fromJSON(e,t.slice),!!t.structure)}}Ud.jsonID("replace",Gd);class Wd extends Ud{constructor(e,t,n,r,i,s,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Xd(e,this.from,this.gapFrom)||Xd(e,this.gapTo,this.to)))return Hd.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Hd.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Hd.fromReplace(e,this.from,this.to,n):Hd.fail("Content does not fit in gap")}getMap(){return new Bd([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Wd(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new Wd(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Wd(t.from,t.to,t.gapFrom,t.gapTo,bo.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Xd(e,t,n){let r=e.resolve(t),i=n-t,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let e=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Kd(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function qd(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let r=e.$from.node(n),i=e.$from.index(n),s=e.$to.indexAfter(n);if(n<e.depth&&r.canReplace(i,s,t))return n;if(0==n||r.type.spec.isolating||!Kd(r,i,s))break}return null}function Jd(e,t,n=1,r){let i=e.resolve(t),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let l=i.depth-1,c=n-2;l>s;l--,c--){let e=i.node(l),t=i.index(l);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),s=r&&r[c+1];s&&(n=n.replaceChild(0,s.type.create(s.attrs)));let o=r&&r[c]||e;if(!e.canReplace(t+1,e.childCount)||!o.type.validContent(n))return!1}let a=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(a,a,u?u.type:i.node(s+1).type)}function Zd(e,t){let n=e.resolve(t),r=n.index();return function(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let s=t.child(i),o=s.type==r?e.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n)return!1;if(!e.type.allowsMarks(s.marks))return!1}return n.validEnd}(e,t))}(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Qd(e,t,n=t,r=bo.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),s=e.resolve(n);return function(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}(i,s,r)?new Gd(t,n,r):new ep(i,s,r).fit()}Ud.jsonID("replaceAround",Wd);class ep{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Oo.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Oo.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,s=n.depth,o=r.depth;for(;s&&o&&1==i.childCount;)i=i.firstChild.content,s--,o--;let a=new bo(i,s,o);return e>-1?new Wd(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Gd(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=rp(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let s=this.depth;s>=0;s--){let e,{type:o,match:a}=this.frontier[s],u=null;if(1==t&&(i?a.matchType(i.type)||(u=a.fillBefore(Oo.from(i),!1)):r&&o.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:s,parent:r,inject:u};if(2==t&&i&&(e=a.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:s,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=rp(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new bo(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=rp(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new bo(tp(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new bo(tp(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,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 s=this.unplaced,o=n?n.content:s.content,a=s.openStart-e,u=0,l=[],{match:c,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));c=c.matchFragment(r)}let d=o.size+e-(s.content.size-s.openEnd);for(;u<o.childCount;){let e=o.child(u),t=c.matchType(e.type);if(!t)break;u++,(u>1||0==a||e.content.size)&&(c=t,l.push(ip(e.mark(h.allowedMarks(e.marks)),1==u?a:0,u==o.childCount?d:-1)))}let p=u==o.childCount;p||(d=-1),this.placed=np(this.placed,t,Oo.from(l)),this.frontier[t].match=c,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=o;f<d;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?bo.empty:new bo(tp(s.content,e-1,1),e-1,d<0?s.openEnd:e-1):new bo(tp(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!sp(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=sp(e,t,r,n,i);if(s){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=sp(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=np(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=np(this.placed,this.depth,Oo.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Oo.empty,!0);e.childCount&&(this.placed=np(this.placed,this.frontier.length,e))}}function tp(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(tp(e.firstChild.content,t-1,n)))}function np(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(np(e.lastChild.content,t-1,n)))}function rp(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function ip(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,ip(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Oo.empty,!0)))),e.copy(r)}function sp(e,t,n,r,i){let s=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,s.content,o)?a:null}class op extends Ud{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Hd.fail("No node at attribute step's position");let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return Hd.fromReplace(e,this.pos,this.pos+1,new bo(Oo.from(r),0,t.isLeaf?0:1))}getMap(){return Bd.empty}invert(e){return new op(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new op(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new op(t.pos,t.attr,t.value)}}Ud.jsonID("attr",op);class ap extends Ud{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Hd.ok(n)}getMap(){return Bd.empty}invert(e){return new ap(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new ap(t.attr,t.value)}}Ud.jsonID("docAttr",ap);let up=class extends Error{};up=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(up.prototype=Object.create(Error.prototype)).constructor=up,up.prototype.name="TransformError";const lp=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function cp(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function hp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function dp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function pp(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function fp(e,t,n,r){let i,s,o=t.nodeBefore,a=t.nodeAfter,u=o.type.spec.isolating||a.type.spec.isolating;if(!u&&function(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!Zd(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let l=!u&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(i=(s=o.contentMatchAt(o.childCount)).findWrapping(a.type))&&s.matchType(i[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=Oo.empty;for(let e=i.length-1;e>=0;e--)s=Oo.from(i[e].create(null,s));s=Oo.from(o.copy(s));let u=e.tr.step(new Wd(t.pos-1,r,t.pos,r,new bo(s,1,0),i.length,!0)),l=u.doc.resolve(r+2*i.length);l.nodeAfter&&l.nodeAfter.type==o.type&&Zd(u.doc,l.pos)&&u.join(l.pos),n(u.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&u?null:nu.findFrom(t,1),h=c&&c.$from.blockRange(c.$to),d=h&&qd(h);if(null!=d&&d>=t.depth)return n&&n(e.tr.lift(h,d).scrollIntoView()),!0;if(l&&cp(a,"start",!0)&&cp(o,"end")){let r=o,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let s=a,u=1;for(;!s.isTextblock;s=s.firstChild)u++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=Oo.empty;for(let e=i.length-1;e>=0;e--)r=Oo.from(i[e].copy(r));n(e.tr.step(new Wd(t.pos-i.length,t.pos+a.nodeSize,t.pos+u,t.pos+a.nodeSize-u,new bo(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function mp(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(ou.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}const Ep=mp(-1),gp=mp(1);function Ap(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let _p=Ap(lp,((e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}(e,n);if(!r)return!1;let i=hp(r);if(!i){let n=r.blockRange(),i=n&&qd(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let s=i.nodeBefore;if(fp(e,i,t,-1))return!0;if(0==r.parent.content.size&&(cp(s,"end")||uu.isSelectable(s)))for(let o=r.depth;;o--){let n=Qd(e.doc,r.before(o),r.after(o),bo.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cp(s,"end")?nu.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):uu.create(r.doc,i.pos-s.nodeSize)),t(r.scrollIntoView())}return!0}if(1==o||r.node(o-1).childCount>1)break}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=hp(r)}let o=s&&s.nodeBefore;return!(!o||!uu.isSelectable(o)||(t&&t(e.tr.setSelection(uu.create(e.doc,s.pos-o.nodeSize)).scrollIntoView()),0))})),Dp=Ap(lp,((e,t,n)=>{let r=function(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}(e,n);if(!r)return!1;let i=dp(r);if(!i)return!1;let s=i.nodeAfter;if(fp(e,i,t,1))return!0;if(0==r.parent.content.size&&(cp(s,"start")||uu.isSelectable(s))){let n=Qd(e.doc,r.before(),r.after(),bo.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(cp(s,"start")?nu.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):uu.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),0))}),((e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=dp(r)}let o=s&&s.nodeAfter;return!(!o||!uu.isSelectable(o)||(t&&t(e.tr.setSelection(uu.create(e.doc,s.pos)).scrollIntoView()),0))}));const vp={Enter:Ap(((e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}),((e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof cu||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=pp(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,s.createAndFill());o.setSelection(ou.create(o.doc,n+1)),t(o.scrollIntoView())}return!0}),((e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Jd(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&qd(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)}),((e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof uu&&e.selection.node.isBlock)return!(!n.parentOffset||!Jd(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let i,s,o=[],a=!1,u=!1;for(let d=n.depth;;d--){if(n.node(d).isBlock){a=n.end(d)==n.pos+(n.depth-d),u=n.start(d)==n.pos-(n.depth-d),s=pp(n.node(d-1).contentMatchAt(n.indexAfter(d-1))),o.unshift(a&&s?{type:s}:null),i=d;break}if(1==d)return!1;o.unshift(null)}let l=e.tr;(e.selection instanceof ou||e.selection instanceof cu)&&l.deleteSelection();let c=l.mapping.map(n.pos),h=Jd(l.doc,c,o.length,o);if(h||(o[0]=s?{type:s}:null,h=Jd(l.doc,c,o.length,o)),l.split(c,o.length,o),!a&&u&&n.node(i).type!=s){let e=l.mapping.map(n.before(i)),t=l.doc.resolve(e);s&&n.node(i-1).canReplaceWith(t.index(),t.index()+1,s)&&l.setNodeMarkup(l.mapping.map(n.before(i)),s)}return t&&t(l.scrollIntoView()),!0})),"Mod-Enter":(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=pp(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(nu.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Backspace:_p,"Mod-Backspace":_p,"Shift-Backspace":_p,Delete:Dp,"Mod-Delete":Dp,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new cu(e.doc))),!0)},Tp={"Ctrl-h":vp.Backspace,"Alt-Backspace":vp["Mod-Backspace"],"Ctrl-d":vp.Delete,"Ctrl-Alt-Backspace":vp["Mod-Delete"],"Alt-Delete":vp["Mod-Delete"],"Alt-d":vp["Mod-Delete"],"Ctrl-a":Ep,"Ctrl-e":gp};for(let os in vp)Tp[os]=vp[os];const Op=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?Tp:vp;function Sp(e,t){return e.reduce(((e,n,r)=>e.concat(t(n,r))),[])}var Cp={};function yp(e){return String.fromCharCode(parseInt(e.slice(1),16))}Object.defineProperty(Cp,"__esModule",{value:!0});var Np=Cp.encode=function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,yp))};function Ip(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Cp.decode=function(e){return decodeURIComponent(Array.from(atob(e),Ip).join(""))};const bp=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/;function Rp(e){const t=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}(e)%Fp.length;return Fp[t]}function wp(e,t){const n=t.lastIndex;let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return t.lastIndex=n,i}function kp(e,t,n){let r=0;const i=[];for(const s of t)s.offset<r||(s.offset>r&&i.push(e.substring(r,s.offset)),i.push(...n(s)),r=s.offset+s.matchedText.length);return r<e.length&&i.push(e.substring(r)),i}function Lp(e){{const t=document.createElement("a");return t.href=e,t.hostname}}function Mp(e){const t=e.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}const Fp=["#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"],xp=(e,t,n=void 0)=>Sp(e,(e=>{if("string"==typeof e)return t(e,n);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:e.type,children:xp(e.children,t,e.type)}];case"link":return[{type:e.type,url:e.url,children:xp(e.children,t,e.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:e.type,action:e.action,params:e.params,children:xp(e.children,t,e.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[e]}}));function Bp(e,t){return n=>{const r=n;let i=0;const s=[];for(const o of wp(n,e)){o.index-i>0&&s.push(r.substring(i,o.index));const e=t(o);Array.isArray(e)?s.push(...e):s.push(e),i=o.index+o[0].length}return i<n.length&&s.push(n.substring(i)),s}}const Pp="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var Up=(e=>(e[e.italic=1]="italic",e[e.strikethrough=2]="strikethrough",e[e.bold=4]="bold",e))(Up||{});const Hp=[0,1,2,3,4,5,6].map((e=>{const t=[];return 1&e||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&e||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&e||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map((e=>e.source)).join("|"),"g")})),$p={_:1,"*":4,"~":2};function jp(e){return Yp(e,0)}function Yp(e,t=0){const n=Hp[t],r=n?function(e){const t=Bp(zp.getOrCompute(e,(()=>new RegExp(`(?:^|[\\s${Pp}])(?:${e.source})(?=[\\s${Pp}]|$)`,"g"))),(e=>{const t=e[0][1],n=e[1]||e[2]||e[3]||e[4]||e[5]||e[6];return[" ",{type:Up[$p[t]],children:[n]}]}));return e=>{const[n,...r]=t(" "+e);return n.length>1&&r.unshift(n.substring(1)),r}}(n):()=>[e];return xp(r(e),((e,n)=>"bold"===n||"italic"===n||"strikethrough"===n?Yp(e,t|Up[n]):[e]))}const zp=function(){const e=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(t,n){if(e.has(t))return e.get(t);const r=n();return e.set(t,r),r}}}();function Vp(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function Gp(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function Wp(e){throw new Error("Unhandled case for value: '"+e+"'")}var Xp=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);t=s.shift();)-1===Vp(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);i.length&&(t=s.shift());){var o=Vp(i,t);-1!==o&&i.splice(o,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}(),Kp=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new Xp({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,s=r.length;i<s;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n=t.length,r=t.location;return"smart"===r?function(e,t,n){var r,i;null==n?(n="&hellip;",i=3,r=8):(i=n.length,r=n.length);var s=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},o=function(e,t){var r=t/2,i=Math.ceil(r),s=-1*Math.floor(r),o="";return s<0&&(o=e.substr(s)),e.substr(0,i)+n+o};if(e.length<=t)return e;var a=t-i,u=function(e){var t={},n=e,r=n.match(/^([a-z]+):\/\//i);return r&&(t.scheme=r[1],n=n.substr(r[0].length)),(r=n.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(t.host=r[1],n=n.substr(r[0].length)),(r=n.match(/^\/(.*?)(?=(\?|#|$))/i))&&(t.path=r[1],n=n.substr(r[0].length)),(r=n.match(/^\?(.*?)(?=(#|$))/i))&&(t.query=r[1],n=n.substr(r[0].length)),(r=n.match(/^#(.*?)$/i))&&(t.fragment=r[1]),t}(e);if(u.query){var l=u.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);l&&(u.query=u.query.substr(0,l[1].length),e=s(u))}if(e.length<=t)return e;if(u.host&&(u.host=u.host.replace(/^www\./,""),e=s(u)),e.length<=t)return e;var c="";if(u.host&&(c+=u.host),c.length>=a)return u.host.length==t?(u.host.substr(0,t-i)+n).substr(0,a+r):o(c,a).substr(0,a+r);var h="";if(u.path&&(h+="/"+u.path),u.query&&(h+="?"+u.query),h){if((c+h).length>=a)return(c+h).length==t?(c+h).substr(0,t):(c+o(h,a-c.length)).substr(0,a+r);c+=h}if(u.fragment){var d="#"+u.fragment;if((c+d).length>=a)return(c+d).length==t?(c+d).substr(0,t):(c+o(d,a-c.length)).substr(0,a+r);c+=d}if(u.scheme&&u.host){var p=u.scheme+"://";if((c+p).length<a)return(p+c).substr(0,t)}if(c.length<=t)return c;var f="";return a>0&&(f=c.substr(-1*Math.floor(a/2))),(c.substr(0,Math.ceil(a/2))+n+f).substr(0,a+r)}(e,n):"middle"===r?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="&hellip;",r=8,i=3):(r=n.length,i=n.length);var s=t-i,o="";return s>0&&(o=e.substr(-1*Math.floor(s/2))),(e.substr(0,Math.ceil(s/2))+n+o).substr(0,s+r)}(e,n):function(e,t){return function(e,t,n){var r;return e.length>t&&(null==n?(n="&hellip;",r=3):r=n.length,e=e.substring(0,t-r)+n),e}(e,t,void 0)}(e,n)},e}(),qp=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),Jp=function(e,t){return Jp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Jp(e,t)};function Zp(e,t){function n(){this.constructor=e}Jp(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Qp,ef=function(){return ef=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ef.apply(this,arguments)},tf=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return Zp(t,e),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}(qp),nf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return Zp(t,e),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,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(qp),rf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return Zp(t,e),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 t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(qp),sf=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return Zp(t,e),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}(qp),of=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return Zp(t,e),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 t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}},t}(qp),af=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},uf=/[A-Za-z]/,lf=/[\d]/,cf=/[\D]/,hf=/\s/,df=/['"]/,pf=/[\x00-\x1F\x7F]/,ff=/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,mf=ff+/\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,Ef=/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,gf=mf+Ef,Af=mf+Ef,_f="(?:["+Ef+"]{1,3}\\.){3}["+Ef+"]{1,3}",Df="["+Af+"](?:["+Af+"\\-]{0,61}["+Af+"])?",vf=function(e){return"(?=("+Df+"))\\"+e},Tf=function(e){return"(?:"+vf(e)+"(?:\\."+vf(e+1)+"){0,126}|"+_f+")"},Of=new RegExp("["+Af+"]"),Sf=/(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,Cf=new RegExp("["+Af+"!#$%&'*+/=?^_`{|}~-]"),yf=new RegExp("^"+Sf.source+"$"),Nf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=Cf,t.strictTldRegex=yf,t}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],s=e.length,o=new If,a={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},u=0,l=0,c=o;u<s;){var h=e.charAt(u);switch(l){case 0:d(h);break;case 1:p(e.charAt(u-1),h);break;case 2:f(h);break;case 3:m(h);break;case 4:E(h);break;case 5:g(h);break;case 6:A(h);break;case 7:_(h);break;default:Wp(l)}u++}return T(),i;function d(e){"m"===e?D(1):n.test(e)&&D()}function p(e,t){":"===e?n.test(t)?(l=2,c=new If(ef(ef({},c),{hasMailtoPrefix:!0}))):v():a[e]===t||(n.test(t)?l=2:"."===t?l=3:"@"===t?l=4:v())}function f(e){"."===e?l=3:"@"===e?l=4:n.test(e)||v()}function m(e){"."===e||"@"===e?v():n.test(e)?l=2:v()}function E(e){Of.test(e)?l=5:v()}function g(e){"."===e?l=7:"-"===e?l=6:Of.test(e)||T()}function A(e){"-"===e||"."===e?T():Of.test(e)?l=5:T()}function _(e){"."===e||"-"===e?T():Of.test(e)?(l=5,c=new If(ef(ef({},c),{hasDomainDot:!0}))):T()}function D(e){void 0===e&&(e=2),l=e,c=new If({idx:u})}function v(){l=0,c=o}function T(){if(c.hasDomainDot){var n=e.slice(c.idx,u);/[-.]$/.test(n)&&(n=n.slice(0,-1));var s=c.hasMailtoPrefix?n.slice(7):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(s)&&i.push(new tf({tagBuilder:t,matchedText:n,offset:c.idx,email:s}))}v()}},t}(af),If=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},bf=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t||this.hasFullProtocolRegex.test(t)||this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+ff+"]"),e.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]*)?\/?$/,e}(),Rf=(Qp=new RegExp("[/?#](?:["+Af+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Af+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Tf(2),")","|","(","(//)?",/(?:www\.)/.source,Tf(6),")","|","(","(//)?",Tf(10)+"\\.",Sf.source,"(?![-"+gf+"])",")",")","(?::[0-9]+)?","(?:"+Qp.source+")?"].join(""),"gi")),wf=new RegExp("["+Af+"]"),kf=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=Rf,n.wordCharRegExp=wf,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,s=this.decodePercentEncoding,o=this.tagBuilder,a=[],u=function(){var n=t[0],u=t[1],c=t[4],h=t[5],d=t[9],p=t.index,f=h||d,m=e.charAt(p-1);if(!bf.isValid(n,u))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),l.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var E=l.matchHasInvalidCharAfterTld(n,u);E>-1&&(n=n.substr(0,E))}var g=["http://","https://"].find((function(e){return!!u&&-1!==u.indexOf(e)}));if(g){var A=n.indexOf(g);n=n.substr(A),u=u.substr(A),p+=A}var _=u?"scheme":c?"www":"tld",D=!!u;a.push(new of({tagBuilder:o,matchedText:n,offset:p,urlMatchType:_,url:n,protocolUrlMatch:D,protocolRelativeMatch:!!f,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:s}))},l=this;null!==(t=n.exec(e));)u();return a},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,s=e.length-1;i<s;i++){var o=e.charAt(i);o===t?r++:o===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+Af+"]*[-"+Af+"]\\.[-"+Af+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(af),Lf=new RegExp("#[_"+Af+"]{1,139}(?![_"+Af+"])","g"),Mf=new RegExp("[^"+Af+"]"),Ff=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Lf,n.nonWordCharRegex=Mf,n.serviceName=t.serviceName,n}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,s=this.tagBuilder,o=[];null!==(t=n.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||r.test(u)){var l=t[0],c=t[0].slice(1);o.push(new nf({tagBuilder:s,matchedText:l,offset:a,serviceName:i,hashtag:c}))}}return o},t}(af),xf=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"),Bf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=xf,t}return Zp(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var s=t[0],o=s.replace(/[^0-9,;#]/g,""),a=!(!t[1]&&!t[2]),u=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+s.length,1),c=!u.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(s)&&c&&i.push(new sf({tagBuilder:r,matchedText:s,offset:t.index,number:o,plusSign:a}))}return i},t.prototype.testMatch=function(e){return cf.test(e)},t}(af),Pf=new RegExp("@[_"+Af+"]{1,50}(?![_"+Af+"])","g"),Uf=new RegExp("@[_."+Af+"]{1,30}(?![_"+Af+"])","g"),Hf=new RegExp("@[-_."+Af+"]{1,50}(?![-_"+Af+"])","g"),$f=new RegExp("[^"+Af+"]"),jf=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:Pf,instagram:Uf,soundcloud:Hf},n.nonWordCharRegex=$f,n.serviceName=t.serviceName,n}return Zp(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,s=this.tagBuilder,o=[];if(!r)return o;for(;null!==(t=r.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||i.test(u)){var l=t[0].replace(/\.+$/g,""),c=l.slice(1);o.push(new rf({tagBuilder:s,matchedText:l,offset:a,serviceName:n,mention:c}))}}return o},t}(af);var Yf=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},zf=function(){function e(t){void 0===t&&(t={}),this.version=e.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="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&"twitter"!==n&&"instagram"!==n&&"soundcloud"!==n)throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(!1!==r&&"twitter"!==r&&"facebook"!==r&&"instagram"!==r)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 e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return function(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,s=t.onText,o=t.onComment,a=t.onDoctype,u=new Yf,l=0,c=e.length,h=0,d=0,p=u;l<c;){var f=e.charAt(l);switch(h){case 0:m(f);break;case 1:E(f);break;case 2:A(f);break;case 3:g(f);break;case 4:_(f);break;case 5:D(f);break;case 6:v(f);break;case 7:T(f);break;case 8:O(f);break;case 9:S(f);break;case 10:C(f);break;case 11:y(f);break;case 12:N(f);break;case 13:I();break;case 14:b(f);break;case 15:R(f);break;case 16:w(f);break;case 17:k(f);break;case 18:L(f);break;case 19:M(f);break;case 20:F(f);break;default:Wp(h)}l++}function m(e){"<"===e&&B()}function E(e){"!"===e?h=13:"/"===e?(h=2,p=new Yf(ef(ef({},p),{isClosing:!0}))):"<"===e?B():uf.test(e)?(h=3,p=new Yf(ef(ef({},p),{isOpening:!0}))):(h=0,p=u)}function g(e){hf.test(e)?(p=new Yf(ef(ef({},p),{name:U()})),h=4):"<"===e?B():"/"===e?(p=new Yf(ef(ef({},p),{name:U()})),h=12):">"===e?(p=new Yf(ef(ef({},p),{name:U()})),P()):uf.test(e)||lf.test(e)||":"===e||x()}function A(e){">"===e?x():uf.test(e)?h=3:x()}function _(e){hf.test(e)||("/"===e?h=12:">"===e?P():"<"===e?B():"="===e||df.test(e)||pf.test(e)?x():h=5)}function D(e){hf.test(e)?h=6:"/"===e?h=12:"="===e?h=7:">"===e?P():"<"===e?B():df.test(e)&&x()}function v(e){hf.test(e)||("/"===e?h=12:"="===e?h=7:">"===e?P():"<"===e?B():df.test(e)?x():h=5)}function T(e){hf.test(e)||('"'===e?h=8:"'"===e?h=9:/[>=`]/.test(e)?x():"<"===e?B():h=10)}function O(e){'"'===e&&(h=11)}function S(e){"'"===e&&(h=11)}function C(e){hf.test(e)?h=4:">"===e?P():"<"===e&&B()}function y(e){hf.test(e)?h=4:"/"===e?h=12:">"===e?P():"<"===e?B():(h=4,l--)}function N(e){">"===e?(p=new Yf(ef(ef({},p),{isClosing:!0})),P()):h=4}function I(t){"--"===e.substr(l,2)?(l+=2,p=new Yf(ef(ef({},p),{type:"comment"})),h=14):"DOCTYPE"===e.substr(l,7).toUpperCase()?(l+=7,p=new Yf(ef(ef({},p),{type:"doctype"})),h=20):x()}function b(e){"-"===e?h=15:">"===e?x():h=16}function R(e){"-"===e?h=18:">"===e?x():h=16}function w(e){"-"===e&&(h=17)}function k(e){h="-"===e?18:16}function L(e){">"===e?P():"!"===e?h=19:"-"===e||(h=16)}function M(e){"-"===e?h=17:">"===e?P():h=16}function F(e){">"===e?P():"<"===e&&B()}function x(){h=0,p=u}function B(){h=1,p=new Yf({idx:l})}function P(){var t=e.slice(d,p.idx);t&&s(t,d),"comment"===p.type?o(p.idx):"doctype"===p.type?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),x(),d=l+1}function U(){var t=p.idx+(p.isClosing?2:1);return e.slice(t,l).toLowerCase()}d<l&&(n=e.slice(d,l),s(n,d),d=l+1)}(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var s=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),o=n;s.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,o);i.push.apply(i,r)}o+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,s=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>i?t:t+1;e.splice(o,1);continue}e[t+1].getOffset()<s&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||Gp(e,(function(e){return"hashtag"===e.getType()})),this.email||Gp(e,(function(e){return"email"===e.getType()})),this.phone||Gp(e,(function(e){return"phone"===e.getType()})),this.mention||Gp(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||Gp(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||Gp(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||Gp(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,s=n.length;i<s;i++){for(var o=n[i].parseMatches(e),a=0,u=o.length;a<u;a++)o[a].setOffset(t+o[a].getOffset());r.push.apply(r,o)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var t=this.parse(e),n=[],r=0,i=0,s=t.length;i<s;i++){var o=t[i];n.push(e.substring(r,o.getOffset())),n.push(this.createMatchReturnVal(o)),r=o.getOffset()+o.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof Xp?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Ff({tagBuilder:e,serviceName:this.hashtag}),new Nf({tagBuilder:e}),new Bf({tagBuilder:e}),new jf({tagBuilder:e,serviceName:this.mention}),new kf({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new Kp({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=Kp,e.HtmlTag=Xp,e.matcher={Email:Nf,Hashtag:Ff,Matcher:af,Mention:jf,Phone:Bf,Url:kf},e.match={Email:tf,Hashtag:nf,Match:qp,Mention:rf,Phone:sf,Url:of},e}();function Vf(e,t=e){return{type:"autolink",url:e,text:t}}const Gf=Bp(/<!!mention:([^>\s]*?)\|(.*?)>/gm,(([e,t,n])=>function(e,t){return{type:"mention",id:e,text:t}}(decodeURIComponent(t),n))),Wf=Bp(/<!!customemoji:(.*?)>/gm,(([e,t])=>function(e){return{type:"customemoji",text:e}}(t))),Xf=Bp(/<((?:https?|mailto):.*?)\|(.*?)>/gi,(([e,t,n])=>function(e,t=[]){return{type:"link",url:e,children:t}}(t,[n]))),Kf=Bp(/<actionlink:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Jf(t);return function(e,t,n=[]){return{type:"actionlink",action:e,params:t,children:n}}(r,i,[n])})),qf=Bp(/<actionbutton:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Jf(t);return function(e,t,n=[]){return{type:"actionbutton",action:e,params:t,children:n}}(r,i,[n])}));function Jf(e){const t=e.indexOf("?");return-1===t?{action:e,params:{}}:{action:e.slice(0,t),params:Object.fromEntries(new URLSearchParams(e.slice(t)))}}const Zf=Bp(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,(([e])=>function(e=[]){return{type:"bulletlist",children:e}}([e.startsWith("\n")?e.slice(1):e]))),Qf=Bp(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,(([e,t])=>({type:"bulletpoint",children:[t]}))),em=e=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let n=0;const r=[];for(const i of wp(e,t)){const t=i[0],s=i[1],o=t.startsWith(s)?i.index:i.index+1;o-n>0&&r.push(e.substring(n,o));const a=Vf("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(a),n=o+s.length}return n<e.length&&r.push(e.substring(n)),r},tm=e=>Xf(e).flatMap((e=>"string"==typeof e?nm(e):["<",...nm(e.url),...nm("|"+e.children[0]+">")])),nm=e=>{const t=zf.parse(e,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),n=[];let r=0;for(const i of t){const t=i.getOffset(),s=i.getMatchedText(),o=s.length;let a=s;i instanceof tf?a="mailto:"+i.getEmail():i instanceof of&&(a=i.getUrl()),t>r&&n.push(e.substring(r,t)),n.push(Vf(a,s)),r=t+o}return r<e.length&&n.push(e.substring(r)),n},rm=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"];const im=function(){const e=RegExp("[^\n]+\n?|\n","g");return t=>Array.from(t.match(e)||[])}();function sm(e,t={except:[]}){let n=function(e,t){let n=[e];return n=om(n,t.multilineSteps),n=om(n,[im]),n=om(n,t.singlelineSteps),n=am(n),n}(e,function(e={except:[]}){const t={multilineSteps:[],singlelineSteps:[]},n=e.except??rm.filter((t=>!e.only.includes(t)));return n.includes("BulletPoint")||t.multilineSteps.push(Zf,Qf),n.includes("Mention")||t.singlelineSteps.push(Gf),n.includes("CustomEmoji")||t.singlelineSteps.push(Wf),n.includes("Codespan")||t.multilineSteps.push(Bp(/```([^]+?)```/g,(([e,t])=>({type:"codespan",text:t})))),n.includes("FormattedLink")||t.singlelineSteps.push(Xf),n.includes("Actions")||(t.singlelineSteps.push(Kf),t.singlelineSteps.push(qf)),n.includes("Wikitext")||t.singlelineSteps.push(jp),n.includes("Autolink")||t.singlelineSteps.push(tm,em),t}(t));return n=um(n,!1),n}function om(e,t){return t.reduce(((e,t)=>xp(e,t)),e)}function am(e){const t=[];let n=-1;for(const r of e)"string"==typeof r?"string"==typeof t[n]?t[n]+=r:t[++n]=r:t[++n]="children"in r?{...r,children:am(r.children)}:r;return t}function um(e,t){const n=[];let r=[];for(let i=0;i<e.length;i++){const s=e[i];"string"==typeof s?r.push(s):"children"in s?(r.length>0&&(n.push(r.join("")),r=[]),s.children=um(s.children,t||"link"===s.type||"actionbutton"===s.type||"actionlink"===s.type),n.push(s)):"autolink"===s.type&&t?r.push(s.text):(r.length>0&&(n.push(r.join("")),r=[]),n.push(s))}return r.length>0&&(n.push(r.join("")),r=[]),n}function lm(e,t,n,r=0,i=[]){for(const s of n)if("string"==typeof s){for(const n of i)e.addMark(t+r,t+r+s.length,n.create());r+=s.length}else if("bold"===s.type||"italic"===s.type||"strikethrough"===s.type){r+=1;const n=kh.marks[s.type],o=[...i,n];[e,r]=lm(e,t,s.children,r,o),r+=1}else si.unreachable();return[e,r]}function cm(e){return(t,n)=>{if(!n)return!0;let r=t.tr;const i=ou.between(t.selection.$from,t.selection.$to);return r=r.replaceRangeWith(i.from,i.from,kh.text(e,r.storedMarks)),r=r.replaceRangeWith(i.to+1,i.to+1,kh.text(e,r.storedMarks)),r=r.setSelection(ou.near(r.doc.resolve(i.to+1))),n(r),!0}}function hm({placeholder:e,disabled:t,className:n="",characterLimit:r,spellcheck:i}){const s=li(),o=le(),a=le(null);return ae((()=>(o.current=function(e,t,n,r){const i=_u.create({schema:kh,plugins:[...[].filter(pm),bd(),Kh({...Op,"Mod-z":wd,"Mod-y":kd,"Mod-b":cm("*"),"Mod-i":cm("_"),"Mod-Enter":Op.Enter,"Shift-Enter":Op.Enter,Enter:n}),Kh({Enter:Op.Enter}),Mh]}),s=function(){let e,t=0;return n=>{const r=(r=Date.now())=>{window.clearTimeout(e),e=void 0,t=r;const i=function(e){(e=(e=(e=e.removeMark(0,e.doc.content.size,kh.marks.bold)).removeMark(0,e.doc.content.size,kh.marks.italic)).removeMark(0,e.doc.content.size,kh.marks.strikethrough)).doc.firstChild;const t=function(e){const t=[];let n,r="";return e.descendants(((e,i)=>(e.isText?(r+=e.text,n??=i):r&&void 0!==n&&(t.push({text:r,pos:n}),r="",n=void 0),e.type!==kh.nodes.mention))),r&&void 0!==n&&t.push({text:r,pos:n}),t}(e.doc);for(const{text:n,pos:r}of t){const t=sm(n,{only:["Wikitext"]});[e]=lm(e,r,t)}return e}(n.state.tr);n.dispatch(i)},i=Date.now();i-t<300?e||(e=window.setTimeout(r,300)):r(i)}}(),o=new yh(e,{handlePaste:(e,t,n)=>function(e,t,n){const r=t.clipboardData;if(!r)return!1;const i=function(e){const t=e.items||[],n={"image/gif":"gif","image/png":"png","image/jpeg":"jpg","image/svg+xml":"svg"},r=Array.from(t).filter((e=>"file"===e.kind&&n[e.type]));if(0===r.length)return;if(e.types.includes("text/rtf"))return;const i=r[0];let s=i.getAsFile();if(!s.name){const e="image."+n[i.type];s=new File([s],e,{type:i.type,lastModified:Date.now()})}return s}(r);return i?n(i):function(e,t){const n=e.state.tr.insertText(t).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");e.dispatch(n)}(e,r.getData("text/plain")),!0}(e,t,r),clipboardTextSerializer(e){const t=[];return e.content.forEach((e=>{e&&t.push(e.textContent.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1"))})),t.join()},state:i,dispatchTransaction(e){e=(e=e.removeStoredMark(kh.marks.literal)).removeStoredMark(kh.marks.emoji);const n=o.state.apply(e);o.state.doc.eq(n.doc)||t(new dm(n.doc)),o.updateState(n),e.steps.some((e=>e instanceof Gd))&&setTimeout((()=>s(o)),0)}});return o}(a.current,(e=>s.onChange(e)),(()=>!!s.onEnter&&(s.onEnter(),!0)),(e=>s.onPasteImage(e))),s.editorView=o.current,()=>{s.editorView=void 0,o.current?.destroy()})),[s]),ae((()=>{o.current?.setProps({editable:()=>!t})}),[t]),ae((()=>Xn((()=>o.current?.setProps({attributes:{spellcheck:String(s.spellcheck$.get()??i??!1),class:"t-text-input","aria-label":"Message Field",role:"textbox"}})))),[s,i]),ae((()=>Xn((()=>{const t=o.current;t?.dispatch(t.state.tr.setMeta(Mh,s.placeholder$.get()??e))}))),[s,e]),ae((()=>{r&&Number.isInteger(r)&&s.setMaxLength(r)}),[r,s]),It("div",{className:`t-editor ${n}`,ref:a})}class dm{constructor(e){this.doc=e,this.size=this.doc.content.size,this.hasContent=Fh(this.doc)}static{this.EMPTY=new dm(kh.topNodeType.create())}asText(){return this.doc.textContent.replace(/\xa0/g," ")}}function pm(e){return null!=e}class fm{constructor(e,t,n,r){this.send=t,this.attachFile=n,this.shareLocation=r,this.isEmpty=e.isEmpty,this.isTyping=e.isTyping,this.atTextLimit=e.atTextLimit,this.characterCount=e.characterCount}}class mm{constructor(e){this.state$=e,this.currentDoc=dm.EMPTY,this.maxLength=1e3,this.markAsTyping=function(e){let t=!1;return(...n)=>{if(!t)return t=!0,setTimeout((()=>{t=!1}),5e3),e(...n)}}((()=>{this.controller?.markAsTyping()})),this.spellcheck$=yr(),this.placeholder$=yr()}onPasteImage(e){si.defined(this.uploadFile),this.uploadFile(e)}onChange(e){this.currentDoc=e;const t=e.asText(),n=e.size>this.maxLength&&t.length>this.maxLength;e.hasContent&&this.markAsTyping(),this.state$.assign({isTyping:e.hasContent,atTextLimit:n,isEmpty:!e.hasContent||0===t.trim().length,characterCount:0===e.size?0:e.size-2})}setMaxLength(e){this.maxLength=e}focus(){this.editorView?.dom.focus()}setText(e){this.editorView&&function(e,t){const n=e.state.doc.content.size,r=t.split(/(<!!(?:mention|customemoji):.*?>)/g).filter((e=>e||e.length)).map((e=>kh.text(e))),i=e.state.tr.replaceWith(0,n,r);e.dispatch(i)}(this.editorView,e)}typeText(e){this.editorView&&function(e,t,n="replace"){const r=e.state.doc.content.size,i="insert"==n?e.state.tr.insertText(t):e.state.tr.insertText(t,0,r);e.dispatch(i)}(this.editorView,e,"insert")}getText(){return this.currentDoc.asText().trim()}clearText(){this.editorView&&function(e){const t=e.state.doc.content.size,n=e.state.tr.insertText("",0,t);e.dispatch(n)}(this.editorView)}}const Em=()=>!0;async function gm(e,t,{initialDelay:n,maxDelay:r,log:i,shouldRetry:s=Em}){return t().catch((async o=>{if(i&&i(`[TalkJS] Retries left: ${e}. Error: ${JSON.stringify(o)}.`),0===e)throw o;if(!(await s(o)))throw o;const a=1e3*n*1.2,u=(r?Math.min(1e3*r,a):a)*(1-.05+2*Math.random()*.05);return function(e){return e<=0?Promise.resolve():new Promise((t=>setTimeout(t,e)))}(u).then((()=>gm(e-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:s})))}))}function Am(){const e={},t=new Promise((function(t,n){e.resolve=t,e.reject=n}));return e.promise=t,e}function _m(e,t,n){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=pe(di);return de((async()=>{function n(t){"denied"===t&&i({type:e})}if(!r||!(await async function(e){if(!("permissions"in navigator))return!1;const t=e;try{return"prompt"===(await navigator.permissions.query({name:t})).state}catch(e){return!1}}(e)))return t((e=>{n(e)}));const s=Am(),o=Am(),a={type:e,showPrompt:async()=>(o.resolve({cancelled:!1}),await s.promise),cancel:()=>{o.resolve({cancelled:!0})}};try{r(a)}catch(e){Ss.error("Your beforeBrowserPermissionPrompt callback threw an error: ",e),o.resolve({cancelled:!0})}const{cancelled:u}=await o.promise;return u?void 0:t((e=>{s.resolve(e),n(e)}))}),[r,i,e,t,...n])}async function Dm(e,t,n){const r=document.createElement(e);try{return r.src=URL.createObjectURL(t),await new Promise(((t,i)=>{const s="img"===e?"load":"loadedmetadata";r.addEventListener(s,(()=>{try{t(n(r))}catch(e){i(e)}}),{once:!0})}))}finally{URL.revokeObjectURL(r.src)}}var vm=function(e,t,n,r){var i;t[0]=0;for(var s=1;s<t.length;s++){var o=t[s++],a=t[s]?(t[0]|=o?1:2,n[t[s++]]):t[++s];3===o?r[0]=a:4===o?r[1]=Object.assign(r[1]||{},a):5===o?(r[1]=r[1]||{})[t[++s]]=a:6===o?r[1][t[++s]]+=a+"":o?(i=e.apply(a,vm(e,a,n,["",null])),r.push(i),a[0]?t[0]|=2:(t[s-2]=0,t[s]=i)):r.push(a)}return r},Tm=new Map;function Om(e){var t=Tm.get(this);return t||(t=new Map,Tm.set(this,t)),(t=vm(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,r=1,i="",s="",o=[0],a=function(e){1===r&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?o.push(0,e,i):3===r&&(e||i)?(o.push(3,e,i),r=2):2===r&&"..."===i&&e?o.push(4,e,0):2===r&&i&&!e?o.push(5,0,!0,i):r>=5&&((i||!e&&5===r)&&(o.push(r,0,i,n),r=6),e&&(o.push(r,e,0,n),r=6)),i=""},u=0;u<e.length;u++){u&&(1===r&&a(),a(u));for(var l=0;l<e[u].length;l++)t=e[u][l],1===r?"<"===t?(a(),o=[o],r=3):i+=t:4===r?"--"===i&&">"===t?(r=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(a(),r=1):r&&("="===t?(r=5,n=i,i=""):"/"===t&&(r<5||">"===e[u][l+1])?(a(),3===r&&(o=o[0]),r=o,(o=o[0]).push(2,0,r),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(),r=2):i+=t),3===r&&"!--"===i&&(r=4,o=o[0])}return a(),o}(e)),t),arguments,[])).length>1?t:t[0]}const Sm={TALK_GMK:"AIzaSyAs_WXNLlj31EHJI_Lw8siO2B3ZJLUzBH0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}.TALK_GMK;function Cm(e){e=Math.floor(e);const t=Math.floor(e/3600);e%=3600;const n=Math.floor(e/60);e%=60;const r=e=>e.toString().padStart(2,"0");let i=`${r(n)}:${r(e)}`;return t>0&&(i=`${r(t)}:${i}`),i}const ym=36e5,Nm=864e5;function Im(e,t,n){return new Intl.RelativeTimeFormat(n).format(-e,t)}function bm(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function Rm(e,t){return n=>{if(e&&e(n),!n.defaultPrevented)return t(n)}}function wm(e){return"boolean"==typeof e}function km(e){return!(!e||"[object Function]"!={}.toString.call(e))}function Lm(e,t){if(null!=e)if(km(e))e(t);else try{e.current=t}catch(n){throw new Error(`Cannot assign value "${t}" to ref "${e}"`)}}function Mm(...e){return de((t=>{for(let n of e)Lm(n,t)}),e)}function Fm(e){return bm()?e?e.ownerDocument:document:null}function xm(e){return"which"in e?3===e.which:"button"in e&&2===e.button}function Bm(...e){return e.filter((e=>null!=e)).join("--")}function Pm(){}function Um(){let[,e]=se(Object.create(null));return de((()=>{e(Object.create(null))}),[])}var Hm=bm()?ue:ae;function $m(e){const t=le(null);return ae((()=>{t.current=e}),[e]),t.current}var jm=({children:e,type:t="reach-portal",containerRef:n})=>{let r=le(null),i=le(null),s=Um();return ae((()=>{null!=n&&("object"==typeof n&&"current"in n?null==n.current&&console.warn("@reach/portal: A ref was passed to the `containerRef` prop of a `Portal`, but no DOM node was attached to it. Be sure to pass the ref to a DOM component.\n\nIf you are forwarding the ref from another component, be sure to use the React.forwardRef API. See https://reactjs.org/docs/forwarding-refs.html."):console.warn("@reach/portal: Invalid value passed to the `containerRef` of a `Portal`. The portal will be appended to the document body, but if you want to attach it to another DOM node you must pass a valid React ref object to `containerRef`."))}),[n]),Hm((()=>{if(!r.current)return;let e=r.current.ownerDocument,o=n?.current||e.body;return i.current=e?.createElement(t),o.appendChild(i.current),s(),()=>{i.current&&o&&o.removeChild(i.current)}}),[t,s,n]),i.current?Ke(e,i.current):_("span",{ref:r})},Ym=({unstable_skipInitialRender:e,...t})=>{let[n,r]=se(!1);return ae((()=>{e&&r(!0)}),[e]),e&&!n?null:_(jm,{...t})};Ym.displayName="Portal";var zm,Vm=["bottom","height","left","right","top","width"],Gm=new Map,Wm=function e(){var t=[];Gm.forEach((function(e,n){var r=n.getBoundingClientRect();(function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),Vm.some((function(n){return e[n]!==t[n]}))})(r,e.rect)&&(e.rect=r,t.push(e))})),t.forEach((function(e){e.callbacks.forEach((function(t){return t(e.rect)}))})),zm=window.requestAnimationFrame(e)};function Xm(e,t,n){let r,i;wm(t)?r=t:(r=t?.observe??!0,i=t?.onChange),km(n)&&(i=n),ae((()=>{wm(t)&&console.warn("Passing `observe` as the second argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `observe` property as the second argument (`useRect(ref, { observe })`).\nSee https://reach.tech/rect#userect-observe")}),[t]),ae((()=>{km(n)&&console.warn("Passing `onChange` as the third argument to `useRect` is deprecated and will be removed in a future version of Reach UI. Instead, you can pass an object of options with an `onChange` property as the second argument (`useRect(ref, { onChange })`).\nSee https://reach.tech/rect#userect-onchange")}),[n]);let[s,o]=se(e.current),a=le(!1),u=le(!1),[l,c]=se(null),h=le(i);return Hm((()=>{h.current=i,e.current!==s&&o(e.current)})),Hm((()=>{s&&!a.current&&(a.current=!0,c(s.getBoundingClientRect()))}),[s]),Hm((()=>{if(!r)return;let t=s;if(u.current||(u.current=!0,t=e.current),!t)return void console.warn("You need to place the ref");let n=(i=t,o=e=>{h.current?.(e),c(e)},{observe:function(){var e=0===Gm.size;Gm.has(i)?Gm.get(i).callbacks.push(o):Gm.set(i,{rect:void 0,hasRectChanged:!1,callbacks:[o]}),e&&Wm()},unobserve:function(){var e=Gm.get(i);if(e){var t=e.callbacks.indexOf(o);t>=0&&e.callbacks.splice(t,1),e.callbacks.length||Gm.delete(i),Gm.size||cancelAnimationFrame(zm)}}});var i,o;return n.observe(),()=>{n.unobserve()}}),[r,s,e]),l}var Km=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),qm="undefined"==typeof Element,Jm=qm?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Zm=!qm&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},Qm=function e(t,n,r){for(var i=[],s=Array.from(t);s.length;){var o=s.shift();if("SLOT"===o.tagName){var a=o.assignedElements(),u=e(a.length?a:o.children,!0,r);r.flatten?i.push.apply(i,u):i.push({scope:o,candidates:u})}else{Jm.call(o,Km)&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var l=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),c=!r.shadowRootFilter||r.shadowRootFilter(o);if(l&&c){var h=e(!0===l?o.children:l.children,!0,r);r.flatten?i.push.apply(i,h):i.push({scope:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},eE=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},tE=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},nE=function(e){return"INPUT"===e.tagName},rE=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},iE=function(e,t){return!(function(e){return function(e){return nE(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Zm(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var i=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!i||i===e}(e)}(t)||eE(t)<0||!function(e,t){return!(t.disabled||function(e){return nE(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var i=Jm.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Jm.call(i,"details:not([open]) *"))return!0;var s=Zm(e).host,o=(null==s?void 0:s.ownerDocument.contains(s))||e.ownerDocument.contains(e);if(n&&"full"!==n){if("non-zero-area"===n)return rE(e)}else{if("function"==typeof r){for(var a=e;e;){var u=e.parentElement,l=Zm(e);if(u&&!u.shadowRoot&&!0===r(u))return rE(e);e=e.assignedSlot?e.assignedSlot:u||l===e.ownerDocument?u:l.host}e=a}if(o)return!e.getClientRects().length}return!1}(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Jm.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))}(e,t))},sE=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},oE=function e(t){var n=[],r=[];return t.forEach((function(t,i){var s=!!t.scope,o=s?t.scope:t,a=eE(o,s),u=s?e(t.candidates):o;0===a?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:a,item:t,isScope:s,content:u})})),r.sort(tE).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},aE=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Qm([e],t.includeContainer,{filter:iE.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:sE}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(Km));return t&&Jm.call(e,Km)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,iE.bind(null,t)),oE(n)},uE=Fe((function({unstable_skipInitialPortalRender:e,...t},n){return _(Ym,{unstable_skipInitialRender:e},_(lE,{ref:n,...t}))}));uE.displayName="Popover";var lE=Fe((function({as:e="div",targetRef:t,position:n=dE,unstable_observableRefs:r=[],...i},s){const o=le(null),a=Xm(o,{observe:!i.hidden}),u=Xm(t,{observe:!0}),l=Mm(o,s);return function(e,t){const n=Fm(e.current);function r(e){"Tab"===e.key&&t.current&&0===aE(t.current).length||("Tab"===e.key&&e.shiftKey?function(e){if(!e.shiftKey)return;const t=i();return e.target===t}(e)?function(e){const n=t.current&&aE(t.current),r=n&&n[n.length-1];r&&(e.preventDefault(),r.focus())}(e):function(e){const n=t.current&&aE(t.current);return!!n&&0!==n.length&&e.target===n[0]}(e)?o(e):function(e){return e.target===aE(n)[0]}(e)&&u():"Tab"===e.key&&(s()?function(e){const n=t.current&&aE(t.current);n&&n[0]&&(e.preventDefault(),n[0].focus())}(e):function(){if(t.current&&t.current.contains(n.activeElement||null)){const e=t.current&&aE(t.current);return Boolean(e&&e[e.length-1]===n.activeElement)}return!1}()?function(e){const t=i();t&&(e.preventDefault(),t.focus())}(e):function(e){const r=t.current?aE(n).filter((e=>!t.current.contains(e))):null;return!!r&&e.target===r[r.length-1]}(e)&&u()))}function i(){const r=aE(n),i=r&&e.current?r.indexOf(e.current):-1,s=r&&r[i+1];return(!t.current||!t.current.contains(s||null))&&s}function s(){return!!e.current&&e.current===n.activeElement}function o(t){t.preventDefault(),e.current?.focus()}ae((()=>(n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)})),[]);let a=[];function u(){const e=t.current&&aE(t.current);e&&(e.forEach((e=>{a.push([e,e.tabIndex]),e.tabIndex=-1})),n.addEventListener("focusin",l))}function l(){n.removeEventListener("focusin",l),a.forEach((([e,t])=>{e.tabIndex=t}))}}(t,o),_(e,{"data-reach-popover":"",ref:l,...i,style:{position:"absolute",...cE(n,u,a,...r),...i.style}})}));function cE(e,t,n,...r){return n?e(t,n,...r.map((e=>e.current))):{visibility:"hidden"}}function hE(e,t,n){return{top:n?`${e.top-t.height+window.pageYOffset}px`:`${e.top+e.height+window.pageYOffset}px`}}lE.displayName="PopoverImpl";var dE=(e,t)=>{if(!e||!t)return{};const{directionRight:n,directionUp:r}=function(e,t,n=0,r=0){const i={top:e.top-t.height<0,right:window.innerWidth<e.left+t.width-n,bottom:window.innerHeight<e.bottom+t.height-r,left:e.left+e.width-t.width<0};return{directionRight:i.right&&!i.left,directionLeft:i.left&&!i.right,directionUp:i.bottom&&!i.top,directionDown:i.top&&!i.bottom}}(e,t);return{left:n?`${e.right-t.width+window.pageXOffset}px`:`${e.left+window.pageXOffset}px`,...hE(e,t,r)}},pE=!1,fE=0;function mE(){return++fE}var EE=yt["useId".toString()];function gE({context:e,children:t,items:n,set:r}){let i=de((({element:e,index:t,...n})=>e?(r((r=>{if(null!=t&&-1!==t)return _E(r,{element:e,index:t,...n},t);if(0===r.length)return[{...n,element:e,index:0}];if(r.find((t=>t.element===e)))return console.warn("[reach-ui]: `useDescendant` was called with an element that was already registered.\n\nIf you are using the `@reach/descendants` package directly, make sure to only register descendants once. Registering a descendant more than once will lead to bugs in your app.\n\nIf you are using another `reach-ui` package, this is probably our bug!\n\nTo report a bug, open a new issue:\n\n https://github.com/reach/reach-ui/issues/new?assignees=&labels=&template=Bug_report.md\n\nIMPORTANT: this check will only run in the development build, so if you see this warning please be aware that your app may crash when deployed."),function(e){return e.sort(((e,t)=>e.element&&t.element?AE(e.element,t.element)?-1:1:0)).map(((e,t)=>({...e,index:t})))}(r);let i,s=function(e,t){if(!t)return-1;if(!e.length)return-1;let n=e.length;for(;n--;){let r=e[n].element;if(r&&AE(r,t))return n+1}return-1}(r,e);return i=-1===s?[...r,{...n,element:e,index:r.length}]:_E(r,{...n,element:e,index:s},s),i})),()=>{e&&r((t=>t.filter((t=>e!==t.element))))}):Pm),[]);return _(e.Provider,{value:he((()=>({descendants:n,registerDescendant:i})),[n,i])},t)}function AE(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function _E(e,t,n){return null!=n&&n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}var DE="CLEAR_SELECTION_INDEX",vE="CLICK_MENU_ITEM",TE="CLOSE_MENU",OE="OPEN_MENU_AT_INDEX",SE="OPEN_MENU_CLEARED",CE="SEARCH_FOR_ITEM",yE="SELECT_ITEM_AT_INDEX",NE="SET_BUTTON_ID",IE=function(e,t={}){let n=z({descendants:[],registerDescendant:()=>Pm,...t});return n.displayName=e,n}("DropdownDescendantContext"),[bE,RE]=function(e){let t=z(void 0);function n(e){let{children:n,...r}=e,i=he((()=>r),Object.values(r));return _(t.Provider,{value:i},n)}return t.displayName=`${e}Context`,n.displayName=`${e}Provider`,[n,function(n){let r=pe(t);if(r)return r;throw Error(`${n} must be rendered inside of a ${e} component.`)}]}("Dropdown"),wE={triggerId:null,isExpanded:!1,typeaheadQuery:"",selectionIndex:-1},kE=({id:e,children:t})=>{let n=le(null),r=le(null),i=le(null),[s,o]=se([]),a=function(e){if(void 0!==EE){let t=EE();return e??t}let t=e??(pE?mE():null),[n,r]=se(t);return Hm((()=>{null===n&&r(mE())}),[]),ae((()=>{!1===pE&&(pE=!0)}),[]),e??n??void 0}(e),u=e||Bm("menu",a),l=Bm("menu-button",u),[c,h]=oe(YE,{...wE,triggerId:l}),d=le(!1),p=le([]),f=le(!1),m=le({x:0,y:0});return ae((()=>{c.isExpanded?(window.__REACH_DISABLE_TOOLTIPS=!0,window.requestAnimationFrame((()=>{jE(r.current)}))):window.__REACH_DISABLE_TOOLTIPS=!1}),[c.isExpanded]),_(gE,{context:IE,items:s,set:o},_(bE,{dispatch:h,dropdownId:u,dropdownRef:r,mouseDownStartPosRef:m,popoverRef:i,readyToSelect:f,selectCallbacks:p,state:c,triggerClickedRef:d,triggerRef:n},km(t)?t({isExpanded:c.isExpanded,isOpen:c.isExpanded}):t))};function LE({onKeyDown:e,onMouseDown:t,id:n,ref:r,...i}){let{dispatch:s,dropdownId:o,mouseDownStartPosRef:a,triggerClickedRef:u,triggerRef:l,state:{triggerId:c,isExpanded:h}}=RE("useDropdownTrigger"),d=Mm(l,r),p=zE(),f=he((()=>p.findIndex((e=>!e.disabled))),[p]);return ae((()=>{null!=n&&n!==c&&s({type:NE,payload:n})}),[c,s,n]),ae((()=>{null==n&&s({type:NE,payload:Bm("menu-button",o)})}),[o,s,n]),{data:{isExpanded:h,controls:o},props:{...i,ref:d,id:c||void 0,onKeyDown:Rm(e,(function(e){switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),s({type:OE,payload:{index:f}});break;case"Enter":case" ":s({type:OE,payload:{index:f}})}})),onMouseDown:Rm(t,(function(e){xm(e.nativeEvent)||(a.current={x:e.clientX,y:e.clientY},h||(u.current=!0),s(h?{type:TE}:{type:SE}))})),type:"button"}}}kE.displayName="DropdownProvider";var ME=Fe((({as:e="button",...t},n)=>{let{props:r}=LE({...t,ref:n});return _(e,{"data-reach-dropdown-trigger":"",...r})}));function FE({index:e,isLink:t=!1,onClick:n,onDragStart:r,onMouseDown:i,onMouseEnter:s,onMouseLeave:o,onMouseMove:a,onMouseUp:u,onSelect:l,disabled:c,onFocus:h,valueText:d,ref:p,...f}){let{dispatch:m,dropdownRef:E,mouseDownStartPosRef:g,readyToSelect:A,selectCallbacks:_,triggerRef:D,state:{selectionIndex:v,isExpanded:T}}=RE("useDropdownItem"),O=le(null),[S,C]=se(d||""),y=de((e=>{!d&&e?.textContent&&C(e.textContent)}),[d]),N=le(!1),[I,b]=function(e){let[t,n]=se(null);return[t,de((t=>{e.current=t,n(t)}),[])]}(O),R=function(e,t,n){let r=Um(),{registerDescendant:i,descendants:s}=pe(t),o=n??s.findIndex((t=>t.element===e.element));return Hm((()=>(e.element||r(),i({...e,index:o}))),[e,r,o,i,...Object.values(e)]),o}(he((()=>({element:I,key:S,disabled:c,isLink:t})),[c,I,t,S]),IE,e),w=R===v&&!c,k=Mm(p,b,y);function L(){jE(D.current),l&&l(),m({type:vE})}return _.current[R]=l,ae((()=>{if(T){let e=window.setTimeout((()=>{A.current=!0}),400);return()=>{window.clearTimeout(e)}}A.current=!1}),[T,A]),ae((()=>{let e=Fm(O.current);return e.addEventListener("mouseup",t),()=>{e.removeEventListener("mouseup",t)};function t(){N.current=!1}}),[]),{data:{disabled:c},props:{id:$E(R),tabIndex:-1,...f,ref:k,"data-disabled":c?"":void 0,"data-selected":w?"":void 0,"data-valuetext":S,onClick:Rm(n,(function(e){xm(e.nativeEvent)||t&&(c?e.preventDefault():L())})),onDragStart:Rm(r,(function(e){t&&e.preventDefault()})),onMouseDown:Rm(i,(function(e){xm(e.nativeEvent)||(t?N.current=!0:e.preventDefault())})),onMouseEnter:Rm(s,(function(e){let t=Fm(E.current);w||null==R||c||(E?.current&&E.current!==t.activeElement&&O.current!==t.activeElement&&E.current.focus(),m({type:yE,payload:{index:R}}))})),onMouseLeave:Rm(o,(function(e){m({type:DE})})),onMouseMove:Rm(a,(function(e){if(!A.current){let t=8,n=Math.abs(e.clientX-g.current.x),r=Math.abs(e.clientY-g.current.y);(n>t||r>t)&&(A.current=!0)}w||null==R||c||m({type:yE,payload:{index:R,dropdownRef:E}})})),onFocus:Rm(h,(function(){A.current=!0,w||null==R||c||m({type:yE,payload:{index:R}})})),onMouseUp:Rm(u,(function(e){xm(e.nativeEvent)||(A.current?t?N.current?N.current=!1:O.current&&O.current.click():c||L():A.current=!0)}))}}}ME.displayName="DropdownTrigger";var xE=Fe((({as:e="div",...t},n)=>{let{props:r}=FE({...t,ref:n});return _(e,{"data-reach-dropdown-item":"",...r})}));function BE({id:e,onKeyDown:t,ref:n,...r}){let{dispatch:i,triggerRef:s,dropdownRef:o,selectCallbacks:a,dropdownId:u,state:{isExpanded:l,triggerId:c,selectionIndex:h,typeaheadQuery:d}}=RE("useDropdownItems"),p=zE(),f=Mm(o,n);ae((()=>{let e=function(e,t=""){if(!t)return null;let n=e.find((e=>!e.disabled&&e.element?.dataset?.valuetext?.toLowerCase().startsWith(t)));return n?e.indexOf(n):null}(p,d);d&&null!=e&&i({type:yE,payload:{index:e,dropdownRef:o}});let t=window.setTimeout((()=>d&&i({type:CE,payload:""})),1e3);return()=>window.clearTimeout(t)}),[i,p,d,o]);let m=$m(p.length),E=$m(p[h]),g=$m(h);ae((()=>{h>p.length-1?i({type:yE,payload:{index:p.length-1,dropdownRef:o}}):m!==p.length&&h>-1&&E&&g===h&&p[h]!==E&&i({type:yE,payload:{index:p.findIndex((e=>e.key===E?.key)),dropdownRef:o}})}),[o,i,p,m,E,g,h]);let A=Rm((function(e){let{key:t}=e;if(l)switch(t){case"Enter":case" ":let n=p.find((e=>e.index===h));n&&!n.disabled&&(e.preventDefault(),n.isLink&&n.element?n.element.click():(jE(s.current),a.current[n.index]&&a.current[n.index](),i({type:vE})));break;case"Escape":jE(s.current),i({type:TE});break;case"Tab":e.preventDefault();break;default:if("string"==typeof t&&1===t.length){let e=d+t.toLowerCase();i({type:CE,payload:e})}}}),function(e,t){let{descendants:n}=pe(e),{callback:r,currentIndex:i,filter:s,key:o="index",orientation:a="vertical",rotate:u=!0,rtl:l=!1}=t;return function(e){if(!["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(e.key))return;let t=i??-1,c=s?n.filter(s):n;if(!c.length)return;let h=c.findIndex((e=>e.index===i));function d(){return t===m().index?u?f():c[h]:c[(h+1)%c.length]}function p(){return t===f().index?u?m():c[h]:c[(h-1+c.length)%c.length]}function f(){return c[0]}function m(){return c[c.length-1]}switch(e.key){case"ArrowDown":if("vertical"===a||"both"===a){e.preventDefault();let t=d();r("option"===o?t:t[o])}break;case"ArrowUp":if("vertical"===a||"both"===a){e.preventDefault();let t=p();r("option"===o?t:t[o])}break;case"ArrowLeft":if("horizontal"===a||"both"===a){e.preventDefault();let t=(l?d:p)();r("option"===o?t:t[o])}break;case"ArrowRight":if("horizontal"===a||"both"===a){e.preventDefault();let t=(l?p:d)();r("option"===o?t:t[o])}break;case"PageUp":e.preventDefault();let t=(e.ctrlKey?p:f)();r("option"===o?t:t[o]);break;case"Home":e.preventDefault();let n=f();r("option"===o?n:n[o]);break;case"PageDown":e.preventDefault();let i=(e.ctrlKey?d:m)();r("option"===o?i:i[o]);break;case"End":e.preventDefault();let s=m();r("option"===o?s:s[o])}}}(IE,{currentIndex:h,orientation:"vertical",rotate:!1,filter:e=>!e.disabled,callback:e=>{i({type:yE,payload:{index:e,dropdownRef:o}})},key:"index"}));return{data:{activeDescendant:$E(h)||void 0,triggerId:c},props:{tabIndex:-1,...r,ref:f,id:u,onKeyDown:Rm(t,A)}}}xE.displayName="DropdownItem";var PE=Fe((({as:e="div",...t},n)=>{let{props:r}=BE({...t,ref:n});return _(e,{"data-reach-dropdown-items":"",...r})}));function UE({onBlur:e,portal:t=!0,position:n,ref:r,...i}){let{triggerRef:s,triggerClickedRef:o,dispatch:a,dropdownRef:u,popoverRef:l,state:{isExpanded:c}}=RE("useDropdownPopover"),h=Mm(l,r);return ae((()=>{if(!c)return;let e=Fm(l.current);function t(e){var t,n;o.current?o.current=!1:(t=l.current,n=e.target,t&&t.contains(n)||a({type:TE}))}return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}}),[o,s,a,u,l,c]),{data:{portal:t,position:n,targetRef:s,isExpanded:c},props:{ref:h,hidden:!c,onBlur:Rm(e,(e=>{e.currentTarget.contains(e.relatedTarget)||a({type:TE})})),...i}}}PE.displayName="DropdownItems";var HE=Fe((({as:e="div",...t},n)=>{let{data:{portal:r,targetRef:i,position:s},props:o}=UE({...t,ref:n}),a={"data-reach-dropdown-popover":""};return r?_(uE,{...o,...a,as:e,targetRef:i,position:s,unstable_skipInitialPortalRender:!0}):_(e,{...o,...a})}));function $E(e){let{dropdownId:t}=RE("useItemId");return null!=e&&e>-1?Bm(`option-${e}`,t):void 0}function jE(e){e&&e.focus()}function YE(e,t={}){switch(t.type){case vE:case TE:return{...e,isExpanded:!1,selectionIndex:-1};case"OPEN_MENU_AT_FIRST_ITEM":return{...e,isExpanded:!0,selectionIndex:0};case OE:return{...e,isExpanded:!0,selectionIndex:t.payload.index};case SE:return{...e,isExpanded:!0,selectionIndex:-1};case yE:{let{dropdownRef:n={current:null}}=t.payload;if(t.payload.index>=0&&t.payload.index!==e.selectionIndex){if(n.current){let e=Fm(n.current);n.current!==e?.activeElement&&n.current.focus()}return{...e,selectionIndex:null!=t.payload.max?Math.min(Math.max(t.payload.index,0),t.payload.max):Math.max(t.payload.index,0)}}return e}case DE:return{...e,selectionIndex:-1};case NE:return{...e,triggerId:t.payload};case CE:return void 0!==t.payload?{...e,typeaheadQuery:t.payload}:e;default:return e}}function zE(){return pe(IE).descendants}HE.displayName="DropdownPopover";var VE={exports:{}},GE={},WE=Symbol.for("react.transitional.element"),XE=Symbol.for("react.portal"),KE=Symbol.for("react.fragment"),qE=Symbol.for("react.strict_mode"),JE=Symbol.for("react.profiler"),ZE=Symbol.for("react.consumer"),QE=Symbol.for("react.context"),eg=Symbol.for("react.forward_ref"),tg=Symbol.for("react.suspense"),ng=Symbol.for("react.suspense_list"),rg=Symbol.for("react.memo"),ig=Symbol.for("react.lazy"),sg=Symbol.for("react.offscreen"),og=Symbol.for("react.client.reference");function ag(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case WE:switch(e=e.type){case KE:case JE:case qE:case tg:case ng:return e;default:switch(e=e&&e.$$typeof){case QE:case eg:case ig:case rg:case ZE:return e;default:return t}}case XE:return t}}}GE.ContextConsumer=ZE,GE.ContextProvider=QE,GE.Element=WE,GE.ForwardRef=eg,GE.Fragment=KE,GE.Lazy=ig,GE.Memo=rg,GE.Portal=XE,GE.Profiler=JE,GE.StrictMode=qE,GE.Suspense=tg,GE.SuspenseList=ng,GE.isContextConsumer=function(e){return ag(e)===ZE},GE.isContextProvider=function(e){return ag(e)===QE},GE.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===WE},GE.isForwardRef=function(e){return ag(e)===eg},GE.isFragment=function(e){return ag(e)===KE},GE.isLazy=function(e){return ag(e)===ig},GE.isMemo=function(e){return ag(e)===rg},GE.isPortal=function(e){return ag(e)===XE},GE.isProfiler=function(e){return ag(e)===JE},GE.isStrictMode=function(e){return ag(e)===qE},GE.isSuspense=function(e){return ag(e)===tg},GE.isSuspenseList=function(e){return ag(e)===ng},GE.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===KE||e===JE||e===qE||e===tg||e===ng||e===sg||"object"==typeof e&&null!==e&&(e.$$typeof===ig||e.$$typeof===rg||e.$$typeof===QE||e.$$typeof===ZE||e.$$typeof===eg||e.$$typeof===og||void 0!==e.getModuleId)},GE.typeOf=ag,VE.exports=GE;var ug=VE.exports,lg=Fe((({as:e=T,id:t,children:n,...r},i)=>{let s=he((()=>{try{return ug.isFragment(_(e,null))}catch(e){return!1}}),[e])?{}:{ref:i,id:t,"data-reach-menu":"",...r};return _(e,{...s},_(kE,{id:t,children:n}))}));lg.displayName="Menu";var cg=Fe((({as:e="button",...t},n)=>{let{data:{isExpanded:r,controls:i},props:s}=LE({...t,ref:n});return _(e,{"aria-expanded":!!r||void 0,"aria-haspopup":!0,"aria-controls":i,...s,"data-reach-menu-button":""})}));cg.displayName="MenuButton";var hg=Fe((({as:e="div",...t},n)=>{let{data:{disabled:r},props:i}=FE({...t,ref:n});return _(e,{role:"menuitem",...i,"aria-disabled":r||void 0,"data-reach-menu-item":""})}));hg.displayName="MenuItemImpl";var dg=Fe((({as:e="div",...t},n)=>_(hg,{...t,ref:n,as:e})));dg.displayName="MenuItem";var pg=Fe((({as:e="div",...t},n)=>{let{data:{activeDescendant:r,triggerId:i},props:s}=BE({...t,ref:n});return _(e,{"aria-activedescendant":r,"aria-labelledby":i||void 0,role:"menu",...s,"data-reach-menu-items":""})}));pg.displayName="MenuItems";var fg=Fe((({as:e="a",component:t,onSelect:n,...r},i)=>(ae((()=>{t&&console.warn("[@reach/menu-button]: Please use the `as` prop instead of `component`")}),[t]),_(hg,{...r,ref:i,"data-reach-menu-link":"",as:e,isLink:!0,onSelect:n||Pm}))));fg.displayName="MenuLink";var mg=Fe((({portal:e=!0,...t},n)=>_(Eg,{portal:e},_(pg,{...t,ref:n,"data-reach-menu-list":""}))));mg.displayName="MenuList";var Eg=Fe((({as:e="div",...t},n)=>{let{data:{portal:r,targetRef:i,position:s},props:o}=UE({...t,ref:n}),a={"data-reach-menu-popover":""};return r?_(uE,{...o,...a,as:e,targetRef:i,position:s,unstable_skipInitialPortalRender:!0}):_(e,{...o,...a})}));Eg.displayName="MenuPopover";var gg=[],Ag=function(e){return void 0===e},_g=/\s*(\.\d+|\d+(?:\.\d+)?)(%|deg)?\s*/,Dg=/\s*(\.\d+|100|\d?\d(?:\.\d+)?)%\s*/,vg=new RegExp("^(rgb|hsl|hsv)a?\\("+_g.source+"[, ]"+_g.source+"[, ]"+_g.source+"(?:[,/]"+_g.source+")?\\)$","i");function Tg(e,t,n){return"%"===e?100:"deg"===e||n&&0===t?360:e?void 0:255}function Og(e){if(Array.isArray(e)){if("string"==typeof e[0]&&"function"==typeof Og[e[0]])return new Og[e[0]](e.slice(1,e.length));if(4===e.length)return new Og.RGB(e[0]/255,e[1]/255,e[2]/255,e[3]/255)}else if("string"==typeof e){var t=e.toLowerCase();Og.namedColors[t]&&(e="#"+Og.namedColors[t]),"transparent"===t&&(e="rgba(0,0,0,0)");var n=e.match(vg);if(n){var r=n[1].toUpperCase(),i="H"===r[0];if(Ag(Og[r]))throw new Error("color."+r+" is not installed.");let e=Ag(n[8])?1:void 0;return void 0===e&&(e="%"===n[9]?parseFloat(n[8])/100:parseFloat(n[8])),new Og[r](parseFloat(n[2])/Tg(n[3],0,i),parseFloat(n[4])/Tg(n[5],1,i),parseFloat(n[6])/Tg(n[7],2,i),e)}e.length<6&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,"$1$1$2$2$3$3$4$4"));var s=e.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])?$/i);if(s)return new Og.RGB(parseInt(s[1],16)/255,parseInt(s[2],16)/255,parseInt(s[3],16)/255,s[4]?parseInt(s[4],16)/255:1);if(Og.CMYK){var o=e.match(new RegExp("^cmyk\\("+Dg.source+","+Dg.source+","+Dg.source+","+Dg.source+"\\)$","i"));if(o)return new Og.CMYK(parseFloat(o[1])/100,parseFloat(o[2])/100,parseFloat(o[3])/100,parseFloat(o[4])/100)}}else if("object"==typeof e&&e.isColor)return e;return!1}Og.namedColors={},Og.installColorSpace=function(e,t,n){Og[e]=function(n){var r=Array.isArray(n)?n:arguments;t.forEach((function(n,i){var s=r[i];if("alpha"===n)this._alpha=isNaN(s)||s>1?1:s<0?0:s;else{if(isNaN(s))throw new Error("["+e+"]: Invalid color: ("+t.join(",")+")");"hue"===n?this._hue=s<0?s-Math.floor(s):s%1:this["_"+n]=s<0?0:s>1?1:s}}),this)},Og[e].propertyNames=t;var r=Og[e].prototype;for(var i in["valueOf","hex","hexa","css","cssa"].forEach((function(t){r[t]=r[t]||("RGB"===e?r.hex:function(){return this.rgb()[t]()})})),r.isColor=!0,r.equals=function(n,r){Ag(r)&&(r=1e-10),n=n[e.toLowerCase()]();for(var i=0;i<t.length;i+=1)if(Math.abs(this["_"+t[i]]-n["_"+t[i]])>r)return!1;return!0},r.toJSON=function(){return[e].concat(t.map((function(e){return this["_"+e]}),this))},n)if(Object.prototype.hasOwnProperty.call(n,i)){var s=i.match(/^from(.*)$/);s?Og[s[1].toUpperCase()].prototype[e.toLowerCase()]=n[i]:r[i]=n[i]}function o(e,t){var n={};for(var r in n[t.toLowerCase()]=function(){return this.rgb()[t.toLowerCase()]()},Og[t].propertyNames.forEach((function(e){var r="black"===e?"k":e.charAt(0);n[e]=n[r]=function(n,r){return this[t.toLowerCase()]()[e](n,r)}})),n)Object.prototype.hasOwnProperty.call(n,r)&&void 0===Og[e].prototype[r]&&(Og[e].prototype[r]=n[r])}return r[e.toLowerCase()]=function(){return this},r.toString=function(){return"["+e+" "+t.map((function(e){return this["_"+e]}),this).join(", ")+"]"},t.forEach((function(e){var n="black"===e?"k":e.charAt(0);r[e]=r[n]=function(n,r){return void 0===n?this["_"+e]:r?new this.constructor(t.map((function(t){return this["_"+t]+(e===t?n:0)}),this)):new this.constructor(t.map((function(t){return e===t?n:this["_"+t]}),this))}})),gg.forEach((function(t){o(e,t),o(t,e)})),gg.push(e),Og},Og.pluginList=[],Og.use=function(e){return-1===Og.pluginList.indexOf(e)&&(this.pluginList.push(e),e(Og)),Og},Og.installMethod=function(e,t){return gg.forEach((function(n){Og[n].prototype[e]=t})),this},Og.installColorSpace("RGB",["red","green","blue","alpha"],{hex:function(){var e=(65536*Math.round(255*this._red)+256*Math.round(255*this._green)+Math.round(255*this._blue)).toString(16);return"#"+"00000".substr(0,6-e.length)+e},hexa:function(){var e=Math.round(255*this._alpha).toString(16);return this.hex()+"00".substr(0,2-e.length)+e},css:function(){return"rgb("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+")"},cssa:function(){return"rgba("+Math.round(255*this._red)+","+Math.round(255*this._green)+","+Math.round(255*this._blue)+","+this._alpha+")"}});var Sg=function(e){e.installColorSpace("XYZ",["x","y","z","alpha"],{fromRgb:function(){var t=function(e){return e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92},n=t(this._red),r=t(this._green),i=t(this._blue);return new e.XYZ(.4124564*n+.3575761*r+.1804375*i,.2126729*n+.7151522*r+.072175*i,.0193339*n+.119192*r+.9503041*i,this._alpha)},rgb:function(){var t=this._x,n=this._y,r=this._z,i=function(e){return e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e};return new e.RGB(i(3.2404542*t+-1.5371385*n+-.4985314*r),i(-.969266*t+1.8760108*n+.041556*r),i(.0556434*t+-.2040259*n+1.0572252*r),this._alpha)},lab:function(){var t=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},n=t(this._x/95.047),r=t(this._y/100),i=t(this._z/108.883);return new e.LAB(116*r-16,500*(n-r),200*(r-i),this._alpha)}})},Cg=function(e){e.installColorSpace("HSV",["hue","saturation","value","alpha"],{rgb:function(){var t,n,r,i=this._hue,s=this._saturation,o=this._value,a=Math.min(5,Math.floor(6*i)),u=6*i-a,l=o*(1-s),c=o*(1-u*s),h=o*(1-(1-u)*s);switch(a){case 0:t=o,n=h,r=l;break;case 1:t=c,n=o,r=l;break;case 2:t=l,n=o,r=h;break;case 3:t=l,n=c,r=o;break;case 4:t=h,n=l,r=o;break;case 5:t=o,n=l,r=c}return new e.RGB(t,n,r,this._alpha)},hsl:function(){var t,n=(2-this._saturation)*this._value,r=this._saturation*this._value,i=n<=1?n:2-n;return t=i<1e-9?0:r/i,new e.HSL(this._hue,t,n/2,this._alpha)},fromRgb:function(){var t,n=this._red,r=this._green,i=this._blue,s=Math.max(n,r,i),o=s-Math.min(n,r,i),a=0===s?0:o/s,u=s;if(0===o)t=0;else switch(s){case n:t=(r-i)/o/6+(r<i?1:0);break;case r:t=(i-n)/o/6+1/3;break;case i:t=(n-r)/o/6+2/3}return new e.HSV(t,a,u,this._alpha)}})},yg=function(e){e.use(Cg),e.installColorSpace("HSL",["hue","saturation","lightness","alpha"],{hsv:function(){var t,n=2*this._lightness,r=this._saturation*(n<=1?n:2-n);return t=n+r<1e-9?0:2*r/(n+r),new e.HSV(this._hue,t,(n+r)/2,this._alpha)},rgb:function(){return this.hsv().rgb()},fromRgb:function(){return this.hsv().hsl()}})},Ng=function(e){function t(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}e.installMethod("luminance",(function(){var e=this.rgb();return.2126*t(e._red)+.7152*t(e._green)+.0722*t(e._blue)}))},Ig=function(e){e.installMethod("isDark",(function(){var e=this.rgb();return(255*e._red*299+255*e._green*587+255*e._blue*114)/1e3<128}))},bg=Og.use(Sg).use((function(e){e.use(Sg),e.installColorSpace("LAB",["l","a","b","alpha"],{fromRgb:function(){return this.xyz().lab()},rgb:function(){return this.xyz().rgb()},xyz:function(){var t=function(e){var t=Math.pow(e,3);return t>.008856?t:(e-16/116)/7.87},n=(this._l+16)/116,r=this._a/500+n,i=n-this._b/200;return new e.XYZ(95.047*t(r),100*t(n),108.883*t(i),this._alpha)}})})).use(Cg).use(yg).use((function(e){e.installColorSpace("CMYK",["cyan","magenta","yellow","black","alpha"],{rgb:function(){return new e.RGB(1-this._cyan*(1-this._black)-this._black,1-this._magenta*(1-this._black)-this._black,1-this._yellow*(1-this._black)-this._black,this._alpha)},fromRgb:function(){var t=this._red,n=this._green,r=this._blue,i=1-t,s=1-n,o=1-r,a=1;return t||n||r?(i=(i-(a=Math.min(i,Math.min(s,o))))/(1-a),s=(s-a)/(1-a),o=(o-a)/(1-a)):a=1,new e.CMYK(i,s,o,a,this._alpha)}})})).use((function(e){e.namedColors={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgrey:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",grey:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}})).use((function(e){e.installMethod("clearer",(function(e){return this.alpha(isNaN(e)?-.1:-e,!0)}))})).use((function(e){e.use(Ng),e.installMethod("contrast",(function(e){var t=this.luminance(),n=e.luminance();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)}))})).use((function(e){e.use(yg),e.installMethod("darken",(function(e){return this.lightness(isNaN(e)?-.1:-e,!0)}))})).use((function(e){e.use(yg),e.installMethod("desaturate",(function(e){return this.saturation(isNaN(e)?-.1:-e,!0)}))})).use((function(e){function t(){var t=this.rgb(),n=.3*t._red+.59*t._green+.11*t._blue;return new e.RGB(n,n,n,t._alpha)}e.installMethod("greyscale",t).installMethod("grayscale",t)})).use(Ig).use((function(e){e.use(Ig),e.installMethod("isLight",(function(){return!this.isDark()}))})).use((function(e){e.use(yg),e.installMethod("lighten",(function(e){return this.lightness(isNaN(e)?.1:e,!0)}))})).use(Ng).use((function(e){e.installMethod("mix",(function(t,n){t=e(t).rgb();var r=2*(n=1-(isNaN(n)?.5:n))-1,i=this._alpha-t._alpha,s=((r*i==-1?r:(r+i)/(1+r*i))+1)/2,o=1-s,a=this.rgb();return new e.RGB(a._red*s+t._red*o,a._green*s+t._green*o,a._blue*s+t._blue*o,a._alpha*n+t._alpha*(1-n))}))})).use((function(e){e.installMethod("negate",(function(){var t=this.rgb();return new e.RGB(1-t._red,1-t._green,1-t._blue,this._alpha)}))})).use((function(e){e.installMethod("opaquer",(function(e){return this.alpha(isNaN(e)?.1:e,!0)}))})).use((function(e){e.use(yg),e.installMethod("rotate",(function(e){return this.hue((e||0)/360,!0)}))})).use((function(e){e.use(yg),e.installMethod("saturate",(function(e){return this.saturation(isNaN(e)?.1:e,!0)}))})).use((function(e){e.installMethod("toAlpha",(function(e){var t=this.rgb(),n=e(e).rgb(),r=new e.RGB(0,0,0,t._alpha),i=["_red","_green","_blue"];return i.forEach((function(e){t[e]<1e-10?r[e]=t[e]:t[e]>n[e]?r[e]=(t[e]-n[e])/(1-n[e]):t[e]>n[e]?r[e]=(n[e]-t[e])/n[e]:r[e]=0})),r._red>r._green?r._red>r._blue?t._alpha=r._red:t._alpha=r._blue:r._green>r._blue?t._alpha=r._green:t._alpha=r._blue,t._alpha<1e-10||(i.forEach((function(e){t[e]=(t[e]-n[e])/t._alpha+n[e]})),t._alpha*=r._alpha),t}))}));const Rg=br(bg);function wg(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{u(r.next(e))}catch(e){s(e)}}function a(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;let kg=class{constructor(){this.listeners={}}on(e,t,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),null==n?void 0:n.once){const n=()=>{this.un(e,n),this.un(e,t)};return this.on(e,n),n}return()=>this.un(e,t)}un(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}};const Lg={decode:function(e,t){return wg(this,void 0,void 0,(function*(){const n=new AudioContext({sampleRate:t});return n.decodeAudioData(e).finally((()=>n.close()))}))},createBuffer:function(e,t){return"number"==typeof e[0]&&(e=[e]),function(e){const t=e[0];if(t.some((e=>e>1||e<-1))){const n=t.length;let r=0;for(let e=0;e<n;e++){const n=Math.abs(t[e]);n>r&&(r=n)}for(const t of e)for(let e=0;e<n;e++)t[e]/=r}}(e),{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:t=>null==e?void 0:e[t],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function Mg(e,t){const n=t.xmlns?document.createElementNS(t.xmlns,e):document.createElement(e);for(const[r,i]of Object.entries(t))if("children"===r)for(const[e,s]of Object.entries(t))"string"==typeof s?n.appendChild(document.createTextNode(s)):n.appendChild(Mg(e,s));else"style"===r?Object.assign(n.style,i):"textContent"===r?n.textContent=i:n.setAttribute(r,i.toString());return n}function Fg(e,t,n){const r=Mg(e,t||{});return null==n||n.appendChild(r),r}var xg=Object.freeze({__proto__:null,createElement:Fg,default:Fg});const Bg={fetchBlob:function(e,t,n){return wg(this,void 0,void 0,(function*(){const r=yield fetch(e,n);if(r.status>=400)throw new Error(`Failed to fetch ${e}: ${r.status} (${r.statusText})`);return function(e,t){wg(this,void 0,void 0,(function*(){if(!e.body||!e.headers)return;const n=e.body.getReader(),r=Number(e.headers.get("Content-Length"))||0;let i=0;const s=e=>wg(this,void 0,void 0,(function*(){i+=(null==e?void 0:e.length)||0;const n=Math.round(i/r*100);t(n)})),o=()=>wg(this,void 0,void 0,(function*(){let e;try{e=yield n.read()}catch(e){return}e.done||(s(e.value),yield o())}));o()}))}(r.clone(),t),r.blob()}))}};let Pg=class extends kg{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),null!=e.playbackRate&&this.onMediaEvent("canplay",(()=>{null!=e.playbackRate&&(this.media.playbackRate=e.playbackRate)}),{once:!0})}onMediaEvent(e,t,n){return this.media.addEventListener(e,t,n),()=>this.media.removeEventListener(e,t,n)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}canPlayType(e){return""!==this.media.canPlayType(e)}setSrc(e,t){const n=this.getSrc();if(e&&n===e)return;this.revokeSrc();const r=t instanceof Blob&&(this.canPlayType(t.type)||!e)?URL.createObjectURL(t):e;try{this.media.src=r}catch(t){this.media.src=e}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return wg(this,void 0,void 0,(function*(){return this.media.play()}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(e,t){null!=t&&(this.media.preservesPitch=t),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}},Ug=class e extends kg{constructor(e,t){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.subscriptions=[],this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,i]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=i.querySelector(".scroll"),this.wrapper=i.querySelector(".wrapper"),this.canvasWrapper=i.querySelector(".canvases"),this.progressWrapper=i.querySelector(".progress"),this.cursor=i.querySelector(".cursor"),t&&i.appendChild(t),this.initEvents()}parentFromOptionsContainer(e){let t;if("string"==typeof e?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("Container not found");return t}initEvents(){const e=e=>{const t=this.wrapper.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;return[n/t.width,r/t.height]};if(this.wrapper.addEventListener("click",(t=>{const[n,r]=e(t);this.emit("click",n,r)})),this.wrapper.addEventListener("dblclick",(t=>{const[n,r]=e(t);this.emit("dblclick",n,r)})),!0!==this.options.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.scrollContainer.addEventListener("scroll",(()=>{const{scrollLeft:e,scrollWidth:t,clientWidth:n}=this.scrollContainer,r=e/t,i=(e+n)/t;this.emit("scroll",r,i,e,e+n)})),"function"==typeof ResizeObserver){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{e().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const e=this.parent.clientWidth;e===this.lastContainerWidth&&"auto"!==this.options.height||(this.lastContainerWidth=e,this.reRender())}initDrag(){this.subscriptions.push(function(e,t,n,r,i=3,s=0,o=100){if(!e)return()=>{};const a=matchMedia("(pointer: coarse)").matches;let u=()=>{};const l=l=>{if(l.button!==s)return;l.preventDefault(),l.stopPropagation();let c=l.clientX,h=l.clientY,d=!1;const p=Date.now(),f=r=>{if(r.preventDefault(),r.stopPropagation(),a&&Date.now()-p<o)return;const s=r.clientX,u=r.clientY,l=s-c,f=u-h;if(d||Math.abs(l)>i||Math.abs(f)>i){const r=e.getBoundingClientRect(),{left:i,top:o}=r;d||(null==n||n(c-i,h-o),d=!0),t(l,f,s-i,u-o),c=s,h=u}},m=t=>{if(d){const n=t.clientX,i=t.clientY,s=e.getBoundingClientRect(),{left:o,top:a}=s;null==r||r(n-o,i-a)}u()},E=e=>{e.relatedTarget&&e.relatedTarget!==document.documentElement||m(e)},g=e=>{d&&(e.stopPropagation(),e.preventDefault())},A=e=>{d&&e.preventDefault()};document.addEventListener("pointermove",f),document.addEventListener("pointerup",m),document.addEventListener("pointerout",E),document.addEventListener("pointercancel",E),document.addEventListener("touchmove",A,{passive:!1}),document.addEventListener("click",g,{capture:!0}),u=()=>{document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",m),document.removeEventListener("pointerout",E),document.removeEventListener("pointercancel",E),document.removeEventListener("touchmove",A),setTimeout((()=>{document.removeEventListener("click",g,{capture:!0})}),10)}};return e.addEventListener("pointerdown",l),()=>{u(),e.removeEventListener("pointerdown",l)}}(this.wrapper,((e,t,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))}),(e=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))}),(e=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))})))}getHeight(e,t){var n;const r=(null===(n=this.audioData)||void 0===n?void 0:n.numberOfChannels)||1;if(null==e)return 128;if(!isNaN(Number(e)))return Number(e);if("auto"===e){const e=this.parent.clientHeight||128;return(null==t?void 0:t.every((e=>!e.overlay)))?e/r:e}return 128}initHtml(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"});return t.innerHTML=`\n <style>\n :host {\n user-select: none;\n min-width: 1px;\n }\n :host audio {\n display: block;\n width: 100%;\n }\n :host .scroll {\n overflow-x: auto;\n overflow-y: hidden;\n width: 100%;\n position: relative;\n }\n :host .noScrollbar {\n scrollbar-color: transparent;\n scrollbar-width: none;\n }\n :host .noScrollbar::-webkit-scrollbar {\n display: none;\n -webkit-appearance: none;\n }\n :host .wrapper {\n position: relative;\n overflow: visible;\n z-index: 2;\n }\n :host .canvases {\n min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;\n }\n :host .canvases > div {\n position: relative;\n }\n :host canvas {\n display: block;\n position: absolute;\n top: 0;\n image-rendering: pixelated;\n }\n :host .progress {\n pointer-events: none;\n position: absolute;\n z-index: 2;\n top: 0;\n left: 0;\n width: 0;\n height: 100%;\n overflow: hidden;\n }\n :host .progress > div {\n position: relative;\n }\n :host .cursor {\n pointer-events: none;\n position: absolute;\n z-index: 5;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 2px;\n }\n </style>\n\n <div class="scroll" part="scroll">\n <div class="wrapper" part="wrapper">\n <div class="canvases" part="canvases"></div>\n <div class="progress" part="progress"></div>\n <div class="cursor" part="cursor"></div>\n </div>\n </div>\n `,[e,t]}setOptions(e){if(this.options.container!==e.container){const t=this.parentFromOptionsContainer(e.container);t.appendChild(this.container),this.parent=t}!0!==e.dragToSeek&&"object"!=typeof this.options.dragToSeek||this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(e){this.scrollContainer.scrollLeft=e}setScrollPercentage(e){const{scrollWidth:t}=this.scrollContainer,n=t*e;this.setScroll(n)}destroy(){var e,t;this.subscriptions.forEach((e=>e())),this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(t=this.unsubscribeOnScroll)||void 0===t||t.call(this)}createDelay(e=10){let t,n;const r=()=>{t&&clearTimeout(t),n&&n()};return this.timeouts.push(r),()=>new Promise(((i,s)=>{r(),n=s,t=setTimeout((()=>{t=void 0,n=void 0,i()}),e)}))}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const t=document.createElement("canvas"),n=t.getContext("2d"),r=t.height*(window.devicePixelRatio||1),i=n.createLinearGradient(0,0,0,r),s=1/(e.length-1);return e.forEach(((e,t)=>{const n=t*s;i.addColorStop(n,e)})),i}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(e,t,n,r){const i=e[0],s=e[1]||e[0],o=i.length,{width:a,height:u}=n.canvas,l=u/2,c=this.getPixelRatio(),h=t.barWidth?t.barWidth*c:1,d=t.barGap?t.barGap*c:t.barWidth?h/2:0,p=t.barRadius||0,f=a/(h+d)/o,m=p&&"roundRect"in n?"roundRect":"rect";n.beginPath();let E=0,g=0,A=0;for(let _=0;_<=o;_++){const e=Math.round(_*f);if(e>E){const i=Math.round(g*l*r),s=i+Math.round(A*l*r)||1;let o=l-i;"top"===t.barAlign?o=0:"bottom"===t.barAlign&&(o=u-s),n[m](E*(h+d),o,h,s,p),E=e,g=0,A=0}const o=Math.abs(i[_]||0),a=Math.abs(s[_]||0);o>g&&(g=o),a>A&&(A=a)}n.fill(),n.closePath()}renderLineWaveform(e,t,n,r){const i=t=>{const i=e[t]||e[0],s=i.length,{height:o}=n.canvas,a=o/2,u=n.canvas.width/s;n.moveTo(0,a);let l=0,c=0;for(let e=0;e<=s;e++){const s=Math.round(e*u);if(s>l){const e=a+(Math.round(c*a*r)||1)*(0===t?-1:1);n.lineTo(l,e),l=s,c=0}const o=Math.abs(i[e]||0);o>c&&(c=o)}n.lineTo(l,a)};n.beginPath(),i(0),i(1),n.fill(),n.closePath()}renderWaveform(e,t,n){if(n.fillStyle=this.convertColorValues(t.waveColor),t.renderFunction)return void t.renderFunction(e,n);let r=t.barHeight||1;if(t.normalize){const t=Array.from(e[0]).reduce(((e,t)=>Math.max(e,Math.abs(t))),0);r=t?1/t:1}t.barWidth||t.barGap||t.barAlign?this.renderBarWaveform(e,t,n,r):this.renderLineWaveform(e,t,n,r)}renderSingleCanvas(e,t,n,r,i,s,o){const a=this.getPixelRatio(),u=document.createElement("canvas");u.width=Math.round(n*a),u.height=Math.round(r*a),u.style.width=`${n}px`,u.style.height=`${r}px`,u.style.left=`${Math.round(i)}px`,s.appendChild(u);const l=u.getContext("2d");if(this.renderWaveform(e,t,l),u.width>0&&u.height>0){const e=u.cloneNode(),n=e.getContext("2d");n.drawImage(u,0,0),n.globalCompositeOperation="source-in",n.fillStyle=this.convertColorValues(t.progressColor),n.fillRect(0,0,u.width,u.height),o.appendChild(e)}}renderMultiCanvas(t,n,r,i,s,o){const a=this.getPixelRatio(),{clientWidth:u}=this.scrollContainer;if(u*a>=r)return void this.renderSingleCanvas(t,n,u,i,0,s,o);const l=r/a;let c=Math.min(e.MAX_CANVAS_WIDTH,u,l),h={};if(n.barWidth||n.barGap){const e=n.barWidth||.5,t=e+(n.barGap||e/2);c%t!=0&&(c=Math.floor(c/t)*t)}const d=e=>{if(e<0||e>=p)return;if(h[e])return;h[e]=!0;const r=e*c,a=Math.min(l-r,c);if(a<=0)return;const u=t.map((e=>{const t=Math.floor(r/l*e.length),n=Math.floor((r+a)/l*e.length);return e.slice(t,n)}));this.renderSingleCanvas(u,n,a,i,r,s,o)},p=Math.ceil(l/c),f=this.scrollContainer.scrollLeft/l,m=Math.floor(f*p);d(m-1),d(m),d(m+1),p>1&&(this.unsubscribeOnScroll=this.on("scroll",(()=>{const{scrollLeft:t}=this.scrollContainer,n=Math.floor(t/l*p);Object.keys(h).length>e.MAX_NODES&&(s.innerHTML="",o.innerHTML="",h={}),d(n-1),d(n),d(n+1)})))}renderChannel(e,t,n,r){var{overlay:i}=t,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["overlay"]);const o=document.createElement("div"),a=this.getHeight(s.height,s.splitChannels);o.style.height=`${a}px`,i&&r>0&&(o.style.marginTop=`-${a}px`),this.canvasWrapper.style.minHeight=`${a}px`,this.canvasWrapper.appendChild(o);const u=o.cloneNode();this.progressWrapper.appendChild(u),this.renderMultiCanvas(e,s,n,a,o,u)}render(e){return wg(this,void 0,void 0,(function*(){var t;this.timeouts.forEach((e=>e())),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",null!=this.options.width&&(this.scrollContainer.style.width="number"==typeof this.options.width?`${this.options.width}px`:this.options.width);const n=this.getPixelRatio(),r=this.scrollContainer.clientWidth,i=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrollable=i>r;const s=this.options.fillParent&&!this.isScrollable,o=(s?r:i)*n;if(this.wrapper.style.width=s?"100%":`${i}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=e,this.emit("render"),this.options.splitChannels)for(let a=0;a<e.numberOfChannels;a++){const n=Object.assign(Object.assign({},this.options),null===(t=this.options.splitChannels)||void 0===t?void 0:t[a]);this.renderChannel([e.getChannelData(a)],n,o,a)}else{const t=[e.getChannelData(0)];e.numberOfChannels>1&&t.push(e.getChannelData(1)),this.renderChannel(t,this.options,o,0)}Promise.resolve().then((()=>this.emit("rendered")))}))}reRender(){var e;if(null===(e=this.unsubscribeOnScroll)||void 0===e||e.call(this),delete this.unsubscribeOnScroll,!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:n}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:e}=this.progressWrapper.getBoundingClientRect();let t=e-n;t*=2,t=t<0?Math.floor(t):Math.ceil(t),t/=2,this.scrollContainer.scrollLeft+=t}}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,t=!1){const{scrollLeft:n,scrollWidth:r,clientWidth:i}=this.scrollContainer,s=e*r,o=n,a=n+i,u=i/2;if(this.isDragging){const e=30;s+e>a?this.scrollContainer.scrollLeft+=e:s-e<o&&(this.scrollContainer.scrollLeft-=e)}else{(s<o||s>a)&&(this.scrollContainer.scrollLeft=s-(this.options.autoCenter?u:0));const e=s-n-u;t&&this.options.autoCenter&&e>0&&(this.scrollContainer.scrollLeft+=Math.min(e,10))}{const e=this.scrollContainer.scrollLeft,t=e/r,n=(e+i)/r;this.emit("scroll",t,n,e,e+i)}}renderProgress(e,t){if(isNaN(e))return;const n=100*e;this.canvasWrapper.style.clipPath=`polygon(${n}% 0, 100% 0, 100% 100%, ${n}% 100%)`,this.progressWrapper.style.width=`${n}%`,this.cursor.style.left=`${n}%`,this.cursor.style.transform=`translateX(-${100===Math.round(n)?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(e,t)}exportImage(e,t,n){return wg(this,void 0,void 0,(function*(){const r=this.canvasWrapper.querySelectorAll("canvas");if(!r.length)throw new Error("No waveform data");if("dataURL"===n){const n=Array.from(r).map((n=>n.toDataURL(e,t)));return Promise.resolve(n)}return Promise.all(Array.from(r).map((n=>new Promise(((r,i)=>{n.toBlob((e=>{e?r(e):i(new Error("Could not export image"))}),e,t)})))))}))}};Ug.MAX_CANVAS_WIDTH=8e3,Ug.MAX_NODES=10;let Hg=class extends kg{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",(()=>{requestAnimationFrame((()=>{this.emit("tick")}))})),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}},$g=class extends kg{constructor(e=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=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return wg(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(e){if(this.currentSrc=e,this._duration=void 0,!e)return this.buffer=null,void this.emit("emptied");fetch(e).then((t=>{if(t.status>=400)throw new Error(`Failed to fetch ${e}: ${t.status} (${t.statusText})`);return t.arrayBuffer()})).then((t=>this.currentSrc!==e?null:this.audioContext.decodeAudioData(t))).then((t=>{this.currentSrc===e&&(this.buffer=t,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())}))}_play(){var e;if(!this.paused)return;this.paused=!1,null===(e=this.bufferNode)||void 0===e||e.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 e;this.paused=!0,null===(e=this.bufferNode)||void 0===e||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return wg(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(e){var t,n;const r=e-this.currentTime;null===(t=this.bufferNode)||void 0===t||t.stop(this.audioContext.currentTime+r),null===(n=this.bufferNode)||void 0===n||n.addEventListener("ended",(()=>{this.bufferNode=null,this.pause()}),{once:!0})}setSinkId(e){return wg(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(e)}))}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e,this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(e){const t=!this.paused;t&&this._pause(),this.playedDuration=e/this._playbackRate,t&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var e,t;return null!==(e=this._duration)&&void 0!==e?e:(null===(t=this.buffer)||void 0===t?void 0:t.duration)||0}set duration(e){this._duration=e}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(e){return/^(audio|video)\//.test(e)}getGainNode(){return this.gainNode}getChannelData(){const e=[];if(!this.buffer)return e;const t=this.buffer.numberOfChannels;for(let n=0;n<t;n++)e.push(this.buffer.getChannelData(n));return e}};const jg={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};let Yg=class e extends Pg{static create(t){return new e(t)}constructor(e){const t=e.media||("WebAudio"===e.backend?new $g:void 0);super({media:t,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},jg,e),this.timer=new Hg;const n=t?void 0:this.getMediaElement();this.renderer=new Ug(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");const{peaks:e,duration:t}=this.options;(r||e&&t)&&this.load(r,e,t).catch((()=>null))}))}updateProgress(e=this.getCurrentTime()){return this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),e}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const e=this.updateProgress();this.emit("timeupdate",e),this.emit("audioprocess",e)}})))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const e=this.updateProgress();this.emit("timeupdate",e)})),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",(e=>{this.emit("error",e.error)})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((e,t)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,t))})),this.renderer.on("dblclick",((e,t)=>{this.emit("dblclick",e,t)})),this.renderer.on("scroll",((e,t,n,r)=>{const i=this.getDuration();this.emit("scroll",e*i,t*i,n,r)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")})),this.renderer.on("dragstart",(e=>{this.emit("dragstart",e)})),this.renderer.on("dragend",(e=>{this.emit("dragend",e)})));{let e;this.subscriptions.push(this.renderer.on("drag",(t=>{if(!this.options.interact)return;let n;this.renderer.renderProgress(t),clearTimeout(e),this.isPlaying()?n=0:!0===this.options.dragToSeek?n=200:"object"==typeof this.options.dragToSeek&&void 0!==this.options.dragToSeek&&(n=this.options.dragToSeek.debounceTime),e=setTimeout((()=>{this.seekTo(t)}),n),this.emit("interaction",t*this.getDuration()),this.emit("drag",t)})))}}initPlugins(){var e;(null===(e=this.options.plugins)||void 0===e?void 0:e.length)&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((e=>e())),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),null!=e.mediaControls&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e._init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",(()=>{this.plugins=this.plugins.filter((t=>t!==e))}))),e}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(e){return this.renderer.setScroll(e)}setScrollTime(e){const t=e/this.getDuration();this.renderer.setScrollPercentage(t)}getActivePlugins(){return this.plugins}loadAudio(e,t,n,r){return wg(this,void 0,void 0,(function*(){var i;if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!t&&!n){const n=this.options.fetchParams||{};window.AbortController&&!n.signal&&(this.abortController=new AbortController,n.signal=null===(i=this.abortController)||void 0===i?void 0:i.signal);const r=e=>this.emit("loading",e);t=yield Bg.fetchBlob(e,r,n)}this.setSrc(e,t);const s=yield new Promise((e=>{const t=r||this.getDuration();t?e(t):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>e(this.getDuration())),{once:!0}))}));if(!e&&!t){const e=this.getMediaElement();e instanceof $g&&(e.duration=s)}if(n)this.decodedData=Lg.createBuffer(n,s||0);else if(t){const e=yield t.arrayBuffer();this.decodedData=yield Lg.decode(e,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(e,t,n){return wg(this,void 0,void 0,(function*(){try{return yield this.loadAudio(e,void 0,t,n)}catch(e){throw this.emit("error",e),e}}))}loadBlob(e,t,n){return wg(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",e,t,n)}catch(e){throw this.emit("error",e),e}}))}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:t=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),i=[];for(let s=0;s<r;s++){const e=this.decodedData.getChannelData(s),r=[],o=e.length/t;for(let i=0;i<t;i++){const t=e.slice(Math.floor(i*o),Math.ceil((i+1)*o));let s=0;for(let e=0;e<t.length;e++){const n=t[e];Math.abs(n)>Math.abs(s)&&(s=n)}r.push(Math.round(s*n)/n)}i.push(r)}return i}getDuration(){let e=super.getDuration()||0;return 0!==e&&e!==1/0||!this.decodedData||(e=this.decodedData.duration),e}toggleInteraction(e){this.options.interact=e}setTime(e){super.setTime(e),this.updateProgress(e),this.emit("timeupdate",e)}seekTo(e){const t=this.getDuration()*e;this.setTime(t)}playPause(){return wg(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(e){this.setTime(this.getCurrentTime()+e)}empty(){this.load("",[[0]],.001)}setMediaElement(e){this.unsubscribePlayerEvents(),super.setMediaElement(e),this.initPlayerEvents()}exportImage(){return wg(this,arguments,void 0,(function*(e="image/png",t=1,n="dataURL"){return this.renderer.exportImage(e,t,n)}))}destroy(){var e;this.emit("destroy"),null===(e=this.abortController)||void 0===e||e.abort(),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}};function zg({src:e,onError:t,filename:n,className:r=""}){const i=ai(),s=hi(),o=le(null),a=le(),u=le(),[l,c]=se(!1),[h,d]=se(0),[p,f]=se(1),m=le(),[E,g]=se(!1);ae((()=>{a.current=new Audio;const r={normalize:!0,height:50,container:o.current};function i(){const e=a.current;e&&("PIPELINE_ERROR_READ: FFmpegDemuxer: demuxer seek failed"===e.error.message?(e.load(),c(!1)):(g(!0),c(!1),t?.()))}const s=n.slice(n.lastIndexOf(".")+1);if(function(e){return/(?:^|\/)talkjs_audio_message_[0-9]+_([0-9]+)[.](?:mp3|webm)$/.test(e)}(n)&&"webm"===s&&!a.current.canPlayType("audio/webm;codecs=opus"))r.backend="WebAudio",u.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"),u.current.controls=!1;else{const t=a.current;t.addEventListener("error",i),t.src=e,t.preload="auto",t.preservesPitch=!0,r.media=t}m.current=function(e){if(!e.container)return;const t=getComputedStyle(e.container);let n=Rg(t.color);return n||(n=Rg("rgb(255,255,255)")),Yg.create({...e,barGap:e.barGap??2,barRadius:e.barRadius??0,barWidth:e.barWidth??2,barHeight:e.barHeight,hideScrollbar:!0,cursorWidth:e.cursorWidth??0,cursorColor:e.cursorColor,height:e.height??24,progressColor:e.progressColor??n.cssa(),waveColor:e.waveColor??n.alpha(n.alpha()/2).cssa()})}(r);const l=m.current;return l.on("finish",(()=>{a.current.loop=!0,c(!1)})),l.on("ready",(e=>d(Math.trunc(e)))),l.on("timeupdate",(e=>d(Math.trunc(e)))),"WebAudio"===r.backend&&l.load(e).catch((()=>{g(!0),c(!1),t?.()})),()=>{a.current?.removeEventListener("error",i),a.current=void 0,l.destroy(),m.current=void 0}}),[e,n,t]);const A=de((()=>{if("WebAudio"===m.current.options.backend)m.current.isPlaying()||u.current.play(),m.current.playPause(),c(m.current.isPlaying()??!1);else{const e=a.current;e.paused?e.play():e.pause(),e.loop=!1,!e.paused&&e.ended&&(e.load(),e.play()),c(!e.paused)}}),[]),_=de((e=>{m.current.setPlaybackRate(e),f(e)}),[]);return It("div",E?{}:{className:`t-audio-player ${r}`,children:[It("button",{onClick:A,children:It(i.Icon,{className:"t-play-pause-icon",type:l?"pause":"play","aria-label":l?"pause audio":"play audio",themeCustom:s.state$.themeCustom.peek().value})}),It("div",{className:"t-waveform",ref:o}),It("div",{className:"t-duration",children:Cm(h)}),It(lg,{as:"div",children:({isExpanded:e})=>It(T,{children:[It(cg,{className:"t-playback-speed","aria-label":"set playback speed",children:[p,"x",It(i.Icon,{type:"updown","aria-hidden":!0,className:"t-up-down-icon",themeCustom:s.state$.themeCustom.peek().value})]}),e&&It(Eg,{children:It(pg,{className:"t-action-menu",children:[It("div",{className:"t-playback-heading",children:"Playback Speed"}),[.25,.5,.75,1,1.25,1.5,2].map(((e,t)=>It(dg,{onSelect:()=>_(e),children:[It("span",{className:"t-playback-checkmark",children:p==e?"✓":""}),e,"x"]},t)))]})})]})})]})}function Vg(e,t){e()||t||(t=e.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}Yg.BasePlugin=class extends kg{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((e=>e()))}},Yg.dom=xg,(e=>{function t(e,t){(function(e,t){switch(t){case"undefined":return void 0===e;case String:return"string"==typeof e||e instanceof String;case Boolean:return"boolean"==typeof e||e instanceof Boolean;case Number:return"number"==typeof e||e instanceof Number;default:return e instanceof t}})(e,t)||(t.name,String(e))}e.defined=function(e){},e.has=function(e,t){e[t]},e.is=t,e.equals=function(e,t){},e.oneOf=function(e,t){t.includes(e)||JSON.stringify(t)},e.isArray=function(e,n){t(e,Array),e&&e.length>0&&t(e[0],n)},e.optional=function(e,n){void 0!==e&&t(e,n)},e.falsy=function(e){},e.never=function(e){}})(Vg||(Vg={}));const Gg=Vg,Wg=/^\/.*[^\\]\/[im]*$/;function Xg(e){return!!Wg.test(e)&&!Kg(e).test("")}function Kg(e){const t=e.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${e} to be a (non-empty) regex`);let n=t[2]||"";return n=n.replace(/[^im]/g,"")+"g",new RegExp(t[1],n)}function qg(e){const t=e.replace(/\./g,"\\.").replace(/\*/g,".*");return new RegExp("^"+t+"$","i")}function Jg(e,t){const n=Lp(t),r=qg(e);return void 0!==n&&r.test(n)}const Zg=/^[]/g;function Qg(e){return e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}class eA{constructor({mode:e,allowedHostnames:t,allowedPhoneNrs:n,allowedMatches:r,forbiddenMatches:i,suppressLinks:s,suppressEmailAddresses:o,suppressPhoneNumbers:a,replacement:u}){Gg.oneOf(e,["all","otherOnly","off"]),this.mode=e,this.suppressLinks=!1!==s,this.suppressEmailAddresses=!1!==o,this.suppressPhoneNumbers=!1!==a,this.allowedHostnames=t||[],this.allowedPhoneNrs=(n||[]).filter((e=>e)).map((e=>e.replace(/[^0-9]/g,""))),this.allowedMatches=(r||[]).filter(Xg).map((e=>Kg(e))),this.forbiddenMatches=(i||[]).filter(Xg).map((e=>Kg(e))),Gg((()=>this.allowedMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),Gg((()=>this.forbiddenMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=u?.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:e}){return"all"===this.mode||"otherOnly"===this.mode&&!e}}const tA=new RegExp(":arslan:|"+/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g.source,"g"),nA=/\uFE0F/g,rA=String.fromCharCode(8205);function iA(e){if(":arslan:"===e)return"https://cdn.talkjs.com/__assets/5461191341cea882b3f227c085d5772c.gif";const t=function(e){const t=[];let n=0,r=0,i=0;for(;i<e.length;)n=e.charCodeAt(i++),r?(t.push((65536+(r-55296<<10)+(n-56320)).toString(16)),r=0):55296<=n&&n<=56319?r=n:t.push(n.toString(16));return t.join("-")}((n=e).indexOf(rA)<0?n.replace(nA,""):n);var n;return`https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/${t}.svg`}function sA(e){let t="";return e.t&&(t=`(${e.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:e.formattedLinks??"plaintext",markup:e.markup??!1,useFallbackMentions:e.useFallbackMentions??!1,sameTabLinkRules:e.sameTabLinkRules??[],enableEmojiImageFallback:e.enableEmojiImageFallback??!1,highlight:e.highlight??[],contactInfo:e.contactInfo??!1,suppression:e.suppression??new eA({mode:"off"}),contactInfoHiddenText:e.contactInfoHiddenText??e.suppression?.replacement??t,customEmojiUrls:e.customEmojiUrls??{}}}function oA(e,t){return aA(e,sA(t))}function aA(e,t){return e.flatMap((e=>{if("string"==typeof e){let n=[e];return n=uA(n,(e=>function(e,t){const{suppression:{forbiddenMatches:n,allowedMatches:r}}=t,i=Sp(n,(t=>wp(e,t))).filter((([e])=>!r.some((t=>null!==e.match(t))))).map((e=>({offset:e.index,matchedText:e[0]})));return kp(e,i,(()=>[{type:"suppressed",text:"CONTACT_INFORMATION_HIDDEN"}]))}(e,t))),n=uA(n,(e=>function(e){return kp(e,function(e){const t=[];let n;for(;n=tA.exec(e);){const e=n[0],r=n.index;t.push({offset:r,matchedText:e})}return t}(e),(e=>[{type:"emoji",text:e.matchedText}]))}(e))),n}switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return{type:e.type,children:aA(e.children,t)};case"codespan":case"codeSpan":case"codeblock":case"codeBlock":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return e;case"mention":return{type:"mention",id:e.id,text:e.text};case"autolink":case"autoLink":return function(e,t){return"link"===t.contactInfo?e:"suppress"===t.contactInfo?function(e,t){if(t.allowedMatches.some((t=>null!==e.match(t))))return!0;if(t.forbiddenMatches.some((t=>null!==e.match(t))))return!1;if(e.startsWith("mailto:")){const n=e.substring(7).replace(/^.*@/,"");return!t.suppressEmailAddresses||lA(t.allowedHostnames,n)}if(e.startsWith("tel:")){const n=e.substring(4).replace(/[^0-9]/g,"");return!t.suppressPhoneNumbers||t.allowedPhoneNrs.some((e=>n.endsWith(e)))}return!t.suppressLinks||lA(t.allowedHostnames,Lp(e))}(e.url,t.suppression)?e:{type:"suppressed",text:"CONTACT_INFORMATION_HIDDEN"}:e.text}(e,t);case"link":return{type:"link",url:e.url,children:aA(e.children,t)};case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return{type:e.type,action:e.action,params:e.params,children:aA(e.children,t)}}}))}function uA(e,t){return Sp(e,(e=>"string"==typeof e?t(e):[e]))}function lA(e,t){for(const n of e)if(qg(n).test(t))return!0;return!1}const cA=()=>{const e=document.createElement("canvas");e.width=e.height=1;const t=e.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},hA=(e,t)=>{const n=cA();return n.fillStyle=t,n.fillText(e,0,0),n.getImageData(0,0,1,1).data};function dA(e,t){return e.flatMap((e=>{if("string"==typeof e)return pA(e,t.highlight);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletpoint":case"bulletPoint":return fA(e,t);case"bulletlist":case"bulletList":return[Ct.createElement("ul",null,...dA(e.children,t))];case"autolink":case"autoLink":return mA(e,t);case"link":return gA(e,t);case"codeblock":case"codeBlock":return[It("code",{"data-language":e.language,children:pA(e.text,t.highlight)})];case"codespan":case"codeSpan":return It("code",{children:pA((n=e.text,n.replace(/^\s*\n/m,"").replace(/\n\s*$/m,"")),t.highlight)});case"mention":return t.useFallbackMentions?It("span",{className:"mention",children:["@",e.text]}):It("div",{"data-name":"mention","data-text":e.text});case"suppressed":return[It("i",{children:t.contactInfoHiddenText})];case"emoji":return t.enableEmojiImageFallback?[It(EA,{unicode:e.text})]:[e.text];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return AA(e,t);case"customemoji":case"customEmoji":return e.text;default:Gg.never(e)}var n}))}function pA(e,t){if(0===t.length)return[e];const n=function(e){const t=e.map((e=>e.trim())).filter((e=>e));if(0===t.length)return Zg;const n=t.map(Qg).join("|");return new RegExp(n,"gi")}(t);return kp(e,wp(e,n).map((e=>({offset:e.index,matchedText:e[0]}))),(({matchedText:e})=>[It("span",{className:"highlighted-text",children:e})]))}const fA=(e,t)=>{const n={bold:"strong",italic:"em",strikethrough:"del",blockquote:"blockquote",bulletpoint:"li",bulletPoint:"li"}[e.type];return[Ct.createElement(n,null,...dA(e.children,t))]},mA=(e,t)=>[It("a",{target:_A(t.sameTabLinkRules,e.url),href:e.url,rel:"noreferrer",children:e.text})];function EA({unicode:e}){const[t,n]=se((()=>":arslan:"!==e));return ae((()=>{t&&!function(e){try{return function(e){const t=hA(e,"#000"),n=hA(e,"#fff"),r=(e=>!e.includes("‍")||cA().measureText(e).width<160)(e);return t&&n&&r&&((e,t)=>{const n=[...e].join(",");return n===[...t].join(",")&&!n.startsWith("0,0,0,")})(t,n)}(e)}catch(e){return!0}}(e)&&n(!1)}),[]),t?It("span",{className:"t-emoji",children:e}):It("img",{className:"t-emoji",src:iA(e),alt:e})}const gA=(e,t)=>{switch(t.formattedLinks){case"link":return[_("a",{target:_A(t.sameTabLinkRules,e.url),href:e.url},...dA(e.children,t))];case"plaintext":case!1:return[Ct.createElement("span",null,...dA(e.children,t))];default:Gg.never(t.formattedLinks)}},AA=(e,t)=>[_("button",{"data-type":e.type,"data-action":e.action,"data-params":JSON.stringify(e.params),disabled:!0},...dA(e.children,t))];function _A(e,t){for(const n of e)if(Wg.test(n)){if(Kg(n).test(t))return"_top"}else if(Jg(n,t))return"_top";return"_blank"}function DA({block:e,className:t=""}){return _("span",{className:`t-text ${t}`},...function(e,t={}){return dA(e,sA(t))}(oA(e.children,{contactInfo:"link"}),{enableEmojiImageFallback:!0}))}function vA(e){const t=ai(),n=hi(),{className:r="",...i}=e,s=Yr((()=>n.state$.messages.child(n.state$.extCurrentConversationId.get()).lookup.child(e.message.id).content.child(0).url.get()));return It("div",{className:`t-message-content ${r}`,children:e.message.content.map((n=>It(TA,{block:n,theme:t,downloadUrl:s,...i},e.message.createdAt+(e.message.editedAt??0))))})}function TA({block:e,currentUser:t,message:n,t:r,theme:i,themeCustom:s,downloadUrl:o}){const a=function(e,t){switch(t.type){case"text":return e.TextBlock;case"location":return e.LocationBlock;case"file":switch(t.subtype){case"image":return e.ImageBlock;case"video":return e.VideoBlock;case"voice":return e.VoiceBlock;case"audio":return e.AudioBlock;default:return e.FileBlock}default:si.never(t)}}(i,e);return It(a,{block:e,t:r,currentUser:t,message:n,themeCustom:s,downloadUrl:o})}function OA(e){return Rp(e)}function SA(e){return e.photoUrl??function(e,t){const n=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">\n <rect x="0" y="0" width="100" height="100" fill="${Rp(e)}"/>\n <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">${t}</text> \n </svg>`.replace(/\s+/g," ");return"data:image/svg+xml;base64,"+Np(n)}(e.id,(e=>e.split(bp).filter((e=>e)).map((e=>e[0])).join("")||e[Symbol.iterator]().next().value||"")(e.name))}function CA(e){const t=1048576,n=1024*t,r=1024*n;return e<1024?e+" B":e<t?Math.floor(e/1024)+" KB":e<n?Math.floor(e/t)+" MB":e<r?Math.floor(e/n)+" GB":Math.floor(e/r)+" TB"}function yA({latitude:e,longitude:t}){const n=e+","+t;return{imageUrl:`https://maps.googleapis.com/maps/api/staticmap?center=${n}&zoom=15&size=300x200&scale=2&maptype=roadmap&markers=${n}&key=${Sm}`,linkUrl:`https://maps.google.com/maps?q=${n}&z=15`}}function NA(e,...t){const n=Om.bind(Ct.createElement)(e,...t);return Array.isArray(n)?Ct.createElement(Ct.Fragment,{},...n):n}function IA({children:e,className:t,...n}){return It("div",{className:"t-attach-overlay "+t,...n,children:e})}function bA({uploadState:e}){ai();const t=e.error,n=e.uploaded;!function(e,t=!0){const n=de((t=>{27===t.keyCode&&e()}),[e]);ae((()=>{if(t)return window.addEventListener("keydown",n,!0),()=>window.removeEventListener("keydown",n,!0)}),[t,n])}((()=>e.closePreview("cancel")));const r=le(null);ae((()=>{n&&r.current.focus()}),[n]);const i=Yr(hi().t$);return It(IA,{className:"t-upload-preview",children:It("div",{className:"t-preview",children:[It(RA,{upload:e.upload,uploaded:n}),void 0!==t&&It("div",{className:"t-error-row",children:t}),It("div",{className:"t-send-row",children:[It("button",{className:"t-cancel",onClick:()=>e.closePreview("cancel"),children:i.CANCEL}),void 0===t&&n&&It("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>e.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function RA({upload:e,uploaded:t}){const n=Yr(hi().t$);return"location"!==e.type?It(T,{children:[It(kA,{upload:e}),It(LA,{upload:e,uploaded:t,t:n})]}):t?It(wA,{location:e.location}):It("div",{className:"t-loading",children:It(fo,{})})}function wA({location:e}){const{imageUrl:t,linkUrl:n}=yA(e);return It("a",{href:n,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(t)}) center center / cover no-repeat`}})}const kA=Ct.memo((function({upload:e}){let t=null;const n=e.file;if("video"===e.type){const r=/[.]ts/i.test(n.name)?"mpegts":"native";t=It("div",{className:"video-container",children:It(MA,{src:e.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else"image"===e.type?t=It("div",{className:"t-img-container",children:It("img",{src:URL.createObjectURL(n)})}):"audio"===e.type&&(t=It(zg,{src:URL.createObjectURL(n),filename:n.name}));return t})),LA=Ct.memo((function({uploaded:e,upload:t,t:n}){let r;r=e?t.metadata.filename:n.UPLOAD_IN_PROGRESS;let i="",s="";return"file"===t.type&&(i="is-file",e&&(s="file-block")),It("div",{className:`t-filename-row ${i}`,children:It("div",{className:s,children:r})})}));function MA(e){const{videoType:t,...n}=e;return It("video",{...n})}function FA({controller:e,appId:t,chatHeaderVisible:n,messageFieldVisible:r,session:i,sendMessage:s}){const o=ai(),a=hi(),u=li(),l=function(e){const t=ti((()=>{const t=e.state$.extUserId.get(),n=e.state$.errors.get(),r=e.state$.authTokenState.get(),i=t&&e.state$.currentUser.get(),s=e.state$.currentConversation.get(),o=e.state$.extCurrentConversationId.get(),a=o&&e.state$.participants.child(o).get(),u=e.state$.app.get();return n.serverError?"server-error":n.wrongAppId?"wrong-app-id":"loading"===r||"idle"===r?"loading-token":"invalid"===r?"invalid-token":"expired"===r?"expired-token":"valid"===r?n.unknownUser?"unknown-user":n.unknownConversation?"loading-conv-failed":Boolean(i&&s&&a&&u)?"loaded":"loading-data":void si.unreachable()})),n=ti({type:"loading"});ni((r=>{const i=t.get(),s=e.state$.extCurrentConversationId.peek(),o=e.state$.extUserId.peek(),a=e.state$.appId.peek();function u(e){n.set({type:"loading"});const t=setTimeout((()=>{n.set(e)}),5e3);return()=>clearTimeout(t)}switch(i){case"invalid-token":n.set({type:"auth-failed"});break;case"expired-token":n.set({type:"expired-token"});break;case"wrong-app-id":n.set({type:"wrong-app-id",appId:a});break;case"server-error":n.set({type:"server-error"});break;case"loading-data":case"loading-token":n.set({type:"loading"});break;case"loaded":n.set({type:"loaded",conversationId:s,userId:o});break;case"loading-conv-failed":r.onCleanup=u({type:"inaccessible-conversation",userId:o,conversationId:s});break;case"unknown-user":r.onCleanup=u({type:"unknown-user",userId:o});break;default:si.never(i)}}));const r=ti({type:"loading"});return ni((e=>{if("loading"===n.type.get()){r.set({type:"invisible-loading"});const t=setTimeout((()=>{r.set({type:"loading"})}),1e3);e.onCleanup=()=>{clearTimeout(t)}}else r.set(n.get())})),r}(a),c=Yr(l),{attachFile:h,shareLocation:d,uploadState:p}=function(e,t,n){const[r,i]=se(null),s=de((async r=>{try{if(r||(r=(await new Promise((e=>{const t=document.createElement("input");t.type="file",t.multiple=!1,t.addEventListener("change",(()=>{e([...t.files])})),t.addEventListener("cancel",(()=>{e([])})),t.click()})))[0]),!r)return;const{uploadPromise:s,upload:o}=await async function(e,t){const n=e.name;if(function(e){return/\.(mp4|ts|mov|webm|ogv)$/i.test(e)}(e.name)){const r=await Dm("video",e,(e=>({width:e.videoWidth,height:e.videoHeight,duration:e.duration,filename:n}))),i=t.uploadVideo(e,r),s=function(e){switch(e.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"}}(e);return{uploadPromise:i,upload:{type:"video",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e],{type:s}))}}}if(function(e){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(e)}(e.name)){const r=await Dm("audio",e,(e=>({duration:e.duration,filename:n})));return{uploadPromise:t.uploadAudio(e,r),upload:{type:"audio",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}if(function(e){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(e)}(e.name)){const r=await Dm("img",e,(e=>({width:e.naturalWidth,height:e.naturalHeight,filename:n})));return{uploadPromise:t.uploadImage(e,r),upload:{type:"image",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}const r={filename:n};return{uploadPromise:t.uploadFile(e,r),upload:{type:"file",file:e,metadata:r,temporaryBlobUrl:URL.createObjectURL(new Blob([e]))}}}(r,e),a=o.file.size+","+o.file.name;n.state$.localFileBlobUrls.child(n.state$.extCurrentConversationId.peek()).child(a).set({url:o.temporaryBlobUrl,fetching:!1}),n.latestFileUpload=o;const u=Am(),l={upload:o,closePreview:u.resolve,uploaded:!1};let c;i(l);try{c=await s,i({...l,uploaded:!0})}catch(e){i((n=>({...n,error:e.toString()})))}if("cancel"===await u.promise)return;si.defined(c),t.sendFileMessage({fileToken:c})}finally{i(null)}}),[t,e,i,n]);return{attachFile:s,shareLocation:_m("geolocation",(async e=>{try{const n=Am(),r={upload:{type:"location",location:void 0},uploaded:!1,closePreview:n.resolve};i(r);const{permissionResult:s,location:o}=await new Promise((e=>{navigator.geolocation.getCurrentPosition((t=>{const n={latitude:t.coords.latitude,longitude:t.coords.longitude};e({permissionResult:"granted",location:n})}),(t=>{1===t.code?e({permissionResult:"denied"}):e({permissionResult:"granted"})}))}));if(e(s),!o)return;if(i({...r,upload:{type:"location",location:o},uploaded:!0}),"cancel"===await n.promise)return;t.sendLocationMessage({location:o})}finally{i(null)}}),[t,i]),uploadState:r}}(i,e,a);ae((()=>{u.uploadFile=h}),[u,h]);const[f,m]=se(!1),E=de((e=>{h(e.dataTransfer.files[0]),e.preventDefault(),m(!1)}),[h]),g=de((e=>{e.preventDefault(),m(!0)}),[]),A=de((e=>{e.preventDefault(),m(!1)}),[]);return"invisible-loading"===c.type?It(T,{}):"loading"===c.type?It(Ao,{}):"inaccessible-conversation"===c.type?It(go,{t:a.t$.peek()}):"unknown-user"===c.type||"auth-failed"===c.type||"wrong-app-id"===c.type||"server-error"===c.type||"unexpected-error"===c.type?It(Eo,{appId:t,chatboxState:c}):"expired-token"==c.type?It(_o,{t:a.t$.peek()}):"loaded"===c.type?It("div",{className:"t-chatbox-content",onDragOver:g,onDragLeave:A,onDrop:E,children:It(zr,{children:()=>It(T,{children:[n&&It(o.ChatHeader,{conversation:a.state$.currentConversation.get(),currentUser:a.state$.currentUser.get(),participants:a.state$.participants.child(c.conversationId).get(),t:a.t$.get(),chatbox:e,themeCustom:a.state$.themeCustom.get().value}),It(ho,{extConversationId:c.conversationId,controller:e}),r&&It(o.MessageField,{conversation:a.state$.currentConversation.get(),currentUser:a.state$.currentUser.get(),participants:a.state$.participants.child(c.conversationId).get(),referencedMessage:a.referencedMessage$.get(),permissions:a.userPermissions$().get(),t:a.t$.get(),chatbox:e,editor:new fm(u.state$.get(),s,h,d),themeCustom:a.state$.themeCustom.get().value}),p&&It(bA,{uploadState:p}),f&&It(IA,{className:"t-drop-overlay",children:It(o.Icon,{type:"attach",themeCustom:a.state$.themeCustom.get().value})})]})})}):It(T,{})}class xA extends Error{constructor(e,t){const n=function(e){if("string"==typeof e)return e;if(Array.isArray(e))return e.join("\n");try{return JSON.stringify(e)}catch(t){return String(e)}}(e);super(n),this.userMessage=t??n,Object.setPrototypeOf&&Object.setPrototypeOf(this,new.target.prototype)}}const BA=console;class PA{constructor(e,t,n,r){this.apiUrls=e,this.appId=t,this.sessionId=n,this.authProvider=r,this._lastPutPromise=Promise.resolve()}async get(e,t={}){const n=this.endpointUrl(e,t),r=await HA((()=>this.fetchWithReauth(n)),{retries:11});return await this.handleResponse(r,n)}async queuedPut(e,t){await this._lastPutPromise;const n=HA((()=>this._doPut(e,t)));return this._lastPutPromise=n,n}put(e,t,n){const r=()=>this._doPut(e,t);return n?$A(r,n):HA(r,{retries:5})}post(e,t,n){const r=()=>this._doPost(e,t);return n?$A(r,n):HA(r,{retries:5})}delete(e,t={}){return HA((()=>this._doDelete(e,t)),{retries:11})}endpointUrl(e,t={}){const n=new URL(this.apiUrls.internalHttpApiUrl);n.pathname+=`/${this.appId}/${e}`,n.searchParams.set("sessionId",this.sessionId);for(const[r,i]of Object.entries(t))n.searchParams.set(r,i);return n}async _doPut(e,t){const n=this.endpointUrl(e),r=await this.fetchWithReauth(n,{method:"PUT",body:JSON.stringify(t)});return await this.handleResponse(r,n)}async _doPost(e,t){const n=this.endpointUrl(e),r=await this.fetchWithReauth(n,{method:"POST",body:JSON.stringify(t)});return await this.handleResponse(r,n)}async _doDelete(e,t){const n=this.endpointUrl(e,t),r=await this.fetchWithReauth(n,{method:"DELETE"});return await this.handleResponse(r,n)}async handleResponse(e,t){if(e.status>=300){if(404===e.status)throw Os.error(`[${this.appId}][BackendRestClient] Couldn't find resource.`),new xA("Could not find app.",`Could not find given appId: "${this.appId}". You can find your appId on https://talkjs.com/dashboard.`);if(401===e.status){const e=await this.authProvider.getToken();throw Os.error(`[${this.appId}][BackendRestClient] Couldn't authenticate ${t} with token ${e}.`),new xA("User not authenticated.","Could not authenticate user. Check if your signature is calculated correctly.")}if(e.status>=300&&e.status<500){const{error:t}=await e.json();throw new xA(t)}{const n=await e.text();throw new Error(`Got non-success response (${n}) from the server for url: ${t}.`)}}return await e.json()}async fetchWithReauth(e,t){function n(n){const r={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${n}`};return fetch(e,{...t,headers:r})}const r=await this.authProvider.getToken(),i=await n(r);return 401!==i.status?i:(BA.error(`401 error from ${t?.method} ${e}, ${r}`),this.authProvider.refreshToken(),n(await this.authProvider.getToken()))}}function UA(e){return!e.userMessage}function HA(e,{retries:t=30}={}){return gm(t,e,{shouldRetry:UA,log:BA.warn.bind(BA),maxDelay:30,initialDelay:.2})}async function $A(e,t){try{return await e()}catch(e){if(!UA(e))throw e}let n=!1;return t.then((()=>{n=!0})),gm(1e3,e,{initialDelay:.2,maxDelay:30,shouldRetry:()=>!n,log:BA.warn.bind(BA)})}var jA={exports:{}};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Function]",o="[object Object]",a=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[i]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[s]=l["[object Map]"]=l["[object Number]"]=l[o]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var c,h="object"==typeof Ir&&Ir&&Ir.Object===Object&&Ir,d="object"==typeof self&&self&&self.Object===Object&&self,p=h||d||Function("return this")(),f=t&&!t.nodeType&&t,m=f&&e&&!e.nodeType&&e,E=m&&m.exports===f,g=E&&h.process,A=function(){try{return m&&m.require&&m.require("util").types||g&&g.binding&&g.binding("util")}catch(e){}}(),_=A&&A.isTypedArray,D=Array.prototype,v=Function.prototype,T=Object.prototype,O=p["__core-js_shared__"],S=v.toString,C=T.hasOwnProperty,y=(c=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",N=T.toString,I=S.call(Object),b=RegExp("^"+S.call(C).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=E?p.Buffer:void 0,w=p.Symbol,k=p.Uint8Array;R&&R.allocUnsafe;var L,M,F=(L=Object.getPrototypeOf,M=Object,function(e){return L(M(e))}),x=Object.create,B=T.propertyIsEnumerable,P=D.splice,U=w?w.toStringTag:void 0,H=function(){try{var e=oe(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),$=R?R.isBuffer:void 0,j=Math.max,Y=Date.now,z=oe(p,"Map"),V=oe(Object,"create"),G=function(){function e(){}return function(t){if(!Ae(t))return{};if(x)return x(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function W(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function q(e){var t=this.__data__=new X(e);this.size=t.size}function J(e,t,n){(void 0!==n&&!he(e[t],n)||void 0===n&&!(t in e))&&ee(e,t,n)}function Z(e,t,n){var r=e[t];C.call(e,t)&&he(r,n)&&(void 0!==n||t in e)||ee(e,t,n)}function Q(e,t){for(var n=e.length;n--;)if(he(e[n][0],t))return n;return-1}function ee(e,t,n){"__proto__"==t&&H?H(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}W.prototype.clear=function(){this.__data__=V?V(null):{},this.size=0},W.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},W.prototype.get=function(e){var t=this.__data__;if(V){var r=t[e];return r===n?void 0:r}return C.call(t,e)?t[e]:void 0},W.prototype.has=function(e){var t=this.__data__;return V?void 0!==t[e]:C.call(t,e)},W.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=V&&void 0===t?n:t,this},X.prototype.clear=function(){this.__data__=[],this.size=0},X.prototype.delete=function(e){var t=this.__data__,n=Q(t,e);return!(n<0||(n==t.length-1?t.pop():P.call(t,n,1),--this.size,0))},X.prototype.get=function(e){var t=this.__data__,n=Q(t,e);return n<0?void 0:t[n][1]},X.prototype.has=function(e){return Q(this.__data__,e)>-1},X.prototype.set=function(e,t){var n=this.__data__,r=Q(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},K.prototype.clear=function(){this.size=0,this.__data__={hash:new W,map:new(z||X),string:new W}},K.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},K.prototype.get=function(e){return se(this,e).get(e)},K.prototype.has=function(e){return se(this,e).has(e)},K.prototype.set=function(e,t){var n=se(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},q.prototype.clear=function(){this.__data__=new X,this.size=0},q.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},q.prototype.get=function(e){return this.__data__.get(e)},q.prototype.has=function(e){return this.__data__.has(e)},q.prototype.set=function(e,t){var n=this.__data__;if(n instanceof X){var r=n.__data__;if(!z||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new K(r)}return n.set(e,t),this.size=n.size,this};function te(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":U&&U in Object(e)?function(e){var t=C.call(e,U),n=e[U];try{e[U]=void 0;var r=!0}catch(e){}var i=N.call(e);return r&&(t?e[U]=n:delete e[U]),i}(e):function(e){return N.call(e)}(e)}function ne(e){return _e(e)&&te(e)==i}function re(e,t,n,r,i){e!==t&&function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var a=s[++r];if(!1===t(i[a],a,i))break}}(t,(function(s,a){if(i||(i=new q),Ae(s))!function(e,t,n,r,i,s,a){var u=le(e,n),l=le(t,n),c=a.get(l);if(c)J(e,n,c);else{var h,d=s?s(u,l,n+"",e,t,a):void 0,p=void 0===d;if(p){var f=pe(l),m=!f&&me(l),E=!f&&!m&&De(l);d=l,f||m||E?pe(u)?d=u:_e(h=u)&&fe(h)?d=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(u):m?(p=!1,d=l.slice()):E?(p=!1,d=function(e){var t,n,r=(n=new(t=e.buffer).constructor(t.byteLength),new k(n).set(new k(t)),n);return new e.constructor(r,e.byteOffset,e.length)}(l)):d=[]:function(e){if(!_e(e)||te(e)!=o)return!1;var t=F(e);if(null===t)return!0;var n=C.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&S.call(n)==I}(l)||de(l)?(d=u,de(u)?d=function(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],a=void 0;void 0===a&&(a=e[o]),r?ee(n,o,a):Z(n,o,a)}return n}(e,ve(e))}(u):Ae(u)&&!Ee(u)||(d=function(e){return"function"!=typeof e.constructor||ue(e)?{}:G(F(e))}(l))):p=!1}p&&(a.set(l,d),i(d,l,r,s,a),a.delete(l)),J(e,n,d)}}(e,t,a,n,re,r,i);else{var u=r?r(le(e,a),s,a+"",e,t,i):void 0;void 0===u&&(u=s),J(e,a,u)}}),ve)}var ie=H?function(e,t){return H(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Se;function se(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function oe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Ae(e)||function(e){return!!y&&y in e}(e))&&(Ee(e)?b:a).test(function(e){if(null!=e){try{return S.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ae(e,t){var n=typeof e;return!!(t=null==t?r:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||T)}function le(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var ce=function(e){var t=0,n=0;return function(){var r=Y(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ie);function he(e,t){return e===t||e!=e&&t!=t}var de=ne(function(){return arguments}())?ne:function(e){return _e(e)&&C.call(e,"callee")&&!B.call(e,"callee")},pe=Array.isArray;function fe(e){return null!=e&&ge(e.length)&&!Ee(e)}var me=$||function(){return!1};function Ee(e){if(!Ae(e))return!1;var t=te(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Ae(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var De=_?function(e){return function(t){return e(t)}}(_):function(e){return _e(e)&&ge(e.length)&&!!l[te(e)]};function ve(e){return fe(e)?function(e){var t=pe(e),n=!t&&de(e),r=!t&&!n&&me(e),i=!t&&!n&&!r&&De(e),s=t||n||r||i,o=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=o.length;for(var u in e)s&&("length"==u||r&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ae(u,a))||o.push(u);return o}(e):function(e){if(!Ae(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&C.call(e,r))&&n.push(r);return n}(e)}var Te,Oe=(Te=function(e,t,n){re(e,t,n)},function(e,t){return ce(function(e,t,n){return t=j(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=j(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,Se),e+"")}((function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Te.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!Ae(n))return!1;var r=typeof t;return!!("number"==r?fe(n)&&ae(t,n.length):"string"==r&&t in n)&&he(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Te(e,o,n)}return e})));function Se(e){return e}e.exports=Oe}(jA,jA.exports);const YA=br(jA.exports);class zA{constructor(e,t,n,r){this.backendRestClient=new PA(e,t,n,r)}async getApp(e){return function(e){return{appMetadata:{...e.appMetadata,id:e.appMetadata.id},features:e.features,role:VA(e.configuration,e.features)}}(await this.backendRestClient.get("/app",{role_name:e}))}async checkIfAppExists(){return this.backendRestClient.get("/app").then((()=>!0)).catch((e=>{if("Could not find app."===e.message)return!1;throw e}))}}function VA(e,t){const n={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}},\n {{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}},\n The {{app.name}} team",enableReplyToEmail:t.includes("reply_via_email"),emailThemeType:t.includes("email_templates")?"custom":"standard",emailTheme:"default_email",emailAttachmentMode:"enabledExcludingImages",htmlTemplate:'<div>\n Hi {{recipient.name}}, <br/>\n <br/>\n {{sender.name}} wants to chat with you on {{app.name}}:<br/>\n <br/>\n {{messages.all}}\n <br/>\n <a href="{{app.custom.websiteUrl}}">Join the chat</a>\n <br/>\n <br/>\n On behalf of {{sender.name}},<br/>\n The {{app.name}} team<br/>\n <br/>\n</div>',textTemplate:"Hi {{recipient.name}},\n\n{{sender.name}} wants to chat with you on {{app.name}}:\n\n{{messages.all}}\n\n{{app.custom.websiteUrl}} Join the chat\n\nOn behalf of {{sender.name}},\nThe {{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 YA(n,e)}function GA(e,t){const n=e.map((e=>function(e,t){if("text"===e.type)return function(e,t){return WA(e,sA(t))}(e.children,t);if("file"===e.type&&"video"===e.subtype)return`🎥 ${Mp(e.url)}`;if("file"===e.type&&"image"===e.subtype)return`📷 ${Mp(e.url)}`;if("file"===e.type&&"audio"===e.subtype)return`🎧 ${Mp(e.url)}`;if("file"===e.type&&"voice"===e.subtype){const t=e.duration;return void 0===t?"🎙️":`🎙️ (${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")})`}return"file"===e.type?(e.subtype,`📎 ${Mp(e.url)}`):"location"===e.type?"📍":""}(e,t)));return n.join("\n\n")}function WA(e,t){return e.flatMap((e=>{if("string"==typeof e)return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return WA(e.children,t);case"bulletlist":case"bulletList":return"\n"+WA(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+WA(e.children,t)+"\n";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 XA(){const e="undefined"!=typeof window?window.crypto:void 0,t=e?()=>e.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 KA{constructor(e,t,n,r,i){this.store=e,this.talkSession=t,this.editorInternals=n,this.onSendMessage=r,this.onDeleteMessage=i}async deleteMessage(e){const t=this.store.state$.extCurrentConversationId.peek(),n=this.store.state$.messages.child(t).lookup.child(e).peek(),r=this.talkSession.conversation(t).message(e),[i]=await Promise.all([n??r.get(),r.delete()]);if(i){const e={currentUser:this.store.state$.currentUser.peek(),conversation:this.store.state$.currentConversation.peek(),message:n};this.onDeleteMessage(e)}}async editMessage(e,t){const n=this.store.state$.extCurrentConversationId.peek();await this.talkSession.conversation(n).message(e).edit(t)}setReferencedMessage(e){this.store.state$.referencedMessageId.set(e)}sendMessage(e){return this._send({text:e.text,custom:e.custom,referencedMessage:e.referencedMessageId})}sendFileMessage(e){const t={type:"file",fileToken:e.fileToken};return this._send({content:[t],custom:e.custom})}sendLocationMessage(e){const t={type:"location",latitude:e.location.latitude,longitude:e.location.longitude};return this._send({content:[t],custom:e.custom})}async _send(e){const t=this.store.state$.extCurrentConversationId.peek(),n=await async function(e,t){const n=e.state$.extCurrentConversationId.peek(),r=e.state$.messages.child(n),i="string"==typeof t.referencedMessage?r.lookup.child(t.referencedMessage).peek():await(t.referencedMessage?.get()??null),s=i&&{...i,type:"UserMessage",sender:i.sender,referencedMessageId:i.referencedMessage?.id??null};s&&delete s.referencedMessage;const o=e.latestFileUpload,a="content"in t?[qA(o,t.content[0])]:[{type:"text",children:[t.text]}],u="text"in t?t.text:GA(t.content.map((e=>qA(o,e))),{});return{id:"ephemeral-"+XA(),type:"UserMessage",sender:e.state$.currentUser.peek(),createdAt:Date.now(),editedAt:null,custom:t.custom??{},origin:"web",referencedMessage:s,content:a,plaintext:u}}(this.store,e);this.store.state$.ephemeralMessages.child(t).child(n.id).set(n);const r=Am();this.store.readyForNewMessagesPromise=r.promise;const i=await this.talkSession.conversation(t).send(e);this.store.state$.ephemeralMessageIdMapping.child(t).child(i.id).set(n.id),r.resolve(),this.onSendMessage({message:await i.get(),currentUser:this.store.state$.currentUser.peek(),conversation:this.store.state$.currentConversation.peek()})}closeMessageActionMenu(){this.store.state$.activeMessageActionMenu.set(null)}openMessageActionMenu(e){this.store.state$.activeMessageActionMenu.set(e)}closeMessageActionMenusOnWindowClick(){const e=e=>{e.target.closest("[t-message-action-menu-keep-open]")||this.closeMessageActionMenu()};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}getMessageFieldText(){return this.editorInternals.getText()}setMessageFieldText(e){this.editorInternals.setText(e)}markAsTyping(){const e=this.store.state$.extCurrentConversationId.peek();this.talkSession.conversation(e).markAsTyping()}}function qA(e,t){switch(t.type){case"text":case"location":return t;case"file":return function(e,t){return{type:"file",subtype:"file"===e.type?void 0:e.type,...e.metadata,size:e.file.size,filename:e.file.name,fileToken:t.fileToken,url:e.temporaryBlobUrl}}(e,t)}}class JA{constructor(e,t,n){this.realtimeWsApiUrl=e,this.internalHttpApiUrl=t,this.restApiHttpUrl=n}getBokensUrl(e,t,n){return this.internalHttpApiUrl+`/${e}/bokens/${encodeURIComponent(t)}?signature=${encodeURIComponent(n??"")}`}getRealtimeWsUrl(e,t,n,r,i){const s=encodeURIComponent(t);return this.realtimeWsApiUrl+`/${e}/realtime/${s}?talkjs-client-build=${i??"standalone"}&talkjs-core=${n}&talkjs-client-id=${r}`}static fromHost(e){const t=new JA("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!e)return t;if(e.endsWith("talkjs.com")){const n=e.match(/\w+-(\w+)\.talkjs\.com/);if(n){const e=n[1];return new JA(`wss://realtime-${e}.talkjs.com/v1`,`https://app-${e}.talkjs.com/api/v0`,`https://api-${e}.talkjs.com/v1`)}return t}return e.includes("localhost")||e.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e)?new JA(`ws://${e}/public_api/v1`,`http://${e}/api/v0`,`http://${e}/public_api/v1`):new JA(`wss://${e}/public_api/v1`,`https://${e}/api/v0`,`https://${e}/public_api/v1`)}}var ZA,QA=Object.defineProperty,e_=Object.defineProperties,t_=Object.getOwnPropertyDescriptors,n_=Object.getOwnPropertySymbols,r_=Object.prototype.hasOwnProperty,i_=Object.prototype.propertyIsEnumerable,s_=(e,t,n)=>t in e?QA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o_=(e,t)=>{for(var n in t||(t={}))r_.call(t,n)&&s_(e,n,t[n]);if(n_)for(var n of n_(t))i_.call(t,n)&&s_(e,n,t[n]);return e},a_=(e,t)=>e_(e,t_(t)),u_=(e,t)=>{var n={};for(var r in e)r_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&n_)for(var r of n_(e))t.indexOf(r)<0&&i_.call(e,r)&&(n[r]=e[r]);return n},l_=(e,t,n)=>new Promise(((r,i)=>{var s=e=>{try{a(n.next(e))}catch(e){i(e)}},o=e=>{try{a(n.throw(e))}catch(e){i(e)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(s,o);a((n=n.apply(e,t)).next())}));function c_(e,t){if(t.ok)return t.value.data;if("SESSION_DESTROYED"===t.value)throw new Error(`${e} failed because the session was destroyed`);if("server"===t.where)throw new Error(h_(e,t.value));throw"unreachable"}function h_(e,t){let n;return n=Array.isArray(t.reasons)?t.reasons.join():JSON.stringify(t.reasons),`${e} failed, got status ${t.status} ${t.errorCode}, reasons: ${n}`}function d_(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if("*"!==t[n]&&e[n]!==t[n])return!1;return!0}function p_(e){return e<=0?Promise.resolve():new Promise((t=>setTimeout(t,e)))}function f_(e,t){return e*(1-t+2*Math.random()*t)}const m_=()=>!0;function E_(e,t,n){return l_(this,arguments,(function*(e,t,{initialDelay:n,maxDelay:r,log:i,shouldRetry:s=m_}){return t().catch((o=>l_(this,null,(function*(){if(0===e)throw o;if(!(yield s(o)))throw o;const a=1e3*n*1.2,u=f_(r?Math.min(1e3*r,a):a,.05);return p_(u).then((()=>E_(e-1,t,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:s})))}))))}))}function g_(){const e={},t=new Promise((function(t,n){e.resolve=t,e.reject=n}));return e.promise=t,e}class A_{constructor(e,t,n){this.layer=e,this.states=t,this.transitions=n,this._state=t[0]}get state(){return this._state}transition(e){const t=this.transitions[e];if(!t)return;if(!this.canTransition(e))return;const n=this.state;this._state=t.to,t.afterTransition({from:n,to:this.state})}canTransition(e){const t=this.transitions[e];return!!t&&("ANY"===t.from||t.from.includes(this.state))}}function __(e){return{ok:!0,value:e}}function D_(e){return{ok:!1,where:"client",value:e}}function v_(e){return{ok:!1,where:"server",value:e}}function T_(){const e={},t=new Promise((t=>{e.ok=e=>l_(this,null,(function*(){return t(__(e))})),e.clientErr=e=>t(D_(e)),e.serverErr=e=>t(v_(e)),e.resolve=e=>t(e)}));return e.promise=t,e}class O_{constructor(e,t){this.realtimeUrl=e,this.handlers=t,this.socket=null,this.stateMachine=new A_("ReconnectingSocket",["STOPPED","CONNECTING","READY","DISCONNECTED","TERMINATED"],{startWs:{from:["STOPPED","DISCONNECTED"],to:"CONNECTING",afterTransition:()=>{const e=new(function(){if(globalThis.WebSocket)return globalThis.WebSocket;throw new Error("Missing WebSocket implementation")}())(this.realtimeUrl+"&talkjs-time="+Date.now());this.socket=e,e.addEventListener("open",(()=>{this.socket===e&&this.stateMachine.transition("onOpen")})),e.addEventListener("close",(()=>{this.socket===e&&this.stateMachine.transition("onClose")})),e.addEventListener("message",(t=>{this.socket===e&&this.handlers.onMessage(t)}))}},onOpen:{from:["CONNECTING"],to:"READY",afterTransition:()=>{this.handlers.onOpen()}},onClose:{from:["CONNECTING","READY"],to:"DISCONNECTED",afterTransition:e=>l_(this,[e],(function*({from:e}){"READY"===e&&this.handlers.onClose(),this.socket=null;const t=f_(1e4,.5);setTimeout((()=>{"DISCONNECTED"===this.stateMachine.state&&this.stateMachine.transition("startWs")}),t)}))},stopWs:{from:["CONNECTING","DISCONNECTED","READY"],to:"STOPPED",afterTransition:({from:e})=>{"READY"===e&&this.handlers.onClose();const t=this.socket;this.socket=null,null==t||t.close(1e3)}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{const e=this.socket;this.socket=null,null==e||e.close(1e3)}}})}stopWs(){this.stateMachine.transition("stopWs")}startWs(){this.stateMachine.transition("startWs")}send(e){return"READY"===this.stateMachine.state?(this.socket.send(e),__(void 0)):D_("SOCKET_NOT_READY")}terminate(){const e=this.socket;this.stateMachine.canTransition("onClose")&&this.stateMachine.transition("onClose"),e&&("terminate"in e?e.terminate():e.close(1e3))}destroy(){this.stateMachine.transition("destroy")}}class S_{constructor(e,t){this.handlers=t,this.socket=new O_(e,{onOpen:()=>this.handlers.onOpen(),onClose:()=>this.handlers.onClose(),onMessage:e=>this.onWebSocketMessage(e)})}call(e,t,n,r){const i=`/${n.map((e=>encodeURIComponent(e))).join("/")}`,s=JSON.stringify([e,t,i,r]);return this.socket.send(s)}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.socket.destroy()}terminate(){this.socket.terminate()}onWebSocketMessage(e){if("Auth token expired"!==e.data)try{const t=JSON.parse(e.data);if("PUBLISH"===t[1]){const e=t[0],n=JSON.stringify([e,"ACK"]);this.socket.send(n);const r=t.slice(2),i=[];r.forEach((e=>{"session.expired"===e.type?this.handlers.onAuthExpired():"upstream.restarting"===e.type?this.handlers.onUpstreamRestarting():i.push(e)})),i.length>0&&this.handlers.onPublish(e,i)}else{const e=t[0],n=t[1],r=t[2];this.handlers.onResponse(e,n,r)}}catch(e){}else this.handlers.onAuthExpired()}}class C_{constructor(e){this.delayMs=e,this.timeout=void 0}schedule(e){this.stop(),this.timeout=setTimeout((()=>{void 0!==this.timeout&&(this.stop(),e())}),this.delayMs)}stop(){void 0!==this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}}class y_{constructor(){this.i=-1}next(){return this.i++,this.i}reset(){this.i=-1}}class N_{constructor(e,t){this.handlers=t,this.seqCounter=new y_,this.responseHandlers={},this.heartbeats=new I_(this),this.socket=new S_(e,{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((e=>{e.clientErr("WEBSOCKET_DISCONNECTED")})),this.responseHandlers={},this.seqCounter.reset(),this.handlers.onNotReady()},onResponse:(e,t,n)=>{this.heartbeats.serverActive(),this.onResponse(e,t,n)},onPublish:(e,t)=>{this.heartbeats.serverActive(),this.handlers.onPublish(e,t),this.heartbeats.clientActive()},onAuthExpired:()=>{this.heartbeats.serverActive(),this.handlers.onAuthExpired()}})}call(e,t,n){const r=this.seqCounter.next(),i=T_();this.responseHandlers[r]=i;const s=this.socket.call(r,e,t,n);return s.ok||i.resolve(s),this.heartbeats.clientActive(),i.promise}onResponse(e,t,n){return l_(this,null,(function*(){const r=this.responseHandlers[e];r&&(200===t?r.ok({status:t,data:n}):r.serverErr({status:t,errorCode:n.errorCode,reasons:n.reasons}),delete this.responseHandlers[e])}))}stopWs(){this.socket.stopWs()}startWs(){this.socket.startWs()}destroy(){this.heartbeats.stop(),Object.values(this.responseHandlers).forEach((e=>{e.clientErr("WEBSOCKET_DISCONNECTED")})),this.responseHandlers={},this.socket.destroy()}terminate(){this.socket.terminate()}}class I_{constructor(e){this.connection=e,this.clientInactivityTimer=new C_(25e3),this.serverInactivityTimer=new C_(1e4),this.serverTimeoutTimer=new C_(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 b_{constructor(e,t,n){this.authProvider=t,this.handlers=n,this.stateMachine=new A_("AuthenticatedConnection",["WAITING_FOR_WS","LOGGING_IN","RENEWING_SESSION","READY","TERMINATED"],{logIn:{from:["WAITING_FOR_WS"],to:"LOGGING_IN",afterTransition:()=>l_(this,null,(function*(){yield this.renewSession()}))},logInFailed:{from:["LOGGING_IN"],to:"LOGGING_IN",afterTransition:()=>l_(this,null,(function*(){this.authProvider.refreshToken(),yield this.renewSession()}))},scheduledReauth:{from:["READY"],to:"RENEWING_SESSION",afterTransition:()=>l_(this,null,(function*(){yield this.renewSession()}))},scheduledReauthFailed:{from:["RENEWING_SESSION"],to:"RENEWING_SESSION",afterTransition:()=>l_(this,null,(function*(){this.authProvider.refreshToken(),yield this.renewSession()}))},authenticated:{from:["LOGGING_IN","RENEWING_SESSION"],to:"READY",afterTransition:({from:e})=>{"LOGGING_IN"===e&&this.handlers.onReady()}},authExpired:{from:["READY","RENEWING_SESSION"],to:"LOGGING_IN",afterTransition:()=>l_(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:e})=>{"READY"!==e&&"RENEWING_SESSION"!==e||this.handlers.onNotReady(),this.authProvider.clearScheduledRefresh()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{this.authProvider.clearScheduledRefresh(),this.connection.destroy()}}}),this.connection=new N_(e,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onReady:()=>this.stateMachine.transition("logIn"),onNotReady:()=>{this.stateMachine.transition("wsDisconnected")},onAuthExpired:()=>{this.stateMachine.transition("authExpired")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}}),t.onTokenChanged((()=>{"READY"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauth")}))}call(e,t,n){const r=this.connection.call(e,t,n);return r.then((e=>{e.ok||"server"!==e.where||401!==e.value.status||"READY"!==this.stateMachine.state&&"RENEWING_SESSION"!==this.stateMachine.state||this.stateMachine.transition("authExpired")})),r}stopWs(){this.connection.stopWs()}startWs(){this.connection.startWs()}destroy(){this.stateMachine.transition("destroy")}renewSession(){return l_(this,null,(function*(){const e=yield this.authProvider.getToken(),t=yield this.connection.call("POST",["session","renew"],{token:e});if(!t.ok&&"client"===t.where)return;const n=t.value;if(n.status,200===n.status){const t=n.data.expiresInSeconds;return void(null!==t&&t<120?(console.warn(`[TalkJS] Authenticated with a token that expires in ${t}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`),"LOGGING_IN"===this.stateMachine.state?this.stateMachine.transition("logInFailed"):"RENEWING_SESSION"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauthFailed")):(this.authProvider.scheduleRefresh(t),this.authProvider.emitTokenAccepted(e),this.stateMachine.canTransition("authenticated")&&this.stateMachine.transition("authenticated")))}if(401===n.status)return void("LOGGING_IN"===this.stateMachine.state?this.stateMachine.transition("logInFailed"):"RENEWING_SESSION"===this.stateMachine.state&&this.stateMachine.transition("scheduledReauthFailed"));if(400===n.status)return void this.authProvider.emitTokenRefreshFailed(h_("Authentication",n));if(402===n.status)return void this.authProvider.emitTokenRefreshFailed(h_("Authentication",n));const r=5e3*Math.random()+5e3;setTimeout((()=>{this.call("POST",["session","renew"],{token:e}).catch((()=>{}))}),r)}))}}class R_{constructor(e,t,n){this.handlers=n,this.stateMachine=new A_("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 C_(3e3),this.connection=new b_(e,t,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("ready")},onNotReady:()=>{"READY"===this.stateMachine.state&&this.stateMachine.transition("unexpectedDisconnect")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}get inactive(){return 0===this.pendingCalls&&0===this.activeSubscriptions}ensureStarted(){this.stateMachine.canTransition("start")&&this.stateMachine.transition("start")}call(e,t,n){return l_(this,null,(function*(){this.inactivityTimer.stop(),this.pendingCalls++;const r=yield this.connection.call(e,t,n);return this.pendingCalls--,"SUBSCRIBE"===e&&r.ok?this.activeSubscriptions++:"UNSUBSCRIBE"===e&&r.ok&&this.activeSubscriptions--,this.inactive&&this.inactivityTimer.schedule((()=>{this.stateMachine.transition("stop")})),r}))}destroy(){this.stateMachine.transition("destroy")}isConnected(){return"READY"===this.stateMachine.state}}class w_{constructor(e,t,n){this.handlers=n,this.stateMachine=new A_("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((e=>e.deferred.ok({status:200,data:{}}))),this.subscribeQueue={},this.handlers.onSubscriptionsLost()}},destroy:{from:"ANY",to:"TERMINATED",afterTransition:()=>{for(var e;this.callQueue.length;){const t=null==(e=this.callQueue.shift())?void 0:e.deferred;null==t||t.clientErr("SESSION_DESTROYED")}this.connection.destroy()}}}),this.subscribeQueue={},this.callQueue=[],this.connection=new R_(e,t,{onUpstreamRestarting:()=>{this.handlers.onUpstreamRestarting()},onReady:()=>{this.stateMachine.transition("processQueue")},onNotReady:()=>{this.stateMachine.transition("notReady")},onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}call(e,t,n){return"READY"===this.stateMachine.state?this.connection.call(e,t,n):("NOT_READY"===this.stateMachine.state&&this.connection.ensureStarted(),"SUBSCRIBE"===e||"UNSUBSCRIBE"===e?this._subscribe(e,t,n):this._call(e,t,n))}_subscribe(e,t,n){const r=t.join("/"),i=this.subscribeQueue[r];if(i&&i.method===e)return i.deferred.promise;i&&i.method!==e&&(i.deferred.ok({status:200,data:{}}),delete this.subscribeQueue[r]);const s={deferred:T_(),method:e,path:t,data:n};return this.subscribeQueue[r]=s,s.deferred.promise}_call(e,t,n){const r={deferred:T_(),method:e,path:t,data:n};return this.callQueue.push(r),r.deferred.promise}dequeue(){for(const e in this.subscribeQueue){const t=this.subscribeQueue[e];return delete this.subscribeQueue[e],t}return this.callQueue.shift()}destroy(){this.stateMachine.transition("destroy")}sendQueuedCalls(){return l_(this,null,(function*(){let e=0;for(;"PROCESSING_QUEUE"===this.stateMachine.state;){e++;const t=this.dequeue();if(!t)return void this.stateMachine.transition("ready");this.connection.call(t.method,t.path,t.data).then((e=>{t.deferred.resolve(e)})),e>50&&(yield new Promise((e=>setTimeout(e,100))))}}))}isConnected(){return"READY"===this.stateMachine.state||"PROCESSING_QUEUE"===this.stateMachine.state}}const k_="undefined"!=typeof window&&null!=(ZA=window.queueMicrotask)?ZA:setTimeout;class L_{constructor(e,t){this.clearPendingBatch=e,this.sendCalls=t,this.sent=!1,k_((()=>this.send()))}send(){this.sent||(this.sent=!0,this.clearPendingBatch(),this.sendCalls())}destroy(){this.sent=!0}}class M_ extends L_{constructor(e,t){super(t,(()=>{this.sendSubscribe(),this.sendGet()})),this.connection=e,this.getCalls=[],this.subscribeCalls=[]}canPush(e,t){return M_.isCorrectBatchTypeFor(e,t)}static isCorrectBatchTypeFor(e,t){return d_(t,["users","*"])&&("GET"===e||"SUBSCRIBE"===e)}push(e,t,n){const r=t[1],i=T_();return"GET"===e?this.getCalls.push({userId:r,deferred:i}):this.subscribeCalls.push({userId:r,deferred:i}),1e3!==this.getCalls.length&&1e3!==this.subscribeCalls.length||this.send(),i.promise}sendGet(){return l_(this,null,(function*(){if(0===this.getCalls.length)return;const e=[...new Set(this.getCalls.map((e=>e.userId)))],t=yield this.connection.call("GET",["users"],{ids:e,includePrivateFields:!1});if(t.ok)for(const n of this.getCalls){const e=t.value.data[n.userId];e?n.deferred.ok({status:200,data:e}):n.deferred.serverErr({status:404,errorCode:"NOT_FOUND",reasons:["No user with that ID exists"]})}else this.getCalls.forEach((e=>e.deferred.resolve(t)))}))}sendSubscribe(){if(0===this.subscribeCalls.length)return;const e=[...new Set(this.subscribeCalls.map((e=>e.userId)))];this.connection.call("SUBSCRIBE",["users"],{ids:e}).then((e=>this.subscribeCalls.forEach((t=>t.deferred.resolve(e)))))}}class F_ extends L_{constructor(e,t,n){super(n,(()=>this.sendMutate())),this.conversationId=e,this.connection=t,this.calls=[]}canPush(e,t){return!!F_.isCorrectBatchTypeFor(e,t)&&t[1]===this.conversationId}static isCorrectBatchTypeFor(e,t){return d_(t,["conversations","*","participants","*"])&&("PUT"===e||"POST"===e||"PATCH"===e)}push(e,t,n){const r=t[3],i=T_();return this.calls.push({action:{id:r,method:e,params:n},deferred:i}),100===this.calls.length&&this.send(),i.promise}sendMutate(){return l_(this,null,(function*(){const e=this.calls.map((e=>e.action)),t=yield this.connection.call("POST",["conversations",this.conversationId,"participants"],{actions:e});if(!t.ok)return void this.calls.forEach((e=>e.deferred.resolve(t)));const n=t.value.data.responses;for(let r=0;r<n.length;r++){const e=this.calls[r].deferred,t=n[r];200===t.status?e.ok(a_(o_({},t),{data:{}})):e.serverErr(t)}}))}}class x_{constructor(e,t,n){this.pendingBatch=null,this.connection=new w_(e,t,n)}call(e,t,n){return l_(this,null,(function*(){var r;if(null==(r=this.pendingBatch)?void 0:r.canPush(e,t))return this.pendingBatch.push(e,t,n);this.pendingBatch&&this.pendingBatch.send();const i=this.createEmptyBatchFor(e,t);return i?(this.pendingBatch=i,i.push(e,t,n)):this.connection.call(e,t,n)}))}destroy(){var e;this.connection.destroy(),null==(e=this.pendingBatch)||e.destroy()}isConnected(){return this.connection.isConnected()}createEmptyBatchFor(e,t){if(M_.isCorrectBatchTypeFor(e,t))return new M_(this.connection,(()=>this.pendingBatch=null));if(F_.isCorrectBatchTypeFor(e,t)){const e=t[1];return new F_(e,this.connection,(()=>this.pendingBatch=null))}return null}}const B_={200:"RESOLVE",400:"RESOLVE",401:"RETRY",402:"RESOLVE",403:"RESOLVE",404:"RESOLVE",405:"RESOLVE",409:"RESOLVE",429:"DELAY",500:"DELAY"};class P_{constructor(e,t,n){this.throttler=new U_,this.alive=!0,this.connection=new x_(e,t,n)}call(e,t,n){return l_(this,null,(function*(){let r=0;for(;this.alive;){const i=yield this.connection.call(e,t,n);if((i.ok||"client"!==i.where||"SOCKET_NOT_READY"!==i.value)&&(i.ok||"server"!==i.where||500!==i.value.status)||r++,10===r)return i;if(i.ok||"client"!==i.where){const e=i.value,t=e.status,n=B_[t];if("RESOLVE"===n)return this.throttler.resetDelay(),i;if("RETRY"===n)continue;if("DELAY"===n){yield this.throttler.wait();continue}return console.warn("[TalkJS] Unexpected status code",t),e}if("SESSION_DESTROYED"===i.value)return D_("SESSION_DESTROYED");"WEBSOCKET_DISCONNECTED"!==i.value&&("SOCKET_NOT_READY"!==i.value?i.value:yield this.throttler.wait())}return D_("SESSION_DESTROYED")}))}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}}class U_{constructor(){this.initialDelayMs=200,this.exponentialFactor=1.2,this.maxDelayMs=3e4,this.currentDelayMs=this.initialDelayMs,this.lastCall=0}getCurrentDelay(){return this.currentDelayMs}wait(){const e=(new Date).getTime(),t=f_(this.currentDelayMs,.05),n=this.lastCall+t,r=Math.max(0,n-e);return this.lastCall=e+r,this.currentDelayMs=Math.min(t*this.exponentialFactor,this.maxDelayMs),p_(r)}resetDelay(){this.currentDelayMs=this.initialDelayMs}}function H_(e){return e.map((e=>encodeURIComponent(e))).join()}class $_{constructor(){this.paths={}}add(e){this.paths[H_(e)]=e}delete(e){delete this.paths[H_(e)]}has(e){return Object.hasOwnProperty.call(this.paths,H_(e))}clear(){this.paths={}}forEach(e){Object.values(this.paths).forEach((t=>e(t)))}}class j_{constructor(e,t,n){this.handlers=n,this.targetSubscriptions=new $_,this.connection=new P_(e,t,{onUpstreamRestarting:()=>this.handlers.onUpstreamRestarting(),onSubscriptionsLost:()=>{this.targetSubscriptions.forEach((e=>{this.resubscribe(e)})),this.handlers.onResubscribeSent()},onReady:()=>this.handlers.onReady(),onPublish:(e,t)=>{this.handlers.onPublish(e,t)}})}call(e,t,n){return this.connection.call(e,t,n)}subscribe(e){return l_(this,null,(function*(){return this.targetSubscriptions.add(e),this.connection.call("SUBSCRIBE",e,{})}))}unsubscribe(e){return l_(this,null,(function*(){return this.targetSubscriptions.delete(e),this.connection.call("UNSUBSCRIBE",e,{})}))}resubscribe(e){return l_(this,null,(function*(){const t=yield this.connection.call("SUBSCRIBE",e,{});t.ok||this.handlers.onResubscribeError(e,t)}))}destroy(){this.targetSubscriptions.clear(),this.connection.destroy()}isConnected(){return this.connection.isConnected()}}function Y_(e,t){return void 0===t?e:t}function z_(e,t){if(void 0===t)return e;if(null===t)return{};const n=o_({},e);for(const r in t){const e=t[r];null===e?delete n[r]:n[r]=e}return n}function V_(e,t){if(e===t)return!0;if(!e||!t)return!1;if("object"!=typeof e||"object"!=typeof t)return!1;if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!V_(e[n],t[n]))return!1}else{const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n){if(!Object.hasOwnProperty.call(t,r))return!1;if(!V_(e[r],t[r]))return!1}}return!0}class G_{constructor(){this.prev=Promise.resolve()}runExclusive(e){return l_(this,null,(function*(){const t=this.prev.then((()=>e()));return this.prev=t,t}))}}class W_{constructor(e){this.initialised=!1,this.getPointer=void 0,this.pendingStates=[e],e.resultPromise.then((()=>this.initialised=!0))}get pendingPointer(){if(0!==this.pendingStates.length)return this.pendingStates[this.pendingStates.length-1]}get mostRecentState(){var e;return null!=(e=this.pendingPointer)?e:this.getPointer}canAppendState(e){var t,n;const r=null==(t=this.getPointer)?void 0:t.seq;if(void 0!==r&&e<=r)return!1;const i=null==(n=this.pendingPointer)?void 0:n.seq;return!(void 0!==i&&e<i)}set(e){if(!this.canAppendState(e.seq))throw"Appending in the past";this.pendingStates.push(e)}mutate(e,t){if(!this.initialised)return;if(!this.canAppendState(e))throw"Mutating in the past";const n=this.mostRecentState.resultPromise.then((e=>e.ok?t(e):e));this.pendingStates.push({seq:e,resultPromise:n})}get(e){for(;this.pendingStates.length>0&&(void 0===this.getPointer||this.pendingStates[0].seq<=e);)this.getPointer=this.pendingStates.shift();return this.getPointer}}class X_ extends W_{constructor(e,t){super(e),this.onTeardown=t,this._error=null,this._lastGoodState=Promise.resolve(void 0)}get error(){return this._error}get lastGoodState(){return this._lastGoodState}mutate(e,t){super.mutate(e,t),this.registerNewState(this.mostRecentState.resultPromise)}set(e){super.set(e),this.registerNewState(this.mostRecentState.resultPromise)}registerNewState(e){const t=this.lastGoodState;this._lastGoodState=e.then((e=>e.ok?e.value:t)),e.then((e=>{e.ok||this.setError(e)}))}setError(e){var t;this._error||(this._error=e,null==(t=this.onTeardown)||t.call(this,e),this.lastGoodState.then((e=>{void 0!==e&&this.teardownNested(e)})))}}class K_ extends X_{constructor(e,t){const n=new Promise((e=>setTimeout(e))).then((()=>this.fetchInitial(e)));super({seq:e,resultPromise:n},t),this.initialSeq=e,this.getDeepMutex=new G_,this.lastDeep=void 0}refetchInitial(e){return l_(this,null,(function*(){const t=this.mostRecentState.resultPromise,n=this.fetchInitial(e),[r,i]=yield Promise.all([t,n]);return void 0!==r&&r.ok&&i.ok&&this.equal(r.value,i.value)?r:i}))}refetch(e){if(null!==this.error)return;const t={seq:e,resultPromise:this.refetchInitial(e)};this.set(t)}changedBetween(e,t){return l_(this,null,(function*(){if(e>=t)return!1;const n=this.get(t),r=yield n.resultPromise;return!!r.ok&&(r.value.lastChanged>Math.max(this.initialSeq,e)&&r.value.lastChanged<=t||(yield this.anyChildChanged(e,t,r.value)))}))}getDeep(e){return l_(this,null,(function*(){return this.getDeepMutex.runExclusive((()=>l_(this,null,(function*(){var t;if(null!==this.error)return this.error;const n=null==(t=this.lastDeep)?void 0:t.seq;if(e===n)return this.lastDeep.deep;if(void 0!==n){if(e<n)throw`Trying to load seq ${e} when we have previously loaded seq ${n}`;if(!(yield this.changedBetween(n,e)))return this.lastDeep.seq=e,this.lastDeep.deep}const r=this.get(e).resultPromise,i=r.then((t=>t.ok?this.loadNested(e,t.value):t));this.lastDeep={seq:e,shallow:r,deep:i};const s=yield i;return s.ok||this.setError(s),s}))))}))}}class q_ extends K_{constructor(e,t,n){super(e,n),this.emitMutex=t,this.unsubscribeTimer=new J_,this.referencedByOtherStores=0,this.listeners=[],this.lastEmitSeq=void 0,this.lastEmitResult=void 0,t.runExclusive((()=>l_(this,null,(function*(){yield this.emit(e)}))))}registerInternalSubscription(){this.referencedByOtherStores++;let e=!0;return()=>{e&&(e=!1,this.referencedByOtherStores--,this.startUnsubscribeTimerIfOrphan())}}get onlyUsedInternally(){return 0===this.listeners.length}listen(e){return this.unsubscribeTimer.stop(),this.listeners.push(e),void 0!==this.lastEmitResult&&e(this.lastEmitResult),()=>{this.listeners=this.listeners.filter((t=>t!==e)),this.startUnsubscribeTimerIfOrphan()}}startUnsubscribeTimerIfOrphan(){0===this.referencedByOtherStores&&0===this.listeners.length&&this.unsubscribeTimer.restart((()=>{this.setError(D_("UNSUBSCRIBED"))}),this.unsubscribeDebounceMs)}getLoadMoreSeq(){var e;const t=null!=(e=this.lastEmitSeq)?e:0,n=this.mostRecentState.seq;return Math.max(t,n)+1e-6}emit(e){return l_(this,null,(function*(){var t;if(this.onlyUsedInternally)return;if(this.lastEmitSeq&&this.lastEmitSeq>=e)return;if(!1===(null==(t=this.lastEmitResult)?void 0:t.ok))return;this.lastEmitSeq=e;const n=yield this.getDeep(e);n!==this.lastEmitResult&&(this.lastEmitResult=n,this.listeners.forEach((e=>e(n))))}))}}class J_{constructor(){this.timerId=void 0}restart(e,t){void 0!==this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout((()=>e()),t)}stop(){clearTimeout(this.timerId)}}class Z_ extends q_{constructor(e,t,n,r,i){super(e,r,i),this.userId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e4}fetchInitial(e){return l_(this,null,(function*(){const t=yield this.realtimeClient.call("GET",["users",this.userId],{includePrivateFields:!1},{bypassCache:!0});return t.ok?__({snapshot:this.realtimeClient.createUserSnapshot(t.value.data),lastChanged:e}):"server"===t.where&&404===t.value.status?__({snapshot:null,lastChanged:e}):t}))}equal(e,t){return V_(e.snapshot,t.snapshot)}loadNested(e,t){return l_(this,null,(function*(){return __(t)}))}userCreated(e,t){this.mutate(e,(n=>null!==n.value.snapshot?n:__({snapshot:this.realtimeClient.createUserSnapshot(t.state),lastChanged:e})))}userEdited(e,t){this.mutate(e,(n=>{const r=n.value.snapshot;return null===r?(console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."),n):__({snapshot:{id:r.id,name:Y_(r.name,t.diff.name),custom:z_(r.custom,t.diff.custom),locale:Y_(r.locale,t.diff.locale),photoUrl:Y_(r.photoUrl,t.diff.photoUrl),role:Y_(r.role,t.diff.role),welcomeMessage:Y_(r.welcomeMessage,t.diff.welcomeMessage)},lastChanged:e})}))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok?null===e.value.snapshot?v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["That user does not exist yet"]}):__({status:200,data:{id:e.value.snapshot.id,name:e.value.snapshot.name,custom:e.value.snapshot.custom,locale:e.value.snapshot.locale,photoUrl:e.value.snapshot.photoUrl,role:e.value.snapshot.role,welcomeMessage:e.value.snapshot.welcomeMessage}}):D_("NOT_IN_CACHE")}))}teardownNested(e){}anyChildChanged(e,t,n){return l_(this,null,(function*(){return!1}))}}var Q_,eD={};function tD(e,t){const n=t.lastIndex;let r;const i=[];for(;null!==(r=t.exec(e));)i.push(r);return t.lastIndex=n,i}function nD(e){const t=e.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(t)}function rD(e,t){e()||t||(t=e.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/,"`$1`")+" was not true")}!function(){if(Q_)return eD;function e(e){return String.fromCharCode(parseInt(e.slice(1),16))}function t(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}Q_=1,Object.defineProperty(eD,"__esModule",{value:!0}),eD.encode=function(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,e))},eD.decode=function(e){return decodeURIComponent(Array.from(atob(e),t).join(""))}}(),(e=>{function t(e,t){(function(e,t){switch(t){case"undefined":return void 0===e;case String:return"string"==typeof e||e instanceof String;case Boolean:return"boolean"==typeof e||e instanceof Boolean;case Number:return"number"==typeof e||e instanceof Number;default:return e instanceof t}})(e,t)||(t.name,String(e))}e.defined=function(e){},e.has=function(e,t){e[t]},e.is=t,e.equals=function(e,t){},e.oneOf=function(e,t){t.includes(e)||JSON.stringify(t)},e.isArray=function(e,n){t(e,Array),e&&e.length>0&&t(e[0],n)},e.optional=function(e,n){void 0!==e&&t(e,n)},e.falsy=function(e){},e.never=function(e){}})(rD||(rD={}));const iD=rD,sD=/^\/.*[^\\]\/[im]*$/;function oD(e){return!!sD.test(e)&&!aD(e).test("")}function aD(e){const t=e.match(/^\/(.*[^\\])\/(.*)$/);if(!t)throw new Error(`Expected ${e} to be a (non-empty) regex`);let n=t[2]||"";return n=n.replace(/[^im]/g,"")+"g",new RegExp(t[1],n)}class uD{constructor({mode:e,allowedHostnames:t,allowedPhoneNrs:n,allowedMatches:r,forbiddenMatches:i,suppressLinks:s,suppressEmailAddresses:o,suppressPhoneNumbers:a,replacement:u}){iD.oneOf(e,["all","otherOnly","off"]),this.mode=e,this.suppressLinks=!1!==s,this.suppressEmailAddresses=!1!==o,this.suppressPhoneNumbers=!1!==a,this.allowedHostnames=t||[],this.allowedPhoneNrs=(n||[]).filter((e=>e)).map((e=>e.replace(/[^0-9]/g,""))),this.allowedMatches=(r||[]).filter(oD).map((e=>aD(e))),this.forbiddenMatches=(i||[]).filter(oD).map((e=>aD(e))),iD((()=>this.allowedMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"),iD((()=>this.forbiddenMatches.every((e=>e.flags.includes("g")))),"All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"),u=null==u?void 0:u.trim(),this.replacement=u&&u.length>0?u:void 0}shouldSuppress({isContentBySender:e}){return"all"===this.mode||"otherOnly"===this.mode&&!e}}function lD(e,t){return e.map((e=>function(e,t){if("text"===e.type)return cD(e.children,function(e){var t,n,r,i,s,o,a,u,l,c,h,d;let p="";return e.t&&(p=`(${e.t("CONTACT_INFORMATION_HIDDEN")})`),{formattedLinks:null!=(t=e.formattedLinks)?t:"plaintext",markup:null!=(n=e.markup)&&n,useFallbackMentions:null!=(r=e.useFallbackMentions)&&r,sameTabLinkRules:null!=(i=e.sameTabLinkRules)?i:[],enableEmojiImageFallback:null!=(s=e.enableEmojiImageFallback)&&s,highlight:null!=(o=e.highlight)?o:[],contactInfo:null!=(a=e.contactInfo)&&a,suppression:null!=(u=e.suppression)?u:new uD({mode:"off"}),contactInfoHiddenText:null!=(h=null!=(c=e.contactInfoHiddenText)?c:null==(l=e.suppression)?void 0:l.replacement)?h:p,customEmojiUrls:null!=(d=e.customEmojiUrls)?d:{}}}(t));if("file"===e.type&&"video"===e.subtype)return`🎥 ${nD(e.url)}`;if("file"===e.type&&"image"===e.subtype)return`📷 ${nD(e.url)}`;if("file"===e.type&&"audio"===e.subtype)return`🎧 ${nD(e.url)}`;if("file"===e.type&&"voice"===e.subtype){const t=e.duration;return void 0===t?"🎙️":`🎙️ (${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,"0")})`}return"file"===e.type?(e.subtype,`📎 ${nD(e.url)}`):"location"===e.type?"📍":""}(e,t))).join("\n\n")}function cD(e,t){return e.flatMap((e=>{if("string"==typeof e)return e;switch(e.type){case"blockquote":case"bold":case"italic":case"strikethrough":case"link":case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return cD(e.children,t);case"bulletlist":case"bulletList":return"\n"+cD(e.children,t);case"bulletpoint":case"bulletPoint":return"- "+cD(e.children,t)+"\n";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 hD extends K_{constructor(e,t,n,r){super(e),this.conversationId=t,this.message=n,this.realtimeClient=r}get messageId(){return"string"==typeof this.message?this.message:this.message.id}fetchInitial(e){return l_(this,null,(function*(){let t;if("object"==typeof this.message)t=this.message;else{const e=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"messages",this.message],{},{bypassCache:!0});if(!e.ok)return e;t=e.value.data}return __({lastChanged:e,sender:null===t.senderId?null:this.realtimeClient.internalSubscribe(["users",t.senderId]),data:{id:t.id,type:t.type,custom:t.custom,createdAt:t.createdAt,editedAt:t.editedAt,referencedMessageId:t.referencedMessageId,origin:t.origin,plaintext:lD(t.content,{}),content:t.content}})}))}refetch(e){throw"Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){return V_(e.data,t.data)}teardownNested(e){var t;null==(t=e.sender)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;const i=null==(r=n.sender)?void 0:r.store;return!0===(yield null==i?void 0:i.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){var n,r,i;const s=yield null==(r=null==(n=t.sender)?void 0:n.store)?void 0:r.getDeep(e);if(!1===(null==s?void 0:s.ok))return s;if(null===t.data)return __({snapshot:null});const o=null==s?void 0:s.value;return __({snapshot:{sender:null!=(i=null==o?void 0:o.snapshot)?i:null,id:t.data.id,type:t.data.type,custom:t.data.custom,createdAt:t.data.createdAt,editedAt:t.data.editedAt,origin:t.data.origin,plaintext:lD(t.data.content,{}),content:t.data.content,referencedMessageId:t.data.referencedMessageId}})}))}messageEdited(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,sender:n.value.sender,data:{id:n.value.data.id,type:n.value.data.type,createdAt:n.value.data.createdAt,origin:n.value.data.origin,referencedMessageId:n.value.data.referencedMessageId,editedAt:Y_(n.value.data.editedAt,t.diff.editedAt),custom:z_(n.value.data.custom,t.diff.custom),content:Y_(n.value.data.content,t.diff.content)}})))}messageDeleted(e,t){this.mutate(e,(n=>null===n.value.data?n:this.messageId===t.messageId?(this.teardownNested(n.value),__({lastChanged:e,sender:null,data:null})):n.value.data.referencedMessageId===t.messageId?__({lastChanged:e,sender:n.value.sender,data:{id:n.value.data.id,type:n.value.data.type,createdAt:n.value.data.createdAt,origin:n.value.data.origin,referencedMessageId:null,editedAt:n.value.data.editedAt,custom:n.value.data.custom,content:n.value.data.content}}):n))}getFromCache(){return l_(this,null,(function*(){var e;const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.data)return v_({status:404,errorCode:"MESSAGE_NOT_FOUND",reasons:["No message with that ID exists"]});const n=t.value,{sender:r}=n,i=u_(n,["sender"]);return __({status:200,data:a_(o_({},i.data),{senderId:null!=(e=null==r?void 0:r.store.userId)?e:null})})}))}}class dD extends K_{constructor(e,t,n,r){super(e),this.createdAt=t,this.dataStore=n,this.referencedDataStore=r}get messageId(){return this.dataStore.messageId}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,dataStore:this.dataStore,referencedDataStore:this.referencedDataStore})}))}refetch(e){throw"Do not call refetch on message stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){return!0}teardownNested(e){}anyChildChanged(e,t,n){return l_(this,arguments,(function*(e,t,{dataStore:n,referencedDataStore:r}){return!0===(yield n.changedBetween(e,t))||!0===(yield null==r?void 0:r.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){var n,r,i;const s=yield t.dataStore.getDeep(e);if(!s.ok)return s;const o=s.value;if(null===o.snapshot)return __({snapshot:null});const a=yield null==(n=t.referencedDataStore)?void 0:n.getDeep(e);if(a&&!a.ok)return a;const u=null!=(r=null==a?void 0:a.value)?r:null,l=null!=(i=null==u?void 0:u.snapshot)?i:null;return __({snapshot:{id:o.snapshot.id,type:o.snapshot.type,sender:o.snapshot.sender,custom:o.snapshot.custom,createdAt:o.snapshot.createdAt,editedAt:o.snapshot.editedAt,referencedMessage:l,origin:o.snapshot.origin,plaintext:o.snapshot.plaintext,content:o.snapshot.content}})}))}}class pD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}listen(e){return this.onlyUsedInternally&&this.mostRecentState.resultPromise.then((e=>{if(e.ok&&null!==e.value.inWindow){const t=30-e.value.inWindow.length;t>0&&this._loadMoreMessages(t)}})),super.listen(e)}fetchInitial(e){return l_(this,null,(function*(){const t=this.onlyUsedInternally?1:30,n=yield fD({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:t});return n.ok?null===n.value.messages?__({lastChanged:e,lastMessageChanged:e,stores:null,inWindow:null,windowEnd:null}):mD({seq:e,messages:n.value.messages,cursor:n.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):n}))}teardownNested(e){if(e.stores){const t=D_("TERMINATED");Object.values(e.stores).forEach((e=>e.setError(t))),e.inWindow.forEach((e=>e.setError(t)))}}anyChildChanged(e,t,n){return l_(this,null,(function*(){for(const r in n.stores){const i=n.stores[r];if(!0===(yield null==i?void 0:i.changedBetween(e,t)))return!0}return!1}))}lastMessageChangedBetween(e,t){return l_(this,null,(function*(){if(e>=t)return!1;const n=yield this.get(t).resultPromise;if(!n.ok)return!1;if(n.value.lastMessageChanged>e)return!0;if(null===n.value.stores)return!1;const r=n.value.inWindow[0];return void 0!==r&&!0===(yield r.changedBetween(e,t))}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&!!V_(e.inWindow.map((e=>e.messageId)),t.inWindow.map((e=>e.messageId)))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:null,loadedAll:!0});const n=yield Promise.all(t.inWindow.map((t=>t.getDeep(e)))),r=n.find((e=>!e.ok));return r||__({snapshot:n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot)),loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreMessages(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreMessages(e=30){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield fD({count:e,cursor:n,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.messages?(console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."),e):mD({seq:i,prevState:e.value,messages:r.value.messages,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}messageCreated(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."),n;if(n.value.windowEnd&&t.state.createdAt<n.value.windowEnd.oldestMessageTs)return n;if(Object.hasOwnProperty.call(n.value.stores,t.state.id))return n;const r=o_({},n.value.stores),i=new hD(e,this.conversationId,t.state,this.realtimeClient);r[t.state.id]=i;const s=t.state.referencedMessageId;let o;null===s?o=null:s in r?o=r[s]:(o=new hD(e,this.conversationId,s,this.realtimeClient),r[s]=o);const a=new dD(e,t.state.createdAt,i,o),u=[...n.value.inWindow,a];u.sort(((e,t)=>t.createdAt-e.createdAt));const l=u[0].messageId===t.messageId?e:n.value.lastMessageChanged;return __({lastChanged:e,lastMessageChanged:l,stores:r,inWindow:u,windowEnd:n.value.windowEnd})}))}messageEdited(e,t){this.mutate(e,(n=>{var r;return null===n.value.stores?(console.warn("[TalkJS] Received a 'message.edited' event for a nonexistent conversation."),n):(null==(r=n.value.stores[t.messageId])||r.messageEdited(e,t),n)}))}messageDeleted(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'message.deleted' event for a conversation that we thought didn't exist."),n;if(Object.values(n.value.stores).forEach((n=>n.messageDeleted(e,t))),void 0===n.value.stores[t.messageId])return n;const r=o_({},n.value.stores);delete r[t.messageId];const i=n.value.inWindow.filter((e=>e.messageId!==t.messageId));if(t.newLastMessage&&0===i.length){const n=new hD(e,this.conversationId,t.newLastMessage,this.realtimeClient);r[n.messageId]=n;const s=t.newLastMessage.referencedMessageId;let o;null===s?o=null:s in r?o=r[s]:(o=new hD(e,this.conversationId,s,this.realtimeClient),r[s]=o);const a=new dD(e,t.newLastMessage.createdAt,n,o);i.push(a)}const s=void 0!==t.newLastMessage?e:n.value.lastMessageChanged;return __({lastChanged:e,lastMessageChanged:s,stores:r,inWindow:i,windowEnd:n.value.windowEnd})}))}conversationCleared(e,t){this.mutate(e,(t=>{var n;return 0===(null==(n=t.value.inWindow)?void 0:n.length)&&null===t.value.windowEnd?t:(this.teardownNested(t.value),__({lastChanged:e,lastMessageChanged:e,stores:{},inWindow:[],windowEnd:null}))}))}sideCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.stores?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.stores?t:(this.teardownNested(t.value),__({lastChanged:e,lastMessageChanged:e,stores:null,inWindow:null,windowEnd:null}))))}getMessageFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return D_("NOT_IN_CACHE");const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.getFromCache()}))}}function fD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,conversationId:n,count:r}){const i={limit:r,cursor:e},s=yield t.call("GET",["me","conversations",n,"messages"],i,{bypassCache:!0});if(s.ok){const{data:e,cursor:t}=s.value.data;return __({messages:e,nextCursor:t})}return!s.ok&&"server"===s.where&&404===s.value.status||!s.ok&&"server"===s.where&&403===s.value.status&&"NOT_A_PARTICIPANT"===s.value.errorCode?__({messages:null,nextCursor:null}):s}))}function mD({seq:e,prevState:t,messages:n,cursor:r,conversationId:i,realtimeClient:s}){var o,a,u,l;const c=t?o_({},t.stores):{};for(const p of n)if(void 0===c[p.id]){const t=new hD(e,i,p,s);c[t.messageId]=t}for(const p of n){const t=p.referencedMessageId;if(t&&void 0===c[t]){const n=new hD(e,i,t,s);c[n.messageId]=n}}const h=t?[...t.inWindow]:[];for(const p of n)h.push(new dD(e,p.createdAt,c[p.id],p.referencedMessageId?c[p.referencedMessageId]:null));h.sort(((e,t)=>t.createdAt-e.createdAt));const d=(null==(a=null==(o=null==t?void 0:t.inWindow)?void 0:o[0])?void 0:a.messageId)===(null==(u=null==h?void 0:h[0])?void 0:u.messageId)&&null!=(l=null==t?void 0:t.lastMessageChanged)?l:e;return __(null===r?{lastChanged:e,lastMessageChanged:d,stores:c,inWindow:h,windowEnd:null}:{lastChanged:e,lastMessageChanged:d,stores:c,inWindow:h,windowEnd:{cursor:r,oldestMessageTs:n[n.length-1].createdAt}})}class ED extends q_{constructor(e,t,n,r,i){super(e,r,i),this.convDataStore=t,this.realtimeClient=n,this.unsubscribeDebounceMs=0}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,store:this.convDataStore})}))}teardownNested(e){e.store.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return n.store.store.changedBetween(e,t)}))}equal(e,t){return!0}loadNested(e,t){return l_(this,null,(function*(){return t.store.store.getDeep(e)}))}getFromCache(){return l_(this,null,(function*(){return this.convDataStore.store.getFromCache()}))}}function gD(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(e[n],n)}function AD(e,t){return function(e){let n={};return gD(e,((e,r)=>{const[i,s]=(([e,n])=>[e,t(n,e)])([r,e]);n[i]=s})),n}(e)}class _D extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e4}fetchInitial(e){return l_(this,null,(function*(){const t=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId,"typing"],{},{bypassCache:!0});if(!t.ok&&"server"===t.where&&404===t.value.status)return __({data:null,lastChanged:e});if(!t.ok&&"server"===t.where&&403===t.value.status&&"NOT_A_PARTICIPANT"===t.value.errorCode)return __({data:null,lastChanged:e});if(!t.ok)return t;const n=t.value.data;return n.many?__({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:e}):__({data:n,userSubscriptions:AD(n.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t]))),lastChanged:e})}))}equal(e,t){return V_(e.data,t.data)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.data)return __({snapshot:null,lastChanged:t.lastChanged});if(t.data.many)return __({snapshot:{many:!0},lastChanged:t.lastChanged});const n=Object.entries(t.data.usersTyping).sort((([e,t],[n,r])=>t-r)).map((([e,t])=>e)).map((n=>t.userSubscriptions[n].store.getDeep(e))),r=yield Promise.all(n),i=r.find((e=>!e.ok));if(i)return i;const s=r.map((e=>e.value)),o=s.map((e=>e.snapshot)),a=s.map((e=>e.lastChanged));return __({snapshot:{users:o,many:!1},lastChanged:Math.max(t.lastChanged,...a)})}))}typingAvailable(e,t){this.mutate(e,(()=>__({data:t.state,userSubscriptions:t.state.many?{}:AD(t.state.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t]))),lastChanged:e})))}typingChanged(e,t){this.mutate(e,(n=>{if(null===n.value.data)return n;if(void 0===t.diff.many){if(!0===n.value.data.many)return n;const r=o_({},n.value.data.usersTyping),i=o_({},n.value.userSubscriptions);return gD(t.diff.usersTyping,((e,t)=>{var n;"number"==typeof e?(r[t]=e,i[t]=this.realtimeClient.internalSubscribe(["users",t])):null===e&&(delete r[t],null==(n=i[t])||n.unsubscribe(),delete i[t])})),__({data:{usersTyping:r,many:!1},userSubscriptions:i,lastChanged:e})}if(!0===t.diff.many)return n.value.data.many?n:__({data:{usersTyping:null,many:!0},userSubscriptions:{},lastChanged:e});if(!1===t.diff.many){if(!1===n.value.data.many)return n;const r=AD(t.diff.usersTyping,((e,t)=>this.realtimeClient.internalSubscribe(["users",t])));return __({data:t.diff,userSubscriptions:r,lastChanged:e})}throw t.diff,"Unreachable"}))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.data?t:__({data:null,lastChanged:e})))}teardownNested(e){e.data&&gD(e.userSubscriptions,(e=>e.unsubscribe()))}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;if(null===n.data)return!1;for(const i in n.userSubscriptions){const s=n.userSubscriptions[i];if(!0===(yield null==(r=null==s?void 0:s.store)?void 0:r.changedBetween(e,t)))return!0}return!1}))}}class DD extends K_{constructor(e,t,n,r){super(e),this.conversationId=t,this.participantData=n,this.realtimeClient=r}fetchInitial(e){return l_(this,null,(function*(){return __({lastChanged:e,user:this.realtimeClient.internalSubscribe(["users",this.participantData.id]),data:this.participantData})}))}refetch(e){throw"Do not call refetch on participant data stores, it can return outdated data. Destroy and remake them instead"}equal(e,t){var n,r,i,s;return(null==(r=null==(n=e.user)?void 0:n.store)?void 0:r.userId)===(null==(s=null==(i=t.user)?void 0:i.store)?void 0:s.userId)&&V_(e.data,t.data)}teardownNested(e){var t;null==(t=e.user)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;const i=null==(r=n.user)?void 0:r.store;return!0===(yield null==i?void 0:i.changedBetween(e,t))}))}loadNested(e,t){return l_(this,null,(function*(){if(null===t.data)return __({snapshot:null});const n=yield t.user.store.getDeep(e);if(!1===n.ok)return n;const r=n.value.snapshot;return __({snapshot:this.realtimeClient.createParticipantSnapshotPreloaded(t.data,r)})}))}participantEdited(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,user:n.value.user,data:{id:n.value.data.id,access:Y_(n.value.data.access,t.diff.access),notify:Y_(n.value.data.notify,t.diff.notify),joinedAt:n.value.data.joinedAt}})))}participantDeleted(e,t){this.mutate(e,(t=>null===t.value.data?t:(this.teardownNested(t.value),__({lastChanged:e,user:null,data:null}))))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok?null===e.value.data?v_({status:404,errorCode:"PARTICIPANT_NOT_FOUND",reasons:["No participant with that ID exists"]}):__({status:200,data:e.value.data}):D_("NOT_IN_CACHE")}))}}class vD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversationId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(e){return l_(this,null,(function*(){const t=yield TD({realtimeClient:this.realtimeClient,conversationId:this.conversationId,count:10});return t.ok?null===t.value.participants?__({lastChanged:e,stores:null,inWindow:null,windowEnd:null}):OD({seq:e,participants:t.value.participants,cursor:t.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):t}))}teardownNested(e){if(e.stores){const t=D_("TERMINATED");Object.values(e.stores).forEach((e=>e.setError(t)))}}anyChildChanged(e,t,n){return l_(this,null,(function*(){for(const r in n.stores){const i=n.stores[r];if(!0===(yield null==i?void 0:i.changedBetween(e,t)))return!0}return!1}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:null,loadedAll:!0});const n=yield Promise.all(Object.values(t.stores).map((t=>t.getDeep(e)))),r=n.find((e=>!e.ok));if(r)return r;const i=n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot));return i.sort(((e,t)=>t.joinedAt-e.joinedAt)),__({snapshot:i,loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreParticipants(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreParticipants(e=10){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield TD({count:e,cursor:n,conversationId:this.conversationId,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.participants?(console.warn("[TalkJS] When loading more participants, the conversation no longer existed. We should have been told about this."),e):OD({seq:i,prevStores:e.value.stores,participants:r.value.participants,cursor:r.value.nextCursor,conversationId:this.conversationId,realtimeClient:this.realtimeClient}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}participantCreated(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'participant.created' event for a nonexistent conversation."),n;if(n.value.windowEnd&&t.state.joinedAt<n.value.windowEnd.oldestParticipantTs)return n;if(Object.hasOwnProperty.call(n.value.stores,t.state.id))return n;const r=o_({},n.value.stores),i=new DD(e,this.conversationId,t.state,this.realtimeClient);return r[t.state.id]=i,__({lastChanged:e,stores:r,windowEnd:n.value.windowEnd})}))}participantEdited(e,t){this.mutate(e,(n=>{var r;return null===n.value.stores?(console.warn("[TalkJS] Received a 'participant.edited' event for a nonexistent conversation."),n):(null==(r=n.value.stores[t.userId])||r.participantEdited(e,t),n)}))}participantDeleted(e,t){this.mutate(e,(n=>{if(null===n.value.stores)return console.warn("[TalkJS] Received a 'participant.deleted' event for a conversation that we thought didn't exist."),n;const r=n.value.stores[t.userId];if(void 0===r)return n;r.participantDeleted(e,t);const i=o_({},n.value.stores);return delete i[t.userId],__({lastChanged:e,stores:i,windowEnd:n.value.windowEnd})}))}sideCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.stores?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.stores?t:(this.teardownNested(t.value),__({lastChanged:e,stores:null,inWindow:null,windowEnd:null}))))}getParticipantFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return D_("NOT_IN_CACHE");const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.getFromCache()}))}}function TD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,conversationId:n,count:r}){const i={limit:r,cursor:e},s=yield t.call("GET",["me","conversations",n,"participants"],i,{bypassCache:!0});if(s.ok){const{data:e,cursor:t}=s.value.data;return __({participants:e,nextCursor:t})}return!s.ok&&"server"===s.where&&404===s.value.status||!s.ok&&"server"===s.where&&403===s.value.status&&"NOT_A_PARTICIPANT"===s.value.errorCode?__({participants:null,nextCursor:null}):s}))}function OD({seq:e,prevStores:t,participants:n,cursor:r,conversationId:i,realtimeClient:s}){const o=t?o_({},t):{};for(const a of n)if(void 0===o[a.id]){const t=new DD(e,i,a,s);o[a.id]=t}return __(null===r?{lastChanged:e,stores:o,windowEnd:null}:{lastChanged:e,stores:o,windowEnd:{cursor:r,oldestParticipantTs:n[n.length-1].joinedAt}})}class SD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.getConvDataStore=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3,this.pendingLoadMore=void 0}fetchInitial(e){return l_(this,null,(function*(){const t=yield CD({realtimeClient:this.realtimeClient,count:20});return t.ok?null===t.value.conversations?__({lastChanged:e,stores:null,windowEnd:null}):yD({seq:e,conversations:t.value.conversations,cursor:t.value.nextCursor,getConvDataStore:this.getConvDataStore}):t}))}teardownNested(e){null!==e.stores&&Object.values(e.stores).forEach((e=>e.unsubscribe()))}anyChildChanged(e,t,n){return l_(this,null,(function*(){var r;for(const i in n.stores){const s=n.stores[i];if(!0===(yield null==(r=null==s?void 0:s.store)?void 0:r.changedBetween(e,t)))return!0}return!1}))}equal(e,t){return null===e.stores&&null===t.stores||null!==e.stores&&null!==t.stores&&!!V_(Object.keys(e.stores),Object.keys(t.stores))&&V_(e.windowEnd,t.windowEnd)}loadNested(e,t){return l_(this,null,(function*(){if(null===t.stores)return __({snapshot:[],loadedAll:!0});const n=yield Promise.all(Object.values(t.stores).map((t=>t.store.getDeep(e)))),r=n.find((e=>!e.ok));if(r)return r;const i=n.filter((e=>null!==e.value.snapshot)).map((e=>e.value.snapshot));return i.sort(((e,t)=>{var n,r,i,s;const o=null!=(r=null==(n=e.lastMessage)?void 0:n.createdAt)?r:e.joinedAt;return(null!=(s=null==(i=t.lastMessage)?void 0:i.createdAt)?s:t.joinedAt)-o})),__({snapshot:i,loadedAll:null===t.windowEnd})}))}loadMore(e){return l_(this,null,(function*(){if(this.pendingLoadMore)return this.pendingLoadMore;const t=g_();this.pendingLoadMore=t.promise,yield this._loadMoreConversations(e),t.resolve(),this.pendingLoadMore=void 0}))}_loadMoreConversations(e=20){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return;if(null===t.value.windowEnd)return;const n=t.value.windowEnd.cursor,r=yield CD({count:e,cursor:n,realtimeClient:this.realtimeClient}),i=this.getLoadMoreSeq();this.mutate(i,(e=>null===e.value.windowEnd||n!==e.value.windowEnd.cursor?e:r.ok?null===r.value.conversations?(console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."),e):yD({seq:i,prevStores:e.value.stores,conversations:r.value.conversations,cursor:r.value.nextCursor,getConvDataStore:this.getConvDataStore}):r)),yield this.emitMutex.runExclusive((()=>this.emit(i)))}))}getConvFromCache(e){return l_(this,null,(function*(){const t=yield this.mostRecentState.resultPromise;if(!t.ok)return D_("NOT_IN_CACHE");if(null===t.value.stores)return v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const n=t.value.stores[e];return void 0===n?D_("NOT_IN_CACHE"):n.store.getFromCache()}))}userCreated(e,t){this.mutate(e,(e=>null!==e.value.stores?e:__({lastChanged:e.value.lastChanged,stores:{},windowEnd:null})))}sideCreated(e,t){const n=this.getConvDataStore(t.state);this.mutate(e,(r=>Object.hasOwnProperty.call(r.value.stores,t.conversationId)?(n.unsubscribe(),r):__({lastChanged:e,stores:a_(o_({},r.value.stores),{[t.conversationId]:n}),windowEnd:r.value.windowEnd})))}sideDeleted(e,t){this.mutate(e,(n=>{var r;if(!Object.hasOwnProperty.call(n.value.stores,t.conversationId))return n;const i=o_({},n.value.stores);return null==(r=i[t.conversationId])||r.unsubscribe(),delete i[t.conversationId],__({lastChanged:e,stores:i,windowEnd:n.value.windowEnd})}))}sideEdited(e,t){const n=t.diff.lastMessageAt;void 0!==n&&this.mutate(e,(r=>{var i;if(null===r.value.stores)return console.warn("[TalkJS] Received a 'side.edited' event when we thought your user didn't exist."),r;if(null===r.value.windowEnd)return r;const s=Object.hasOwnProperty.call(r.value.stores,t.conversationId);if(s&&n<r.value.windowEnd.oldestMessageTs){const n=o_({},r.value.stores);return null==(i=n[t.conversationId])||i.unsubscribe(),delete n[t.conversationId],__({lastChanged:e,stores:n,windowEnd:r.value.windowEnd})}if(!s&&n>=r.value.windowEnd.oldestMessageTs){const n=this.getConvDataStore(t.conversationId);return __({lastChanged:e,stores:a_(o_({},r.value.stores),{[t.conversationId]:n}),windowEnd:r.value.windowEnd})}return r}))}}function CD(e){return l_(this,arguments,(function*({cursor:e,realtimeClient:t,count:n}){const r={limit:n,cursor:e},i=yield t.call("GET",["me","conversations"],r,{bypassCache:!0});if(i.ok){const{data:e,cursor:t}=i.value.data;return __({conversations:e,nextCursor:t})}return i.ok||"server"!==i.where||404!==i.value.status||"USER_NOT_FOUND"!==i.value.errorCode?i:__({conversations:null,nextCursor:null})}))}function yD({seq:e,prevStores:t,conversations:n,cursor:r,getConvDataStore:i}){const s=t?o_({},t):{};for(const o of n)void 0===s[o.id]&&(s[o.id]=i(o));return __(null===r?{lastChanged:e,stores:s,windowEnd:null}:{lastChanged:e,stores:s,windowEnd:{cursor:r,oldestMessageTs:Math.min(...n.map((e=>e.lastMessageAt)))}})}class ND extends q_{constructor(e,t,n,r,i){super(e,r,i),this.conversation=t,this.realtimeClient=n,this.unsubscribeDebounceMs=5e3}get conversationId(){return"string"==typeof this.conversation?this.conversation:this.conversation.id}fetchInitial(e){return l_(this,null,(function*(){const t=this.realtimeClient.internalSubscribe(["me","conversations",this.conversationId,"messages"]);if("object"==typeof this.conversation)return __({lastChanged:e,snapshot:this.conversation,messageWindowStore:t});const n=yield this.realtimeClient.call("GET",["me","conversations",this.conversationId],{},{bypassCache:!0});let r;if(n.ok)r=n.value.data;else if("server"===n.where&&404===n.value.status)r=null;else{if("server"!==n.where||403!==n.value.status||"NOT_A_PARTICIPANT"!==n.value.errorCode)return t.unsubscribe(),n;r=null}return __({lastChanged:e,snapshot:r,messageWindowStore:t})}))}teardownNested(e){var t;null==(t=e.messageWindowStore)||t.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return!0===(yield n.messageWindowStore.store.lastMessageChangedBetween(e,t))}))}equal(e,t){return V_(e.snapshot,t.snapshot)}loadNested(e,t){return l_(this,null,(function*(){var n;if(!t.snapshot)return __({snapshot:null,loadedAll:!0});const r=yield t.messageWindowStore.store.getDeep(e);if(!r.ok)return r;const i=r.value.snapshot,s=null!=(n=null==i?void 0:i[0])?n:null;return __({snapshot:a_(o_({},t.snapshot),{lastMessage:s})})}))}participantEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}conversationEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}sideEdited(e,t){this.mutate(e,(n=>null===n.value.snapshot?(console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."),n):__({lastChanged:e,snapshot:ID(n.value.snapshot,t.diff),messageWindowStore:n.value.messageWindowStore})))}sideCreated(e,t){this.mutate(e,(n=>n.value.snapshot?n:__({lastChanged:e,snapshot:t.state,messageWindowStore:n.value.messageWindowStore})))}sideDeleted(e,t){this.mutate(e,(t=>null===t.value.snapshot?t:__({lastChanged:e,snapshot:null,messageWindowStore:t.value.messageWindowStore})))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;return e.ok&&e.value.snapshot?__({status:200,data:e.value.snapshot}):D_("NOT_IN_CACHE")}))}}function ID(e,t){const n=t;return{id:e.id,createdAt:e.createdAt,subject:Y_(e.subject,n.subject),photoUrl:Y_(e.photoUrl,n.photoUrl),welcomeMessages:Y_(e.welcomeMessages,n.welcomeMessages),custom:z_(e.custom,n.custom),lastMessageAt:Y_(e.lastMessageAt,n.lastMessageAt),unreadMessageCount:Y_(e.unreadMessageCount,n.unreadMessageCount),isUnread:Y_(e.isUnread,n.isUnread),access:Y_(e.access,n.access),notify:Y_(e.notify,n.notify),readUntil:Y_(e.readUntil,n.readUntil),everyoneReadUntil:Y_(e.everyoneReadUntil,n.everyoneReadUntil),joinedAt:e.joinedAt}}class bD extends q_{constructor(e,t,n,r,i){super(e,r,i),this.userId=t,this.realtimeClient=n,this.unsubscribeDebounceMs=1e3}fetchInitial(e){return l_(this,null,(function*(){const t=this.realtimeClient.internalSubscribe(["users",this.userId]),n=yield this.realtimeClient.call("GET",["users",this.userId,"online"],{},{bypassCache:!0});return n.ok||"server"!==n.where||404!==n.value.status||"USER_NOT_FOUND"!==n.value.errorCode?n.ok?__({lastChanged:e,user:t,data:n.value.data}):n:__({lastChanged:e,user:t,data:null})}))}equal(e,t){return V_(e.data,t.data)}teardownNested(e){e.user.unsubscribe()}anyChildChanged(e,t,n){return l_(this,null,(function*(){return n.user.store.changedBetween(e,t)}))}loadNested(e,t){return l_(this,null,(function*(){const n=yield t.user.store.getDeep(e);if(!n.ok)return n;const r=n.value.snapshot;return null===t.data||null===r?__({snapshot:null}):__({snapshot:o_({user:r},t.data)})}))}userCreated(e,t){const n=this.fetchInitial(e);this.mutate(e,(e=>null!==e.value.data?(n.then((e=>{e.ok&&this.teardownNested(e.value)})),e):n))}userOnlineChanged(e,t){this.mutate(e,(n=>null===n.value.data?n:__({lastChanged:e,user:n.value.user,data:t.diff})))}getFromCache(){return l_(this,null,(function*(){const e=yield this.mostRecentState.resultPromise;if(!e.ok)return D_("NOT_IN_CACHE");if(null===e.value.data)return v_({status:404,errorCode:"USER_NOT_FOUND",reasons:["No user with that ID exists"]});const t=e.value,n=u_(t,["user"]);return __({status:200,data:o_({},n.data)})}))}}class RD{constructor(e,t,n){this.realtimeClient=n,this.convDataStores={},this.storeMap={},this.emitMutex=new G_,this.seqOffset=0,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss=!0,this.connection=new j_(e,t,{onUpstreamRestarting:()=>{this.refetchOnNextNetworkLoss=!1},onReady:()=>{this.refetchOnNextNetworkLoss=!0},onResubscribeSent:()=>{if(this.seqOffset+=this.seq,this.seqInThisConnection=0,this.refetchOnNextNetworkLoss){this.seqOffset++;const e=this.seq;this.refetchAll(e),this.emitAll(e)}},onResubscribeError:(e,t)=>{var n;null==(n=this.storeMap[wD(e)])||n.setError(t)},onPublish:(e,t)=>{this.seqInThisConnection=e;const n=this.seq;for(const r of t)this.handlePublish(n,r);this.emitAll(n)}})}get seq(){return this.seqOffset+this.seqInThisConnection}refetchAll(e){Object.values(this.storeMap).forEach((t=>null==t?void 0:t.refetch(e)))}emitAll(e){return this.emitMutex.runExclusive((()=>l_(this,null,(function*(){const t=Object.values(this.storeMap).map((t=>null==t?void 0:t.emit(e)));yield Promise.all(t)}))))}handlePublish(e,t){var n,r,i,s,o,a,u,l,c,h,d,p,f,m,E,g,A,_,D,v,T,O,S,C,y,N,I;switch(t.type){case"user.created":return null==(n=this.storeMap[`/users/${t.userId}`])||n.userCreated(e,t),null==(r=this.storeMap["/me/conversations"])||r.userCreated(e,t),void(null==(i=this.storeMap[`/users/${t.userId}/online`])||i.userCreated(e,t));case"user.edited":return void(null==(s=this.storeMap[`/users/${t.userId}`])||s.userEdited(e,t));case"side.created":return null==(o=this.convDataStores[t.conversationId])||o.sideCreated(e,t),null==(a=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||a.sideCreated(e,t),null==(u=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||u.sideCreated(e,t),void(null==(l=this.storeMap["/me/conversations"])||l.sideCreated(e,t));case"side.edited":return null==(c=this.convDataStores[t.conversationId])||c.sideEdited(e,t),void(null==(h=this.storeMap["/me/conversations"])||h.sideEdited(e,t));case"side.deleted":return null==(d=this.convDataStores[t.conversationId])||d.sideDeleted(e,t),null==(p=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||p.sideDeleted(e,t),null==(f=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||f.sideDeleted(e,t),null==(m=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||m.sideDeleted(e,t),void(null==(E=this.storeMap["/me/conversations"])||E.sideDeleted(e,t));case"conversation.edited":return void(null==(g=this.convDataStores[t.conversationId])||g.conversationEdited(e,t));case"message.created":return void(null==(A=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||A.messageCreated(e,t));case"message.edited":return void(null==(_=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||_.messageEdited(e,t));case"message.deleted":return void(null==(D=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||D.messageDeleted(e,t));case"typing.available":return void(null==(v=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||v.typingAvailable(e,t));case"typing.changed":return void(null==(T=this.storeMap[`/me/conversations/${t.conversationId}/typing`])||T.typingChanged(e,t));case"conversation.cleared":return void(null==(O=this.storeMap[`/me/conversations/${t.conversationId}/messages`])||O.conversationCleared(e,t));case"participant.edited":return null==(S=this.convDataStores[t.conversationId])||S.participantEdited(e,t),void(null==(C=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||C.participantEdited(e,t));case"participant.created":return void(null==(y=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||y.participantCreated(e,t));case"participant.deleted":return void(null==(N=this.storeMap[`/me/conversations/${t.conversationId}/participants`])||N.participantDeleted(e,t));case"user.online.changed":return void(null==(I=this.storeMap[`/users/${t.userId}/online`])||I.userOnlineChanged(e,t))}}call(e,t,n,r){return l_(this,null,(function*(){if(!r.bypassCache&&"GET"===e){const e=wD(t);if(e in this.storeMap){const t=e,n=this.storeMap[t];if(n&&"getFromCache"in n){const e=yield n.getFromCache();if("NOT_IN_CACHE"!==e.value)return e}}else if(d_(t,["me","conversations","*","messages","*"])){const e=this.storeMap[`/me/conversations/${t[2]}/messages`];if(e){const n=yield e.getMessageFromCache(t[4]);if("NOT_IN_CACHE"!==n.value)return n}}else if(d_(t,["me","conversations","*","participants","*"])){const e=this.storeMap[`/me/conversations/${t[2]}/participants`];if(e){const n=yield e.getParticipantFromCache(t[4]);if("NOT_IN_CACHE"!==n.value)return n}}else if(d_(t,["me","conversations","*"])){const e=this.storeMap["/me/conversations"];if(e){const n=yield e.getConvFromCache(t[2]);if("NOT_IN_CACHE"!==n.value)return n}}}return this.connection.call(e,t,n)}))}subscribe(e,t){const n=this.getOrCreateStore(e),r=g_(),i=g_();r.promise.catch((()=>{})),i.promise.catch((()=>{}));const s={state:{type:"pending",latestSnapshot:void 0},connected:r.promise,terminated:i.promise,loadMore:e=>l_(this,null,(function*(){"loadMore"in n&&(yield n.loadMore(e))})),unsubscribe:()=>{}},o=n.listen((n=>{if(n.ok){const e=!("loadedAll"in n.value)||n.value.loadedAll,i={type:"active",latestSnapshot:n.value.snapshot,loadedAll:e};s.state=i,null==t||t(n.value.snapshot,e),r.resolve(i)}else if("pending"===s.state.type||"active"===s.state.type){if("server"===n.where){const t={type:"error",error:new Error(h_(`Subscribe to ${e.join("/")}`,n.value))};return s.state=t,i.resolve(t),void r.reject("Subscription encountered an error during initial connection")}if("SESSION_DESTROYED"===n.value){const e={type:"error",error:new Error("Session was destroyed causing all subscriptions to be terminated")};return s.state=e,i.resolve(e),void r.reject("Subscription encountered an error during initial connection")}if("UNSUBSCRIBED"===n.value)return;if("TERMINATED"===n.value)return;n.value}}));return s.unsubscribe=()=>{if("pending"===s.state.type||"active"===s.state.type){o();const e={type:"unsubscribed"};s.state=e,i.resolve(e),r.reject("Subscription was unsubscribed before connecting")}},s}getOrCreateStore(e){const t=wD(e);if(t in this.storeMap)return this.storeMap[t];this.connection.subscribe(e).then((e=>{e.ok||n.setError(e)}));const n=this.instantiateStore(e,(()=>{delete this.storeMap[t],this.connection.unsubscribe(e)}));return this.storeMap[t]=n,n}destroy(){this.storeMap={},this.convDataStores={},this.connection.destroy()}isConnected(){return this.connection.isConnected()}instantiateStore(e,t){if(d_(e,["users","*"]))return new Z_(this.seq,e[1],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*"]))return new ED(this.seq,this.subscribeConvData(e[2]),this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","messages"]))return new pD(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","participants"]))return new vD(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations","*","typing"]))return new _D(this.seq,e[2],this.realtimeClient,this.emitMutex,t);if(d_(e,["me","conversations"]))return new SD(this.seq,(e=>this.subscribeConvData(e)),this.realtimeClient,this.emitMutex,t);if(d_(e,["users","*","online"]))return new bD(this.seq,e[1],this.realtimeClient,this.emitMutex,t);throw"Unreachable"}subscribeConvData(e){const t="string"==typeof e?e:e.id;if(Object.hasOwnProperty.call(this.convDataStores,t)){const e=this.convDataStores[t];return{store:e,unsubscribe:e.registerInternalSubscription()}}const n=new ND(this.seq,e,this.realtimeClient,this.emitMutex,(()=>{delete this.convDataStores[t]}));return this.convDataStores[t]=n,{store:n,unsubscribe:n.registerInternalSubscription()}}}function wD(e){return`/${e.join("/")}`}class kD{constructor(e,t,n){this.userId=t,this.alive=!0,this.connection=new RD(e,n,this),n.onTokenRefreshFailed((()=>{this.destroy()}))}call(e,t,n){return l_(this,arguments,(function*(e,t,n,r={}){return this.alive?this.connection.call(e,t,n,r):D_("SESSION_DESTROYED")}))}subscribe(e,t){return this.connection.subscribe(e,t)}internalSubscribe(e){const t=this.connection.getOrCreateStore(e);return{store:t,unsubscribe:t.registerInternalSubscription()}}destroy(){this.alive=!1,this.connection.destroy()}isConnected(){return this.connection.isConnected()}listMessages(e,t){return l_(this,null,(function*(){const n=yield this.call("GET",["me","conversations",e,"messages"],t);if(!n.ok)return LD(n,"Listing messages in "+e);const r=n.value.data.data,i=yield Promise.all(r.map((t=>this.createMessageSnapshot(t,e)))),s=i.find((e=>!e.ok));return void 0===s||s.ok?__(i.map((({value:e})=>e))):s}))}createConversationSnapshotPreloaded(e,t){return{id:e.id,subject:e.subject,photoUrl:e.photoUrl,welcomeMessages:e.welcomeMessages,custom:e.custom,createdAt:e.createdAt,joinedAt:e.joinedAt,lastMessageAt:e.lastMessageAt,unreadMessageCount:e.unreadMessageCount,isUnread:e.isUnread,access:e.access,notify:e.notify,lastMessage:t,readUntil:e.readUntil,everyoneReadUntil:e.everyoneReadUntil}}createUserSnapshot(e){return{id:e.id,name:e.name,custom:e.custom,locale:e.locale,photoUrl:e.photoUrl,role:e.role,welcomeMessage:e.welcomeMessage}}createParticipantSnapshotPreloaded(e,t){return{user:t,access:e.access,notify:e.notify,joinedAt:e.joinedAt}}createMessageSnapshot(e,t){return l_(this,null,(function*(){const n=null===e.senderId?Promise.resolve(__(null)):this.getUser(e.senderId),r=null===e.referencedMessageId?Promise.resolve(__(null)):this.getReferencedMessage(t,e.referencedMessageId),i=yield n;if(!i.ok)return i;const s=yield r;return s.ok?__(this.createMessageSnapshotPreloaded(e,i.value,s.value)):s}))}getReferencedMessage(e,t){return l_(this,null,(function*(){const n=yield this.call("GET",["me","conversations",e,"messages",t],{});if(!n.ok&&"server"===n.where&&404===n.value.status)return __(null);if(!n.ok&&"server"===n.where&&403===n.value.status&&"NOT_A_PARTICIPANT"===n.value.errorCode)return __(null);if(!n.ok)return LD(n,`Fetching referenced message ${t} in conversation ${e}`);const r=n.value.data,i=yield this.getUser(r.senderId);if(!i.ok)return i;const s=i.value;return __(this.createReferencedMessageSnapshotPreloaded(r,s))}))}getUser(e){return l_(this,null,(function*(){const t=yield this.call("GET",["users",e],{includePrivateFields:!1});return t.ok||"server"!==t.where||404!==t.value.status?t.ok?__(this.createUserSnapshot(t.value.data)):LD(t,"Get user "+e):__(null)}))}createMessageSnapshotPreloaded(e,t,n){return{id:e.id,type:e.type,sender:t,referencedMessage:n,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,origin:e.origin,content:e.content,plaintext:lD(e.content,{})}}createReferencedMessageSnapshotPreloaded(e,t){return{id:e.id,type:e.type,sender:t,referencedMessageId:e.referencedMessageId,custom:e.custom,createdAt:e.createdAt,editedAt:e.editedAt,origin:e.origin,content:e.content,plaintext:lD(e.content,{})}}}function LD(e,t){return"server"===e.where?v_(a_(o_({},e.value),{operation:t})):e}function MD(e,t){var n;if(t.ok)return t.value;throw"SESSION_DESTROYED"===t.value?new Error(`${e} failed because the session was destroyed`):new Error(h_(null!=(n=t.value.operation)?n:e,t.value))}class FD{constructor(e,t){this.id=e,this._realtimeClient=t}get brandedId(){return this.id}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.getUser(this.brandedId);return MD("Get user "+this.id,e)}))}set(e){return l_(this,null,(function*(){null===e.role&&(e.role="default");const t="string"==typeof e.email?[e.email]:e.email,n="string"==typeof e.phone?[e.phone]:e.phone,r=yield this._realtimeClient.call("PUT",["users",this.brandedId],a_(o_({},e),{email:t,phone:n}));c_("Set user "+this.id,r)}))}createIfNotExists(e){return l_(this,null,(function*(){void 0===e.role&&(e.role="default");const t="string"==typeof e.email?[e.email]:e.email,n="string"==typeof e.phone?[e.phone]:e.phone,r=yield this._realtimeClient.call("POST",["users",this.brandedId],a_(o_({},e),{email:t,phone:n}));(r.ok||"server"!==r.where||409!=r.value.status)&&c_(`Create user ${this.id} if not exists`,r)}))}subscribe(e){return this._realtimeClient.subscribe(["users",this.brandedId],e)}subscribeOnline(e){return this._realtimeClient.subscribe(["users",this.brandedId,"online"],e)}}class xD{constructor(e,t,n){this.userId=e,this.conversationId=t,this._realtimeClient=n}get brandedUserId(){return this.userId}get brandedConversationId(){return this.conversationId}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"participants",this.brandedUserId],{}),t=yield this._realtimeClient.call("GET",["users",this.brandedUserId],{includePrivateFields:!1}),[n,r]=yield Promise.all([e,t]);if(!n.ok&&"server"===n.where&&404===n.value.status)return null;if(!r.ok&&"server"===r.where&&404===r.value.status)return null;const i=c_(`Get participant ${this.userId} in conversation ${this.conversationId}`,n),s=c_(`Get user ${this.userId}`,r),o=this._realtimeClient.createUserSnapshot(s);return this._realtimeClient.createParticipantSnapshotPreloaded(i,o)}))}set(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("PUT",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);c_(`Set participant ${this.userId} in conversation ${this.conversationId}`,t)}))}edit(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);c_(`Edit participant ${this.userId} in conversation ${this.conversationId}`,t)}))}createIfNotExists(){return l_(this,arguments,(function*(e={}){const t=yield this._realtimeClient.call("POST",["conversations",this.brandedConversationId,"participants",this.brandedUserId],e);(t.ok||"server"!==t.where||409!==t.value.status)&&c_(`Add participant ${this.userId} to conversation ${this.conversationId}`,t)}))}delete(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"participants",this.brandedUserId],{});(e.ok||"server"!==e.where||404!==e.value.status)&&c_(`Remove participant ${this.userId} from conversation ${this.conversationId}`,e)}))}}function BD(e){const t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";let n=0;const r=[],i=e===n;n=e;const s=new Array(8);for(let a=7;a>=0;a--)s[a]=t.charAt(e%64),e=Math.floor(e/64);if(0!==e)throw new Error("We should have converted the entire timestamp.");let o=s.join("");if(i){let e;for(e=11;e>=0&&63===r[e];e--)r[e]=0;r[e]++}else for(let a=0;a<12;a++)r[a]=Math.floor(64*Math.random());for(let a=0;a<12;a++)o+=t.charAt(r[a]);if(20!=o.length)throw new Error("Length should be 20.");return o}const PD=(e,t,n=void 0)=>e.reduce(((e,r,i)=>e.concat((e=>{if("string"==typeof e)return t(e,n);switch(e.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:e.type,children:PD(e.children,t,e.type)}];case"link":return[{type:e.type,url:e.url,children:PD(e.children,t,e.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:e.type,action:e.action,params:e.params,children:PD(e.children,t,e.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[e]}})(r))),[]);function UD(e,t){return n=>{const r=n;let i=0;const s=[];for(const o of tD(n,e)){o.index-i>0&&s.push(r.substring(i,o.index));const e=t(o);Array.isArray(e)?s.push(...e):s.push(e),i=o.index+o[0].length}return i<n.length&&s.push(n.substring(i)),s}}const HD="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var $D,jD=(($D=jD||{})[$D.italic=1]="italic",$D[$D.strikethrough=2]="strikethrough",$D[$D.bold=4]="bold",$D);const YD=[0,1,2,3,4,5,6].map((e=>{const t=[];return 1&e||t.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&e||t.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&e||t.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(t.map((e=>e.source)).join("|"),"g")})),zD={_:1,"*":4,"~":2};function VD(e){return GD(e,0)}function GD(e,t=0){const n=YD[t],r=n?function(e){const t=UD(WD.getOrCompute(e,(()=>new RegExp(`(?:^|[\\s${HD}])(?:${e.source})(?=[\\s${HD}]|$)`,"g"))),(e=>{const t=e[0][1],n=e[1]||e[2]||e[3]||e[4]||e[5]||e[6];return[" ",{type:jD[zD[t]],children:[n]}]}));return e=>{const[n,...r]=t(" "+e);return n.length>1&&r.unshift(n.substring(1)),r}}(n):()=>[e];return PD(r(e),((e,n)=>"bold"===n||"italic"===n||"strikethrough"===n?GD(e,t|jD[n]):[e]))}const WD=function(){const e=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(t,n){if(e.has(t))return e.get(t);const r=n();return e.set(t,r),r}}}();function XD(e,t){if(Array.prototype.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function KD(e,t){for(var n=e.length-1;n>=0;n--)!0===t(e[n])&&e.splice(n,1)}function qD(e){throw new Error("Unhandled case for value: '"+e+"'")}var JD=function(){function e(e){void 0===e&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.whitespaceRegex=/\s+/,this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return e.prototype.setTagName=function(e){return this.tagName=e,this},e.prototype.getTagName=function(){return this.tagName||""},e.prototype.setAttr=function(e,t){return this.getAttrs()[e]=t,this},e.prototype.getAttr=function(e){return this.getAttrs()[e]},e.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},e.prototype.getAttrs=function(){return this.attrs||(this.attrs={})},e.prototype.setClass=function(e){return this.setAttr("class",e)},e.prototype.addClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);t=s.shift();)-1===XD(i,t)&&i.push(t);return this.getAttrs().class=i.join(" "),this},e.prototype.removeClass=function(e){for(var t,n=this.getClass(),r=this.whitespaceRegex,i=n?n.split(r):[],s=e.split(r);i.length&&(t=s.shift());){var o=XD(i,t);-1!==o&&i.splice(o,1)}return this.getAttrs().class=i.join(" "),this},e.prototype.getClass=function(){return this.getAttrs().class||""},e.prototype.hasClass=function(e){return-1!==(" "+this.getClass()+" ").indexOf(" "+e+" ")},e.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},e.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},e.prototype.getInnerHTML=function(){return this.innerHTML||""},e.prototype.getInnerHtml=function(){return this.getInnerHTML()},e.prototype.toAnchorString=function(){var e=this.getTagName(),t=this.buildAttrsStr();return["<",e,t=t?" "+t:"",">",this.getInnerHtml(),"</",e,">"].join("")},e.prototype.buildAttrsStr=function(){if(!this.attrs)return"";var e=this.getAttrs(),t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n+'="'+e[n]+'"');return t.join(" ")},e}(),ZD=function(){function e(e){void 0===e&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return e.prototype.build=function(e){return new JD({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},e.prototype.createAttrs=function(e){var t={href:e.getAnchorHref()},n=this.createCssClass(e);return n&&(t.class=n),this.newWindow&&(t.target="_blank",t.rel="noopener noreferrer"),this.truncate&&this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(t.title=e.getAnchorHref()),t},e.prototype.createCssClass=function(e){var t=this.className;if(t){for(var n=[t],r=e.getCssClassSuffixes(),i=0,s=r.length;i<s;i++)n.push(t+"-"+r[i]);return n.join(" ")}return""},e.prototype.processAnchorText=function(e){return this.doTruncate(e)},e.prototype.doTruncate=function(e){var t=this.truncate;if(!t||!t.length)return e;var n,r,i,s,o=t.length,a=t.location;return"smart"===a?function(e,t,n){var r,i;null==n?(n="&hellip;",i=3,r=8):(i=n.length,r=n.length);var s=function(e){var t="";return e.scheme&&e.host&&(t+=e.scheme+"://"),e.host&&(t+=e.host),e.path&&(t+="/"+e.path),e.query&&(t+="?"+e.query),e.fragment&&(t+="#"+e.fragment),t},o=function(e,t){var r=t/2,i=Math.ceil(r),s=-1*Math.floor(r),o="";return s<0&&(o=e.substr(s)),e.substr(0,i)+n+o};if(e.length<=t)return e;var a,u,l,c=t-i,h=(a={},(l=(u=e).match(/^([a-z]+):\/\//i))&&(a.scheme=l[1],u=u.substr(l[0].length)),(l=u.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(a.host=l[1],u=u.substr(l[0].length)),(l=u.match(/^\/(.*?)(?=(\?|#|$))/i))&&(a.path=l[1],u=u.substr(l[0].length)),(l=u.match(/^\?(.*?)(?=(#|$))/i))&&(a.query=l[1],u=u.substr(l[0].length)),(l=u.match(/^#(.*?)$/i))&&(a.fragment=l[1]),a);if(h.query){var d=h.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);d&&(h.query=h.query.substr(0,d[1].length),e=s(h))}if(e.length<=t)return e;if(h.host&&(h.host=h.host.replace(/^www\./,""),e=s(h)),e.length<=t)return e;var p="";if(h.host&&(p+=h.host),p.length>=c)return h.host.length==t?(h.host.substr(0,t-i)+n).substr(0,c+r):o(p,c).substr(0,c+r);var f="";if(h.path&&(f+="/"+h.path),h.query&&(f+="?"+h.query),f){if((p+f).length>=c)return(p+f).length==t?(p+f).substr(0,t):(p+o(f,c-p.length)).substr(0,c+r);p+=f}if(h.fragment){var m="#"+h.fragment;if((p+m).length>=c)return(p+m).length==t?(p+m).substr(0,t):(p+o(m,c-p.length)).substr(0,c+r);p+=m}if(h.scheme&&h.host){var E=h.scheme+"://";if((p+E).length<c)return(E+p).substr(0,t)}if(p.length<=t)return p;var g="";return c>0&&(g=p.substr(-1*Math.floor(c/2))),(p.substr(0,Math.ceil(c/2))+n+g).substr(0,c+r)}(e,o):"middle"===a?function(e,t,n){if(e.length<=t)return e;var r,i;null==n?(n="&hellip;",r=8,i=3):(r=n.length,i=n.length);var s=t-i,o="";return s>0&&(o=e.substr(-1*Math.floor(s/2))),(e.substr(0,Math.ceil(s/2))+n+o).substr(0,s+r)}(e,o):(r=o,i=void 0,(n=e).length>r&&(null==i?(i="&hellip;",s=3):s=i.length,n=n.substring(0,r-s)+i),n)},e}(),QD=function(){function e(e){this.__jsduckDummyDocProp=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return e.prototype.getMatchedText=function(){return this.matchedText},e.prototype.setOffset=function(e){this.offset=e},e.prototype.getOffset=function(){return this.offset},e.prototype.getCssClassSuffixes=function(){return[this.getType()]},e.prototype.buildTag=function(){return this.tagBuilder.build(this)},e}(),ev=function(e,t){return(ev=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function tv(e,t){function n(){this.constructor=e}ev(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var nv,rv=function(){return rv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},rv.apply(this,arguments)},iv=function(e){function t(t){var n=e.call(this,t)||this;return n.email="",n.email=t.email,n}return tv(t,e),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}(QD),sv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="",n.hashtag="",n.serviceName=t.serviceName,n.hashtag=t.hashtag,n}return tv(t,e),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,t=this.hashtag;switch(e){case"twitter":return"https://twitter.com/hashtag/"+t;case"facebook":return"https://www.facebook.com/hashtag/"+t;case"instagram":return"https://instagram.com/explore/tags/"+t;default:throw new Error("Unknown service name to point hashtag to: "+e)}},t.prototype.getAnchorText=function(){return"#"+this.hashtag},t}(QD),ov=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.mention="",n.mention=t.mention,n.serviceName=t.serviceName,n}return tv(t,e),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 t=e.prototype.getCssClassSuffixes.call(this),n=this.getServiceName();return n&&t.push(n),t},t}(QD),av=function(e){function t(t){var n=e.call(this,t)||this;return n.number="",n.plusSign=!1,n.number=t.number,n.plusSign=t.plusSign,n}return tv(t,e),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}(QD),uv=function(e){function t(t){var n=e.call(this,t)||this;return n.url="",n.urlMatchType="scheme",n.protocolUrlMatch=!1,n.protocolRelativeMatch=!1,n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.schemePrefixRegex=/^(https?:\/\/)?/i,n.wwwPrefixRegex=/^(https?:\/\/)?(www\.)?/i,n.protocolRelativeRegex=/^\/\//,n.protocolPrepended=!1,n.urlMatchType=t.urlMatchType,n.url=t.url,n.protocolUrlMatch=t.protocolUrlMatch,n.protocolRelativeMatch=t.protocolRelativeMatch,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return tv(t,e),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 t=e.replace(/%22/gi,"&quot;").replace(/%26/gi,"&amp;").replace(/%27/gi,"&#39;").replace(/%3C/gi,"&lt;").replace(/%3E/gi,"&gt;");try{return decodeURIComponent(t)}catch(e){return t}},t}(QD),lv=function(e){this.__jsduckDummyDocProp=null,this.tagBuilder=e.tagBuilder},cv=/[A-Za-z]/,hv=/[\d]/,dv=/[\D]/,pv=/\s/,fv=/['"]/,mv=/[\x00-\x1F\x7F]/,Ev=/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,gv=Ev+/\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,Av=/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,_v=gv+Av,Dv=gv+Av,vv="(?:["+Av+"]{1,3}\\.){3}["+Av+"]{1,3}",Tv="["+Dv+"](?:["+Dv+"\\-]{0,61}["+Dv+"])?",Ov=function(e){return"(?=("+Tv+"))\\"+e},Sv=function(e){return"(?:"+Ov(e)+"(?:\\."+Ov(e+1)+"){0,126}|"+vv+")"},Cv=new RegExp("["+Dv+"]"),yv=/(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/,Nv=new RegExp("["+Dv+"!#$%&'*+/=?^_`{|}~-]"),Iv=new RegExp("^"+yv.source+"$"),bv=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.localPartCharRegex=Nv,t.strictTldRegex=Iv,t}return tv(t,e),t.prototype.parseMatches=function(e){for(var t=this.tagBuilder,n=this.localPartCharRegex,r=this.strictTldRegex,i=[],s=e.length,o=new Rv,a={m:"a",a:"i",i:"l",l:"t",t:"o",o:":"},u=0,l=0,c=o;u<s;){var h=e.charAt(u);switch(l){case 0:"m"===(d=h)?D(1):n.test(d)&&D();break;case 1:p(e.charAt(u-1),h);break;case 2:f(h);break;case 3:m(h);break;case 4:E(h);break;case 5:g(h);break;case 6:A(h);break;case 7:_(h);break;default:qD(l)}u++}var d;return T(),i;function p(e,t){":"===e?n.test(t)?(l=2,c=new Rv(rv(rv({},c),{hasMailtoPrefix:!0}))):v():a[e]===t||(n.test(t)?l=2:"."===t?l=3:"@"===t?l=4:v())}function f(e){"."===e?l=3:"@"===e?l=4:n.test(e)||v()}function m(e){"."===e||"@"===e?v():n.test(e)?l=2:v()}function E(e){Cv.test(e)?l=5:v()}function g(e){"."===e?l=7:"-"===e?l=6:Cv.test(e)||T()}function A(e){"-"===e||"."===e?T():Cv.test(e)?l=5:T()}function _(e){"."===e||"-"===e?T():Cv.test(e)?(l=5,c=new Rv(rv(rv({},c),{hasDomainDot:!0}))):T()}function D(e){void 0===e&&(e=2),l=e,c=new Rv({idx:u})}function v(){l=0,c=o}function T(){if(c.hasDomainDot){var n=e.slice(c.idx,u);/[-.]$/.test(n)&&(n=n.slice(0,-1));var s=c.hasMailtoPrefix?n.slice(7):n;(function(e){var t=(e.split(".").pop()||"").toLowerCase();return r.test(t)})(s)&&i.push(new iv({tagBuilder:t,matchedText:n,offset:c.idx,email:s}))}v()}},t}(lv),Rv=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.hasMailtoPrefix=!!e.hasMailtoPrefix,this.hasDomainDot=!!e.hasDomainDot},wv=function(){function e(){}return e.isValid=function(e,t){return!(t&&!this.isValidUriScheme(t)||this.urlMatchDoesNotHaveProtocolOrDot(e,t)||this.urlMatchDoesNotHaveAtLeastOneWordChar(e,t)&&!this.isValidIpAddress(e)||this.containsMultipleDots(e))},e.isValidIpAddress=function(e){var t=new RegExp(this.hasFullProtocolRegex.source+this.ipRegex.source);return null!==e.match(t)},e.containsMultipleDots=function(e){var t=e;return this.hasFullProtocolRegex.test(e)&&(t=e.split("://")[1]),t.split("/")[0].indexOf("..")>-1},e.isValidUriScheme=function(e){var t=e.match(this.uriSchemeRegex),n=t&&t[0].toLowerCase();return"javascript:"!==n&&"vbscript:"!==n},e.urlMatchDoesNotHaveProtocolOrDot=function(e,t){return!(!e||t&&this.hasFullProtocolRegex.test(t)||-1!==e.indexOf("."))},e.urlMatchDoesNotHaveAtLeastOneWordChar=function(e,t){return!(!e||!t||this.hasFullProtocolRegex.test(t)||this.hasWordCharAfterProtocolRegex.test(e))},e.hasFullProtocolRegex=/^[A-Za-z][-.+A-Za-z0-9]*:\/\//,e.uriSchemeRegex=/^[A-Za-z][-.+A-Za-z0-9]*:/,e.hasWordCharAfterProtocolRegex=new RegExp(":[^\\s]*?["+Ev+"]"),e.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]*)?\/?$/,e}(),kv=(nv=new RegExp("[/?#](?:["+Dv+"\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*["+Dv+"\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"),new RegExp(["(?:","(",/(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source,Sv(2),")","|","(","(//)?",/(?:www\.)/.source,Sv(6),")","|","(","(//)?",Sv(10)+"\\.",yv.source,"(?![-"+_v+"])",")",")","(?::[0-9]+)?","(?:"+nv.source+")?"].join(""),"gi")),Lv=new RegExp("["+Dv+"]"),Mv=function(e){function t(t){var n=e.call(this,t)||this;return n.stripPrefix={scheme:!0,www:!0},n.stripTrailingSlash=!0,n.decodePercentEncoding=!0,n.matcherRegex=kv,n.wordCharRegExp=Lv,n.stripPrefix=t.stripPrefix,n.stripTrailingSlash=t.stripTrailingSlash,n.decodePercentEncoding=t.decodePercentEncoding,n}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.stripPrefix,i=this.stripTrailingSlash,s=this.decodePercentEncoding,o=this.tagBuilder,a=[],u=function(){var n=t[0],u=t[1],c=t[4],h=t[5],d=t[9],p=t.index,f=h||d,m=e.charAt(p-1);if(!wv.isValid(n,u))return"continue";if(p>0&&"@"===m)return"continue";if(p>0&&f&&l.wordCharRegExp.test(m))return"continue";if(/\?$/.test(n)&&(n=n.substr(0,n.length-1)),l.matchHasUnbalancedClosingParen(n))n=n.substr(0,n.length-1);else{var E=l.matchHasInvalidCharAfterTld(n,u);E>-1&&(n=n.substr(0,E))}var g=["http://","https://"].find((function(e){return!!u&&-1!==u.indexOf(e)}));if(g){var A=n.indexOf(g);n=n.substr(A),u=u.substr(A),p+=A}var _=u?"scheme":c?"www":"tld",D=!!u;a.push(new uv({tagBuilder:o,matchedText:n,offset:p,urlMatchType:_,url:n,protocolUrlMatch:D,protocolRelativeMatch:!!f,stripPrefix:r,stripTrailingSlash:i,decodePercentEncoding:s}))},l=this;null!==(t=n.exec(e));)u();return a},t.prototype.matchHasUnbalancedClosingParen=function(e){var t,n=e.charAt(e.length-1);if(")"===n)t="(";else if("]"===n)t="[";else{if("}"!==n)return!1;t="{"}for(var r=0,i=0,s=e.length-1;i<s;i++){var o=e.charAt(i);o===t?r++:o===n&&(r=Math.max(r-1,0))}return 0===r},t.prototype.matchHasInvalidCharAfterTld=function(e,t){if(!e)return-1;var n=0;t&&(n=e.indexOf(":"),e=e.slice(n));var r=new RegExp("^((.?//)?[-."+Dv+"]*[-"+Dv+"]\\.[-"+Dv+"]+)").exec(e);return null===r?-1:(n+=r[1].length,e=e.slice(r[1].length),/^[^-.A-Za-z0-9:\/?#]/.test(e)?n:-1)},t}(lv),Fv=new RegExp("#[_"+Dv+"]{1,139}(?![_"+Dv+"])","g"),xv=new RegExp("[^"+Dv+"]"),Bv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegex=Fv,n.nonWordCharRegex=xv,n.serviceName=t.serviceName,n}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.nonWordCharRegex,i=this.serviceName,s=this.tagBuilder,o=[];null!==(t=n.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||r.test(u)){var l=t[0],c=t[0].slice(1);o.push(new sv({tagBuilder:s,matchedText:l,offset:a,serviceName:i,hashtag:c}))}}return o},t}(lv),Pv=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"),Uv=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.matcherRegex=Pv,t}return tv(t,e),t.prototype.parseMatches=function(e){for(var t,n=this.matcherRegex,r=this.tagBuilder,i=[];null!==(t=n.exec(e));){var s=t[0],o=s.replace(/[^0-9,;#]/g,""),a=!(!t[1]&&!t[2]),u=0==t.index?"":e.substr(t.index-1,1),l=e.substr(t.index+s.length,1),c=!u.match(/\d/)&&!l.match(/\d/);this.testMatch(t[3])&&this.testMatch(s)&&c&&i.push(new av({tagBuilder:r,matchedText:s,offset:t.index,number:o,plusSign:a}))}return i},t.prototype.testMatch=function(e){return dv.test(e)},t}(lv),Hv=new RegExp("@[_"+Dv+"]{1,50}(?![_"+Dv+"])","g"),$v=new RegExp("@[_."+Dv+"]{1,30}(?![_"+Dv+"])","g"),jv=new RegExp("@[-_."+Dv+"]{1,50}(?![-_"+Dv+"])","g"),Yv=new RegExp("[^"+Dv+"]"),zv=function(e){function t(t){var n=e.call(this,t)||this;return n.serviceName="twitter",n.matcherRegexes={twitter:Hv,instagram:$v,soundcloud:jv},n.nonWordCharRegex=Yv,n.serviceName=t.serviceName,n}return tv(t,e),t.prototype.parseMatches=function(e){var t,n=this.serviceName,r=this.matcherRegexes[this.serviceName],i=this.nonWordCharRegex,s=this.tagBuilder,o=[];if(!r)return o;for(;null!==(t=r.exec(e));){var a=t.index,u=e.charAt(a-1);if(0===a||i.test(u)){var l=t[0].replace(/\.+$/g,""),c=l.slice(1);o.push(new ov({tagBuilder:s,matchedText:l,offset:a,serviceName:n,mention:c}))}}return o},t}(lv),Vv=function(e){void 0===e&&(e={}),this.idx=void 0!==e.idx?e.idx:-1,this.type=e.type||"tag",this.name=e.name||"",this.isOpening=!!e.isOpening,this.isClosing=!!e.isClosing},Gv=function(){function e(t){void 0===t&&(t={}),this.version=e.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="boolean"==typeof t.email?t.email:this.email,this.phone="boolean"==typeof t.phone?t.phone:this.phone,this.hashtag=t.hashtag||this.hashtag,this.mention=t.mention||this.mention,this.newWindow="boolean"==typeof t.newWindow?t.newWindow:this.newWindow,this.stripPrefix=this.normalizeStripPrefixCfg(t.stripPrefix),this.stripTrailingSlash="boolean"==typeof t.stripTrailingSlash?t.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding="boolean"==typeof t.decodePercentEncoding?t.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=t.sanitizeHtml||!1;var n=this.mention;if(!1!==n&&"twitter"!==n&&"instagram"!==n&&"soundcloud"!==n)throw new Error("invalid `mention` cfg - see docs");var r=this.hashtag;if(!1!==r&&"twitter"!==r&&"facebook"!==r&&"instagram"!==r)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 e.link=function(t,n){return new e(n).link(t)},e.parse=function(t,n){return new e(n).parse(t)},e.prototype.normalizeUrlsCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{schemeMatches:e,wwwMatches:e,tldMatches:e}:{schemeMatches:"boolean"!=typeof e.schemeMatches||e.schemeMatches,wwwMatches:"boolean"!=typeof e.wwwMatches||e.wwwMatches,tldMatches:"boolean"!=typeof e.tldMatches||e.tldMatches}},e.prototype.normalizeStripPrefixCfg=function(e){return null==e&&(e=!0),"boolean"==typeof e?{scheme:e,www:e}:{scheme:"boolean"!=typeof e.scheme||e.scheme,www:"boolean"!=typeof e.www||e.www}},e.prototype.normalizeTruncateCfg=function(e){return"number"==typeof e?{length:e,location:"end"}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&void 0===e[n]&&(e[n]=t[n]);return e}(e||{},{length:Number.POSITIVE_INFINITY,location:"end"})},e.prototype.parse=function(e){var t=this,n=["a","style","script"],r=0,i=[];return function(e,t){for(var n,r=t.onOpenTag,i=t.onCloseTag,s=t.onText,o=t.onComment,a=t.onDoctype,u=new Vv,l=0,c=e.length,h=0,d=0,p=u;l<c;){var f=e.charAt(l);switch(h){case 0:"<"===f&&F();break;case 1:m(f);break;case 2:g(f);break;case 3:E(f);break;case 4:A(f);break;case 5:_(f);break;case 6:D(f);break;case 7:v(f);break;case 8:T(f);break;case 9:O(f);break;case 10:S(f);break;case 11:C(f);break;case 12:y(f);break;case 13:"--"===e.substr(l,2)?(l+=2,p=new Vv(rv(rv({},p),{type:"comment"})),h=14):"DOCTYPE"===e.substr(l,7).toUpperCase()?(l+=7,p=new Vv(rv(rv({},p),{type:"doctype"})),h=20):M();break;case 14:N(f);break;case 15:I(f);break;case 16:b(f);break;case 17:R(f);break;case 18:w(f);break;case 19:k(f);break;case 20:L(f);break;default:qD(h)}l++}function m(e){"!"===e?h=13:"/"===e?(h=2,p=new Vv(rv(rv({},p),{isClosing:!0}))):"<"===e?F():cv.test(e)?(h=3,p=new Vv(rv(rv({},p),{isOpening:!0}))):(h=0,p=u)}function E(e){pv.test(e)?(p=new Vv(rv(rv({},p),{name:B()})),h=4):"<"===e?F():"/"===e?(p=new Vv(rv(rv({},p),{name:B()})),h=12):">"===e?(p=new Vv(rv(rv({},p),{name:B()})),x()):cv.test(e)||hv.test(e)||":"===e||M()}function g(e){">"===e?M():cv.test(e)?h=3:M()}function A(e){pv.test(e)||("/"===e?h=12:">"===e?x():"<"===e?F():"="===e||fv.test(e)||mv.test(e)?M():h=5)}function _(e){pv.test(e)?h=6:"/"===e?h=12:"="===e?h=7:">"===e?x():"<"===e?F():fv.test(e)&&M()}function D(e){pv.test(e)||("/"===e?h=12:"="===e?h=7:">"===e?x():"<"===e?F():fv.test(e)?M():h=5)}function v(e){pv.test(e)||('"'===e?h=8:"'"===e?h=9:/[>=`]/.test(e)?M():"<"===e?F():h=10)}function T(e){'"'===e&&(h=11)}function O(e){"'"===e&&(h=11)}function S(e){pv.test(e)?h=4:">"===e?x():"<"===e&&F()}function C(e){pv.test(e)?h=4:"/"===e?h=12:">"===e?x():"<"===e?F():(h=4,l--)}function y(e){">"===e?(p=new Vv(rv(rv({},p),{isClosing:!0})),x()):h=4}function N(e){"-"===e?h=15:">"===e?M():h=16}function I(e){"-"===e?h=18:">"===e?M():h=16}function b(e){"-"===e&&(h=17)}function R(e){h="-"===e?18:16}function w(e){">"===e?x():"!"===e?h=19:"-"===e||(h=16)}function k(e){"-"===e?h=17:">"===e?x():h=16}function L(e){">"===e?x():"<"===e&&F()}function M(){h=0,p=u}function F(){h=1,p=new Vv({idx:l})}function x(){var t=e.slice(d,p.idx);t&&s(t,d),"comment"===p.type?o(p.idx):"doctype"===p.type?a(p.idx):(p.isOpening&&r(p.name,p.idx),p.isClosing&&i(p.name,p.idx)),M(),d=l+1}function B(){var t=p.idx+(p.isClosing?2:1);return e.slice(t,l).toLowerCase()}d<l&&(n=e.slice(d,l),s(n,d),d=l+1)}(e,{onOpenTag:function(e){n.indexOf(e)>=0&&r++},onText:function(e,n){if(0===r){var s=function(e,t){if(!t.global)throw new Error("`splitRegex` must have the 'g' flag set");for(var n,r=[],i=0;n=t.exec(e);)r.push(e.substring(i,n.index)),r.push(n[0]),i=n.index+n[0].length;return r.push(e.substring(i)),r}(e,/(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi),o=n;s.forEach((function(e,n){if(n%2==0){var r=t.parseText(e,o);i.push.apply(i,r)}o+=e.length}))}},onCloseTag:function(e){n.indexOf(e)>=0&&(r=Math.max(r-1,0))},onComment:function(e){},onDoctype:function(e){}}),i=this.compactMatches(i),i=this.removeUnwantedMatches(i)},e.prototype.compactMatches=function(e){e.sort((function(e,t){return e.getOffset()-t.getOffset()}));for(var t=0;t<e.length-1;t++){var n=e[t],r=n.getOffset(),i=n.getMatchedText().length,s=r+i;if(t+1<e.length){if(e[t+1].getOffset()===r){var o=e[t+1].getMatchedText().length>i?t:t+1;e.splice(o,1);continue}e[t+1].getOffset()<s&&e.splice(t+1,1)}}return e},e.prototype.removeUnwantedMatches=function(e){return this.hashtag||KD(e,(function(e){return"hashtag"===e.getType()})),this.email||KD(e,(function(e){return"email"===e.getType()})),this.phone||KD(e,(function(e){return"phone"===e.getType()})),this.mention||KD(e,(function(e){return"mention"===e.getType()})),this.urls.schemeMatches||KD(e,(function(e){return"url"===e.getType()&&"scheme"===e.getUrlMatchType()})),this.urls.wwwMatches||KD(e,(function(e){return"url"===e.getType()&&"www"===e.getUrlMatchType()})),this.urls.tldMatches||KD(e,(function(e){return"url"===e.getType()&&"tld"===e.getUrlMatchType()})),e},e.prototype.parseText=function(e,t){void 0===t&&(t=0),t=t||0;for(var n=this.getMatchers(),r=[],i=0,s=n.length;i<s;i++){for(var o=n[i].parseMatches(e),a=0,u=o.length;a<u;a++)o[a].setOffset(t+o[a].getOffset());r.push.apply(r,o)}return r},e.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;"));for(var t=this.parse(e),n=[],r=0,i=0,s=t.length;i<s;i++){var o=t[i];n.push(e.substring(r,o.getOffset())),n.push(this.createMatchReturnVal(o)),r=o.getOffset()+o.getMatchedText().length}return n.push(e.substring(r)),n.join("")},e.prototype.createMatchReturnVal=function(e){var t;return this.replaceFn&&(t=this.replaceFn.call(this.context,e)),"string"==typeof t?t:!1===t?e.getMatchedText():t instanceof JD?t.toAnchorString():e.buildTag().toAnchorString()},e.prototype.getMatchers=function(){if(this.matchers)return this.matchers;var e=this.getTagBuilder(),t=[new Bv({tagBuilder:e,serviceName:this.hashtag}),new bv({tagBuilder:e}),new Uv({tagBuilder:e}),new zv({tagBuilder:e,serviceName:this.mention}),new Mv({tagBuilder:e,stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding})];return this.matchers=t},e.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new ZD({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},e.version="3.14.3",e.AnchorTagBuilder=ZD,e.HtmlTag=JD,e.matcher={Email:bv,Hashtag:Bv,Matcher:lv,Mention:zv,Phone:Uv,Url:Mv},e.match={Email:iv,Hashtag:sv,Match:QD,Mention:ov,Phone:av,Url:uv},e}();function Wv(e,t=e){return{type:"autolink",url:e,text:t}}const Xv=UD(/<!!mention:([^>\s]*?)\|(.*?)>/gm,(([e,t,n])=>function(e,t){return{type:"mention",id:e,text:t}}(decodeURIComponent(t),n))),Kv=UD(/<!!customemoji:(.*?)>/gm,(([e,t])=>function(e){return{type:"customemoji",text:e}}(t))),qv=UD(/<((?:https?|mailto):.*?)\|(.*?)>/gi,(([e,t,n])=>function(e,t=[]){return{type:"link",url:e,children:t}}(t,[n]))),Jv=UD(/<actionlink:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Qv(t);return function(e,t,n=[]){return{type:"actionlink",action:e,params:t,children:n}}(r,i,[n])})),Zv=UD(/<actionbutton:([^|]+)[|]([^>]*)>/gi,(([e,t,n])=>{const{action:r,params:i}=Qv(t);return function(e,t,n=[]){return{type:"actionbutton",action:e,params:t,children:n}}(r,i,[n])}));function Qv(e){const t=e.indexOf("?");return-1===t?{action:e,params:{}}:{action:e.slice(0,t),params:Object.fromEntries(new URLSearchParams(e.slice(t)))}}const eT=UD(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,(([e])=>function(e=[]){return{type:"bulletlist",children:e}}([e.startsWith("\n")?e.slice(1):e]))),tT=UD(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,(([e,t])=>({type:"bulletpoint",children:[t]}))),nT=e=>{const t=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;let n=0;const r=[];for(const i of tD(e,t)){const t=i[0],s=i[1],o=t.startsWith(s)?i.index:i.index+1;o-n>0&&r.push(e.substring(n,o));const a=Wv("tel:"+s.replace(/[^0-9+]/g,""),s);r.push(a),n=o+s.length}return n<e.length&&r.push(e.substring(n)),r},rT=e=>qv(e).flatMap((e=>"string"==typeof e?iT(e):["<",...iT(e.url),...iT("|"+e.children[0]+">")])),iT=e=>{const t=Gv.parse(e,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),n=[];let r=0;for(const i of t){const t=i.getOffset(),s=i.getMatchedText(),o=s.length;let a=s;i instanceof iv?a="mailto:"+i.getEmail():i instanceof uv&&(a=i.getUrl()),t>r&&n.push(e.substring(r,t)),n.push(Wv(a,s)),r=t+o}return r<e.length&&n.push(e.substring(r)),n},sT=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"],oT=function(){const e=RegExp("[^\n]+\n?|\n","g");return t=>Array.from(t.match(e)||[])}();function aT(e,t={except:[]}){let n=function(e,t){let n=[e];return n=uT(n,t.multilineSteps),n=uT(n,[oT]),n=uT(n,t.singlelineSteps),n=lT(n),n}(e,function(e={except:[]}){var t;const n={multilineSteps:[],singlelineSteps:[]},r=null!=(t=e.except)?t:sT.filter((t=>!e.only.includes(t)));return r.includes("BulletPoint")||n.multilineSteps.push(eT,tT),r.includes("Mention")||n.singlelineSteps.push(Xv),r.includes("CustomEmoji")||n.singlelineSteps.push(Kv),r.includes("Codespan")||n.multilineSteps.push(UD(/```([^]+?)```/g,(([e,t])=>({type:"codespan",text:t})))),r.includes("FormattedLink")||n.singlelineSteps.push(qv),r.includes("Actions")||(n.singlelineSteps.push(Jv),n.singlelineSteps.push(Zv)),r.includes("Wikitext")||n.singlelineSteps.push(VD),r.includes("Autolink")||n.singlelineSteps.push(rT,nT),n}(t));return n=cT(n,!1),n}function uT(e,t){return t.reduce(((e,t)=>PD(e,t)),e)}function lT(e){const t=[];let n=-1;for(const r of e)"string"==typeof r?"string"==typeof t[n]?t[n]+=r:t[++n]=r:t[++n]="children"in r?a_(o_({},r),{children:lT(r.children)}):r;return t}function cT(e,t){const n=[];let r=[];for(let i=0;i<e.length;i++){const s=e[i];"string"==typeof s?r.push(s):"children"in s?(r.length>0&&(n.push(r.join("")),r=[]),s.children=cT(s.children,t||"link"===s.type||"actionbutton"===s.type||"actionlink"===s.type),n.push(s)):"autolink"===s.type&&t?r.push(s.text):(r.length>0&&(n.push(r.join("")),r=[]),n.push(s))}return r.length>0&&(n.push(r.join("")),r=[]),n}class hT{constructor(e,t,n){this.id=e,this.conversationId=t,this._realtimeClient=n}get brandedId(){return this.id}get brandedConversationId(){return this.conversationId}get(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("GET",["me","conversations",this.brandedConversationId,"messages",this.brandedId],{});if(!e.ok&&"server"===e.where&&404===e.value.status)return null;if(!e.ok&&"server"===e.where&&403===e.value.status&&"NOT_A_PARTICIPANT"===e.value.errorCode)return null;const t=c_("Get message "+this.id,e),n=yield this._realtimeClient.createMessageSnapshot(t,this.brandedConversationId);return MD("Get message "+this.id,n)}))}edit(e){return l_(this,null,(function*(){const t={content:dT(e),custom:"string"==typeof e?void 0:e.custom},n=yield this._realtimeClient.call("PATCH",["conversations",this.brandedConversationId,"messages",this.brandedId],t);c_(`Edit message ${this.id} in conversation ${this.conversationId}`,n)}))}delete(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("DELETE",["conversations",this.brandedConversationId,"messages",this.brandedId],{});(e.ok||"server"!==e.where||404!==e.value.status)&&c_(`Delete message ${this.id} in conversation ${this.conversationId}`,e)}))}}function dT(e){return"string"==typeof e?[{type:"text",children:aT(e)}]:"text"in e&&e.text?[{type:"text",children:aT(e.text)}]:"content"in e&&e.content?e.content:void 0}class pT{constructor(e,t){this.id=e,this._realtimeClient=t,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(e){return new xD("string"==typeof e?e:e.id,this.id,this._realtimeClient)}message(e){return new hT(e,this.brandedId,this._realtimeClient)}get(){return l_(this,null,(function*(){const e=this._realtimeClient.listMessages(this.brandedId,{limit:1}),t=yield this._realtimeClient.call("GET",["me","conversations",this.brandedId],{});if(!t.ok&&"server"===t.where&&404===t.value.status)return null;const n=c_("Get conversation "+this.id,t),r=MD("Get last message in conversation "+this.id,yield e),i=0===r.length?null:r[0];return this._realtimeClient.createConversationSnapshotPreloaded(n,i)}))}set(e){return l_(this,null,(function*(){const t=this._realtimeClient.call("PUT",["conversations",this.brandedId],e),n=this._realtimeClient.call("PUT",["conversations",this.brandedId,"participants",this.brandedUserId],e),r=yield t;!r.ok&&"server"===r.where&&403===r.value.status&&"UNAUTHORIZED_TO_EDIT"===r.value.errorCode&&function(e){return void 0===e.subject&&void 0===e.photoUrl&&void 0===e.welcomeMessages&&null!==e.custom&&(void 0===e.custom||!Object.values(e.custom).some((e=>void 0!==e)))}(e)||c_("Set conversation "+this.id,r);const i=yield n;!i.ok&&"server"===i.where&&403===i.value.status&&"UNAUTHORIZED_TO_EDIT_PARTICIPANT"===i.value.errorCode&&function(e){return void 0===e.access&&void 0===e.notify}(e)||c_("Set your participation in conversation "+this.id,i)}))}createIfNotExists(){return l_(this,arguments,(function*(e={}){const t=this._realtimeClient.call("POST",["conversations",this.brandedId],e),n=this._realtimeClient.call("POST",["conversations",this.brandedId,"participants",this.brandedUserId],e),r=yield t;(r.ok||"server"!==r.where||409!==r.value.status)&&c_("Create conversation "+this.id,yield t);const i=yield n;(i.ok||"server"!==i.where||409!==i.value.status)&&c_("Join conversation "+this.id,yield n)}))}markAsRead(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"read"],{});c_(`Mark ${this.id} as read`,e)}))}markAsUnread(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"unread"],{});c_(`Mark ${this.id} as unread`,e)}))}send(e){return l_(this,null,(function*(){const t={content:fT(e),referencedMessageId:mT(e),custom:"string"==typeof e?void 0:e.custom,idempotencyKey:BD((new Date).getTime())},n=yield this._realtimeClient.call("POST",["conversations",this.brandedId,"messages"],t),r=c_("Send message to conversation "+this.id,n);return new hT(r.id,this.brandedId,this._realtimeClient)}))}subscribeMessages(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"messages"],e)}subscribeParticipants(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"participants"],e)}subscribe(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId],e)}subscribeTyping(e){return this._realtimeClient.subscribe(["me","conversations",this.brandedId,"typing"],e)}markAsTyping(){return l_(this,null,(function*(){const e=yield this._realtimeClient.call("POST",["me","conversations",this.brandedId,"typing"],{});c_(`Set user as typing in ${this.id}`,e)}))}}function fT(e){return"string"==typeof e?[{type:"text",children:aT(e)}]:"text"in e?[{type:"text",children:aT(e.text)}]:e.content}function mT(e){if("string"==typeof e)return;const t=e.referencedMessage;return void 0!==t?"string"==typeof t?t:t.id:void 0}class ET{constructor(e,t,n){this.realtimeWsApiUrl=e,this.internalHttpApiUrl=t,this.restApiHttpUrl=n}getBokensUrl(e,t,n){return this.internalHttpApiUrl+`/${e}/bokens/${encodeURIComponent(t)}?signature=${encodeURIComponent(null!=n?n:"")}`}getRealtimeWsUrl(e,t,n,r,i){const s=encodeURIComponent(t);return this.realtimeWsApiUrl+`/${e}/realtime/${s}?talkjs-client-build=${null!=i?i:"standalone"}&talkjs-core=${n}&talkjs-client-id=${r}`}static fromHost(e){const t=new ET("wss://realtime.talkjs.com/v1","https://app.talkjs.com/api/v0","https://api.talkjs.com/v1");if(!e)return t;if(e.endsWith("talkjs.com")){const n=e.match(/\w+-(\w+)\.talkjs\.com/);if(n){const e=n[1];return new ET(`wss://realtime-${e}.talkjs.com/v1`,`https://app-${e}.talkjs.com/api/v0`,`https://api-${e}.talkjs.com/v1`)}return t}return e.includes("localhost")||e.includes("localtest.me")||/^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e)?new ET(`ws://${e}/public_api/v1`,`http://${e}/api/v0`,`http://${e}/public_api/v1`):new ET(`wss://${e}/public_api/v1`,`https://${e}/api/v0`,`https://${e}/public_api/v1`)}}function gT({method:e,url:t,data:n,options:r,attempts:i,shouldRetry:s,authProvider:o}){var a;(!i||i<=0)&&(i=1);const u={"x-talkjs-client-build":"jssdk-dev","x-talkjs-client-date":"2025-08-05T08:38:32.896Z"};return n instanceof FormData||(u["Content-Type"]=null!=(a=null==r?void 0:r.contentType)?a:"application/json"),E_(i,(()=>l_(this,null,(function*(){if(o){const e=yield o.getToken();u.Authorization=`Bearer ${e}`}return fetch(t,{method:e,headers:u,body:n}).then((e=>{if(e.ok)return e;throw e}))}))),{initialDelay:.2,log:void 0,shouldRetry:n=>l_(this,null,(function*(){return o&&401===n.status?(CT.log(`401 error from ${e} ${t}, ${yield o.getToken()}`),o.refreshToken(),!0):s?s(n):!("status"in n&&n.status>=400&&n.status<500)}))}).catch((n=>{if(Math.random()<.1&&!t.toString().startsWith("https://capture.trackjs.com")){const r=`Network Error for ${e} ${t}`;"undefined"!=typeof window&&(n instanceof Response?n.clone().text().then((e=>CT.log(`${r} ${n.status} ${e} (10% logged)`))):CT.log(`${r} ${n} (10% logged)`)),console.error("[TalkJS]",r)}throw n}))}const{cdnHost:AT,appHost:_T,restHost:DT,realtimeHost:vT,appProtocol:TT,appWsProtocol:OT}=function(){if("undefined"==typeof window)return{cdnHost:"test-hostname",appHost:"test-hostname",appProtocol:"http:",appWsProtocol:"ws:"};const e=function(){if(document.currentScript)return document.currentScript.src;try{throw new Error}catch(e){const n=e.stack.match(/https?:\/\/.*\.(js|jsx|ts|tsx)/);return n?n[0]:""}}(),t=document.createElement("a");t.href=e;const n=t.host,r=(a=n).match(/^cdn[.-]/)?a.replace(/^cdn/,"app"):"talkjs.com"===a?"app.talkjs.com":a,i=function(e){return e.match(/^app[.-]/)?e.replace(/^app/,"api"):e+"/public_api"}(r),s=function(e){return e.match(/^app[.-]/)?e.replace(/^app/,"realtime"):e+"/public_api"}(r),o=t.protocol;var a;return{cdnHost:n,appHost:r,restHost:i,realtimeHost:s,appProtocol:o,appWsProtocol:"https:"===o?"wss:":"ws:"}}(),ST=_T.startsWith("app.talkjs.com"),CT="undefined"==typeof window?{log:e=>Promise.resolve(),setData:e=>{}}:new class{constructor(e){this._timeCreated=Date.now(),this._enabled=ST,this._trackJSData={customer:{application:"",correlationId:"",sessionId:"",token:"",userId:"",version:"dev-2025-08-05T08:38:32.896Z"},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-05T08:38:32.896Z",throttled:0},this._url=`https://capture.trackjs.com/capture?token=${e}`,this._trackJSData.customer.token=e}setData({appId:e,meId:t,sessionId:n}){this._trackJSData.customer.userId=e,this._trackJSData.customer.sessionId=`${e}/${t}`,this._trackJSData.customer.correlationId=n}log(e){return l_(this,null,(function*(){try{if(!this._enabled)return Promise.resolve();const t=a_(o_({},this._trackJSData),{message:e});yield gT({method:"POST",url:this._url,data:JSON.stringify(t),options:{contentType:"text/plain"}})}catch(e){console.error("[TalkJS] Failed when sending an error report. Error: ",e)}}))}}("970cd0be0fb74630b75c8451051299dc");class yT{constructor(e,t={}){this._onSubscription=t,this._handlers={};for(const n in e)Object.hasOwnProperty.call(e,n)&&(this._handlers[n]=[])}emit(e,t){for(const n of this._handlers[e])try{n(t)}catch(t){console.error(`[TalkJS] '${String(e)}' handler threw an error:`,t)}}emitAsync(e,t){return l_(this,null,(function*(){try{const n=this._handlers[e].map((e=>e(t)));yield Promise.all(n)}catch(t){console.error(`[TalkJS] '${String(e)}' handler threw an error:`,t)}}))}supports(e){return e in this._handlers}on(e,t){var n,r;if(!this.supports(e))throw new Error(`Unknown event type '${String(e)}'`);null==(r=(n=this._onSubscription)[e])||r.call(n),this._handlers[e].push(t)}off(e,t){if(!Object.hasOwnProperty.call(this._handlers,e))throw new Error(`Unknown event type '${String(e)}'`);const n=this._handlers[e].indexOf(t);-1!==n&&this._handlers[e].splice(n,1)}removeAllListeners(){for(const e in this._handlers)this._handlers[e]=[]}handles(e){return this._handlers[e].length>0}subscribe(e,t){return this.on(e,t),{unsubscribe:()=>this.off(e,t)}}}class NT{constructor(e,t,n,r,i,s){if(this.appId=t,this.userId=n,this.tokenFetcher=i,this.usingBokens=!1,this.requestInProgress=!1,this.eventEmitter=new yT({tokenChanged(e){},tokenRefreshFailed(e){},tokenAccepted(e){}}),this.sessionExpiryWarningTimeoutId=void 0,s&&(r||i))throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");r?this.fetchToken((()=>r)):(i||(this.usingBokens=!0,this.tokenFetcher=()=>this.sendBokenRequest(e,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(e){return this.eventEmitter.on("tokenChanged",e),()=>{this.eventEmitter.off("tokenChanged",e)}}emitTokenChanged(e){this.eventEmitter.emit("tokenChanged",e)}onTokenRefreshFailed(e){return this.eventEmitter.on("tokenRefreshFailed",e),()=>{this.eventEmitter.off("tokenRefreshFailed",e)}}emitTokenRefreshFailed(e){this.eventEmitter.emit("tokenRefreshFailed",e),console.error(`[TalkJS] Could not authenticate, cannot recover automatically: ${e}`)}onTokenAccepted(e){return this.eventEmitter.on("tokenAccepted",e),()=>{this.eventEmitter.off("tokenAccepted",e)}}emitTokenAccepted(e){this.eventEmitter.emit("tokenAccepted",e)}clearScheduledRefresh(){this.sessionExpiryWarningTimeoutId&&clearTimeout(this.sessionExpiryWarningTimeoutId)}scheduleRefresh(e){if(this.clearScheduledRefresh(),null===e)return;const t=void 0!==this.tokenFetcher;if(e<120&&!t?console.warn(`[TalkJS] TalkJS will stop working in ${e} seconds due to auth token expiry. Token expires in ${e} 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.`):e<120&&t?console.warn(`[TalkJS] TalkJS auth token will expire and need to be refreshed in ${e} seconds. Refreshable JWTs are recommended to expire at least 30 minutes in the future, to improve performance and reduce unnecessary refreshes.`):e<3300&&!t&&console.warn(`[TalkJS debug] TalkJS will stop working in ${Math.round(e/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.`),void 0!==this.tokenFetcher){const t=e>600?e-300:e/2,n=Math.min(1728e6,1e3*t);this.sessionExpiryWarningTimeoutId=setTimeout((()=>{this.refreshToken()}),n)}else e<2e6&&(this.sessionExpiryWarningTimeoutId=setTimeout((()=>{this.emitTokenRefreshFailed("Token has expired and no `tokenFetcher` was provided when creating the session, so it cannot be refreshed.")}),1e3*e))}fetchToken(e){return l_(this,null,(function*(){if(this.requestInProgress)return;this.requestInProgress=!0;const t=()=>l_(this,null,(function*(){const t=yield e();return this.checkJwt(t),t}));try{const e=void 0!==this.token;this.token=t(),yield this.token.then((t=>{e&&this.emitTokenChanged(t)})).catch((e=>{this.emitTokenRefreshFailed(e)}))}catch(e){this.emitTokenRefreshFailed(e)}finally{this.requestInProgress=!1}}))}checkJwt(e){!function(e){if(!("string"==typeof e||e instanceof String)){if(void 0===e)throw"Token was undefined";throw"Token must be a string, got: "+e}}(e);const t=[];let n,r,i;if("string"==typeof e?n=e:t.push(`Token type is ${typeof e} instead of a string.`),n)try{const e=function(e){const t=e.split(".");if(3!==t.length)throw"Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";return{header:IT(t[0]),payload:IT(t[1])}}(n);r=e.header,i=e.payload}catch(e){t.push(e)}if(r){const e=this.checkJwtHeader(r);t.push(...e)}if(i){const e=this.checkJwtPayload(i);t.push(...e)}if(t.length)if(this.usingBokens)CT.log(`JWT Errors detected by AuthProvider when using bokens: ${t.join("\n")}`);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 n=t.length>1;t.forEach(((e,t)=>{const r=n?`Reason ${t+1}:`:"Reason:";console.warn(`[TalkJS] ${r} ${e}`)})),console.warn(`[TalkJS]: Authentication token: "${e}"`)}}checkJwtHeader(e){const t=[],n=e.alg;return void 0===n?t.push('Token header must contain `"alg": "HS256"`, but no `alg` was specified.'):"string"!=typeof n?t.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was ${typeof n} instead of a string. Make sure you wrap the value in "".`):"HS256"!==n&&t.push(`Token header must contain \`"alg": "HS256"\`, but \`alg\` was set to "${n}" instead. HS256 is the only supported algorithm.`),t}checkJwtPayload(e){const t=[],n=e.iss;void 0===n?t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was missing.`):"string"!=typeof n?t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was ${typeof n} instead of a string. Make sure you wrap the value in "".`):n!==this.appId&&t.push(`Token payload must contain an \`iss\` claim set to your app ID (${this.appId}), but \`iss\` was set to "${n}" instead.`);const r=e.sub;void 0===r?t.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`):"string"!=typeof r?t.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof r} instead of a string. Make sure you wrap the value in "".`):r!==this.userId&&t.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${r}" instead.`);const i=e.tokenType;void 0===i?t.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.'):"string"!=typeof i?t.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof i} instead of a string. Make sure you wrap the value in "".`):"user"!==i&&t.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${i}" instead.`);const s=e.exp;void 0===s||("number"!=typeof s?t.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof i} 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?t.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?t.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&&t.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 o=e.nbf;return void 0===o||("number"!=typeof o?t.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof i} 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.`):o>1e11&&t.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${o}, representing ${new Date(1e3*o).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.`)),t}sendBokenRequest(e,t){return l_(this,null,(function*(){let n=0;const r=e.getBokensUrl(this.appId,this.userId,t),i=yield gT({method:"GET",url:r,attempts:1e4,shouldRetry:e=>{if(e instanceof Error)return!0;if(401===e.status)throw"Check that you provided a valid signature.";if(404===e.status)throw"Check that you specified the correct App ID.";if(429===e.status||502===e.status)return!0;if(e.status>=400&&e.status<500)throw`Unexpected HTTP ${e.status} response when fetching auth token. Check that you configured the session correctly.`;if(n++,n>=5)throw`Unexpected HTTP ${e.status} response when fetching auth token, retrying did not help.`;return!0}});return(yield i.json()).boken}))}}function IT(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}catch(t){throw`Could not base64-decode and JSON-parse token section: ${e}. Check that you base-64 encoded the section correctly.`}}class bT{constructor(e){this.target=e}deref(){return this.target}}const RT=new class{constructor(){this.registry={}}getOrCreate(e){var t;const n=this.key(e),r=null==(t=this.registry[n])?void 0:t.deref();if(r)return r;const i=new wT(e),s=globalThis.WeakRef?new WeakRef(i):new bT(i);return this.registry[n]=s,i}deregister(e,t){const n=this.key({appId:e,userId:t});delete this.registry[n]}key({appId:e,userId:t}){return`${e}:${t}`}};class wT{constructor(e){!function(e){function t(e,t){if(!e)throw new Error("[TalkJS] TalkSession: "+t)}t(e&&"object"==typeof e,"Expected an object argument in TalkSession#constructor."),t(e.appId&&"string"==typeof e.appId,"The `appId` property of TalkSession#constructor is required and it must be a non-empty string."),t("string"==typeof e.userId,"The `userId` property of TalkSession#constructor is required and it must be a string."),void 0!==e.token&&t(e.token&&"string"==typeof e.token,"The `token` property of TalkSession#constructor must be a non-empty string."),void 0!==e.tokenFetcher&&t("function"==typeof e.tokenFetcher,"The `tokenFetcher` property of TalkSession#constructor must be a function.")}(e);const{appId:t,userId:n,token:r,tokenFetcher:i,signature:s}=e;this._appId=t,this._apiUrls=e.apiUrls?new ET(e.apiUrls.realtimeWsApiUrl,e.apiUrls.internalHttpApiUrl,e.apiUrls.restApiHttpUrl):ET.fromHost(e.host),this._authProvider=new NT(this._apiUrls,t,n,r,i,s);const o=Math.random().toString().split(".")[1];this._realtimeClient=new kD(this._apiUrls.getRealtimeWsUrl(t,n,"1.4.2",o,e.clientBuild),n,this._authProvider),this.currentUser=new FD(this._realtimeClient.userId,this._realtimeClient),this._terminationReason=g_(),this._terminationReason.promise.then((e=>{console.error(`[TalkSession] ${e}`)})),function(e,t,n){return l_(this,null,(function*(){return gT({method:"GET",url:`${t}/${e}/app`,authProvider:n}).then((e=>200===e.status||404!==e.status&&(console.warn(`[TalkJS] Received unexpected ${e.status} status code when validating app ID. Assuming that the app ID is valid.`),!0))).catch((e=>{if("string"!=typeof e&&"status"in e){const t=e;return 200===t.status||404!==t.status&&(console.warn(`[TalkJS] Received unexpected ${t.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((e=>{e||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((e=>{this.terminate(new Error(`Could not authenticate, cannot recover automatically: ${e}`))}))}onError(e){const t=g_();return Promise.race([t.promise,this._terminationReason.promise]).then((t=>{"UNSUBSCRIBED"!==t&&e(t)})),{unsubscribe:()=>t.resolve("UNSUBSCRIBED")}}user(e){return new FD(e,this._realtimeClient)}conversation(e){return new pT(e,this._realtimeClient)}subscribeConversations(e){return this._realtimeClient.subscribe(["me","conversations"],e)}terminate(e){RT.deregister(this._appId,this.currentUser.id),this._terminationReason.resolve(e),this._realtimeClient.destroy()}_isConnected(){return this._realtimeClient.isConnected()}uploadFile(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,t)}uploadImage(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"image"},t))}uploadVideo(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"video"},t))}uploadAudio(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"audio"},t))}uploadVoice(e,t){return kT(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`,this._authProvider,e,o_({subtype:"voice"},t))}}function kT(e,t,n,r){return l_(this,arguments,(function*(e,t,n,{subtype:r,filename:i,width:s,height:o,duration:a}){const u=new FormData;return u.set("file",n,i),void 0!==r&&u.set("subtype",r),void 0!==s&&u.set("width",s.toString()),void 0!==o&&u.set("height",o.toString()),void 0!==a&&u.set("duration",a.toString()),gT({method:"POST",url:e,data:u,authProvider:t}).then((e=>e.json())).then((e=>e.attachmentToken)).catch((e=>l_(this,null,(function*(){if(e instanceof Response){const t=yield e.json(),n=`Unexpected response when uploading file, status code ${e.status} ${t.errorCode}, ${t.reasons}`;throw new Error(n)}throw e}))))}))}function LT(e,t,n){return de((r=>{e&&e(r);const i=t.current?.parentElement;"T-CHATBOX"===i?.tagName&&function(e,t,n){for(const r of n){const n=new Event(r);Object.assign(n,t),e.dispatchEvent(n)}}(i,r,n)}),[e,t,n])}!function({observableFunctions:e,observableProperties:t,jsonReplacer:n,jsonReviver:r}){if(e)for(const i in e){const t=e[i];nr.set(i,t),Sr.prototype[i]=function(...e){return t.call(this,this._node,...e)}}if(t)for(const i in t){const e=t[i];tr.set(i,e),Object.defineProperty(Sr.prototype,i,{configurable:!0,get(){return e.get.call(this,this._node)},set(t){return e.set.call(this,this._node,t)}})}n&&(Jt.replacer=n),r&&(Jt.reviver=r)}({observableFunctions:{child:(e,t)=>(si("string"==typeof t||"number"==typeof t,"Key should be a string or a number"),Nr.getProxy(e,t.toString()))}}),Ss.registerHandler((({level:e,data:t})=>{console[e]("[TalkJS]",...t)}));const MT=Fe((function(e,t){const{onSendMessage:n,onDeleteMessage:r,beforeBrowserPermissionPrompt:i,onMissingBrowserPermission:s,messageFieldPlaceholder:o,messageFieldSpellcheck:a}=e;ae((()=>{e.__internalOnLoaded?.()}),[]);const[u,l]=se(!0);ae((()=>{l(!1)}),[]);const c=le(null);!function(e){ae((()=>{if(window.cordova){const t=e.current;si.defined(t);const n=e=>{e.target instanceof HTMLAnchorElement&&(e.preventDefault(),function(e){const t=window;t.cordova.InAppBrowser?t.cordova.InAppBrowser.open(e,"_system"):window.open(e,"_system","location=yes")}(e.target.href))};return t.addEventListener("click",n),()=>t.removeEventListener("click",n)}}),[e])}(c);const h=LT(r,c,["deleteMessage","delete-message","deletemessage","DeleteMessage"]),d=LT(n,c,["sendMessage","send-message","sendmessage","SendMessage"]),p={beforeBrowserPermissionPrompt:i,onMissingBrowserPermissionCallback:LT(s,c,["browserPermissionDenied","browser-permission-denied","browserpermissiondenied","BrowserPermissionDenied"])},{store:f,controller:m,editorInternals:E,session:g}=function(e,t,n){const r=e.appId,i=e.userId,s=e.conversationId,o=he((()=>JA.fromHost(e.host)),[e.host]),a=he((()=>new uo),[e.appId]);ue((()=>{a.state$.themeCustom.set(gn({value:e.themeCustom}))}),[a,e.themeCustom]);const u=he((()=>XA()),[e.appId,e.userId,e.token,e.tokenFetcher]),l=function(e){return e.forceCreateNew?new wT(e):RT.getOrCreate(e)}({apiUrls:o,appId:r,userId:i,token:e.token,tokenFetcher:e.tokenFetcher});ae((()=>{const e=l.onError((e=>{Ss.error(e.message),a.state$.errors.serverError.set(!0)}));return()=>e.unsubscribe()}),[l,a]);const c=he((()=>new zA(o,r,u,l._authProvider)),[r,u,l,o]),h=he((()=>new mm(a.state$.editor)),[a]),d=he((()=>new KA(a,l,h,t,n)),[l,a,h,t,n]);return h.controller=d,ae((()=>{"loading"!==a.state$.authTokenState.peek()&&a.state$.authTokenState.set("loading"),l._authProvider.getToken().then((()=>{a.state$.authTokenState.set("valid")}));const t=l._authProvider.onTokenRefreshFailed((()=>{a.state$.authTokenState.set(e.tokenFetcher?"invalid":"expired")}));return()=>{t()}}),[l,a,e.tokenFetcher]),ae((()=>{let e=!0;a.resetState(r,i,s);let t=null;const n=l.currentUser.subscribe((async n=>{if(e&&(a.state$.errors.unknownUser.set(!n),n&&(a.state$.currentUser.set(n),n.role!==t))){t=n.role;const r=await c.getApp(n.role);if(!e)return;a.state$.app.set(r)}})),o=l.conversation(s).subscribeMessages((async(t,n)=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&(await a.readyForNewMessagesPromise,a.storeMessages(s,t,n)))}));a.messageSubscription=o;const u=l.conversation(s).subscribeParticipants((t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.state$.participants.child(s).set(t))}));a.participantSubscription=u;const h=l.conversation(s).subscribe((async t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.state$.currentConversation.set(t))})),d=l.conversation(s).subscribeTyping((t=>{e&&(a.state$.errors.unknownConversation.set(!t),t&&a.storeTyping(s,t))}));return()=>{e=!1,n.unsubscribe(),u.unsubscribe(),h.unsubscribe(),o.unsubscribe(),d.unsubscribe(),a.messageSubscription=null}}),[s,i,r,c,l,a,d]),ae((()=>d.closeMessageActionMenusOnWindowClick()),[d]),{store:a,controller:d,editorInternals:h,session:l}}(e,d,h),A=de((async()=>{const e=E.state$;if(e.isEmpty.peek()||e.atTextLimit.peek())return;const t=E.getText(),n=f.state$.referencedMessageId.peek();n&&m.setReferencedMessage(null),E.clearText(),await m.sendMessage({text:t,referencedMessageId:n??void 0})}),[m,E,f]);ae((()=>{const t=e.enterSendsMessage??!0;E.onEnter=t?A:void 0}),[E,e.enterSendsMessage,A]),ae((()=>{E.spellcheck$.set(a)}),[E,a]),ae((()=>{E.placeholder$.set(o)}),[E,o]),ce(t,(()=>({deleteMessage:e=>m.deleteMessage(e),editMessage:(e,t)=>m.editMessage(e,t),sendMessage:e=>m.sendMessage(e),sendFileMessage:e=>m.sendFileMessage(e),sendLocationMessage:e=>m.sendLocationMessage(e),setReferencedMessage:e=>m.setReferencedMessage(e),openMessageActionMenu:e=>m.openMessageActionMenu(e),closeMessageActionMenu:()=>m.closeMessageActionMenu(),getMessageFieldText:()=>E.getText(),setMessageFieldText:e=>E.setText(e)})));const _=de((({error:t})=>It(Eo,{appId:e.appId,chatboxState:{type:"unexpected-error",error:t}})),[e.appId]);return It("div",u?{className:"t-chatbox",ref:c}:{className:"t-chatbox",ref:c,children:It(wt,{fallbackRender:_,children:It(ui.Provider,{value:E,children:It(ci.Provider,{value:f,children:It(oi.Provider,{value:e.theme,children:It(di.Provider,{value:p,children:It(FA,{controller:m,appId:e.appId,chatHeaderVisible:e.chatHeaderVisible??!0,messageFieldVisible:e.messageFieldVisible??!0,session:g,sendMessage:A})})})})})})})}));function FT({photoUrl:e}){return NA`
2
2
  <div
3
3
  className="t-theme-avatar"
4
- style=${{float:t,backgroundImage:`url(${e})`}}
4
+ style=${{backgroundImage:`url(${e})`}}
5
5
  />
6
6
  `}function xT({participants:e}){return NA`
7
7
  <div className="t-theme-group-chat-image">
@@ -51,9 +51,7 @@ var TalkChatbox=function(e){"use strict";var t,n,r,i,s,o,a,u,l,c,h,d,p={},f=[],m
51
51
  </text>
52
52
  </svg>`}
53
53
  </div>
54
- `}function BT({conversation:e,participants:t,currentUser:n}){return e.photoUrl?NA`<${FT} photoUrl=${e.photoUrl} />`:0===t.length?null:1===t.length?NA`<${FT} photoUrl=${SA(n)} />`:2===t.length?NA`<${FT}
55
- photoUrl=${SA((t[0].user.id===n.id?t[1]:t[0]).user)}
56
- />`:NA`<${xT} participants=${t} />`}function PT(e){const{conversation:t,participants:n,currentUser:r}=e;return t.subject?NA`
54
+ `}function BT({conversation:e,participants:t,currentUser:n}){return e.photoUrl?NA`<${FT} photoUrl=${e.photoUrl} />`:0===t.length?null:1===t.length?NA`<${FT} photoUrl=${SA(n)} />`:2===t.length?NA`<${FT} photoUrl=${SA(t[0].user.id===n.id?t[1].user:t[0].user)} />`:NA`<${xT} participants=${t} />`}function PT(e){const{conversation:t,participants:n,currentUser:r}=e;return t.subject?NA`
57
55
  <div className="t-title">${t.subject}</div>
58
56
  <div className="t-subtitle">
59
57
  ${UT(n,r)}
@@ -664,10 +662,6 @@ var TalkChatbox=function(e){"use strict";var t,n,r,i,s,o,a,u,l,c,h,d,p={},f=[],m
664
662
  ${e.ENTRYBOX_PLACEHOLDER_CHAT_READONLY}
665
663
  </div>
666
664
  </div>
667
- `:"None"===t.access?NA`
668
- <div className="t-theme-text-form">
669
- <div className="t-readonly">${e.ENTRYBOX_PLACEHOLDER_CHAT_CLOSED}</div>
670
- </div>
671
665
  `:NA`
672
666
  <div className="t-theme-text-form">
673
667
  <div className="t-textbox-column">
@@ -856,18 +850,18 @@ var TalkChatbox=function(e){"use strict";var t,n,r,i,s,o,a,u,l,c,h,d,p={},f=[],m
856
850
  />
857
851
  </div>
858
852
  </div>
859
- `},MessageListFooter:function(e){const{typing:t,t:n}=e,{users:r,many:i}=t;if(!i&&0===r.length)return null;const s=i?NA`<div className="t-theme-avatar">5+</div>`:r.slice(0,2).map((e=>NA`<${FT}
853
+ `},MessageListFooter:function(e){const{typing:t}=e,{users:n,many:r}=t;if(!r&&0===n.length)return null;const i=r?NA`<div className="t-theme-avatar">5+</div>`:n.slice(0,2).map((e=>NA`<${FT}
860
854
  key=${e.id}
861
855
  photoUrl=${SA(e)}
862
856
  />`));return NA`
863
857
  <div
864
858
  className="t-theme-message-list-footer"
865
- t-many=${String(i)}
866
- aria-label="${function(e,t){return t?"Several people are typing":1===e.length?`${e[0].name} is typing`:2===e.length?`${e[0].name} and ${e[1].name} are typing`:`${e[0].name}, ${e[1].name}, and ${e.length-2} others are typing`}(r,i)}"
859
+ t-many=${String(r)}
860
+ aria-label="${function(e,t){return t?"Several people are typing":1===e.length?`${e[0].name} is typing`:2===e.length?`${e[0].name} and ${e[1].name} are typing`:`${e[0].name}, ${e[1].name}, and ${e.length-2} others are typing`}(n,r)}"
867
861
  >
868
862
  <div className="t-typing-avatars" aria-hidden="true">
869
- ${s}
870
- ${!i&&r.length>2&&NA`<div className="t-theme-avatar">+${r.length-2}</div>`}
863
+ ${i}
864
+ ${!r&&n.length>2&&NA`<div className="t-theme-avatar">+${n.length-2}</div>`}
871
865
  </div>
872
866
  <div className="t-typing-bubble">
873
867
  <div className="t-typing-animation">