@talkjs/web-components 0.1.9 → 0.1.10
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.
- package/default.cjs +26 -27
- package/default.css +1 -1
- package/default.js +53 -44
- package/package.json +1 -1
package/default.cjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
`);return{dom:l,text:d,slice:e}}function TE(t,e,n,r,i){let o,s,a=i.parent.type.spec.code;if(!n&&!e)return null;let l=!!e&&(r||a||!n);if(l){if(t.someProp("transformPastedText",d=>{e=d(e,a||r,t)}),a)return s=new J(X.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
15
15
|
`))),0,0),t.someProp("transformPasted",d=>{s=d(s,t,!0)}),s;let h=t.someProp("clipboardTextParser",d=>d(e,i,r,t));if(h)s=h;else{let d=i.marks(),{schema:p}=t.state,f=Pi.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let E=o.appendChild(document.createElement("p"));m&&E.appendChild(f.serializeNode(p.text(m,d)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),o=function(h){let d=/^(\s*<meta [^>]*>)*/.exec(h);d&&(h=h.slice(d[0].length));let p,f=NE().createElement("div"),m=/<([a-z][^>\s]+)/i.exec(h);if((p=m&&yE[m[1].toLowerCase()])&&(h=p.map(E=>"<"+E+">").join("")+h+p.map(E=>"</"+E+">").reverse().join("")),f.innerHTML=function(E){let A=window.trustedTypes;return A?(tl||(tl=A.defaultPolicy||A.createPolicy("ProseMirrorClipboard",{createHTML:_=>_})),tl.createHTML(E)):E}(h),p)for(let E=0;E<p.length;E++)f=f.querySelector(p[E])||f;return f}(n),Fo&&function(h){let d=h.querySelectorAll(et?"span:not([class]):not([style])":"span.Apple-converted-space");for(let p=0;p<d.length;p++){let f=d[p];f.childNodes.length==1&&f.textContent==" "&&f.parentNode&&f.parentNode.replaceChild(h.ownerDocument.createTextNode(" "),f)}}(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let h=+c[3];h>0;h--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(s||(s=(t.someProp("clipboardParser")||t.someProp("domParser")||Ao.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!(!l&&!c),context:i,ruleFromNode:d=>d.nodeName!="BR"||d.nextSibling||!d.parentNode||PS.test(d.parentNode.nodeName)?null:{ignore:!0}})),c)s=function(h,d){if(!h.size)return h;let p,f=h.content.firstChild.type.schema;try{p=JSON.parse(d)}catch(_){return h}let{content:m,openStart:E,openEnd:A}=h;for(let _=p.length-2;_>=0;_-=2){let g=f.nodes[p[_]];if(!g||g.hasRequiredAttrs())break;m=X.from(g.create(p[_+1],m)),E++,A++}return new J(m,E,A)}(Lh(s,+c[1],+c[2]),c[4]);else if(s=J.maxOpen(function(h,d){if(h.childCount<2)return h;for(let p=d.depth;p>=0;p--){let f,m=d.node(p).contentMatchAt(d.index(p)),E=[];if(h.forEach(A=>{if(!E)return;let _,g=m.findWrapping(A.type);if(!g)return E=null;if(_=E.length&&f.length&&CE(g,f,A,E[E.length-1],0))E[E.length-1]=_;else{E.length&&(E[E.length-1]=IE(E[E.length-1],f.length));let O=RE(A,g);E.push(O),m=m.matchType(O.type),f=g}}),E)return X.from(E)}return h}(s.content,i),!0),s.openStart||s.openEnd){let h=0,d=0;for(let p=s.content.firstChild;h<s.openStart&&!p.type.spec.isolating;h++,p=p.firstChild);for(let p=s.content.lastChild;d<s.openEnd&&!p.type.spec.isolating;d++,p=p.lastChild);s=Lh(s,h,d)}return t.someProp("transformPasted",h=>{s=h(s,t,l)}),s}const PS=/^(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 RE(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,X.from(t));return t}function CE(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=CE(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(X.from(RE(n,t,i+1))))}}function IE(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,IE(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(X.empty,!0);return t.copy(n.append(r))}function ic(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(o=0),i<r-1&&(a=ic(a,e,n,r,i+1,o)),i>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(X.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Lh(t,e,n){return e<t.openStart&&(t=new J(ic(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new J(ic(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const yE={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 wh=null;function NE(){return wh||(wh=document.implementation.createHTMLDocument("title"))}let tl=null;const Ot={},Tt={},xS={touchstart:!0,touchmove:!0};class FS{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function er(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>oc(t,r))})}function oc(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)})}function HS(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Hs(t){return{left:t.clientX,top:t.clientY}}function pu(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,a=>s>o.depth?a(t,n,o.nodeAfter,o.before(s),i,!0):a(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function fi(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function US(t,e,n,r,i){return pu(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?function(o,s){if(s==-1)return!1;let a,l,u=o.state.selection;u instanceof re&&(a=u.node);let c=o.state.doc.resolve(s);for(let h=c.depth+1;h>0;h--){let d=h>c.depth?c.nodeAfter:c.node(h);if(re.isSelectable(d)){l=a&&u.$from.depth>0&&h>=u.$from.depth&&c.before(u.$from.depth+1)==u.$from.pos?c.before(u.$from.depth):c.before(h);break}}return l!=null&&(fi(o,re.create(o.state.doc,l)),!0)}(t,n):function(o,s){if(s==-1)return!1;let a=o.state.doc.resolve(s),l=a.nodeAfter;return!!(l&&l.isAtom&&re.isSelectable(l))&&(fi(o,new re(a)),!0)}(t,n))}function BS(t,e,n,r){return pu(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function jS(t,e,n,r){return pu(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||function(i,o,s){if(s.button!=0)return!1;let a=i.state.doc;if(o==-1)return!!a.inlineContent&&(fi(i,Ee.create(a,0,a.content.size)),!0);let l=a.resolve(o);for(let u=l.depth+1;u>0;u--){let c=u>l.depth?l.nodeAfter:l.node(u),h=l.before(u);if(c.inlineContent)fi(i,Ee.create(a,h+1,h+1+c.content.size));else{if(!re.isSelectable(c))continue;fi(i,re.create(a,h))}return!0}}(t,n,r)}function sc(t){return Us(t)}Tt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Mh(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!Mn||!et||n.keyCode!=13))if(n.keyCode!=229&&t.domObserver.forceFlush(),!yi||n.keyCode!=13||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",r=>r(t,n))||MS(t,n)?n.preventDefault():er(t,"key");else{let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Dr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}},Tt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Tt.keypress=(t,e)=>{let n=e;if(Mh(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Yt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n)))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof Ee&&r.$from.sameParent(r.$to))){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();/[\r\n]/.test(i)||t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))||t.dispatch(o()),n.preventDefault()}};const bE=Yt?"metaKey":"ctrlKey";Ot.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=sc(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&function(a,l){let u=l.x-a.clientX,c=l.y-a.clientY;return u*u+c*c<100}(n,t.input.lastClick)&&!n[bE]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let s=t.posAtCoords(Hs(n));s&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new $S(t,s,n,!!r)):(o=="doubleClick"?BS:jS)(t,s.pos,s.inside,n)?n.preventDefault():er(t,"pointer"))};class $S{constructor(e,n,r,i){let o,s;if(this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[bE],this.allowDefault=r.shiftKey,n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);o=c.parent,s=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||u instanceof re&&u.from<=s&&u.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Kt||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)),er(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(()=>Fn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Hs(e))),this.updateAllowDefault(e),this.allowDefault||!n?er(this.view,"pointer"):US(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ct&&this.mightDrag&&!this.mightDrag.node.isAtom||et&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(fi(this.view,Ae.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):er(this.view,"pointer")}move(e){this.updateAllowDefault(e),er(this.view,"pointer"),e.buttons==0&&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 Mh(t,e){return!!t.composing||!!(ct&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}Ot.touchstart=t=>{t.input.lastTouch=Date.now(),sc(t),er(t,"pointer")},Ot.touchmove=t=>{t.input.lastTouch=Date.now(),er(t,"pointer")},Ot.contextmenu=t=>sc(t);const VS=Mn?5e3:-1;function Ph(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Us(t),e))}function kE(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function zS(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=function(i,o){for(;;){if(i.nodeType==3&&o)return i;if(i.nodeType==1&&o>0){if(i.contentEditable=="false")return null;o=Gt(i=i.childNodes[o-1])}else{if(!i.parentNode||Oo(i))return null;o=lt(i),i=i.parentNode}}}(e.focusNode,e.focusOffset),r=function(i,o){for(;;){if(i.nodeType==3&&o<i.nodeValue.length)return i;if(i.nodeType==1&&o<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[o],o=0}else{if(!i.parentNode||Oo(i))return null;o=lt(i)+1,i=i.parentNode}}}(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(s&&s.isText(n.nodeValue))return r}}return n||r}function Us(t,e=!1){if(!(Mn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),kE(t),e||t.docView&&t.docView.dirty){let n=uu(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):!t.markCursor&&!e||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}Tt.compositionstart=Tt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Ee&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||et&&pE&&function(r){let{focusNode:i,focusOffset:o}=r.domSelectionRange();if(!i||i.nodeType!=1||o>=i.childNodes.length)return!1;let s=i.childNodes[o];return s.nodeType==1&&s.contentEditable=="false"}(t)))t.markCursor=t.state.storedMarks||n.marks(),Us(t,!0),t.markCursor=null;else if(Us(t,!e.selection.empty),Kt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}i=s,o=-1}}t.input.composing=!0}Ph(t,VS)},Tt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Ph(t,20))};const ro=bt&&rr<15||yi&&DS<604;function io(t,e,n,r,i){let o=TE(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,o||J.empty)))return!0;if(!o)return!1;let s=function(l){return l.openStart==0&&l.openEnd==0&&l.content.childCount==1?l.content.firstChild:null}(o),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function LE(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ot.copy=Tt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=ro?null:n.clipboardData,s=r.content(),{dom:a,text:l}=hu(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function(u,c){if(!u.dom.parentNode)return;let h=u.dom.parentNode.appendChild(document.createElement("div"));h.appendChild(c),h.style.cssText="position: fixed; left: -10000px; top: 10px";let d=getSelection(),p=document.createRange();p.selectNodeContents(c),u.dom.blur(),d.removeAllRanges(),d.addRange(p),setTimeout(()=>{h.parentNode&&h.parentNode.removeChild(h),u.focus()},50)}(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Tt.paste=(t,e)=>{let n=e;if(t.composing&&!Mn)return;let r=ro?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&io(t,LE(r),r.getData("text/html"),i,n)?n.preventDefault():function(o,s){if(!o.dom.parentNode)return;let a=o.input.shiftKey||o.state.selection.$from.parent.type.spec.code,l=o.dom.parentNode.appendChild(document.createElement(a?"textarea":"div"));a||(l.contentEditable="true"),l.style.cssText="position: fixed; left: -10000px; top: 10px",l.focus();let u=o.input.shiftKey&&o.input.lastKeyCode!=45;setTimeout(()=>{o.focus(),l.parentNode&&l.parentNode.removeChild(l),a?io(o,l.value,null,u,s):io(o,l.textContent,l.innerHTML,u,s)},50)}(t,n)};class wE{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const YS=Yt?"altKey":"ctrlKey";function xh(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n!=null?n:!e[YS]}Ot.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,o=t.state.selection,s=o.empty?null:t.posAtCoords(Hs(n));if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof re?o.to-1:o.to))){if(r&&r.mightDrag)i=re.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(i=re.create(t.state.doc,h.posBefore))}}let a=(i||t.state.selection).content(),{dom:l,text:u,slice:c}=hu(t,a);(!n.dataTransfer.files.length||!et||hE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ro?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ro||n.dataTransfer.setData("text/plain",u),t.dragging=new wE(c,xh(t,n),i)},Ot.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Tt.dragover=Tt.dragenter=(t,e)=>e.preventDefault(),Tt.drop=(t,e)=>{try{(function(n,r,i){if(!r.dataTransfer)return;let o=n.posAtCoords(Hs(r));if(!o)return;let s=n.state.doc.resolve(o.pos),a=i&&i.slice;a?n.someProp("transformPasted",m=>{a=m(a,n,!1)}):a=TE(n,LE(r.dataTransfer),ro?null:r.dataTransfer.getData("text/html"),!1,s);let l=!(!i||!xh(n,r));if(n.someProp("handleDrop",m=>m(n,r,a||J.empty,l)))return void r.preventDefault();if(!a)return;r.preventDefault();let u=a?function(m,E,A){let _=m.resolve(E);if(!A.content.size)return E;let g=A.content;for(let O=0;O<A.openStart;O++)g=g.firstChild.content;for(let O=1;O<=(A.openStart==0&&A.size?2:1);O++)for(let D=_.depth;D>=0;D--){let R=D==_.depth?0:_.pos<=(_.start(D+1)+_.end(D+1))/2?-1:1,T=_.index(D)+(R>0?1:0),I=_.node(D),S=!1;if(O==1)S=I.canReplace(T,T,g);else{let v=I.contentMatchAt(T).findWrapping(g.firstChild.type);S=v&&I.canReplaceWith(T,T,v[0])}if(S)return R==0?_.pos:R<0?_.before(D+1):_.after(D+1)}return null}(n.state.doc,s.pos,a):s.pos;u==null&&(u=s.pos);let c=n.state.tr;if(l){let{node:m}=i;m?m.replace(c):c.deleteSelection()}let h=c.mapping.map(u),d=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,p=c.doc;if(d?c.replaceRangeWith(h,h,a.content.firstChild):c.replaceRange(h,h,a),c.doc.eq(p))return;let f=c.doc.resolve(h);if(d&&re.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new re(f));else{let m=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((E,A,_,g)=>m=g),c.setSelection(du(n,f,c.doc.resolve(m)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))})(t,e,t.dragging)}finally{t.dragging=null}},Ot.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Fn(t)},20))},Ot.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Ot.beforeinput=(t,e)=>{if(et&&Mn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Dr(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Tt)Ot[t]=Tt[t];function Do(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Bs{constructor(e,n){this.toDOM=e,this.spec=n||kr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Ht(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Bs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Do(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class or{constructor(e,n){this.attrs=e,this.spec=n||kr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ht(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof or&&Do(this.attrs,e.attrs)&&Do(this.spec,e.spec)}static is(e){return e.type instanceof or}destroy(){}}class fu{constructor(e,n){this.attrs=e,this.spec=n||kr}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ht(o.pos-r,s.pos-r,this)}valid(e,n){let r,{index:i,offset:o}=e.content.findIndex(n.from);return o==n.from&&!(r=e.child(i)).isText&&o+r.nodeSize==n.to}eq(e){return this==e||e instanceof fu&&Do(this.attrs,e.attrs)&&Do(this.spec,e.spec)}destroy(){}}class Ht{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Ht(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Ht(e,e,new Bs(n,r))}static inline(e,n,r,i){return new Ht(e,n,new or(r,i))}static node(e,n,r,i){return new Ht(e,n,new fu(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof or}get widget(){return this.type instanceof Bs}}const ti=[],kr={};class je{constructor(e,n){this.local=e.length?e:ti,this.children=n.length?n:ti}static create(e,n){return n.length?_s(n,e,0,kr):ht}find(e,n,r){let i=[];return this.findInner(e==null?0:e,n==null?1e9:n,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,i+a,o)}}map(e,n,r){return this==ht||e.maps.length==0?this:this.mapInner(e,n,0,0,r||kr)}mapInner(e,n,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?function(a,l,u,c,h,d,p){let f=a.slice();for(let E=0,A=d;E<u.maps.length;E++){let _=0;u.maps[E].forEach((g,O,D,R)=>{let T=R-D-(O-g);for(let I=0;I<f.length;I+=3){let S=f[I+1];if(S<0||g>S+A-_)continue;let v=f[I]+A-_;O>=v?f[I+1]=g<=v?-2:-1:g>=A&&T&&(f[I]+=T,f[I+1]+=T)}_+=T}),A=u.maps[E].map(A,-1)}let m=!1;for(let E=0;E<f.length;E+=3)if(f[E+1]<0){if(f[E+1]==-2){m=!0,f[E+1]=-1;continue}let A=u.map(a[E]+d),_=A-h;if(_<0||_>=c.content.size){m=!0;continue}let g=u.map(a[E+1]+d,-1)-h,{index:O,offset:D}=c.content.findIndex(_),R=c.maybeChild(O);if(R&&D==_&&D+R.nodeSize==g){let T=f[E+2].mapInner(u,R,A+1,a[E]+d+1,p);T!=ht?(f[E]=_,f[E+1]=g,f[E+2]=T):(f[E+1]=-2,m=!0)}else m=!0}if(m){let E=function(_,g,O,D,R,T,I){function S(v,y){for(let b=0;b<v.local.length;b++){let M=v.local[b].map(D,R,y);M?O.push(M):I.onRemove&&I.onRemove(v.local[b].spec)}for(let b=0;b<v.children.length;b+=3)S(v.children[b+2],v.children[b]+y+1)}for(let v=0;v<_.length;v+=3)_[v+1]==-1&&S(_[v+2],g[v]+T+1);return O}(f,a,l,u,h,d,p),A=_s(E,c,0,p);l=A.local;for(let _=0;_<f.length;_+=3)f[_+1]<0&&(f.splice(_,3),_-=3);for(let _=0,g=0;_<A.children.length;_+=3){let O=A.children[_];for(;g<f.length&&f[g]<O;)g+=3;f.splice(g,0,A.children[_],A.children[_+1],A.children[_+2])}}return new je(l.sort(Rr),f)}(this.children,s||[],e,n,r,i,o):s?new je(s.sort(Rr),ti):ht}add(e,n){return n.length?this==ht?je.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((a,l)=>{let u,c=l+r;if(u=PE(n,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,u,c+1):i.splice(o,0,l,l+a.nodeSize,_s(u,a,c+1,kr)),o+=3}});let s=ME(o?xE(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new je(s.length?this.local.concat(s).sort(Rr):this.local,i||this.children)}remove(e){return e.length==0||this==ht?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+n,l=r[o+1]+n;for(let c,h=0;h<e.length;h++)(c=e[h])&&c.from>a&&c.to<l&&(e[h]=null,(s||(s=[])).push(c));if(!s)continue;r==this.children&&(r=this.children.slice());let u=r[o+2].removeInner(s,a+1);u!=ht?r[o+2]=u:(r.splice(o,3),o-=3)}if(i.length){for(let o,s=0;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new je(i,r):ht}forChild(e,n){if(this==ht)return this;if(n.isLeaf)return je.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let o=e+1,s=o+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof or){let u=Math.max(o,l.from)-o,c=Math.min(s,l.to)-o;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new je(i.sort(Rr),ti);return r?new qn([a,r]):a}return r||ht}eq(e){if(this==e)return!0;if(!(e instanceof je)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return mu(this.localsInner(e))}localsInner(e){if(this==ht)return ti;if(e.inlineContent||!this.local.some(or.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof or||n.push(this.local[r]);return n}forEachSet(e){e(this)}}je.empty=new je([],[]),je.removeOverlap=mu;const ht=je.empty;class qn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,kr));return qn.from(r)}forChild(e,n){if(n.isLeaf)return je.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=ht&&(o instanceof qn?r=r.concat(o.members):r.push(o))}return qn.from(r)}eq(e){if(!(e instanceof qn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(n){r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}else n=o}return n?mu(r?n:n.sort(Rr)):ti}static from(e){switch(e.length){case 0:return ht;case 1:return e[0];default:return new qn(e.every(n=>n instanceof je)?e:e.reduce((n,r)=>n.concat(r instanceof je?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function ME(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ht(i.from+e,i.to+e,i.type))}return n}function PE(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o,s=0;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function xE(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function _s(t,e,n,r){let i=[],o=!1;e.forEach((a,l)=>{let u=PE(t,a,l+n);if(u){o=!0;let c=_s(u,a,n+l+1,r);c!=ht&&i.push(l,l+a.nodeSize,c)}});let s=ME(o?xE(t):t,-n).sort(Rr);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new je(s,i):ht}function Rr(t,e){return t.from-e.from||t.to-e.to}function mu(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from!=r.from){o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),Fh(e,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),Fh(e,i+1,o.copy(r.to,o.to)))}}return e}function Fh(t,e,n){for(;e<t.length&&Rr(n,t[e])>0;)e++;t.splice(e,0,n)}function rl(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ht&&e.push(r)}),t.cursorWrapper&&e.push(je.create(t.state.doc,[t.cursorWrapper.deco])),qn.from(e)}const GS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},WS=bt&&rr<=11;class XS{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 KS{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new XS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);bt&&rr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():ct&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),WS&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,GS)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(Rh(this.view)){if(this.suppressingSelectionUpdates)return Fn(this.view);if(bt&&rr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&xr(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 n,r=new Set;for(let o=e.focusNode;o;o=Ii(o))r.add(o);for(let o=e.anchorNode;o;o=Ii(o))if(r.has(o)){n=o;break}let i=n&&this.view.docView.nearestDesc(n);return i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n})?(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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Rh(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let h=this.registerMutation(n[c],l);h&&(o=o<0?h.from:Math.min(h.from,o),s=s<0?h.to:Math.max(h.to,s),h.typeOver&&(a=!0))}if(Kt&&l.length){let c=l.filter(h=>h.nodeName=="BR");if(c.length==2){let[h,d]=c;h.parentNode&&h.parentNode.parentNode==d.parentNode?d.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let d of c){let p=d.parentNode;!p||p.nodeName!="LI"||h&&qS(e,h)==p||d.remove()}}}else if((et||ct)&&l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let h=c.nextSibling;h&&h.nodeType==1&&h.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ga(r)&&(u=uu(e))&&u.eq(Ae.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Fn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),function(c){if(!Hh.has(c)&&(Hh.set(c,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(c.dom).whiteSpace)!==-1)){if(c.requiresGeckoHackNode=Kt,Uh)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."),Uh=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(c,h){var d;let{focusNode:p,focusOffset:f}=c.domSelectionRange();for(let m of h)if(((d=m.parentNode)===null||d===void 0?void 0:d.nodeName)=="TR"){let E=m.nextSibling;for(;E&&E.nodeName!="TD"&&E.nodeName!="TH";)E=E.nextSibling;if(E){let A=E;for(;;){let _=A.firstChild;if(!_||_.nodeType!=1||_.contentEditable=="false"||/^(BR|IMG)$/.test(_.nodeName))break;A=_}A.insertBefore(m,A.firstChild),p==m&&c.domSelection().collapse(m,f)}else m.parentNode.removeChild(m)}}(e,l)),this.handleDOMChange(o,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Fn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let c=e.addedNodes[u];n.push(c),c.nodeType==3&&(this.lastChangedTextNode=c)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(bt&&rr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:c,nextSibling:h}=e.addedNodes[u];(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(i=c),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?lt(i)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=o&&o.parentNode==e.target?lt(o):e.target.childNodes.length;return{from:a,to:r.localPosFromDOM(e.target,l,1)}}return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Hh=new WeakMap,Uh=!1;function Bh(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return xr(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function qS(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function JS(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ct&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(t.parentNode.lastChild==t||ct&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ZS=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function QS(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=uu(t,T);if(I&&!t.state.selection.eq(I)){if(et&&Mn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",v=>v(t,Dr(13,"Enter"))))return;let S=t.state.tr.setSelection(I);T=="pointer"?S.setMeta("pointer",!0):T=="key"&&S.scrollIntoView(),o&&S.setMeta("composition",o),t.dispatch(S)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l,u,c=t.state.selection,h=function(T,I,S){let v,{node:y,fromOffset:b,toOffset:M,from:k,to:P}=T.docView.parseRange(I,S),B=T.domSelectionRange(),F=B.anchorNode;if(F&&T.dom.contains(F.nodeType==1?F:F.parentNode)&&(v=[{node:F,offset:B.anchorOffset}],ga(B)||v.push({node:B.focusNode,offset:B.focusOffset})),et&&T.input.lastKeyCode===8)for(let ie=M;ie>b;ie--){let ue=y.childNodes[ie-1],le=ue.pmViewDesc;if(ue.nodeName=="BR"&&!le){M=ie;break}if(!le||le.size)break}let V=T.state.doc,G=T.someProp("domParser")||Ao.fromSchema(T.state.schema),z=V.resolve(k),K=null,_e=G.parse(y,{topNode:z.parent,topMatch:z.parent.contentMatchAt(z.index()),topOpen:!0,from:b,to:M,preserveWhitespace:z.parent.type.whitespace!="pre"||"full",findPositions:v,ruleFromNode:JS,context:z});if(v&&v[0].pos!=null){let ie=v[0].pos,ue=v[1]&&v[1].pos;ue==null&&(ue=ie),K={anchor:ie+k,head:ue+k}}return{doc:_e,sel:K,from:k,to:P}}(t,e,n),d=t.state.doc,p=d.slice(h.from,h.to);t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(l=t.state.selection.to,u="end"):(l=t.state.selection.from,u="start"),t.input.lastKeyCode=null;let f=function(T,I,S,v,y){let b=T.findDiffStart(I,S);if(b==null)return null;let{a:M,b:k}=T.findDiffEnd(I,S+T.size,S+I.size);if(y=="end"&&(v-=M+Math.max(0,b-Math.min(M,k))-b),M<b&&T.size<I.size){let P=v<=b&&v>=M?b-v:0;b-=P,b&&b<I.size&&$h(I.textBetween(b-1,b+1))&&(b+=P?1:-1),k=b+(k-M),M=b}else if(k<b){let P=v<=b&&v>=k?b-v:0;b-=P,b&&b<T.size&&$h(T.textBetween(b-1,b+1))&&(b+=P?1:-1),M=b+(M-k),k=b}return{start:b,endA:M,endB:k}}(p.content,h.doc.content,h.from,l,u);if(f&&t.input.domChangeCount++,(yi&&t.input.lastIOSEnter>Date.now()-225||Mn)&&i.some(T=>T.nodeType==1&&!ZS.test(T.nodeName))&&(!f||f.endA>=f.endB)&&t.someProp("handleKeyDown",T=>T(t,Dr(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(!f){if(!(r&&c instanceof Ee&&!c.empty&&c.$head.sameParent(c.$anchor))||t.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let T=jh(t,t.state.doc,h.sel);if(T&&!T.eq(t.state.selection)){let I=t.state.tr.setSelection(T);o&&I.setMeta("composition",o),t.dispatch(I)}}return}f={start:c.from,endA:c.to,endB:c.to}}t.state.selection.from<t.state.selection.to&&f.start==f.endB&&t.state.selection instanceof Ee&&(f.start>t.state.selection.from&&f.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?f.start=t.state.selection.from:f.endA<t.state.selection.to&&f.endA>=t.state.selection.to-2&&t.state.selection.to<=h.to&&(f.endB+=t.state.selection.to-f.endA,f.endA=t.state.selection.to)),bt&&rr<=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=h.doc.resolveNoCache(f.start-h.from),E=h.doc.resolveNoCache(f.endB-h.from),A=d.resolve(f.start),_=m.sameParent(E)&&m.parent.inlineContent&&A.end()>=f.endA;if((yi&&t.input.lastIOSEnter>Date.now()-225&&(!_||i.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!_&&m.pos<h.doc.content.size&&(!m.sameParent(E)||!m.parent.inlineContent)&&m.pos<E.pos&&!/\S/.test(h.doc.textBetween(m.pos,E.pos,"","")))&&t.someProp("handleKeyDown",T=>T(t,Dr(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>f.start&&function(T,I,S,v,y){if(S-I<=y.pos-v.pos||il(v,!0,!1)<y.pos)return!1;let b=T.resolve(I);if(!v.parent.isTextblock){let k=b.nodeAfter;return k!=null&&S==I+k.nodeSize}if(b.parentOffset<b.parent.content.size||!b.parent.isTextblock)return!1;let M=T.resolve(il(b,!0,!0));return!(!M.parent.isTextblock||M.pos>S||il(M,!0,!1)<S)&&v.parent.content.cut(v.parentOffset).eq(M.parent.content)}(d,f.start,f.endA,m,E)&&t.someProp("handleKeyDown",T=>T(t,Dr(8,"Backspace"))))return void(Mn&&et&&t.domObserver.suppressSelectionUpdates());et&&f.endB==f.start&&(t.input.lastChromeDelete=Date.now()),Mn&&!_&&m.start()!=E.start()&&E.parentOffset==0&&m.depth==E.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,E=h.doc.resolveNoCache(f.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,Dr(13,"Enter"))})},20));let g,O=f.start,D=f.endA,R=T=>{let I=T||t.state.tr.replace(O,D,h.doc.slice(f.start-h.from,f.endB-h.from));if(h.sel){let S=jh(t,I.doc,h.sel);S&&!(et&&t.composing&&S.empty&&(f.start!=f.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==O||S.head==I.mapping.map(D)-1)||bt&&S.empty&&S.head==O)&&I.setSelection(S)}return o&&I.setMeta("composition",o),I.scrollIntoView()};if(_)if(m.pos==E.pos){bt&&rr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Fn(t),20));let T=R(t.state.tr.delete(O,D)),I=d.resolve(f.start).marksAcross(d.resolve(f.endA));I&&T.ensureMarks(I),t.dispatch(T)}else if(f.endA==f.endB&&(g=function(T,I){let S,v,y,b=T.firstChild.marks,M=I.firstChild.marks,k=b,P=M;for(let F=0;F<M.length;F++)k=M[F].removeFromSet(k);for(let F=0;F<b.length;F++)P=b[F].removeFromSet(P);if(k.length==1&&P.length==0)v=k[0],S="add",y=F=>F.mark(v.addToSet(F.marks));else{if(k.length!=0||P.length!=1)return null;v=P[0],S="remove",y=F=>F.mark(v.removeFromSet(F.marks))}let B=[];for(let F=0;F<I.childCount;F++)B.push(y(I.child(F)));if(X.from(B).eq(T))return{mark:v,type:S}}(m.parent.content.cut(m.parentOffset,E.parentOffset),A.parent.content.cut(A.parentOffset,f.endA-A.start())))){let T=R(t.state.tr);g.type=="add"?T.addMark(O,D,g.mark):T.removeMark(O,D,g.mark),t.dispatch(T)}else if(m.parent.child(m.index()).isText&&m.index()==E.index()-(E.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,E.parentOffset),I=()=>R(t.state.tr.insertText(T,O,D));t.someProp("handleTextInput",S=>S(t,O,D,T,I))||t.dispatch(I())}else t.dispatch(R());else t.dispatch(R())}function jh(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:du(t,e.resolve(n.anchor),e.resolve(n.head))}function il(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function $h(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class FE{constructor(e,n){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 FS,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.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):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Yh(this),zh(this),this.nodeViews=Gh(this),this.docView=Ah(this.state.doc,Vh(this),rl(this),this.dom,this),this.domObserver=new KS(this,(r,i,o,s)=>QS(this,r,i,o,s)),this.domObserver.start(),function(r){for(let i in Ot){let o=Ot[i];r.dom.addEventListener(i,r.input.eventHandlers[i]=s=>{!HS(r,s)||oc(r,s)||!r.editable&&s.type in Tt||o(r,s)},xS[i]?{passive:!0}:void 0)}ct&&r.dom.addEventListener("input",()=>null),nl(r)}(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(kE(this),s=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Gh(this);(function(f,m){let E=0,A=0;for(let _ in f){if(f[_]!=m[_])return!0;E++}for(let _ in m)A++;return E!=A})(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&nl(this),this.editable=Yh(this),zh(this);let l=rl(this),u=Vh(this),c=i.plugins==e.plugins||i.doc.eq(e.doc)?e.scrollToSelection>i.scrollToSelection?"to selection":"preserve":"reset",h=o||!this.docView.matchesNode(e.doc,u,l);!h&&e.selection.eq(i.selection)||(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&function(p){let f,m,E=p.dom.getBoundingClientRect(),A=Math.max(0,E.top);for(let _=(E.left+E.right)/2,g=A+1;g<Math.min(innerHeight,E.bottom);g+=5){let O=p.root.elementFromPoint(_,g);if(!O||O==p.dom||!p.dom.contains(O))continue;let D=O.getBoundingClientRect();if(D.top>=A-20){f=O,m=D.top;break}}return{refDOM:f,refTop:m,stack:dh(p.dom)}}(this);if(s){this.domObserver.stop();let p=h&&(bt||et)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&function(f,m){let E=Math.min(f.$anchor.sharedDepth(f.head),m.$anchor.sharedDepth(m.head));return f.$anchor.start(E)!=m.$anchor.start(E)}(i.selection,e.selection);if(h){let f=et?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zS(this)),!o&&this.docView.update(e.doc,u,l,this)||(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Ah(e.doc,u,l,this.dom,this)),!f||this.trackWrites&&this.dom.contains(this.trackWrites)||(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(f){let m=f.docView.domFromPos(f.state.selection.anchor,0),E=f.domSelectionRange();return xr(m.node,m.offset,E.anchorNode,E.anchorOffset)}(this))?Fn(this,p):(DE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&function({refDOM:p,refTop:f,stack:m}){let E=p?p.getBoundingClientRect().top:0;hh(m,E==0?0:E-f)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(e.nodeType==1?e:e.parentNode)&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof re){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&uh(this,n.getBoundingClientRect(),e)}else uh(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 n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new wE(e.slice,e.move,i<0?void 0:re.create(this.state.doc,i))}someProp(e,n){let r,i=this._props&&this._props[e];if(i!=null&&(r=n?n(i):i))return r;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(r=n?n(a):a))return r}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[e];if(a!=null&&(r=n?n(a):a))return r}}hasFocus(){if(bt){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(e.contentEditable=="false")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(Jr)return e.focus(Jr);let n=dh(e);e.focus(Jr==null?{get preventScroll(){return Jr={preventScroll:!0},!0}}:void 0),Jr||(Jr=!1,hh(n,0))}(this.dom),Fn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return RS(this,e)}coordsAtPos(e,n=1){return EE(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return yS(this,n||this.state,e)}pasteHTML(e,n){return io(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return io(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return hu(this,e)}destroy(){this.docView&&(function(e){e.domObserver.stop();for(let n in e.input.eventHandlers)e.dom.removeEventListener(n,e.input.eventHandlers[n]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rl(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jl=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return function(n,r){oc(n,r)||!Ot[r.type]||!n.editable&&r.type in Tt||Ot[r.type](n,r)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?ct&&this.root.nodeType===11&&function(n){let r=n.activeElement;for(;r&&r.shadowRoot;)r=r.shadowRoot.activeElement;return r}(this.dom.ownerDocument)==this.dom&&function(n,r){if(r.getComposedRanges){let s=r.getComposedRanges(n.root)[0];if(s)return Bh(n,s)}let i;function o(s){s.preventDefault(),s.stopImmediatePropagation(),i=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),i?Bh(n,i):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Vh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:e[r]||r=="contenteditable"||r=="nodeName"||(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ht.node(0,t.state.doc.content.size,e)]}function zh(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ht.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Yh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Gh(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Wh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}FE.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};const Xe=new class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let r in t)e[r]=t[r];e.nodes=ot.from(t.nodes),e.marks=ot.from(t.marks||{}),this.nodes=zd.compile(this.spec.nodes,this),this.marks=ma.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 i=this.nodes[r],o=i.spec.content||"",s=i.spec.marks;if(i.contentMatch=n[o]||(n[o]=Mr.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=s=="_"?null:s?Yd(this,s.split(" ")):s!=""&&i.inlineContent?null:[]}for(let r in this.marks){let i=this.marks[r],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Yd(this,o.split(" "))}this.nodeFromJSON=r=>Nr.fromJSON(this,r),this.markFromJSON=r=>ge.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,r){if(typeof t=="string")t=this.nodeType(t);else{if(!(t instanceof zd))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new xs(n,n.defaultAttrs,t,ge.setFrom(e))}mark(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}({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:t=>["span",{"data-mention-id":t.attrs.id,class:"t-mention"},`@${t.attrs.name}`],parseDOM:[{tag:"span[data-mention-id]",getAttrs:t=>({id:t.dataset["mention-id"]})}]},customemoji:{group:"inline",inline:!0,attrs:{name:{},url:{}},content:"text*",selectable:!1,toDOM:t=>["img",{src:t.attrs.url,alt:t.attrs.name,"data-custom-emoji":t.attrs.name}],parseDOM:[{tag:"img[data-custom-emoji]",getAttrs:t=>{const e=t;return{name:e.dataset.customEmoji,url:e.src}}}]}},marks:{literal:{toDOM:()=>["span",{"data-literal":""}],parseDOM:[{tag:"span[data-literal]"}]},bold:{toDOM:()=>["b"],parseDOM:[{tag:"b"}]},italic:{toDOM:()=>["i"],parseDOM:[{tag:"i"}]},strikethrough:{toDOM:()=>["del"],parseDOM:[{tag:"del"}]},emoji:{attrs:{emoji:{}},toDOM:t=>["span",{"data-emoji":t.attrs.emoji},t.attrs.emoji],parseDOM:[{tag:"span[data-emoji]",getAttrs:t=>({emoji:t.dataset.emoji})}]}}}),ol=new Aa("placeholder"),Xh=new _a({key:ol,props:{decorations(t){if(HE(t.doc))return;const e=t.doc.firstChild,n=Ht.node(0,e.nodeSize,{class:"empty-node","data-placeholder":ol.getState(t)});return je.create(t.doc,[n])}},state:{init:()=>"",apply:(t,e)=>{var n;return(n=t.getMeta(ol))!=null?n:e}}});function HE(t){return t.childCount!==1||t.firstChild.childCount!==0}for(var ar={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:"'"},js={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},eO=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),tO=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),st=0;st<10;st++)ar[48+st]=ar[96+st]=String(st);for(st=1;st<=24;st++)ar[st+111]="F"+st;for(st=65;st<=90;st++)ar[st]=String.fromCharCode(st+32),js[st]=String.fromCharCode(st);for(var sl in ar)js.hasOwnProperty(sl)||(js[sl]=ar[sl]);const nO=typeof navigator!="undefined"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function rO(t){let e,n,r,i,o=t.split(/-(?!$)/),s=o[o.length-1];s=="Space"&&(s=" ");for(let a=0;a<o.length-1;a++){let l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))e=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);nO?i=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function al(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Kh(t){return new _a({props:{handleKeyDown:iO(t)}})}function iO(t){let e=function(n){let r=Object.create(null);for(let i in n)r[rO(i)]=n[i];return r}(t);return function(n,r){let i,o=function(a){var l=!(eO&&a.metaKey&&a.shiftKey&&!a.ctrlKey&&!a.altKey||tO&&a.shiftKey&&a.key&&a.key.length==1||a.key=="Unidentified")&&a.key||(a.shiftKey?js:ar)[a.keyCode]||a.key||"Unidentified";return l=="Esc"&&(l="Escape"),l=="Del"&&(l="Delete"),l=="Left"&&(l="ArrowLeft"),l=="Up"&&(l="ArrowUp"),l=="Right"&&(l="ArrowRight"),l=="Down"&&(l="ArrowDown"),l}(r),s=e[al(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[al(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=ar[r.keyCode])&&i!=o){let a=e[al(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var $s=200,Qe=function(){};Qe.prototype.append=function(t){return t.length?(t=Qe.from(t),!this.length&&t||t.length<$s&&this.leafAppend(t)||this.length<$s&&t.leafPrepend(this)||this.appendInner(t)):this},Qe.prototype.prepend=function(t){return t.length?Qe.from(t).append(this):this},Qe.prototype.appendInner=function(t){return new oO(this,t)},Qe.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Qe.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Qe.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Qe.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Qe.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(i,o){return r.push(t(i,o))},e,n),r},Qe.from=function(t){return t instanceof Qe?t:t&&t.length?new UE(t):Qe.empty};var UE=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,o,s){for(var a=i;a<o;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){for(var a=i-1;a>=o;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=$s)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=$s)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Qe);Qe.empty=new UE([]);var oO=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,i,o){var s=this.left.length;return!(r<s&&this.left.forEachInner(n,r,Math.min(i,s),o)===!1)&&!(i>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,i)-s,o+s)===!1)&&void 0},e.prototype.forEachInvertedInner=function(n,r,i,o){var s=this.left.length;return!(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(i,s)-s,o+s)===!1)&&!(i<s&&this.left.forEachInvertedInner(n,Math.min(r,s),i,o)===!1)&&void 0},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(n,r):n>=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Qe);class Zt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r,i,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}n&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s,a,l=e.tr,u=[],c=[];return this.items.forEach((h,d)=>{if(!h.step)return r||(r=this.remapping(o,d+1),i=r.maps.length),i--,void c.push(h);if(r){c.push(new un(h.map));let p,f=h.step.map(r.slice(i));f&&l.maybeStep(f).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],u.push(new un(p,void 0,void 0,u.length+c.length))),i--,p&&r.appendMap(p,i)}else l.maybeStep(h.step);return h.selection?(s=r?h.selection.map(r.slice(i)):h.selection,a=new Zt(this.items.slice(0,o).append(c.reverse().concat(u)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:a,transform:l,selection:s}}addTransform(e,n,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let h,d=e.steps[c].invert(e.docs[c]),p=new un(e.mapping.maps[c],d,n);(h=l&&l.merge(p))&&(p=h,c?o.pop():a=a.slice(0,a.length-1)),o.push(p),n&&(s++,n=void 0),i||(l=p)}let u=s-r.depth;return u>sO&&(a=function(c,h){let d;return c.forEach((p,f)=>{if(p.selection&&h--==0)return d=f,!1}),c.slice(d)}(a,u),s-=u),new Zt(a.append(o),s)}remapping(e,n){let r=new go;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Zt(this.items.append(e.map(n=>new un(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(d=>{d.selection&&a--},i);let l=n;this.items.forEach(d=>{let p=o.getMirror(--l);if(p==null)return;s=Math.min(s,p);let f=o.maps[p];if(d.step){let m=e.steps[p].invert(e.docs[p]),E=d.selection&&d.selection.map(o.slice(l+1,p));E&&a++,r.push(new un(f,m,E))}else r.push(new un(f))},i);let u=[];for(let d=n;d<s;d++)u.push(new un(o.maps[d]));let c=this.items.slice(0,i).append(u).append(r),h=new Zt(c,a);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let h,d=new un(u.invert(),l,c),p=i.length-1;(h=i.length&&i[p].merge(d))?i[p]=h:i.push(d)}}else s.map&&r--},this.items.length,0),new Zt(Qe.from(i.reverse()),o)}}Zt.empty=new Zt(Qe.empty,0);class un{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new un(n.getMap().invert(),n,this.selection)}}}class Gn{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const sO=20;function qh(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function ll(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}let cl=!1,Jh=null;function As(t){let e=t.plugins;if(Jh!=e){cl=!1,Jh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cl=!0;break}}return cl}const Cr=new Aa("history"),aO=new Aa("closeHistory");function lO(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new _a({key:Cr,state:{init:()=>new Gn(Zt.empty,Zt.empty,null,0,-1),apply:(e,n,r)=>function(i,o,s,a){let l,u=s.getMeta(Cr);if(u)return u.historyState;s.getMeta(aO)&&(i=new Gn(i.done,i.undone,null,0,-1));let c=s.getMeta("appendedTransaction");if(s.steps.length==0)return i;if(c&&c.getMeta(Cr))return c.getMeta(Cr).redo?new Gn(i.done.addTransform(s,void 0,a,As(o)),i.undone,qh(s.mapping.maps),i.prevTime,i.prevComposition):new Gn(i.done,i.undone.addTransform(s,void 0,a,As(o)),null,i.prevTime,i.prevComposition);if(s.getMeta("addToHistory")===!1||c&&c.getMeta("addToHistory")===!1)return(l=s.getMeta("rebased"))?new Gn(i.done.rebased(s,l),i.undone.rebased(s,l),ll(i.prevRanges,s.mapping),i.prevTime,i.prevComposition):new Gn(i.done.addMaps(s.mapping.maps),i.undone.addMaps(s.mapping.maps),ll(i.prevRanges,s.mapping),i.prevTime,i.prevComposition);{let h=s.getMeta("composition"),d=i.prevTime==0||!c&&i.prevComposition!=h&&(i.prevTime<(s.time||0)-a.newGroupDelay||!function(f,m){if(!m)return!1;if(!f.docChanged)return!0;let E=!1;return f.mapping.maps[0].forEach((A,_)=>{for(let g=0;g<m.length;g+=2)A<=m[g+1]&&_>=m[g]&&(E=!0)}),E}(s,i.prevRanges)),p=c?ll(i.prevRanges,s.mapping):qh(s.mapping.maps);return new Gn(i.done.addTransform(s,d?o.selection.getBookmark():void 0,a,As(o)),Zt.empty,p,s.time,h==null?i.prevComposition:h)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?jE:r=="historyRedo"?ac:null;return!(!i||!e.editable)&&(n.preventDefault(),i(e.state,e.dispatch))}}}})}function BE(t,e){return(n,r)=>{let i=Cr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=function(s,a,l){let u=As(a),c=Cr.get(a).spec.config,h=(l?s.undone:s.done).popEvent(a,u);if(!h)return null;let d=h.selection.resolve(h.transform.doc),p=(l?s.done:s.undone).addTransform(h.transform,a.selection.getBookmark(),c,u),f=new Gn(l?p:h.remaining,l?h.remaining:p,null,0,-1);return h.transform.setSelection(d).setMeta(Cr,{redo:l,historyState:f})}(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const jE=BE(!1,!0),ac=BE(!0,!0),$E=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Ni(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}function Zh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Qh(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}function lc(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const cO=(t,e)=>{let{$from:n,$to:r}=t.selection;if(t.selection instanceof re&&t.selection.node.isBlock)return!(!n.parentOffset||!Es(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(e){let i=r.parentOffset==r.parent.content.size,o=t.tr;(t.selection instanceof Ee||t.selection instanceof Bt)&&o.deleteSelection();let s=n.depth==0?null:lc(n.node(-1).contentMatchAt(n.indexAfter(-1))),a=i&&s?[{type:s}]:void 0,l=Es(o.doc,o.mapping.map(n.pos),1,a);if(a||l||!Es(o.doc,o.mapping.map(n.pos),1,s?[{type:s}]:void 0)||(s&&(a=[{type:s}]),l=!0),l&&(o.split(o.mapping.map(n.pos),1,a),!i&&!n.parentOffset&&n.parent.type!=s)){let u=o.mapping.map(n.before()),c=o.doc.resolve(u);s&&n.node(-1).canReplaceWith(c.index(),c.index()+1,s)&&o.setNodeMarkup(o.mapping.map(n.before()),s)}e(o.scrollIntoView())}return!0};function VE(t,e,n){let r,i,o=e.nodeBefore,s=e.nodeAfter;if(o.type.spec.isolating||s.type.spec.isolating)return!1;if(function(h,d,p){let f=d.nodeBefore,m=d.nodeAfter,E=d.index();return!(!(f&&m&&f.type.compatibleContent(m.type))||(!f.content.size&&d.parent.canReplace(E-1,E)?(p&&p(h.tr.delete(d.pos-f.nodeSize,d.pos).scrollIntoView()),0):!d.parent.canReplace(E,E+1)||!m.isTextblock&&!nh(h.doc,d.pos)||(p&&p(h.tr.clearIncompatible(d.pos,f.type,f.contentMatchAt(f.childCount)).join(d.pos).scrollIntoView()),0)))}(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(r=(i=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&i.matchType(r[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,d=X.empty;for(let m=r.length-1;m>=0;m--)d=X.from(r[m].create(null,d));d=X.from(o.copy(d));let p=t.tr.step(new Ft(e.pos-1,h,e.pos,h,new J(d,1,0),r.length,!0)),f=h+2*r.length;nh(p.doc,f)&&p.join(f),n(p.scrollIntoView())}return!0}let l=Ae.findFrom(e,1),u=l&&l.$from.blockRange(l.$to),c=u&&su(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(a&&Ni(s,"start",!0)&&Ni(o,"end")){let h=o,d=[];for(;d.push(h),!h.isTextblock;)h=h.lastChild;let p=s,f=1;for(;!p.isTextblock;p=p.firstChild)f++;if(h.canReplace(h.childCount,h.childCount,p.content)){if(n){let m=X.empty;for(let E=d.length-1;E>=0;E--)m=X.from(d[E].copy(m));n(t.tr.step(new Ft(e.pos-d.length,e.pos+s.nodeSize,e.pos+f,e.pos+s.nodeSize-f,new J(m,d.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function zE(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(e.tr.setSelection(Ee.create(e.doc,t<0?i.start(o):i.end(o)))),!0)}}const uO=zE(-1),dO=zE(1);function Eu(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let ul=Eu($E,(t,e,n)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("backward",s):l.parentOffset>0)?null:l}(t,n);if(!r)return!1;let i=Zh(r);if(!i){let s=r.blockRange(),a=s&&su(s);return a!=null&&(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&VE(t,i,e))return!0;if(r.parent.content.size==0&&(Ni(o,"end")||re.isSelectable(o))){let s=au(t.doc,r.before(),r.after(),J.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Ni(o,"end")?Ae.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):re.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)},(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Zh(r)}let s=o&&o.nodeBefore;return!(!s||!re.isSelectable(s))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)}),ep=Eu($E,(t,e,n)=>{let r=function(s,a){let{$cursor:l}=s.selection;return!l||(a?!a.endOfTextblock("forward",s):l.parentOffset<l.parent.content.size)?null:l}(t,n);if(!r)return!1;let i=Qh(r);if(!i)return!1;let o=i.nodeAfter;if(VE(t,i,e))return!0;if(r.parent.content.size==0&&(Ni(o,"start")||re.isSelectable(o))){let s=au(t.doc,r.before(),r.after(),J.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Ni(o,"start")?Ae.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):re.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Qh(r)}let s=o&&o.nodeAfter;return!(!s||!re.isSelectable(s))&&(e&&e(t.tr.setSelection(re.create(t.doc,o.pos)).scrollIntoView()),!0)});const Ln={Enter:Eu((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(e&&e(t.tr.insertText(`
|
|
16
|
-
`).scrollIntoView()),!0)},(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Bt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=lc(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(Ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Es(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&su(r);return i!=null&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},cO),"Mod-Enter":(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=lc(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ae.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Backspace:ul,"Mod-Backspace":ul,"Shift-Backspace":ul,Delete:ep,"Mod-Delete":ep,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new Bt(t.doc))),!0)},YE={"Ctrl-h":Ln.Backspace,"Alt-Backspace":Ln["Mod-Backspace"],"Ctrl-d":Ln.Delete,"Ctrl-Alt-Backspace":Ln["Mod-Delete"],"Alt-Delete":Ln["Mod-Delete"],"Alt-d":Ln["Mod-Delete"],"Ctrl-a":uO,"Ctrl-e":dO};for(let t in Ln)YE[t]=Ln[t];const ts=(typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!(typeof os=="undefined"||!os.platform)&&os.platform()=="darwin")?YE:Ln;function _u(t,e){return t.reduce((n,r,i)=>n.concat(e(r,i)),[])}var Au={};function hO(t){return String.fromCharCode(parseInt(t.slice(1),16))}Object.defineProperty(Au,"__esModule",{value:!0});var pO=Au.encode=function(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,hO))};function fO(t){return`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`}Au.decode=function(t){return decodeURIComponent(Array.from(atob(t),fO).join(""))};const mO=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/,EO=t=>t.split(mO).filter(e=>e).map(e=>e[0]).join("")||t[Symbol.iterator]().next().value||"";function GE(t){const e=function(n){let r=0;for(let i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r&=r;return Math.abs(r)}(t)%rp.length;return rp[e]}function Oa(t,e){const n=e.lastIndex;let r;const i=[];for(;(r=e.exec(t))!==null;)i.push(r),r[0]===""&&(e.lastIndex+=1);return e.lastIndex=n,i}function cc(t,e,n){let r=0;const i=[];for(const o of e)o.offset<r||(o.offset>r&&i.push(t.substring(r,o.offset)),i.push(...n(o)),r=o.offset+o.matchedText.length);return r<t.length&&i.push(t.substring(r)),i}function WE(t){try{return new URL(t).hostname}catch(e){return}}const _O=13;function tp(t){return t.keyCode===_O&&!t.shiftKey}function ns(t){const e=t.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1");return decodeURIComponent(e)}function np(t,e){return t.localeCompare(e,void 0,{usage:"search",sensitivity:"base"})===0}function AO(t){return[...t.matchAll(/^|\s+/g)].map(n=>n.index+n[0].length).map(n=>t.substring(n))}const rp=["#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"],oo=(t,e,n=void 0)=>_u(t,r=>{if(typeof r=="string")return e(r,n);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:r.type,children:oo(r.children,e,r.type)}];case"link":return[{type:r.type,url:r.url,children:oo(r.children,e,r.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:r.type,action:r.action,params:r.params,children:oo(r.children,e,r.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[r]}});function $n(t,e){return n=>{const r=n;let i=0;const o=[];for(const s of Oa(n,t)){s.index-i>0&&o.push(r.substring(i,s.index));const a=e(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<n.length&&o.push(n.substring(i)),o}}function XE(t){return t.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1").replace(/<!!customemoji:(.*?)>/gim,"$1")}const ip="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var uc=(t=>(t[t.italic=1]="italic",t[t.strikethrough=2]="strikethrough",t[t.bold=4]="bold",t))(uc||{});const gO=[0,1,2,3,4,5,6].map(t=>{const e=[];return 1&t||e.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&t||e.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&t||e.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(e.map(n=>n.source).join("|"),"g")}),SO={_:1,"*":4,"~":2};function OO(t){return KE(t,0)}function KE(t,e=0){const n=gO[e],r=n?function(i){const o=DO.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${ip}])(?:${i.source})(?=[\\s${ip}]|$)`,"g")),s=$n(o,a=>{const l=a[0][1],u=a[1]||a[2]||a[3]||a[4]||a[5]||a[6];return[" ",{type:uc[SO[l]],children:[u]}]});return a=>{const[l,...u]=s(" "+a);return l.length>1&&u.unshift(l.substring(1)),u}}(n):()=>[t];return oo(r(t),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?KE(i,e|uc[o]):[i])}const DO=function(){const t=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(e,n){if(t.has(e))return t.get(e);const r=n();return t.set(e,r),r}}}();var dc=function(t,e){return dc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},dc(t,e)};function Uo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}dc(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var We=function(){return We=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},We.apply(this,arguments)};var vO=Object.prototype.hasOwnProperty;function zt(t){return typeof t=="boolean"}function _r(t,e){for(var n=t.length-1;n>=0;n--)e(t[n])===!0&&t.splice(n,1)}function Fr(t){throw new Error("Unhandled case for value: '".concat(t,"'"))}var rs=/\s+/,qE=function(){function t(e){e===void 0&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return t.prototype.setTagName=function(e){return this.tagName=e,this},t.prototype.getTagName=function(){return this.tagName},t.prototype.setAttr=function(e,n){return this.getAttrs()[e]=n,this},t.prototype.getAttr=function(e){return this.getAttrs()[e]},t.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},t.prototype.getAttrs=function(){return this.attrs},t.prototype.setClass=function(e){return this.setAttr("class",e)},t.prototype.addClass=function(e){for(var n,r=this.getClass(),i=r?r.split(rs):[],o=e.split(rs);n=o.shift();)i.indexOf(n)===-1&&i.push(n);return this.getAttrs().class=i.join(" "),this},t.prototype.removeClass=function(e){for(var n,r=this.getClass(),i=r?r.split(rs):[],o=e.split(rs);i.length&&(n=o.shift());){var s=i.indexOf(n);s!==-1&&i.splice(s,1)}return this.getAttrs().class=i.join(" "),this},t.prototype.getClass=function(){return this.getAttrs().class||""},t.prototype.hasClass=function(e){return(" "+this.getClass()+" ").indexOf(" "+e+" ")!==-1},t.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},t.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},t.prototype.getInnerHTML=function(){return this.innerHTML||""},t.prototype.getInnerHtml=function(){return this.getInnerHTML()},t.prototype.toAnchorString=function(){var e=this.getTagName(),n=this.buildAttrsStr();return["<",e,n=n?" "+n:"",">",this.getInnerHtml(),"</",e,">"].join("")},t.prototype.buildAttrsStr=function(){var e=this.getAttrs(),n=[];for(var r in e)vO.call(e,r)&&n.push(r+'="'+e[r]+'"');return n.join(" ")},t}();function op(t){var e="";return t.scheme&&t.host&&(e+=t.scheme+"://"),t.host&&(e+=t.host),t.path&&(e+="/"+t.path),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e}function dl(t,e,n){var r=e/2,i=Math.ceil(r),o=-1*Math.floor(r),s="";return o<0&&(s=t.substr(o)),t.substr(0,i)+n+s}var TO=function(){function t(e){e===void 0&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return t.prototype.build=function(e){return new qE({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},t.prototype.createAttrs=function(e){var n={href:e.getAnchorHref()},r=this.createCssClass(e);return r&&(n.class=r),this.newWindow&&(n.target="_blank",n.rel="noopener noreferrer"),this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(n.title=e.getAnchorHref()),n},t.prototype.createCssClass=function(e){var n=this.className;if(n){for(var r=[n],i=e.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(n+"-"+i[o]);return r.join(" ")}return""},t.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},t.prototype.doTruncate=function(e){var n=this.truncate;if(!n.length)return e;var r=n.length,i=n.location;return i==="smart"?function(o,s,a){var l,u;if(a==null?(a="…",u=3,l=8):(u=a.length,l=a.length),o.length<=s)return o;var c=s-u,h=function(_){var g={},O=_,D=O.match(/^([a-z]+):\/\//i);return D&&(g.scheme=D[1],O=O.slice(D[0].length)),(D=O.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(g.host=D[1],O=O.slice(D[0].length)),(D=O.match(/^\/(.*?)(?=(\?|#|$))/i))&&(g.path=D[1],O=O.slice(D[0].length)),(D=O.match(/^\?(.*?)(?=(#|$))/i))&&(g.query=D[1],O=O.slice(D[0].length)),(D=O.match(/^#(.*?)$/i))&&(g.fragment=D[1]),g}(o);if(h.query){var d=h.query.match(/^(.*?)(?=(\?|#))(.*?)$/i);d&&(h.query=h.query.substr(0,d[1].length),o=op(h))}if(o.length<=s||(h.host&&(h.host=h.host.replace(/^www\./,""),o=op(h)),o.length<=s))return o;var p="";if(h.host&&(p+=h.host),p.length>=c)return h.host.length===s?(h.host.substr(0,s-u)+a).substr(0,c+l):dl(p,c,a).substr(0,c+l);var f="";if(h.path&&(f+="/"+h.path),h.query&&(f+="?"+h.query),f){if((p+f).length>=c)return(p+f).length==s?(p+f).substr(0,s):(p+dl(f,c-p.length,a)).substr(0,c+l);p+=f}if(h.fragment){var m="#"+h.fragment;if((p+m).length>=c)return(p+m).length==s?(p+m).substr(0,s):(p+dl(m,c-p.length,a)).substr(0,c+l);p+=m}if(h.scheme&&h.host){var E=h.scheme+"://";if((p+E).length<c)return(E+p).substr(0,s)}if(p.length<=s)return p;var A="";return c>0&&(A=p.substr(-1*Math.floor(c/2))),(p.substr(0,Math.ceil(c/2))+a+A).substr(0,c+l)}(e,r):i==="middle"?function(o,s,a){if(o.length<=s)return o;var l,u;a==null?(a="…",l=8,u=3):(l=a.length,u=a.length);var c=s-u,h="";return c>0&&(h=o.substr(-1*Math.floor(c/2))),(o.substr(0,Math.ceil(c/2))+a+h).substr(0,c+l)}(e,r):function(o,s,a){return function(l,u,c){var h;return l.length>u&&(c==null?(c="…",h=3):h=c.length,l=l.substring(0,u-h)+c),l}(o,s,a)}(e,r)},t}(),Bo=function(){function t(e){this._=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return t.prototype.getMatchedText=function(){return this.matchedText},t.prototype.setOffset=function(e){this.offset=e},t.prototype.getOffset=function(){return this.offset},t.prototype.getCssClassSuffixes=function(){return[this.type]},t.prototype.buildTag=function(){return this.tagBuilder.build(this)},t}();function xi(t){return t>=65&&t<=90||t>=97&&t<=122}function ut(t){return t>=48&&t<=57}function gu(t){return t==34||t==39}function Gr(t){return t<8232?t<160?t>=9&&t<=13||t==32:t<5760?t==160:t==5760||t>=8192&&t<=8202:t<8287?t>=8232&&t<=8233||t==8239:t<12288?t==8287:t==12288||t==65279}function Wr(t){return t<4800?t<2949?t<2451?t<1425?t<768?t<192?t<169?t<65?t>=48&&t<=57:t>=65&&t<=90||t>=97&&t<=122:t<181?t>=169&&t<=170||t==174:t==181||t==186:t<710?t<216?t>=192&&t<=214:t>=216&&t<=246||t>=248&&t<=705:t<748?t>=710&&t<=721||t>=736&&t<=740:t==748||t==750:t<910?t<895?t<886?t>=768&&t<=884:t>=886&&t<=887||t>=890&&t<=893:t<904?t==895||t==902:t>=904&&t<=906||t==908:t<1155?t<931?t>=910&&t<=929:t>=931&&t<=1013||t>=1015&&t<=1153:t<1369?t>=1155&&t<=1327||t>=1329&&t<=1366:t==1369||t>=1377&&t<=1415:t<1808?t<1552?t<1476?t<1471?t>=1425&&t<=1469:t==1471||t>=1473&&t<=1474:t<1488?t>=1476&&t<=1477||t==1479:t>=1488&&t<=1514||t>=1520&&t<=1522:t<1749?t<1568?t>=1552&&t<=1562:t>=1568&&t<=1641||t>=1646&&t<=1747:t<1770?t>=1749&&t<=1756||t>=1759&&t<=1768:t>=1770&&t<=1788||t==1791:t<2230?t<2042?t<1869?t>=1808&&t<=1866:t>=1869&&t<=1969||t>=1984&&t<=2037:t<2112?t==2042||t>=2048&&t<=2093:t>=2112&&t<=2139||t>=2208&&t<=2228:t<2406?t<2260?t>=2230&&t<=2237:t>=2260&&t<=2273||t>=2275&&t<=2403:t<2437?t>=2406&&t<=2415||t>=2417&&t<=2435:t>=2437&&t<=2444||t>=2447&&t<=2448:t<2693?t<2579?t<2519?t<2486?t<2474?t>=2451&&t<=2472:t>=2474&&t<=2480||t==2482:t<2503?t>=2486&&t<=2489||t>=2492&&t<=2500:t>=2503&&t<=2504||t>=2507&&t<=2510:t<2534?t<2524?t==2519:t>=2524&&t<=2525||t>=2527&&t<=2531:t<2565?t>=2534&&t<=2545||t>=2561&&t<=2563:t>=2565&&t<=2570||t>=2575&&t<=2576:t<2631?t<2613?t<2602?t>=2579&&t<=2600:t>=2602&&t<=2608||t>=2610&&t<=2611:t<2620?t>=2613&&t<=2614||t>=2616&&t<=2617:t==2620||t>=2622&&t<=2626:t<2649?t<2635?t>=2631&&t<=2632:t>=2635&&t<=2637||t==2641:t<2662?t>=2649&&t<=2652||t==2654:t>=2662&&t<=2677||t>=2689&&t<=2691:t<2821?t<2759?t<2730?t<2703?t>=2693&&t<=2701:t>=2703&&t<=2705||t>=2707&&t<=2728:t<2741?t>=2730&&t<=2736||t>=2738&&t<=2739:t>=2741&&t<=2745||t>=2748&&t<=2757:t<2784?t<2763?t>=2759&&t<=2761:t>=2763&&t<=2765||t==2768:t<2809?t>=2784&&t<=2787||t>=2790&&t<=2799:t==2809||t>=2817&&t<=2819:t<2887?t<2858?t<2831?t>=2821&&t<=2828:t>=2831&&t<=2832||t>=2835&&t<=2856:t<2869?t>=2858&&t<=2864||t>=2866&&t<=2867:t>=2869&&t<=2873||t>=2876&&t<=2884:t<2911?t<2902?t>=2887&&t<=2888||t>=2891&&t<=2893:t>=2902&&t<=2903||t>=2908&&t<=2909:t<2929?t>=2911&&t<=2915||t>=2918&&t<=2927:t==2929||t>=2946&&t<=2947:t<3517?t<3205?t<3046?t<2984?t<2969?t<2958?t>=2949&&t<=2954:t>=2958&&t<=2960||t>=2962&&t<=2965:t<2974?t>=2969&&t<=2970||t==2972:t>=2974&&t<=2975||t>=2979&&t<=2980:t<3014?t<2990?t>=2984&&t<=2986:t>=2990&&t<=3001||t>=3006&&t<=3010:t<3024?t>=3014&&t<=3016||t>=3018&&t<=3021:t==3024||t==3031:t<3142?t<3086?t<3072?t>=3046&&t<=3055:t>=3072&&t<=3075||t>=3077&&t<=3084:t<3114?t>=3086&&t<=3088||t>=3090&&t<=3112:t>=3114&&t<=3129||t>=3133&&t<=3140:t<3160?t<3146?t>=3142&&t<=3144:t>=3146&&t<=3149||t>=3157&&t<=3158:t<3174?t>=3160&&t<=3162||t>=3168&&t<=3171:t>=3174&&t<=3183||t>=3200&&t<=3203:t<3333?t<3274?t<3242?t<3214?t>=3205&&t<=3212:t>=3214&&t<=3216||t>=3218&&t<=3240:t<3260?t>=3242&&t<=3251||t>=3253&&t<=3257:t>=3260&&t<=3268||t>=3270&&t<=3272:t<3296?t<3285?t>=3274&&t<=3277:t>=3285&&t<=3286||t==3294:t<3313?t>=3296&&t<=3299||t>=3302&&t<=3311:t>=3313&&t<=3314||t>=3329&&t<=3331:t<3423?t<3389?t<3342?t>=3333&&t<=3340:t>=3342&&t<=3344||t>=3346&&t<=3386:t<3402?t>=3389&&t<=3396||t>=3398&&t<=3400:t>=3402&&t<=3406||t>=3412&&t<=3415:t<3458?t<3430?t>=3423&&t<=3427:t>=3430&&t<=3439||t>=3450&&t<=3455:t<3482?t>=3458&&t<=3459||t>=3461&&t<=3478:t>=3482&&t<=3505||t>=3507&&t<=3515:t<3804?t<3722?t<3570?t<3535?t<3520?t==3517:t>=3520&&t<=3526||t==3530:t<3544?t>=3535&&t<=3540||t==3542:t>=3544&&t<=3551||t>=3558&&t<=3567:t<3664?t<3585?t>=3570&&t<=3571:t>=3585&&t<=3642||t>=3648&&t<=3662:t<3716?t>=3664&&t<=3673||t>=3713&&t<=3714:t==3716||t>=3719&&t<=3720:t<3754?t<3737?t<3725?t==3722:t==3725||t>=3732&&t<=3735:t<3749?t>=3737&&t<=3743||t>=3745&&t<=3747:t==3749||t==3751:t<3776?t<3757?t>=3754&&t<=3755:t>=3757&&t<=3769||t>=3771&&t<=3773:t<3784?t>=3776&&t<=3780||t==3782:t>=3784&&t<=3789||t>=3792&&t<=3801:t<4176?t<3902?t<3872?t<3840?t>=3804&&t<=3807:t==3840||t>=3864&&t<=3865:t<3895?t>=3872&&t<=3881||t==3893:t==3895||t==3897:t<3974?t<3913?t>=3902&&t<=3911:t>=3913&&t<=3948||t>=3953&&t<=3972:t<4038?t>=3974&&t<=3991||t>=3993&&t<=4028:t==4038||t>=4096&&t<=4169:t<4688?t<4301?t<4256?t>=4176&&t<=4253:t>=4256&&t<=4293||t==4295:t<4348?t==4301||t>=4304&&t<=4346:t>=4348&&t<=4680||t>=4682&&t<=4685:t<4746?t<4698?t>=4688&&t<=4694||t==4696:t>=4698&&t<=4701||t>=4704&&t<=4744:t<4786?t>=4746&&t<=4749||t>=4752&&t<=4784:t>=4786&&t<=4789||t>=4792&&t<=4798:t<11035?t<7416?t<6176?t<5873?t<4992?t<4824?t<4802?t==4800:t>=4802&&t<=4805||t>=4808&&t<=4822:t<4888?t>=4824&&t<=4880||t>=4882&&t<=4885:t>=4888&&t<=4954||t>=4957&&t<=4959:t<5121?t<5024?t>=4992&&t<=5007:t>=5024&&t<=5109||t>=5112&&t<=5117:t<5761?t>=5121&&t<=5740||t>=5743&&t<=5759:t>=5761&&t<=5786||t>=5792&&t<=5866:t<6002?t<5920?t<5888?t>=5873&&t<=5880:t>=5888&&t<=5900||t>=5902&&t<=5908:t<5984?t>=5920&&t<=5940||t>=5952&&t<=5971:t>=5984&&t<=5996||t>=5998&&t<=6e3:t<6108?t<6016?t>=6002&&t<=6003:t>=6016&&t<=6099||t==6103:t<6155?t>=6108&&t<=6109||t>=6112&&t<=6121:t>=6155&&t<=6157||t>=6160&&t<=6169:t<6783?t<6512?t<6400?t<6272?t>=6176&&t<=6263:t>=6272&&t<=6314||t>=6320&&t<=6389:t<6448?t>=6400&&t<=6430||t>=6432&&t<=6443:t>=6448&&t<=6459||t>=6470&&t<=6509:t<6608?t<6528?t>=6512&&t<=6516:t>=6528&&t<=6571||t>=6576&&t<=6601:t<6688?t>=6608&&t<=6617||t>=6656&&t<=6683:t>=6688&&t<=6750||t>=6752&&t<=6780:t<7040?t<6832?t<6800?t>=6783&&t<=6793:t>=6800&&t<=6809||t==6823:t<6992?t>=6832&&t<=6846||t>=6912&&t<=6987:t>=6992&&t<=7001||t>=7019&&t<=7027:t<7245?t<7168?t>=7040&&t<=7155:t>=7168&&t<=7223||t>=7232&&t<=7241:t<7376?t>=7245&&t<=7293||t>=7296&&t<=7304:t>=7376&&t<=7378||t>=7380&&t<=7414:t<8450?t<8130?t<8025?t<7960?t<7424?t>=7416&&t<=7417:t>=7424&&t<=7669||t>=7675&&t<=7957:t<8008?t>=7960&&t<=7965||t>=7968&&t<=8005:t>=8008&&t<=8013||t>=8016&&t<=8023:t<8031?t<8027?t==8025:t==8027||t==8029:t<8118?t>=8031&&t<=8061||t>=8064&&t<=8116:t>=8118&&t<=8124||t==8126:t<8205?t<8150?t<8134?t>=8130&&t<=8132:t>=8134&&t<=8140||t>=8144&&t<=8147:t<8178?t>=8150&&t<=8155||t>=8160&&t<=8172:t>=8178&&t<=8180||t>=8182&&t<=8188:t<8305?t<8252?t==8205:t==8252||t==8265:t<8336?t==8305||t==8319:t>=8336&&t<=8348||t>=8400&&t<=8432:t<8579?t<8486?t<8469?t<8455?t==8450:t==8455||t>=8458&&t<=8467:t<8482?t==8469||t>=8473&&t<=8477:t==8482||t==8484:t<8495?t<8488?t==8486:t==8488||t>=8490&&t<=8493:t<8517?t>=8495&&t<=8505||t>=8508&&t<=8511:t>=8517&&t<=8521||t==8526:t<9410?t<9e3?t<8592?t>=8579&&t<=8580:t>=8592&&t<=8703||t>=8986&&t<=8987:t<9193?t==9e3||t==9167:t>=9193&&t<=9203||t>=9208&&t<=9210:t<9723?t<9654?t==9410||t>=9642&&t<=9643:t==9654||t==9664:t<10548?t>=9723&&t<=9726||t>=9728&&t<=10175:t>=10548&&t<=10549||t>=11013&&t<=11015:t<43259?t<12445?t<11688?t<11520?t<11264?t<11088?t>=11035&&t<=11036:t==11088||t==11093:t<11360?t>=11264&&t<=11310||t>=11312&&t<=11358:t>=11360&&t<=11492||t>=11499&&t<=11507:t<11568?t<11559?t>=11520&&t<=11557:t==11559||t==11565:t<11647?t>=11568&&t<=11623||t==11631:t>=11647&&t<=11670||t>=11680&&t<=11686:t<11744?t<11712?t<11696?t>=11688&&t<=11694:t>=11696&&t<=11702||t>=11704&&t<=11710:t<11728?t>=11712&&t<=11718||t>=11720&&t<=11726:t>=11728&&t<=11734||t>=11736&&t<=11742:t<12330?t<11823?t>=11744&&t<=11775:t==11823||t>=12293&&t<=12294:t<12353?t>=12330&&t<=12341||t>=12347&&t<=12349:t>=12353&&t<=12438||t>=12441&&t<=12442:t<42512?t<12951?t<12549?t<12449?t>=12445&&t<=12447:t>=12449&&t<=12538||t>=12540&&t<=12543:t<12704?t>=12549&&t<=12589||t>=12593&&t<=12686:t>=12704&&t<=12730||t>=12784&&t<=12799:t<19968?t<12953?t==12951:t==12953||t>=13312&&t<=19893:t<42192?t>=19968&&t<=40917||t>=40960&&t<=42124:t>=42192&&t<=42237||t>=42240&&t<=42508:t<42891?t<42623?t<42560?t>=42512&&t<=42539:t>=42560&&t<=42610||t>=42612&&t<=42621:t<42775?t>=42623&&t<=42725||t>=42736&&t<=42737:t>=42775&&t<=42783||t>=42786&&t<=42888:t<43072?t<42928?t>=42891&&t<=42926:t>=42928&&t<=42935||t>=42999&&t<=43047:t<43216?t>=43072&&t<=43123||t>=43136&&t<=43205:t>=43216&&t<=43225||t>=43232&&t<=43255:t<55243?t<43744?t<43488?t<43312?t<43261?t==43259:t==43261||t>=43264&&t<=43309:t<43392?t>=43312&&t<=43347||t>=43360&&t<=43388:t>=43392&&t<=43456||t>=43471&&t<=43481:t<43600?t<43520?t>=43488&&t<=43518:t>=43520&&t<=43574||t>=43584&&t<=43597:t<43642?t>=43600&&t<=43609||t>=43616&&t<=43638:t>=43642&&t<=43714||t>=43739&&t<=43741:t<43824?t<43785?t<43762?t>=43744&&t<=43759:t>=43762&&t<=43766||t>=43777&&t<=43782:t<43808?t>=43785&&t<=43790||t>=43793&&t<=43798:t>=43808&&t<=43814||t>=43816&&t<=43822:t<44012?t<43868?t>=43824&&t<=43866:t>=43868&&t<=43877||t>=43888&&t<=44010:t<44032?t>=44012&&t<=44013||t>=44016&&t<=44025:t>=44032&&t<=55203||t>=55216&&t<=55238:t<64848?t<64298?t<64112?t<55296?t>=55243&&t<=55291:t>=55296&&t<=57343||t>=63744&&t<=64109:t<64275?t>=64112&&t<=64217||t>=64256&&t<=64262:t>=64275&&t<=64279||t>=64285&&t<=64296:t<64320?t<64312?t>=64298&&t<=64310:t>=64312&&t<=64316||t==64318:t<64326?t>=64320&&t<=64321||t>=64323&&t<=64324:t>=64326&&t<=64433||t>=64467&&t<=64829:t<65296?t<65024?t<64914?t>=64848&&t<=64911:t>=64914&&t<=64967||t>=65008&&t<=65019:t<65136?t>=65024&&t<=65039||t>=65056&&t<=65071:t>=65136&&t<=65140||t>=65142&&t<=65276:t<65474?t<65345?t>=65296&&t<=65305||t>=65313&&t<=65338:t>=65345&&t<=65370||t>=65382&&t<=65470:t<65490?t>=65474&&t<=65479||t>=65482&&t<=65487:t>=65490&&t<=65495||t>=65498&&t<=65500}function JE(t){return t<58?t<44?t==33:t==44||t==46:t<63?t>=58&&t<=59:t==63||t==94}function RO(t){return t<91?t==40:t==91||t==123}function sp(t){return t<93?t==41:t==93||t==125}var CO=/^(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|travelersinsurance|vermögensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|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|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|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--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--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|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|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|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--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|pramerica|richardli|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--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|banamex|bauhaus|bestbuy|booking|brother|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|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|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|yamaxun|youtube|zuerich|католик|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|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|kindle|kosher|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|nagoya|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|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|walter|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|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|loans|locus|lotte|lotto|mango|media|miami|money|movie|music|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|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|aero|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|dvag|erni|fage|fail|fans|farm|fast|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|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|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|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|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|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|ceo|cfa|cfd|com|cpa|crs|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|gay|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|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|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|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|scb|sew|sex|sfr|ski|sky|soy|spa|srl|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|ss|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|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)$/,ZE=/https?:\/\//i,IO=new RegExp("^"+ZE.source,"i"),yO=/^(javascript|vbscript):/i,NO=/^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/,bO=/^(?:\/\/)?([^/#?:]+)/,vo=xi;function QE(t){return xi(t)||ut(t)||t===43||t===45||t===46}var ur=Wr;function Su(t){return t===95||ur(t)}function e_(t){return Wr(t)||function(e){return e<91?e<47?e>=35&&e<=43||e==45:e<61?e==47:e==61||e==64:e<95?e==91||e==93:e<123?e==95:e>=123&&e<=126||e==10003}(t)||JE(t)}function Ou(t){return t===47||t===63||t===35}function ap(t){return CO.test(t.toLowerCase())}var kO=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,LO=/[:/?#]/,wO=/^(https?:\/\/)?(?:www\.)?/i,MO=/^\/\//,t_=function(t){function e(n){var r=t.call(this,n)||this;return r.type="url",r.url="",r.urlMatchType="scheme",r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.protocolPrepended=!1,r.urlMatchType=n.urlMatchType,r.url=n.url,r.protocolRelativeMatch=n.protocolRelativeMatch,r.stripPrefix=n.stripPrefix,r.stripTrailingSlash=n.stripTrailingSlash,r.decodePercentEncoding=n.decodePercentEncoding,r}return Uo(e,t),e.prototype.getType=function(){return"url"},e.prototype.getUrlMatchType=function(){return this.urlMatchType},e.prototype.getUrl=function(){var n=this.url;return this.protocolRelativeMatch||this.urlMatchType==="scheme"||this.protocolPrepended||(n=this.url="http://"+n,this.protocolPrepended=!0),n},e.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},e.prototype.getAnchorText=function(){var n=this.getMatchedText();return this.protocolRelativeMatch&&(n=n.replace(MO,"")),this.stripPrefix.scheme&&(n=n.replace(IO,"")),this.stripPrefix.www&&(n=function(r){return r.includes("www.")?r.replace(wO,"$1"):r}(n)),this.stripTrailingSlash&&(n=function(r){return r.charAt(r.length-1)==="/"&&(r=r.slice(0,-1)),r}(n)),this.decodePercentEncoding&&(n=function(r){var i=r.replace(/%(?:22|26|27|3C|3E)/gi,function(o){return o==="%22"?""":o==="%26"?"&":o==="%27"?"'":o==="%3C"||o==="%3c"?"<":">"});if(i.includes("%"))try{return decodeURIComponent(i)}catch(o){}return i}(n)),n},e}(Bo),PO=/^mailto:/i,n_=Wr;function Du(t){return n_(t)||function(e){return e<47?e<42?e==33||e>=35&&e<=39:e>=42&&e<=43||e==45:e<63?e==47||e==61:e<94?e==63:e>=94&&e<=96||e>=123&&e<=126}(t)}var r_=function(t){function e(n){var r=t.call(this,n)||this;return r.type="email",r.email="",r.email=n.email,r}return Uo(e,t),e.prototype.getType=function(){return"email"},e.prototype.getEmail=function(){return this.email},e.prototype.getAnchorHref=function(){return"mailto:"+this.email},e.prototype.getAnchorText=function(){return this.email},e}(Bo);function i_(t){return t===95||Wr(t)}var xO=["twitter","facebook","instagram","tiktok","youtube"],FO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="hashtag",r.serviceName="twitter",r.hashtag="",r.serviceName=n.serviceName,r.hashtag=n.hashtag,r}return Uo(e,t),e.prototype.getType=function(){return"hashtag"},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getHashtag=function(){return this.hashtag},e.prototype.getAnchorHref=function(){var n=this.serviceName,r=this.hashtag;switch(n){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;case"tiktok":return"https://www.tiktok.com/tag/"+r;case"youtube":return"https://youtube.com/hashtag/"+r;default:Fr(n)}},e.prototype.getAnchorText=function(){return"#"+this.hashtag},e.prototype.getCssClassSuffixes=function(){var n=t.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&n.push(r),n},e}(Bo),HO={twitter:/^@\w{1,15}$/,instagram:/^@[_\w]{1,30}$/,soundcloud:/^@[-a-z0-9_]{3,25}$/,tiktok:/^@[.\w]{1,23}[\w]$/,youtube:/^@[-.·\w]{3,30}$/};function o_(t){return t===45||t===46||t===95||xi(t)||ut(t)}var UO=["twitter","instagram","soundcloud","tiktok","youtube"],BO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="mention",r.serviceName="twitter",r.mention="",r.mention=n.mention,r.serviceName=n.serviceName,r}return Uo(e,t),e.prototype.getType=function(){return"mention"},e.prototype.getMention=function(){return this.mention},e.prototype.getServiceName=function(){return this.serviceName},e.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;case"tiktok":return"https://www.tiktok.com/@"+this.mention;case"youtube":return"https://youtube.com/@"+this.mention;default:Fr(this.serviceName)}},e.prototype.getAnchorText=function(){return"@"+this.mention},e.prototype.getCssClassSuffixes=function(){var n=t.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&n.push(r),n},e}(Bo),jO=/[-. ()]/,$O=new RegExp("^".concat(/(?:(?:(?:(\+)?\d{1,3}[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\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)[-. ]?(?:\d[-. ]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]-?[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,"$"));function s_(t){return t===45||t===46||t===32}function vu(t){return t===44||t===59}var VO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="phone",r.number="",r.plusSign=!1,r.number=n.number,r.plusSign=n.plusSign,r}return Uo(e,t),e.prototype.getType=function(){return"phone"},e.prototype.getPhoneNumber=function(){return this.number},e.prototype.getNumber=function(){return this.getPhoneNumber()},e.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},e.prototype.getAnchorText=function(){return this.matchedText},e}(Bo),zO=function(){function t(e,n){this.charIdx=0,this.matches=[],this._stateMachines=[],this.schemeUrlMachinesCount=0,this.text=e,this.tagBuilder=n.tagBuilder,this.stripPrefix=n.stripPrefix,this.stripTrailingSlash=n.stripTrailingSlash,this.decodePercentEncoding=n.decodePercentEncoding,this.hashtagServiceName=n.hashtagServiceName,this.mentionServiceName=n.mentionServiceName}return Object.defineProperty(t.prototype,"stateMachines",{get:function(){return this._stateMachines},enumerable:!1,configurable:!0}),t.prototype.addMachine=function(e){this._stateMachines.push(e),cp(e)&&this.schemeUrlMachinesCount++},t.prototype.removeMachine=function(e){this._stateMachines=this._stateMachines.filter(function(n){return n!==e}),cp(e)&&this.schemeUrlMachinesCount--},t.prototype.hasSchemeUrlMachine=function(){return this.schemeUrlMachinesCount>0},t}();function Da(t,e,n){var r=t.charIdx;if(n===35)t.addMachine({type:2,startIdx:r,state:28,acceptStateReached:!1});else if(n===64)t.addMachine(function(o,s){return{type:3,startIdx:o,state:s,acceptStateReached:!1}}(r,30));else if(n===47)t.addMachine(hc(r,11));else if(n===43)t.addMachine(hl(r,37));else if(n===40)t.addMachine(hl(r,32));else{if(ut(n)&&(t.addMachine(hl(r,38)),t.addMachine(function(o,s){return{type:0,startIdx:o,state:s,acceptStateReached:!1,matchType:2,octetsEncountered:1}}(r,13))),n_(n)){var i=e.toLowerCase()==="m"?15:22;t.addMachine(function(o,s){return{type:1,startIdx:o,state:s,acceptStateReached:!1}}(r,i))}vo(n)&&t.addMachine(va(r,0)),Wr(n)&&t.addMachine(hc(r,5))}}function YO(t,e,n){n===58?e.state=2:n===45?e.state=1:QE(n)||t.removeMachine(e)}function GO(t,e,n){var r=t.charIdx;n===45||(n===47?(t.removeMachine(e),t.addMachine(hc(r,11))):QE(n)?e.state=0:t.removeMachine(e))}function WO(t,e,n){var r=t.charIdx;n===47?e.state=3:n===46?t.removeMachine(e):ur(n)?(e.state=5,vo(n)&&t.addMachine(va(r,0))):t.removeMachine(e)}function XO(t,e,n){n===47?e.state=4:e_(n)?(e.state=10,e.acceptStateReached=!0):Le(t,e)}function KO(t,e,n,r){r===47?(e.state=10,e.acceptStateReached=!0):ur(r)?(e.state=5,e.acceptStateReached=!0):t.removeMachine(e)}function qO(t,e,n){n===47?e.state=12:t.removeMachine(e)}function JO(t,e,n){ur(n)?e.state=5:t.removeMachine(e)}function ZO(t,e,n){n===46?e.state=7:n===45?e.state=6:n===58?e.state=8:Ou(n)?e.state=10:Su(n)||Le(t,e)}function QO(t,e,n,r){r===45||(r===46?Le(t,e):ur(r)?e.state=5:Le(t,e))}function eD(t,e,n,r){r===46?Le(t,e):ur(r)?(e.state=5,e.acceptStateReached=!0):Le(t,e)}function tD(t,e,n){n===46?e.state=14:n===58?e.state=8:ut(n)||(Ou(n)?e.state=10:Wr(n)?t.removeMachine(e):Le(t,e))}function nD(t,e,n){ut(n)?(e.octetsEncountered++,e.octetsEncountered===4&&(e.acceptStateReached=!0),e.state=13):Le(t,e)}function rD(t,e,n){ut(n)?e.state=9:Le(t,e)}function iD(t,e,n){ut(n)||(Ou(n)?e.state=10:Le(t,e))}function oD(t,e,n){e_(n)||Le(t,e)}function sD(t,e,n,r){n.toLowerCase()==="a"?e.state=16:Xr(t,e,r)}function aD(t,e,n,r){n.toLowerCase()==="i"?e.state=17:Xr(t,e,r)}function lD(t,e,n,r){n.toLowerCase()==="l"?e.state=18:Xr(t,e,r)}function cD(t,e,n,r){n.toLowerCase()==="t"?e.state=19:Xr(t,e,r)}function uD(t,e,n,r){n.toLowerCase()==="o"?e.state=20:Xr(t,e,r)}function dD(t,e,n){n===58?e.state=21:Xr(t,e,n)}function hD(t,e,n){Du(n)?e.state=22:t.removeMachine(e)}function Xr(t,e,n){n===46?e.state=23:n===64?e.state=24:Du(n)?e.state=22:t.removeMachine(e)}function pD(t,e,n){n===46||n===64?t.removeMachine(e):Du(n)?e.state=22:t.removeMachine(e)}function fD(t,e,n){ur(n)?e.state=25:t.removeMachine(e)}function mD(t,e,n){n===46?e.state=27:n===45?e.state=26:Su(n)||Le(t,e)}function ED(t,e,n){n===45||n===46?Le(t,e):Su(n)?e.state=25:Le(t,e)}function _D(t,e,n){n===46||n===45?Le(t,e):ur(n)?(e.state=25,e.acceptStateReached=!0):Le(t,e)}function AD(t,e,n){i_(n)?(e.state=29,e.acceptStateReached=!0):t.removeMachine(e)}function gD(t,e,n){i_(n)||Le(t,e)}function SD(t,e,n){o_(n)?(e.state=31,e.acceptStateReached=!0):t.removeMachine(e)}function OD(t,e,n){o_(n)||(Wr(n)?t.removeMachine(e):Le(t,e))}function DD(t,e,n,r){ut(r)?e.state=38:(t.removeMachine(e),Da(t,n,r))}function vD(t,e,n,r){ut(r)?e.state=33:t.removeMachine(e),Da(t,n,r)}function TD(t,e,n){ut(n)?e.state=34:t.removeMachine(e)}function RD(t,e,n){ut(n)?e.state=35:t.removeMachine(e)}function CD(t,e,n){n===41?e.state=36:t.removeMachine(e)}function ID(t,e,n,r){ut(r)?e.state=38:s_(r)?e.state=39:t.removeMachine(e)}function yD(t,e,n,r){var i=t.charIdx;e.acceptStateReached=!0,vu(r)?e.state=40:r===35?e.state=41:ut(r)||(r===40?e.state=32:s_(r)?e.state=39:(Le(t,e),vo(r)&&t.addMachine(va(i,0))))}function ND(t,e,n,r){ut(r)?e.state=38:r===40?e.state=32:(Le(t,e),Da(t,n,r))}function bD(t,e,n){vu(n)||(n===35?e.state=41:ut(n)?e.state=38:Le(t,e))}function kD(t,e,n){vu(n)?e.state=40:ut(n)?t.removeMachine(e):Le(t,e)}function Le(t,e){var n=t.matches,r=t.text,i=t.charIdx,o=t.tagBuilder,s=t.stripPrefix,a=t.stripTrailingSlash,l=t.decodePercentEncoding,u=t.hashtagServiceName,c=t.mentionServiceName;if(t.removeMachine(e),e.acceptStateReached){var h,d,p=e.startIdx,f=r.slice(e.startIdx,i);switch(f=function(A){for(var _={"(":0,"{":0,"[":0},g=0;g<A.length;g++){var O=A.charAt(g);RO(R=A.charCodeAt(g))?_[O]++:sp(R)&&_[lp[O]]--}for(var D=A.length-1;D>=0;){var R;if(O=A.charAt(D),sp(R=A.charCodeAt(D))){var T=lp[O];if(!(_[T]<0))break;_[T]++,D--}else{if(!JE(R))break;D--}}return A.slice(0,D+1)}(f),e.type){case 0:if(r.charCodeAt(e.startIdx-1)===64)return;switch(e.matchType){case 0:var m=ZE.exec(f);if(m&&(p+=m.index,f=f.slice(m.index)),!function(A){if(yO.test(A))return!1;var _=A.match(NO);if(!_)return!1;var g=!!_[1],O=_[2];return!!g||!(O.indexOf(".")===-1||!/[A-Za-z]/.test(O))}(f))return;break;case 1:if(!function(A){var _=A.match(bO);if(!_)return!1;var g=_[0].split(".");return!(g.length<2||!ap(g[g.length-1]))}(f))return;break;case 2:if(d=f.split(LO,1)[0],!kO.test(d))return;break;default:Fr(e)}n.push(new t_({tagBuilder:o,matchedText:f,offset:p,urlMatchType:LD(e.matchType),url:f,protocolRelativeMatch:f.slice(0,2)==="//",stripPrefix:s,stripTrailingSlash:a,decodePercentEncoding:l}));break;case 1:ap(f.split(".").pop())&&n.push(new r_({tagBuilder:o,matchedText:f,offset:p,email:f.replace(PO,"")}));break;case 2:f.length<=140&&n.push(new FO({tagBuilder:o,matchedText:f,offset:p,serviceName:u,hashtag:f.slice(1)}));break;case 3:(function(A,_){return HO[_].test(A)})(f,c)&&n.push(new BO({tagBuilder:o,matchedText:f,offset:p,serviceName:c,mention:f.slice(1)}));break;case 4:if(f=f.replace(/ +$/g,""),((h=f).charAt(0)==="+"||jO.test(h))&&$O.test(h)){var E=f.replace(/[^0-9,;#]/g,"");n.push(new VO({tagBuilder:o,matchedText:f,offset:p,number:E,plusSign:f.charAt(0)==="+"}))}break;default:Fr(e)}}}function LD(t){switch(t){case 0:return"scheme";case 1:return"tld";case 2:return"ipV4";default:Fr(t)}}var lp={")":"(","}":"{","]":"["};function va(t,e){return{type:0,startIdx:t,state:e,acceptStateReached:!1,matchType:0}}function hc(t,e){return{type:0,startIdx:t,state:e,acceptStateReached:!1,matchType:1}}function hl(t,e){return{type:4,startIdx:t,state:e,acceptStateReached:!1}}function cp(t){return t.type===0&&t.matchType===0}var _n=function(t){t===void 0&&(t={}),this.idx=t.idx!==void 0?t.idx:-1,this.type=t.type||"tag",this.name=t.name||"",this.isOpening=!!t.isOpening,this.isClosing=!!t.isClosing},Tu=new _n,wD=function(t,e){this.charIdx=0,this.state=0,this.currentDataIdx=0,this.currentTag=Tu,this.html=t,this.callbacks=e};function MD(t,e){e==="<"&&vn(t)}function PD(t,e,n){e==="!"?t.state=13:e==="/"?(t.state=2,t.currentTag=new _n(We(We({},t.currentTag),{isClosing:!0}))):e==="<"?vn(t):xi(n)?(t.state=3,t.currentTag=new _n(We(We({},t.currentTag),{isOpening:!0}))):(t.state=0,t.currentTag=Tu)}function xD(t,e,n){Gr(n)?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),t.state=4):e==="<"?vn(t):e==="/"?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),t.state=12):e===">"?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),Tn(t)):xi(n)||ut(n)||e===":"||qt(t)}function FD(t,e,n){e===">"?qt(t):xi(n)?t.state=3:qt(t)}function HD(t,e,n){Gr(n)||(e==="/"?t.state=12:e===">"?Tn(t):e==="<"?vn(t):e==="="||gu(n)||function(r){return r>=0&&r<=31||r==127}(n)?qt(t):t.state=5)}function UD(t,e,n){Gr(n)?t.state=6:e==="/"?t.state=12:e==="="?t.state=7:e===">"?Tn(t):e==="<"?vn(t):gu(n)&&qt(t)}function BD(t,e,n){Gr(n)||(e==="/"?t.state=12:e==="="?t.state=7:e===">"?Tn(t):e==="<"?vn(t):gu(n)?qt(t):t.state=5)}function jD(t,e,n){Gr(n)||(e==='"'?t.state=8:e==="'"?t.state=9:/[>=`]/.test(e)?qt(t):e==="<"?vn(t):t.state=10)}function $D(t,e){e==='"'&&(t.state=11)}function VD(t,e){e==="'"&&(t.state=11)}function zD(t,e,n){Gr(n)?t.state=4:e===">"?Tn(t):e==="<"&&vn(t)}function YD(t,e,n){Gr(n)?t.state=4:e==="/"?t.state=12:e===">"?Tn(t):e==="<"?vn(t):(t.state=4,function(r){r.charIdx--}(t))}function GD(t,e){e===">"?(t.currentTag=new _n(We(We({},t.currentTag),{isClosing:!0})),Tn(t)):qt(t)}function WD(t){var e=t.html,n=t.charIdx;e.slice(n,n+2)==="--"?(t.charIdx++,t.currentTag=new _n(We(We({},t.currentTag),{type:"comment"})),t.state=14):e.slice(n,n+7).toUpperCase()==="DOCTYPE"?(t.charIdx+=6,t.currentTag=new _n(We(We({},t.currentTag),{type:"doctype"})),t.state=20):qt(t)}function XD(t,e){e==="-"?t.state=15:e===">"?qt(t):t.state=16}function KD(t,e){e==="-"?t.state=18:e===">"?qt(t):t.state=16}function qD(t,e){e==="-"&&(t.state=17)}function JD(t,e){t.state=e==="-"?18:16}function ZD(t,e){e===">"?Tn(t):e==="!"?t.state=19:e==="-"||(t.state=16)}function QD(t,e){e==="-"?t.state=17:e===">"?Tn(t):t.state=16}function ev(t,e){e===">"?Tn(t):e==="<"&&vn(t)}function qt(t){t.state=0,t.currentTag=Tu}function vn(t){t.state=1,t.currentTag=new _n({idx:t.charIdx})}function Tn(t){var e=t.html.slice(t.currentDataIdx,t.currentTag.idx);e&&t.callbacks.onText(e,t.currentDataIdx);var n=t.currentTag;n.type==="comment"?t.callbacks.onComment(n.idx):n.type==="doctype"?t.callbacks.onDoctype(n.idx):(n.isOpening&&t.callbacks.onOpenTag(n.name,n.idx),n.isClosing&&t.callbacks.onCloseTag(n.name,n.idx)),qt(t),t.currentDataIdx=t.charIdx+1}function pl(t){var e=t.currentTag.idx+(t.currentTag.isClosing?2:1);return t.html.slice(e,t.charIdx).toLowerCase()}var tv=function(){function t(e){e===void 0&&(e={}),this.version=t.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.tagBuilder=null,this.urls=function(o){return o==null&&(o=!0),zt(o)?{schemeMatches:o,tldMatches:o,ipV4Matches:o}:{schemeMatches:!zt(o.schemeMatches)||o.schemeMatches,tldMatches:!zt(o.tldMatches)||o.tldMatches,ipV4Matches:!zt(o.ipV4Matches)||o.ipV4Matches}}(e.urls),this.email=zt(e.email)?e.email:this.email,this.phone=zt(e.phone)?e.phone:this.phone,this.hashtag=e.hashtag||this.hashtag,this.mention=e.mention||this.mention,this.newWindow=zt(e.newWindow)?e.newWindow:this.newWindow,this.stripPrefix=function(o){return o==null&&(o=!0),zt(o)?{scheme:o,www:o}:{scheme:!zt(o.scheme)||o.scheme,www:!zt(o.www)||o.www}}(e.stripPrefix),this.stripTrailingSlash=zt(e.stripTrailingSlash)?e.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=zt(e.decodePercentEncoding)?e.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=e.sanitizeHtml||!1;var n=this.mention;if(n!==!1&&UO.indexOf(n)===-1)throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var r,i=this.hashtag;if(i!==!1&&xO.indexOf(i)===-1)throw new Error("invalid `hashtag` cfg '".concat(i,"' - see docs"));this.truncate=typeof(r=e.truncate)=="number"?{length:r,location:"end"}:We({length:Number.POSITIVE_INFINITY,location:"end"},r),this.className=e.className||this.className,this.replaceFn=e.replaceFn||this.replaceFn,this.context=e.context||this}return t.link=function(e,n){return new t(n).link(e)},t.parse=function(e,n){return new t(n).parse(e)},t.prototype.parse=function(e){var n=this,r=["a","style","script"],i=0,o=[];return function(s,a){for(var l=new wD(s,a),u=s.length;l.charIdx<u;){var c=s.charAt(l.charIdx),h=s.charCodeAt(l.charIdx);switch(l.state){case 0:MD(l,c);break;case 1:PD(l,c,h);break;case 2:FD(l,c,h);break;case 3:xD(l,c,h);break;case 4:HD(l,c,h);break;case 5:UD(l,c,h);break;case 6:BD(l,c,h);break;case 7:jD(l,c,h);break;case 8:$D(l,c);break;case 9:VD(l,c);break;case 10:zD(l,c,h);break;case 11:YD(l,c,h);break;case 12:GD(l,c);break;case 13:WD(l);break;case 14:XD(l,c);break;case 15:KD(l,c);break;case 16:qD(l,c);break;case 17:JD(l,c);break;case 18:ZD(l,c);break;case 19:QD(l,c);break;case 20:ev(l,c);break;default:Fr(l.state)}l.charIdx++}l.currentDataIdx<l.charIdx&&function(d){var p=d.html.slice(d.currentDataIdx,d.charIdx);d.callbacks.onText(p,d.currentDataIdx),d.currentDataIdx=d.charIdx+1}(l)}(e,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=s.split(/( | |<|<|>|>|"|"|')/gi),u=a;l.forEach(function(c,h){if(h%2==0){var d=n.parseText(c,u);o.push.apply(o,function(p,f,m){if(m||arguments.length===2)for(var E,A=0,_=f.length;A<_;A++)!E&&A in f||(E||(E=Array.prototype.slice.call(f,0,A)),E[A]=f[A]);return p.concat(E||Array.prototype.slice.call(f))}([],function(p,f){var m=typeof Symbol=="function"&&p[Symbol.iterator];if(!m)return p;var E,A,_=m.call(p),g=[];try{for(;(f===void 0||f-- >0)&&!(E=_.next()).done;)g.push(E.value)}catch(O){A={error:O}}finally{try{E&&!E.done&&(m=_.return)&&m.call(_)}finally{if(A)throw A.error}}return g}(d),!1))}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(){},onDoctype:function(){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},t.prototype.compactMatches=function(e){e.sort(nv);for(var n=0;n<e.length-1;){var r=e[n],i=r.getOffset(),o=r.getMatchedText().length;if(n+1<e.length&&e[n+1].getOffset()===i){var s=e[n+1].getMatchedText().length>o?n:n+1;e.splice(s,1)}else n++}return e},t.prototype.removeUnwantedMatches=function(e){return this.hashtag||_r(e,function(n){return n.getType()==="hashtag"}),this.email||_r(e,function(n){return n.getType()==="email"}),this.phone||_r(e,function(n){return n.getType()==="phone"}),this.mention||_r(e,function(n){return n.getType()==="mention"}),this.urls.schemeMatches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="scheme"}),this.urls.tldMatches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="tld"}),this.urls.ipV4Matches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="ipV4"}),e},t.prototype.parseText=function(e,n){n=n||0;for(var r=function(s,a){for(var l=new zO(s,a);l.charIdx<l.text.length;l.charIdx++){var u=s.charAt(l.charIdx),c=s.charCodeAt(l.charIdx);if(l.stateMachines.length===0)Da(l,u,c);else{for(var h=l.stateMachines.length-1;h>=0;h--){var d=l.stateMachines[h];switch(d.state){case 11:qO(l,d,c);break;case 12:JO(l,d,c);break;case 0:YO(l,d,c);break;case 1:GO(l,d,c);break;case 2:WO(l,d,c);break;case 3:XO(l,d,c);break;case 4:KO(l,d,0,c);break;case 5:ZO(l,d,c);break;case 6:QO(l,d,0,c);break;case 7:eD(l,d,0,c);break;case 13:tD(l,d,c);break;case 14:nD(l,d,c);break;case 8:rD(l,d,c);break;case 9:iD(l,d,c);break;case 10:oD(l,d,c);break;case 15:sD(l,d,u,c);break;case 16:aD(l,d,u,c);break;case 17:lD(l,d,u,c);break;case 18:cD(l,d,u,c);break;case 19:uD(l,d,u,c);break;case 20:dD(l,d,c);break;case 21:hD(l,d,c);break;case 22:Xr(l,d,c);break;case 23:pD(l,d,c);break;case 24:fD(l,d,c);break;case 25:mD(l,d,c);break;case 26:ED(l,d,c);break;case 27:_D(l,d,c);break;case 28:AD(l,d,c);break;case 29:gD(l,d,c);break;case 30:SD(l,d,c);break;case 31:OD(l,d,c);break;case 32:vD(l,d,u,c);break;case 33:TD(l,d,c);break;case 34:RD(l,d,c);break;case 35:CD(l,d,c);break;case 36:ID(l,d,0,c);break;case 37:DD(l,d,u,c);break;case 38:yD(l,d,0,c);break;case 39:ND(l,d,u,c);break;case 40:bD(l,d,c);break;case 41:kD(l,d,c);break;default:Fr(d.state)}}if(!l.hasSchemeUrlMachine()&&l.charIdx>0&&vo(c)){var p=l.text.charCodeAt(l.charIdx-1);vo(p)||l.addMachine(va(l.charIdx,0))}}}for(var f=l.stateMachines.length-1;f>=0;f--)l.stateMachines.forEach(function(m){return Le(l,m)});return l.matches}(e,{tagBuilder:this.getTagBuilder(),stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding,hashtagServiceName:this.hashtag,mentionServiceName:this.mention||"twitter"}),i=0,o=r.length;i<o;i++)r[i].setOffset(n+r[i].getOffset());return r},t.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var n=this.parse(e),r=new Array(2*n.length+1),i=0,o=0,s=n.length;o<s;o++){var a=n[o];r.push(e.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(e.substring(i)),r.join("")},t.prototype.createMatchReturnVal=function(e){var n;return this.replaceFn&&(n=this.replaceFn.call(this.context,e)),typeof n=="string"?n:n===!1?e.getMatchedText():n instanceof qE?n.toAnchorString():e.buildTag().toAnchorString()},t.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new TO({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},t.version="4.1.5",t}();function nv(t,e){return t.getOffset()-e.getOffset()}function a_(t,e=t){return{type:"autolink",url:t,text:e}}const rv=()=>$n(/```([^]+?)```/g,([t,e])=>({type:"codespan",text:XE(e)})),iv=$n(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([t,e,n])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(e),n)),ov=$n(/<!!customemoji:(.*?)>/gm,([t,e])=>function(n){return{type:"customemoji",text:n}}(e)),l_=$n(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([t,e,n])=>function(r,i=[]){return{type:"link",url:r,children:i}}(e,[n])),sv=$n(/<actionlink:([^|]+)[|]([^>]*)>/gi,([t,e,n])=>{const{action:r,params:i}=c_(e);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[n])}),av=$n(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([t,e,n])=>{const{action:r,params:i}=c_(e);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[n])});function c_(t){const e=t.indexOf("?");return e===-1?{action:t,params:{}}:{action:t.slice(0,e),params:Object.fromEntries(new URLSearchParams(t.slice(e)))}}const lv=$n(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([t])=>function(e=[]){return{type:"bulletlist",children:e}}([t.startsWith(`
|
|
16
|
+
`).scrollIntoView()),!0)},(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Bt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=lc(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(s,o.createAndFill());a.setSelection(Ee.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Es(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&su(r);return i!=null&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},cO),"Mod-Enter":(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=lc(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ae.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Backspace:ul,"Mod-Backspace":ul,"Shift-Backspace":ul,Delete:ep,"Mod-Delete":ep,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new Bt(t.doc))),!0)},YE={"Ctrl-h":Ln.Backspace,"Alt-Backspace":Ln["Mod-Backspace"],"Ctrl-d":Ln.Delete,"Ctrl-Alt-Backspace":Ln["Mod-Delete"],"Alt-Delete":Ln["Mod-Delete"],"Alt-d":Ln["Mod-Delete"],"Ctrl-a":uO,"Ctrl-e":dO};for(let t in Ln)YE[t]=Ln[t];const ts=(typeof navigator!="undefined"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!(typeof os=="undefined"||!os.platform)&&os.platform()=="darwin")?YE:Ln;function _u(t,e){return t.reduce((n,r,i)=>n.concat(e(r,i)),[])}var Au={};function hO(t){return String.fromCharCode(parseInt(t.slice(1),16))}Object.defineProperty(Au,"__esModule",{value:!0});var pO=Au.encode=function(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,hO))};function fO(t){return`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`}Au.decode=function(t){return decodeURIComponent(Array.from(atob(t),fO).join(""))};const mO=/[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF\u0400-\u044f\u0300-\u036e]+/,EO=t=>t.split(mO).filter(e=>e).map(e=>e[0]).join("")||t[Symbol.iterator]().next().value||"";function GE(t){const e=function(n){let r=0;for(let i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r&=r;return Math.abs(r)}(t)%rp.length;return rp[e]}function Oa(t,e){const n=e.lastIndex;let r;const i=[];for(;(r=e.exec(t))!==null;)i.push(r),r[0]===""&&(e.lastIndex+=1);return e.lastIndex=n,i}function cc(t,e,n){let r=0;const i=[];for(const o of e)o.offset<r||(o.offset>r&&i.push(t.substring(r,o.offset)),i.push(...n(o)),r=o.offset+o.matchedText.length);return r<t.length&&i.push(t.substring(r)),i}function WE(t){try{return new URL(t).hostname}catch(e){return}}const _O=13;function tp(t){return t.keyCode===_O&&!t.shiftKey}function ns(t){const e=t.replace(/%2F/g,"/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/,"$1"),n=decodeURIComponent(e);if(/%[0-9A-Fa-f]{2}/.test(n))try{return decodeURIComponent(n.replace(/\+/g,"%20"))}catch(r){return n}return n}function np(t,e){return t.localeCompare(e,void 0,{usage:"search",sensitivity:"base"})===0}function AO(t){return[...t.matchAll(/^|\s+/g)].map(n=>n.index+n[0].length).map(n=>t.substring(n))}const rp=["#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"],oo=(t,e,n=void 0)=>_u(t,r=>{if(typeof r=="string")return e(r,n);switch(r.type){case"bold":case"italic":case"strikethrough":case"blockquote":case"bulletlist":case"bulletList":case"bulletpoint":case"bulletPoint":return[{type:r.type,children:oo(r.children,e,r.type)}];case"link":return[{type:r.type,url:r.url,children:oo(r.children,e,r.type)}];case"actionlink":case"actionLink":case"actionbutton":case"actionButton":return[{type:r.type,action:r.action,params:r.params,children:oo(r.children,e,r.type)}];case"mention":case"autolink":case"autoLink":case"codeblock":case"codeBlock":case"codespan":case"codeSpan":case"suppressed":case"emoji":case"customemoji":case"customEmoji":return[r]}});function $n(t,e){return n=>{const r=n;let i=0;const o=[];for(const s of Oa(n,t)){s.index-i>0&&o.push(r.substring(i,s.index));const a=e(s);Array.isArray(a)?o.push(...a):o.push(a),i=s.index+s[0].length}return i<n.length&&o.push(n.substring(i)),o}}function XE(t){return t.replace(/<!!mention:.*?\|([^>]*)>/gim,"@$1").replace(/<!!customemoji:(.*?)>/gim,"$1")}const ip="’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var uc=(t=>(t[t.italic=1]="italic",t[t.strikethrough=2]="strikethrough",t[t.bold=4]="bold",t))(uc||{});const gO=[0,1,2,3,4,5,6].map(t=>{const e=[];return 1&t||e.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/),2&t||e.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/),4&t||e.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/),new RegExp(e.map(n=>n.source).join("|"),"g")}),SO={_:1,"*":4,"~":2};function OO(t){return KE(t,0)}function KE(t,e=0){const n=gO[e],r=n?function(i){const o=DO.getOrCompute(i,()=>new RegExp(`(?:^|[\\s${ip}])(?:${i.source})(?=[\\s${ip}]|$)`,"g")),s=$n(o,a=>{const l=a[0][1],u=a[1]||a[2]||a[3]||a[4]||a[5]||a[6];return[" ",{type:uc[SO[l]],children:[u]}]});return a=>{const[l,...u]=s(" "+a);return l.length>1&&u.unshift(l.substring(1)),u}}(n):()=>[t];return oo(r(t),(i,o)=>o==="bold"||o==="italic"||o==="strikethrough"?KE(i,e|uc[o]):[i])}const DO=function(){const t=function(){try{return new WeakMap}catch(e){const n={has:()=>!1,get:()=>{},set:()=>n};return n}}();return{getOrCompute(e,n){if(t.has(e))return t.get(e);const r=n();return t.set(e,r),r}}}();var dc=function(t,e){return dc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},dc(t,e)};function Uo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}dc(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var We=function(){return We=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},We.apply(this,arguments)};var vO=Object.prototype.hasOwnProperty;function zt(t){return typeof t=="boolean"}function _r(t,e){for(var n=t.length-1;n>=0;n--)e(t[n])===!0&&t.splice(n,1)}function Fr(t){throw new Error("Unhandled case for value: '".concat(t,"'"))}var rs=/\s+/,qE=function(){function t(e){e===void 0&&(e={}),this.tagName="",this.attrs={},this.innerHTML="",this.tagName=e.tagName||"",this.attrs=e.attrs||{},this.innerHTML=e.innerHtml||e.innerHTML||""}return t.prototype.setTagName=function(e){return this.tagName=e,this},t.prototype.getTagName=function(){return this.tagName},t.prototype.setAttr=function(e,n){return this.getAttrs()[e]=n,this},t.prototype.getAttr=function(e){return this.getAttrs()[e]},t.prototype.setAttrs=function(e){return Object.assign(this.getAttrs(),e),this},t.prototype.getAttrs=function(){return this.attrs},t.prototype.setClass=function(e){return this.setAttr("class",e)},t.prototype.addClass=function(e){for(var n,r=this.getClass(),i=r?r.split(rs):[],o=e.split(rs);n=o.shift();)i.indexOf(n)===-1&&i.push(n);return this.getAttrs().class=i.join(" "),this},t.prototype.removeClass=function(e){for(var n,r=this.getClass(),i=r?r.split(rs):[],o=e.split(rs);i.length&&(n=o.shift());){var s=i.indexOf(n);s!==-1&&i.splice(s,1)}return this.getAttrs().class=i.join(" "),this},t.prototype.getClass=function(){return this.getAttrs().class||""},t.prototype.hasClass=function(e){return(" "+this.getClass()+" ").indexOf(" "+e+" ")!==-1},t.prototype.setInnerHTML=function(e){return this.innerHTML=e,this},t.prototype.setInnerHtml=function(e){return this.setInnerHTML(e)},t.prototype.getInnerHTML=function(){return this.innerHTML||""},t.prototype.getInnerHtml=function(){return this.getInnerHTML()},t.prototype.toAnchorString=function(){var e=this.getTagName(),n=this.buildAttrsStr();return["<",e,n=n?" "+n:"",">",this.getInnerHtml(),"</",e,">"].join("")},t.prototype.buildAttrsStr=function(){var e=this.getAttrs(),n=[];for(var r in e)vO.call(e,r)&&n.push(r+'="'+e[r]+'"');return n.join(" ")},t}();function op(t){var e="";return t.scheme&&t.host&&(e+=t.scheme+"://"),t.host&&(e+=t.host),t.path&&(e+="/"+t.path),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e}function dl(t,e,n){var r=e/2,i=Math.ceil(r),o=-1*Math.floor(r),s="";return o<0&&(s=t.substr(o)),t.substr(0,i)+n+s}var TO=function(){function t(e){e===void 0&&(e={}),this.newWindow=!1,this.truncate={},this.className="",this.newWindow=e.newWindow||!1,this.truncate=e.truncate||{},this.className=e.className||""}return t.prototype.build=function(e){return new qE({tagName:"a",attrs:this.createAttrs(e),innerHtml:this.processAnchorText(e.getAnchorText())})},t.prototype.createAttrs=function(e){var n={href:e.getAnchorHref()},r=this.createCssClass(e);return r&&(n.class=r),this.newWindow&&(n.target="_blank",n.rel="noopener noreferrer"),this.truncate.length&&this.truncate.length<e.getAnchorText().length&&(n.title=e.getAnchorHref()),n},t.prototype.createCssClass=function(e){var n=this.className;if(n){for(var r=[n],i=e.getCssClassSuffixes(),o=0,s=i.length;o<s;o++)r.push(n+"-"+i[o]);return r.join(" ")}return""},t.prototype.processAnchorText=function(e){return e=this.doTruncate(e)},t.prototype.doTruncate=function(e){var n=this.truncate;if(!n.length)return e;var r=n.length,i=n.location;return i==="smart"?function(o,s,a){var l,u;if(a==null?(a="…",u=3,l=8):(u=a.length,l=a.length),o.length<=s)return o;var c=s-u,h=function(_){var g={},O=_,D=O.match(/^([a-z]+):\/\//i);return D&&(g.scheme=D[1],O=O.slice(D[0].length)),(D=O.match(/^(.*?)(?=(\?|#|\/|$))/i))&&(g.host=D[1],O=O.slice(D[0].length)),(D=O.match(/^\/(.*?)(?=(\?|#|$))/i))&&(g.path=D[1],O=O.slice(D[0].length)),(D=O.match(/^\?(.*?)(?=(#|$))/i))&&(g.query=D[1],O=O.slice(D[0].length)),(D=O.match(/^#(.*?)$/i))&&(g.fragment=D[1]),g}(o);if(h.query){var d=h.query.match(/^(.*?)(?=(\?|#))(.*?)$/i);d&&(h.query=h.query.substr(0,d[1].length),o=op(h))}if(o.length<=s||(h.host&&(h.host=h.host.replace(/^www\./,""),o=op(h)),o.length<=s))return o;var p="";if(h.host&&(p+=h.host),p.length>=c)return h.host.length===s?(h.host.substr(0,s-u)+a).substr(0,c+l):dl(p,c,a).substr(0,c+l);var f="";if(h.path&&(f+="/"+h.path),h.query&&(f+="?"+h.query),f){if((p+f).length>=c)return(p+f).length==s?(p+f).substr(0,s):(p+dl(f,c-p.length,a)).substr(0,c+l);p+=f}if(h.fragment){var m="#"+h.fragment;if((p+m).length>=c)return(p+m).length==s?(p+m).substr(0,s):(p+dl(m,c-p.length,a)).substr(0,c+l);p+=m}if(h.scheme&&h.host){var E=h.scheme+"://";if((p+E).length<c)return(E+p).substr(0,s)}if(p.length<=s)return p;var A="";return c>0&&(A=p.substr(-1*Math.floor(c/2))),(p.substr(0,Math.ceil(c/2))+a+A).substr(0,c+l)}(e,r):i==="middle"?function(o,s,a){if(o.length<=s)return o;var l,u;a==null?(a="…",l=8,u=3):(l=a.length,u=a.length);var c=s-u,h="";return c>0&&(h=o.substr(-1*Math.floor(c/2))),(o.substr(0,Math.ceil(c/2))+a+h).substr(0,c+l)}(e,r):function(o,s,a){return function(l,u,c){var h;return l.length>u&&(c==null?(c="…",h=3):h=c.length,l=l.substring(0,u-h)+c),l}(o,s,a)}(e,r)},t}(),Bo=function(){function t(e){this._=null,this.matchedText="",this.offset=0,this.tagBuilder=e.tagBuilder,this.matchedText=e.matchedText,this.offset=e.offset}return t.prototype.getMatchedText=function(){return this.matchedText},t.prototype.setOffset=function(e){this.offset=e},t.prototype.getOffset=function(){return this.offset},t.prototype.getCssClassSuffixes=function(){return[this.type]},t.prototype.buildTag=function(){return this.tagBuilder.build(this)},t}();function xi(t){return t>=65&&t<=90||t>=97&&t<=122}function ut(t){return t>=48&&t<=57}function gu(t){return t==34||t==39}function Gr(t){return t<8232?t<160?t>=9&&t<=13||t==32:t<5760?t==160:t==5760||t>=8192&&t<=8202:t<8287?t>=8232&&t<=8233||t==8239:t<12288?t==8287:t==12288||t==65279}function Wr(t){return t<4800?t<2949?t<2451?t<1425?t<768?t<192?t<169?t<65?t>=48&&t<=57:t>=65&&t<=90||t>=97&&t<=122:t<181?t>=169&&t<=170||t==174:t==181||t==186:t<710?t<216?t>=192&&t<=214:t>=216&&t<=246||t>=248&&t<=705:t<748?t>=710&&t<=721||t>=736&&t<=740:t==748||t==750:t<910?t<895?t<886?t>=768&&t<=884:t>=886&&t<=887||t>=890&&t<=893:t<904?t==895||t==902:t>=904&&t<=906||t==908:t<1155?t<931?t>=910&&t<=929:t>=931&&t<=1013||t>=1015&&t<=1153:t<1369?t>=1155&&t<=1327||t>=1329&&t<=1366:t==1369||t>=1377&&t<=1415:t<1808?t<1552?t<1476?t<1471?t>=1425&&t<=1469:t==1471||t>=1473&&t<=1474:t<1488?t>=1476&&t<=1477||t==1479:t>=1488&&t<=1514||t>=1520&&t<=1522:t<1749?t<1568?t>=1552&&t<=1562:t>=1568&&t<=1641||t>=1646&&t<=1747:t<1770?t>=1749&&t<=1756||t>=1759&&t<=1768:t>=1770&&t<=1788||t==1791:t<2230?t<2042?t<1869?t>=1808&&t<=1866:t>=1869&&t<=1969||t>=1984&&t<=2037:t<2112?t==2042||t>=2048&&t<=2093:t>=2112&&t<=2139||t>=2208&&t<=2228:t<2406?t<2260?t>=2230&&t<=2237:t>=2260&&t<=2273||t>=2275&&t<=2403:t<2437?t>=2406&&t<=2415||t>=2417&&t<=2435:t>=2437&&t<=2444||t>=2447&&t<=2448:t<2693?t<2579?t<2519?t<2486?t<2474?t>=2451&&t<=2472:t>=2474&&t<=2480||t==2482:t<2503?t>=2486&&t<=2489||t>=2492&&t<=2500:t>=2503&&t<=2504||t>=2507&&t<=2510:t<2534?t<2524?t==2519:t>=2524&&t<=2525||t>=2527&&t<=2531:t<2565?t>=2534&&t<=2545||t>=2561&&t<=2563:t>=2565&&t<=2570||t>=2575&&t<=2576:t<2631?t<2613?t<2602?t>=2579&&t<=2600:t>=2602&&t<=2608||t>=2610&&t<=2611:t<2620?t>=2613&&t<=2614||t>=2616&&t<=2617:t==2620||t>=2622&&t<=2626:t<2649?t<2635?t>=2631&&t<=2632:t>=2635&&t<=2637||t==2641:t<2662?t>=2649&&t<=2652||t==2654:t>=2662&&t<=2677||t>=2689&&t<=2691:t<2821?t<2759?t<2730?t<2703?t>=2693&&t<=2701:t>=2703&&t<=2705||t>=2707&&t<=2728:t<2741?t>=2730&&t<=2736||t>=2738&&t<=2739:t>=2741&&t<=2745||t>=2748&&t<=2757:t<2784?t<2763?t>=2759&&t<=2761:t>=2763&&t<=2765||t==2768:t<2809?t>=2784&&t<=2787||t>=2790&&t<=2799:t==2809||t>=2817&&t<=2819:t<2887?t<2858?t<2831?t>=2821&&t<=2828:t>=2831&&t<=2832||t>=2835&&t<=2856:t<2869?t>=2858&&t<=2864||t>=2866&&t<=2867:t>=2869&&t<=2873||t>=2876&&t<=2884:t<2911?t<2902?t>=2887&&t<=2888||t>=2891&&t<=2893:t>=2902&&t<=2903||t>=2908&&t<=2909:t<2929?t>=2911&&t<=2915||t>=2918&&t<=2927:t==2929||t>=2946&&t<=2947:t<3517?t<3205?t<3046?t<2984?t<2969?t<2958?t>=2949&&t<=2954:t>=2958&&t<=2960||t>=2962&&t<=2965:t<2974?t>=2969&&t<=2970||t==2972:t>=2974&&t<=2975||t>=2979&&t<=2980:t<3014?t<2990?t>=2984&&t<=2986:t>=2990&&t<=3001||t>=3006&&t<=3010:t<3024?t>=3014&&t<=3016||t>=3018&&t<=3021:t==3024||t==3031:t<3142?t<3086?t<3072?t>=3046&&t<=3055:t>=3072&&t<=3075||t>=3077&&t<=3084:t<3114?t>=3086&&t<=3088||t>=3090&&t<=3112:t>=3114&&t<=3129||t>=3133&&t<=3140:t<3160?t<3146?t>=3142&&t<=3144:t>=3146&&t<=3149||t>=3157&&t<=3158:t<3174?t>=3160&&t<=3162||t>=3168&&t<=3171:t>=3174&&t<=3183||t>=3200&&t<=3203:t<3333?t<3274?t<3242?t<3214?t>=3205&&t<=3212:t>=3214&&t<=3216||t>=3218&&t<=3240:t<3260?t>=3242&&t<=3251||t>=3253&&t<=3257:t>=3260&&t<=3268||t>=3270&&t<=3272:t<3296?t<3285?t>=3274&&t<=3277:t>=3285&&t<=3286||t==3294:t<3313?t>=3296&&t<=3299||t>=3302&&t<=3311:t>=3313&&t<=3314||t>=3329&&t<=3331:t<3423?t<3389?t<3342?t>=3333&&t<=3340:t>=3342&&t<=3344||t>=3346&&t<=3386:t<3402?t>=3389&&t<=3396||t>=3398&&t<=3400:t>=3402&&t<=3406||t>=3412&&t<=3415:t<3458?t<3430?t>=3423&&t<=3427:t>=3430&&t<=3439||t>=3450&&t<=3455:t<3482?t>=3458&&t<=3459||t>=3461&&t<=3478:t>=3482&&t<=3505||t>=3507&&t<=3515:t<3804?t<3722?t<3570?t<3535?t<3520?t==3517:t>=3520&&t<=3526||t==3530:t<3544?t>=3535&&t<=3540||t==3542:t>=3544&&t<=3551||t>=3558&&t<=3567:t<3664?t<3585?t>=3570&&t<=3571:t>=3585&&t<=3642||t>=3648&&t<=3662:t<3716?t>=3664&&t<=3673||t>=3713&&t<=3714:t==3716||t>=3719&&t<=3720:t<3754?t<3737?t<3725?t==3722:t==3725||t>=3732&&t<=3735:t<3749?t>=3737&&t<=3743||t>=3745&&t<=3747:t==3749||t==3751:t<3776?t<3757?t>=3754&&t<=3755:t>=3757&&t<=3769||t>=3771&&t<=3773:t<3784?t>=3776&&t<=3780||t==3782:t>=3784&&t<=3789||t>=3792&&t<=3801:t<4176?t<3902?t<3872?t<3840?t>=3804&&t<=3807:t==3840||t>=3864&&t<=3865:t<3895?t>=3872&&t<=3881||t==3893:t==3895||t==3897:t<3974?t<3913?t>=3902&&t<=3911:t>=3913&&t<=3948||t>=3953&&t<=3972:t<4038?t>=3974&&t<=3991||t>=3993&&t<=4028:t==4038||t>=4096&&t<=4169:t<4688?t<4301?t<4256?t>=4176&&t<=4253:t>=4256&&t<=4293||t==4295:t<4348?t==4301||t>=4304&&t<=4346:t>=4348&&t<=4680||t>=4682&&t<=4685:t<4746?t<4698?t>=4688&&t<=4694||t==4696:t>=4698&&t<=4701||t>=4704&&t<=4744:t<4786?t>=4746&&t<=4749||t>=4752&&t<=4784:t>=4786&&t<=4789||t>=4792&&t<=4798:t<11035?t<7416?t<6176?t<5873?t<4992?t<4824?t<4802?t==4800:t>=4802&&t<=4805||t>=4808&&t<=4822:t<4888?t>=4824&&t<=4880||t>=4882&&t<=4885:t>=4888&&t<=4954||t>=4957&&t<=4959:t<5121?t<5024?t>=4992&&t<=5007:t>=5024&&t<=5109||t>=5112&&t<=5117:t<5761?t>=5121&&t<=5740||t>=5743&&t<=5759:t>=5761&&t<=5786||t>=5792&&t<=5866:t<6002?t<5920?t<5888?t>=5873&&t<=5880:t>=5888&&t<=5900||t>=5902&&t<=5908:t<5984?t>=5920&&t<=5940||t>=5952&&t<=5971:t>=5984&&t<=5996||t>=5998&&t<=6e3:t<6108?t<6016?t>=6002&&t<=6003:t>=6016&&t<=6099||t==6103:t<6155?t>=6108&&t<=6109||t>=6112&&t<=6121:t>=6155&&t<=6157||t>=6160&&t<=6169:t<6783?t<6512?t<6400?t<6272?t>=6176&&t<=6263:t>=6272&&t<=6314||t>=6320&&t<=6389:t<6448?t>=6400&&t<=6430||t>=6432&&t<=6443:t>=6448&&t<=6459||t>=6470&&t<=6509:t<6608?t<6528?t>=6512&&t<=6516:t>=6528&&t<=6571||t>=6576&&t<=6601:t<6688?t>=6608&&t<=6617||t>=6656&&t<=6683:t>=6688&&t<=6750||t>=6752&&t<=6780:t<7040?t<6832?t<6800?t>=6783&&t<=6793:t>=6800&&t<=6809||t==6823:t<6992?t>=6832&&t<=6846||t>=6912&&t<=6987:t>=6992&&t<=7001||t>=7019&&t<=7027:t<7245?t<7168?t>=7040&&t<=7155:t>=7168&&t<=7223||t>=7232&&t<=7241:t<7376?t>=7245&&t<=7293||t>=7296&&t<=7304:t>=7376&&t<=7378||t>=7380&&t<=7414:t<8450?t<8130?t<8025?t<7960?t<7424?t>=7416&&t<=7417:t>=7424&&t<=7669||t>=7675&&t<=7957:t<8008?t>=7960&&t<=7965||t>=7968&&t<=8005:t>=8008&&t<=8013||t>=8016&&t<=8023:t<8031?t<8027?t==8025:t==8027||t==8029:t<8118?t>=8031&&t<=8061||t>=8064&&t<=8116:t>=8118&&t<=8124||t==8126:t<8205?t<8150?t<8134?t>=8130&&t<=8132:t>=8134&&t<=8140||t>=8144&&t<=8147:t<8178?t>=8150&&t<=8155||t>=8160&&t<=8172:t>=8178&&t<=8180||t>=8182&&t<=8188:t<8305?t<8252?t==8205:t==8252||t==8265:t<8336?t==8305||t==8319:t>=8336&&t<=8348||t>=8400&&t<=8432:t<8579?t<8486?t<8469?t<8455?t==8450:t==8455||t>=8458&&t<=8467:t<8482?t==8469||t>=8473&&t<=8477:t==8482||t==8484:t<8495?t<8488?t==8486:t==8488||t>=8490&&t<=8493:t<8517?t>=8495&&t<=8505||t>=8508&&t<=8511:t>=8517&&t<=8521||t==8526:t<9410?t<9e3?t<8592?t>=8579&&t<=8580:t>=8592&&t<=8703||t>=8986&&t<=8987:t<9193?t==9e3||t==9167:t>=9193&&t<=9203||t>=9208&&t<=9210:t<9723?t<9654?t==9410||t>=9642&&t<=9643:t==9654||t==9664:t<10548?t>=9723&&t<=9726||t>=9728&&t<=10175:t>=10548&&t<=10549||t>=11013&&t<=11015:t<43259?t<12445?t<11688?t<11520?t<11264?t<11088?t>=11035&&t<=11036:t==11088||t==11093:t<11360?t>=11264&&t<=11310||t>=11312&&t<=11358:t>=11360&&t<=11492||t>=11499&&t<=11507:t<11568?t<11559?t>=11520&&t<=11557:t==11559||t==11565:t<11647?t>=11568&&t<=11623||t==11631:t>=11647&&t<=11670||t>=11680&&t<=11686:t<11744?t<11712?t<11696?t>=11688&&t<=11694:t>=11696&&t<=11702||t>=11704&&t<=11710:t<11728?t>=11712&&t<=11718||t>=11720&&t<=11726:t>=11728&&t<=11734||t>=11736&&t<=11742:t<12330?t<11823?t>=11744&&t<=11775:t==11823||t>=12293&&t<=12294:t<12353?t>=12330&&t<=12341||t>=12347&&t<=12349:t>=12353&&t<=12438||t>=12441&&t<=12442:t<42512?t<12951?t<12549?t<12449?t>=12445&&t<=12447:t>=12449&&t<=12538||t>=12540&&t<=12543:t<12704?t>=12549&&t<=12589||t>=12593&&t<=12686:t>=12704&&t<=12730||t>=12784&&t<=12799:t<19968?t<12953?t==12951:t==12953||t>=13312&&t<=19893:t<42192?t>=19968&&t<=40917||t>=40960&&t<=42124:t>=42192&&t<=42237||t>=42240&&t<=42508:t<42891?t<42623?t<42560?t>=42512&&t<=42539:t>=42560&&t<=42610||t>=42612&&t<=42621:t<42775?t>=42623&&t<=42725||t>=42736&&t<=42737:t>=42775&&t<=42783||t>=42786&&t<=42888:t<43072?t<42928?t>=42891&&t<=42926:t>=42928&&t<=42935||t>=42999&&t<=43047:t<43216?t>=43072&&t<=43123||t>=43136&&t<=43205:t>=43216&&t<=43225||t>=43232&&t<=43255:t<55243?t<43744?t<43488?t<43312?t<43261?t==43259:t==43261||t>=43264&&t<=43309:t<43392?t>=43312&&t<=43347||t>=43360&&t<=43388:t>=43392&&t<=43456||t>=43471&&t<=43481:t<43600?t<43520?t>=43488&&t<=43518:t>=43520&&t<=43574||t>=43584&&t<=43597:t<43642?t>=43600&&t<=43609||t>=43616&&t<=43638:t>=43642&&t<=43714||t>=43739&&t<=43741:t<43824?t<43785?t<43762?t>=43744&&t<=43759:t>=43762&&t<=43766||t>=43777&&t<=43782:t<43808?t>=43785&&t<=43790||t>=43793&&t<=43798:t>=43808&&t<=43814||t>=43816&&t<=43822:t<44012?t<43868?t>=43824&&t<=43866:t>=43868&&t<=43877||t>=43888&&t<=44010:t<44032?t>=44012&&t<=44013||t>=44016&&t<=44025:t>=44032&&t<=55203||t>=55216&&t<=55238:t<64848?t<64298?t<64112?t<55296?t>=55243&&t<=55291:t>=55296&&t<=57343||t>=63744&&t<=64109:t<64275?t>=64112&&t<=64217||t>=64256&&t<=64262:t>=64275&&t<=64279||t>=64285&&t<=64296:t<64320?t<64312?t>=64298&&t<=64310:t>=64312&&t<=64316||t==64318:t<64326?t>=64320&&t<=64321||t>=64323&&t<=64324:t>=64326&&t<=64433||t>=64467&&t<=64829:t<65296?t<65024?t<64914?t>=64848&&t<=64911:t>=64914&&t<=64967||t>=65008&&t<=65019:t<65136?t>=65024&&t<=65039||t>=65056&&t<=65071:t>=65136&&t<=65140||t>=65142&&t<=65276:t<65474?t<65345?t>=65296&&t<=65305||t>=65313&&t<=65338:t>=65345&&t<=65370||t>=65382&&t<=65470:t<65490?t>=65474&&t<=65479||t>=65482&&t<=65487:t>=65490&&t<=65495||t>=65498&&t<=65500}function JE(t){return t<58?t<44?t==33:t==44||t==46:t<63?t>=58&&t<=59:t==63||t==94}function RO(t){return t<91?t==40:t==91||t==123}function sp(t){return t<93?t==41:t==93||t==125}var CO=/^(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|travelersinsurance|vermögensberatung|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbc0a9azcg|xn--nqv7fs00ema|americanfamily|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|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|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|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--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--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|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|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|tatamotors|technology|university|vlaanderen|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--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|pramerica|richardli|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--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|builders|business|capetown|catering|catholic|cipriani|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|banamex|bauhaus|bestbuy|booking|brother|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|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|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|yamaxun|youtube|zuerich|католик|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|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|kindle|kosher|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|nagoya|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|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|walter|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|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|loans|locus|lotte|lotto|mango|media|miami|money|movie|music|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|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|aero|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|dvag|erni|fage|fail|fans|farm|fast|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|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kids|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|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|read|reit|rent|rest|rich|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|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|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|ceo|cfa|cfd|com|cpa|crs|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|gay|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|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|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|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|scb|sew|sex|sfr|ski|sky|soy|spa|srl|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|ss|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|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)$/,ZE=/https?:\/\//i,IO=new RegExp("^"+ZE.source,"i"),yO=/^(javascript|vbscript):/i,NO=/^[A-Za-z][-.+A-Za-z0-9]*:(\/\/)?([^:/]*)/,bO=/^(?:\/\/)?([^/#?:]+)/,vo=xi;function QE(t){return xi(t)||ut(t)||t===43||t===45||t===46}var ur=Wr;function Su(t){return t===95||ur(t)}function e_(t){return Wr(t)||function(e){return e<91?e<47?e>=35&&e<=43||e==45:e<61?e==47:e==61||e==64:e<95?e==91||e==93:e<123?e==95:e>=123&&e<=126||e==10003}(t)||JE(t)}function Ou(t){return t===47||t===63||t===35}function ap(t){return CO.test(t.toLowerCase())}var kO=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,LO=/[:/?#]/,wO=/^(https?:\/\/)?(?:www\.)?/i,MO=/^\/\//,t_=function(t){function e(n){var r=t.call(this,n)||this;return r.type="url",r.url="",r.urlMatchType="scheme",r.protocolRelativeMatch=!1,r.stripPrefix={scheme:!0,www:!0},r.stripTrailingSlash=!0,r.decodePercentEncoding=!0,r.protocolPrepended=!1,r.urlMatchType=n.urlMatchType,r.url=n.url,r.protocolRelativeMatch=n.protocolRelativeMatch,r.stripPrefix=n.stripPrefix,r.stripTrailingSlash=n.stripTrailingSlash,r.decodePercentEncoding=n.decodePercentEncoding,r}return Uo(e,t),e.prototype.getType=function(){return"url"},e.prototype.getUrlMatchType=function(){return this.urlMatchType},e.prototype.getUrl=function(){var n=this.url;return this.protocolRelativeMatch||this.urlMatchType==="scheme"||this.protocolPrepended||(n=this.url="http://"+n,this.protocolPrepended=!0),n},e.prototype.getAnchorHref=function(){return this.getUrl().replace(/&/g,"&")},e.prototype.getAnchorText=function(){var n=this.getMatchedText();return this.protocolRelativeMatch&&(n=n.replace(MO,"")),this.stripPrefix.scheme&&(n=n.replace(IO,"")),this.stripPrefix.www&&(n=function(r){return r.includes("www.")?r.replace(wO,"$1"):r}(n)),this.stripTrailingSlash&&(n=function(r){return r.charAt(r.length-1)==="/"&&(r=r.slice(0,-1)),r}(n)),this.decodePercentEncoding&&(n=function(r){var i=r.replace(/%(?:22|26|27|3C|3E)/gi,function(o){return o==="%22"?""":o==="%26"?"&":o==="%27"?"'":o==="%3C"||o==="%3c"?"<":">"});if(i.includes("%"))try{return decodeURIComponent(i)}catch(o){}return i}(n)),n},e}(Bo),PO=/^mailto:/i,n_=Wr;function Du(t){return n_(t)||function(e){return e<47?e<42?e==33||e>=35&&e<=39:e>=42&&e<=43||e==45:e<63?e==47||e==61:e<94?e==63:e>=94&&e<=96||e>=123&&e<=126}(t)}var r_=function(t){function e(n){var r=t.call(this,n)||this;return r.type="email",r.email="",r.email=n.email,r}return Uo(e,t),e.prototype.getType=function(){return"email"},e.prototype.getEmail=function(){return this.email},e.prototype.getAnchorHref=function(){return"mailto:"+this.email},e.prototype.getAnchorText=function(){return this.email},e}(Bo);function i_(t){return t===95||Wr(t)}var xO=["twitter","facebook","instagram","tiktok","youtube"],FO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="hashtag",r.serviceName="twitter",r.hashtag="",r.serviceName=n.serviceName,r.hashtag=n.hashtag,r}return Uo(e,t),e.prototype.getType=function(){return"hashtag"},e.prototype.getServiceName=function(){return this.serviceName},e.prototype.getHashtag=function(){return this.hashtag},e.prototype.getAnchorHref=function(){var n=this.serviceName,r=this.hashtag;switch(n){case"twitter":return"https://twitter.com/hashtag/"+r;case"facebook":return"https://www.facebook.com/hashtag/"+r;case"instagram":return"https://instagram.com/explore/tags/"+r;case"tiktok":return"https://www.tiktok.com/tag/"+r;case"youtube":return"https://youtube.com/hashtag/"+r;default:Fr(n)}},e.prototype.getAnchorText=function(){return"#"+this.hashtag},e.prototype.getCssClassSuffixes=function(){var n=t.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&n.push(r),n},e}(Bo),HO={twitter:/^@\w{1,15}$/,instagram:/^@[_\w]{1,30}$/,soundcloud:/^@[-a-z0-9_]{3,25}$/,tiktok:/^@[.\w]{1,23}[\w]$/,youtube:/^@[-.·\w]{3,30}$/};function o_(t){return t===45||t===46||t===95||xi(t)||ut(t)}var UO=["twitter","instagram","soundcloud","tiktok","youtube"],BO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="mention",r.serviceName="twitter",r.mention="",r.mention=n.mention,r.serviceName=n.serviceName,r}return Uo(e,t),e.prototype.getType=function(){return"mention"},e.prototype.getMention=function(){return this.mention},e.prototype.getServiceName=function(){return this.serviceName},e.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;case"tiktok":return"https://www.tiktok.com/@"+this.mention;case"youtube":return"https://youtube.com/@"+this.mention;default:Fr(this.serviceName)}},e.prototype.getAnchorText=function(){return"@"+this.mention},e.prototype.getCssClassSuffixes=function(){var n=t.prototype.getCssClassSuffixes.call(this),r=this.getServiceName();return r&&n.push(r),n},e}(Bo),jO=/[-. ()]/,$O=new RegExp("^".concat(/(?:(?:(?:(\+)?\d{1,3}[-. ]?)?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\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)[-. ]?(?:\d[-. ]?){6,12}\d+))([,;]+[0-9]+#?)*/.source,"|").concat(/(0([1-9]-?[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,"$"));function s_(t){return t===45||t===46||t===32}function vu(t){return t===44||t===59}var VO=function(t){function e(n){var r=t.call(this,n)||this;return r.type="phone",r.number="",r.plusSign=!1,r.number=n.number,r.plusSign=n.plusSign,r}return Uo(e,t),e.prototype.getType=function(){return"phone"},e.prototype.getPhoneNumber=function(){return this.number},e.prototype.getNumber=function(){return this.getPhoneNumber()},e.prototype.getAnchorHref=function(){return"tel:"+(this.plusSign?"+":"")+this.number},e.prototype.getAnchorText=function(){return this.matchedText},e}(Bo),zO=function(){function t(e,n){this.charIdx=0,this.matches=[],this._stateMachines=[],this.schemeUrlMachinesCount=0,this.text=e,this.tagBuilder=n.tagBuilder,this.stripPrefix=n.stripPrefix,this.stripTrailingSlash=n.stripTrailingSlash,this.decodePercentEncoding=n.decodePercentEncoding,this.hashtagServiceName=n.hashtagServiceName,this.mentionServiceName=n.mentionServiceName}return Object.defineProperty(t.prototype,"stateMachines",{get:function(){return this._stateMachines},enumerable:!1,configurable:!0}),t.prototype.addMachine=function(e){this._stateMachines.push(e),cp(e)&&this.schemeUrlMachinesCount++},t.prototype.removeMachine=function(e){this._stateMachines=this._stateMachines.filter(function(n){return n!==e}),cp(e)&&this.schemeUrlMachinesCount--},t.prototype.hasSchemeUrlMachine=function(){return this.schemeUrlMachinesCount>0},t}();function Da(t,e,n){var r=t.charIdx;if(n===35)t.addMachine({type:2,startIdx:r,state:28,acceptStateReached:!1});else if(n===64)t.addMachine(function(o,s){return{type:3,startIdx:o,state:s,acceptStateReached:!1}}(r,30));else if(n===47)t.addMachine(hc(r,11));else if(n===43)t.addMachine(hl(r,37));else if(n===40)t.addMachine(hl(r,32));else{if(ut(n)&&(t.addMachine(hl(r,38)),t.addMachine(function(o,s){return{type:0,startIdx:o,state:s,acceptStateReached:!1,matchType:2,octetsEncountered:1}}(r,13))),n_(n)){var i=e.toLowerCase()==="m"?15:22;t.addMachine(function(o,s){return{type:1,startIdx:o,state:s,acceptStateReached:!1}}(r,i))}vo(n)&&t.addMachine(va(r,0)),Wr(n)&&t.addMachine(hc(r,5))}}function YO(t,e,n){n===58?e.state=2:n===45?e.state=1:QE(n)||t.removeMachine(e)}function GO(t,e,n){var r=t.charIdx;n===45||(n===47?(t.removeMachine(e),t.addMachine(hc(r,11))):QE(n)?e.state=0:t.removeMachine(e))}function WO(t,e,n){var r=t.charIdx;n===47?e.state=3:n===46?t.removeMachine(e):ur(n)?(e.state=5,vo(n)&&t.addMachine(va(r,0))):t.removeMachine(e)}function XO(t,e,n){n===47?e.state=4:e_(n)?(e.state=10,e.acceptStateReached=!0):Le(t,e)}function KO(t,e,n,r){r===47?(e.state=10,e.acceptStateReached=!0):ur(r)?(e.state=5,e.acceptStateReached=!0):t.removeMachine(e)}function qO(t,e,n){n===47?e.state=12:t.removeMachine(e)}function JO(t,e,n){ur(n)?e.state=5:t.removeMachine(e)}function ZO(t,e,n){n===46?e.state=7:n===45?e.state=6:n===58?e.state=8:Ou(n)?e.state=10:Su(n)||Le(t,e)}function QO(t,e,n,r){r===45||(r===46?Le(t,e):ur(r)?e.state=5:Le(t,e))}function eD(t,e,n,r){r===46?Le(t,e):ur(r)?(e.state=5,e.acceptStateReached=!0):Le(t,e)}function tD(t,e,n){n===46?e.state=14:n===58?e.state=8:ut(n)||(Ou(n)?e.state=10:Wr(n)?t.removeMachine(e):Le(t,e))}function nD(t,e,n){ut(n)?(e.octetsEncountered++,e.octetsEncountered===4&&(e.acceptStateReached=!0),e.state=13):Le(t,e)}function rD(t,e,n){ut(n)?e.state=9:Le(t,e)}function iD(t,e,n){ut(n)||(Ou(n)?e.state=10:Le(t,e))}function oD(t,e,n){e_(n)||Le(t,e)}function sD(t,e,n,r){n.toLowerCase()==="a"?e.state=16:Xr(t,e,r)}function aD(t,e,n,r){n.toLowerCase()==="i"?e.state=17:Xr(t,e,r)}function lD(t,e,n,r){n.toLowerCase()==="l"?e.state=18:Xr(t,e,r)}function cD(t,e,n,r){n.toLowerCase()==="t"?e.state=19:Xr(t,e,r)}function uD(t,e,n,r){n.toLowerCase()==="o"?e.state=20:Xr(t,e,r)}function dD(t,e,n){n===58?e.state=21:Xr(t,e,n)}function hD(t,e,n){Du(n)?e.state=22:t.removeMachine(e)}function Xr(t,e,n){n===46?e.state=23:n===64?e.state=24:Du(n)?e.state=22:t.removeMachine(e)}function pD(t,e,n){n===46||n===64?t.removeMachine(e):Du(n)?e.state=22:t.removeMachine(e)}function fD(t,e,n){ur(n)?e.state=25:t.removeMachine(e)}function mD(t,e,n){n===46?e.state=27:n===45?e.state=26:Su(n)||Le(t,e)}function ED(t,e,n){n===45||n===46?Le(t,e):Su(n)?e.state=25:Le(t,e)}function _D(t,e,n){n===46||n===45?Le(t,e):ur(n)?(e.state=25,e.acceptStateReached=!0):Le(t,e)}function AD(t,e,n){i_(n)?(e.state=29,e.acceptStateReached=!0):t.removeMachine(e)}function gD(t,e,n){i_(n)||Le(t,e)}function SD(t,e,n){o_(n)?(e.state=31,e.acceptStateReached=!0):t.removeMachine(e)}function OD(t,e,n){o_(n)||(Wr(n)?t.removeMachine(e):Le(t,e))}function DD(t,e,n,r){ut(r)?e.state=38:(t.removeMachine(e),Da(t,n,r))}function vD(t,e,n,r){ut(r)?e.state=33:t.removeMachine(e),Da(t,n,r)}function TD(t,e,n){ut(n)?e.state=34:t.removeMachine(e)}function RD(t,e,n){ut(n)?e.state=35:t.removeMachine(e)}function CD(t,e,n){n===41?e.state=36:t.removeMachine(e)}function ID(t,e,n,r){ut(r)?e.state=38:s_(r)?e.state=39:t.removeMachine(e)}function yD(t,e,n,r){var i=t.charIdx;e.acceptStateReached=!0,vu(r)?e.state=40:r===35?e.state=41:ut(r)||(r===40?e.state=32:s_(r)?e.state=39:(Le(t,e),vo(r)&&t.addMachine(va(i,0))))}function ND(t,e,n,r){ut(r)?e.state=38:r===40?e.state=32:(Le(t,e),Da(t,n,r))}function bD(t,e,n){vu(n)||(n===35?e.state=41:ut(n)?e.state=38:Le(t,e))}function kD(t,e,n){vu(n)?e.state=40:ut(n)?t.removeMachine(e):Le(t,e)}function Le(t,e){var n=t.matches,r=t.text,i=t.charIdx,o=t.tagBuilder,s=t.stripPrefix,a=t.stripTrailingSlash,l=t.decodePercentEncoding,u=t.hashtagServiceName,c=t.mentionServiceName;if(t.removeMachine(e),e.acceptStateReached){var h,d,p=e.startIdx,f=r.slice(e.startIdx,i);switch(f=function(A){for(var _={"(":0,"{":0,"[":0},g=0;g<A.length;g++){var O=A.charAt(g);RO(R=A.charCodeAt(g))?_[O]++:sp(R)&&_[lp[O]]--}for(var D=A.length-1;D>=0;){var R;if(O=A.charAt(D),sp(R=A.charCodeAt(D))){var T=lp[O];if(!(_[T]<0))break;_[T]++,D--}else{if(!JE(R))break;D--}}return A.slice(0,D+1)}(f),e.type){case 0:if(r.charCodeAt(e.startIdx-1)===64)return;switch(e.matchType){case 0:var m=ZE.exec(f);if(m&&(p+=m.index,f=f.slice(m.index)),!function(A){if(yO.test(A))return!1;var _=A.match(NO);if(!_)return!1;var g=!!_[1],O=_[2];return!!g||!(O.indexOf(".")===-1||!/[A-Za-z]/.test(O))}(f))return;break;case 1:if(!function(A){var _=A.match(bO);if(!_)return!1;var g=_[0].split(".");return!(g.length<2||!ap(g[g.length-1]))}(f))return;break;case 2:if(d=f.split(LO,1)[0],!kO.test(d))return;break;default:Fr(e)}n.push(new t_({tagBuilder:o,matchedText:f,offset:p,urlMatchType:LD(e.matchType),url:f,protocolRelativeMatch:f.slice(0,2)==="//",stripPrefix:s,stripTrailingSlash:a,decodePercentEncoding:l}));break;case 1:ap(f.split(".").pop())&&n.push(new r_({tagBuilder:o,matchedText:f,offset:p,email:f.replace(PO,"")}));break;case 2:f.length<=140&&n.push(new FO({tagBuilder:o,matchedText:f,offset:p,serviceName:u,hashtag:f.slice(1)}));break;case 3:(function(A,_){return HO[_].test(A)})(f,c)&&n.push(new BO({tagBuilder:o,matchedText:f,offset:p,serviceName:c,mention:f.slice(1)}));break;case 4:if(f=f.replace(/ +$/g,""),((h=f).charAt(0)==="+"||jO.test(h))&&$O.test(h)){var E=f.replace(/[^0-9,;#]/g,"");n.push(new VO({tagBuilder:o,matchedText:f,offset:p,number:E,plusSign:f.charAt(0)==="+"}))}break;default:Fr(e)}}}function LD(t){switch(t){case 0:return"scheme";case 1:return"tld";case 2:return"ipV4";default:Fr(t)}}var lp={")":"(","}":"{","]":"["};function va(t,e){return{type:0,startIdx:t,state:e,acceptStateReached:!1,matchType:0}}function hc(t,e){return{type:0,startIdx:t,state:e,acceptStateReached:!1,matchType:1}}function hl(t,e){return{type:4,startIdx:t,state:e,acceptStateReached:!1}}function cp(t){return t.type===0&&t.matchType===0}var _n=function(t){t===void 0&&(t={}),this.idx=t.idx!==void 0?t.idx:-1,this.type=t.type||"tag",this.name=t.name||"",this.isOpening=!!t.isOpening,this.isClosing=!!t.isClosing},Tu=new _n,wD=function(t,e){this.charIdx=0,this.state=0,this.currentDataIdx=0,this.currentTag=Tu,this.html=t,this.callbacks=e};function MD(t,e){e==="<"&&vn(t)}function PD(t,e,n){e==="!"?t.state=13:e==="/"?(t.state=2,t.currentTag=new _n(We(We({},t.currentTag),{isClosing:!0}))):e==="<"?vn(t):xi(n)?(t.state=3,t.currentTag=new _n(We(We({},t.currentTag),{isOpening:!0}))):(t.state=0,t.currentTag=Tu)}function xD(t,e,n){Gr(n)?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),t.state=4):e==="<"?vn(t):e==="/"?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),t.state=12):e===">"?(t.currentTag=new _n(We(We({},t.currentTag),{name:pl(t)})),Tn(t)):xi(n)||ut(n)||e===":"||qt(t)}function FD(t,e,n){e===">"?qt(t):xi(n)?t.state=3:qt(t)}function HD(t,e,n){Gr(n)||(e==="/"?t.state=12:e===">"?Tn(t):e==="<"?vn(t):e==="="||gu(n)||function(r){return r>=0&&r<=31||r==127}(n)?qt(t):t.state=5)}function UD(t,e,n){Gr(n)?t.state=6:e==="/"?t.state=12:e==="="?t.state=7:e===">"?Tn(t):e==="<"?vn(t):gu(n)&&qt(t)}function BD(t,e,n){Gr(n)||(e==="/"?t.state=12:e==="="?t.state=7:e===">"?Tn(t):e==="<"?vn(t):gu(n)?qt(t):t.state=5)}function jD(t,e,n){Gr(n)||(e==='"'?t.state=8:e==="'"?t.state=9:/[>=`]/.test(e)?qt(t):e==="<"?vn(t):t.state=10)}function $D(t,e){e==='"'&&(t.state=11)}function VD(t,e){e==="'"&&(t.state=11)}function zD(t,e,n){Gr(n)?t.state=4:e===">"?Tn(t):e==="<"&&vn(t)}function YD(t,e,n){Gr(n)?t.state=4:e==="/"?t.state=12:e===">"?Tn(t):e==="<"?vn(t):(t.state=4,function(r){r.charIdx--}(t))}function GD(t,e){e===">"?(t.currentTag=new _n(We(We({},t.currentTag),{isClosing:!0})),Tn(t)):qt(t)}function WD(t){var e=t.html,n=t.charIdx;e.slice(n,n+2)==="--"?(t.charIdx++,t.currentTag=new _n(We(We({},t.currentTag),{type:"comment"})),t.state=14):e.slice(n,n+7).toUpperCase()==="DOCTYPE"?(t.charIdx+=6,t.currentTag=new _n(We(We({},t.currentTag),{type:"doctype"})),t.state=20):qt(t)}function XD(t,e){e==="-"?t.state=15:e===">"?qt(t):t.state=16}function KD(t,e){e==="-"?t.state=18:e===">"?qt(t):t.state=16}function qD(t,e){e==="-"&&(t.state=17)}function JD(t,e){t.state=e==="-"?18:16}function ZD(t,e){e===">"?Tn(t):e==="!"?t.state=19:e==="-"||(t.state=16)}function QD(t,e){e==="-"?t.state=17:e===">"?Tn(t):t.state=16}function ev(t,e){e===">"?Tn(t):e==="<"&&vn(t)}function qt(t){t.state=0,t.currentTag=Tu}function vn(t){t.state=1,t.currentTag=new _n({idx:t.charIdx})}function Tn(t){var e=t.html.slice(t.currentDataIdx,t.currentTag.idx);e&&t.callbacks.onText(e,t.currentDataIdx);var n=t.currentTag;n.type==="comment"?t.callbacks.onComment(n.idx):n.type==="doctype"?t.callbacks.onDoctype(n.idx):(n.isOpening&&t.callbacks.onOpenTag(n.name,n.idx),n.isClosing&&t.callbacks.onCloseTag(n.name,n.idx)),qt(t),t.currentDataIdx=t.charIdx+1}function pl(t){var e=t.currentTag.idx+(t.currentTag.isClosing?2:1);return t.html.slice(e,t.charIdx).toLowerCase()}var tv=function(){function t(e){e===void 0&&(e={}),this.version=t.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.tagBuilder=null,this.urls=function(o){return o==null&&(o=!0),zt(o)?{schemeMatches:o,tldMatches:o,ipV4Matches:o}:{schemeMatches:!zt(o.schemeMatches)||o.schemeMatches,tldMatches:!zt(o.tldMatches)||o.tldMatches,ipV4Matches:!zt(o.ipV4Matches)||o.ipV4Matches}}(e.urls),this.email=zt(e.email)?e.email:this.email,this.phone=zt(e.phone)?e.phone:this.phone,this.hashtag=e.hashtag||this.hashtag,this.mention=e.mention||this.mention,this.newWindow=zt(e.newWindow)?e.newWindow:this.newWindow,this.stripPrefix=function(o){return o==null&&(o=!0),zt(o)?{scheme:o,www:o}:{scheme:!zt(o.scheme)||o.scheme,www:!zt(o.www)||o.www}}(e.stripPrefix),this.stripTrailingSlash=zt(e.stripTrailingSlash)?e.stripTrailingSlash:this.stripTrailingSlash,this.decodePercentEncoding=zt(e.decodePercentEncoding)?e.decodePercentEncoding:this.decodePercentEncoding,this.sanitizeHtml=e.sanitizeHtml||!1;var n=this.mention;if(n!==!1&&UO.indexOf(n)===-1)throw new Error("invalid `mention` cfg '".concat(n,"' - see docs"));var r,i=this.hashtag;if(i!==!1&&xO.indexOf(i)===-1)throw new Error("invalid `hashtag` cfg '".concat(i,"' - see docs"));this.truncate=typeof(r=e.truncate)=="number"?{length:r,location:"end"}:We({length:Number.POSITIVE_INFINITY,location:"end"},r),this.className=e.className||this.className,this.replaceFn=e.replaceFn||this.replaceFn,this.context=e.context||this}return t.link=function(e,n){return new t(n).link(e)},t.parse=function(e,n){return new t(n).parse(e)},t.prototype.parse=function(e){var n=this,r=["a","style","script"],i=0,o=[];return function(s,a){for(var l=new wD(s,a),u=s.length;l.charIdx<u;){var c=s.charAt(l.charIdx),h=s.charCodeAt(l.charIdx);switch(l.state){case 0:MD(l,c);break;case 1:PD(l,c,h);break;case 2:FD(l,c,h);break;case 3:xD(l,c,h);break;case 4:HD(l,c,h);break;case 5:UD(l,c,h);break;case 6:BD(l,c,h);break;case 7:jD(l,c,h);break;case 8:$D(l,c);break;case 9:VD(l,c);break;case 10:zD(l,c,h);break;case 11:YD(l,c,h);break;case 12:GD(l,c);break;case 13:WD(l);break;case 14:XD(l,c);break;case 15:KD(l,c);break;case 16:qD(l,c);break;case 17:JD(l,c);break;case 18:ZD(l,c);break;case 19:QD(l,c);break;case 20:ev(l,c);break;default:Fr(l.state)}l.charIdx++}l.currentDataIdx<l.charIdx&&function(d){var p=d.html.slice(d.currentDataIdx,d.charIdx);d.callbacks.onText(p,d.currentDataIdx),d.currentDataIdx=d.charIdx+1}(l)}(e,{onOpenTag:function(s){r.indexOf(s)>=0&&i++},onText:function(s,a){if(i===0){var l=s.split(/( | |<|<|>|>|"|"|')/gi),u=a;l.forEach(function(c,h){if(h%2==0){var d=n.parseText(c,u);o.push.apply(o,function(p,f,m){if(m||arguments.length===2)for(var E,A=0,_=f.length;A<_;A++)!E&&A in f||(E||(E=Array.prototype.slice.call(f,0,A)),E[A]=f[A]);return p.concat(E||Array.prototype.slice.call(f))}([],function(p,f){var m=typeof Symbol=="function"&&p[Symbol.iterator];if(!m)return p;var E,A,_=m.call(p),g=[];try{for(;(f===void 0||f-- >0)&&!(E=_.next()).done;)g.push(E.value)}catch(O){A={error:O}}finally{try{E&&!E.done&&(m=_.return)&&m.call(_)}finally{if(A)throw A.error}}return g}(d),!1))}u+=c.length})}},onCloseTag:function(s){r.indexOf(s)>=0&&(i=Math.max(i-1,0))},onComment:function(){},onDoctype:function(){}}),o=this.compactMatches(o),o=this.removeUnwantedMatches(o)},t.prototype.compactMatches=function(e){e.sort(nv);for(var n=0;n<e.length-1;){var r=e[n],i=r.getOffset(),o=r.getMatchedText().length;if(n+1<e.length&&e[n+1].getOffset()===i){var s=e[n+1].getMatchedText().length>o?n:n+1;e.splice(s,1)}else n++}return e},t.prototype.removeUnwantedMatches=function(e){return this.hashtag||_r(e,function(n){return n.getType()==="hashtag"}),this.email||_r(e,function(n){return n.getType()==="email"}),this.phone||_r(e,function(n){return n.getType()==="phone"}),this.mention||_r(e,function(n){return n.getType()==="mention"}),this.urls.schemeMatches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="scheme"}),this.urls.tldMatches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="tld"}),this.urls.ipV4Matches||_r(e,function(n){return n.getType()==="url"&&n.getUrlMatchType()==="ipV4"}),e},t.prototype.parseText=function(e,n){n=n||0;for(var r=function(s,a){for(var l=new zO(s,a);l.charIdx<l.text.length;l.charIdx++){var u=s.charAt(l.charIdx),c=s.charCodeAt(l.charIdx);if(l.stateMachines.length===0)Da(l,u,c);else{for(var h=l.stateMachines.length-1;h>=0;h--){var d=l.stateMachines[h];switch(d.state){case 11:qO(l,d,c);break;case 12:JO(l,d,c);break;case 0:YO(l,d,c);break;case 1:GO(l,d,c);break;case 2:WO(l,d,c);break;case 3:XO(l,d,c);break;case 4:KO(l,d,0,c);break;case 5:ZO(l,d,c);break;case 6:QO(l,d,0,c);break;case 7:eD(l,d,0,c);break;case 13:tD(l,d,c);break;case 14:nD(l,d,c);break;case 8:rD(l,d,c);break;case 9:iD(l,d,c);break;case 10:oD(l,d,c);break;case 15:sD(l,d,u,c);break;case 16:aD(l,d,u,c);break;case 17:lD(l,d,u,c);break;case 18:cD(l,d,u,c);break;case 19:uD(l,d,u,c);break;case 20:dD(l,d,c);break;case 21:hD(l,d,c);break;case 22:Xr(l,d,c);break;case 23:pD(l,d,c);break;case 24:fD(l,d,c);break;case 25:mD(l,d,c);break;case 26:ED(l,d,c);break;case 27:_D(l,d,c);break;case 28:AD(l,d,c);break;case 29:gD(l,d,c);break;case 30:SD(l,d,c);break;case 31:OD(l,d,c);break;case 32:vD(l,d,u,c);break;case 33:TD(l,d,c);break;case 34:RD(l,d,c);break;case 35:CD(l,d,c);break;case 36:ID(l,d,0,c);break;case 37:DD(l,d,u,c);break;case 38:yD(l,d,0,c);break;case 39:ND(l,d,u,c);break;case 40:bD(l,d,c);break;case 41:kD(l,d,c);break;default:Fr(d.state)}}if(!l.hasSchemeUrlMachine()&&l.charIdx>0&&vo(c)){var p=l.text.charCodeAt(l.charIdx-1);vo(p)||l.addMachine(va(l.charIdx,0))}}}for(var f=l.stateMachines.length-1;f>=0;f--)l.stateMachines.forEach(function(m){return Le(l,m)});return l.matches}(e,{tagBuilder:this.getTagBuilder(),stripPrefix:this.stripPrefix,stripTrailingSlash:this.stripTrailingSlash,decodePercentEncoding:this.decodePercentEncoding,hashtagServiceName:this.hashtag,mentionServiceName:this.mention||"twitter"}),i=0,o=r.length;i<o;i++)r[i].setOffset(n+r[i].getOffset());return r},t.prototype.link=function(e){if(!e)return"";this.sanitizeHtml&&(e=e.replace(/</g,"<").replace(/>/g,">"));for(var n=this.parse(e),r=new Array(2*n.length+1),i=0,o=0,s=n.length;o<s;o++){var a=n[o];r.push(e.substring(i,a.getOffset())),r.push(this.createMatchReturnVal(a)),i=a.getOffset()+a.getMatchedText().length}return r.push(e.substring(i)),r.join("")},t.prototype.createMatchReturnVal=function(e){var n;return this.replaceFn&&(n=this.replaceFn.call(this.context,e)),typeof n=="string"?n:n===!1?e.getMatchedText():n instanceof qE?n.toAnchorString():e.buildTag().toAnchorString()},t.prototype.getTagBuilder=function(){var e=this.tagBuilder;return e||(e=this.tagBuilder=new TO({newWindow:this.newWindow,truncate:this.truncate,className:this.className})),e},t.version="4.1.5",t}();function nv(t,e){return t.getOffset()-e.getOffset()}function a_(t,e=t){return{type:"autolink",url:t,text:e}}const rv=()=>$n(/```([^]+?)```/g,([t,e])=>({type:"codespan",text:XE(e)})),iv=$n(/<!!mention:([^>\s]*?)\|(.*?)>/gm,([t,e,n])=>function(r,i){return{type:"mention",id:r,text:i}}(decodeURIComponent(e),n)),ov=$n(/<!!customemoji:(.*?)>/gm,([t,e])=>function(n){return{type:"customemoji",text:n}}(e)),l_=$n(/<((?:https?|mailto):.*?)\|(.*?)>/gi,([t,e,n])=>function(r,i=[]){return{type:"link",url:r,children:i}}(e,[n])),sv=$n(/<actionlink:([^|]+)[|]([^>]*)>/gi,([t,e,n])=>{const{action:r,params:i}=c_(e);return function(o,s,a=[]){return{type:"actionlink",action:o,params:s,children:a}}(r,i,[n])}),av=$n(/<actionbutton:([^|]+)[|]([^>]*)>/gi,([t,e,n])=>{const{action:r,params:i}=c_(e);return function(o,s,a=[]){return{type:"actionbutton",action:o,params:s,children:a}}(r,i,[n])});function c_(t){const e=t.indexOf("?");return e===-1?{action:t,params:{}}:{action:t.slice(0,e),params:Object.fromEntries(new URLSearchParams(t.slice(e)))}}const lv=$n(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g,([t])=>function(e=[]){return{type:"bulletlist",children:e}}([t.startsWith(`
|
|
17
17
|
`)?t.slice(1):t])),cv=$n(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm,([t,e])=>({type:"bulletpoint",children:[e]})),u_=t=>{const e=/(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g,n=/^(\d{4})-(\d{4})$/,r=/^(\d{1,2})\.(\d{2})-(\d{1,2})\.(\d{2})$/;let i=0;const o=[];for(const s of Oa(t,e)){const a=s[0],l=s[1],u=l.match(n);if(u&&Number(u[1])<Number(u[2]))continue;const c=l.match(r);if(c){const p=Number(c[1]),f=Number(c[2]),m=Number(c[3]),E=Number(c[4]);if(p<=23&&m<=23&&f<=59&&E<=59)continue}const h=a.startsWith(l)?s.index:s.index+1;h-i>0&&o.push(t.substring(i,h));const d=a_("tel:"+l.replace(/[^0-9+]/g,""),l);o.push(d),i=h+l.length}return i<t.length&&o.push(t.substring(i)),o},d_=t=>l_(t).flatMap(e=>typeof e=="string"?fl(e):["<",...fl(e.url),...fl("|"+e.children[0]+">")]),fl=t=>{const e=tv.parse(t,{urls:!0,email:!0,phone:!1,hashtag:!1,mention:!1}),n=[];let r=0;for(const i of e){const o=i.getOffset(),s=i.getMatchedText(),a=s.length;let l=s;i instanceof r_?l="mailto:"+i.getEmail():i instanceof t_&&(l=i.getUrl()),o>r&&n.push(t.substring(r,o)),n.push(a_(l,s)),r=o+a}return r<t.length&&n.push(t.substring(r)),n},uv=["Codeblock","Codespan","FormattedLink","Wikitext","Autolink","Actions","Mention","Mention","BulletPoint","CustomEmoji"],dv=function(t){const e=RegExp(`[^${t}]+${t}?|${t}`,"g");return n=>Array.from(n.match(e)||[])}(`
|
|
18
18
|
`);function h_(t,e={except:[]}){const n=function(i={except:[]}){var a;const o={multilineSteps:[],singlelineSteps:[]},s=(a=i.except)!=null?a:uv.filter(l=>!i.only.includes(l));return s.includes("BulletPoint")||o.multilineSteps.push(lv,cv),s.includes("Mention")||o.singlelineSteps.push(iv),s.includes("CustomEmoji")||o.singlelineSteps.push(ov),s.includes("Codespan")||o.multilineSteps.push(rv()),s.includes("FormattedLink")||o.singlelineSteps.push(l_),s.includes("Actions")||(o.singlelineSteps.push(sv),o.singlelineSteps.push(av)),s.includes("Wikitext")||o.singlelineSteps.push(OO),s.includes("Autolink")||o.singlelineSteps.push(d_,u_),o}(e);let r=f_(t,n);return r=m_(r,!1),r}function p_(t){return h_(t,{except:["FormattedLink","Actions"]})}function f_(t,e){let n=[t];return n=ml(n,e.multilineSteps),n=ml(n,[dv]),n=ml(n,e.singlelineSteps),n=Ru(n),n}function ml(t,e){return e.reduce((n,r)=>oo(n,r),t)}function Ru(t){const e=[];let n=-1;for(const r of t)typeof r=="string"?typeof e[n]=="string"?e[n]+=r:e[++n]=r:e[++n]="children"in r?{...r,children:Ru(r.children)}:r;return e}function m_(t,e){const n=[];let r=[];for(let i=0;i<t.length;i++){const o=t[i];if(typeof o=="string")r.push(o);else if("children"in o){r.length>0&&(n.push(r.join("")),r=[]);const s=m_(o.children,e||o.type==="link"||o.type==="actionbutton"||o.type==="actionlink");n.push({...o,children:s})}else o.type==="autolink"&&e?r.push(o.text):(r.length>0&&(n.push(r.join("")),r=[]),n.push(o))}return r.length>0&&(n.push(r.join("")),r=[]),n}function hv(){let t,e=0;return n=>{const r=(o=Date.now())=>{if(window.clearTimeout(t),t=void 0,e=o,n.isDestroyed)return;const s=function(a){a=a.removeMark(0,a.doc.content.size,Xe.marks.bold),a=a.removeMark(0,a.doc.content.size,Xe.marks.italic),a=a.removeMark(0,a.doc.content.size,Xe.marks.strikethrough),a.doc.firstChild;const l=function(u){const c=[];let h,d="";return u.descendants((p,f)=>(p.isText?(d+=p.text,h!=null||(h=f)):d&&h!==void 0&&(c.push({text:d,pos:h}),d="",h=void 0),p.type!==Xe.nodes.mention)),d&&h!==void 0&&c.push({text:d,pos:h}),c}(a.doc);for(const{text:u,pos:c}of l){const h=h_(u,{only:["Wikitext"]});[a]=E_(a,c,h)}return a}(n.state.tr);n.dispatch(s)},i=Date.now();i-e<300?t||(t=window.setTimeout(r,300)):r(i)}}function E_(t,e,n,r=0,i=[]){for(const o of n)if(typeof o=="string"){for(const s of i)t.addMark(e+r,e+r+o.length,s.create());r+=o.length}else if(o.type==="bold"||o.type==="italic"||o.type==="strikethrough"){r+=1;const s=Xe.marks[o.type],a=[...i,s];[t,r]=E_(t,e,o.children,r,a),r+=1}else de.unreachable();return[t,r]}function up(t){return(e,n)=>{if(!n)return!0;let r=e.tr;const i=Ee.between(e.selection.$from,e.selection.$to);return r=r.replaceRangeWith(i.from,i.from,Xe.text(t,r.storedMarks)),r=r.replaceRangeWith(i.to+1,i.to+1,Xe.text(t,r.storedMarks)),r=r.setSelection(Ee.near(r.doc.resolve(i.to+1))),n(r),!0}}function pv(t,e,n){const r=e.clipboardData;if(!r)return!1;const i=function(o){const s=o.items||[],a={"image/gif":"gif","image/png":"png","image/jpeg":"jpg","image/svg+xml":"svg"},l=Array.from(s).filter(h=>h.kind==="file"&&a[h.type]);if(l.length===0||o.types.includes("text/rtf"))return;const u=l[0];let c=u.getAsFile();if(!c.name){const h="image."+a[u.type];c=new File([c],h,{type:u.type,lastModified:Date.now()})}return c}(r);return i?n(i):function(o,s){const a=o.state.tr.insertText(s).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");o.dispatch(a)}(t,r.getData("text/plain")),!0}function dp(t){const{matcher:e,suggestionClass:n="ProseMirror-suggestion",onEnter:r=()=>!1,onChange:i=()=>!1,onExit:o=()=>!1,onKeyDown:s=()=>!1,debug:a=!1}=t;return new _a({key:new Aa("suggestions"),view(){return{update:(l,u)=>{const c=this.key.getState(u),h=this.key.getState(l.state);if(!c||!h)return;const d=c.active&&h.active&&c.range.from!==h.range.from,p=!c.active&&h.active,f=c.active&&!h.active,m=!p&&!f&&c.text!==h.text;(f||d)&&o({view:l,range:c.range,text:c.text}),m&&!d&&i({view:l,range:h.range,text:h.text}),(p||d)&&r({view:l,range:h.range,text:h.text})}}},state:{init:()=>({active:!1,range:{from:0,to:0},text:null}),apply(l,u){const{selection:c}=l,h={...u};if(c.from===c.to){(c.from<u.range.from||c.from>u.range.to)&&(h.active=!1);const d=c.$from,p=e(d);p?(h.active=!0,h.range=p.range,h.text=p.text):h.active=!1}else h.active=!1;return h.active||(h.range={from:0,to:0},h.text=null),h}},props:{handleKeyDown(l,u){var h;const c=this.getState(l.state);return!!(c!=null&&c.active)&&((h=s({view:l,event:u}))!=null?h:!1)},decorations(l){const u=this.getState(l);return u!=null&&u.active?je.create(l.doc,[Ht.inline(u.range.from,u.range.to,{nodeName:"span",class:n,style:a?"background: rgba(0, 0, 255, 0.05); color: blue; border: 2px solid blue;":void 0})]):null}}})}const hp=(t,e)=>n=>{var l;const r=(l=n.nodeBefore)==null?void 0:l.text;if(!r)return;const i=r.match(t);if(!i)return;const o=i[2],s=n.pos-o.length,a=n.pos;if(!n.doc.rangeHasMark(s,a,e.marks.literal))return{range:{from:s,to:a},text:o}},fv=/(^|\s)(:[^:\s]+:?)$/,mv=/(^|\s)(@[^@]*)$/;function __({placeholder:t,disabled:e,className:n="",characterLimit:r,spellcheck:i}){const o=xo(),s=Q(),a=Q(null);return Z(()=>(s.current=function(l,u,c,h,d){const p=ai.create({schema:Xe,plugins:[...d.filter(Ev),lO(),Kh({...ts,"Mod-z":jE,"Mod-y":ac,"Mod-Shift-z":ac,"Mod-b":up("*"),"Mod-i":up("_"),"Mod-Enter":ts.Enter,"Shift-Enter":ts.Enter,Enter:c}),Kh({Enter:ts.Enter}),Xh]}),f=hv(),m=new FE(l,{handlePaste:(E,A,_)=>pv(E,A,h),clipboardTextSerializer(E){const A=[];return E.content.forEach(_=>{_&&A.push(XE(_.textContent))}),A.join()},state:p,dispatchTransaction(E){E=(E=E.removeStoredMark(Xe.marks.literal)).removeStoredMark(Xe.marks.emoji);const A=m.state.apply(E);m.state.doc.eq(A.doc)||u(new Vs(A.doc)),m.updateState(A),E.steps.some(_=>_ instanceof at)&&f(m)}});return m}(a.current,l=>o.onChange(l),()=>!!o.onEnter&&(o.onEnter(),!0),l=>o.onPasteImage(l),[o.emojiSuggesterPlugin(),o.mentionsPlugin()]),o.setEditorView(s.current),()=>{var l;o.setEditorView(void 0),(l=s.current)==null||l.destroy()}),[o]),Z(()=>{var l;(l=s.current)==null||l.setProps({editable:()=>!e})},[e]),Z(()=>gt(()=>{var l,u,c;return(c=s.current)==null?void 0:c.setProps({attributes:{spellcheck:String((u=(l=o.spellcheck$.get())!=null?l:i)!=null?u:!1),class:"t-text-input","aria-label":"Message Field",role:"textbox"}})}),[o,i]),Z(()=>gt(()=>{var u;const l=s.current;l==null||l.dispatch(l.state.tr.setMeta(Xh,(u=o.placeholder$.get())!=null?u:t))}),[o,t]),Z(()=>{r&&Number.isInteger(r)&&o.setMaxLength(r)},[r,o]),L("div",{className:`t-editor ${n}`,ref:a})}function pp(t){if(t.startsWith(":"))throw new Error("Not implemented");{const e=Xe.marks.emoji.create({emoji:t});return Xe.text(t,[e])}}function fp(t,e){const n=encodeURIComponent(t);return Xe.nodes.mention.create({id:t,name:e},Xe.text(`<!!mention:${n}|${e}>`))}const ra=class ra{constructor(e){this.doc=e,this.size=this.doc.content.size,this.hasContent=HE(this.doc)}hasNonWhitespaceContent(){return this.hasContent&&function(e){let n=!1;return e.descendants(r=>!(r.isText&&r.text&&/\S/.test(r.text))||(n=!0,!1)),n}(this.doc)}asText(){return this.doc.textContent.replace(/\xa0/g," ")}};ra.EMPTY=new ra(Xe.topNodeType.create());let Vs=ra;function Ev(t){return t!=null}function mp(t,e){let n=0;return(...r)=>{n&&(clearTimeout(n),n=0),n=setTimeout(()=>{t(...r)},e)}}class A_{constructor(e,n,r){this.state$=e,this.device$=n,this.userPermissions$=r,this.currentDoc=Vs.EMPTY,this.maxLength=1e4,this.markAsTyping=function(i,o){let s=!1;return(...a)=>{if(!s)return s=!0,setTimeout(()=>{s=!1},o),i(...a)}}(()=>{var i;(i=this.controller)==null||i.markAsTyping()},5e3),this._suggesterKeydownHandlers={emoji:void 0,mention:void 0},this.toggleEmojiPicker=i=>{const o=this.state$.showEmojiPicker;i!=null||(i=!o.peek()),o.set(i),i===!1&&this.focus()},this.spellcheck$=me(),this.placeholder$=me()}setEditorView(e){this.editorView=e}emojiSuggesterPlugin(){if(this.device$.peek().supportsEmojiPicker)return dp({debug:!1,matcher:hp(fv,Xe),onEnter:e=>this.suggestEmoji(e.text,e.range),onChange:e=>this.suggestEmoji(e.text,e.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:e})=>{var n,r,i;return(i=(r=(n=this._suggesterKeydownHandlers).emoji)==null?void 0:r.call(n,e.key))!=null?i:!1}})}mentionsPlugin(){const e=this.userPermissions$.peek();if(de.defined(e),e.canMention)return dp({debug:!1,matcher:hp(mv,Xe),onEnter:n=>this.suggestMention(n.text,n.range),onChange:n=>this.suggestMention(n.text,n.range),onExit:()=>this.onExitSuggester(),onKeyDown:({event:n})=>{var r,i,o;return(o=(i=(r=this._suggesterKeydownHandlers).mention)==null?void 0:i.call(r,n.key))!=null?o:!1}})}closeSuggester(){de.defined(this._suggestionRange),function(e,n){const{from:r,to:i}=n,o=e.state.tr.addMark(r,i,Xe.marks.literal.create());e.dispatch(o)}(this.editorView,this._suggestionRange)}listenKeydown(e,n){this._suggesterKeydownHandlers[e]=n}onExitSuggester(){this._suggestionRange=void 0,this.state$.suggestEmojiQuery.set(void 0),this.state$.suggestMentionQuery.set(void 0)}suggestEmoji(e,n){e.length<2||(this._suggestionRange=n,this.state$.suggestEmojiQuery.set(e))}suggestMention(e,n){e.length<1||(this._suggestionRange=n,this.state$.suggestMentionQuery.set(e))}onPasteImage(e){de.defined(this.uploadFile),this.uploadFile(e)}onChange(e){var r;this.currentDoc=e;const n=e.size>this.maxLength&&e.asText().length>this.maxLength;e.hasContent&&this.markAsTyping(),this.state$.assign({atTextLimit:n,isEmpty:!e.hasNonWhitespaceContent(),characterCount:e.size===0?0:e.size-2}),(r=this.controller)==null||r.storeDraft(()=>e.asText())}setMaxLength(e){this.maxLength=e}focus({skipProseMirrorStuff:e}={skipProseMirrorStuff:!1}){var n,r;e?(n=this.editorView)==null||n.dom.focus():(r=this.editorView)==null||r.focus()}setText(e){this.editorView&&function(n,r){const i=n.state.doc.content.size,o=r.split(/(<!!(?:mention|customemoji):.*?>)/g).filter(a=>a||a.length).map(a=>{const[l,u,c]=a.match(/<!!mention:(.*)\|(.*)>/)||[null];if(l&&u&&c)return fp(u,c);const[h,d]=a.match(/<!!customemoji:(.*?)>/)||[null];return h&&d?pp(d):Xe.text(a)}),s=n.state.tr.replaceWith(0,i,o);n.dispatch(s)}(this.editorView,e)}typeText(e){this.editorView&&function(n,r,i="replace"){const o=n.state.doc.content.size,s=i=="insert"?n.state.tr.insertText(r):n.state.tr.insertText(r,0,o);n.dispatch(s)}(this.editorView,e,"insert")}getText(){return this.currentDoc.asText().trim()}clearText(){this.editorView&&function(e){const n=e.state.doc.content.size,r=e.state.tr.insertText("",0,n);e.dispatch(r)}(this.editorView)}selectEmoji(e){de.defined(this.editorView),function(n,r,i){const o=pp(r);if(i){const{from:a,to:l}=i,u=n.state.tr.deleteRange(a,l);n.dispatch(u)}const s=n.state.tr.replaceSelectionWith(o,!1);n.dispatch(s)}(this.editorView,e,this._suggestionRange),this.focus()}selectMention(e){de.defined(this.editorView),function(n,r,i){const o=fp(r.id,r.name);let s=n.state.tr;if(i){const{from:a,to:l}=i;s=s.replaceRangeWith(a,l,o)}else s=s.replaceSelectionWith(o,!1);s=s.insertText(" "),n.dispatch(s)}(this.editorView,e,this._suggestionRange),this.focus()}}const _v=Symbol("no_render");function pt(t){const e=vt(!1),n=Q({_value:typeof t=="function"?t():t.peek(),get value(){return setTimeout(()=>{e.set(!0)}),n.current._value},set value(r){n.current._value=r}});return te(()=>{if(!e.get())return _v;const r=typeof t=="function"?t():t.get();return n.current.value=r,r}),n.current}function nn(){const t=Mi(),e=he(),n=xm(),r=nt(),i=pt(e.app$.appMetadata),o=pt(e.currentUser$),s=pt(e.state$.currentConversation),a=pt(e.state$.currentConversationId),l=pt(e.t$),u=pt(e.device$),c=pt(e.themeCustom$),h=pt(e.chatSearchState$),d=pt(e.focusedMessage$),p=pt(()=>{var E;const m=e.state$.currentConversationId.get();return(E=m&&e.state$.typing.child(m).get())!=null?E:{many:!1,users:[]}}),f=pt(()=>{const m=e.state$.currentConversationId.get();return m&&e.state$.participants.child(m).get()});return se(()=>({session:t,store:e,chatbox:n,theme:r,get app(){return i.value},get currentUser(){return o.value},get conversation(){return s.value},get conversationId(){return a.value},get t(){return l.value},get device(){return u.value},get themeCustom(){return c.value.value},get typing(){return p.value},get participants(){return f.value},get focusedMessage(){return d.value},get chatSearchState(){return h.value}}),[i,n,s,a,o,u,e,l,r,c,p,f,t,h,d])}function Ta(){const t=Mi(),e=he(),n=nt(),r=xm(),i=pt(e.app$.appMetadata),o=pt(e.currentUser$),s=pt(e.t$),a=pt(e.device$),l=pt(e.themeCustom$);return se(()=>({session:t,store:e,theme:n,conversationList:r,get app(){return i.value},get currentUser(){return o.value},get t(){return s.value},get device(){return a.value},get themeCustom(){return l.value.value}}),[i,r,o,a,t,e,s,n,l])}const Av=(()=>{if(typeof window!="undefined"){let t;try{t=window.localStorage;const e="__storage_test__";return t.setItem(e,e),t.removeItem(e),!0}catch(e){return e instanceof DOMException&&(e.code===22||e.code===1014||e.name==="QuotaExceededError"||e.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}return!1})(),At={};Av?(At.setItem=window.localStorage.setItem.bind(window.localStorage),At.getItem=window.localStorage.getItem.bind(window.localStorage),At.removeItem=window.localStorage.removeItem.bind(window.localStorage),At.isSupported=!0):(At.setItem=function(){},At.getItem=function(){return null},At.removeItem=function(){},At.isSupported=!1),At.set=(t,e)=>At.setItem(t,JSON.stringify(e)),At.get=t=>JSON.parse(At.getItem(t)||"null");const pc="talkjs_drafts",gv=function(t,e){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}(200,(t,e,n,r)=>{const i=g_(t,e,n),o=JSON.parse(At.getItem(pc)||"{}"),s=r();s.match(/^\s*$/)?delete o[i]:o[i]=s,At.setItem(pc,JSON.stringify(o))}),g_=(t,e,n)=>`draft_${t}_${e}_${n}`;function St(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(u){try{l(r.next(u))}catch(c){o(c)}}function a(u){try{l(r.throw(u))}catch(c){o(c)}}function l(u){var c;u.done?i(u.value):(c=u.value,c instanceof n?c:new n(function(h){h(c)})).then(s,a)}l((r=r.apply(t,e||[])).next())})}let jo=class{constructor(){this.listeners={}}on(t,e,n){if(this.listeners[t]||(this.listeners[t]=new Set),n==null?void 0:n.once){const r=(...i)=>{this.un(t,r),e(...i)};return this.listeners[t].add(r),()=>this.un(t,r)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var n;(n=this.listeners[t])===null||n===void 0||n.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach(n=>n(...e))}};const is={decode:function(t,e){return St(this,void 0,void 0,function*(){const n=new AudioContext({sampleRate:e});try{return yield n.decodeAudioData(t)}finally{n.close()}})},createBuffer:function(t,e){if(!t||t.length===0)throw new Error("channelData must be a non-empty array");if(e<=0)throw new Error("duration must be greater than 0");if(typeof t[0]=="number"&&(t=[t]),!t[0]||t[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(r){const i=r[0];if(i.some(o=>o>1||o<-1)){const o=i.length;let s=0;for(let a=0;a<o;a++){const l=Math.abs(i[a]);l>s&&(s=l)}for(const a of r)for(let l=0;l<o;l++)a[l]/=s}})(t);const n=t.map(r=>r instanceof Float32Array?r:Float32Array.from(r));return{duration:e,length:n[0].length,sampleRate:n[0].length/e,numberOfChannels:n.length,getChannelData:r=>{const i=n[r];if(!i)throw new Error(`Channel ${r} not found`);return i},copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function S_(t,e){const n=e.xmlns?document.createElementNS(e.xmlns,t):document.createElement(t);for(const[r,i]of Object.entries(e))if(r==="children"&&i)for(const[o,s]of Object.entries(i))s instanceof Node?n.appendChild(s):typeof s=="string"?n.appendChild(document.createTextNode(s)):n.appendChild(S_(o,s));else r==="style"?Object.assign(n.style,i):r==="textContent"?n.textContent=i:n.setAttribute(r,i.toString());return n}function Ep(t,e,n){const r=S_(t,e||{});return n==null||n.appendChild(r),r}var Sv=Object.freeze({__proto__:null,createElement:Ep,default:Ep});const Ov={fetchBlob:function(t,e,n){return St(this,void 0,void 0,function*(){const r=yield fetch(t,n);if(r.status>=400)throw new Error(`Failed to fetch ${t}: ${r.status} (${r.statusText})`);return function(i,o){St(this,void 0,void 0,function*(){if(!i.body||!i.headers)return;const s=i.body.getReader(),a=Number(i.headers.get("Content-Length"))||0;let l=0;const u=c=>{l+=(c==null?void 0:c.length)||0;const h=Math.round(l/a*100);o(h)};try{for(;;){const c=yield s.read();if(c.done)break;u(c.value)}}catch(c){console.warn("Progress tracking error:",c)}})}(r.clone(),e),r.blob()})}};function Ue(t){let e=t;const n=new Set;return{get value(){return e},set(r){Object.is(e,r)||(e=r,n.forEach(i=>i(e)))},update(r){this.set(r(e))},subscribe:r=>(n.add(r),()=>n.delete(r))}}function vr(t,e){const n=Ue(t());return e.forEach(r=>r.subscribe(()=>{const i=t();Object.is(n.value,i)||n.set(i)})),{get value(){return n.value},subscribe:r=>n.subscribe(r)}}function Xn(t,e){let n;const r=()=>{n&&(n(),n=void 0),n=t()},i=e.map(o=>o.subscribe(r));return r(),()=>{n&&(n(),n=void 0),i.forEach(o=>o())}}class Dv extends jo{get isPlayingSignal(){return this._isPlaying}get currentTimeSignal(){return this._currentTime}get durationSignal(){return this._duration}get volumeSignal(){return this._volume}get mutedSignal(){return this._muted}get playbackRateSignal(){return this._playbackRate}get seekingSignal(){return this._seeking}constructor(e){super(),this.isExternalMedia=!1,this.reactiveMediaEventCleanups=[],e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),this._isPlaying=Ue(!1),this._currentTime=Ue(0),this._duration=Ue(0),this._volume=Ue(this.media.volume),this._muted=Ue(this.media.muted),this._playbackRate=Ue(this.media.playbackRate||1),this._seeking=Ue(!1),this.setupReactiveMediaEvents(),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),e.playbackRate!=null&&this.onMediaEvent("canplay",()=>{e.playbackRate!=null&&(this.media.playbackRate=e.playbackRate)},{once:!0})}setupReactiveMediaEvents(){this.reactiveMediaEventCleanups.push(this.onMediaEvent("play",()=>{this._isPlaying.set(!0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("pause",()=>{this._isPlaying.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ended",()=>{this._isPlaying.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("timeupdate",()=>{this._currentTime.set(this.media.currentTime)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("durationchange",()=>{this._duration.set(this.media.duration||0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("loadedmetadata",()=>{this._duration.set(this.media.duration||0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeking",()=>{this._seeking.set(!0)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeked",()=>{this._seeking.set(!1)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("volumechange",()=>{this._volume.set(this.media.volume),this._muted.set(this.media.muted)})),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ratechange",()=>{this._playbackRate.set(this.media.playbackRate)}))}onMediaEvent(e,n,r){return this.media.addEventListener(e,n,r),()=>this.media.removeEventListener(e,n,r)}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,n){const r=this.getSrc();if(e&&r===e)return;this.revokeSrc();const i=n instanceof Blob&&(this.canPlayType(n.type)||!e)?URL.createObjectURL(n):e;if(r&&this.media.removeAttribute("src"),i||e)try{this.media.src=i}catch(o){this.media.src=e}}destroy(){this.reactiveMediaEventCleanups.forEach(e=>e()),this.reactiveMediaEventCleanups=[],this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(e){this.reactiveMediaEventCleanups.forEach(n=>n()),this.reactiveMediaEventCleanups=[],this.media=e,this.setupReactiveMediaEvents()}play(){return St(this,void 0,void 0,function*(){try{return yield this.media.play()}catch(e){if(e instanceof DOMException&&e.name==="AbortError")return;throw e}})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=Math.max(0,Math.min(e,this.getDuration()))}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,n){n!=null&&(this.media.preservesPitch=n),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}}function vv({maxTop:t,maxBottom:e,halfHeight:n,vScale:r,barMinHeight:i=0,barAlign:o}){let s=Math.round(t*n*r),a=s+Math.round(e*n*r)||1;return a<i&&(a=i,o||(s=a/2)),{topHeight:s,totalHeight:a}}function Tv({barAlign:t,halfHeight:e,topHeight:n,totalHeight:r,canvasHeight:i}){return t==="top"?0:t==="bottom"?i-r:e-n}function _p(t,e,n){const r=e-t.left,i=n-t.top;return[r/t.width,i/t.height]}function O_(t){return!!(t.barWidth||t.barGap||t.barAlign)}function Ap(t,e){if(!O_(e))return t;const n=e.barWidth||.5,r=n+(e.barGap||n/2);return r===0?t:Math.floor(t/r)*r}function gp({scrollLeft:t,totalWidth:e,numCanvases:n}){if(e===0)return[0];const r=t/e,i=Math.floor(r*n);return[i-1,i,i+1]}function Sp(t){const e=t._cleanup;typeof e=="function"&&e()}class Rv extends jo{constructor(e,n){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragStream=null,this.scrollStream=null,this.subscriptions=[],this.options=e;const r=this.parentFromOptionsContainer(e.container);this.parent=r;const[i,o]=this.initHtml();r.appendChild(i),this.container=i,this.scrollContainer=o.querySelector(".scroll"),this.wrapper=o.querySelector(".wrapper"),this.canvasWrapper=o.querySelector(".canvases"),this.progressWrapper=o.querySelector(".progress"),this.cursor=o.querySelector(".cursor"),n&&o.appendChild(n),this.initEvents()}parentFromOptionsContainer(e){let n;if(typeof e=="string"?n=document.querySelector(e):e instanceof HTMLElement&&(n=e),!n)throw new Error("Container not found");return n}initEvents(){this.wrapper.addEventListener("click",n=>{const r=this.wrapper.getBoundingClientRect(),[i,o]=_p(r,n.clientX,n.clientY);this.emit("click",i,o)}),this.wrapper.addEventListener("dblclick",n=>{const r=this.wrapper.getBoundingClientRect(),[i,o]=_p(r,n.clientX,n.clientY);this.emit("dblclick",i,o)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollStream=function(n){const r=Ue({scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,clientWidth:n.clientWidth}),i=vr(()=>function(a){const{scrollLeft:l,scrollWidth:u,clientWidth:c}=a;if(u===0)return{startX:0,endX:1};const h=l/u,d=(l+c)/u;return{startX:Math.max(0,Math.min(1,h)),endX:Math.max(0,Math.min(1,d))}}(r.value),[r]),o=vr(()=>function(a){return{left:a.scrollLeft,right:a.scrollLeft+a.clientWidth}}(r.value),[r]),s=()=>{r.set({scrollLeft:n.scrollLeft,scrollWidth:n.scrollWidth,clientWidth:n.clientWidth})};return n.addEventListener("scroll",s,{passive:!0}),{scrollData:r,percentages:i,bounds:o,cleanup:()=>{n.removeEventListener("scroll",s),Sp(r)}}}(this.scrollContainer);const e=Xn(()=>{const{startX:n,endX:r}=this.scrollStream.percentages.value,{left:i,right:o}=this.scrollStream.bounds.value;this.emit("scroll",n,r,i,o)},[this.scrollStream.percentages,this.scrollStream.bounds]);if(this.subscriptions.push(e),typeof ResizeObserver=="function"){const n=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{n().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const e=this.parent.clientWidth;e===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=e,this.reRender(),this.emit("resize"))}initDrag(){if(this.dragStream)return;this.dragStream=function(n,r={}){const{threshold:i=3,mouseButton:o=0,touchDelay:s=100}=r,a=Ue(null),l=new Map,u=matchMedia("(pointer: coarse)").matches;let c=()=>{};const h=d=>{if(d.button!==o||(l.set(d.pointerId,d),l.size>1))return;let p=d.clientX,f=d.clientY,m=!1;const E=Date.now(),A=n.getBoundingClientRect(),{left:_,top:g}=A,O=S=>{if(S.defaultPrevented||l.size>1||u&&Date.now()-E<s)return;const v=S.clientX,y=S.clientY,b=v-p,M=y-f;(m||Math.abs(b)>i||Math.abs(M)>i)&&(S.preventDefault(),S.stopPropagation(),m||(a.set({type:"start",x:p-_,y:f-g}),m=!0),a.set({type:"move",x:v-_,y:y-g,deltaX:b,deltaY:M}),p=v,f=y)},D=S=>{if(l.delete(S.pointerId),m){const v=S.clientX,y=S.clientY;a.set({type:"end",x:v-_,y:y-g})}c()},R=S=>{l.delete(S.pointerId),S.relatedTarget&&S.relatedTarget!==document.documentElement||D(S)},T=S=>{m&&(S.stopPropagation(),S.preventDefault())},I=S=>{S.defaultPrevented||l.size>1||m&&S.preventDefault()};document.addEventListener("pointermove",O),document.addEventListener("pointerup",D),document.addEventListener("pointerout",R),document.addEventListener("pointercancel",R),document.addEventListener("touchmove",I,{passive:!1}),document.addEventListener("click",T,{capture:!0}),c=()=>{document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",D),document.removeEventListener("pointerout",R),document.removeEventListener("pointercancel",R),document.removeEventListener("touchmove",I),setTimeout(()=>{document.removeEventListener("click",T,{capture:!0})},10)}};return n.addEventListener("pointerdown",h),{signal:a,cleanup:()=>{c(),n.removeEventListener("pointerdown",h),l.clear(),Sp(a)}}}(this.wrapper);const e=Xn(()=>{const n=this.dragStream.signal.value;if(!n)return;const r=this.wrapper.getBoundingClientRect().width,i=(o=n.x/r)<0?0:o>1?1:o;var o;n.type==="start"?(this.isDragging=!0,this.emit("dragstart",i)):n.type==="move"?this.emit("drag",i):n.type==="end"&&(this.isDragging=!1,this.emit("dragend",i))},[this.dragStream.signal]);this.subscriptions.push(e)}initHtml(){const e=document.createElement("div"),n=e.attachShadow({mode:"open"}),r=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return n.innerHTML=`
|
|
19
19
|
<style${r?` nonce="${r}"`:""}>
|
|
@@ -101,7 +101,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
101
101
|
<text x="50%" y="54%" dominant-baseline="middle" font-size="34" font-family="San Francisco, Segoe UI, Helvetica Neue, Arial, Helvetica, sans-serif" fill="#fff" text-anchor="middle">${r}</text>
|
|
102
102
|
</svg>`.replace(/\s+/g," ");return"data:image/svg+xml;base64,"+pO(i)}(t.id,EO(t.name))}function zo(t){return t<1024?t+" B":t<1048576?Math.floor(t/1024)+" KB":t<1073741824?Math.floor(t/1048576)+" MB":t<1099511627776?Math.floor(t/1073741824)+" GB":Math.floor(t/1099511627776)+" TB"}function Fu({latitude:t,longitude:e}){const n=t+","+e;return{imageUrl:`https://maps.googleapis.com/maps/api/staticmap?center=${n}&zoom=15&size=300x200&scale=2&maptype=roadmap&markers=${n}&key=${bv}`,linkUrl:`https://maps.google.com/maps?q=${n}&z=15`}}function gA(t,e){const[n,r]=ae({long:"",short:""});return ft(()=>{let i,o=!0;const s=()=>{const l=Date.now(),u=function(c,h,d){const p=c-h;let f,m,E;const A=new Date(h),_={month:"short",day:"numeric"};if(p<Qp)return{changeTimeout:5e3,short:d.JUST_NOW,long:d.JUST_NOW};if(p<ef)f=Qp,m="MINUTES",E=d.MINUTES;else if(p<tf)f=ef,m="HOURS",E=d.HOURS;else{if(!(p<nT)){if(A.getFullYear()===new Date(c).getFullYear()){const O=A.toLocaleDateString(d.locale,_);return{changeTimeout:void 0,short:O,long:O}}{const O=A.toLocaleDateString(d.locale,{..._,year:"numeric"});return{changeTimeout:void 0,short:O,long:O}}}f=tf,m="DAYS",E=d.DAYS}const g=Math.floor(p/f);return{changeTimeout:f,short:g+E,long:rT(g,m.toLowerCase(),d.locale)}}(l,t>l?l-2e3:t,e);return r(u),u},a=()=>{const l=s();o&&l.changeTimeout&&(i=window.setTimeout(a,l.changeTimeout))};return s(),i=window.setTimeout(a,100),()=>{o=!1,clearTimeout(i)}},[e,t]),n}function Na(t){t=Math.floor(t);const e=Math.floor(t/3600);t%=3600;const n=Math.floor(t/60);t%=60;const r=o=>o.toString().padStart(2,"0");let i=`${r(n)}:${r(t)}`;return e>0&&(i=`${r(e)}:${i}`),i}const Zp=864e5;function SA(t,e){const n=Date.now(),r=(i=t,o=n,Math.floor((o-i)/Zp));var i,o;if(r<0||r===0)return e.TODAY;if(r===1)return e.YESTERDAY;const s={weekday:"long"},a=new Date(t);if(r<7)return a.toLocaleDateString(e.locale,s);const l=new Date(n);return function(c,h){return Math.floor((h-c)/(365*Zp))}(l.setFullYear(l.getFullYear()-1),t)===0?a.toLocaleDateString(e.locale,{...s,month:"long",day:"numeric"}):a.toLocaleDateString(e.locale,{...s,year:"numeric",month:"long",day:"numeric"})}const Qp=6e4,ef=36e5,tf=864e5,nT=6048e5;function rT(t,e,n){return new Intl.RelativeTimeFormat(n).format(-t,e)}function U(t,...e){const n=yv.bind(Oe)(t,...e);return Array.isArray(n)?Oe(Pe,{},...n):n}function Yo(t,e=10){return Cu(t,Math.min(e,100))}function OA(t,e,n){const r=Mi(),i=vt([]),o=vt(!1);ym(a=>{if(o.get()){const l=r.conversation(t).message(e).reactions(n).subscribe(u=>{u!=null||(u=[]),u=u.slice(0,10),i.set(u)});a.onCleanup=()=>{l.unsubscribe()}}});const s=ee(()=>o.set(!0),[o]);return[te(i),s]}function DA(t){var i,o,s,a,l,u,c,h;if(!t.container)return;const e=getComputedStyle(t.container),n=(i=yo.parse(e.color))!=null?i:new yo(255,255,255,1),r=n.withAlpha(n.alpha/2);return To.create({...t,barGap:(o=t.barGap)!=null?o:2,barRadius:(s=t.barRadius)!=null?s:0,barWidth:(a=t.barWidth)!=null?a:2,barHeight:t.barHeight,hideScrollbar:!0,cursorWidth:(l=t.cursorWidth)!=null?l:0,cursorColor:t.cursorColor,height:(u=t.height)!=null?u:24,progressColor:(c=t.progressColor)!=null?c:r.toRgbaString(),waveColor:(h=t.waveColor)!=null?h:r.toRgbaString()})}function Go({src:t,onError:e,filename:n,className:r=""}){const i=Q(null),o=Q(),s=Q(),[a,l]=ae(!1),[u,c]=ae(0),[h,d]=ae(1),p=Q(),[f,m]=ae(!1),E=te(he().t$),{audioUrl:A,audioName:_,height:g,isRecordingPreviewBlob:O}=se(()=>{const S=new URL(t),v=S.protocol==="blob:"&&S.searchParams.has("name");let y=n!=null?n:"";return v&&(y=S.searchParams.get("name"),S.searchParams.delete("name")),{audioUrl:S,audioName:y,height:v?24:50,isRecordingPreviewBlob:v}},[t,n]),[D,R]=ae(O);Z(()=>{let S;const v=i.current.closest("t-message-list"),y=new IntersectionObserver(function([b]){b.isIntersecting?S=setTimeout(()=>R(!0),500):clearTimeout(S)},{root:v});return y.observe(i.current),()=>{y.disconnect()}},[]),Z(()=>{if(!D)return;o.current=new Audio;const S={normalize:!0,height:g,container:i.current};function v(){const M=o.current;if(!M)return;const k=M.error;(k.message!=="Media failed to load"||M.paused)&&(k.message==="PIPELINE_ERROR_READ: FFmpegDemuxer: demuxer seek failed"?(M.load(),l(!1)):(m(!0),l(!1),e==null||e()))}const y=_.slice(_.lastIndexOf(".")+1);if(function(M){return/(?:^|\/)talkjs_audio_message_[0-9]+_([0-9]+)[.](?:mp3|webm)$/.test(M)}(_)&&y==="webm"&&!o.current.canPlayType("audio/webm;codecs=opus"))S.backend="WebAudio",s.current=new Audio("data:audio/mp3;base64,//MkxAAHiAICWABElBeKPL/RANb2w+yiT1g/gTok//lP/W/l3h8QO/OCdCqCW2Cw//MkxAQHkAIWUAhEmAQXWUOFW2dxPu//9mr60ElY5sseQ+xxesmHKtZr7bsqqX2L//MkxAgFwAYiQAhEAC2hq22d3///9FTV6tA36JdgBJoOGgc+7qvqej5Zu7/7uI9l//MkxBQHAAYi8AhEAO193vt9KGOq+6qcT7hhfN5FTInmwk8RkqKImTM55pRQHQSq//MkxBsGkgoIAABHhTACIJLf99nVI///yuW1uBqWfEu7CgNPWGpUadBmZ////4sL//MkxCMHMAH9iABEmAsKioqKigsLCwtVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVV//MkxCkECAUYCAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"),s.current.controls=!1;else{const M=o.current;M.addEventListener("error",v),M.preservesPitch=!0,S.url=A.toString(),S.media=M}p.current=DA(S);const b=p.current;return b.on("finish",()=>{o.current.loop=!0,l(!1)}),b.on("ready",M=>c(Math.trunc(M))),b.on("timeupdate",M=>c(Math.trunc(M))),S.backend==="WebAudio"&&b.load(A.toString()).catch(()=>{m(!0),l(!1),e==null||e()}),()=>{var M,k;(M=o.current)==null||M.pause(),(k=o.current)==null||k.removeEventListener("error",v),o.current=void 0,b.destroy(),p.current=void 0}},[A,_,e,D,g]);const T=ee(()=>{var S;if(p.current.options.backend==="WebAudio")p.current.isPlaying()||s.current.play(),p.current.playPause(),l((S=p.current.isPlaying())!=null?S:!1);else{const v=o.current;v.paused?v.play():v.pause(),v.loop=!1,!v.paused&&v.ended&&(v.load(),v.play()),l(!v.paused)}},[]),I=ee(S=>{p.current.setPlaybackRate(S),d(S)},[]);return L("div",f?{}:{className:`t-audio-player ${r}`,children:[L("button",{onClick:T,children:L(Ys,{className:"t-play-pause-icon",type:a?"pause":"play","aria-label":a?E.ARIA_PAUSE_AUDIO:E.ARIA_PLAY_AUDIO})}),L("div",{className:"t-waveform",ref:i,style:{height:g}}),L("div",{className:"t-duration",children:Na(u)}),L(li,{type:"menu",portal:!0,popoverComponent:oT,popoverProps:{playbackSpeed:h,selectPlaybackSpeed:I},className:"t-playback-speed","aria-label":E.ARIA_SET_PLAYBACK_SPEED,children:[h,"x",L(Ys,{type:"updown",className:"t-up-down-icon","aria-hidden":!0})]})]})}const iT=[.25,.5,.75,1,1.25,1.5,2];function oT({playbackSpeed:t,selectPlaybackSpeed:e}){return L("div",{className:"t-playback-speed-menu",children:[L("div",{className:"t-heading",children:"Playback Speed"}),iT.map(n=>L(Kn,{className:"t-menu-item",onSelect:()=>e(n),children:[L("span",{className:"t-playback-checkmark",children:t===n?"✓ ":""}),n,"x"]},n))]})}const sT=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,aT=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)$/;class yo{constructor(e,n,r,i){this.red=e,this.green=n,this.blue=r,this.alpha=i}static parse(e){var r;const n=(r=e.match(sT))!=null?r:e.match(aT);if(n){const[i,o,s,a,l="1"]=n;return new yo(Number(o),Number(s),Number(a),Number(l))}return null}withAlpha(e){return new yo(this.red,this.green,this.blue,e)}toRgbaString(){const{red:e,green:n,blue:r,alpha:i}=this;return i!==1?`rgba(${e}, ${n}, ${r}, ${i})`:`rgb(${e}, ${n}, ${r})`}}function Il(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(u){try{l(r.next(u))}catch(c){o(c)}}function a(u){try{l(r.throw(u))}catch(c){o(c)}}function l(u){var c;u.done?i(u.value):(c=u.value,c instanceof n?c:new n(function(h){h(c)})).then(s,a)}l((r=r.apply(t,[])).next())})}class vA{constructor(){this.listeners={}}on(e,n,r){if(this.listeners[e]||(this.listeners[e]=new Set),r==null?void 0:r.once){const i=(...o)=>{this.un(e,i),n(...o)};return this.listeners[e].add(i),()=>this.un(e,i)}return this.listeners[e].add(n),()=>this.un(e,n)}un(e,n){var r;(r=this.listeners[e])===null||r===void 0||r.delete(n)}once(e,n){return this.on(e,n,{once:!0})}unAll(){this.listeners={}}emit(e,...n){this.listeners[e]&&this.listeners[e].forEach(r=>r(...n))}}class lT extends vA{constructor(e){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=e}onInit(){}_init(e){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e()),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}}class cT extends vA{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const e=()=>{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(e))};e()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop()}}const uT=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class Hu extends lT{constructor(e){var n,r,i,o,s,a;super(Object.assign(Object.assign({},e),{audioBitsPerSecond:(n=e.audioBitsPerSecond)!==null&&n!==void 0?n:128e3,scrollingWaveform:(r=e.scrollingWaveform)!==null&&r!==void 0&&r,scrollingWaveformWindow:(i=e.scrollingWaveformWindow)!==null&&i!==void 0?i:5,continuousWaveform:(o=e.continuousWaveform)!==null&&o!==void 0&&o,renderRecordedAudio:(s=e.renderRecordedAudio)===null||s===void 0||s,mediaRecorderTimeslice:(a=e.mediaRecorderTimeslice)!==null&&a!==void 0?a:void 0})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.micStream=null,this.recordedBlobUrl=null,this.timer=new cT,this.subscriptions.push(this.timer.on("tick",()=>{const l=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+l,this.emit("record-progress",this.duration)}))}static create(e){return new Hu(e||{})}renderMicStream(e){var n;const r=new AudioContext,i=r.createMediaStreamSource(e),o=r.createAnalyser();i.connect(o),(this.options.continuousWaveform||this.options.scrollingWaveform)&&(o.fftSize=32);const s=o.frequencyBinCount,a=new Float32Array(s);let l=0;this.wavesurfer&&((n=this.originalOptions)!==null&&n!==void 0||(this.originalOptions=Object.assign({},this.wavesurfer.options)),this.wavesurfer.options.interact=!1,this.options.scrollingWaveform&&(this.wavesurfer.options.cursorWidth=0,this.wavesurfer.options.normalize=!0,this.wavesurfer.options.maxPeak=1));const u=setInterval(()=>{var c,h,d,p;if(!this.isWaveformPaused){if(o.getFloatTimeDomainData(a),this.options.scrollingWaveform){const f=Math.floor(100*(this.options.scrollingWaveformWindow||0));let m=0;for(let A=0;A<s;A++){const _=Math.abs(a[A]);_>m&&(m=_)}this.dataWindow||(this.dataWindow=new Float32Array(f));const E=new Float32Array(f);if(this.dataWindow&&this.dataWindow.length>0){const A=f-1,_=this.dataWindow.slice(-A);E.set(_,0)}E[f-1]=m,this.dataWindow=E}else if(this.options.continuousWaveform){if(!this.dataWindow){const m=this.options.continuousWaveformDuration?Math.round(100*this.options.continuousWaveformDuration):((h=(c=this.wavesurfer)===null||c===void 0?void 0:c.getWidth())!==null&&h!==void 0?h:0)*window.devicePixelRatio;this.dataWindow=new Float32Array(m)}let f=0;for(let m=0;m<s;m++){const E=Math.abs(a[m]);E>f&&(f=E)}if(l+1>this.dataWindow.length){const m=new Float32Array(2*this.dataWindow.length);m.set(this.dataWindow,0),this.dataWindow=m}this.dataWindow[l]=f,l++}else this.dataWindow=a;if(this.wavesurfer){const f=((p=(d=this.dataWindow)===null||d===void 0?void 0:d.length)!==null&&p!==void 0?p:0)/100;this.wavesurfer.load("",[this.dataWindow],this.options.scrollingWaveform?this.options.scrollingWaveformWindow:f).then(()=>{this.wavesurfer&&this.options.continuousWaveform&&(this.wavesurfer.setTime(this.getDuration()/1e3),this.wavesurfer.options.minPxPerSec||this.wavesurfer.setOptions({minPxPerSec:this.wavesurfer.getWidth()/this.wavesurfer.getDuration()}))}).catch(m=>{console.error("Error rendering real-time recording data:",m)})}}},10);return{onDestroy:()=>{clearInterval(u),i==null||i.disconnect(),r==null||r.close()},onEnd:()=>{this.isWaveformPaused=!0,this.stopMic()}}}startMic(e){return Il(this,0,void 0,function*(){let n;this.micStream&&this.stopMic();try{n=yield navigator.mediaDevices.getUserMedia({audio:e==null||e})}catch(i){throw new Error("Error accessing the microphone: "+i.message)}const r=this.renderMicStream(n);return this.micStream=r,this.unsubscribeDestroy=this.once("destroy",r.onDestroy),this.unsubscribeRecordEnd=this.once("record-end",r.onEnd),this.stream=n,n})}stopMic(){var e,n,r;(e=this.micStream)===null||e===void 0||e.onDestroy(),(n=this.unsubscribeDestroy)===null||n===void 0||n.call(this),(r=this.unsubscribeRecordEnd)===null||r===void 0||r.call(this),this.micStream=null,this.unsubscribeDestroy=void 0,this.unsubscribeRecordEnd=void 0,this.stream&&(this.stream.getTracks().forEach(i=>i.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(e){return Il(this,0,void 0,function*(){const n=this.stream||(yield this.startMic(e));this.dataWindow=null;const r=this.mediaRecorder||new MediaRecorder(n,{mimeType:this.options.mimeType||uT.find(s=>MediaRecorder.isTypeSupported(s)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=r,this.stopRecording();const i=[];r.ondataavailable=s=>{s.data.size>0&&i.push(s.data),this.emit("record-data-available",s.data)};const o=s=>{var a;const l=new Blob(i,{type:r.mimeType});this.emit(s,l),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),this.recordedBlobUrl&&URL.revokeObjectURL(this.recordedBlobUrl),this.recordedBlobUrl=URL.createObjectURL(l),(a=this.wavesurfer)===null||a===void 0||a.load(this.recordedBlobUrl))};r.onpause=()=>o("record-pause"),r.onstop=()=>o("record-end"),r.start(this.options.mediaRecorderTimeslice),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)==="recording"}isPaused(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)==="paused"}isActive(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)!=="inactive"}stopRecording(){var e;this.isActive()&&((e=this.mediaRecorder)===null||e===void 0||e.stop(),this.timer.stop())}pauseRecording(){var e,n;this.isRecording()&&(this.isWaveformPaused=!0,(e=this.mediaRecorder)===null||e===void 0||e.requestData(),(n=this.mediaRecorder)===null||n===void 0||n.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var e;this.isPaused()&&(this.isWaveformPaused=!1,(e=this.mediaRecorder)===null||e===void 0||e.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return Il(this,0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(e=>e.filter(n=>n.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic(),this.recordedBlobUrl&&(URL.revokeObjectURL(this.recordedBlobUrl),this.recordedBlobUrl=null)}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.setOptions(this.originalOptions),delete this.originalOptions)}}var TA={exports:{}};TA.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var s in r)n.d(o,s,function(a){return r[a]}.bind(null,s));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=0)}([function(t,e,n){(function(r){function i(O){return(i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D})(O)}function o(O,D){return function(R){if(Array.isArray(R))return R}(O)||function(R,T){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(R)){var I=[],S=!0,v=!1,y=void 0;try{for(var b,M=R[Symbol.iterator]();!(S=(b=M.next()).done)&&(I.push(b.value),!T||I.length!==T);S=!0);}catch(k){v=!0,y=k}finally{try{S||M.return==null||M.return()}finally{if(v)throw y}}return I}}(O,D)||function(R,T){if(R){if(typeof R=="string")return s(R,T);var I=Object.prototype.toString.call(R).slice(8,-1);return I==="Object"&&R.constructor&&(I=R.constructor.name),I==="Map"||I==="Set"?Array.from(R):I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I)?s(R,T):void 0}}(O,D)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
103
103
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function s(O,D){(D==null||D>O.length)&&(D=O.length);for(var R=0,T=new Array(D);R<D;R++)T[R]=O[R];return T}function a(O,D){if(!(O instanceof D))throw new TypeError("Cannot call a class as a function")}function l(O,D){for(var R=0;R<D.length;R++){var T=D[R];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(O,T.key,T)}}function u(O,D){return(u=Object.setPrototypeOf||function(R,T){return R.__proto__=T,R})(O,D)}function c(O){var D=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(R){return!1}}();return function(){var R,T=d(O);if(D){var I=d(this).constructor;R=Reflect.construct(T,arguments,I)}else R=T.apply(this,arguments);return h(this,R)}}function h(O,D){return!D||i(D)!=="object"&&typeof D!="function"?function(R){if(R===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return R}(O):D}function d(O){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(D){return D.__proto__||Object.getPrototypeOf(D)})(O)}var p,f=n(2),m=f.EventTarget,E=f.defineEventAttribute,A=(0,n(3).detect)(),_=r.AudioContext||r.webkitAudioContext,g=function(O){(function(v,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(y&&y.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),y&&u(v,y)})(S,O);var D,R,T,I=c(S);function S(v){var y,b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};a(this,S);var k=b.mimeType,P=b.audioBitsPerSecond,B=(b.videoBitsPerSecond,b.bitsPerSecond),F=M.encoderWorkerFactory,V=M.OggOpusEncoderWasmPath,G=M.WebMOpusEncoderWasmPath;if((y=I.call(this))._stream=v,y._state="inactive",y._mimeType=k||"",y._audioBitsPerSecond=P||B,y.workerState="inactive",!S.isTypeSupported(y._mimeType))throw new TypeError("invalid arguments, a MIME Type is not supported");switch(S._parseType(y._mimeType).subtype){case"wave":case"wav":y._mimeType="audio/wave";break;case"webm":y._mimeType="audio/webm";break;case"ogg":y._mimeType="audio/ogg";break;default:switch(A&&A.name){case"chrome":case"edge":default:y._mimeType="audio/webm";break;case"firefox":y._mimeType="audio/ogg";break;case"ios":case"safari":y._mimeType="audio/wave"}}switch(y._mimeType){case"audio/wave":y._wasmPath="";break;case"audio/webm":y._wasmPath=G||"";break;case"audio/ogg":y._wasmPath=V||"";break;default:throw new Error("Internal Error: Unexpected MIME Type: ".concat(y._mimeType))}var z="";return document.currentScript?z=document.currentScript.src:self.location&&(z=self.location.href),z=z.substr(0,z.lastIndexOf("/"))+"/encoderWorker.umd.js",typeof S.encoderWorker=="function"&&(z=URL.createObjectURL(new Blob(["(".concat(S.encoderWorker,")()")]))),y._workerFactory=typeof F=="function"?F:function(K){return new Worker(z)},y._spawnWorker(),y}return D=S,T=[{key:"isTypeSupported",value:function(v){if(typeof v=="string"&&!v)return!0;try{var y=S._parseType(v),b=y.type,M=y.subtype,k=y.codec}catch(P){return!1}if(b!=="audio"||M!=="ogg"&&M!=="webm"&&M!=="wave"&&M!=="wav")return!1;switch(M){case"ogg":case"webm":if(k!=="opus"&&k)return!1;break;case"wave":case"wav":if(k)return!1}return!0}},{key:"_parseType",value:function(v){try{var y=o(v.match(/^(\w+)\/(\w+)(;\s*codecs=(\w+))?$/),5),b=y[1],M=y[2],k=y[4]}catch(P){return typeof v!="string"||v?null:{type:"",subtype:"",codec:""}}return{type:b,subtype:M,codec:k}}}],(R=[{key:"_spawnWorker",value:function(){var v=this;this.worker=this._workerFactory(),this.worker.onmessage=function(y){return v._onmessageFromWorker(y)},this.worker.onerror=function(y){return v._onerrorFromWorker(y)},this._postMessageToWorker("loadEncoder",{mimeType:this._mimeType,wasmPath:this._wasmPath})}},{key:"_postMessageToWorker",value:function(v){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};switch(v){case"loadEncoder":var b=y.mimeType,M=y.wasmPath;this.worker.postMessage({command:v,mimeType:b,wasmPath:M});break;case"init":var k=y.sampleRate,P=y.channelCount,B=y.bitsPerSecond;this.worker.postMessage({command:v,sampleRate:k,channelCount:P,bitsPerSecond:B}),this.workerState="encoding",this.source.connect(this.processor),this.processor.connect(this.context.destination);var F=new r.Event("start");this.dispatchEvent(F);break;case"pushInputData":var V=y.channelBuffers,G=y.length,z=y.duration;this.worker.postMessage({command:v,channelBuffers:V,length:G,duration:z});break;case"getEncodedData":case"done":this.worker.postMessage({command:v});break;default:throw new Error("Internal Error: Incorrect postMessage requested.")}}},{key:"_onmessageFromWorker",value:function(v){var y,b=v.data,M=b.command,k=b.buffers;switch(M){case"readyToInit":var P=this.sampleRate,B=this.channelCount;this.workerState="readyToInit",this.state==="recording"&&this._postMessageToWorker("init",{sampleRate:P,channelCount:B,bitsPerSecond:this.audioBitsPerSecond});break;case"encodedData":case"lastEncodedData":var F=new Blob(k,{type:this._mimeType});(y=new r.Event("dataavailable")).data=F,this.dispatchEvent(y),M==="lastEncodedData"&&(y=new r.Event("stop"),this.dispatchEvent(y),this.workerState="closed")}}},{key:"_onerrorFromWorker",value:function(v){this.source.disconnect(),this.processor.disconnect(),this.worker.terminate(),this.workerState="closed";var y=["FileName: "+v.filename,"LineNumber: "+v.lineno,"Message: "+v.message].join(" - "),b=new r.Event("error");b.name="UnknownError",b.message=y,this.dispatchEvent(b)}},{key:"_enableAudioProcessCallback",value:function(v){var y=this,b=0;this.processor.onaudioprocess=function(M){for(var k=M.inputBuffer,P=(M.playbackTime,k.sampleRate,k.length),B=k.duration,F=k.numberOfChannels,V=new Array(F),G=0;G<F;G++)V[G]=k.getChannelData(G);var z={channelBuffers:V,length:P,duration:B};y._postMessageToWorker("pushInputData",z),(b+=B)>=v&&(y._postMessageToWorker("getEncodedData"),b=0)}}},{key:"start",value:function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.MAX_SAFE_INTEGER;if(this.state!=="inactive")throw new Error("DOMException: INVALID_STATE_ERR, state must be inactive.");if(v<0)throw new TypeError("invalid arguments, timeslice should be 0 or higher.");v/=1e3,this.workerState==="closed"&&this._spawnWorker(),this.context=new _;var y=this.stream.getAudioTracks();if(!y[0])throw new Error("DOMException: UnkownError, media track not found.");if(this.channelCount=y[0].getSettings().channelCount||1,this.sampleRate=this.context.sampleRate,this.source=this.context.createMediaStreamSource(this.stream),this.processor=this.context.createScriptProcessor(4096,this.channelCount,this.channelCount),this._state="recording",this._enableAudioProcessCallback(v),this.workerState==="readyToInit"){var b=this.sampleRate,M=this.channelCount;this._postMessageToWorker("init",{sampleRate:b,channelCount:M,bitsPerSecond:this.audioBitsPerSecond})}}},{key:"stop",value:function(){if(this.state==="inactive")throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.disconnect(),this.processor.disconnect(),this.context.close(),this._postMessageToWorker("done"),this._state="inactive"}},{key:"pause",value:function(){if(this.state==="inactive")throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.disconnect(),this.processor.disconnect();var v=new r.Event("pause");this.dispatchEvent(v),this._state="paused"}},{key:"resume",value:function(){if(this.state==="inactive")throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this.source.connect(this.processor),this.processor.connect(this.context.destination);var v=new r.Event("resume");this.dispatchEvent(v),this._state="recording"}},{key:"requestData",value:function(){if(this.state==="inactive")throw new Error("DOMException: INVALID_STATE_ERR, state must NOT be inactive.");this._postMessageToWorker("getEncodedData")}},{key:"stream",get:function(){return this._stream}},{key:"mimeType",get:function(){return this._mimeType}},{key:"state",get:function(){return this._state}},{key:"videoBitsPerSecond",get:function(){}},{key:"audioBitsPerSecond",get:function(){return this._audioBitsPerSecond}}])&&l(D.prototype,R),T&&l(D,T),S}(m);["start","stop","dataavailable","pause","resume","error"].forEach(function(O){return E(g.prototype,O)}),A&&A.name==="edge"&&(p=Worker.prototype.postMessage,Worker.prototype.postMessage=function(O){p.apply(this,[O])}),t.exports=g}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){typeof window=="object"&&(n=window)}t.exports=n},function(t,e,n){n.r(e),n.d(e,"defineEventAttribute",function(){return m}),n.d(e,"EventTarget",function(){return A});const r=new WeakMap,i=new WeakMap;function o(_){const g=r.get(_);return console.assert(g!=null,"'this' is expected an Event object, but got",_),g}function s(_,g){r.set(this,{eventTarget:_,event:g,eventPhase:2,currentTarget:_,canceled:!1,stopped:!1,passiveListener:null,timeStamp:g.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const O=Object.keys(g);for(let D=0;D<O.length;++D){const R=O[D];R in this||Object.defineProperty(this,R,a(R))}}function a(_){return{get(){return o(this).event[_]},set(g){o(this).event[_]=g},configurable:!0,enumerable:!0}}function l(_){return{value(){const g=o(this).event;return g[_].apply(g,arguments)},configurable:!0,enumerable:!0}}function u(_){if(_==null||_===Object.prototype)return s;let g=i.get(_);return g==null&&(g=function(O,D){const R=Object.keys(D);if(R.length===0)return O;function T(I,S){O.call(this,I,S)}T.prototype=Object.create(O.prototype,{constructor:{value:T,configurable:!0,writable:!0}});for(let I=0;I<R.length;++I){const S=R[I];if(!(S in O.prototype)){const v=typeof Object.getOwnPropertyDescriptor(D,S).value=="function";Object.defineProperty(T.prototype,S,v?l(S):a(S))}}return T}(u(Object.getPrototypeOf(_)),_),i.set(_,g)),g}function c(_){return o(_).stopped}function h(_,g){o(_).passiveListener=g}s.prototype={get type(){return o(this).event.type},get target(){return o(this).eventTarget},get currentTarget(){return o(this).currentTarget},composedPath(){const _=o(this).currentTarget;return _==null?[]:[_]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return o(this).eventPhase},stopPropagation(){const _=o(this);typeof _.event.stopPropagation=="function"&&_.event.stopPropagation()},stopImmediatePropagation(){const _=o(this);_.stopped=!0,typeof _.event.stopImmediatePropagation=="function"&&_.event.stopImmediatePropagation()},get bubbles(){return!!o(this).event.bubbles},get cancelable(){return!!o(this).event.cancelable},preventDefault(){const _=o(this);_.passiveListener==null?_.event.cancelable&&(_.canceled=!0,typeof _.event.preventDefault=="function"&&_.event.preventDefault()):console.warn("Event#preventDefault() was called from a passive listener:",_.passiveListener)},get defaultPrevented(){return o(this).canceled},get composed(){return!!o(this).event.composed},get timeStamp(){return o(this).timeStamp}},Object.defineProperty(s.prototype,"constructor",{value:s,configurable:!0,writable:!0}),typeof window!="undefined"&&window.Event!==void 0&&(Object.setPrototypeOf(s.prototype,window.Event.prototype),i.set(window.Event.prototype,s));const d=new WeakMap;function p(_){return _!==null&&typeof _=="object"}function f(_){const g=d.get(_);if(g==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return g}function m(_,g){Object.defineProperty(_,"on"+g,function(O){return{get(){let D=f(this).get(O);for(;D!=null;){if(D.listenerType===3)return D.listener;D=D.next}return null},set(D){typeof D=="function"||p(D)||(D=null);const R=f(this);let T=null,I=R.get(O);for(;I!=null;)I.listenerType===3?T!==null?T.next=I.next:I.next!==null?R.set(O,I.next):R.delete(O):T=I,I=I.next;if(D!==null){const S={listener:D,listenerType:3,passive:!1,once:!1,next:null};T===null?R.set(O,S):T.next=S}},configurable:!0,enumerable:!0}}(g))}function E(_){function g(){A.call(this)}g.prototype=Object.create(A.prototype,{constructor:{value:g,configurable:!0,writable:!0}});for(let O=0;O<_.length;++O)m(g.prototype,_[O]);return g}function A(){if(!(this instanceof A)){if(arguments.length===1&&Array.isArray(arguments[0]))return E(arguments[0]);if(arguments.length>0){const _=new Array(arguments.length);for(let g=0;g<arguments.length;++g)_[g]=arguments[g];return E(_)}throw new TypeError("Cannot call a class as a function")}d.set(this,new Map)}A.prototype={addEventListener(_,g,O){if(g==null)return!1;if(typeof g!="function"&&!p(g))throw new TypeError("'listener' should be a function or an object.");const D=f(this),R=p(O),T=(R?O.capture:O)?1:2,I={listener:g,listenerType:T,passive:R&&!!O.passive,once:R&&!!O.once,next:null};let S=D.get(_);if(S===void 0)return D.set(_,I),!0;let v=null;for(;S!=null;){if(S.listener===g&&S.listenerType===T)return!1;v=S,S=S.next}return v.next=I,!0},removeEventListener(_,g,O){if(g==null)return!1;const D=f(this),R=(p(O)?O.capture:O)?1:2;let T=null,I=D.get(_);for(;I!=null;){if(I.listener===g&&I.listenerType===R)return T!==null?T.next=I.next:I.next!==null?D.set(_,I.next):D.delete(_),!0;T=I,I=I.next}return!1},dispatchEvent(_){if(_==null||typeof _.type!="string")throw new TypeError('"event.type" should be a string.');const g=f(this),O=_.type;let D=g.get(O);if(D==null)return!0;const R=function(I,S){return new(u(Object.getPrototypeOf(S)))(I,S)}(this,_);let T=null;for(;D!=null;){if(D.once?T!==null?T.next=D.next:D.next!==null?g.set(O,D.next):g.delete(O):T=D,h(R,D.passive?D.listener:null),typeof D.listener=="function")try{D.listener.call(this,R)}catch(I){typeof console!="undefined"&&typeof console.error=="function"&&console.error(I)}else D.listenerType!==3&&typeof D.listener.handleEvent=="function"&&D.listener.handleEvent(R);if(c(R))break;D=D.next}return h(R,null),function(I,S){o(I).eventPhase=S}(R,0),function(I,S){o(I).currentTarget=S}(R,null),!R.defaultPrevented}},Object.defineProperty(A.prototype,"constructor",{value:A,configurable:!0,writable:!0}),typeof window!="undefined"&&window.EventTarget!==void 0&&Object.setPrototypeOf(A.prototype,window.EventTarget.prototype),e.default=A},function(t,e,n){(function(r){var i=this&&this.__spreadArrays||function(){for(var p=0,f=0,m=arguments.length;f<m;f++)p+=arguments[f].length;var E=Array(p),A=0;for(f=0;f<m;f++)for(var _=arguments[f],g=0,O=_.length;g<O;g++,A++)E[A]=_[g];return E};Object.defineProperty(e,"__esModule",{value:!0});var o=function(p,f,m){this.name=p,this.version=f,this.os=m};e.BrowserInfo=o;var s=function(p){this.version=p,this.name="node",this.os=r.platform};e.NodeInfo=s;var a=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null};e.BotInfo=a;var l=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/Edg\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],u=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function c(p){var f=p!==""&&l.reduce(function(_,g){var O=g[0],D=g[1];if(_)return _;var R=D.exec(p);return!!R&&[O,R]},!1);if(!f)return null;var m=f[0],E=f[1];if(m==="searchbot")return new a;var A=E[1]&&E[1].split(/[._]/).slice(0,3);return A?A.length<3&&(A=i(A,function(_){for(var g=[],O=0;O<_;O++)g.push("0");return g}(3-A.length))):A=[],new o(m,A.join("."),h(p))}function h(p){for(var f=0,m=u.length;f<m;f++){var E=u[f],A=E[0];if(E[1].test(p))return A}return null}function d(){return r!==void 0&&r.version?new s(r.version.slice(1)):null}e.detect=function(p){return p?c(p):typeof navigator!="undefined"?c(navigator.userAgent):d()},e.parseUserAgent=c,e.detectOS=h,e.getNodeVersion=d}).call(this,n(4))},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(E){if(n===setTimeout)return setTimeout(E,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(E,0);try{return n(E,0)}catch(A){try{return n.call(null,E,0)}catch(_){return n.call(this,E,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:o}catch(E){n=o}try{r=typeof clearTimeout=="function"?clearTimeout:s}catch(E){r=s}})();var l,u=[],c=!1,h=-1;function d(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&p())}function p(){if(!c){var E=a(d);c=!0;for(var A=u.length;A;){for(l=u,u=[];++h<A;)l&&l[h].run();h=-1,A=u.length}l=null,c=!1,function(_){if(r===clearTimeout)return clearTimeout(_);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(_);try{r(_)}catch(g){try{return r.call(null,_)}catch(O){return r.call(this,_)}}}(E)}}function f(E,A){this.fun=E,this.array=A}function m(){}i.nextTick=function(E){var A=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)A[_-1]=arguments[_];u.push(new f(E,A)),u.length!==1||c||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(E){return[]},i.binding=function(E){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(E){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}]);const dT=tu(TA.exports);var nf,yl,RA={exports:{}};nf=RA,typeof OpusMediaRecorder!="undefined"&&OpusMediaRecorder,yl=function(){return function(){(function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var s in r)n.d(o,s,function(a){return r[a]}.bind(null,s));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=5)})([function(t,e,n){(function(r){function i(a,l){for(var u=0,c=a.length-1;c>=0;c--){var h=a[c];h==="."?a.splice(c,1):h===".."?(a.splice(c,1),u++):u&&(a.splice(c,1),u--)}if(l)for(;u--;u)a.unshift("..");return a}function o(a,l){if(a.filter)return a.filter(l);for(var u=[],c=0;c<a.length;c++)l(a[c],c,a)&&u.push(a[c]);return u}e.resolve=function(){for(var a="",l=!1,u=arguments.length-1;u>=-1&&!l;u--){var c=u>=0?arguments[u]:r.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");c&&(a=c+"/"+a,l=c.charAt(0)==="/")}return(l?"/":"")+(a=i(o(a.split("/"),function(h){return!!h}),!l).join("/"))||"."},e.normalize=function(a){var l=e.isAbsolute(a),u=s(a,-1)==="/";return(a=i(o(a.split("/"),function(c){return!!c}),!l).join("/"))||l||(a="."),a&&u&&(a+="/"),(l?"/":"")+a},e.isAbsolute=function(a){return a.charAt(0)==="/"},e.join=function(){var a=Array.prototype.slice.call(arguments,0);return e.normalize(o(a,function(l,u){if(typeof l!="string")throw new TypeError("Arguments to path.join must be strings");return l}).join("/"))},e.relative=function(a,l){function u(E){for(var A=0;A<E.length&&E[A]==="";A++);for(var _=E.length-1;_>=0&&E[_]==="";_--);return A>_?[]:E.slice(A,_-A+1)}a=e.resolve(a).substr(1),l=e.resolve(l).substr(1);for(var c=u(a.split("/")),h=u(l.split("/")),d=Math.min(c.length,h.length),p=d,f=0;f<d;f++)if(c[f]!==h[f]){p=f;break}var m=[];for(f=p;f<c.length;f++)m.push("..");return(m=m.concat(h.slice(p))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(a){if(typeof a!="string"&&(a+=""),a.length===0)return".";for(var l=a.charCodeAt(0),u=l===47,c=-1,h=!0,d=a.length-1;d>=1;--d)if((l=a.charCodeAt(d))===47){if(!h){c=d;break}}else h=!1;return c===-1?u?"/":".":u&&c===1?"/":a.slice(0,c)},e.basename=function(a,l){var u=function(c){typeof c!="string"&&(c+="");var h,d=0,p=-1,f=!0;for(h=c.length-1;h>=0;--h)if(c.charCodeAt(h)===47){if(!f){d=h+1;break}}else p===-1&&(f=!1,p=h+1);return p===-1?"":c.slice(d,p)}(a);return l&&u.substr(-1*l.length)===l&&(u=u.substr(0,u.length-l.length)),u},e.extname=function(a){typeof a!="string"&&(a+="");for(var l=-1,u=0,c=-1,h=!0,d=0,p=a.length-1;p>=0;--p){var f=a.charCodeAt(p);if(f!==47)c===-1&&(h=!1,c=p+1),f===46?l===-1?l=p:d!==1&&(d=1):l!==-1&&(d=-1);else if(!h){u=p+1;break}}return l===-1||c===-1||d===0||d===1&&l===c-1&&l===u+1?"":a.slice(l,c)};var s="ab".substr(-1)==="b"?function(a,l,u){return a.substr(l,u)}:function(a,l,u){return l<0&&(l=a.length+l),a.substr(l,u)}}).call(this,n(2))},function(t,e){function n(A){return(n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _})(A)}function r(A,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(_&&_.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),_&&i(A,_)}function i(A,_){return(i=Object.setPrototypeOf||function(g,O){return g.__proto__=O,g})(A,_)}function o(A){var _=function(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(g){return!1}}();return function(){var g,O=a(A);if(_){var D=a(this).constructor;g=Reflect.construct(O,arguments,D)}else g=O.apply(this,arguments);return s(this,g)}}function s(A,_){return!_||n(_)!=="object"&&typeof _!="function"?function(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}(A):_}function a(A){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(_){return _.__proto__||Object.getPrototypeOf(_)})(A)}function l(A,_){if(!(A instanceof _))throw new TypeError("Cannot call a class as a function")}function u(A,_,g){return _&&function(O,D){for(var R=0;R<D.length;R++){var T=D[R];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(O,T.key,T)}}(A.prototype,_),A}var c=function(){function A(_,g,O,D){switch(l(this,A),this._size=g,this._module=_,this._size){case 1:this._heapArray=O?this._module.HEAP8:this._module.HEAPU8;break;case 2:this._heapArray=O?this._module.HEAP16:this._module.HEAPU16;break;case 4:this._heapArray=O?this._module.HEAP32:this._module.HEAPU32;break;default:this._heapArray=this._module.HEAPU8}D&&(this._size=4,this._heapArray=this._module.HEAPF32),this._pointer=this._module._malloc(g)}return u(A,[{key:"free",value:function(){this._module._free(this.pointer)}},{key:"pointer",get:function(){return this._pointer}},{key:"value",get:function(){var _=0;switch(this._size){case 2:_=1;break;case 4:_=2;break;default:throw new Error("Pointer can be only deferenced as integer-sized")}return this._heapArray[this.pointer>>_]},set:function(_){var g=0;switch(this._size){case 2:g=1;break;case 4:g=2;break;default:throw new Error("Pointer can be only deferenced as integer-sized")}this._heapArray[this.pointer>>g]=_}}]),A}(),h=function(A){r(g,A);var _=o(g);function g(O,D){var R;return l(this,g),R=_.call(this,O,4,!0,!1),D!==void 0&&(R.value=D),R}return g}(c),d=function(A){r(g,A);var _=o(g);function g(O,D){var R;return l(this,g),R=_.call(this,O,4,!1,!1),D!==void 0&&(R.value=D),R}return g}(c),p=function(A){r(g,A);var _=o(g);function g(O,D,R,T,I){var S;l(this,g),S=_.call(this,O,D*R,T,I);var v=0;switch(R){case 1:S._heapArray=T?S._module.HEAP8:S._module.HEAPU8,v=0;break;case 2:S._heapArray=T?S._module.HEAP16:S._module.HEAPU16,v=1;break;case 4:S._heapArray=T?S._module.HEAP32:S._module.HEAPU32,v=2;break;default:throw new Error("Unit size must be an integer-size")}I&&(S._heapArray=S._module.HEAPF32,v=2);var y=S._pointer>>v;return S._buffer=S._heapArray.subarray(y,y+D),S._length=D,S}return u(g,[{key:"set",value:function(O,D){this._buffer.set(O,D)}},{key:"subarray",value:function(O,D){return this._buffer.subarray(O,D)}},{key:"length",get:function(){return this._length}}]),g}(c),f=function(A){r(g,A);var _=o(g);function g(O,D){return l(this,g),_.call(this,O,D,4,!0,!0)}return g}(p),m=function(A){r(g,A);var _=o(g);function g(O,D){return l(this,g),_.call(this,O,D,1,!1,!1)}return g}(p),E=function(){function A(_){l(this,A),this._module=_}return u(A,[{key:"mallocInt32",value:function(_){return new h(this._module,_)}},{key:"mallocUint32",value:function(_){return new d(this._module,_)}},{key:"mallocUint8Buffer",value:function(_){return new m(this._module,_)}},{key:"mallocFloat32Buffer",value:function(_){return new f(this._module,_)}}]),A}();t.exports={writeString:function(A,_,g){for(var O=0;O<g.length;O++)A.setUint8(_+O,g.charCodeAt(O))},EmscriptenMemoryAllocator:E}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(E){if(n===setTimeout)return setTimeout(E,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(E,0);try{return n(E,0)}catch(A){try{return n.call(null,E,0)}catch(_){return n.call(this,E,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:o}catch(E){n=o}try{r=typeof clearTimeout=="function"?clearTimeout:s}catch(E){r=s}})();var l,u=[],c=!1,h=-1;function d(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&p())}function p(){if(!c){var E=a(d);c=!0;for(var A=u.length;A;){for(l=u,u=[];++h<A;)l&&l[h].run();h=-1,A=u.length}l=null,c=!1,function(_){if(r===clearTimeout)return clearTimeout(_);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(_);try{r(_)}catch(g){try{return r.call(null,_)}catch(O){return r.call(this,_)}}}(E)}}function f(E,A){this.fun=E,this.array=A}function m(){}i.nextTick=function(E){var A=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)A[_-1]=arguments[_];u.push(new f(E,A)),u.length!==1||c||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(E){return[]},i.binding=function(E){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(E){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){t.exports=function(n){return n.webpackPolyfill||(n.deprecate=function(){},n.paths=[],n.children||(n.children=[]),Object.defineProperty(n,"loaded",{enumerable:!0,get:function(){return n.l}}),Object.defineProperty(n,"id",{enumerable:!0,get:function(){return n.i}}),n.webpackPolyfill=1),n}},function(t,e){},function(t,e,n){function r(i){var o,s=n(6),a=n(7),l=n(8);i.onmessage=function(u){var c=u.data.command;switch(c){case"loadEncoder":var h,d=u.data,p=d.mimeType,f=d.wasmPath;switch(p){case"audio/wav":case"audio/wave":h=s;break;case"audio/webm":h=a;break;case"audio/ogg":h=l}var m={};f&&(m.locateFile=function(I,S){return I.match(/.wasm/)?f:S+I}),h(m).then(function(I){o=I,self.postMessage({command:"readyToInit"})});break;case"init":var E=u.data,A=E.sampleRate,_=E.channelCount,g=E.bitsPerSecond;o.init(A,_,g);break;case"pushInputData":for(var O=u.data,D=O.channelBuffers,R=(O.length,O.duration,0);R<D.length;R++)D[R]=new Float32Array(D[R].buffer);o.encode(D);break;case"getEncodedData":case"done":c==="done"&&o.close();var T=o.flush();self.postMessage({command:c==="done"?"lastEncodedData":"encodedData",buffers:T},T),c==="done"&&self.close()}}}typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&r(self),t.exports=r},function(t,e,n){function r(a,l){(l==null||l>a.length)&&(l=a.length);for(var u=0,c=new Array(l);u<l;u++)c[u]=a[u];return c}var i=n(1).writeString,o=Int16Array.BYTES_PER_ELEMENT,s=function(){function a(u,c,h){(function(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")})(this,a),this.config={inputSampleRate:u,channelCount:c},this.encodedBuffers=[]}var l;return(l=[{key:"encode",value:function(u){for(var c=u[0].length,h=new ArrayBuffer(c*o*this.config.channelCount),d=new DataView(h),p=0;p<this.config.channelCount;p++)for(var f=u[p],m=0;m<c;m++){var E=32767*f[m]|0;E>32767?E=32767:E<-32768&&(E=-32768);var A=(m*this.config.channelCount+p)*o;d.setInt16(A,0|E,!0)}this.encodedBuffers.push(h)}},{key:"getHeader",value:function(){var u=this.encodedBuffers.reduce(function(d,p){return d+p.byteLength},0),c=new ArrayBuffer(44),h=new DataView(c);return i(h,0,"RIFF"),h.setUint32(4,36+u,!0),i(h,8,"WAVE"),i(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,this.config.channelCount,!0),h.setUint32(24,this.config.inputSampleRate,!0),h.setUint32(28,this.config.inputSampleRate*o*this.config.channelCount,!0),h.setUint16(32,o*this.config.channelCount,!0),h.setUint16(34,8*o,!0),i(h,36,"data"),h.setUint32(40,u,!0),c}}])&&function(u,c){for(var h=0;h<c.length;h++){var d=c[h];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}(a.prototype,l),a}();t.exports=function(a){return new Promise(function(l,u){(a=a!==void 0&&a||{}).init=function(c,h,d){a.encoder=new s(c,h,d)},a.encode=function(c){a.encoder.encode(c)},a.flush=function(){var c=a.encoder.getHeader(),h=a.encoder.encodedBuffers.splice(0,a.encoder.encodedBuffers.length);return[c].concat(function(d){return function(p){if(Array.isArray(p))return r(p)}(d)||function(p){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(p))return Array.from(p)}(d)||function(p,f){if(p){if(typeof p=="string")return r(p,f);var m=Object.prototype.toString.call(p).slice(8,-1);return m==="Object"&&p.constructor&&(m=p.constructor.name),m==="Map"||m==="Set"?Array.from(p):m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m)?r(p,f):void 0}}(d)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
104
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}(h))},a.close=function(){},l(a)})}},function(t,e,n){(function(r,i,o,s){var a;function l(d){return(l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p})(d)}function u(d,p,f){return p&&function(m,E){for(var A=0;A<E.length;A++){var _=E[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}(d.prototype,p),d}var c,h=(c=(c=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0)||r,function(d){d=(d=d||{})!==void 0?d:{};var p=n(1).EmscriptenMemoryAllocator,f=48e3,m=function(){function C(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;(function(W,Y){if(!(W instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,C),this.config={inputSampleRate:N,channelCount:x},this.memory=new p(d),this._opus_encoder_create=d._opus_encoder_create,this._opus_encoder_ctl=d._opus_encoder_ctl,this._opus_encode_float=d._opus_encode_float,this._opus_encoder_destroy=d._opus_encoder_destroy,this._speex_resampler_init=d._speex_resampler_init,this._speex_resampler_process_interleaved_float=d._speex_resampler_process_interleaved_float,this._speex_resampler_destroy=d._speex_resampler_destroy,this._container=new d.Container,this._container.init(f,x,Math.floor(4294967295*Math.random())),this.OpusInitCodec(f,x,$),this.SpeexInitResampler(N,f,x),this.inputSamplesPerChannel=20*N/1e3,this.outputSamplePerChannel=960,this.inputBufferIndex=0,this.mInputBuffer=this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel*x),this.mResampledBuffer=this.memory.mallocFloat32Buffer(this.outputSamplePerChannel*x),this.mOutputBuffer=this.memory.mallocUint8Buffer(4e3),this.interleavedBuffers=x!==1?new Float32Array(4096*x):void 0}return u(C,[{key:"encode",value:function(N){for(var x=this.interleave(N),$=0;$<x.length;){var W=Math.min(this.mInputBuffer.length-this.inputBufferIndex,x.length-$);if(this.mInputBuffer.set(x.subarray($,$+W),this.inputBufferIndex),this.inputBufferIndex+=W,this.inputBufferIndex>=this.mInputBuffer.length){var Y=this.memory.mallocUint32(this.inputSamplesPerChannel),ne=this.memory.mallocUint32(this.outputSamplePerChannel),Re=this._speex_resampler_process_interleaved_float(this.resampler,this.mInputBuffer.pointer,Y.pointer,this.mResampledBuffer.pointer,ne.pointer);if(Y.free(),ne.free(),Re!==0)throw new Error("Resampling error.");var Me=this._opus_encode_float(this.encoder,this.mResampledBuffer.pointer,this.outputSamplePerChannel,this.mOutputBuffer.pointer,this.mOutputBuffer.length);if(Me<0)throw new Error("Opus encoding error.");this._container.writeFrame(this.mOutputBuffer.pointer,Me,this.outputSamplePerChannel),this.inputBufferIndex=0}$+=W}}},{key:"close",value:function(){for(var N=this.config.channelCount,x=[],$=0;$<N;++$)x.push(new Float32Array(4096-this.inputBufferIndex/N));this.encode(x),d.destroy(this._container),this.mInputBuffer.free(),this.mResampledBuffer.free(),this.mOutputBuffer.free(),this._opus_encoder_destroy(this.encoder),this._speex_resampler_destroy(this.resampler)}},{key:"interleave",value:function(N){var x=N.length;if(x===1)return N[0];for(var $=0;$<x;$++)for(var W=N[$],Y=0;Y<W.length;Y++)this.interleavedBuffers[Y*x+$]=W[Y];return this.interleavedBuffers}},{key:"OpusInitCodec",value:function(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,W=this.memory.mallocUint32(void 0);this.encoder=this._opus_encoder_create(N,x,2049,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Opus encodor initialization failed.");$&&this.OpusSetOpusControl(4002,$)}},{key:"OpusSetOpusControl",value:function(N,x){var $=this.memory.mallocInt32(x);this._opus_encoder_ctl(this.encoder,N,$.pointer),$.free()}},{key:"SpeexInitResampler",value:function(N,x,$){var W=this.memory.mallocUint32(void 0);this.resampler=this._speex_resampler_init($,N,x,6,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Initializing resampler failed.")}}]),C}();d.init=function(C,N,x){d.encodedBuffers=[],d.encoder=new m(C,N,x)},d.encode=function(C){d.encoder.encode(C)},d.flush=function(){return d.encodedBuffers.splice(0,d.encodedBuffers.length)},d.close=function(){d.encoder.close()};var E,A,_,g,O,D={};for(E in d)d.hasOwnProperty(E)&&(D[E]=d[E]);A=(typeof window=="undefined"?"undefined":l(window))==="object",_=typeof importScripts=="function",g=(i===void 0?"undefined":l(i))==="object"&&l(i.versions)==="object"&&typeof i.versions.node=="string",O=!A&&!g&&!_;var R,T,I,S,v="";g?(v=_?n(0).dirname(v)+"/":o+"/",R=function(C,N){return I||(I=n(4)),S||(S=n(0)),C=S.normalize(C),I.readFileSync(C,N?null:"utf8")},T=function(C){var N=R(C,!0);return N.buffer||(N=new Uint8Array(N)),F(N.buffer),N},i.argv.length>1&&i.argv[1].replace(/\\/g,"/"),i.argv.slice(2),i.on("uncaughtException",function(C){if(!(C instanceof Er))throw C}),i.on("unhandledRejection",we),d.inspect=function(){return"[Emscripten Module object]"}):O?(typeof read!="undefined"&&(R=function(C){return read(C)}),T=function(C){var N;return typeof readbuffer=="function"?new Uint8Array(readbuffer(C)):(F(l(N=read(C,"binary"))==="object"),N)},typeof scriptArgs!="undefined"&&scriptArgs,typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||_)&&(_?v=self.location.href:document.currentScript&&(v=document.currentScript.src),c&&(v=c),v=v.indexOf("blob:")!==0?v.substr(0,v.lastIndexOf("/")+1):"",R=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.send(null),N.responseText},_&&(T=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var y,b,M=d.print||console.log.bind(console),k=d.printErr||console.warn.bind(console);for(E in D)D.hasOwnProperty(E)&&(d[E]=D[E]);D=null,d.arguments&&d.arguments,d.thisProgram&&d.thisProgram,d.quit&&d.quit,d.wasmBinary&&(y=d.wasmBinary),d.noExitRuntime&&d.noExitRuntime,(typeof WebAssembly=="undefined"?"undefined":l(WebAssembly))!=="object"&&k("no native wasm support detected");var P=new WebAssembly.Table({initial:60,maximum:60,element:"anyfunc"}),B=!1;function F(C,N){C||we("Assertion failed: "+N)}var V,G,z,K=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function _e(C,N,x){for(var $=N+x,W=N;C[W]&&!(W>=$);)++W;if(W-N>16&&C.subarray&&K)return K.decode(C.subarray(N,W));for(var Y="";N<W;){var ne=C[N++];if(128&ne){var Re=63&C[N++];if((224&ne)!=192){var Me=63&C[N++];if((ne=(240&ne)==224?(15&ne)<<12|Re<<6|Me:(7&ne)<<18|Re<<12|Me<<6|63&C[N++])<65536)Y+=String.fromCharCode(ne);else{var In=ne-65536;Y+=String.fromCharCode(55296|In>>10,56320|1023&In)}}else Y+=String.fromCharCode((31&ne)<<6|Re)}else Y+=String.fromCharCode(ne)}return Y}function ie(C,N){return C?_e(G,C,N):""}typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");var ue=d.INITIAL_MEMORY||16777216;function le(C){for(;C.length>0;){var N=C.shift();if(typeof N!="function"){var x=N.func;typeof x=="number"?N.arg===void 0?d.dynCall_v(x):d.dynCall_vi(x,N.arg):x(N.arg===void 0?null:N.arg)}else N()}}(b=d.wasmMemory?d.wasmMemory:new WebAssembly.Memory({initial:ue/65536,maximum:ue/65536}))&&(V=b.buffer),ue=V.byteLength,function(C){V=C,d.HEAP8=new Int8Array(C),d.HEAP16=new Int16Array(C),d.HEAP32=z=new Int32Array(C),d.HEAPU8=G=new Uint8Array(C),d.HEAPU16=new Uint16Array(C),d.HEAPU32=new Uint32Array(C),d.HEAPF32=new Float32Array(C),d.HEAPF64=new Float64Array(C)}(V),z[11496]=5289024;var Ie=[],$t=[],rt=[],ye=[];function Ke(C){Ie.unshift(C)}function Jt(C){ye.unshift(C)}var ve=0,qe=null;function we(C){throw d.onAbort&&d.onAbort(C),M(C+=""),k(C),B=!0,C="abort("+C+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(C)}d.preloadedImages={},d.preloadedAudios={};var dr="data:application/octet-stream;base64,";function Rn(C){return String.prototype.startsWith?C.startsWith(dr):C.indexOf(dr)===0}var Ge="WebMOpusEncoder.wasm";function rn(){try{if(y)return new Uint8Array(y);if(T)return T(Ge);throw"both async and sync fetching of the wasm failed"}catch(C){we(C)}}Rn(Ge)||(Ge=function(C){return d.locateFile?d.locateFile(C,v):v+C}(Ge)),$t.push({func:function(){hr()}});var Je={mappings:{},buffers:[null,[],[]],printChar:function(C,N){var x=Je.buffers[C];N===0||N===10?((C===1?M:k)(_e(x,0)),x.length=0):x.push(N)},varargs:void 0,get:function(){return Je.varargs+=4,z[Je.varargs-4>>2]},getStr:function(C){return ie(C)},get64:function(C,N){return C}},Fi={a:function(C,N,x,$){we("Assertion failed: "+ie(C)+", at: "+[N?ie(N):"unknown filename",x,$?ie($):"unknown function"])},e:function(C,N,x){return Je.varargs=x,0},h:function(C,N,x){Je.varargs=x},g:function(C,N,x){return Je.varargs=x,0},b:function(){we()},m:function(C,N){var x=new Uint8Array(d.HEAPU8.buffer,C,N);d.encodedBuffers.push(new Uint8Array(x).buffer)},k:function(C,N,x){G.copyWithin(C,N,N+x)},l:function(C){we("OOM")},c:function(C){return 0},f:function(C,N,x,$){var W=Je.getStreamFromFD(C),Y=Je.doReadv(W,N,x);return z[$>>2]=Y,0},j:function(C,N,x,$,W){},d:function(C,N,x,$){for(var W=0,Y=0;Y<x;Y++){for(var ne=z[N+8*Y>>2],Re=z[N+(8*Y+4)>>2],Me=0;Me<Re;Me++)Je.printChar(C,G[ne+Me]);W+=Re}return z[$>>2]=W,0},memory:b,table:P,i:function(C){var N=Date.now()/1e3|0;return C&&(z[C>>2]=N),N}},on=function(){var C={a:Fi};function N(W,Y){var ne=W.exports;d.asm=ne,function(){if(ve--,d.monitorRunDependencies&&d.monitorRunDependencies(ve),ve==0&&qe){var Re=qe;qe=null,Re()}}()}function x(W){N(W.instance)}function $(W){return(y||!A&&!_||typeof fetch!="function"?new Promise(function(Y,ne){Y(rn())}):fetch(Ge,{credentials:"same-origin"}).then(function(Y){if(!Y.ok)throw"failed to load wasm binary file at '"+Ge+"'";return Y.arrayBuffer()}).catch(function(){return rn()})).then(function(Y){return WebAssembly.instantiate(Y,C)}).then(W,function(Y){k("failed to asynchronously prepare wasm: "+Y),we(Y)})}if(ve++,d.monitorRunDependencies&&d.monitorRunDependencies(ve),d.instantiateWasm)try{return d.instantiateWasm(C,N)}catch(W){return k("Module.instantiateWasm callback failed with error: "+W),!1}return function(){if(y||typeof WebAssembly.instantiateStreaming!="function"||Rn(Ge)||typeof fetch!="function")return $(x);fetch(Ge,{credentials:"same-origin"}).then(function(W){return WebAssembly.instantiateStreaming(W,C).then(x,function(Y){k("wasm streaming compile failed: "+Y),k("falling back to ArrayBuffer instantiation"),$(x)})})}(),{}}();d.asm=on;var Rt,hr=d.___wasm_call_ctors=function(){return(hr=d.___wasm_call_ctors=d.asm.n).apply(null,arguments)},pr=(d.___em_js__emscriptenPushBuffer=function(){return(d.___em_js__emscriptenPushBuffer=d.asm.o).apply(null,arguments)},d._emscripten_bind_VoidPtr___destroy___0=function(){return(pr=d._emscripten_bind_VoidPtr___destroy___0=d.asm.p).apply(null,arguments)}),Vn=d._emscripten_bind_Container_Container_0=function(){return(Vn=d._emscripten_bind_Container_Container_0=d.asm.q).apply(null,arguments)},fr=d._emscripten_bind_Container_init_3=function(){return(fr=d._emscripten_bind_Container_init_3=d.asm.r).apply(null,arguments)},mr=d._emscripten_bind_Container_writeFrame_3=function(){return(mr=d._emscripten_bind_Container_writeFrame_3=d.asm.s).apply(null,arguments)},sn=d._emscripten_bind_Container___destroy___0=function(){return(sn=d._emscripten_bind_Container___destroy___0=d.asm.t).apply(null,arguments)};function Er(C){this.name="ExitStatus",this.message="Program terminated with exit("+C+")",this.status=C}function an(C){function N(){Rt||(Rt=!0,d.calledRun=!0,B||(le($t),le(rt),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)Jt(d.postRun.shift());le(ye)}()))}ve>0||(function(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ke(d.preRun.shift());le(Ie)}(),ve>0||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),N()},1)):N()))}if(d._opus_encoder_create=function(){return(d._opus_encoder_create=d.asm.u).apply(null,arguments)},d._opus_encode_float=function(){return(d._opus_encode_float=d.asm.v).apply(null,arguments)},d._opus_encoder_ctl=function(){return(d._opus_encoder_ctl=d.asm.w).apply(null,arguments)},d._opus_encoder_destroy=function(){return(d._opus_encoder_destroy=d.asm.x).apply(null,arguments)},d._speex_resampler_init=function(){return(d._speex_resampler_init=d.asm.y).apply(null,arguments)},d._speex_resampler_destroy=function(){return(d._speex_resampler_destroy=d.asm.z).apply(null,arguments)},d._speex_resampler_process_interleaved_float=function(){return(d._speex_resampler_process_interleaved_float=d.asm.A).apply(null,arguments)},d._free=function(){return(d._free=d.asm.B).apply(null,arguments)},d._malloc=function(){return(d._malloc=d.asm.C).apply(null,arguments)},d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.D).apply(null,arguments)},d.dynCall_v=function(){return(d.dynCall_v=d.asm.E).apply(null,arguments)},d.asm=on,d.then=function(C){if(Rt)C(d);else{var N=d.onRuntimeInitialized;d.onRuntimeInitialized=function(){N&&N(),C(d)}}return d},qe=function C(){Rt||an(),Rt||(qe=C)},d.run=an,d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();function Se(){}function kt(C){return(C||Se).__cache__}function Cn(C,N){var x=kt(N),$=x[C];return $||(($=Object.create((N||Se).prototype)).ptr=C,x[C]=$)}function Te(){throw"cannot construct a VoidPtr, no constructor in IDL"}function pe(){this.ptr=Vn(),kt(pe)[this.ptr]=this}return an(),Se.prototype=Object.create(Se.prototype),Se.prototype.constructor=Se,Se.prototype.__class__=Se,Se.__cache__={},d.WrapperObject=Se,d.getCache=kt,d.wrapPointer=Cn,d.castObject=function(C,N){return Cn(C.ptr,N)},d.NULL=Cn(0),d.destroy=function(C){if(!C.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";C.__destroy__(),delete kt(C.__class__)[C.ptr]},d.compare=function(C,N){return C.ptr===N.ptr},d.getPointer=function(C){return C.ptr},d.getClass=function(C){return C.__class__},Te.prototype=Object.create(Se.prototype),Te.prototype.constructor=Te,Te.prototype.__class__=Te,Te.__cache__={},d.VoidPtr=Te,Te.prototype.__destroy__=Te.prototype.__destroy__=function(){var C=this.ptr;pr(C)},pe.prototype=Object.create(Se.prototype),pe.prototype.constructor=pe,pe.prototype.__class__=pe,pe.__cache__={},d.Container=pe,pe.prototype.init=pe.prototype.init=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),fr($,C,N,x)},pe.prototype.writeFrame=pe.prototype.writeFrame=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),mr($,C,N,x)},pe.prototype.__destroy__=pe.prototype.__destroy__=function(){var C=this.ptr;sn(C)},d});l(e)==="object"&&l(s)==="object"?s.exports=h:(a=function(){return h}.apply(e,[]))===void 0||(s.exports=a)}).call(this,"/index.js",n(2),"/",n(3)(t))},function(t,e,n){(function(r,i,o,s){var a;function l(d){return(l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p})(d)}function u(d,p,f){return p&&function(m,E){for(var A=0;A<E.length;A++){var _=E[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}(d.prototype,p),d}var c,h=(c=(c=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0)||r,function(d){d=(d=d||{})!==void 0?d:{};var p=n(1).EmscriptenMemoryAllocator,f=48e3,m=function(){function C(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;(function(W,Y){if(!(W instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,C),this.config={inputSampleRate:N,channelCount:x},this.memory=new p(d),this._opus_encoder_create=d._opus_encoder_create,this._opus_encoder_ctl=d._opus_encoder_ctl,this._opus_encode_float=d._opus_encode_float,this._opus_encoder_destroy=d._opus_encoder_destroy,this._speex_resampler_init=d._speex_resampler_init,this._speex_resampler_process_interleaved_float=d._speex_resampler_process_interleaved_float,this._speex_resampler_destroy=d._speex_resampler_destroy,this._container=new d.Container,this._container.init(f,x,Math.floor(4294967295*Math.random())),this.OpusInitCodec(f,x,$),this.SpeexInitResampler(N,f,x),this.inputSamplesPerChannel=20*N/1e3,this.outputSamplePerChannel=960,this.inputBufferIndex=0,this.mInputBuffer=this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel*x),this.mResampledBuffer=this.memory.mallocFloat32Buffer(this.outputSamplePerChannel*x),this.mOutputBuffer=this.memory.mallocUint8Buffer(4e3),this.interleavedBuffers=x!==1?new Float32Array(4096*x):void 0}return u(C,[{key:"encode",value:function(N){for(var x=this.interleave(N),$=0;$<x.length;){var W=Math.min(this.mInputBuffer.length-this.inputBufferIndex,x.length-$);if(this.mInputBuffer.set(x.subarray($,$+W),this.inputBufferIndex),this.inputBufferIndex+=W,this.inputBufferIndex>=this.mInputBuffer.length){var Y=this.memory.mallocUint32(this.inputSamplesPerChannel),ne=this.memory.mallocUint32(this.outputSamplePerChannel),Re=this._speex_resampler_process_interleaved_float(this.resampler,this.mInputBuffer.pointer,Y.pointer,this.mResampledBuffer.pointer,ne.pointer);if(Y.free(),ne.free(),Re!==0)throw new Error("Resampling error.");var Me=this._opus_encode_float(this.encoder,this.mResampledBuffer.pointer,this.outputSamplePerChannel,this.mOutputBuffer.pointer,this.mOutputBuffer.length);if(Me<0)throw new Error("Opus encoding error.");this._container.writeFrame(this.mOutputBuffer.pointer,Me,this.outputSamplePerChannel),this.inputBufferIndex=0}$+=W}}},{key:"close",value:function(){for(var N=this.config.channelCount,x=[],$=0;$<N;++$)x.push(new Float32Array(4096-this.inputBufferIndex/N));this.encode(x),d.destroy(this._container),this.mInputBuffer.free(),this.mResampledBuffer.free(),this.mOutputBuffer.free(),this._opus_encoder_destroy(this.encoder),this._speex_resampler_destroy(this.resampler)}},{key:"interleave",value:function(N){var x=N.length;if(x===1)return N[0];for(var $=0;$<x;$++)for(var W=N[$],Y=0;Y<W.length;Y++)this.interleavedBuffers[Y*x+$]=W[Y];return this.interleavedBuffers}},{key:"OpusInitCodec",value:function(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,W=this.memory.mallocUint32(void 0);this.encoder=this._opus_encoder_create(N,x,2049,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Opus encodor initialization failed.");$&&this.OpusSetOpusControl(4002,$)}},{key:"OpusSetOpusControl",value:function(N,x){var $=this.memory.mallocInt32(x);this._opus_encoder_ctl(this.encoder,N,$.pointer),$.free()}},{key:"SpeexInitResampler",value:function(N,x,$){var W=this.memory.mallocUint32(void 0);this.resampler=this._speex_resampler_init($,N,x,6,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Initializing resampler failed.")}}]),C}();d.init=function(C,N,x){d.encodedBuffers=[],d.encoder=new m(C,N,x)},d.encode=function(C){d.encoder.encode(C)},d.flush=function(){return d.encodedBuffers.splice(0,d.encodedBuffers.length)},d.close=function(){d.encoder.close()};var E,A,_,g,O,D={};for(E in d)d.hasOwnProperty(E)&&(D[E]=d[E]);A=(typeof window=="undefined"?"undefined":l(window))==="object",_=typeof importScripts=="function",g=(i===void 0?"undefined":l(i))==="object"&&l(i.versions)==="object"&&typeof i.versions.node=="string",O=!A&&!g&&!_;var R,T,I,S,v="";g?(v=_?n(0).dirname(v)+"/":o+"/",R=function(C,N){return I||(I=n(4)),S||(S=n(0)),C=S.normalize(C),I.readFileSync(C,N?null:"utf8")},T=function(C){var N=R(C,!0);return N.buffer||(N=new Uint8Array(N)),F(N.buffer),N},i.argv.length>1&&i.argv[1].replace(/\\/g,"/"),i.argv.slice(2),i.on("uncaughtException",function(C){if(!(C instanceof Er))throw C}),i.on("unhandledRejection",we),d.inspect=function(){return"[Emscripten Module object]"}):O?(typeof read!="undefined"&&(R=function(C){return read(C)}),T=function(C){var N;return typeof readbuffer=="function"?new Uint8Array(readbuffer(C)):(F(l(N=read(C,"binary"))==="object"),N)},typeof scriptArgs!="undefined"&&scriptArgs,typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||_)&&(_?v=self.location.href:document.currentScript&&(v=document.currentScript.src),c&&(v=c),v=v.indexOf("blob:")!==0?v.substr(0,v.lastIndexOf("/")+1):"",R=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.send(null),N.responseText},_&&(T=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var y,b,M=d.print||console.log.bind(console),k=d.printErr||console.warn.bind(console);for(E in D)D.hasOwnProperty(E)&&(d[E]=D[E]);D=null,d.arguments&&d.arguments,d.thisProgram&&d.thisProgram,d.quit&&d.quit,d.wasmBinary&&(y=d.wasmBinary),d.noExitRuntime&&d.noExitRuntime,(typeof WebAssembly=="undefined"?"undefined":l(WebAssembly))!=="object"&&k("no native wasm support detected");var P=new WebAssembly.Table({initial:36,maximum:36,element:"anyfunc"}),B=!1;function F(C,N){C||we("Assertion failed: "+N)}var V,G,z,K=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function _e(C,N,x){for(var $=N+x,W=N;C[W]&&!(W>=$);)++W;if(W-N>16&&C.subarray&&K)return K.decode(C.subarray(N,W));for(var Y="";N<W;){var ne=C[N++];if(128&ne){var Re=63&C[N++];if((224&ne)!=192){var Me=63&C[N++];if((ne=(240&ne)==224?(15&ne)<<12|Re<<6|Me:(7&ne)<<18|Re<<12|Me<<6|63&C[N++])<65536)Y+=String.fromCharCode(ne);else{var In=ne-65536;Y+=String.fromCharCode(55296|In>>10,56320|1023&In)}}else Y+=String.fromCharCode((31&ne)<<6|Re)}else Y+=String.fromCharCode(ne)}return Y}function ie(C,N){return C?_e(G,C,N):""}typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");var ue=d.INITIAL_MEMORY||16777216;function le(C){for(;C.length>0;){var N=C.shift();if(typeof N!="function"){var x=N.func;typeof x=="number"?N.arg===void 0?d.dynCall_v(x):d.dynCall_vi(x,N.arg):x(N.arg===void 0?null:N.arg)}else N()}}(b=d.wasmMemory?d.wasmMemory:new WebAssembly.Memory({initial:ue/65536,maximum:ue/65536}))&&(V=b.buffer),ue=V.byteLength,function(C){V=C,d.HEAP8=new Int8Array(C),d.HEAP16=new Int16Array(C),d.HEAP32=z=new Int32Array(C),d.HEAPU8=G=new Uint8Array(C),d.HEAPU16=new Uint16Array(C),d.HEAPU32=new Uint32Array(C),d.HEAPF32=new Float32Array(C),d.HEAPF64=new Float64Array(C)}(V),z[11672]=5289728;var Ie=[],$t=[],rt=[],ye=[];function Ke(C){Ie.unshift(C)}function Jt(C){ye.unshift(C)}var ve=0,qe=null;function we(C){throw d.onAbort&&d.onAbort(C),M(C+=""),k(C),B=!0,C="abort("+C+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(C)}d.preloadedImages={},d.preloadedAudios={};var dr="data:application/octet-stream;base64,";function Rn(C){return String.prototype.startsWith?C.startsWith(dr):C.indexOf(dr)===0}var Ge="OggOpusEncoder.wasm";function rn(){try{if(y)return new Uint8Array(y);if(T)return T(Ge);throw"both async and sync fetching of the wasm failed"}catch(C){we(C)}}Rn(Ge)||(Ge=function(C){return d.locateFile?d.locateFile(C,v):v+C}(Ge)),$t.push({func:function(){hr()}});var Je={mappings:{},buffers:[null,[],[]],printChar:function(C,N){var x=Je.buffers[C];N===0||N===10?((C===1?M:k)(_e(x,0)),x.length=0):x.push(N)},varargs:void 0,get:function(){return Je.varargs+=4,z[Je.varargs-4>>2]},getStr:function(C){return ie(C)},get64:function(C,N){return C}},Fi={a:function(C,N,x,$){we("Assertion failed: "+ie(C)+", at: "+[N?ie(N):"unknown filename",x,$?ie($):"unknown function"])},c:function(){we()},d:function(C,N){var x=new Uint8Array(d.HEAPU8.buffer,C,N);d.encodedBuffers.push(new Uint8Array(x).buffer)},f:function(C,N,x){G.copyWithin(C,N,N+x)},g:function(C){we("OOM")},h:function(C){return 0},e:function(C,N,x,$,W){},b:function(C,N,x,$){for(var W=0,Y=0;Y<x;Y++){for(var ne=z[N+8*Y>>2],Re=z[N+(8*Y+4)>>2],Me=0;Me<Re;Me++)Je.printChar(C,G[ne+Me]);W+=Re}return z[$>>2]=W,0},memory:b,table:P},on=function(){var C={a:Fi};function N(W,Y){var ne=W.exports;d.asm=ne,function(){if(ve--,d.monitorRunDependencies&&d.monitorRunDependencies(ve),ve==0&&qe){var Re=qe;qe=null,Re()}}()}function x(W){N(W.instance)}function $(W){return(y||!A&&!_||typeof fetch!="function"?new Promise(function(Y,ne){Y(rn())}):fetch(Ge,{credentials:"same-origin"}).then(function(Y){if(!Y.ok)throw"failed to load wasm binary file at '"+Ge+"'";return Y.arrayBuffer()}).catch(function(){return rn()})).then(function(Y){return WebAssembly.instantiate(Y,C)}).then(W,function(Y){k("failed to asynchronously prepare wasm: "+Y),we(Y)})}if(ve++,d.monitorRunDependencies&&d.monitorRunDependencies(ve),d.instantiateWasm)try{return d.instantiateWasm(C,N)}catch(W){return k("Module.instantiateWasm callback failed with error: "+W),!1}return function(){if(y||typeof WebAssembly.instantiateStreaming!="function"||Rn(Ge)||typeof fetch!="function")return $(x);fetch(Ge,{credentials:"same-origin"}).then(function(W){return WebAssembly.instantiateStreaming(W,C).then(x,function(Y){k("wasm streaming compile failed: "+Y),k("falling back to ArrayBuffer instantiation"),$(x)})})}(),{}}();d.asm=on;var Rt,hr=d.___wasm_call_ctors=function(){return(hr=d.___wasm_call_ctors=d.asm.i).apply(null,arguments)},pr=(d.___em_js__emscriptenPushBuffer=function(){return(d.___em_js__emscriptenPushBuffer=d.asm.j).apply(null,arguments)},d._emscripten_bind_VoidPtr___destroy___0=function(){return(pr=d._emscripten_bind_VoidPtr___destroy___0=d.asm.k).apply(null,arguments)}),Vn=d._emscripten_bind_Container_Container_0=function(){return(Vn=d._emscripten_bind_Container_Container_0=d.asm.l).apply(null,arguments)},fr=d._emscripten_bind_Container_init_3=function(){return(fr=d._emscripten_bind_Container_init_3=d.asm.m).apply(null,arguments)},mr=d._emscripten_bind_Container_writeFrame_3=function(){return(mr=d._emscripten_bind_Container_writeFrame_3=d.asm.n).apply(null,arguments)},sn=d._emscripten_bind_Container___destroy___0=function(){return(sn=d._emscripten_bind_Container___destroy___0=d.asm.o).apply(null,arguments)};function Er(C){this.name="ExitStatus",this.message="Program terminated with exit("+C+")",this.status=C}function an(C){function N(){Rt||(Rt=!0,d.calledRun=!0,B||(le($t),le(rt),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)Jt(d.postRun.shift());le(ye)}()))}ve>0||(function(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ke(d.preRun.shift());le(Ie)}(),ve>0||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),N()},1)):N()))}if(d._opus_encoder_create=function(){return(d._opus_encoder_create=d.asm.p).apply(null,arguments)},d._opus_encode_float=function(){return(d._opus_encode_float=d.asm.q).apply(null,arguments)},d._opus_encoder_ctl=function(){return(d._opus_encoder_ctl=d.asm.r).apply(null,arguments)},d._opus_encoder_destroy=function(){return(d._opus_encoder_destroy=d.asm.s).apply(null,arguments)},d._malloc=function(){return(d._malloc=d.asm.t).apply(null,arguments)},d._free=function(){return(d._free=d.asm.u).apply(null,arguments)},d._speex_resampler_init=function(){return(d._speex_resampler_init=d.asm.v).apply(null,arguments)},d._speex_resampler_destroy=function(){return(d._speex_resampler_destroy=d.asm.w).apply(null,arguments)},d._speex_resampler_process_interleaved_float=function(){return(d._speex_resampler_process_interleaved_float=d.asm.x).apply(null,arguments)},d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.y).apply(null,arguments)},d.dynCall_v=function(){return(d.dynCall_v=d.asm.z).apply(null,arguments)},d.asm=on,d.then=function(C){if(Rt)C(d);else{var N=d.onRuntimeInitialized;d.onRuntimeInitialized=function(){N&&N(),C(d)}}return d},qe=function C(){Rt||an(),Rt||(qe=C)},d.run=an,d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();function Se(){}function kt(C){return(C||Se).__cache__}function Cn(C,N){var x=kt(N),$=x[C];return $||(($=Object.create((N||Se).prototype)).ptr=C,x[C]=$)}function Te(){throw"cannot construct a VoidPtr, no constructor in IDL"}function pe(){this.ptr=Vn(),kt(pe)[this.ptr]=this}return an(),Se.prototype=Object.create(Se.prototype),Se.prototype.constructor=Se,Se.prototype.__class__=Se,Se.__cache__={},d.WrapperObject=Se,d.getCache=kt,d.wrapPointer=Cn,d.castObject=function(C,N){return Cn(C.ptr,N)},d.NULL=Cn(0),d.destroy=function(C){if(!C.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";C.__destroy__(),delete kt(C.__class__)[C.ptr]},d.compare=function(C,N){return C.ptr===N.ptr},d.getPointer=function(C){return C.ptr},d.getClass=function(C){return C.__class__},Te.prototype=Object.create(Se.prototype),Te.prototype.constructor=Te,Te.prototype.__class__=Te,Te.__cache__={},d.VoidPtr=Te,Te.prototype.__destroy__=Te.prototype.__destroy__=function(){var C=this.ptr;pr(C)},pe.prototype=Object.create(Se.prototype),pe.prototype.constructor=pe,pe.prototype.__class__=pe,pe.__cache__={},d.Container=pe,pe.prototype.init=pe.prototype.init=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),fr($,C,N,x)},pe.prototype.writeFrame=pe.prototype.writeFrame=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),mr($,C,N,x)},pe.prototype.__destroy__=pe.prototype.__destroy__=function(){var C=this.ptr;sn(C)},d});l(e)==="object"&&l(s)==="object"?s.exports=h:(a=function(){return h}.apply(e,[]))===void 0||(s.exports=a)}).call(this,"/index.js",n(2),"/",n(3)(t))}])}},typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope?yl()():nf.exports=yl();const hT=tu(RA.exports);let CA;const Ts="audio/webm;codecs=opus";function pT(t){const e=Q(),n=Q(),r=Q(),i=Q(!1),o=t.mediaRecorder;Z(()=>{t.recordingState==="recording"?s():o.current&&t.recordingState===null&&(i.current=!0,o.current.stop())},[t.recordingState]);const s=async()=>{var l;n.current=Hu.create({scrollingWaveform:!0,scrollingWaveformWindow:10}),e.current=DA({...t.wavesurferOptions,interact:!1,barHeight:(l=t.wavesurferOptions.barHeight)!=null?l:4,plugins:[n.current],container:t.wavesurferContainer.current});const a=await n.current.startMic();MediaRecorder&&MediaRecorder.isTypeSupported(Ts)?o.current=new MediaRecorder(a,{mimeType:Ts}):typeof window!="undefined"&&(o.current=new dT(a,{mimeType:Ts},{encoderWorkerFactory:()=>new hT,WebMOpusEncoderWasmPath:CA})),o.current.onstart=()=>r.current=Date.now(),o.current.ondataavailable=u=>{var c;if(!i.current){const h=Date.now(),d=Math.floor((h-r.current)/1e3),p=new File([u.data],`talkjs_audio_message_${h}_${d}.webm`,{type:"audio/webm"});t.onSendRecording(p,d)}i.current=!1,o.current=void 0,(c=e.current)==null||c.destroy(),e.current=void 0,n.current=void 0},o.current.start()};return null}function IA(t){const e=nt(),n=he(),r=nn(),i=te(n.referencedMessage$),o=te(n.state$.userPermissions),s=xo(),{sendMessage:a}=Wg(),{voiceRecorder:l,recordVoiceMessage:u,voiceRecorderControlsProps:c}=function(){const p=he(),f=Yr(),m=vt({...Cl}),{state:E,duration:A,recordingUrl:_,uploadState:g,fileToken:O}=te(m),D=Q(void 0),R=Q(null),T=Q(),I=ee(()=>{m.assign({state:"recording",duration:0}),T.current=setInterval(()=>{m.duration.set(M=>M+1)},1e3)},[m]),S=ee(()=>{var M;T.current&&(clearInterval(T.current),T.current=void 0),(M=D.current)==null||M.stop()},[]),v=ee(()=>{T.current&&(clearInterval(T.current),T.current=void 0),m.assign(Cl)},[m]),y=ee((M,k)=>{const P=URL.createObjectURL(new Blob([M])),B=M.size+","+M.name;p.state$.localFileBlobUrls.child(p.state$.currentConversationId.peek()).child(B).set({url:P,fetching:!1});const F={duration:k,filename:M.name};p.latestFileUpload={type:"voice",file:M,metadata:F,temporaryBlobUrl:P},m.assign({state:"previewing",uploadState:"pending",recordingUrl:P+"?name="+M.name}),f.uploadVoice(M,F).then(V=>{m.assign({uploadState:"done",fileToken:V})})},[f,m,p]),b=ee(()=>{O&&f.sendFileMessage({fileToken:O}),m.assign(Cl)},[f,O,m]);return{voiceRecorder:se(()=>{if(!E)return;const M={state:E,duration:A,recordingUrl:_,uploadState:g,stop:S,cancel:v,send:b};return fA.set(M,R),M},[E,A,_,g,S,v,b]),recordVoiceMessage:I,voiceRecorderControlsProps:se(()=>({onSendRecording:y,recordingState:E,mediaRecorder:D,wavesurferOptions:tT,wavesurferContainer:R}),[y,E])}}(),h=te(vt(()=>{const p=s.state$.get();return t.editMessageId===void 0?new Bd(p,a,t.attachFile,t.shareLocation,s.toggleEmojiPicker,u):new Bd(p,t.onEditMessage,()=>{},()=>{},()=>{},()=>{})},[s.state$,s.toggleEmojiPicker,t.attachFile,t.editMessageId,t.onEditMessage,t.shareLocation,a])),d=ee(p=>s.setText(p),[s]);return function({appId:p,conversationId:f,meId:m,setText:E,enabled:A}){const _=se(()=>g_(f,m,p),[p,f,m]);Z(()=>{var O;if(!_||!A)return;const g=(O=JSON.parse(At.getItem(pc)||"{}")[_])!=null?O:"";E(g)},[_,A,E])}({appId:r.app.id,conversationId:r.conversation.id,meId:r.currentUser.id,setText:d,enabled:!t.editMessageId}),L(Fm.Provider,{value:{onClose:()=>s.toggleEmojiPicker(!1),onEmojiSelected:p=>s.selectEmoji(p)},children:[L(pT,{...c}),L(e.MessageField,{common:r,referencedMessage:i,permissions:o,editor:h,voiceRecorder:l,editMessageId:t.editMessageId})]})}function fT({message:t}){const e=he(),n=Yr(),r=te(e.state$.editingMessageId),i=se(()=>cn(t.content[0].children),[t]),o=vt({isEmpty:i.length===0,atTextLimit:!1,characterCount:i.length,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0}),s=se(()=>new A_(o,e.device$,e.state$.userPermissions),[o,e]),a=ee(async()=>{const l=s.state$;if(l.isEmpty.peek()||l.atTextLimit.peek())return;const u=s.getText();u&&await n.editMessage(t.id,{text:u}),e.state$.editingMessageId.set(null)},[e,n,s,t.id]);return Z(()=>{s.onEnter=a},[s,a]),Z(()=>{s.focus(),s.setText(cn(t.content[0].children,!0))},[s,t]),L(km.Provider,{value:s,children:L(IA,{editMessageId:r,onEditMessage:a})})}function mT(t){const e=nt(),n=nn();return L(e.MessageDivider,{common:n,...t})}function ET({message:t}){const e=nt(),n=he(),r=te(()=>n.messagePermissions$(t)),i=nn(),[o,s]=ae("sent");return Eo(a=>{if(t.id.startsWith("ephemeral-"))return s("sending");const l=n.state$.currentConversation.everyoneReadUntil.get();return l!==void 0?t.createdAt<=l?s("everyoneRead"):s("sent"):void 0}),L(e.Message,{common:i,message:t,messageStatus:o,permissions:r})}function _T(){const t=nt(),e=nn();return L(t.BeforeMessages,{common:e})}function AT(){const t=nt(),e=nn();return L(t.AfterMessages,{common:e})}function gT(t){const e=he(),n=Mi();Z(()=>function(r,i,o){const s=r.state$.currentConversation;let a=!1;function l(){if(!a){const E=r.state$.currentConversationId.peek();de.defined(E),i.conversation(E).markAsRead()}}function u(){r.newMessageMarker$.peek()||r.newMessageMarker$.set(s.readUntil.peek())}function c(){s.isUnread.get()&&s.unreadMessageCount.peek()===0&&(a=!0,u())}let h=null;function d(){var O;const E=r.state$.currentConversation.lastMessage.id.get(),A=r.state$.currentConversationId.peek(),_=A!==h;if(h=A,_&&(p.stop(),a=!1,r.newMessageMarker$.set(void 0)),!E||!A)return;s.isUnread.peek()&&(o()?(_&&u(),l()):(u(),p.start())),((O=s.lastMessage.sender)==null?void 0:O.id.peek())===r.extUserId$.peek()&&(r.newMessageMarker$.set(void 0),a=!1)}const p={handle:void 0,start(){this.handle||(this.handle=setInterval(()=>this.tick(),2e3))},tick(){o()&&(l(),this.stop())},stop(){clearInterval(this.handle),this.handle=void 0}};window.__talkjsE2E&&(window.__talkjsE2E.foregroundCheck=()=>{de.defined(p.handle),p.tick()});const f=gt(c),m=gt(d);return()=>{r.newMessageMarker$.set(void 0),f(),m(),p.stop()}}(e,n,t),[e,n,t])}function ST({conversationId:t}){const e=he(),n=Yr(),r=Q(!0),i=Q(null),o=te(()=>!!e.state$.messages.child(t).loadedAll.get());Z(()=>n.setScrollableDiv(i),[n]),gT(ee(()=>{if(!i.current)return!1;const a=!document.hidden,l=function(h){if(h.checkVisibility)return h.checkVisibility({contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0,checkOpacity:!0,checkVisibilityCSS:!0});{const d=window.getComputedStyle(h),p=d.visibility,f=d.opacity;return!(h.getClientRects().length===0||p==="hidden"||f==="0")}}(i.current),u=i.current.getBoundingClientRect(),c=u.top<window.innerHeight&&u.bottom>0&&u.left<window.innerWidth&&u.right>0;return a&&l&&c},[])),ft(()=>{r.current=i.current.scrollTop>-30}),Z(()=>{r.current&&(i.current.scrollTop=0)});const s=ee(a=>{const l=a.currentTarget,u=l.scrollHeight-l.clientHeight+l.scrollTop,c=e.messageSubscriptions[t];u<90&&c&&c.loadMore(10)},[e.messageSubscriptions,t]);return L("div",{className:"t-message-list",ref:i,"t-menu-boundary":"",onScroll:s,children:[L(AT,{}),L(mo,{each:e.chatItems$,children:a=>L("div",{className:"t-message-group","t-group-type":a.type.get(),children:L(mo,{each:a.items,item:OT,itemProps:{controller:n,conversationId:t}})},a.id.get())}),o&&L(_T,{})]})}function OT({item$:t}){const e=he(),n=te(t),r=te(e.state$.editingMessageId);return n instanceof fs?L(mT,{timestamp:n.timestamp,isReadMarker:n.isReadMarker,isDayMarker:n.isDayMarker}):r===n.id?L(fT,{message:n}):L(ET,{message:n})}typeof window=="undefined"||MediaRecorder&&MediaRecorder.isTypeSupported(Ts)||async function(){return(await mc(N_["opus-media-recorder-wasm"])).default}().then(t=>CA=t);const DT=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function ba({appId:t,chatboxState:e}){const n=t.charAt(0)==="t"||DT.has(t);return Z(()=>{switch(e.type){case"auth-failed":$e.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":$e.error(`User \`${e.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":$e.error(e.error);break;case"wrong-app-id":$e.error(`Could not find given appId: "${e.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:de.never(e)}},[e]),L("div",{className:"t-panel t-error-panel",children:[L("span",{className:"t-heading",children:"Something went wrong"}),L("p",{children:"Please reload the page and try again."}),n?L(Pe,{children:[L("p",{children:"Developer note: check your browser's developer tools console for messages that may help solve the problem."}),L("p",{children:"This message only shows up in test mode."})]}):L("p",{children:"If things keep not working, do not hesitate to get in touch with us."})]})}function vT(){return L("div",{className:"t-panel t-error-panel",children:L("span",{className:"t-heading",children:te(he().t$).CHAT_NOT_FOUND})})}function yA(){return L("div",{className:"t-panel t-loading-panel",children:L(Nu,{})})}function NA(){const t=te(he().t$);return L("div",{className:"t-panel t-error-panel",children:[L("span",{className:"t-heading",children:t.AUTH_EXPIRED_OVERLAY_TITLE}),L("p",{children:t.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}const TT=()=>!0;async function Uu(t,e,{initialDelay:n,maxDelay:r,log:i,shouldRetry:o=TT}){return e().catch(async s=>{if(i&&i(`[TalkJS] Retries left: ${t}. Error: ${JSON.stringify(s)}.`),t===0||!await o(s))throw s;const a=1e3*n*1.2,l=Math.min(1e3*r,a),u=l*(1-(c=.05)+2*Math.random()*c);var c,h;return(h=u,h<=0?Promise.resolve():new Promise(d=>setTimeout(d,h))).then(()=>Uu(t-1,e,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:o}))})}function No(){const t={},e=new Promise(function(n,r){t.resolve=n,t.reject=r});return t.promise=e,t}function RT(t,e,n){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=lr(Lm);return ee(async()=>{function o(c){c==="denied"&&i({type:t})}if(!r||!await async function(c){if(!("permissions"in navigator))return!1;try{return(await navigator.permissions.query({name:c})).state==="prompt"}catch(h){return!1}}(t))return e(c=>{o(c)});const s=No(),a=No(),l={type:t,showPrompt:async()=>(a.resolve({cancelled:!1}),await s.promise),cancel:()=>{a.resolve({cancelled:!0})}};try{r(l)}catch(c){$e.error("Your beforeBrowserPermissionPrompt callback threw an error: ",c),a.resolve({cancelled:!0})}const{cancelled:u}=await a.promise;return u?void 0:e(c=>{s.resolve(c),o(c)})},[r,i,t,e,...n])}function CT({onClose:t}){const e=he(),n=Yr(),r=Mi(),[i,o]=ae(null),s=ee(async l=>{try{if(l||(l=(await new Promise(m=>{const E=document.createElement("input");E.type="file",E.multiple=!1,E.addEventListener("change",()=>{m([...E.files])}),E.addEventListener("cancel",()=>{m([])}),E.click()}))[0]),!l)return;const{uploadPromise:u,upload:c}=await async function(m,E){const A=m.name;if(function(D){return/\.(mp4|ts|mov|webm|ogv)$/i.test(D)}(m.name)){const D=await Nl("video",m,I=>({width:I.videoWidth,height:I.videoHeight,duration:I.duration,filename:A})),R=E.uploadVideo(m,D),T=function(I){switch(I.name.split(".").pop()){case"ts":return"video/MP2T";case"mov":return"video/quicktime";case"webm":return"video/webm";case"ogv":return"video/ogg";default:return"video/mp4"}}(m);return{uploadPromise:R,upload:{type:"video",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m],{type:T}))}}}if(function(D){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(D)}(m.name)){const D=await Nl("audio",m,R=>({duration:R.duration,filename:A}));return{uploadPromise:E.uploadAudio(m,D),upload:{type:"audio",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}if(function(D){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(D)}(m.name)){const D=await Nl("img",m,R=>({width:R.naturalWidth,height:R.naturalHeight,filename:A}));return{uploadPromise:E.uploadImage(m,D),upload:{type:"image",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}const _={filename:A},g=E.uploadFile(m,_),O=URL.createObjectURL(new Blob([m]));return{uploadPromise:g,upload:{type:"file",file:m,metadata:_,temporaryBlobUrl:O}}}(l,r),h=c.file.size+","+c.file.name;e.state$.localFileBlobUrls.child(e.state$.currentConversationId.peek()).child(h).set({url:c.temporaryBlobUrl,fetching:!1}),e.latestFileUpload=c;const d=No(),p={upload:c,closePreview:d.resolve,uploaded:!1,errored:!1};let f;o(p);try{f=await rf(u,d.promise),o({...p,uploaded:!0})}catch(m){if(m===bc)return;$e.warn("File upload failed",m.toString()),o(E=>({...E,errored:!0}))}if(await d.promise==="cancel")return;de.defined(f),n.sendFileMessage({fileToken:f})}finally{t(),o(null)}},[n,r,o,e,t]),a=RT("geolocation",async l=>{try{const u=No(),c={upload:{type:"location",location:void 0},uploaded:!1,closePreview:u.resolve,errored:!1};o(c);const{permissionResult:h,location:d}=await rf(new Promise(p=>{navigator.geolocation.getCurrentPosition(f=>{const m={latitude:f.coords.latitude,longitude:f.coords.longitude};p({permissionResult:"granted",location:m})},f=>{f.code===1?p({permissionResult:"denied"}):p({permissionResult:"granted"})})}),u.promise);if(l(h),!d||(o({...c,upload:{type:"location",location:d},uploaded:!0}),await u.promise==="cancel"))return;n.sendLocationMessage({location:d})}catch(u){if(u===bc)return;throw u}finally{t(),o(null)}},[n,o,t]);return{attachFile:s,shareLocation:a,uploadState:i}}const bc=Symbol("cancelled");function rf(t,e){return Promise.race([t,e.then(()=>Promise.reject(bc))])}async function Nl(t,e,n){const r=document.createElement(t);try{return r.src=URL.createObjectURL(e),await new Promise((i,o)=>{const s=t==="img"?"load":"loadedmetadata";r.addEventListener(s,()=>{try{i(n(r))}catch(a){o(a)}},{once:!0})})}finally{URL.revokeObjectURL(r.src)}}function bA({children:t,className:e,...n}){return L("div",{className:"t-attach-overlay "+e,...n,children:t})}function IT({uploadState:t}){const{uploaded:e,errored:n}=t;$o(()=>t.closePreview("cancel"),".t-upload-preview");const r=Q(null);Z(()=>{e&&r.current.focus()},[e]);const i=te(he().t$);return L(bA,{className:"t-upload-preview",children:L("div",{className:"t-preview",children:[!n&&L(yT,{upload:t.upload,uploaded:e}),n&&L("div",{className:"t-error-row",children:i.UPLOAD_ERROR}),L("div",{className:"t-send-row",children:[L("button",{className:"t-cancel",onClick:()=>t.closePreview("cancel"),children:i.CANCEL}),!n&&e&&L("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>t.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function yT({upload:t,uploaded:e}){const n=te(he().t$);return t.type!=="location"?L(Pe,{children:[L(bT,{upload:t}),L(kT,{upload:t,uploaded:e,t:n})]}):e?L(NT,{location:t.location}):L("div",{className:"t-loading",children:L(Nu,{})})}function NT({location:t}){const{imageUrl:e,linkUrl:n}=Fu(t);return L("a",{href:n,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(e)}) center center / cover no-repeat`}})}const bT=Un(function({upload:t}){let e=null;const n=t.file;if(t.type==="video"){const r=/[.]ts/i.test(n.name)?"mpegts":"native";e=L("div",{className:"video-container",children:L(LT,{src:t.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else t.type==="image"?e=L("div",{className:"t-img-container",children:L("img",{src:t.temporaryBlobUrl})}):t.type==="audio"&&(e=L(Go,{src:t.temporaryBlobUrl,filename:n.name}));return e}),kT=Un(function({uploaded:t,upload:e,t:n}){let r;r=t?e.metadata.filename:n.UPLOAD_IN_PROGRESS;let i="",o="";return e.type==="file"&&(i="is-file",t&&(o="file-block")),L("div",{className:`t-filename-row ${i}`,children:L("div",{className:o,children:r})})});function LT(t){const{videoType:e,...n}=t;return L("video",{...n})}function wT(){var o;const t=nt(),e=he(),n=nn(),r=(o=te(()=>e.state$.isUserConnected.child(e.state$.currentConversationId.get())))!=null?o:{},i=te(e.state$.userPermissions);return L(t.ChatHeader,{common:n,isUserConnected:r,permissions:i})}function MT(){const t=nt(),e=nn();return L(t.MessageListHeader,{common:e})}function PT(){const t=nt(),e=nn();return L(t.MessageListFooter,{common:e})}function xT(){const t=nt(),e=nn();return L(t.NoConversationSelected,{common:e})}function kA({containerRef:t}){const[e,n]=ae(null),[r,i]=ae(null),[o,s]=ae(!1);Z(()=>{const h=t.current;let d=null;const p=f=>{if(f.pointerType!=="mouse")return;d&&(clearTimeout(d),d=null);const m=f.target.closest("[t-tooltip-text]");m&&(d=setTimeout(()=>{d=null,n(m),s(!1)},500))};return h==null||h.addEventListener("pointerover",p),()=>{h==null||h.removeEventListener("pointerover",p)}},[t]),Z(()=>{const h=t.current;let d,p=!1;function f(A){p=!1,A.pointerType!=="mouse"&&(d=setTimeout(()=>{const _=A.target.closest("[t-tooltip-text]");_&&(p=!0,n(_),s(!0))},300))}function m(){clearTimeout(d)}function E(A){p&&(A.stopPropagation(),A.preventDefault())}return h.addEventListener("pointerdown",f),h.addEventListener("pointerup",m),h.addEventListener("pointerleave",m),h.addEventListener("click",E,!0),h.addEventListener("contextmenu",E,!0),()=>{h.removeEventListener("pointerdown",f),h.removeEventListener("pointerup",m),h.removeEventListener("pointerleave",m),h.removeEventListener("click",E,!0),h.removeEventListener("contextmenu",E,!0)}},[t]);const{refs:a,floatingStyles:l}=q_({placement:"top",middleware:[J_(),o&&(u=10,{...g0(u),options:[u,c]})],whileElementsMounted:X_});var u,c;return Z(()=>{if(e){a.setReference(e);const h=()=>{const f=e.getAttribute("t-tooltip-text");f===null?p():i(f.trim())},d=new MutationObserver(h);d.observe(e,{attributes:!0}),h();const p=()=>{o?setTimeout(()=>n(null),1e3):n(null)};return e.addEventListener("pointerleave",p),()=>{e.removeEventListener("pointerleave",p),d.disconnect(),a.setReference(null),i(null)}}},[e,o,a]),r?L("div",{className:"t-tooltip",role:"tooltip",style:l,ref:a.setFloating,children:r}):null}function FT({appId:t,chatHeaderVisible:e,messageFieldVisible:n}){const r=xo(),i=function(){const E=he(),A=vt(()=>{const O=E.errors$.get(),D=E.authTokenState$.get(),R=E.state$.loadingConversationId.get(),T=E.state$.currentConversationId.get();return O.serverError?"server-error":O.wrongAppId?"wrong-app-id":D==="loading"||D==="idle"?"loading-token":D==="invalid"?"invalid-token":D==="expired"?"expired-token":D==="valid"?O.unknownUser?"unknown-user":R&&E.state$.unknownConversations.child(R).get()?"loading-conv-failed":E.canRenderUi(R)||T!==R&&E.canRenderUi(T)?"loaded":"loading-data":void de.unreachable()}),_=vt({type:"loading"});Eo(O=>{const D=A.get(),R=E.state$.currentConversationId.get(),T=E.extUserId$.get(),I=E.appId$.get();function S(v){_.set({type:"loading"});const y=setTimeout(()=>{_.set(v)},5e3);return()=>clearTimeout(y)}switch(D){case"invalid-token":_.set({type:"auth-failed"});break;case"expired-token":_.set({type:"expired-token"});break;case"wrong-app-id":_.set({type:"wrong-app-id",appId:I});break;case"server-error":_.set({type:"server-error"});break;case"loading-data":case"loading-token":_.set({type:"loading"});break;case"loaded":_.set({type:"loaded",conversationId:R,userId:T});break;case"loading-conv-failed":O.onCleanup=S({type:"inaccessible-conversation",userId:T,conversationId:R});break;case"unknown-user":O.onCleanup=S({type:"unknown-user",userId:T});break;default:de.never(D)}});const g=vt({type:"loading"});return Eo(O=>{if(_.type.get()==="loading"){g.set({type:"invisible-loading"});const D=setTimeout(()=>{g.set({type:"loading"})},1e3);O.onCleanup=()=>{clearTimeout(D)}}else g.set(_.get())}),te(g)}(),{attachFile:o,shareLocation:s,uploadState:a}=CT({onClose:()=>r.focus()});Z(()=>{r.uploadFile=o},[r,o]);const[l,u]=ae(!1),c=he(),h=te(()=>c.app$.get()?c.state$.userPermissions.canShareFile.get():void 0);Z(()=>{i.type==="loaded"?c.renderedConversationId$.set(i.conversationId):c.renderedConversationId$.set(void 0)},[i,c]);const d=ee(E=>{o(E.dataTransfer.files[0]),E.preventDefault(),u(!1)},[o]),p=ee(E=>{E.preventDefault(),u(!0)},[]),f=ee(E=>{E.preventDefault(),u(!1)},[]),m=Q(null);return bu(),i.type==="invisible-loading"?L(Pe,{}):i.type==="loading"?L(yA,{}):i.type==="inaccessible-conversation"?L(vT,{}):i.type==="unknown-user"||i.type==="auth-failed"||i.type==="wrong-app-id"||i.type==="server-error"||i.type==="unexpected-error"?L(ba,{appId:t,chatboxState:i}):i.type=="expired-token"?L(NA,{}):i.type==="loaded"?i.conversationId===null?L(xT,{}):L("div",{className:"t-chatbox-content",onDragOver:h?p:void 0,onDragLeave:h?f:void 0,onDrop:h?d:void 0,"t-menu-boundary":"root",ref:m,children:[e&&L(wT,{}),L(MT,{}),L(ST,{conversationId:i.conversationId}),L(PT,{}),n&&L(IA,{attachFile:o,shareLocation:s}),a&&L(IT,{uploadState:a}),l&&L(bA,{className:"t-drop-overlay",children:L(Ys,{type:"attach"})}),L(kA,{containerRef:m})]}):L(Pe,{})}const us=new Uint8Array(31);function LA(){if(globalThis.crypto!==void 0)crypto.getRandomValues(us);else for(let e=0;e<us.length;e++)us[e]=Math.floor(256*Math.random());let t=0;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^us[t++]&15>>+e/4).toString(16))}class HT{constructor(e,n,r,i,o,s,a,l){this.store=e,this.talkSession=n,this.editorInternals=r,this.onSendMessage=i,this.onDeleteMessage=o,this.onMessageAction=s,this.onFocusMessage=a,this.onBackButtonClick=l,this.loadMoreUntil=async u=>{const c=this.store.state$.currentConversationId.peek(),h=this.store.state$.messages.child(c).loadedAll;let d;do{const p=this.store.messageSubscriptions[c];p&&!h.peek()&&await p.loadMore(30),d=u()}while(!h.peek()&&!d);return d}}setScrollableDiv(e){this.scrollable=e}toggleSearchBox(e){if(this.store.state$.userPermissions.canSearch.peek())if(e!==void 0)this.store.chatSearchState$.set(e?"visible":"hidden");else{const n=this.store.chatSearchState$.peek();this.store.chatSearchState$.set(n==="hidden"?"visible":"hidden")}else $e.error("In-conversation message search is only available to customers on Growth plan and above.")}async deleteMessage(e){const n=this.store.state$.currentConversationId.peek();if(!n)return;const r=this.store.state$.messages.child(n).lookup.child(e).peek(),i=this.talkSession.conversation(n).message(e),[o]=await Promise.all([r!=null?r:i.get(),i.delete()]);if(o){const s={currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek(),message:r};this.onDeleteMessage(s)}}setEditing(e){this.store.state$.currentConversationId.peek()&&this.store.state$.editingMessageId.set(e)}async editMessage(e,n){const r=this.store.state$.currentConversationId.peek();r&&await this.talkSession.conversation(r).message(e).edit(n)}setReferencedMessage(e){this.store.state$.currentConversationId.peek()&&(this.store.state$.referencedMessageId.set(e),setTimeout(()=>this.editorInternals.focus({skipProseMirrorStuff:!0}),100))}async focusMessage(e,n=!0){var a;if(e==null)return this.store.focusedMessage$.set(null),null;if(await da(()=>this.store.state$.loadingConversationId.get()===this.store.renderedConversationId$.get()),this.store.state$.currentConversationId.peek()===null)return $e.error("Cannot focus message because current conversation is `null`."),null;const r=()=>{const l=this.store.state$.currentConversationId.peek();return this.store.state$.messages.child(l).lookup.child(e).peek()||null};let i=r();if(i||(i=await this.loadMoreUntil(r)),!i)return $e.error(`Message with id: \`${e}\` could not be found in this conversation`),i;const o=(a=this.scrollable)==null?void 0:a.current;de.defined(o);const s=o.querySelector(`[t-message-id="${e}"]`);return s?this.scrollToAndHighlight(s,i,n):$e.error(`Could not find HTMLElement with attribute: t-message-id="${e}"`),i}async jumpToHighlight(e){if(!this.store.state$.userPermissions.canSearch.peek())return $e.error("In-conversation message search is only available to customers on Growth plan and above."),null;if(this.store.highlightedStrings$.peek().length===0||this.store.chatSearchState$.peek()==="searching")return null;let n=this.findHighlight(e);return n||e!=="up"||(this.store.chatSearchState$.set("searching"),n=await this.loadMoreUntil(()=>this.findHighlight("up"))),n}findHighlight(e){var u;const n=(u=this.scrollable)==null?void 0:u.current;de.defined(n);const r=[],i=Array.from(n.querySelectorAll("[t-message-id]")),o=this.store.state$.currentConversationId.peek(),s=this.store.state$.messages.child(o).state.peek();if(i.length===0&&s.length!==0)return $e.error("Could not find HTMLElements with the attribute: t-message-id. This attribute is required for In-Conversation search to work."),null;let a;if(Array.from(n.getElementsByClassName("t-highlighted-text")).forEach(c=>{const h=i.findIndex(f=>f.contains(c));if(h===-1)return;const d=i.splice(h,1)[0],p=d.getAttribute("t-message-id");r.push([p,d])}),e==="up"){const c=n.getBoundingClientRect().top;a=r.find(([h,d])=>d.getBoundingClientRect().top-c<-5)}else{const c=.05*n.getBoundingClientRect().height,h=n.getBoundingClientRect().bottom;for(let d=r.length-1;d>=0;d--){const p=r[d],[f,m]=p;if(h-m.getBoundingClientRect().top<=c){a=p;break}}}const l=this.store.chatSearchState$;if(a){const[c,h]=a,d=this.store.state$.messages.child(o).lookup.child(c).peek();return this.scrollToAndHighlight(h,d),l.set("visible"),d}return r.length===0?l.set("noResults"):l.set("noMoreResults"),null}scrollToAndHighlight(e,n,r=!0){const i=this.scrollable.current.getBoundingClientRect(),o=e.getBoundingClientRect();let s="start";Math.sign(i.top-o.top)===-1&&o.height<i.height&&(s="end"),e instanceof HTMLElement&&(e.style.scrollSnapAlign=s),e.scrollIntoView({behavior:"instant"}),e instanceof HTMLElement&&(e.style.scrollSnapAlign="none"),this.store.focusedMessage$.set(n),r&&this.onFocusMessage({message:n})}setHighlightedStrings(e){this.store.state$.userPermissions.canSearch.peek()?this.store.highlightedStrings$.set(e):$e.error("In-conversation message search and by extension highlighting of strings are only available to customers on Growth plan and above.")}async sendMessage(e){const n=this.store.state$.currentConversationId.peek();if(!n)return;const r=await async function(s,a){var m,E,A,_,g;const l=s.state$.currentConversationId.peek(),u=s.state$.messages.child(l),c=typeof a.referencedMessage=="string"?u.lookup.child(a.referencedMessage).peek():await((E=(m=a.referencedMessage)==null?void 0:m.get())!=null?E:null),h=c&&{...c,type:"UserMessage",sender:c.sender,referencedMessageId:(_=(A=c.referencedMessage)==null?void 0:A.id)!=null?_:null};h&&delete h.referencedMessage;const d=s.latestFileUpload,p="content"in a?[of(d,a.content[0])]:[UT(a.text)],f="text"in a?a.text:EA(a.content.map(O=>of(d,O)),{});return{id:"ephemeral-"+LA(),type:"UserMessage",sender:s.currentUser$.peek(),createdAt:Date.now(),editedAt:null,custom:(g=a.custom)!=null?g:{},origin:"web",referencedMessage:h,reactions:[],content:p,plaintext:f}}(this.store,e);this.store.state$.ephemeralMessages.child(n).child(r.id).set(r);const i=No();this.store.readyForNewMessagesPromise=i.promise;const o=await this.talkSession.conversation(n).send(e);this.store.state$.ephemeralMessageIdMapping.child(n).child(o.id).set(r.id),i.resolve(),this.onSendMessage({message:await o.get(),currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek()})}sendFileMessage(e){const n={type:"file",fileToken:e.fileToken};return this.sendMessage({content:[n],custom:e.custom})}async uploadVoice(e,n){return await this.talkSession.uploadVoice(e,n)}sendLocationMessage(e){const n={type:"location",latitude:e.location.latitude,longitude:e.location.longitude};return this.sendMessage({content:[n],custom:e.custom})}markAsTyping(){const e=this.store.state$.currentConversationId.peek();e&&this.talkSession.conversation(e).markAsTyping()}async toggleReaction(e,n,r){typeof n!="string"&&(n=n.emoji);const i=this.store.state$.currentConversationId.peek();if(!i)return;const o=this.store.state$.messages.child(i).lookup.child(e).peek().reactions.find(a=>a.emoji===n),s=this._getReactionRef(e,n);o!=null&&o.currentUserReacted&&r!==!0?await s.remove():r!==!1&&await s.add()}async addReaction(e,n){this.store.state$.currentConversationId.peek()&&await this._getReactionRef(e,n).add()}triggerMessageAction(e,n,r){const i=this.store.state$.currentConversation.peek();i&&(typeof e=="string"&&(e=this.store.state$.messages.child(i.id).lookup.child(e).peek()),this.onMessageAction({action:n,params:r,message:e,conversation:i}))}clickBackButton(){const e=this.store.currentUser$.peek();de.defined(e),this.onBackButtonClick({currentUser:e})}storeDraft(e){const n=this.store.state$.currentConversationId.peek(),r=this.store.currentUser$.peek(),i=this.store.appId$.peek();n&&r&&i&&gv(n,r.id,i,e)}_getReactionRef(e,n){const r=this.store.state$.currentConversationId.peek();return this.talkSession.conversation(r).message(e).reaction(n)}}const UT=t=>({type:"text",children:p_(t)});function of(t,e){switch(e.type){case"text":case"location":return e;case"file":return function(n,r){return{type:"file",subtype:n.type==="file"?void 0:n.type,...n.metadata,size:n.file.size,filename:n.file.name,fileToken:r.fileToken,url:n.temporaryBlobUrl}}(t,e)}}class bl extends Error{constructor(e,n){const r=function(i){if(typeof i=="string")return i;if(Array.isArray(i))return i.join(`
|
|
104
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}(h))},a.close=function(){},l(a)})}},function(t,e,n){(function(r,i,o,s){var a;function l(d){return(l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p})(d)}function u(d,p,f){return p&&function(m,E){for(var A=0;A<E.length;A++){var _=E[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}(d.prototype,p),d}var c,h=(c=(c=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0)||r,function(d){d=(d=d||{})!==void 0?d:{};var p=n(1).EmscriptenMemoryAllocator,f=48e3,m=function(){function C(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;(function(W,Y){if(!(W instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,C),this.config={inputSampleRate:N,channelCount:x},this.memory=new p(d),this._opus_encoder_create=d._opus_encoder_create,this._opus_encoder_ctl=d._opus_encoder_ctl,this._opus_encode_float=d._opus_encode_float,this._opus_encoder_destroy=d._opus_encoder_destroy,this._speex_resampler_init=d._speex_resampler_init,this._speex_resampler_process_interleaved_float=d._speex_resampler_process_interleaved_float,this._speex_resampler_destroy=d._speex_resampler_destroy,this._container=new d.Container,this._container.init(f,x,Math.floor(4294967295*Math.random())),this.OpusInitCodec(f,x,$),this.SpeexInitResampler(N,f,x),this.inputSamplesPerChannel=20*N/1e3,this.outputSamplePerChannel=960,this.inputBufferIndex=0,this.mInputBuffer=this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel*x),this.mResampledBuffer=this.memory.mallocFloat32Buffer(this.outputSamplePerChannel*x),this.mOutputBuffer=this.memory.mallocUint8Buffer(4e3),this.interleavedBuffers=x!==1?new Float32Array(4096*x):void 0}return u(C,[{key:"encode",value:function(N){for(var x=this.interleave(N),$=0;$<x.length;){var W=Math.min(this.mInputBuffer.length-this.inputBufferIndex,x.length-$);if(this.mInputBuffer.set(x.subarray($,$+W),this.inputBufferIndex),this.inputBufferIndex+=W,this.inputBufferIndex>=this.mInputBuffer.length){var Y=this.memory.mallocUint32(this.inputSamplesPerChannel),ne=this.memory.mallocUint32(this.outputSamplePerChannel),Re=this._speex_resampler_process_interleaved_float(this.resampler,this.mInputBuffer.pointer,Y.pointer,this.mResampledBuffer.pointer,ne.pointer);if(Y.free(),ne.free(),Re!==0)throw new Error("Resampling error.");var Me=this._opus_encode_float(this.encoder,this.mResampledBuffer.pointer,this.outputSamplePerChannel,this.mOutputBuffer.pointer,this.mOutputBuffer.length);if(Me<0)throw new Error("Opus encoding error.");this._container.writeFrame(this.mOutputBuffer.pointer,Me,this.outputSamplePerChannel),this.inputBufferIndex=0}$+=W}}},{key:"close",value:function(){for(var N=this.config.channelCount,x=[],$=0;$<N;++$)x.push(new Float32Array(4096-this.inputBufferIndex/N));this.encode(x),d.destroy(this._container),this.mInputBuffer.free(),this.mResampledBuffer.free(),this.mOutputBuffer.free(),this._opus_encoder_destroy(this.encoder),this._speex_resampler_destroy(this.resampler)}},{key:"interleave",value:function(N){var x=N.length;if(x===1)return N[0];for(var $=0;$<x;$++)for(var W=N[$],Y=0;Y<W.length;Y++)this.interleavedBuffers[Y*x+$]=W[Y];return this.interleavedBuffers}},{key:"OpusInitCodec",value:function(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,W=this.memory.mallocUint32(void 0);this.encoder=this._opus_encoder_create(N,x,2049,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Opus encodor initialization failed.");$&&this.OpusSetOpusControl(4002,$)}},{key:"OpusSetOpusControl",value:function(N,x){var $=this.memory.mallocInt32(x);this._opus_encoder_ctl(this.encoder,N,$.pointer),$.free()}},{key:"SpeexInitResampler",value:function(N,x,$){var W=this.memory.mallocUint32(void 0);this.resampler=this._speex_resampler_init($,N,x,6,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Initializing resampler failed.")}}]),C}();d.init=function(C,N,x){d.encodedBuffers=[],d.encoder=new m(C,N,x)},d.encode=function(C){d.encoder.encode(C)},d.flush=function(){return d.encodedBuffers.splice(0,d.encodedBuffers.length)},d.close=function(){d.encoder.close()};var E,A,_,g,O,D={};for(E in d)d.hasOwnProperty(E)&&(D[E]=d[E]);A=(typeof window=="undefined"?"undefined":l(window))==="object",_=typeof importScripts=="function",g=(i===void 0?"undefined":l(i))==="object"&&l(i.versions)==="object"&&typeof i.versions.node=="string",O=!A&&!g&&!_;var R,T,I,S,v="";g?(v=_?n(0).dirname(v)+"/":o+"/",R=function(C,N){return I||(I=n(4)),S||(S=n(0)),C=S.normalize(C),I.readFileSync(C,N?null:"utf8")},T=function(C){var N=R(C,!0);return N.buffer||(N=new Uint8Array(N)),F(N.buffer),N},i.argv.length>1&&i.argv[1].replace(/\\/g,"/"),i.argv.slice(2),i.on("uncaughtException",function(C){if(!(C instanceof Er))throw C}),i.on("unhandledRejection",we),d.inspect=function(){return"[Emscripten Module object]"}):O?(typeof read!="undefined"&&(R=function(C){return read(C)}),T=function(C){var N;return typeof readbuffer=="function"?new Uint8Array(readbuffer(C)):(F(l(N=read(C,"binary"))==="object"),N)},typeof scriptArgs!="undefined"&&scriptArgs,typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||_)&&(_?v=self.location.href:document.currentScript&&(v=document.currentScript.src),c&&(v=c),v=v.indexOf("blob:")!==0?v.substr(0,v.lastIndexOf("/")+1):"",R=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.send(null),N.responseText},_&&(T=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var y,b,M=d.print||console.log.bind(console),k=d.printErr||console.warn.bind(console);for(E in D)D.hasOwnProperty(E)&&(d[E]=D[E]);D=null,d.arguments&&d.arguments,d.thisProgram&&d.thisProgram,d.quit&&d.quit,d.wasmBinary&&(y=d.wasmBinary),d.noExitRuntime&&d.noExitRuntime,(typeof WebAssembly=="undefined"?"undefined":l(WebAssembly))!=="object"&&k("no native wasm support detected");var P=new WebAssembly.Table({initial:60,maximum:60,element:"anyfunc"}),B=!1;function F(C,N){C||we("Assertion failed: "+N)}var V,G,z,K=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function _e(C,N,x){for(var $=N+x,W=N;C[W]&&!(W>=$);)++W;if(W-N>16&&C.subarray&&K)return K.decode(C.subarray(N,W));for(var Y="";N<W;){var ne=C[N++];if(128&ne){var Re=63&C[N++];if((224&ne)!=192){var Me=63&C[N++];if((ne=(240&ne)==224?(15&ne)<<12|Re<<6|Me:(7&ne)<<18|Re<<12|Me<<6|63&C[N++])<65536)Y+=String.fromCharCode(ne);else{var In=ne-65536;Y+=String.fromCharCode(55296|In>>10,56320|1023&In)}}else Y+=String.fromCharCode((31&ne)<<6|Re)}else Y+=String.fromCharCode(ne)}return Y}function ie(C,N){return C?_e(G,C,N):""}typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");var ue=d.INITIAL_MEMORY||16777216;function le(C){for(;C.length>0;){var N=C.shift();if(typeof N!="function"){var x=N.func;typeof x=="number"?N.arg===void 0?d.dynCall_v(x):d.dynCall_vi(x,N.arg):x(N.arg===void 0?null:N.arg)}else N()}}(b=d.wasmMemory?d.wasmMemory:new WebAssembly.Memory({initial:ue/65536,maximum:ue/65536}))&&(V=b.buffer),ue=V.byteLength,function(C){V=C,d.HEAP8=new Int8Array(C),d.HEAP16=new Int16Array(C),d.HEAP32=z=new Int32Array(C),d.HEAPU8=G=new Uint8Array(C),d.HEAPU16=new Uint16Array(C),d.HEAPU32=new Uint32Array(C),d.HEAPF32=new Float32Array(C),d.HEAPF64=new Float64Array(C)}(V),z[11496]=5289024;var Ie=[],$t=[],rt=[],ye=[];function Ke(C){Ie.unshift(C)}function Jt(C){ye.unshift(C)}var ve=0,qe=null;function we(C){throw d.onAbort&&d.onAbort(C),M(C+=""),k(C),B=!0,C="abort("+C+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(C)}d.preloadedImages={},d.preloadedAudios={};var dr="data:application/octet-stream;base64,";function Rn(C){return String.prototype.startsWith?C.startsWith(dr):C.indexOf(dr)===0}var Ge="WebMOpusEncoder.wasm";function rn(){try{if(y)return new Uint8Array(y);if(T)return T(Ge);throw"both async and sync fetching of the wasm failed"}catch(C){we(C)}}Rn(Ge)||(Ge=function(C){return d.locateFile?d.locateFile(C,v):v+C}(Ge)),$t.push({func:function(){hr()}});var Je={mappings:{},buffers:[null,[],[]],printChar:function(C,N){var x=Je.buffers[C];N===0||N===10?((C===1?M:k)(_e(x,0)),x.length=0):x.push(N)},varargs:void 0,get:function(){return Je.varargs+=4,z[Je.varargs-4>>2]},getStr:function(C){return ie(C)},get64:function(C,N){return C}},Fi={a:function(C,N,x,$){we("Assertion failed: "+ie(C)+", at: "+[N?ie(N):"unknown filename",x,$?ie($):"unknown function"])},e:function(C,N,x){return Je.varargs=x,0},h:function(C,N,x){Je.varargs=x},g:function(C,N,x){return Je.varargs=x,0},b:function(){we()},m:function(C,N){var x=new Uint8Array(d.HEAPU8.buffer,C,N);d.encodedBuffers.push(new Uint8Array(x).buffer)},k:function(C,N,x){G.copyWithin(C,N,N+x)},l:function(C){we("OOM")},c:function(C){return 0},f:function(C,N,x,$){var W=Je.getStreamFromFD(C),Y=Je.doReadv(W,N,x);return z[$>>2]=Y,0},j:function(C,N,x,$,W){},d:function(C,N,x,$){for(var W=0,Y=0;Y<x;Y++){for(var ne=z[N+8*Y>>2],Re=z[N+(8*Y+4)>>2],Me=0;Me<Re;Me++)Je.printChar(C,G[ne+Me]);W+=Re}return z[$>>2]=W,0},memory:b,table:P,i:function(C){var N=Date.now()/1e3|0;return C&&(z[C>>2]=N),N}},on=function(){var C={a:Fi};function N(W,Y){var ne=W.exports;d.asm=ne,function(){if(ve--,d.monitorRunDependencies&&d.monitorRunDependencies(ve),ve==0&&qe){var Re=qe;qe=null,Re()}}()}function x(W){N(W.instance)}function $(W){return(y||!A&&!_||typeof fetch!="function"?new Promise(function(Y,ne){Y(rn())}):fetch(Ge,{credentials:"same-origin"}).then(function(Y){if(!Y.ok)throw"failed to load wasm binary file at '"+Ge+"'";return Y.arrayBuffer()}).catch(function(){return rn()})).then(function(Y){return WebAssembly.instantiate(Y,C)}).then(W,function(Y){k("failed to asynchronously prepare wasm: "+Y),we(Y)})}if(ve++,d.monitorRunDependencies&&d.monitorRunDependencies(ve),d.instantiateWasm)try{return d.instantiateWasm(C,N)}catch(W){return k("Module.instantiateWasm callback failed with error: "+W),!1}return function(){if(y||typeof WebAssembly.instantiateStreaming!="function"||Rn(Ge)||typeof fetch!="function")return $(x);fetch(Ge,{credentials:"same-origin"}).then(function(W){return WebAssembly.instantiateStreaming(W,C).then(x,function(Y){k("wasm streaming compile failed: "+Y),k("falling back to ArrayBuffer instantiation"),$(x)})})}(),{}}();d.asm=on;var Rt,hr=d.___wasm_call_ctors=function(){return(hr=d.___wasm_call_ctors=d.asm.n).apply(null,arguments)},pr=(d.___em_js__emscriptenPushBuffer=function(){return(d.___em_js__emscriptenPushBuffer=d.asm.o).apply(null,arguments)},d._emscripten_bind_VoidPtr___destroy___0=function(){return(pr=d._emscripten_bind_VoidPtr___destroy___0=d.asm.p).apply(null,arguments)}),Vn=d._emscripten_bind_Container_Container_0=function(){return(Vn=d._emscripten_bind_Container_Container_0=d.asm.q).apply(null,arguments)},fr=d._emscripten_bind_Container_init_3=function(){return(fr=d._emscripten_bind_Container_init_3=d.asm.r).apply(null,arguments)},mr=d._emscripten_bind_Container_writeFrame_3=function(){return(mr=d._emscripten_bind_Container_writeFrame_3=d.asm.s).apply(null,arguments)},sn=d._emscripten_bind_Container___destroy___0=function(){return(sn=d._emscripten_bind_Container___destroy___0=d.asm.t).apply(null,arguments)};function Er(C){this.name="ExitStatus",this.message="Program terminated with exit("+C+")",this.status=C}function an(C){function N(){Rt||(Rt=!0,d.calledRun=!0,B||(le($t),le(rt),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)Jt(d.postRun.shift());le(ye)}()))}ve>0||(function(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ke(d.preRun.shift());le(Ie)}(),ve>0||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),N()},1)):N()))}if(d._opus_encoder_create=function(){return(d._opus_encoder_create=d.asm.u).apply(null,arguments)},d._opus_encode_float=function(){return(d._opus_encode_float=d.asm.v).apply(null,arguments)},d._opus_encoder_ctl=function(){return(d._opus_encoder_ctl=d.asm.w).apply(null,arguments)},d._opus_encoder_destroy=function(){return(d._opus_encoder_destroy=d.asm.x).apply(null,arguments)},d._speex_resampler_init=function(){return(d._speex_resampler_init=d.asm.y).apply(null,arguments)},d._speex_resampler_destroy=function(){return(d._speex_resampler_destroy=d.asm.z).apply(null,arguments)},d._speex_resampler_process_interleaved_float=function(){return(d._speex_resampler_process_interleaved_float=d.asm.A).apply(null,arguments)},d._free=function(){return(d._free=d.asm.B).apply(null,arguments)},d._malloc=function(){return(d._malloc=d.asm.C).apply(null,arguments)},d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.D).apply(null,arguments)},d.dynCall_v=function(){return(d.dynCall_v=d.asm.E).apply(null,arguments)},d.asm=on,d.then=function(C){if(Rt)C(d);else{var N=d.onRuntimeInitialized;d.onRuntimeInitialized=function(){N&&N(),C(d)}}return d},qe=function C(){Rt||an(),Rt||(qe=C)},d.run=an,d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();function Se(){}function kt(C){return(C||Se).__cache__}function Cn(C,N){var x=kt(N),$=x[C];return $||(($=Object.create((N||Se).prototype)).ptr=C,x[C]=$)}function Te(){throw"cannot construct a VoidPtr, no constructor in IDL"}function pe(){this.ptr=Vn(),kt(pe)[this.ptr]=this}return an(),Se.prototype=Object.create(Se.prototype),Se.prototype.constructor=Se,Se.prototype.__class__=Se,Se.__cache__={},d.WrapperObject=Se,d.getCache=kt,d.wrapPointer=Cn,d.castObject=function(C,N){return Cn(C.ptr,N)},d.NULL=Cn(0),d.destroy=function(C){if(!C.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";C.__destroy__(),delete kt(C.__class__)[C.ptr]},d.compare=function(C,N){return C.ptr===N.ptr},d.getPointer=function(C){return C.ptr},d.getClass=function(C){return C.__class__},Te.prototype=Object.create(Se.prototype),Te.prototype.constructor=Te,Te.prototype.__class__=Te,Te.__cache__={},d.VoidPtr=Te,Te.prototype.__destroy__=Te.prototype.__destroy__=function(){var C=this.ptr;pr(C)},pe.prototype=Object.create(Se.prototype),pe.prototype.constructor=pe,pe.prototype.__class__=pe,pe.__cache__={},d.Container=pe,pe.prototype.init=pe.prototype.init=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),fr($,C,N,x)},pe.prototype.writeFrame=pe.prototype.writeFrame=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),mr($,C,N,x)},pe.prototype.__destroy__=pe.prototype.__destroy__=function(){var C=this.ptr;sn(C)},d});l(e)==="object"&&l(s)==="object"?s.exports=h:(a=function(){return h}.apply(e,[]))===void 0||(s.exports=a)}).call(this,"/index.js",n(2),"/",n(3)(t))},function(t,e,n){(function(r,i,o,s){var a;function l(d){return(l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p})(d)}function u(d,p,f){return p&&function(m,E){for(var A=0;A<E.length;A++){var _=E[A];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(m,_.key,_)}}(d.prototype,p),d}var c,h=(c=(c=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0)||r,function(d){d=(d=d||{})!==void 0?d:{};var p=n(1).EmscriptenMemoryAllocator,f=48e3,m=function(){function C(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;(function(W,Y){if(!(W instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,C),this.config={inputSampleRate:N,channelCount:x},this.memory=new p(d),this._opus_encoder_create=d._opus_encoder_create,this._opus_encoder_ctl=d._opus_encoder_ctl,this._opus_encode_float=d._opus_encode_float,this._opus_encoder_destroy=d._opus_encoder_destroy,this._speex_resampler_init=d._speex_resampler_init,this._speex_resampler_process_interleaved_float=d._speex_resampler_process_interleaved_float,this._speex_resampler_destroy=d._speex_resampler_destroy,this._container=new d.Container,this._container.init(f,x,Math.floor(4294967295*Math.random())),this.OpusInitCodec(f,x,$),this.SpeexInitResampler(N,f,x),this.inputSamplesPerChannel=20*N/1e3,this.outputSamplePerChannel=960,this.inputBufferIndex=0,this.mInputBuffer=this.memory.mallocFloat32Buffer(this.inputSamplesPerChannel*x),this.mResampledBuffer=this.memory.mallocFloat32Buffer(this.outputSamplePerChannel*x),this.mOutputBuffer=this.memory.mallocUint8Buffer(4e3),this.interleavedBuffers=x!==1?new Float32Array(4096*x):void 0}return u(C,[{key:"encode",value:function(N){for(var x=this.interleave(N),$=0;$<x.length;){var W=Math.min(this.mInputBuffer.length-this.inputBufferIndex,x.length-$);if(this.mInputBuffer.set(x.subarray($,$+W),this.inputBufferIndex),this.inputBufferIndex+=W,this.inputBufferIndex>=this.mInputBuffer.length){var Y=this.memory.mallocUint32(this.inputSamplesPerChannel),ne=this.memory.mallocUint32(this.outputSamplePerChannel),Re=this._speex_resampler_process_interleaved_float(this.resampler,this.mInputBuffer.pointer,Y.pointer,this.mResampledBuffer.pointer,ne.pointer);if(Y.free(),ne.free(),Re!==0)throw new Error("Resampling error.");var Me=this._opus_encode_float(this.encoder,this.mResampledBuffer.pointer,this.outputSamplePerChannel,this.mOutputBuffer.pointer,this.mOutputBuffer.length);if(Me<0)throw new Error("Opus encoding error.");this._container.writeFrame(this.mOutputBuffer.pointer,Me,this.outputSamplePerChannel),this.inputBufferIndex=0}$+=W}}},{key:"close",value:function(){for(var N=this.config.channelCount,x=[],$=0;$<N;++$)x.push(new Float32Array(4096-this.inputBufferIndex/N));this.encode(x),d.destroy(this._container),this.mInputBuffer.free(),this.mResampledBuffer.free(),this.mOutputBuffer.free(),this._opus_encoder_destroy(this.encoder),this._speex_resampler_destroy(this.resampler)}},{key:"interleave",value:function(N){var x=N.length;if(x===1)return N[0];for(var $=0;$<x;$++)for(var W=N[$],Y=0;Y<W.length;Y++)this.interleavedBuffers[Y*x+$]=W[Y];return this.interleavedBuffers}},{key:"OpusInitCodec",value:function(N,x){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,W=this.memory.mallocUint32(void 0);this.encoder=this._opus_encoder_create(N,x,2049,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Opus encodor initialization failed.");$&&this.OpusSetOpusControl(4002,$)}},{key:"OpusSetOpusControl",value:function(N,x){var $=this.memory.mallocInt32(x);this._opus_encoder_ctl(this.encoder,N,$.pointer),$.free()}},{key:"SpeexInitResampler",value:function(N,x,$){var W=this.memory.mallocUint32(void 0);this.resampler=this._speex_resampler_init($,N,x,6,W.pointer);var Y=W.value;if(W.free(),Y!==0)throw new Error("Initializing resampler failed.")}}]),C}();d.init=function(C,N,x){d.encodedBuffers=[],d.encoder=new m(C,N,x)},d.encode=function(C){d.encoder.encode(C)},d.flush=function(){return d.encodedBuffers.splice(0,d.encodedBuffers.length)},d.close=function(){d.encoder.close()};var E,A,_,g,O,D={};for(E in d)d.hasOwnProperty(E)&&(D[E]=d[E]);A=(typeof window=="undefined"?"undefined":l(window))==="object",_=typeof importScripts=="function",g=(i===void 0?"undefined":l(i))==="object"&&l(i.versions)==="object"&&typeof i.versions.node=="string",O=!A&&!g&&!_;var R,T,I,S,v="";g?(v=_?n(0).dirname(v)+"/":o+"/",R=function(C,N){return I||(I=n(4)),S||(S=n(0)),C=S.normalize(C),I.readFileSync(C,N?null:"utf8")},T=function(C){var N=R(C,!0);return N.buffer||(N=new Uint8Array(N)),F(N.buffer),N},i.argv.length>1&&i.argv[1].replace(/\\/g,"/"),i.argv.slice(2),i.on("uncaughtException",function(C){if(!(C instanceof Er))throw C}),i.on("unhandledRejection",we),d.inspect=function(){return"[Emscripten Module object]"}):O?(typeof read!="undefined"&&(R=function(C){return read(C)}),T=function(C){var N;return typeof readbuffer=="function"?new Uint8Array(readbuffer(C)):(F(l(N=read(C,"binary"))==="object"),N)},typeof scriptArgs!="undefined"&&scriptArgs,typeof print!="undefined"&&(typeof console=="undefined"&&(console={}),console.log=print,console.warn=console.error=typeof printErr!="undefined"?printErr:print)):(A||_)&&(_?v=self.location.href:document.currentScript&&(v=document.currentScript.src),c&&(v=c),v=v.indexOf("blob:")!==0?v.substr(0,v.lastIndexOf("/")+1):"",R=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.send(null),N.responseText},_&&(T=function(C){var N=new XMLHttpRequest;return N.open("GET",C,!1),N.responseType="arraybuffer",N.send(null),new Uint8Array(N.response)}));var y,b,M=d.print||console.log.bind(console),k=d.printErr||console.warn.bind(console);for(E in D)D.hasOwnProperty(E)&&(d[E]=D[E]);D=null,d.arguments&&d.arguments,d.thisProgram&&d.thisProgram,d.quit&&d.quit,d.wasmBinary&&(y=d.wasmBinary),d.noExitRuntime&&d.noExitRuntime,(typeof WebAssembly=="undefined"?"undefined":l(WebAssembly))!=="object"&&k("no native wasm support detected");var P=new WebAssembly.Table({initial:36,maximum:36,element:"anyfunc"}),B=!1;function F(C,N){C||we("Assertion failed: "+N)}var V,G,z,K=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function _e(C,N,x){for(var $=N+x,W=N;C[W]&&!(W>=$);)++W;if(W-N>16&&C.subarray&&K)return K.decode(C.subarray(N,W));for(var Y="";N<W;){var ne=C[N++];if(128&ne){var Re=63&C[N++];if((224&ne)!=192){var Me=63&C[N++];if((ne=(240&ne)==224?(15&ne)<<12|Re<<6|Me:(7&ne)<<18|Re<<12|Me<<6|63&C[N++])<65536)Y+=String.fromCharCode(ne);else{var In=ne-65536;Y+=String.fromCharCode(55296|In>>10,56320|1023&In)}}else Y+=String.fromCharCode((31&ne)<<6|Re)}else Y+=String.fromCharCode(ne)}return Y}function ie(C,N){return C?_e(G,C,N):""}typeof TextDecoder!="undefined"&&new TextDecoder("utf-16le");var ue=d.INITIAL_MEMORY||16777216;function le(C){for(;C.length>0;){var N=C.shift();if(typeof N!="function"){var x=N.func;typeof x=="number"?N.arg===void 0?d.dynCall_v(x):d.dynCall_vi(x,N.arg):x(N.arg===void 0?null:N.arg)}else N()}}(b=d.wasmMemory?d.wasmMemory:new WebAssembly.Memory({initial:ue/65536,maximum:ue/65536}))&&(V=b.buffer),ue=V.byteLength,function(C){V=C,d.HEAP8=new Int8Array(C),d.HEAP16=new Int16Array(C),d.HEAP32=z=new Int32Array(C),d.HEAPU8=G=new Uint8Array(C),d.HEAPU16=new Uint16Array(C),d.HEAPU32=new Uint32Array(C),d.HEAPF32=new Float32Array(C),d.HEAPF64=new Float64Array(C)}(V),z[11672]=5289728;var Ie=[],$t=[],rt=[],ye=[];function Ke(C){Ie.unshift(C)}function Jt(C){ye.unshift(C)}var ve=0,qe=null;function we(C){throw d.onAbort&&d.onAbort(C),M(C+=""),k(C),B=!0,C="abort("+C+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(C)}d.preloadedImages={},d.preloadedAudios={};var dr="data:application/octet-stream;base64,";function Rn(C){return String.prototype.startsWith?C.startsWith(dr):C.indexOf(dr)===0}var Ge="OggOpusEncoder.wasm";function rn(){try{if(y)return new Uint8Array(y);if(T)return T(Ge);throw"both async and sync fetching of the wasm failed"}catch(C){we(C)}}Rn(Ge)||(Ge=function(C){return d.locateFile?d.locateFile(C,v):v+C}(Ge)),$t.push({func:function(){hr()}});var Je={mappings:{},buffers:[null,[],[]],printChar:function(C,N){var x=Je.buffers[C];N===0||N===10?((C===1?M:k)(_e(x,0)),x.length=0):x.push(N)},varargs:void 0,get:function(){return Je.varargs+=4,z[Je.varargs-4>>2]},getStr:function(C){return ie(C)},get64:function(C,N){return C}},Fi={a:function(C,N,x,$){we("Assertion failed: "+ie(C)+", at: "+[N?ie(N):"unknown filename",x,$?ie($):"unknown function"])},c:function(){we()},d:function(C,N){var x=new Uint8Array(d.HEAPU8.buffer,C,N);d.encodedBuffers.push(new Uint8Array(x).buffer)},f:function(C,N,x){G.copyWithin(C,N,N+x)},g:function(C){we("OOM")},h:function(C){return 0},e:function(C,N,x,$,W){},b:function(C,N,x,$){for(var W=0,Y=0;Y<x;Y++){for(var ne=z[N+8*Y>>2],Re=z[N+(8*Y+4)>>2],Me=0;Me<Re;Me++)Je.printChar(C,G[ne+Me]);W+=Re}return z[$>>2]=W,0},memory:b,table:P},on=function(){var C={a:Fi};function N(W,Y){var ne=W.exports;d.asm=ne,function(){if(ve--,d.monitorRunDependencies&&d.monitorRunDependencies(ve),ve==0&&qe){var Re=qe;qe=null,Re()}}()}function x(W){N(W.instance)}function $(W){return(y||!A&&!_||typeof fetch!="function"?new Promise(function(Y,ne){Y(rn())}):fetch(Ge,{credentials:"same-origin"}).then(function(Y){if(!Y.ok)throw"failed to load wasm binary file at '"+Ge+"'";return Y.arrayBuffer()}).catch(function(){return rn()})).then(function(Y){return WebAssembly.instantiate(Y,C)}).then(W,function(Y){k("failed to asynchronously prepare wasm: "+Y),we(Y)})}if(ve++,d.monitorRunDependencies&&d.monitorRunDependencies(ve),d.instantiateWasm)try{return d.instantiateWasm(C,N)}catch(W){return k("Module.instantiateWasm callback failed with error: "+W),!1}return function(){if(y||typeof WebAssembly.instantiateStreaming!="function"||Rn(Ge)||typeof fetch!="function")return $(x);fetch(Ge,{credentials:"same-origin"}).then(function(W){return WebAssembly.instantiateStreaming(W,C).then(x,function(Y){k("wasm streaming compile failed: "+Y),k("falling back to ArrayBuffer instantiation"),$(x)})})}(),{}}();d.asm=on;var Rt,hr=d.___wasm_call_ctors=function(){return(hr=d.___wasm_call_ctors=d.asm.i).apply(null,arguments)},pr=(d.___em_js__emscriptenPushBuffer=function(){return(d.___em_js__emscriptenPushBuffer=d.asm.j).apply(null,arguments)},d._emscripten_bind_VoidPtr___destroy___0=function(){return(pr=d._emscripten_bind_VoidPtr___destroy___0=d.asm.k).apply(null,arguments)}),Vn=d._emscripten_bind_Container_Container_0=function(){return(Vn=d._emscripten_bind_Container_Container_0=d.asm.l).apply(null,arguments)},fr=d._emscripten_bind_Container_init_3=function(){return(fr=d._emscripten_bind_Container_init_3=d.asm.m).apply(null,arguments)},mr=d._emscripten_bind_Container_writeFrame_3=function(){return(mr=d._emscripten_bind_Container_writeFrame_3=d.asm.n).apply(null,arguments)},sn=d._emscripten_bind_Container___destroy___0=function(){return(sn=d._emscripten_bind_Container___destroy___0=d.asm.o).apply(null,arguments)};function Er(C){this.name="ExitStatus",this.message="Program terminated with exit("+C+")",this.status=C}function an(C){function N(){Rt||(Rt=!0,d.calledRun=!0,B||(le($t),le(rt),d.onRuntimeInitialized&&d.onRuntimeInitialized(),function(){if(d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;)Jt(d.postRun.shift());le(ye)}()))}ve>0||(function(){if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)Ke(d.preRun.shift());le(Ie)}(),ve>0||(d.setStatus?(d.setStatus("Running..."),setTimeout(function(){setTimeout(function(){d.setStatus("")},1),N()},1)):N()))}if(d._opus_encoder_create=function(){return(d._opus_encoder_create=d.asm.p).apply(null,arguments)},d._opus_encode_float=function(){return(d._opus_encode_float=d.asm.q).apply(null,arguments)},d._opus_encoder_ctl=function(){return(d._opus_encoder_ctl=d.asm.r).apply(null,arguments)},d._opus_encoder_destroy=function(){return(d._opus_encoder_destroy=d.asm.s).apply(null,arguments)},d._malloc=function(){return(d._malloc=d.asm.t).apply(null,arguments)},d._free=function(){return(d._free=d.asm.u).apply(null,arguments)},d._speex_resampler_init=function(){return(d._speex_resampler_init=d.asm.v).apply(null,arguments)},d._speex_resampler_destroy=function(){return(d._speex_resampler_destroy=d.asm.w).apply(null,arguments)},d._speex_resampler_process_interleaved_float=function(){return(d._speex_resampler_process_interleaved_float=d.asm.x).apply(null,arguments)},d.dynCall_vi=function(){return(d.dynCall_vi=d.asm.y).apply(null,arguments)},d.dynCall_v=function(){return(d.dynCall_v=d.asm.z).apply(null,arguments)},d.asm=on,d.then=function(C){if(Rt)C(d);else{var N=d.onRuntimeInitialized;d.onRuntimeInitialized=function(){N&&N(),C(d)}}return d},qe=function C(){Rt||an(),Rt||(qe=C)},d.run=an,d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);d.preInit.length>0;)d.preInit.pop()();function Se(){}function kt(C){return(C||Se).__cache__}function Cn(C,N){var x=kt(N),$=x[C];return $||(($=Object.create((N||Se).prototype)).ptr=C,x[C]=$)}function Te(){throw"cannot construct a VoidPtr, no constructor in IDL"}function pe(){this.ptr=Vn(),kt(pe)[this.ptr]=this}return an(),Se.prototype=Object.create(Se.prototype),Se.prototype.constructor=Se,Se.prototype.__class__=Se,Se.__cache__={},d.WrapperObject=Se,d.getCache=kt,d.wrapPointer=Cn,d.castObject=function(C,N){return Cn(C.ptr,N)},d.NULL=Cn(0),d.destroy=function(C){if(!C.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";C.__destroy__(),delete kt(C.__class__)[C.ptr]},d.compare=function(C,N){return C.ptr===N.ptr},d.getPointer=function(C){return C.ptr},d.getClass=function(C){return C.__class__},Te.prototype=Object.create(Se.prototype),Te.prototype.constructor=Te,Te.prototype.__class__=Te,Te.__cache__={},d.VoidPtr=Te,Te.prototype.__destroy__=Te.prototype.__destroy__=function(){var C=this.ptr;pr(C)},pe.prototype=Object.create(Se.prototype),pe.prototype.constructor=pe,pe.prototype.__class__=pe,pe.__cache__={},d.Container=pe,pe.prototype.init=pe.prototype.init=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),fr($,C,N,x)},pe.prototype.writeFrame=pe.prototype.writeFrame=function(C,N,x){var $=this.ptr;C&&l(C)==="object"&&(C=C.ptr),N&&l(N)==="object"&&(N=N.ptr),x&&l(x)==="object"&&(x=x.ptr),mr($,C,N,x)},pe.prototype.__destroy__=pe.prototype.__destroy__=function(){var C=this.ptr;sn(C)},d});l(e)==="object"&&l(s)==="object"?s.exports=h:(a=function(){return h}.apply(e,[]))===void 0||(s.exports=a)}).call(this,"/index.js",n(2),"/",n(3)(t))}])}},typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope?yl()():nf.exports=yl();const hT=tu(RA.exports);let CA;const Ts="audio/webm;codecs=opus";function pT(t){const e=Q(),n=Q(),r=Q(),i=Q(!1),o=t.mediaRecorder;Z(()=>{t.recordingState==="recording"?s():o.current&&t.recordingState===null&&(i.current=!0,o.current.stop())},[t.recordingState]);const s=async()=>{var l;n.current=Hu.create({scrollingWaveform:!0,scrollingWaveformWindow:10}),e.current=DA({...t.wavesurferOptions,interact:!1,barHeight:(l=t.wavesurferOptions.barHeight)!=null?l:4,plugins:[n.current],container:t.wavesurferContainer.current});const a=await n.current.startMic();MediaRecorder&&MediaRecorder.isTypeSupported(Ts)?o.current=new MediaRecorder(a,{mimeType:Ts}):typeof window!="undefined"&&(o.current=new dT(a,{mimeType:Ts},{encoderWorkerFactory:()=>new hT,WebMOpusEncoderWasmPath:CA})),o.current.onstart=()=>r.current=Date.now(),o.current.ondataavailable=u=>{var c;if(!i.current){const h=Date.now(),d=Math.floor((h-r.current)/1e3),p=new File([u.data],`talkjs_audio_message_${h}_${d}.webm`,{type:"audio/webm"});t.onSendRecording(p,d)}i.current=!1,o.current=void 0,(c=e.current)==null||c.destroy(),e.current=void 0,n.current=void 0},o.current.start()};return null}function IA(t){const e=nt(),n=he(),r=nn(),i=te(n.referencedMessage$),o=te(n.state$.userPermissions),s=xo(),{sendMessage:a}=Wg(),{voiceRecorder:l,recordVoiceMessage:u,voiceRecorderControlsProps:c}=function(){const p=he(),f=Yr(),m=vt({...Cl}),{state:E,duration:A,recordingUrl:_,uploadState:g,fileToken:O}=te(m),D=Q(void 0),R=Q(null),T=Q(),I=ee(()=>{const M=p.state$.currentConversation.peek();M&&M.access!=="Read"&&(m.assign({state:"recording",duration:0}),T.current=setInterval(()=>{m.duration.set(k=>k+1)},1e3))},[m,p]),S=ee(()=>{var M;T.current&&(clearInterval(T.current),T.current=void 0),(M=D.current)==null||M.stop()},[]),v=ee(()=>{T.current&&(clearInterval(T.current),T.current=void 0),m.assign(Cl)},[m]),y=ee((M,k)=>{const P=URL.createObjectURL(new Blob([M])),B=M.size+","+M.name;p.state$.localFileBlobUrls.child(p.state$.currentConversationId.peek()).child(B).set({url:P,fetching:!1});const F={duration:k,filename:M.name};p.latestFileUpload={type:"voice",file:M,metadata:F,temporaryBlobUrl:P},m.assign({state:"previewing",uploadState:"pending",recordingUrl:P+"?name="+M.name}),f.uploadVoice(M,F).then(V=>{m.assign({uploadState:"done",fileToken:V})})},[f,m,p]),b=ee(()=>{O&&f.sendFileMessage({fileToken:O}),m.assign(Cl)},[f,O,m]);return{voiceRecorder:se(()=>{if(!E)return;const M={state:E,duration:A,recordingUrl:_,uploadState:g,stop:S,cancel:v,send:b};return fA.set(M,R),M},[E,A,_,g,S,v,b]),recordVoiceMessage:I,voiceRecorderControlsProps:se(()=>({onSendRecording:y,recordingState:E,mediaRecorder:D,wavesurferOptions:tT,wavesurferContainer:R}),[y,E])}}(),h=te(vt(()=>{const p=s.state$.get();return t.editMessageId===void 0?new Bd(p,a,t.attachFile,t.shareLocation,s.toggleEmojiPicker,u):new Bd(p,t.onEditMessage,()=>{},()=>{},()=>{},()=>{})},[s.state$,s.toggleEmojiPicker,t.attachFile,t.editMessageId,t.onEditMessage,t.shareLocation,a])),d=ee(p=>s.setText(p),[s]);return function({appId:p,conversationId:f,meId:m,setText:E,enabled:A}){const _=se(()=>g_(f,m,p),[p,f,m]);Z(()=>{var O;if(!_||!A)return;const g=(O=JSON.parse(At.getItem(pc)||"{}")[_])!=null?O:"";E(g)},[_,A,E])}({appId:r.app.id,conversationId:r.conversation.id,meId:r.currentUser.id,setText:d,enabled:!t.editMessageId}),L(Fm.Provider,{value:{onClose:()=>s.toggleEmojiPicker(!1),onEmojiSelected:p=>s.selectEmoji(p)},children:[L(pT,{...c}),L(e.MessageField,{common:r,referencedMessage:i,permissions:o,editor:h,voiceRecorder:l,editMessageId:t.editMessageId})]})}function fT({message:t}){const e=he(),n=Yr(),r=te(e.state$.editingMessageId),i=se(()=>cn(t.content[0].children),[t]),o=vt({isEmpty:i.length===0,atTextLimit:!1,characterCount:i.length,showEmojiPicker:!1,suggestEmojiQuery:void 0,suggestMentionQuery:void 0}),s=se(()=>new A_(o,e.device$,e.state$.userPermissions),[o,e]),a=ee(async()=>{const l=s.state$;if(l.isEmpty.peek()||l.atTextLimit.peek())return;const u=s.getText();u&&await n.editMessage(t.id,{text:u}),e.state$.editingMessageId.set(null)},[e,n,s,t.id]);return Z(()=>{s.onEnter=a},[s,a]),Z(()=>{s.focus(),s.setText(cn(t.content[0].children,!0))},[s,t]),L(km.Provider,{value:s,children:L(IA,{editMessageId:r,onEditMessage:a})})}function mT(t){const e=nt(),n=nn();return L(e.MessageDivider,{common:n,...t})}function ET({message:t}){const e=nt(),n=he(),r=te(()=>n.messagePermissions$(t)),i=nn(),[o,s]=ae("sent");return Eo(a=>{if(t.id.startsWith("ephemeral-"))return s("sending");const l=n.state$.currentConversation.everyoneReadUntil.get();return l!==void 0?t.createdAt<=l?s("everyoneRead"):s("sent"):void 0}),L(e.Message,{common:i,message:t,messageStatus:o,permissions:r})}function _T(){const t=nt(),e=nn();return L(t.BeforeMessages,{common:e})}function AT(){const t=nt(),e=nn();return L(t.AfterMessages,{common:e})}function gT(t){const e=he(),n=Mi();Z(()=>function(r,i,o){const s=r.state$.currentConversation;let a=!1;function l(){if(!a){const E=r.state$.currentConversationId.peek();de.defined(E),i.conversation(E).markAsRead()}}function u(){r.newMessageMarker$.peek()||r.newMessageMarker$.set(s.readUntil.peek())}function c(){s.isUnread.get()&&s.unreadMessageCount.peek()===0&&(a=!0,u())}let h=null;function d(){var O;const E=r.state$.currentConversation.lastMessage.id.get(),A=r.state$.currentConversationId.peek(),_=A!==h;if(h=A,_&&(p.stop(),a=!1,r.newMessageMarker$.set(void 0)),!E||!A)return;s.isUnread.peek()&&(o()?(_&&u(),l()):(u(),p.start())),((O=s.lastMessage.sender)==null?void 0:O.id.peek())===r.extUserId$.peek()&&(r.newMessageMarker$.set(void 0),a=!1)}const p={handle:void 0,start(){this.handle||(this.handle=setInterval(()=>this.tick(),2e3))},tick(){o()&&(l(),this.stop())},stop(){clearInterval(this.handle),this.handle=void 0}};window.__talkjsE2E&&(window.__talkjsE2E.foregroundCheck=()=>{de.defined(p.handle),p.tick()});const f=gt(c),m=gt(d);return()=>{r.newMessageMarker$.set(void 0),f(),m(),p.stop()}}(e,n,t),[e,n,t])}function ST({conversationId:t}){const e=he(),n=Yr(),r=Q(!0),i=Q(null),o=te(()=>!!e.state$.messages.child(t).loadedAll.get());Z(()=>n.setScrollableDiv(i),[n]),gT(ee(()=>{if(!i.current)return!1;const a=!document.hidden,l=function(h){if(h.checkVisibility)return h.checkVisibility({contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0,checkOpacity:!0,checkVisibilityCSS:!0});{const d=window.getComputedStyle(h),p=d.visibility,f=d.opacity;return!(h.getClientRects().length===0||p==="hidden"||f==="0")}}(i.current),u=i.current.getBoundingClientRect(),c=u.top<window.innerHeight&&u.bottom>0&&u.left<window.innerWidth&&u.right>0;return a&&l&&c},[])),ft(()=>{r.current=i.current.scrollTop>-30}),Z(()=>{r.current&&(i.current.scrollTop=0)});const s=ee(a=>{const l=a.currentTarget,u=l.scrollHeight-l.clientHeight+l.scrollTop,c=e.messageSubscriptions[t];u<90&&c&&c.loadMore(10)},[e.messageSubscriptions,t]);return L("div",{className:"t-message-list",ref:i,"t-menu-boundary":"",onScroll:s,children:[L(AT,{}),L(mo,{each:e.chatItems$,children:a=>L("div",{className:"t-message-group","t-group-type":a.type.get(),children:L(mo,{each:a.items,item:OT,itemProps:{controller:n,conversationId:t}})},a.id.get())}),o&&L(_T,{})]})}function OT({item$:t}){const e=he(),n=te(t),r=te(e.state$.editingMessageId);return n instanceof fs?L(mT,{timestamp:n.timestamp,isReadMarker:n.isReadMarker,isDayMarker:n.isDayMarker}):r===n.id?L(fT,{message:n}):L(ET,{message:n})}typeof window=="undefined"||MediaRecorder&&MediaRecorder.isTypeSupported(Ts)||async function(){return(await mc(N_["opus-media-recorder-wasm"])).default}().then(t=>CA=t);const DT=new Set(["ByV39eoc","B1FxElnd","aW4c49tW","qGfuGtx","SbERe5ee","ilaVEa15","FOlWOSaH","dao5gGmT","DLUgAhzL","fqXFumr6","FtiWHMYT","66iWOyWt","1375amYi","mWbJgzpt","jO7GqAvL","SkFIKxo5","2z4ILc3y","aDr8oPL1","Hku1c4Pt"]);function ba({appId:t,chatboxState:e}){const n=t.charAt(0)==="t"||DT.has(t);return Z(()=>{switch(e.type){case"auth-failed":$e.error("Could not authenticate user. Check if you are authenticating correctly.");break;case"unknown-user":$e.error(`User \`${e.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":$e.error(e.error);break;case"wrong-app-id":$e.error(`Could not find given appId: "${e.appId}". You can find your appId on https://talkjs.com/dashboard.`);break;case"server-error":break;default:de.never(e)}},[e]),L("div",{className:"t-panel t-error-panel",children:[L("span",{className:"t-heading",children:"Something went wrong"}),L("p",{children:"Please reload the page and try again."}),n?L(Pe,{children:[L("p",{children:"Developer note: check your browser's developer tools console for messages that may help solve the problem."}),L("p",{children:"This message only shows up in test mode."})]}):L("p",{children:"If things keep not working, do not hesitate to get in touch with us."})]})}function vT(){return L("div",{className:"t-panel t-error-panel",children:L("span",{className:"t-heading",children:te(he().t$).CHAT_NOT_FOUND})})}function yA(){return L("div",{className:"t-panel t-loading-panel",children:L(Nu,{})})}function NA(){const t=te(he().t$);return L("div",{className:"t-panel t-error-panel",children:[L("span",{className:"t-heading",children:t.AUTH_EXPIRED_OVERLAY_TITLE}),L("p",{children:t.AUTH_EXPIRED_OVERLAY_DESCRIPTION})]})}const TT=()=>!0;async function Uu(t,e,{initialDelay:n,maxDelay:r,log:i,shouldRetry:o=TT}){return e().catch(async s=>{if(i&&i(`[TalkJS] Retries left: ${t}. Error: ${JSON.stringify(s)}.`),t===0||!await o(s))throw s;const a=1e3*n*1.2,l=Math.min(1e3*r,a),u=l*(1-(c=.05)+2*Math.random()*c);var c,h;return(h=u,h<=0?Promise.resolve():new Promise(d=>setTimeout(d,h))).then(()=>Uu(t-1,e,{initialDelay:u/1e3,maxDelay:r,log:i,shouldRetry:o}))})}function No(){const t={},e=new Promise(function(n,r){t.resolve=n,t.reject=r});return t.promise=e,t}function RT(t,e,n){const{beforeBrowserPermissionPrompt:r,onMissingBrowserPermissionCallback:i}=lr(Lm);return ee(async()=>{function o(c){c==="denied"&&i({type:t})}if(!r||!await async function(c){if(!("permissions"in navigator))return!1;try{return(await navigator.permissions.query({name:c})).state==="prompt"}catch(h){return!1}}(t))return e(c=>{o(c)});const s=No(),a=No(),l={type:t,showPrompt:async()=>(a.resolve({cancelled:!1}),await s.promise),cancel:()=>{a.resolve({cancelled:!0})}};try{r(l)}catch(c){$e.error("Your beforeBrowserPermissionPrompt callback threw an error: ",c),a.resolve({cancelled:!0})}const{cancelled:u}=await a.promise;return u?void 0:e(c=>{s.resolve(c),o(c)})},[r,i,t,e,...n])}function CT({onClose:t}){const e=he(),n=Yr(),r=Mi(),[i,o]=ae(null),s=ee(async l=>{try{if(l||(l=(await new Promise(m=>{const E=document.createElement("input");E.type="file",E.multiple=!1,E.addEventListener("change",()=>{m([...E.files])}),E.addEventListener("cancel",()=>{m([])}),E.click()}))[0]),!l)return;const{uploadPromise:u,upload:c}=await async function(m,E){const A=m.name;if(function(D){return/\.(mp4|ts|mov|webm|ogv)$/i.test(D)}(m.name)){const D=await Nl("video",m,I=>({width:I.videoWidth,height:I.videoHeight,duration:I.duration,filename:A})),R=E.uploadVideo(m,D),T=function(I){switch(I.name.split(".").pop()){case"ts":return"video/MP2T";case"mov":return"video/quicktime";case"webm":return"video/webm";case"ogv":return"video/ogg";default:return"video/mp4"}}(m);return{uploadPromise:R,upload:{type:"video",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m],{type:T}))}}}if(function(D){return/\.(mp3|m4a|ogg|oga|opus|flac|wav)$/i.test(D)}(m.name)){const D=await Nl("audio",m,R=>({duration:R.duration,filename:A}));return{uploadPromise:E.uploadAudio(m,D),upload:{type:"audio",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}if(function(D){return/(gif|png|jpg|jpeg|svg|bmp|webp)$/i.test(D)}(m.name)){const D=await Nl("img",m,R=>({width:R.naturalWidth,height:R.naturalHeight,filename:A}));return{uploadPromise:E.uploadImage(m,D),upload:{type:"image",file:m,metadata:D,temporaryBlobUrl:URL.createObjectURL(new Blob([m]))}}}const _={filename:A},g=E.uploadFile(m,_),O=URL.createObjectURL(new Blob([m]));return{uploadPromise:g,upload:{type:"file",file:m,metadata:_,temporaryBlobUrl:O}}}(l,r),h=c.file.size+","+c.file.name;e.state$.localFileBlobUrls.child(e.state$.currentConversationId.peek()).child(h).set({url:c.temporaryBlobUrl,fetching:!1}),e.latestFileUpload=c;const d=No(),p={upload:c,closePreview:d.resolve,uploaded:!1,errored:!1};let f;o(p);try{f=await rf(u,d.promise),o({...p,uploaded:!0})}catch(m){if(m===bc)return;$e.warn("File upload failed",m.toString()),o(E=>({...E,errored:!0}))}if(await d.promise==="cancel")return;de.defined(f),n.sendFileMessage({fileToken:f})}finally{t(),o(null)}},[n,r,o,e,t]),a=RT("geolocation",async l=>{try{const u=No(),c={upload:{type:"location",location:void 0},uploaded:!1,closePreview:u.resolve,errored:!1};o(c);const{permissionResult:h,location:d}=await rf(new Promise(p=>{navigator.geolocation.getCurrentPosition(f=>{const m={latitude:f.coords.latitude,longitude:f.coords.longitude};p({permissionResult:"granted",location:m})},f=>{f.code===1?p({permissionResult:"denied"}):p({permissionResult:"granted"})})}),u.promise);if(l(h),!d||(o({...c,upload:{type:"location",location:d},uploaded:!0}),await u.promise==="cancel"))return;n.sendLocationMessage({location:d})}catch(u){if(u===bc)return;throw u}finally{t(),o(null)}},[n,o,t]);return{attachFile:s,shareLocation:a,uploadState:i}}const bc=Symbol("cancelled");function rf(t,e){return Promise.race([t,e.then(()=>Promise.reject(bc))])}async function Nl(t,e,n){const r=document.createElement(t);try{return r.src=URL.createObjectURL(e),await new Promise((i,o)=>{const s=t==="img"?"load":"loadedmetadata";r.addEventListener(s,()=>{try{i(n(r))}catch(a){o(a)}},{once:!0})})}finally{URL.revokeObjectURL(r.src)}}function bA({children:t,className:e,...n}){return L("div",{className:"t-attach-overlay "+e,...n,children:t})}function IT({uploadState:t}){const{uploaded:e,errored:n}=t;$o(()=>t.closePreview("cancel"),".t-upload-preview");const r=Q(null);Z(()=>{e&&r.current.focus()},[e]);const i=te(he().t$);return L(bA,{className:"t-upload-preview",children:L("div",{className:"t-preview",children:[!n&&L(yT,{upload:t.upload,uploaded:e}),n&&L("div",{className:"t-error-row",children:i.UPLOAD_ERROR}),L("div",{className:"t-send-row",children:[L("button",{className:"t-cancel",onClick:()=>t.closePreview("cancel"),children:i.CANCEL}),!n&&e&&L("button",{className:"t-confirm-send test__confirm-upload-button",onClick:()=>t.closePreview("send"),ref:r,children:i.SEND_BUTTON_TEXT})]})]})})}function yT({upload:t,uploaded:e}){const n=te(he().t$);return t.type!=="location"?L(Pe,{children:[L(bT,{upload:t}),L(kT,{upload:t,uploaded:e,t:n})]}):e?L(NT,{location:t.location}):L("div",{className:"t-loading",children:L(Nu,{})})}function NT({location:t}){const{imageUrl:e,linkUrl:n}=Fu(t);return L("a",{href:n,target:"_blank",rel:"noreferrer",className:"t-location-upload-preview",style:{background:`url(${JSON.stringify(e)}) center center / cover no-repeat`}})}const bT=Un(function({upload:t}){let e=null;const n=t.file;if(t.type==="video"){const r=/[.]ts/i.test(n.name)?"mpegts":"native";e=L("div",{className:"video-container",children:L(LT,{src:t.temporaryBlobUrl,videoType:r,playsInline:!0,controls:!0,preload:"auto"})})}else t.type==="image"?e=L("div",{className:"t-img-container",children:L("img",{src:t.temporaryBlobUrl})}):t.type==="audio"&&(e=L(Go,{src:t.temporaryBlobUrl,filename:n.name}));return e}),kT=Un(function({uploaded:t,upload:e,t:n}){let r;r=t?e.metadata.filename:n.UPLOAD_IN_PROGRESS;let i="",o="";return e.type==="file"&&(i="is-file",t&&(o="file-block")),L("div",{className:`t-filename-row ${i}`,children:L("div",{className:o,children:r})})});function LT(t){const{videoType:e,...n}=t;return L("video",{...n})}function wT(){var o;const t=nt(),e=he(),n=nn(),r=(o=te(()=>e.state$.isUserConnected.child(e.state$.currentConversationId.get())))!=null?o:{},i=te(e.state$.userPermissions);return L(t.ChatHeader,{common:n,isUserConnected:r,permissions:i})}function MT(){const t=nt(),e=nn();return L(t.MessageListHeader,{common:e})}function PT(){const t=nt(),e=nn();return L(t.MessageListFooter,{common:e})}function xT(){const t=nt(),e=nn();return L(t.NoConversationSelected,{common:e})}function kA({containerRef:t}){const[e,n]=ae(null),[r,i]=ae(null),[o,s]=ae(!1);Z(()=>{const h=t.current;let d=null;const p=f=>{if(f.pointerType!=="mouse")return;d&&(clearTimeout(d),d=null);const m=f.target.closest("[t-tooltip-text]");m&&(d=setTimeout(()=>{d=null,n(m),s(!1)},500))};return h==null||h.addEventListener("pointerover",p),()=>{h==null||h.removeEventListener("pointerover",p)}},[t]),Z(()=>{const h=t.current;let d,p=!1;function f(A){p=!1,A.pointerType!=="mouse"&&(d=setTimeout(()=>{const _=A.target.closest("[t-tooltip-text]");_&&(p=!0,n(_),s(!0))},300))}function m(){clearTimeout(d)}function E(A){p&&(A.stopPropagation(),A.preventDefault())}return h.addEventListener("pointerdown",f),h.addEventListener("pointerup",m),h.addEventListener("pointerleave",m),h.addEventListener("click",E,!0),h.addEventListener("contextmenu",E,!0),()=>{h.removeEventListener("pointerdown",f),h.removeEventListener("pointerup",m),h.removeEventListener("pointerleave",m),h.removeEventListener("click",E,!0),h.removeEventListener("contextmenu",E,!0)}},[t]);const{refs:a,floatingStyles:l}=q_({placement:"top",middleware:[J_(),o&&(u=10,{...g0(u),options:[u,c]})],whileElementsMounted:X_});var u,c;return Z(()=>{if(e){a.setReference(e);const h=()=>{const f=e.getAttribute("t-tooltip-text");f===null?p():i(f.trim())},d=new MutationObserver(h);d.observe(e,{attributes:!0}),h();const p=()=>{o?setTimeout(()=>n(null),1e3):n(null)};return e.addEventListener("pointerleave",p),()=>{e.removeEventListener("pointerleave",p),d.disconnect(),a.setReference(null),i(null)}}},[e,o,a]),r?L("div",{className:"t-tooltip",role:"tooltip",style:l,ref:a.setFloating,children:r}):null}function FT({appId:t,chatHeaderVisible:e,messageFieldVisible:n}){const r=xo(),i=function(){const E=he(),A=vt(()=>{const O=E.errors$.get(),D=E.authTokenState$.get(),R=E.state$.loadingConversationId.get(),T=E.state$.currentConversationId.get();return O.serverError?"server-error":O.wrongAppId?"wrong-app-id":D==="loading"||D==="idle"?"loading-token":D==="invalid"?"invalid-token":D==="expired"?"expired-token":D==="valid"?O.unknownUser?"unknown-user":R&&E.state$.unknownConversations.child(R).get()?"loading-conv-failed":E.canRenderUi(R)||T!==R&&E.canRenderUi(T)?"loaded":"loading-data":void de.unreachable()}),_=vt({type:"loading"});Eo(O=>{const D=A.get(),R=E.state$.currentConversationId.get(),T=E.extUserId$.get(),I=E.appId$.get();function S(v){_.set({type:"loading"});const y=setTimeout(()=>{_.set(v)},5e3);return()=>clearTimeout(y)}switch(D){case"invalid-token":_.set({type:"auth-failed"});break;case"expired-token":_.set({type:"expired-token"});break;case"wrong-app-id":_.set({type:"wrong-app-id",appId:I});break;case"server-error":_.set({type:"server-error"});break;case"loading-data":case"loading-token":_.set({type:"loading"});break;case"loaded":_.set({type:"loaded",conversationId:R,userId:T});break;case"loading-conv-failed":O.onCleanup=S({type:"inaccessible-conversation",userId:T,conversationId:R});break;case"unknown-user":O.onCleanup=S({type:"unknown-user",userId:T});break;default:de.never(D)}});const g=vt({type:"loading"});return Eo(O=>{if(_.type.get()==="loading"){g.set({type:"invisible-loading"});const D=setTimeout(()=>{g.set({type:"loading"})},1e3);O.onCleanup=()=>{clearTimeout(D)}}else g.set(_.get())}),te(g)}(),{attachFile:o,shareLocation:s,uploadState:a}=CT({onClose:()=>r.focus()});Z(()=>{r.uploadFile=o},[r,o]);const[l,u]=ae(!1),c=he(),h=te(()=>c.app$.get()?c.state$.userPermissions.canShareFile.get():void 0);Z(()=>{i.type==="loaded"?c.renderedConversationId$.set(i.conversationId):c.renderedConversationId$.set(void 0)},[i,c]);const d=ee(E=>{o(E.dataTransfer.files[0]),E.preventDefault(),u(!1)},[o]),p=ee(E=>{E.preventDefault(),u(!0)},[]),f=ee(E=>{E.preventDefault(),u(!1)},[]),m=Q(null);return bu(),i.type==="invisible-loading"?L(Pe,{}):i.type==="loading"?L(yA,{}):i.type==="inaccessible-conversation"?L(vT,{}):i.type==="unknown-user"||i.type==="auth-failed"||i.type==="wrong-app-id"||i.type==="server-error"||i.type==="unexpected-error"?L(ba,{appId:t,chatboxState:i}):i.type=="expired-token"?L(NA,{}):i.type==="loaded"?i.conversationId===null?L(xT,{}):L("div",{className:"t-chatbox-content",onDragOver:h?p:void 0,onDragLeave:h?f:void 0,onDrop:h?d:void 0,"t-menu-boundary":"root",ref:m,children:[e&&L(wT,{}),L(MT,{}),L(ST,{conversationId:i.conversationId}),L(PT,{}),n&&L(IA,{attachFile:o,shareLocation:s}),a&&L(IT,{uploadState:a}),l&&L(bA,{className:"t-drop-overlay",children:L(Ys,{type:"attach"})}),L(kA,{containerRef:m})]}):L(Pe,{})}const us=new Uint8Array(31);function LA(){if(globalThis.crypto!==void 0)crypto.getRandomValues(us);else for(let e=0;e<us.length;e++)us[e]=Math.floor(256*Math.random());let t=0;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^us[t++]&15>>+e/4).toString(16))}class HT{constructor(e,n,r,i,o,s,a,l){this.store=e,this.talkSession=n,this.editorInternals=r,this.onSendMessage=i,this.onDeleteMessage=o,this.onMessageAction=s,this.onFocusMessage=a,this.onBackButtonClick=l,this.loadMoreUntil=async u=>{const c=this.store.state$.currentConversationId.peek(),h=this.store.state$.messages.child(c).loadedAll;let d;do{const p=this.store.messageSubscriptions[c];p&&!h.peek()&&await p.loadMore(30),d=u()}while(!h.peek()&&!d);return d}}setScrollableDiv(e){this.scrollable=e}toggleSearchBox(e){if(this.store.state$.userPermissions.canSearch.peek())if(e!==void 0)this.store.chatSearchState$.set(e?"visible":"hidden");else{const n=this.store.chatSearchState$.peek();this.store.chatSearchState$.set(n==="hidden"?"visible":"hidden")}else $e.error("In-conversation message search is only available to customers on Growth plan and above.")}async deleteMessage(e){const n=this.store.state$.currentConversation.peek();if(!n||n.access==="Read")return;const r=n.id,i=this.store.state$.messages.child(r).lookup.child(e).peek(),o=this.talkSession.conversation(r).message(e),[s]=await Promise.all([i!=null?i:o.get(),o.delete()]);if(s){const a={currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek(),message:i};this.onDeleteMessage(a)}}setEditing(e){const n=this.store.state$.currentConversation.peek();n&&n.access!=="Read"&&this.store.state$.editingMessageId.set(e)}async editMessage(e,n){const r=this.store.state$.currentConversation.peek();if(!r||r.access==="Read")return;const i=r.id;await this.talkSession.conversation(i).message(e).edit(n)}setReferencedMessage(e){const n=this.store.state$.currentConversation.peek();n&&n.access!=="Read"&&(this.store.state$.referencedMessageId.set(e),setTimeout(()=>this.editorInternals.focus({skipProseMirrorStuff:!0}),100))}async focusMessage(e,n=!0){var a;if(e==null)return this.store.focusedMessage$.set(null),null;if(await da(()=>this.store.state$.loadingConversationId.get()===this.store.renderedConversationId$.get()),this.store.state$.currentConversationId.peek()===null)return $e.error("Cannot focus message because current conversation is `null`."),null;const r=()=>{const l=this.store.state$.currentConversationId.peek();return this.store.state$.messages.child(l).lookup.child(e).peek()||null};let i=r();if(i||(i=await this.loadMoreUntil(r)),!i)return $e.error(`Message with id: \`${e}\` could not be found in this conversation`),i;const o=(a=this.scrollable)==null?void 0:a.current;de.defined(o);const s=o.querySelector(`[t-message-id="${e}"]`);return s?this.scrollToAndHighlight(s,i,n):$e.error(`Could not find HTMLElement with attribute: t-message-id="${e}"`),i}async jumpToHighlight(e){if(!this.store.state$.userPermissions.canSearch.peek())return $e.error("In-conversation message search is only available to customers on Growth plan and above."),null;if(this.store.highlightedStrings$.peek().length===0||this.store.chatSearchState$.peek()==="searching")return null;let n=this.findHighlight(e);return n||e!=="up"||(this.store.chatSearchState$.set("searching"),n=await this.loadMoreUntil(()=>this.findHighlight("up"))),n}findHighlight(e){var u;const n=(u=this.scrollable)==null?void 0:u.current;de.defined(n);const r=[],i=Array.from(n.querySelectorAll("[t-message-id]")),o=this.store.state$.currentConversationId.peek(),s=this.store.state$.messages.child(o).state.peek();if(i.length===0&&s.length!==0)return $e.error("Could not find HTMLElements with the attribute: t-message-id. This attribute is required for In-Conversation search to work."),null;let a;if(Array.from(n.getElementsByClassName("t-highlighted-text")).forEach(c=>{const h=i.findIndex(f=>f.contains(c));if(h===-1)return;const d=i.splice(h,1)[0],p=d.getAttribute("t-message-id");r.push([p,d])}),e==="up"){const c=n.getBoundingClientRect().top;a=r.find(([h,d])=>d.getBoundingClientRect().top-c<-5)}else{const c=.05*n.getBoundingClientRect().height,h=n.getBoundingClientRect().bottom;for(let d=r.length-1;d>=0;d--){const p=r[d],[f,m]=p;if(h-m.getBoundingClientRect().top<=c){a=p;break}}}const l=this.store.chatSearchState$;if(a){const[c,h]=a,d=this.store.state$.messages.child(o).lookup.child(c).peek();return this.scrollToAndHighlight(h,d),l.set("visible"),d}return r.length===0?l.set("noResults"):l.set("noMoreResults"),null}scrollToAndHighlight(e,n,r=!0){const i=this.scrollable.current.getBoundingClientRect(),o=e.getBoundingClientRect();let s="start";Math.sign(i.top-o.top)===-1&&o.height<i.height&&(s="end"),e instanceof HTMLElement&&(e.style.scrollSnapAlign=s),e.scrollIntoView({behavior:"instant"}),e instanceof HTMLElement&&(e.style.scrollSnapAlign="none"),this.store.focusedMessage$.set(n),r&&this.onFocusMessage({message:n})}setHighlightedStrings(e){this.store.state$.userPermissions.canSearch.peek()?this.store.highlightedStrings$.set(e):$e.error("In-conversation message search and by extension highlighting of strings are only available to customers on Growth plan and above.")}async sendMessage(e){const n=this.store.state$.currentConversationId.peek();if(!n)return;const r=await async function(s,a){var m,E,A,_,g;const l=s.state$.currentConversationId.peek(),u=s.state$.messages.child(l),c=typeof a.referencedMessage=="string"?u.lookup.child(a.referencedMessage).peek():await((E=(m=a.referencedMessage)==null?void 0:m.get())!=null?E:null),h=c&&{...c,type:"UserMessage",sender:c.sender,referencedMessageId:(_=(A=c.referencedMessage)==null?void 0:A.id)!=null?_:null};h&&delete h.referencedMessage;const d=s.latestFileUpload,p="content"in a?[of(d,a.content[0])]:[UT(a.text)],f="text"in a?a.text:EA(a.content.map(O=>of(d,O)),{});return{id:"ephemeral-"+LA(),type:"UserMessage",sender:s.currentUser$.peek(),createdAt:Date.now(),editedAt:null,custom:(g=a.custom)!=null?g:{},origin:"web",referencedMessage:h,reactions:[],content:p,plaintext:f}}(this.store,e);this.store.state$.ephemeralMessages.child(n).child(r.id).set(r);const i=No();this.store.readyForNewMessagesPromise=i.promise;const o=await this.talkSession.conversation(n).send(e);this.store.state$.ephemeralMessageIdMapping.child(n).child(o.id).set(r.id),i.resolve(),this.onSendMessage({message:await o.get(),currentUser:this.store.currentUser$.peek(),conversation:this.store.state$.currentConversation.peek()})}sendFileMessage(e){const n={type:"file",fileToken:e.fileToken};return this.sendMessage({content:[n],custom:e.custom})}async uploadVoice(e,n){return await this.talkSession.uploadVoice(e,n)}sendLocationMessage(e){const n={type:"location",latitude:e.location.latitude,longitude:e.location.longitude};return this.sendMessage({content:[n],custom:e.custom})}markAsTyping(){const e=this.store.state$.currentConversationId.peek();e&&this.talkSession.conversation(e).markAsTyping()}async toggleReaction(e,n,r){typeof n!="string"&&(n=n.emoji);const i=this.store.state$.currentConversationId.peek();if(!i)return;const o=this.store.state$.messages.child(i).lookup.child(e).peek().reactions.find(a=>a.emoji===n),s=this._getReactionRef(e,n);o!=null&&o.currentUserReacted&&r!==!0?await s.remove():r!==!1&&await s.add()}async addReaction(e,n){this.store.state$.currentConversationId.peek()&&await this._getReactionRef(e,n).add()}triggerMessageAction(e,n,r){const i=this.store.state$.currentConversation.peek();i&&(typeof e=="string"&&(e=this.store.state$.messages.child(i.id).lookup.child(e).peek()),this.onMessageAction({action:n,params:r,message:e,conversation:i}))}clickBackButton(){const e=this.store.currentUser$.peek();de.defined(e),this.onBackButtonClick({currentUser:e})}storeDraft(e){const n=this.store.state$.currentConversationId.peek(),r=this.store.currentUser$.peek(),i=this.store.appId$.peek();n&&r&&i&&gv(n,r.id,i,e)}_getReactionRef(e,n){const r=this.store.state$.currentConversationId.peek();return this.talkSession.conversation(r).message(e).reaction(n)}}const UT=t=>({type:"text",children:p_(t)});function of(t,e){switch(e.type){case"text":case"location":return e;case"file":return function(n,r){return{type:"file",subtype:n.type==="file"?void 0:n.type,...n.metadata,size:n.file.size,filename:n.file.name,fileToken:r.fileToken,url:n.temporaryBlobUrl}}(t,e)}}class bl extends Error{constructor(e,n){const r=function(i){if(typeof i=="string")return i;if(Array.isArray(i))return i.join(`
|
|
105
105
|
`);try{return JSON.stringify(i)}catch(o){return String(i)}}(e);super(r),this.userMessage=n!=null?n:r,Object.setPrototypeOf&&Object.setPrototypeOf(this,new.target.prototype)}}const bo=console;class BT{constructor(e,n,r,i){this.apiUrls=e,this.appId=n,this.sessionId=r,this.authProvider=i,this._lastPutPromise=Promise.resolve()}async get(e,n={}){const r=this.endpointUrl(e,n),i=await zi(()=>this.fetchWithReauth(r),{retries:11});return await this.handleResponse(i,r)}async queuedPut(e,n){await this._lastPutPromise;const r=zi(()=>this._doPut(e,n));return this._lastPutPromise=r,r}put(e,n,r){const i=()=>this._doPut(e,n);return r?sf(i,r):zi(i,{retries:5})}post(e,n,r){const i=()=>this._doPost(e,n);return r?sf(i,r):zi(i,{retries:5})}delete(e,n={}){return zi(()=>this._doDelete(e,n),{retries:11})}endpointUrl(e,n={}){const r=new URL(this.apiUrls.internalHttpApiUrl);r.pathname+=`/${this.appId}/${e}`,r.searchParams.set("sessionId",this.sessionId);for(const[i,o]of Object.entries(n))r.searchParams.set(i,o);return r}async _doPut(e,n){const r=this.endpointUrl(e),i=await this.fetchWithReauth(r,{method:"PUT",body:JSON.stringify(n)});return await this.handleResponse(i,r)}async _doPost(e,n){const r=this.endpointUrl(e),i=await this.fetchWithReauth(r,{method:"POST",body:JSON.stringify(n)});return await this.handleResponse(i,r)}async _doDelete(e,n){const r=this.endpointUrl(e,n),i=await this.fetchWithReauth(r,{method:"DELETE"});return await this.handleResponse(i,r)}async handleResponse(e,n){if(e.status>=300){if(e.status===404)throw Yl.error(`[${this.appId}][BackendRestClient] Couldn't find resource.`),new bl("Could not find app.",`Could not find given appId: "${this.appId}". You can find your appId on https://talkjs.com/dashboard.`);if(e.status===401){const r=await this.authProvider.getToken();throw Yl.error(`[${this.appId}][BackendRestClient] Couldn't authenticate ${n} with token ${r}.`),new bl("User not authenticated.","Could not authenticate user. Check if your signature is calculated correctly.")}if(e.status>=300&&e.status<500){const{error:r}=await e.json();throw new bl(r)}{const r=await e.text();throw new Error(`Got non-success response (${r}) from the server for url: ${n}.`)}}return await e.json()}async fetchWithReauth(e,n){function r(s){const a={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${s}`};return fetch(e,{...n,headers:a})}const i=await this.authProvider.getToken(),o=await r(i);return o.status!==401?o:(bo.error(`401 error from ${n==null?void 0:n.method} ${e}, ${i}`),this.authProvider.refreshToken(),r(await this.authProvider.getToken()))}}function wA(t){return!t.userMessage}function zi(t,{retries:e=30}={}){return Uu(e,t,{shouldRetry:wA,log:bo.warn.bind(bo),maxDelay:30,initialDelay:.2})}async function sf(t,e){try{return await t()}catch(r){if(!wA(r))throw r}let n=!1;return e.then(()=>{n=!0}),Uu(1e3,t,{initialDelay:.2,maxDelay:30,shouldRetry:()=>!n,log:bo.warn.bind(bo)})}var kc={exports:{}};(function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",o="[object Function]",s="[object Object]",a=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[i]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u[o]=u["[object Map]"]=u["[object Number]"]=u[s]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1;var c=typeof Zo=="object"&&Zo&&Zo.Object===Object&&Zo,h=typeof self=="object"&&self&&self.Object===Object&&self,d=c||h||Function("return this")(),p=e&&!e.nodeType&&e,f=p&&t&&!t.nodeType&&t,m=f&&f.exports===p,E=m&&c.process,A=function(){try{var w=f&&f.require&&f.require("util").types;return w||E&&E.binding&&E.binding("util")}catch(H){}}(),_=A&&A.isTypedArray,g,O=Array.prototype,D=Function.prototype,R=Object.prototype,T=d["__core-js_shared__"],I=D.toString,S=R.hasOwnProperty,v=(g=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",y=R.toString,b=I.call(Object),M=RegExp("^"+I.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),k=m?d.Buffer:void 0,P=d.Symbol,B=d.Uint8Array;k&&k.allocUnsafe;var F,V,G=(F=Object.getPrototypeOf,V=Object,function(w){return F(V(w))}),z=Object.create,K=R.propertyIsEnumerable,_e=O.splice,ie=P?P.toStringTag:void 0,ue=function(){try{var w=Er(Object,"defineProperty");return w({},"",{}),w}catch(H){}}(),le=k?k.isBuffer:void 0,Ie=Math.max,$t=Date.now,rt=Er(d,"Map"),ye=Er(Object,"create"),Ke=function(){function w(){}return function(H){if(!Y(H))return{};if(z)return z(H);w.prototype=H;var j=new w;return w.prototype=void 0,j}}();function Jt(w){var H=-1,j=w==null?0:w.length;for(this.clear();++H<j;){var q=w[H];this.set(q[0],q[1])}}function ve(w){var H=-1,j=w==null?0:w.length;for(this.clear();++H<j;){var q=w[H];this.set(q[0],q[1])}}function qe(w){var H=-1,j=w==null?0:w.length;for(this.clear();++H<j;){var q=w[H];this.set(q[0],q[1])}}function we(w){var H=this.__data__=new ve(w);this.size=H.size}function dr(w,H){var j=C(w),q=!j&&pe(w),fe=!j&&!q&&x(w),xe=!j&&!q&&!fe&&Re(w),Ne=j||q||fe||xe,Et=Ne?function(it,yn){for(var It=-1,Kr=Array(it);++It<it;)Kr[It]=yn(It);return Kr}(w.length,String):[],Ct=Et.length;for(var Fe in w)Ne&&(Fe=="length"||fe&&(Fe=="offset"||Fe=="parent")||xe&&(Fe=="buffer"||Fe=="byteLength"||Fe=="byteOffset")||an(Fe,Ct))||Et.push(Fe);return Et}function Rn(w,H,j){(j!==void 0&&!Te(w[H],j)||j===void 0&&!(H in w))&&Je(w,H,j)}function Ge(w,H,j){var q=w[H];S.call(w,H)&&Te(q,j)&&(j!==void 0||H in w)||Je(w,H,j)}function rn(w,H){for(var j=w.length;j--;)if(Te(w[j][0],H))return j;return-1}function Je(w,H,j){H=="__proto__"&&ue?ue(w,H,{configurable:!0,enumerable:!0,value:j,writable:!0}):w[H]=j}Jt.prototype.clear=function(){this.__data__=ye?ye(null):{},this.size=0},Jt.prototype.delete=function(w){var H=this.has(w)&&delete this.__data__[w];return this.size-=H?1:0,H},Jt.prototype.get=function(w){var H=this.__data__;if(ye){var j=H[w];return j===n?void 0:j}return S.call(H,w)?H[w]:void 0},Jt.prototype.has=function(w){var H=this.__data__;return ye?H[w]!==void 0:S.call(H,w)},Jt.prototype.set=function(w,H){var j=this.__data__;return this.size+=this.has(w)?0:1,j[w]=ye&&H===void 0?n:H,this},ve.prototype.clear=function(){this.__data__=[],this.size=0},ve.prototype.delete=function(w){var H=this.__data__,j=rn(H,w);return!(j<0)&&(j==H.length-1?H.pop():_e.call(H,j,1),--this.size,!0)},ve.prototype.get=function(w){var H=this.__data__,j=rn(H,w);return j<0?void 0:H[j][1]},ve.prototype.has=function(w){return rn(this.__data__,w)>-1},ve.prototype.set=function(w,H){var j=this.__data__,q=rn(j,w);return q<0?(++this.size,j.push([w,H])):j[q][1]=H,this},qe.prototype.clear=function(){this.size=0,this.__data__={hash:new Jt,map:new(rt||ve),string:new Jt}},qe.prototype.delete=function(w){var H=sn(this,w).delete(w);return this.size-=H?1:0,H},qe.prototype.get=function(w){return sn(this,w).get(w)},qe.prototype.has=function(w){return sn(this,w).has(w)},qe.prototype.set=function(w,H){var j=sn(this,w),q=j.size;return j.set(w,H),this.size+=j.size==q?0:1,this},we.prototype.clear=function(){this.__data__=new ve,this.size=0},we.prototype.delete=function(w){var H=this.__data__,j=H.delete(w);return this.size=H.size,j},we.prototype.get=function(w){return this.__data__.get(w)},we.prototype.has=function(w){return this.__data__.has(w)},we.prototype.set=function(w,H){var j=this.__data__;if(j instanceof ve){var q=j.__data__;if(!rt||q.length<199)return q.push([w,H]),this.size=++j.size,this;j=this.__data__=new qe(q)}return j.set(w,H),this.size=j.size,this};var Fi=function(w,H,j){for(var q=-1,fe=Object(w),xe=j(w),Ne=xe.length;Ne--;){var Et=xe[++q];if(H(fe[Et],Et,fe)===!1)break}return w};function on(w){return w==null?w===void 0?"[object Undefined]":"[object Null]":ie&&ie in Object(w)?function(H){var j=S.call(H,ie),q=H[ie];try{H[ie]=void 0;var fe=!0}catch(Ne){}var xe=y.call(H);return fe&&(j?H[ie]=q:delete H[ie]),xe}(w):function(H){return y.call(H)}(w)}function Rt(w){return ne(w)&&on(w)==i}function hr(w){return!(!Y(w)||function(H){return!!v&&v in H}(w))&&($(w)?M:a).test(function(H){if(H!=null){try{return I.call(H)}catch(j){}try{return H+""}catch(j){}}return""}(w))}function pr(w){if(!Y(w))return function(fe){var xe=[];if(fe!=null)for(var Ne in Object(fe))xe.push(Ne);return xe}(w);var H=Se(w),j=[];for(var q in w)(q!="constructor"||!H&&S.call(w,q))&&j.push(q);return j}function Vn(w,H,j,q,fe){w!==H&&Fi(H,function(xe,Ne){if(fe||(fe=new we),Y(xe))(function(Ct,Fe,it,yn,It,Kr,Hi){var ln=kt(Ct,it),yt=kt(Fe,it),Vu=Hi.get(yt);if(Vu)return void Rn(Ct,it,Vu);var Lt=Kr?Kr(ln,yt,it+"",Ct,Fe,Hi):void 0,Ui=Lt===void 0;if(Ui){var ka=C(yt),La=!ka&&x(yt),zu=!ka&&!La&&Re(yt);Lt=yt,ka||La||zu?C(ln)?Lt=ln:ne(Yu=ln)&&N(Yu)?Lt=function(Ze,Vt){var dt=-1,wt=Ze.length;for(Vt||(Vt=Array(wt));++dt<wt;)Vt[dt]=Ze[dt];return Vt}(ln):La?(Ui=!1,Lt=yt.slice()):zu?(Ui=!1,Lt=function(Ze){var Vt=(dt=Ze.buffer,wt=new dt.constructor(dt.byteLength),new B(wt).set(new B(dt)),wt),dt,wt;return new Ze.constructor(Vt,Ze.byteOffset,Ze.length)}(yt)):Lt=[]:function(Ze){if(!ne(Ze)||on(Ze)!=s)return!1;var Vt=G(Ze);if(Vt===null)return!0;var dt=S.call(Vt,"constructor")&&Vt.constructor;return typeof dt=="function"&&dt instanceof dt&&I.call(dt)==b}(yt)||pe(yt)?(Lt=ln,pe(ln)?Lt=function(Ze){return function(Vt,dt,wt){var jA=!wt;wt||(wt={});for(var Gu=-1,$A=dt.length;++Gu<$A;){var wa=dt[Gu],Wo=void 0;Wo===void 0&&(Wo=Vt[wa]),jA?Je(wt,wa,Wo):Ge(wt,wa,Wo)}return wt}(Ze,Me(Ze))}(ln):Y(ln)&&!$(ln)||(Lt=function(Ze){return typeof Ze.constructor!="function"||Se(Ze)?{}:Ke(G(Ze))}(yt))):Ui=!1}var Yu;Ui&&(Hi.set(yt,Lt),It(Lt,yt,yn,Kr,Hi),Hi.delete(yt)),Rn(Ct,it,Lt)})(w,H,Ne,j,Vn,q,fe);else{var Et=q?q(kt(w,Ne),xe,Ne+"",w,H,fe):void 0;Et===void 0&&(Et=xe),Rn(w,Ne,Et)}},Me)}function fr(w,H){return Cn(function(j,q,fe){return q=Ie(q===void 0?j.length-1:q,0),function(){for(var xe=arguments,Ne=-1,Et=Ie(xe.length-q,0),Ct=Array(Et);++Ne<Et;)Ct[Ne]=xe[q+Ne];Ne=-1;for(var Fe=Array(q+1);++Ne<q;)Fe[Ne]=xe[Ne];return Fe[q]=fe(Ct),function(it,yn,It){switch(It.length){case 0:return it.call(yn);case 1:return it.call(yn,It[0]);case 2:return it.call(yn,It[0],It[1]);case 3:return it.call(yn,It[0],It[1],It[2])}return it.apply(yn,It)}(j,this,Fe)}}(w,H,$u),w+"")}var mr=ue?function(w,H){return ue(w,"toString",{configurable:!0,enumerable:!1,value:(j=H,function(){return j}),writable:!0});var j}:$u;function sn(w,H){var j,q,fe=w.__data__;return((q=typeof(j=H))=="string"||q=="number"||q=="symbol"||q=="boolean"?j!=="__proto__":j===null)?fe[typeof H=="string"?"string":"hash"]:fe.map}function Er(w,H){var j=function(q,fe){return q==null?void 0:q[fe]}(w,H);return hr(j)?j:void 0}function an(w,H){var j=typeof w;return!!(H=H==null?r:H)&&(j=="number"||j!="symbol"&&l.test(w))&&w>-1&&w%1==0&&w<H}function Se(w){var H=w&&w.constructor;return w===(typeof H=="function"&&H.prototype||R)}function kt(w,H){if((H!=="constructor"||typeof w[H]!="function")&&H!="__proto__")return w[H]}var Cn=function(w){var H=0,j=0;return function(){var q=$t(),fe=16-(q-j);if(j=q,fe>0){if(++H>=800)return arguments[0]}else H=0;return w.apply(void 0,arguments)}}(mr);function Te(w,H){return w===H||w!=w&&H!=H}var pe=Rt(function(){return arguments}())?Rt:function(w){return ne(w)&&S.call(w,"callee")&&!K.call(w,"callee")},C=Array.isArray;function N(w){return w!=null&&W(w.length)&&!$(w)}var x=le||function(){return!1};function $(w){if(!Y(w))return!1;var H=on(w);return H==o||H=="[object GeneratorFunction]"||H=="[object AsyncFunction]"||H=="[object Proxy]"}function W(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=r}function Y(w){var H=typeof w;return w!=null&&(H=="object"||H=="function")}function ne(w){return w!=null&&typeof w=="object"}var Re=_?function(w){return function(H){return w(H)}}(_):function(w){return ne(w)&&W(w.length)&&!!u[on(w)]};function Me(w){return N(w)?dr(w):pr(w)}var In,BA=(In=function(w,H,j){Vn(w,H,j)},fr(function(w,H){var j=-1,q=H.length,fe=q>1?H[q-1]:void 0,xe=q>2?H[2]:void 0;for(fe=In.length>3&&typeof fe=="function"?(q--,fe):void 0,xe&&function(Et,Ct,Fe){if(!Y(Fe))return!1;var it=typeof Ct;return!!(it=="number"?N(Fe)&&an(Ct,Fe.length):it=="string"&&Ct in Fe)&&Te(Fe[Ct],Et)}(H[0],H[1],xe)&&(fe=q<3?void 0:fe,q=1),w=Object(w);++j<q;){var Ne=H[j];Ne&&In(w,Ne,j,fe)}return w}));function $u(w){return w}t.exports=BA})(kc,kc.exports);const jT=tu(kc.exports);class $T{constructor(e,n,r,i){this.backendRestClient=new BT(e,n,r,i)}async getApp(e){return function(n){const r=function(s,a){const l={general:{enableFileTransfers:a.includes("file_sharing"),enableLocation:a.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}},
|
|
106
106
|
{{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}},
|
|
107
107
|
The {{app.name}} team`,enableReplyToEmail:a.includes("reply_via_email"),emailThemeType:a.includes("email_templates")?"custom":"standard",emailTheme:"default_email",emailAttachmentMode:"enabledExcludingImages",htmlTemplate:`<div>
|
|
@@ -191,13 +191,13 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
191
191
|
</span>
|
|
192
192
|
`)}
|
|
193
193
|
</span>
|
|
194
|
-
`:U`<span className="t-participants">${o.map(({user:s})=>s.name).join(", ")}</span>`}function sR({common:t}){return null}function aR(t){const{message:e,messageStatus:n,permissions:r,common:i}=t,{currentUser:o,theme:s,
|
|
194
|
+
`:U`<span className="t-participants">${o.map(({user:s})=>s.name).join(", ")}</span>`}function sR({common:t}){return null}function aR(t){const{message:e,messageStatus:n,permissions:r,common:i}=t,{currentUser:o,theme:s,conversation:a,conversationId:l,t:u,focusedMessage:c}=i,{Avatar:h,Icon:d,ReferencedMessage:p,TimeAgo:f,MessageActionMenu:m}=s,E=Yo(l,3).length>=3,A=e.sender,_=(A==null?void 0:A.id)!==o.id&&E,g=e.referencedMessage,O=r.canReplyToMessage||r.canDeleteMessage,D=r.canAddReaction&&a.access==="ReadWrite";let R;R=A?A.id===o.id?"currentUser":"other":"system";const T=e.id===(c==null?void 0:c.id);return U`
|
|
195
195
|
<div
|
|
196
196
|
className="t-theme-message"
|
|
197
|
-
t-sender=${
|
|
197
|
+
t-sender=${R}
|
|
198
198
|
t-message-id=${e.id}
|
|
199
199
|
t-status=${n}
|
|
200
|
-
t-focused=${
|
|
200
|
+
t-focused=${T?"":void 0}
|
|
201
201
|
>
|
|
202
202
|
<div className="t-message-row">
|
|
203
203
|
${A&&U`<${h}
|
|
@@ -226,7 +226,7 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
226
226
|
|
|
227
227
|
<div className="t-message-status">
|
|
228
228
|
<${f} timestamp=${e.createdAt} common=${i} />
|
|
229
|
-
${
|
|
229
|
+
${R=="currentUser"&&U`<${cR} ...${t} />`}
|
|
230
230
|
</div>
|
|
231
231
|
</div>
|
|
232
232
|
|
|
@@ -241,7 +241,7 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
241
241
|
<${d} className="t-action-menu-icon" type="horizontalDots" />
|
|
242
242
|
</${li}>
|
|
243
243
|
`}
|
|
244
|
-
${
|
|
244
|
+
${D&&U`
|
|
245
245
|
<${li}
|
|
246
246
|
className="t-add-reaction-button"
|
|
247
247
|
popoverComponent=${b_}
|
|
@@ -255,9 +255,9 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
255
255
|
|
|
256
256
|
${e.reactions.length>0&&U`
|
|
257
257
|
<div className="t-emoji-reactions">
|
|
258
|
-
${e.reactions.map(
|
|
259
|
-
key=${
|
|
260
|
-
summary=${
|
|
258
|
+
${e.reactions.map(I=>U`<${lR}
|
|
259
|
+
key=${I.emoji}
|
|
260
|
+
summary=${I}
|
|
261
261
|
message=${e}
|
|
262
262
|
common=${i}
|
|
263
263
|
permissions=${r}
|
|
@@ -304,7 +304,7 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
304
304
|
${o.DELETE_MESSAGE}
|
|
305
305
|
</${Kn}>
|
|
306
306
|
`}
|
|
307
|
-
</div>`}function dR(t){const{common:e,referencedMessage:n,editor:r,voiceRecorder:i,permissions:o,editMessageId:s}=t,{chatbox:a,device:l,conversation:u,t:c,theme:h}=e,{ReplyBar:d,Icon:p,VoiceRecorder:f,RecordingPreview:m}=h,E=s?"edit":"send",A=!r.atTextLimit&&!r.isEmpty,_=E==="send"&&r.isEmpty&&o.canShareLocation,g=E==="send"&&r.isEmpty&&o.canShareFile,O=E==="send"&&l.supportsEmojiPicker&&!l.isMobile,D=E==="send"&&r.isEmpty&&o.canSendVoiceMessage;return U`
|
|
307
|
+
</div>`}function dR(t){const{common:e,referencedMessage:n,editor:r,voiceRecorder:i,permissions:o,editMessageId:s}=t,{chatbox:a,device:l,conversation:u,t:c,theme:h}=e,{ReplyBar:d,Icon:p,VoiceRecorder:f,RecordingPreview:m}=h,E=s?"edit":"send",A=!r.atTextLimit&&!r.isEmpty&&u.access==="ReadWrite",_=E==="send"&&r.isEmpty&&o.canShareLocation,g=E==="send"&&r.isEmpty&&o.canShareFile,O=E==="send"&&l.supportsEmojiPicker&&!l.isMobile,D=E==="send"&&r.isEmpty&&o.canSendVoiceMessage,R=!i&&u.access==="ReadWrite";return U`
|
|
308
308
|
<div className="t-theme-message-field" t-mode=${E}>
|
|
309
309
|
${r.showEmojiPicker&&U`
|
|
310
310
|
<div className="t-emoji-picker-wrapper">
|
|
@@ -320,27 +320,26 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
320
320
|
/>`}
|
|
321
321
|
|
|
322
322
|
<div className="t-wrapper">
|
|
323
|
-
${r.atTextLimit&&U
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
${r.atTextLimit&&U`
|
|
324
|
+
<div className="t-text-limit-indicator">${c.ENTRYBOX_TEXT_LIMIT}</div>
|
|
325
|
+
`}
|
|
326
|
+
|
|
326
327
|
<div className="t-text-form">
|
|
327
328
|
${u.access==="Read"&&U`
|
|
328
329
|
<div className="t-readonly">
|
|
329
330
|
${c.ENTRYBOX_PLACEHOLDER_CHAT_READONLY}
|
|
330
331
|
</div>
|
|
331
332
|
`}
|
|
332
|
-
${
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
`)}
|
|
343
|
-
${!i&&u.access==="ReadWrite"&&U`
|
|
333
|
+
${(i==null?void 0:i.state)==="recording"&&U`
|
|
334
|
+
<${f} common=${e} voiceRecorder=${i} />
|
|
335
|
+
`}
|
|
336
|
+
${(i==null?void 0:i.state)==="previewing"&&U`
|
|
337
|
+
<${m}
|
|
338
|
+
common=${e}
|
|
339
|
+
voiceRecorder=${i}
|
|
340
|
+
/>
|
|
341
|
+
`}
|
|
342
|
+
${R&&U`
|
|
344
343
|
<div className="t-textbox-column">
|
|
345
344
|
<${__} placeholder=${c.ENTRYBOX_PLACEHOLDER} />
|
|
346
345
|
|
|
@@ -378,7 +377,7 @@ The {{app.name}} team`},smsSettings:{enabled:a.includes("sms_notifications"),sms
|
|
|
378
377
|
</div>
|
|
379
378
|
</div>
|
|
380
379
|
`}
|
|
381
|
-
${E==="send"
|
|
380
|
+
${E==="send"&&R&&U`
|
|
382
381
|
<div className="t-send-column">
|
|
383
382
|
${D&&U`<button
|
|
384
383
|
className="t-record-button"
|