phanpy-cz/assets/compose-xua1VIA2.js
2024-10-16 19:47:13 +02:00

27 lines
82 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Dt=s=>{throw TypeError(s)};var mt=(s,t,n)=>t.has(s)||Dt("Cannot "+n);var B=(s,t,n)=>(mt(s,t,"read from private field"),n?n.call(s):t.get(s)),oe=(s,t,n)=>t.has(s)?Dt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),me=(s,t,n,a)=>(mt(s,t,"write to private field"),a?a.call(s,n):t.set(s,n),n),Y=(s,t,n)=>(mt(s,t,"access private method"),n);import{i as ge,z as vn,s as le,V as Jt,j as Ke,a as _t,h as q,A as V,M as bn,aD as Qt,d as Se,y as te,x as yn,aE as xn,l as je,c as e,T as K,b as wn,f as Pe,w as at,r as kn,af as En,P as Fn,u as Cn,t as $t,C as en}from"./useTitle-B8ZF9tfB.js";import{j as Fe,F as zn,_ as _n,a as $e,a8 as Ln,x as jt,u as An,k as tn,b as Sn,I as Z,z as Pt,i as Je,a9 as In,l as xt,M as Qe,s as ze,a4 as Mn,a0 as Bn,q as Tn,P as Rn,X as rt,c as Dn,d as Ot,y as $n}from"./fuse-RZOrQKm7.js";class jn{constructor(t,n,{tabInsertsSuggestions:a,defaultFirstOption:c}={}){this.input=t,this.list=n,this.tabInsertsSuggestions=a??!0,this.defaultFirstOption=c??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=l=>Pn(l,this),this.compositionEventHandler=l=>Hn(l,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",n.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",Ht),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",Ht)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(gt)[0])===null||t===void 0||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){const n=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(gt)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(gt),c=a.indexOf(n);if(c===a.length-1&&t===1||c===0&&t===-1){this.clearSelection(),this.input.focus();return}let l=t===1?0:a.length-1;if(n&&c>=0){const x=c+t;x>=0&&x<a.length&&(l=x)}const o=a[l];if(o)for(const x of a)x.removeAttribute("data-combobox-option-default"),o===x?(this.input.setAttribute("aria-activedescendant",o.id),o.setAttribute("aria-selected","true"),Nn(this.list,o)):x.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.removeAttribute("aria-selected");this.indicateDefaultOption()}}function Pn(s,t){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!t.ctrlBindings&&s.ctrlKey)&&!t.isComposing)switch(s.key){case"Enter":Nt(t.input,t.list)&&s.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&Nt(t.input,t.list)&&s.preventDefault();break;case"Escape":t.clearSelection();break;case"ArrowDown":t.navigate(1),s.preventDefault();break;case"ArrowUp":t.navigate(-1),s.preventDefault();break;case"n":t.ctrlBindings&&s.ctrlKey&&(t.navigate(1),s.preventDefault());break;case"p":t.ctrlBindings&&s.ctrlKey&&(t.navigate(-1),s.preventDefault());break;default:if(s.ctrlKey)break;t.clearSelection()}}function Ht(s){if(!(s.target instanceof Element))return;const t=s.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&On(t)}function Nt(s,t){const n=t.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return n?(n.getAttribute("aria-disabled")==="true"||n.click(),!0):!1}function On(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function gt(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function Hn(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Nn(s,t){qn(s,t)||(s.scrollTop=t.offsetTop)}function qn(s,t){const n=s.scrollTop,a=n+s.clientHeight,c=t.offsetTop,l=c+t.clientHeight;return c>=n&&l<=a}const Kn=/\s|\(|\[/;function Wn(s,t,n,{multiWord:a,lookBackIndex:c,lastMatchPosition:l}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let o=s.lastIndexOf(t,n-1);if(o===-1||o<c)return;if(a){if(l!=null){if(l===o)return;o=l-t.length}if(s[o+1]===" "&&n>=o+t.length+1||s.lastIndexOf(`
`,n-1)>o||s.lastIndexOf(".",n-1)>o)return}else if(s.lastIndexOf(" ",n-1)>o)return;const x=s[o-1];return x&&!Kn.test(x)?void 0:{text:s.substring(o+t.length,n),position:o+t.length}}class Un extends HTMLElement{}class Vn extends Event{constructor(){super("update")}}const ft=new WeakMap;var Oe,He,Ne,xe,W,wt,Ae,Ie,Me,kt,Be,et,tt,nt,qe,_e;const At=class At extends Un{constructor(){super(...arguments);oe(this,W);oe(this,Oe,new MutationObserver(()=>Y(this,W,tt).call(this)));oe(this,He,new ResizeObserver(()=>Y(this,W,et).call(this)));oe(this,Ne);oe(this,xe);oe(this,Ie,0);oe(this,Me,0);oe(this,Be,!1);oe(this,qe,()=>Y(this,W,nt).call(this));oe(this,_e,n=>{Y(this,W,Ae).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&Y(this,W,et).call(this)})})}static for(n){let a=ft.get(n);return a||(a=new At,a.connect(n),ft.set(n,a)),a}connect(n){me(this,Ne,new WeakRef(n)),me(this,xe,document.createElement("div")),B(this,xe).style.position="absolute",B(this,xe).style.pointerEvents="none",n.after(B(this,xe)),B(this,xe).appendChild(this)}forceUpdate(){Y(this,W,tt).call(this),Y(this,W,nt).call(this)}connectedCallback(){Y(this,W,Ae).call(this,n=>{this.style.pointerEvents="none",this.style.userSelect="none",this.style.overflow="hidden",this.style.display="block",this.style.visibility="hidden",n instanceof HTMLTextAreaElement?(this.style.whiteSpace="pre-wrap",this.style.wordWrap="break-word"):(this.style.whiteSpace="nowrap",this.style.display="table-cell",this.style.verticalAlign="middle"),this.setAttribute("aria-hidden","true"),Y(this,W,tt).call(this),Y(this,W,nt).call(this),B(this,Oe).observe(n,{attributeFilter:["style","dir"]}),B(this,He).observe(n),document.addEventListener("scroll",B(this,_e),{capture:!0}),window.addEventListener("resize",B(this,_e),{capture:!0}),n.addEventListener("input",B(this,qe),{capture:!0})})}disconnectedCallback(){var a;(a=B(this,xe))==null||a.remove(),B(this,Oe).disconnect(),B(this,He).disconnect(),document.removeEventListener("scroll",B(this,_e),{capture:!0}),window.removeEventListener("resize",B(this,_e),{capture:!0});const n=B(this,W,wt);n&&(n.removeEventListener("input",B(this,qe),{capture:!0}),ft.delete(n))}};Oe=new WeakMap,He=new WeakMap,Ne=new WeakMap,xe=new WeakMap,W=new WeakSet,wt=function(){var n;return(n=B(this,Ne))==null?void 0:n.deref()},Ae=function(n){const a=B(this,W,wt);return a?n(a):this.remove()},Ie=new WeakMap,Me=new WeakMap,kt=function(){Y(this,W,Ae).call(this,n=>{const a=window.getComputedStyle(n);this.style.height=a.height,this.style.width=a.width,n.clientHeight!==this.clientHeight&&(this.style.height=`calc(${a.height} + ${n.clientHeight-this.clientHeight}px)`),n.clientWidth!==this.clientWidth&&(this.style.width=`calc(${a.width} + ${n.clientWidth-this.clientWidth}px)`);const c=n.getBoundingClientRect(),l=this.getBoundingClientRect();me(this,Ie,B(this,Ie)+c.left-l.left),me(this,Me,B(this,Me)+c.top-l.top),this.style.transform=`translate(${B(this,Ie)}px, ${B(this,Me)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new Vn)})},Be=new WeakMap,et=function(){B(this,Be)||(me(this,Be,!0),requestAnimationFrame(()=>{Y(this,W,kt).call(this),me(this,Be,!1)}))},tt=function(){Y(this,W,Ae).call(this,n=>{const a=window.getComputedStyle(n);for(const c of Gn)this.style[c]=a[c];Y(this,W,et).call(this)})},nt=function(){Y(this,W,Ae).call(this,n=>{this.textContent=n.value,Y(this,W,kt).call(this)})},qe=new WeakMap,_e=new WeakMap;let it=At;const Gn=["direction","writingMode","unicodeBidi","textOrientation","boxSizing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"];try{customElements.define("input-style-clone",it)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var be,Te,Re,ce,Ft,nn,Ct,De;const st=class st{constructor(t,n=0,a=n){oe(this,ce);oe(this,be);oe(this,Te);oe(this,Re);me(this,be,t),me(this,Te,n),me(this,Re,a)}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new st(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return B(this,be)}get endContainer(){return B(this,be)}get startContainer(){return B(this,be)}get startOffset(){return B(this,Te)}get endOffset(){return B(this,Re)}setStartOffset(t){me(this,Te,Y(this,ce,Ct).call(this,t))}setEndOffset(t){me(this,Re,Y(this,ce,Ct).call(this,t))}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Y(this,ce,De).call(this).cloneContents()}cloneRange(){return new st(B(this,be),this.startOffset,this.endOffset)}getBoundingClientRect(){return Y(this,ce,De).call(this).getBoundingClientRect()}getClientRects(){return Y(this,ce,De).call(this).getClientRects()}toString(){return Y(this,ce,De).call(this).toString()}getStyleClone(){return B(this,ce,Ft)}};be=new WeakMap,Te=new WeakMap,Re=new WeakMap,ce=new WeakSet,Ft=function(){return it.for(B(this,be))},nn=function(){return B(this,ce,Ft)},Ct=function(t){return Math.max(0,Math.min(t,B(this,be).value.length))},De=function(){const t=document.createRange(),n=B(this,ce,nn).childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t};let Et=st;const Ze=new WeakMap;class Yn{constructor(t,n){this.expander=t,this.input=n,this.combobox=null,this.menu=null,this.match=null,this.justPasted=!1,this.lookBackIndex=0,this.oninput=this.onInput.bind(this),this.onpaste=this.onPaste.bind(this),this.onkeydown=this.onKeydown.bind(this),this.oncommit=this.onCommit.bind(this),this.onmousedown=this.onMousedown.bind(this),this.onblur=this.onBlur.bind(this),this.interactingWithList=!1,n.addEventListener("paste",this.onpaste),n.addEventListener("input",this.oninput),n.addEventListener("keydown",this.onkeydown),n.addEventListener("blur",this.onblur)}destroy(){this.input.removeEventListener("paste",this.onpaste),this.input.removeEventListener("input",this.oninput),this.input.removeEventListener("keydown",this.onkeydown),this.input.removeEventListener("blur",this.onblur)}dismissMenu(){this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex)}activate(t,n){var a,c;this.input!==document.activeElement&&this.input!==((c=(a=document.activeElement)===null||a===void 0?void 0:a.shadowRoot)===null||c===void 0?void 0:c.activeElement)||(this.deactivate(),this.menu=n,n.id||(n.id=`text-expander-${Math.floor(Math.random()*1e5).toString()}`),this.expander.append(n),this.combobox=new jn(this.input,n),this.expander.dispatchEvent(new Event("text-expander-activate")),this.positionMenu(n,t.position),this.combobox.start(),n.addEventListener("combobox-commit",this.oncommit),n.addEventListener("mousedown",this.onmousedown),this.combobox.navigate(1))}positionMenu(t,n){const a=new Et(this.input,n).getBoundingClientRect(),c={left:a.left,top:a.top+a.height},l=t.getBoundingClientRect(),o={left:c.left-l.left,top:c.top-l.top};if(o.left!==0||o.top!==0){const x=getComputedStyle(t);t.style.left=x.left?`calc(${x.left} + ${o.left}px)`:`${o.left}px`,t.style.top=x.top?`calc(${x.top} + ${o.top}px)`:`${o.top}px`}}deactivate(){const t=this.menu;return!t||!this.combobox?!1:(this.expander.dispatchEvent(new Event("text-expander-deactivate")),this.menu=null,t.removeEventListener("combobox-commit",this.oncommit),t.removeEventListener("mousedown",this.onmousedown),this.combobox.destroy(),this.combobox=null,t.remove(),!0)}onCommit({target:t}){var n;const a=t;if(!(a instanceof HTMLElement)||!this.combobox)return;const c=this.match;if(!c)return;const l=this.input.value.substring(0,c.position-c.key.length),o=this.input.value.substring(c.position+c.text.length),x={item:a,key:c.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:x}))||!x.value)return;let z=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";x.continue&&(z="");const N=`${x.value}${z}`;this.input.value=l+N+o;const g=l.length+N.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=g,this.input.selectionEnd=g,x.continue||(this.lookBackIndex=g,this.match=null),this.expander.dispatchEvent(new CustomEvent("text-expander-committed",{cancelable:!1,detail:{input:this.input}}))}onBlur(){if(this.interactingWithList){this.interactingWithList=!1;return}this.deactivate()}onPaste(){this.justPasted=!0}async onInput(){if(this.justPasted){this.justPasted=!1;return}const t=this.findMatch();if(t){this.match=t;const n=await this.notifyProviders(t);if(!this.match)return;n?this.activate(t,n):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const t=this.input.selectionEnd||0,n=this.input.value;t<=this.lookBackIndex&&(this.lookBackIndex=t-1);for(const{key:a,multiWord:c}of this.expander.keys){const l=Wn(n,a,t,{multiWord:c,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(l)return{text:l.text,key:a,position:l.position}}}async notifyProviders(t){const n=[],a=x=>n.push(x);return this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:t.text,key:t.key}}))?(await Promise.all(n)).filter(x=>x.matched).map(x=>x.fragment)[0]:void 0}onMousedown(){this.interactingWithList=!0}onKeydown(t){t.key==="Escape"&&(this.match=null,this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex,t.stopImmediatePropagation(),t.preventDefault()))}}class qt extends HTMLElement{get keys(){const t=this.getAttribute("keys"),n=t?t.split(" "):[],a=this.getAttribute("multiword"),c=a?a.split(" "):[],l=c.length===0&&this.hasAttribute("multiword");return n.map(o=>({key:o,multiWord:l||c.includes(o)}))}set keys(t){this.setAttribute("keys",t)}connectedCallback(){const t=this.querySelector('input[type="text"], textarea');if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))return;const n=new Yn(this,t);Ze.set(this,n)}disconnectedCallback(){const t=Ze.get(this);t&&(t.destroy(),Ze.delete(this))}dismiss(){const t=Ze.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=qt,window.customElements.define("text-expander",qt));function Zn({onlyFirst:s=!1}={}){const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,s?void 0:"g")}const Xn=Zn();function Jn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Xn,"")}const Qn=new Intl.Segmenter;function Kt(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=Jn(s)),s===""))return 0;let n=0;for(const a of Qn.segment(s))n++;return n}const ei="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.0'%20viewBox='0%200%20641%20223'%3e%3cpath%20fill='%23aaa'%20d='M86%20214c-9-1-17-4-24-8l-6-3-5-5-5-4-4-6-4-6-3-8-2-8v-27l2-9%203-9%204-6%204-6%205-5%205-5%207-3%206-4%207-2%207-2%2012-1h12l7%201%208%202%207%204%207%203%205%205%205%204-10%2010-10%209-4-3-10-5-5-1H88l-5%202-6%203-3%204-4%204-2%205-2%206v6l-1%207%201%207%202%207%203%205%202%204%204%203%204%203%205%202%206%202h9l10-1%205-2%206-3v-16H91v-27h59v54l-1%203-2%203-5%204-4%204-5%203-5%202-8%202-8%202-10%201H92l-6-1zm266-62V91h34v46h44V91h34v121h-34v-46h-44v46h-34v-61zm-182-1V90h34v121h-34v-60zm59-1V90h35l36%201%205%202c3%200%208%202%2010%204l5%202%204%205%205%204%203%207%203%207%201%2013v13l-4%206-3%207-4%204-5%205-5%202-5%203-6%202-5%201-18%201h-18v32h-34v-61zm67-2%203-2%202-4%202-5v-5l-2-4-2-4-3-2-3-3h-30v31h30l3-2zm226%2039v-24l-8-12-18-28a1751%201751%200%200%200-20-31v-2h39l7%2012%2012%2021%206%209%2013-21%2013-21h38v2l-41%2061-7%2010v48h-34v-24zM109%2066l-4-1-5-5-5-4-1-5-3-9v-5l1-5c2-7%203-10%208-15l4-4%207-2%207-2h7l6%201%205%202%205%202%203%204%204%203%202%206%202%205v13l-2%205-2%206-4%204-3%203-5%202-4%202-9%201h-9l-5-2zm22-11%204-2%203-4%202-5V34l-2-4-2-4-3-2-4-3-5-1h-6l-4%202-5%202-2%204-3%205-1%203v4l1%205%202%205%202%202%205%203%204%202h10l4-2zM37%2039V11h33l3%201%203%202%204%203%203%203%201%205%201%204v5l-1%204-3%204-3%205-4%201-3%202-11%201H49v16H37V39zm31%200%203-2%201-2%201-2v-4l-1-3-3-2-2-2H49v18h15l4-1zm107%2025a512%20512%200%200%200-19-53h14l4%2014%206%2019%201%204%201-1%207-19%205-17h9l6%2019%207%2018v-1l2-6%205-17%204-13h14v1l-4%2012-16%2041v2h-5l-5-1-6-15-6-15-1%201-3%207-6%2015-2%208h-11l-1-3zm74-25V11h42v11h-29v2l-1%205v4h29v11h-28v11h2l15%201h13v11h-43V39zm55%200V11h33l5%203%205%202%202%204%202%205v10l-2%203-1%204-5%203-5%203%205%205%208%2010%203%204h-14l-7-9-8-10h-9v19h-12V39zm33-3%202-3v-6l-3-3-2-3h-18v16h1v1h17l2-2zm26%203V11h42v11h-29l-1%206v5h29v11h-28v5l-1%205%201%201v1h30v11h-43V39zm54%200V11h17l18%201%204%202%205%203%202%204%203%204%202%206%201%206v5c-1%206-3%2012-6%2015l-3%204-5%203-5%202-17%201h-16V39zm33%2014%205-5%202-3v-6l-1-6-1-3-1-3-4-3-3-2h-5l-6-1-3%201h-3v34h9l8-1%203-2zm50-14V11h34l5%202%204%202%202%203%202%203v9l-2%202-3%204-1%201%203%203%203%204%201%203%201%204-1%204-1%204-3%203-3%203-5%201-5%201h-31V39zm34%2015%202-1v-6l-2-2-2-2h-20v13h20l2-2zm-3-22%204-2v-6l-2-1-2-2h-19v12h16l4-1zm42%2024V45l-6-9-11-17-5-8h15l4%208%207%2011%202%203%207-11%207-11h14l-11%2016-11%2017v23h-12V56z'/%3e%3c/svg%3e",Lt=[["aa","Afar","Afaraf"],["ab","Abkhaz","аҧсуа бызшәа"],["ae","Avestan","avesta"],["af","Afrikaans","Afrikaans"],["ak","Akan","Akan"],["am","Amharic","አማርኛ"],["an","Aragonese","aragonés"],["ar","Arabic","اللغة العربية"],["as","Assamese","অসমীয়া"],["av","Avaric","авар мацӀ"],["ay","Aymara","aymar aru"],["az","Azerbaijani","azərbaycan dili"],["ba","Bashkir","башҡорт теле"],["be","Belarusian","беларуская мова"],["bg","Bulgarian","български език"],["bh","Bihari","भोजपुरी"],["bi","Bislama","Bislama"],["bm","Bambara","bamanankan"],["bn","Bengali","বাংলা"],["bo","Tibetan","བོད་ཡིག"],["br","Breton","brezhoneg"],["bs","Bosnian","bosanski jezik"],["ca","Catalan","Català"],["ce","Chechen","нохчийн мотт"],["ch","Chamorro","Chamoru"],["co","Corsican","corsu"],["cr","Cree","ᓀᐦᐃᔭᐍᐏᐣ"],["cs","Czech","čeština"],["cu","Old Church Slavonic","ѩзыкъ словѣньскъ"],["cv","Chuvash","чӑваш чӗлхи"],["cy","Welsh","Cymraeg"],["da","Danish","dansk"],["de","German","Deutsch"],["dv","Divehi","Dhivehi"],["dz","Dzongkha","རྫོང་ཁ"],["ee","Ewe","Eʋegbe"],["el","Greek","Ελληνικά"],["en","English","English"],["eo","Esperanto","Esperanto"],["es","Spanish","Español"],["et","Estonian","eesti"],["eu","Basque","euskara"],["fa","Persian","فارسی"],["ff","Fula","Fulfulde"],["fi","Finnish","suomi"],["fj","Fijian","Vakaviti"],["fo","Faroese","føroyskt"],["fr","French","Français"],["fy","Western Frisian","Frysk"],["ga","Irish","Gaeilge"],["gd","Scottish Gaelic","Gàidhlig"],["gl","Galician","galego"],["gu","Gujarati","ગુજરાતી"],["gv","Manx","Gaelg"],["ha","Hausa","هَوُسَ"],["he","Hebrew","עברית"],["hi","Hindi","हिन्दी"],["ho","Hiri Motu","Hiri Motu"],["hr","Croatian","Hrvatski"],["ht","Haitian","Kreyòl ayisyen"],["hu","Hungarian","magyar"],["hy","Armenian","Հայերեն"],["hz","Herero","Otjiherero"],["ia","Interlingua","Interlingua"],["id","Indonesian","Bahasa Indonesia"],["ie","Interlingue","Interlingue"],["ig","Igbo","Asụsụ Igbo"],["ii","Nuosu","ꆈꌠ꒿ Nuosuhxop"],["ik","Inupiaq","Iñupiaq"],["io","Ido","Ido"],["is","Icelandic","Íslenska"],["it","Italian","Italiano"],["iu","Inuktitut","ᐃᓄᒃᑎᑐᑦ"],["ja","Japanese","日本語"],["jv","Javanese","basa Jawa"],["ka","Georgian","ქართული"],["kg","Kongo","Kikongo"],["ki","Kikuyu","Gĩkũyũ"],["kj","Kwanyama","Kuanyama"],["kk","Kazakh","қазақ тілі"],["kl","Kalaallisut","kalaallisut"],["km","Khmer","ខេមរភាសា"],["kn","Kannada","ಕನ್ನಡ"],["ko","Korean","한국어"],["kr","Kanuri","Kanuri"],["ks","Kashmiri","कश्मीरी"],["ku","Kurmanji (Kurdish)","Kurmancî"],["kv","Komi","коми кыв"],["kw","Cornish","Kernewek"],["ky","Kyrgyz","Кыргызча"],["la","Latin","latine"],["lb","Luxembourgish","Lëtzebuergesch"],["lg","Ganda","Luganda"],["li","Limburgish","Limburgs"],["ln","Lingala","Lingála"],["lo","Lao","ລາວ"],["lt","Lithuanian","lietuvių kalba"],["lu","Luba-Katanga","Tshiluba"],["lv","Latvian","latviešu valoda"],["mg","Malagasy","fiteny malagasy"],["mh","Marshallese","Kajin M̧ajeļ"],["mi","Māori","te reo Māori"],["mk","Macedonian","македонски јазик"],["ml","Malayalam","മലയാളം"],["mn","Mongolian","Монгол хэл"],["mr","Marathi","मराठी"],["ms","Malay","Bahasa Melayu"],["ms-Arab","Jawi Malay","بهاس ملايو"],["mt","Maltese","Malti"],["my","Burmese","ဗမာစာ"],["na","Nauru","Ekakairũ Naoero"],["nb","Norwegian Bokmål","Norsk bokmål"],["nd","Northern Ndebele","isiNdebele"],["ne","Nepali","नेपाली"],["ng","Ndonga","Owambo"],["nl","Dutch","Nederlands"],["nn","Norwegian Nynorsk","Norsk Nynorsk"],["no","Norwegian","Norsk"],["nr","Southern Ndebele","isiNdebele"],["nv","Navajo","Diné bizaad"],["ny","Chichewa","chiCheŵa"],["oc","Occitan","occitan"],["oj","Ojibwe","ᐊᓂᔑᓈᐯᒧᐎᓐ"],["om","Oromo","Afaan Oromoo"],["or","Oriya","ଓଡ଼ିଆ"],["os","Ossetian","ирон æвзаг"],["pa","Punjabi","ਪੰਜਾਬੀ"],["pi","Pāli","पाऴि"],["pl","Polish","Polski"],["ps","Pashto","پښتو"],["pt","Portuguese","Português"],["qu","Quechua","Runa Simi"],["rm","Romansh","rumantsch grischun"],["rn","Kirundi","Ikirundi"],["ro","Romanian","Română"],["ru","Russian","Русский"],["rw","Kinyarwanda","Ikinyarwanda"],["sa","Sanskrit","संस्कृतम्"],["sc","Sardinian","sardu"],["sd","Sindhi","सिन्धी"],["se","Northern Sami","Davvisámegiella"],["sg","Sango","yângâ tî sängö"],["si","Sinhala","සිංහල"],["sk","Slovak","slovenčina"],["sl","Slovenian","slovenščina"],["sn","Shona","chiShona"],["so","Somali","Soomaaliga"],["sq","Albanian","Shqip"],["sr","Serbian","српски језик"],["ss","Swati","SiSwati"],["st","Southern Sotho","Sesotho"],["su","Sundanese","Basa Sunda"],["sv","Swedish","Svenska"],["sw","Swahili","Kiswahili"],["ta","Tamil","தமிழ்"],["te","Telugu","తెలుగు"],["tg","Tajik","тоҷикӣ"],["th","Thai","ไทย"],["ti","Tigrinya","ትግርኛ"],["tk","Turkmen","Türkmen"],["tl","Tagalog","Wikang Tagalog"],["tn","Tswana","Setswana"],["to","Tonga","faka Tonga"],["tr","Turkish","Türkçe"],["ts","Tsonga","Xitsonga"],["tt","Tatar","татар теле"],["tw","Twi","Twi"],["ty","Tahitian","Reo Tahiti"],["ug","Uyghur","ئۇيغۇرچە‎"],["uk","Ukrainian","Українська"],["ur","Urdu","اردو"],["uz","Uzbek","Ўзбек"],["ve","Venda","Tshivenḓa"],["vi","Vietnamese","Tiếng Việt"],["vo","Volapük","Volapük"],["wa","Walloon","walon"],["wo","Wolof","Wollof"],["xh","Xhosa","isiXhosa"],["yi","Yiddish","ייִדיש"],["yo","Yoruba","Yorùbá"],["za","Zhuang","Saɯ cueŋƅ"],["zh","Chinese","中文"],["zu","Zulu","isiZulu"],["zh-CN","Chinese (China)","简体中文"],["zh-HK","Chinese (Hong Kong)","繁體中文(香港)"],["zh-TW","Chinese (Taiwan)","繁體中文(臺灣)"],["zh-YUE","Cantonese","廣東話"],["ast","Asturian","Asturianu"],["chr","Cherokee","ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ"],["ckb","Sorani (Kurdish)","سۆرانی"],["cnr","Montenegrin","crnogorski"],["csb","Kashubian","Kaszëbsczi"],["jbo","Lojban","la .lojban."],["kab","Kabyle","Taqbaylit"],["ldn","Láadan","Láadan"],["lfn","Lingua Franca Nova","lingua franca nova"],["moh","Mohawk","Kanienʼkéha"],["nds","Low German","Plattdüütsch"],["pdc","Pennsylvania Dutch","Pennsilfaani-Deitsch"],["sco","Scots","Scots"],["sma","Southern Sami","Åarjelsaemien Gïele"],["smj","Lule Sami","Julevsámegiella"],["szl","Silesian","ślůnsko godka"],["tok","Toki Pona","toki pona"],["vai","Vai","ꕙꔤ"],["xal","Kalmyk","Хальмг келн"],["zba","Balaibalan","باليبلن"],["zgh","Standard Moroccan Tamazight","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],ti="(((?:[^A-Za-z0-9@$#\\uFFFE\\uFEFF\\uFFFF]|[\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069]|^))((https?:\\/\\/)((?:(?:(?:[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/](?:[_-]|[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/])*)?[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/]\\.)*(?:(?:[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/](?:-|[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/])*)?[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/]\\.)(?:(?:(?:삼성|닷컴|닷넷|香格里拉|餐厅|食品|飞利浦|電訊盈科|集团|通販|购物|谷歌|诺基亚|联通|网络|网站|网店|网址|组织机构|移动|珠宝|点看|游戏|淡马锡|机构|書籍|时尚|新闻|政府|政务|招聘|手表|手机|我爱你|慈善|微博|广东|工行|家電|娱乐|天主教|大拿|大众汽车|在线|嘉里大酒店|嘉里|商标|商店|商城|公益|公司|八卦|健康|信息|佛山|企业|中文网|中信|世界|ポイント|ファッション|セール|ストア|コム|グーグル|クラウド|みんな|คอม|संगठन|नेट|कॉम|همراه|موقع|موبايلي|كوم|كاثوليك|عرب|شبكة|بيتك|بازار|العليان|ارامكو|اتصالات|ابوظبي|קום|сайт|рус|орг|онлайн|москва|ком|католик|дети|zuerich|zone|zippo|zip|zero|zara|zappos|yun|youtube|you|yokohama|yoga|yodobashi|yandex|yamaxun|yahoo|yachts|xyz|xxx|xperia|xin|xihuan|xfinity|xerox|xbox|wtf|wtc|wow|world|works|work|woodside|wolterskluwer|wme|winners|wine|windows|win|williamhill|wiki|wien|whoswho|weir|weibo|wedding|wed|website|weber|webcam|weatherchannel|weather|watches|watch|warman|wanggou|wang|walter|walmart|wales|vuelos|voyage|voto|voting|vote|volvo|volkswagen|vodka|vlaanderen|vivo|viva|vistaprint|vista|vision|visa|virgin|vip|vin|villas|viking|vig|video|viajes|vet|versicherung|vermögensberatung|vermögensberater|verisign|ventures|vegas|vanguard|vana|vacations|ups|uol|uno|university|unicom|uconnect|ubs|ubank|tvs|tushu|tunes|tui|tube|trv|trust|travelersinsurance|travelers|travelchannel|travel|training|trading|trade|toys|toyota|town|tours|total|toshiba|toray|top|tools|tokyo|today|tmall|tkmaxx|tjx|tjmaxx|tirol|tires|tips|tiffany|tienda|tickets|tiaa|theatre|theater|thd|teva|tennis|temasek|telefonica|telecity|tel|technology|tech|team|tdk|tci|taxi|tax|tattoo|tatar|tatamotors|target|taobao|talk|taipei|tab|systems|symantec|sydney|swiss|swiftcover|swatch|suzuki|surgery|surf|support|supply|supplies|sucks|style|study|studio|stream|store|storage|stockholm|stcgroup|stc|statoil|statefarm|statebank|starhub|star|staples|stada|srt|srl|spreadbetting|spot|sport|spiegel|space|soy|sony|song|solutions|solar|sohu|software|softbank|social|soccer|sncf|smile|smart|sling|skype|sky|skin|ski|site|singles|sina|silk|shriram|showtime|show|shouji|shopping|shop|shoes|shiksha|shia|shell|shaw|sharp|shangrila|sfr|sexy|sex|sew|seven|ses|services|sener|select|seek|security|secure|seat|search|scot|scor|scjohnson|science|schwarz|schule|school|scholarships|schmidt|schaeffler|scb|sca|sbs|sbi|saxo|save|sas|sarl|sapo|sap|sanofi|sandvikcoromant|sandvik|samsung|samsclub|salon|sale|sakura|safety|safe|saarland|ryukyu|rwe|run|ruhr|rugby|rsvp|room|rogers|rodeo|rocks|rocher|rmit|rip|rio|ril|rightathome|ricoh|richardli|rich|rexroth|reviews|review|restaurant|rest|republican|report|repair|rentals|rent|ren|reliance|reit|reisen|reise|rehab|redumbrella|redstone|red|recipes|realty|realtor|realestate|read|raid|radio|racing|qvc|quest|quebec|qpon|pwc|pub|prudential|pru|protection|property|properties|promo|progressive|prof|productions|prod|pro|prime|press|praxi|pramerica|post|porn|politie|poker|pohl|pnc|plus|plumbing|playstation|play|place|pizza|pioneer|pink|ping|pin|pid|pictures|pictet|pics|piaget|physio|photos|photography|photo|phone|philips|phd|pharmacy|pfizer|pet|pccw|pay|passagens|party|parts|partners|pars|paris|panerai|panasonic|pamperedchef|page|ovh|ott|otsuka|osaka|origins|orientexpress|organic|org|orange|oracle|open|ooo|onyourside|online|onl|ong|one|omega|ollo|oldnavy|olayangroup|olayan|okinawa|office|off|observer|obi|nyc|ntt|nrw|nra|nowtv|nowruz|now|norton|northwesternmutual|nokia|nissay|nissan|ninja|nikon|nike|nico|nhk|ngo|nfl|nexus|nextdirect|next|news|newholland|new|neustar|network|netflix|netbank|net|nec|nba|navy|natura|nationwide|name|nagoya|nadex|nab|mutuelle|mutual|museum|mtr|mtpc|mtn|msd|movistar|movie|mov|motorcycles|moto|moscow|mortgage|mormon|mopar|montblanc|monster|money|monash|mom|moi|moe|moda|mobily|mobile|mobi|mma|mls|mlb|mitsubishi|mit|mint|mini|mil|microsoft|miami|metlife|merckmsd|meo|menu|men|memorial|meme|melbourne|meet|media|med|mckinsey|mcdonalds|mcd|mba|mattel|maserati|marshalls|marriott|markets|marketing|market|map|mango|management|man|makeup|maison|maif|madrid|macys|luxury|luxe|lupin|lundbeck|ltda|ltd|lplfinancial|lpl|love|lotto|lotte|london|lol|loft|locus|locker|loans|loan|llp|llc|lixil|living|live|lipsy|link|linde|lincoln|limo|limited|lilly|like|lighting|lifestyle|lifeinsurance|life|lidl|liaison|lgbt|lexus|lego|legal|lefrak|leclerc|lease|lds|lawyer|law|latrobe|latino|lat|lasalle|lanxess|landrover|land|lancome|lancia|lancaster|lamer|lamborghini|ladbrokes|lacaixa|kyoto|kuokgroup|kred|krd|kpn|kpmg|kosher|komatsu|koeln|kiwi|kitchen|kindle|kinder|kim|kia|kfh|kerryproperties|kerrylogistics|kerryhotels|kddi|kaufen|juniper|juegos|jprs|jpmorgan|joy|jot|joburg|jobs|jnj|jmp|jll|jlc|jio|jewelry|jetzt|jeep|jcp|jcb|java|jaguar|iwc|iveco|itv|itau|istanbul|ist|ismaili|iselect|irish|ipiranga|investments|intuit|international|intel|int|insure|insurance|institute|ink|ing|info|infiniti|industries|inc|immobilien|immo|imdb|imamat|ikano|iinet|ifm|ieee|icu|ice|icbc|ibm|hyundai|hyatt|hughes|htc|hsbc|how|house|hotmail|hotels|hoteles|hot|hosting|host|hospital|horse|honeywell|honda|homesense|homes|homegoods|homedepot|holiday|holdings|hockey|hkt|hiv|hitachi|hisamitsu|hiphop|hgtv|hermes|here|helsinki|help|healthcare|health|hdfcbank|hdfc|hbo|haus|hangout|hamburg|hair|guru|guitars|guide|guge|gucci|guardian|group|grocery|gripe|green|gratis|graphics|grainger|gov|got|gop|google|goog|goodyear|goodhands|goo|golf|goldpoint|gold|godaddy|gmx|gmo|gmbh|gmail|globo|global|gle|glass|glade|giving|gives|gifts|gift|ggee|george|genting|gent|gea|gdn|gbiz|gay|garden|gap|games|game|gallup|gallo|gallery|gal|fyi|futbol|furniture|fund|fun|fujixerox|fujitsu|ftr|frontier|frontdoor|frogans|frl|fresenius|free|fox|foundation|forum|forsale|forex|ford|football|foodnetwork|food|foo|fly|flsmidth|flowers|florist|flir|flights|flickr|fitness|fit|fishing|fish|firmdale|firestone|fire|financial|finance|final|film|fido|fidelity|fiat|ferrero|ferrari|feedback|fedex|fast|fashion|farmers|farm|fans|fan|family|faith|fairwinds|fail|fage|extraspace|express|exposed|expert|exchange|everbank|events|eus|eurovision|etisalat|esurance|estate|esq|erni|ericsson|equipment|epson|epost|enterprises|engineering|engineer|energy|emerck|email|education|edu|edeka|eco|eat|earth|dvr|dvag|durban|dupont|duns|dunlop|duck|dubai|dtv|drive|download|dot|doosan|domains|doha|dog|dodge|doctor|docs|dnp|diy|dish|discover|discount|directory|direct|digital|diet|diamonds|dhl|dev|design|desi|dentist|dental|democrat|delta|deloitte|dell|delivery|degree|deals|dealer|deal|dds|dclk|day|datsun|dating|date|data|dance|dad|dabur|cyou|cymru|cuisinella|csc|cruises|cruise|crs|crown|cricket|creditunion|creditcard|credit|cpa|courses|coupons|coupon|country|corsica|coop|cool|cookingchannel|cooking|contractors|contact|consulting|construction|condos|comsec|computer|compare|company|community|commbank|comcast|com|cologne|college|coffee|codes|coach|clubmed|club|cloud|clothing|clinique|clinic|click|cleaning|claims|cityeats|city|citic|citi|citadel|cisco|circle|cipriani|church|chrysler|chrome|christmas|chloe|chintai|cheap|chat|chase|charity|channel|chanel|cfd|cfa|cern|ceo|center|ceb|cbs|cbre|cbn|cba|catholic|catering|cat|casino|cash|caseih|case|casa|cartier|cars|careers|career|care|cards|caravan|car|capitalone|capital|capetown|canon|cancerresearch|camp|camera|cam|calvinklein|call|cal|cafe|cab|bzh|buzz|buy|business|builders|build|bugatti|budapest|brussels|brother|broker|broadway|bridgestone|bradesco|box|boutique|bot|boston|bostik|bosch|boots|booking|book|boo|bond|bom|bofa|boehringer|boats|bnpparibas|bnl|bmw|bms|blue|bloomberg|blog|blockbuster|blanco|blackfriday|black|biz|bio|bingo|bing|bike|bid|bible|bharti|bet|bestbuy|best|berlin|bentley|beer|beauty|beats|bcn|bcg|bbva|bbt|bbc|bayern|bauhaus|basketball|baseball|bargains|barefoot|barclays|barclaycard|barcelona|bar|bank|band|bananarepublic|banamex|baidu|baby|azure|axa|aws|avianca|autos|auto|author|auspost|audio|audible|audi|auction|attorney|athleta|associates|asia|asda|arte|art|arpa|army|archi|aramco|arab|aquarelle|apple|app|apartments|aol|anz|anquan|android|analytics|amsterdam|amica|amfam|amex|americanfamily|americanexpress|alstom|alsace|ally|allstate|allfinanz|alipay|alibaba|alfaromeo|akdn|airtel|airforce|airbus|aigo|aig|agency|agakhan|africa|afl|afamilycompany|aetna|aero|aeg|adult|ads|adac|actor|active|aco|accountants|accountant|accenture|academy|abudhabi|abogado|able|abc|abbvie|abbott|abb|abarth|aarp|aaa|onion)(?=[^0-9a-zA-Z@+-]|$))|(?:(?:한국|香港|澳門|新加坡|台灣|台湾|中國|中国|გე|ລາວ|ไทย|ලංකා|ഭാരതം|ಭಾರತ|భారత్|சிங்கப்பூர்|இலங்கை|இந்தியா|ଭାରତ|ભારત|ਭਾਰਤ|ভাৰত|ভারত|বাংলা|भारोत|भारतम्|भारत|ڀارت|پاکستان|موريتانيا|مليسيا|مصر|قطر|فلسطين|عمان|عراق|سورية|سودان|تونس|بھارت|بارت|ایران|امارات|المغرب|السعودية|الجزائر|البحرين|الاردن|հայ|қаз|укр|срб|рф|мон|мкд|ею|бел|бг|ευ|ελ|zw|zm|za|yt|ye|ws|wf|vu|vn|vi|vg|ve|vc|va|uz|uy|us|um|uk|ug|ua|tz|tw|tv|tt|tr|tp|to|tn|tm|tl|tk|tj|th|tg|tf|td|tc|sz|sy|sx|sv|su|st|ss|sr|so|sn|sm|sl|sk|sj|si|sh|sg|se|sd|sc|sb|sa|rw|ru|rs|ro|re|qa|py|pw|pt|ps|pr|pn|pm|pl|pk|ph|pg|pf|pe|pa|om|nz|nu|nr|np|no|nl|ni|ng|nf|ne|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|mn|mm|ml|mk|mh|mg|mf|me|md|mc|ma|ly|lv|lu|lt|ls|lr|lk|li|lc|lb|la|kz|ky|kw|kr|kp|kn|km|ki|kh|kg|ke|jp|jo|jm|je|it|is|ir|iq|io|in|im|il|ie|id|hu|ht|hr|hn|hm|hk|gy|gw|gu|gt|gs|gr|gq|gp|gn|gm|gl|gi|gh|gg|gf|ge|gd|gb|ga|fr|fo|fm|fk|fj|fi|eu|et|es|er|eh|eg|ee|ec|dz|do|dm|dk|dj|de|cz|cy|cx|cw|cv|cu|cr|co|cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|bz|by|bw|bv|bt|bs|br|bq|bo|bn|bm|bl|bj|bi|bh|bg|bf|be|bd|bb|ba|az|ax|aw|au|at|as|ar|aq|ao|an|am|al|ai|ag|af|ae|ad|ac)(?=[^0-9a-zA-Z@+-]|$))|(?:xn--[\\-0-9a-z]+))))(?::([0-9]+))?(\\/(?:(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*(?:\\((?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+|(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*\\([a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*))\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*)*[\\+\\-a-z\\u0400-\\u04FF0-9=_#\\/\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]|(?:\\((?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+|(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*\\([a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*))\\)))|(?:@[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\/))*)?(\\?[a-z0-9!?\\*'@\\(\\);:&=\\+\\$\\/%#\\[\\]\\-_\\.,~|]*[a-z0-9\\-_&=#\\/])?))",ni="gi",Wt={source:ti,flags:ni},Ut=["byte","kilobyte","megabyte","gigabyte","terabyte","petabyte"];function Xe(s){const t=Math.min(Math.floor(Math.log2(s)/10),Ut.length-1),n=s/1024**t;return ge.number(n,{style:"unit",unit:Ut[t],unitDisplay:"narrow",maximumFractionDigits:0})}const ii={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:vt,PHANPY_GIPHY_API_KEY:si}=ii,ai=Lt.reduce((s,t)=>{const[n,a,c]=t;return s[n]={common:a,native:c},s},{}),sn={300:Fe(5,"minute"),1800:Fe(30,"minute"),3600:Fe(1,"hour"),21600:Fe(6,"hour"),86400:Fe(1,"day"),259200:Fe(3,"day"),604800:Fe(1,"week")},ri=Object.keys(sn),Vt=24*60*60,Gt=s=>{if(!s)return Vt;const t=(new Date(s).getTime()-Date.now())/1e3;return ri.find(n=>n>=t)||Vt},Ee=document.createElement("ul");Ee.role="listbox";Ee.className="text-expander-menu";const oi=16,li=new IntersectionObserver(s=>{s.forEach(t=>{if(t.isIntersecting){const{left:n,width:a}=t.boundingClientRect,{innerWidth:c}=window;if(n+a>c){const l=zn()?"right":"left";Ee.style[l]=c-a-oi+"px"}}})});li.observe(Ee);const Ce=vn([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],Lt.map(s=>s[0]),"en"),an=new RegExp(Wt.source,Wt.flags),ci=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,ui="$2xxxxxxxxxxxxxxxxxxxxxxx";function di(s){return s.replace(an,ui).replace(ci,"$1@$3")}const hi=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,pi=new RegExp(`(^|[^=\\/\\w])(@${hi.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),mi=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),gi="[a-zA-Z0-9_]{2,}",fi=new RegExp(`(^|[^=\\/\\w])(:${gi}:)(?=[^A-Za-z0-9_:]|$)`,"g"),vi=new Intl.Segmenter;function bt(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function bi(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=le;if(n>t){let a="",c="";const l=vi.segment(s);for(const{segment:o,index:x}of l)x<t?a+=o:c+=o;return c&&(c='<mark class="compose-highlight-exceeded">'+bt(c)+"</mark>"),bt(a)+c}return bt(s).replace(an,'$2<mark class="compose-highlight-url">$3</mark>').replace(pi,'$1<mark class="compose-highlight-mention">$2</mark>').replace(mi,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(fi,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const yi=Jt(s=>new Intl.RelativeTimeFormat(s||void 0)),xi=Jt(s=>new Intl.ListFormat(s||void 0)),zt=100;function Ti({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:c,hasOpener:l}){var Rt;const{i18n:o}=Ke(),x=yi(o.locale),_=xi(o.locale),{masto:z,instance:N}=_t(),[g,M]=q("default"),C=V((a==null?void 0:a.uid)||_n()),$=bn(),T=$.info,ne=Qt(),{statuses:{maxCharacters:ee,maxMediaAttachments:u,charactersReservedPerUrl:h}={},mediaAttachments:{supportedMimeTypes:m,imageSizeLimit:w,imageMatrixLimit:f,videoSizeLimit:j,videoMatrixLimit:k,videoFrameRateLimit:G}={},polls:{maxOptions:re,maxCharactersPerOption:ue,maxExpiration:X,minExpiration:pe}={}}=ne||{},S=V(),O=V(),[U,ie]=q("public"),[se,ae]=q(!1),[D,de]=q(Se.session.get("currentLanguage")||Ce),R=V(D),[v,L]=q([]),[P,J]=q(null),Q=Se.account.get("preferences")||{},fe=()=>{S.current&&S.current.dispatchEvent(new Event("input"))},we=()=>{setTimeout(()=>{var r,d,y;S.current&&((d=(r=a==null?void 0:a.status)==null?void 0:r.startsWith)!=null&&d.call(r,`
`)&&(S.current.selectionStart=0,S.current.selectionEnd=0),(y=S.current)==null||y.focus())},300)};te(()=>{var r,d;if(t){const{spoilerText:y,visibility:p,language:A,sensitive:F}=t;y&&O.current&&(O.current.value=y);const b=[...new Set([t.account.acct,...t.mentions.map(E=>E.acct)])].filter(E=>E!==T.acct);b.length>0&&(S.current.value=`${b.map(E=>`@${E}`).join(" ")} `,fe()),we(),ie(p==="public"&&Q["posting:default:visibility"]?Q["posting:default:visibility"].toLowerCase():p),de(A||((r=Q["posting:default:language"])==null?void 0:r.toLowerCase())||Ce),ae(F&&!!y)}else if(n){const{visibility:y,language:p,sensitive:A,poll:F,mediaAttachments:I}=n,b=!!(F!=null&&F.options)&&{...F,options:F.options.map(E=>(E==null?void 0:E.title)||E),expiresIn:(F==null?void 0:F.expiresIn)||Gt(F.expiresAt)};M("loading"),(async()=>{var E;try{const H=await z.v1.statuses.$select(n.id).source.fetch(),{text:he,spoilerText:ve}=H;S.current.value=he,S.current.dataset.source=he,fe(),we(),O.current.value=ve,ie(y),de(p||((E=Q["posting:default:language"])==null?void 0:E.toLowerCase())||Ce),ae(A),b&&J(b),L(I),M("default")}catch(H){alert((H==null?void 0:H.reason)||H),M("error")}})()}else we(),Q["posting:default:visibility"]&&ie(Q["posting:default:visibility"].toLowerCase()),Q["posting:default:language"]&&de(Q["posting:default:language"].toLowerCase()),Q["posting:default:sensitive"]&&ae(!!Q["posting:default:sensitive"]);if(a){const{status:y,spoilerText:p,visibility:A,language:F,sensitive:I,poll:b,mediaAttachments:E}=a,H=!!(b!=null&&b.options)&&{...b,options:b.options.map(he=>(he==null?void 0:he.title)||he),expiresIn:(b==null?void 0:b.expiresIn)||Gt(b.expiresAt)};S.current.value=y,fe(),we(),p&&(O.current.value=p),A&&ie(A),de(F||((d=Q["posting:default:language"])==null?void 0:d.toLowerCase())||Ce),I!==null&&ae(I),H&&J(H),E&&L(E)}},[a,n,t]);const Le=V(),St=o._({id:"hR9gtK"}),ot=()=>{const{value:r,dataset:d}=S.current;if(g==="loading")return!1;const y=(r||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),p=v.length>0;if(!y&&!p||v.length>0&&v.every(E=>E.id))return!0;const F=(t==null?void 0:t.account.id)===T.id,I=t&&r.trim()===`@${t.account.acct}`;return!!(!F&&I||r===(d==null?void 0:d.source))},We=()=>ot()?!0:confirm(St);te(()=>{const r=d=>{ot()||(d.preventDefault(),d.returnValue=St)};return window.addEventListener("beforeunload",r,{capture:!0}),()=>window.removeEventListener("beforeunload",r,{capture:!0})},[]);const ln=()=>{const{value:r}=S.current,{value:d}=O.current;return Kt(di(r))+Kt(d)},lt=()=>{const r=ln();le.composerCharacterCount=r};te(lt,[]);const It=window.CloseWatcher,ct=V(!1);$e("esc",()=>{ct.current=!0},{enabled:!It,enableOnFormTags:!0}),$e("esc",()=>{!c&&ct.current&&We()&&s(),ct.current=!1},{enabled:!It,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:r=>{const d=document.querySelectorAll("#modal-container > *"),y=!!d,p=d.length===1&&d[0].querySelector("#compose-container");return y&&!p}}),Ln(()=>{!c&&We()&&s()},[c,We,s]);const Mt=V({}),Bt=()=>`${yn()}#${C.current}`,ut=()=>{if(n||le.composerState.minimized)return;const r=Bt(),d={key:r,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}};!xn(d,Mt.current)&&!ot()&&(jt.drafts.set(r,{...d,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(y=>{}),Mt.current=structuredClone(d))};An(ut,5e3),te(()=>(ut(),()=>{jt.drafts.del(Bt())}),[]),te(()=>{const r=y=>{const{items:p}=y.clipboardData||y.dataTransfer,A=[],F=[];for(let I=0;I<p.length;I++){const b=p[I];if(b.kind==="file"){const E=b.getAsFile();m!==void 0&&!m.includes(E.type)?F.push(E):A.push(E)}}if(F.length>0&&alert(o._({id:"rpXAF6",values:{0:F.length,1:F[0].name,2:_.format(F.map(I=>I.name))}})),A.length>0&&v.length>=u){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}if(A.length>0){y.preventDefault(),y.stopPropagation();let I=A;if(u!==void 0){const E=u-v.length;if(I=I.slice(0,E),I.length<=0){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}}const b=I.map(E=>({file:E,type:E.type,size:E.size,url:URL.createObjectURL(E),id:null,description:null}));L([...v,...b])}};window.addEventListener("paste",r);const d=y=>{y.dataTransfer.items.length>0&&(y.preventDefault(),y.stopPropagation())};return window.addEventListener("dragover",d),window.addEventListener("drop",r),()=>{window.removeEventListener("paste",r),window.removeEventListener("dragover",d),window.removeEventListener("drop",r)}},[v]);const[Ue,dt]=q(!1),[Ve,Ge]=q(!1),[cn,ht]=q(!1),[ye,un]=q(null),[dn,hn]=je(()=>{const r=[],d=[],{contentTranslationHideLanguages:y=[]}=le.settings;return Lt.forEach(p=>{const[A]=p;A===D||A===R.current||A===Ce||y.includes(A)||ye!=null&&ye.length&&ye.includes(A)?r.push(p):d.push(p)}),r.sort(([p,A],[F,I])=>p===D?-1:F===D?1:A.localeCompare(I)),d.sort(([p,A],[F,I])=>A.localeCompare(I)),[r,d]},[D,ye]),Tt=je(()=>!!(t!=null&&t.createdAt)&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),pn=()=>{ut(),le.composerState.minimized=!0};return e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:c?"standalone":"",children:[e("div",{class:"compose-top",children:[(T==null?void 0:T.avatarStatic)&&e(tn,{account:T,accountInstance:$.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),c?l&&e("button",{type:"button",class:"light pop-button",disabled:g==="loading",onClick:()=>{var r;if(!window.opener){alert(o._({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if((r=window.opener.__STATES__.composerState)!=null&&r.publishing){alert(o._({id:"Z2l5Bt"}));return}let d=o._({id:"AB/GtR"});if(!confirm(d))return}s({fn:()=>{const d={editStatus:n,replyToStatus:t,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}};window.opener.__COMPOSE__=d,window.opener.__STATES__.showCompose?(window.opener.__STATES__.showCompose=!1,setTimeout(()=>{window.opener.__STATES__.showCompose=!0},10)):window.opener.__STATES__.showCompose=!0,window.opener.__STATES__.composerState.minimized&&(window.opener.__STATES__.composerState.minimized=!1)}})},children:e(Z,{icon:"popin",alt:o._({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:g==="loading",onClick:()=>{Sn({editStatus:n,replyToStatus:t,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}})&&s()},children:e(Z,{icon:"popout",alt:o._({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:pn,children:e(Z,{icon:"minimize",alt:o._({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:g==="loading",onClick:()=>{We()&&s()},children:e(Z,{icon:"x",alt:o._({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(Pt,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:Tt>0?e(K,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:x.format(-Tt,"month")},components:{0:e("strong",{})}}):e(K,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(Pt,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(K,{id:"wKtOLH"})})]}),e("form",{ref:Le,class:`form-visibility-${U}`,style:{pointerEvents:g==="loading"?"none":"auto",opacity:g==="loading"?.5:1},onKeyDown:r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&Le.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:r=>{r.preventDefault();const d=new FormData(r.target),y=Object.fromEntries(d.entries());let{status:p,visibility:A,sensitive:F,spoilerText:I}=y;if(F=F==="on",P){if(P.options.length<2){alert(o._({id:"zhrMYj"}));return}if(P.options.some(b=>b==="")){alert(o._({id:"uNVxXX"}));return}}v.length>0&&v.some(E=>{var H,he;return!((he=(H=E.description)==null?void 0:H.trim)!=null&&he.call(H))})&&!confirm(o._({id:"MQYucx"}))||(I=F&&I||void 0,p=p===""?void 0:p,le.composerState.publishing=!0,M("loading"),(async()=>{try{if(v.length>0){const H=v.map(ve=>{const{file:Ye,description:mn,id:gn}=ve;if(gn)return ve;{const fn=Xt({file:Ye,description:mn});return z.v2.media.create(fn).then(pt=>(pt.id&&(ve.id=pt.id),pt))}}),he=await Promise.allSettled(H);if(he.some(ve=>{var Ye;return ve.status==="rejected"||!((Ye=ve.value)!=null&&Ye.id)})){le.composerState.publishing=!1,le.composerState.publishingError=!0,M("error"),he.forEach(ve=>{ve.status==="rejected"&&alert(ve.reason||o._({id:"eIiurD",values:{i}}))});return}}let b={status:p,spoiler_text:I,language:D,sensitive:F,poll:P,media_ids:v.map(H=>H.id)};n&&Je("@mastodon/edit-media-attributes")?b.media_attributes=v.map(H=>({id:H.id,description:H.description})):n||(b.visibility=A,b.in_reply_to_id=(t==null?void 0:t.id)||void 0),b=Xt(b);let E;if(n)E=await z.v1.statuses.$select(n.id).update(b),wn(E,N,{skipThreading:!0});else try{E=await z.v1.statuses.create(b,{requestInit:{headers:{"Idempotency-Key":C.current}}})}catch{E=await z.v1.statuses.create(b)}le.composerState.minimized=!1,le.composerState.publishing=!1,M("default"),s({type:n?"edit":t?"reply":"post",newStatus:E,instance:N})}catch(b){le.composerState.publishing=!1,le.composerState.publishingError=!0,alert((b==null?void 0:b.reason)||b),M("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:O,type:"text",name:"spoilerText",placeholder:o._({id:"gnKo7f"}),disabled:g==="loading",class:"spoiler-text-field",lang:D,spellCheck:"true",dir:"auto",style:{opacity:se?1:0,pointerEvents:se?"auto":"none"},onInput:()=>{lt()}}),e("label",{class:`toolbar-button ${se?"highlight":""}`,title:o._({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:se,disabled:g==="loading",onChange:r=>{var y,p;const d=r.target.checked;ae(d),d?(y=O.current)==null||y.focus():(p=S.current)==null||p.focus()}}),e(Z,{icon:`eye-${se?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${U!=="public"&&!se?"show-field":""} ${U!=="public"?"highlight":""}`,title:U,children:[e(Z,{icon:In[U],alt:U}),e("select",{name:"visibility",value:U,onChange:r=>{ie(r.target.value)},disabled:g==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(K,{id:"7d1a0d"})}),(Je("@pleroma/local-visibility-post")||Je("@akkoma/local-visibility-post"))&&e("option",{value:"local",children:e(K,{id:"d5zxa4"})}),e("option",{value:"unlisted",children:e(K,{id:"WDcQq9"})}),e("option",{value:"private",children:e(K,{id:"o34OrG"})}),e("option",{value:"direct",children:e(K,{id:"IV4QaU"})})]})]})," "]}),e(Ei,{ref:S,placeholder:t?o._({id:"Sjj+EN"}):n?o._({id:"qzVesX"}):o._({id:"owpNF1"}),required:(v==null?void 0:v.length)===0,disabled:g==="loading",lang:D,onInput:()=>{lt()},maxCharacters:ee,performSearch:r=>{const{type:d,q:y,limit:p}=r;return d==="accounts"?z.v1.accounts.search.list({q:y,limit:p,resolve:!1}):z.v2.search.fetch(r)},onTrigger:r=>{(r==null?void 0:r.name)==="custom-emojis"?Ge({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="mention"?dt({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="auto-detect-language"&&(r!=null&&r.languages)&&un(r.languages)}}),(v==null?void 0:v.length)>0&&e("div",{class:"media-attachments",children:[v.map((r,d)=>{const{id:y,file:p}=r,A=(p==null?void 0:p.size)+(p==null?void 0:p.type)+(p==null?void 0:p.name);return e(Ci,{attachment:r,disabled:g==="loading",lang:D,onDescriptionChange:F=>{L(I=>{const b=[...I];return b[d]={...b[d],description:F},b})},onRemove:()=>{L(F=>F.filter((I,b)=>b!==d))}},y||A||d)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:se,disabled:g==="loading",onChange:r=>{const d=r.target.checked;ae(d)}})," ",e("span",{children:e(K,{id:"jER18a"})})," ",e(Z,{icon:`eye-${se?"close":"open"}`})]})]}),!!P&&e(zi,{lang:D,maxOptions:re,maxExpiration:X,minExpiration:pe,maxCharactersPerOption:ue,poll:P,disabled:g==="loading",onInput:r=>{if(r){const d={...r};J(d)}else J(null)}}),e("div",{class:"toolbar wrap",style:{justifyContent:"flex-end"},children:[e("span",{children:[e("label",{class:"toolbar-button",children:[e("input",{type:"file",accept:m==null?void 0:m.join(","),multiple:u===void 0||u-v>=2,disabled:g==="loading"||v.length>=u||!!P,onChange:r=>{const d=r.target.files;if(!d)return;const y=Array.from(d).map(p=>({file:p,type:p.type,size:p.size,url:URL.createObjectURL(p),id:null,description:null}));v.length+y.length>u?alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}})):L(p=>p.concat(y)),r.target.value=""}}),e(Z,{icon:"attachment"})]}),re==null||re>1&&e(Pe,{children:e("button",{type:"button",class:"toolbar-button",disabled:g==="loading"||!!P||!!v.length,onClick:()=>{J({options:["",""],expiresIn:24*60*60,multiple:!1})},children:e(Z,{icon:"poll",alt:o._({id:"cZJ92q"})})})}),e("button",{type:"button",class:"toolbar-button",disabled:g==="loading",onClick:()=>{Ge(!0)},children:e(Z,{icon:"emoji2",alt:o._({id:"ggiJLM"})})}),!!le.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:g==="loading"||u!==void 0&&v.length>=u||!!P,onClick:()=>{ht(!0)},children:e("span",{children:"GIF"})})]}),e("div",{class:"spacer"}),g==="loading"?e(at,{abrupt:!0}):e(Fi,{maxCharacters:ee,hidden:g==="loading"}),e("label",{class:`toolbar-button ${D!==R.current||ye!=null&&ye.length&&!ye.includes(D)?"highlight":""}`,children:[e("span",{class:"icon-text",children:(Rt=ai[D])==null?void 0:Rt.native}),e("select",{name:"language",value:D,onChange:r=>{const{value:d}=r.target;de(d||Ce),Se.session.set("currentLanguage",d||Ce)},disabled:g==="loading",dir:"auto",children:[dn.map(([r,d,y])=>{const p=xt({code:r,fallback:d});return e("option",{value:r,children:p!==y?`${y} - ${p}`:p},r)}),e("hr",{}),hn.map(([r,d,y])=>{const p=xt({code:r,fallback:d});return e("option",{value:r,children:p!==y?`${y} - ${p}`:p},r)})]})]})," ",e("button",{type:"submit",class:"large",disabled:g==="loading",children:t?o._({id:"ImOQa9"}):n?o._({id:"EkH9pt"}):o._({id:"GMe2XV"})})]})]})]}),Ue&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&dt(!1)},children:e(_i,{masto:z,instance:N,onClose:()=>{dt(!1)},defaultSearchTerm:Ue==null?void 0:Ue.defaultSearchTerm,onSelect:r=>{const d=S.current;if(!d)return;const{selectionStart:y,selectionEnd:p}=d,A=d.value,F=A.slice(0,y),I=F?/[\s\t\n\r]$/.test(F)?"":" ":"",b=A.slice(p),E=/^[\s\t\n\r]/.test(b)?"":" ",H=F+I+"@"+r+E+b;d.value=H,d.selectionStart=d.selectionEnd=p+1+r.length+E.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),Ve&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&Ge(!1)},children:e(Li,{masto:z,instance:N,onClose:()=>{Ge(!1)},defaultSearchTerm:Ve==null?void 0:Ve.defaultSearchTerm,onSelect:r=>{const d=S.current;if(!d)return;const{selectionStart:y,selectionEnd:p}=d,A=d.value,F=A.slice(0,y),I=F?/[\s\t\n\r]$/.test(F)?"":" ":"",b=A.slice(p),E=/^[\s\t\n\r]/.test(b)?"":" ",H=F+I+r+E+b;d.value=H,d.selectionStart=d.selectionEnd=p+r.length+E.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),cn&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&ht(!1)},children:e(Si,{onClose:()=>ht(!1),onSelect:({url:r,type:d,alt_text:y})=>{if(v.length>=u){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}(async()=>{var A,F;let p;try{p=ze({text:o._({id:"/Cw4Tx"}),duration:-1});const I=await fetch(r,{referrerPolicy:"no-referrer"}).then(H=>H.blob()),b=new File([I],d==="video/mp4"?"video.mp4":"image.gif",{type:d}),E=[...v,{file:b,type:d,size:b.size,id:null,description:y||""}];L(E),(A=p==null?void 0:p.hideToast)==null||A.call(p)}catch{(F=p==null?void 0:p.hideToast)==null||F.call(p),ze(o._({id:"VKDnAx"}))}})()}})})]})}function Yt(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:c}=s;if(n<window.innerHeight){const l=n-c,o=t?a+l+"px":null;s.style.height=o}}async function wi(s,t){const a=(await t.v1.customEmojis.list()).filter(l=>l.visibleInPicker),c=new Mn(a,{keys:["shortcode"],findAllMatches:!0});return[a,c]}const rn=kn(wi,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),ki=async s=>{const{detectAll:t}=await En(async()=>{const{detectAll:a}=await import("./tinyld-light-tbgyvj3S.js");return{detectAll:a}},[],import.meta.url),n=t(s);return n!=null&&n.length?n.slice(0,2).map(a=>a.lang):null},Ei=Fn((s,t)=>{var ee;const{masto:n,instance:a}=_t(),[c,l]=q(((ee=t.current)==null?void 0:ee.value)||""),{maxCharacters:o,performSearch:x=()=>{},onTrigger:_=()=>{},...z}=s,N=V();te(()=>{rn(a,n).then(u=>{const[h,m]=u;N.current=m}).catch(u=>{})},[]);const g=V(),M=V("");te(()=>{let u,h,m;return g.current&&(u=w=>{var re;const{key:f,provide:j,text:k}=w.detail;if(M.current=k,k===""){j(Promise.resolve({matched:!1}));return}if(f===":"){const ue=(re=N.current)==null?void 0:re.search(k,{limit:5});let X="";ue.forEach(({item:pe})=>{const{shortcode:S,url:O}=pe;X+=`
<li role="option" data-value="${ke(S)}">
<img src="${ke(O)}" width="16" height="16" alt="" loading="lazy" />
${ke(S)}
</li>`}),X+=`<li role="option" data-value="" data-more="${k}">${ge._({id:"24misb"})}</li>`,Ee.innerHTML=X,j(Promise.resolve({matched:ue.length>0,fragment:Ee}));return}const G={"@":"accounts","#":"hashtags"}[f];j(new Promise(ue=>{x({type:G,q:k,limit:5}).then(pe=>{if(k!==M.current)return;const S=pe[G]||pe;let O="";S.forEach(U=>{var P;const{name:ie,avatarStatic:se,displayName:ae,username:D,acct:de,emojis:R,history:v}=U,L=Bn(ae,R);if(de)O+=`
<li role="option" data-value="${ke(de)}">
<span class="avatar">
<img src="${ke(se)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${L||D}</b>
<br><span class="bidi-isolate">@${ke(de)}</span>
</span>
</li>
`;else{const J=(P=v==null?void 0:v.reduce)==null?void 0:P.call(v,(Q,fe)=>Q+ +fe.uses,0);O+=`
<li role="option" data-value="${ke(ie)}">
<span class="grow">#<b>${ke(ie)}</b></span>
${J?`<span class="count">${Tn(J)}</span>`:""}
</li>
`}}),G==="accounts"&&(O+=`<li role="option" data-value="" data-more="${k}">${ge._({id:"24misb"})}</li>`),Ee.innerHTML=O,ue({matched:S.length>0,fragment:Ee})})}))},g.current.addEventListener("text-expander-change",u),h=w=>{const{key:f,item:j}=w.detail,{value:k,more:G}=j.dataset;f===":"?(w.detail.value=k?`:${k}:`:"",G&&(w.detail.continue=!0,setTimeout(()=>{_==null||_({name:"custom-emojis",defaultSearchTerm:G})},300))):f==="@"?(w.detail.value=k?`@${k} `:"",G&&(w.detail.continue=!0,setTimeout(()=>{_==null||_({name:"mention",defaultSearchTerm:G})},300))):w.detail.value=`${f}${k}`},g.current.addEventListener("text-expander-value",h),m=w=>{const{input:f}=w.detail;if(l(f.value),t.current){const j=new Event("input",{bubbles:!0});t.current.dispatchEvent(j)}},g.current.addEventListener("text-expander-committed",m)),()=>{g.current&&(g.current.removeEventListener("text-expander-change",u),g.current.removeEventListener("text-expander-value",h),g.current.removeEventListener("text-expander-committed",m))}},[]),te(()=>{const u=t.current;if(!u)return;new ResizeObserver(()=>{if(g.current){const{height:m}=u.getBoundingClientRect();g.current.style.height=m+"px"}}).observe(u)},[]);const C=V(0),$=V(),T=Rn(u=>{var w;if(!$.current)return;if(C.current>3){$.current.innerHTML="",$.current=null,(w=T==null?void 0:T.cancel)==null||w.call(T);return}let h,m;C.current<=3&&(h=Date.now()),$.current.innerHTML=bi(u,{maxCharacters:o})+`
`,C.current<=3&&(m=Date.now()),h&&m&&m-h>50&&C.current++},500),ne=rt(()=>{var m,w;const u=(m=$.current)==null?void 0:m.cloneNode(!0);if(!u)return;u.querySelectorAll("mark").forEach(f=>{f.remove()});const h=(w=u.innerText)==null?void 0:w.trim();h&&(async()=>{const f=await ki(h);f!=null&&f.length&&(_==null||_({name:"auto-detect-language",languages:f}))})()},2e3);return e("text-expander",{ref:g,keys:"@ # :",class:"compose-field-container",children:[e("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...z,ref:t,name:"status",value:c,onKeyDown:u=>{const{key:h,target:m}=u;if(h==="Enter"&&!(u.ctrlKey||u.metaKey))try{const{value:w,selectionStart:f}=m,k=w.slice(0,f).split(`
`).slice(-1)[0];if(k&&/^\s*(-|\d+\.)\s/.test(k)){const[G,re,ue,X,pe]=k.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(pe){u.preventDefault();const[S]=ue.match(/\d+/)||[],O=S?`${+S+1}.`:"-",U=`
${re}${O}${X}`;m.setRangeText(U,f,f);const ie=f+U.length;m.setSelectionRange(ie,ie)}else{const S=f-k.length;m.setRangeText("",S,f)}Yt(m),m.dispatchEvent(new Event("input"))}}catch{}$.current&&($.current.scrollTop=m.scrollTop)},onInput:u=>{var w;const{target:h}=u,m=h.value.replace(/\u200b/g,"");l(m),Yt(h),(w=s.onInput)==null||w.call(s,u),T(m),ne()},style:{width:"100%",height:"4em"},onScroll:u=>{if($.current){const{scrollTop:h}=u.target;$.current.scrollTop=h}}}),e("div",{ref:$,class:"compose-highlight","aria-hidden":"true"})]})});function Fi({maxCharacters:s=500,hidden:t}){const a=Cn(le).composerCharacterCount,c=s-a;return t?e("span",{class:"char-counter",hidden:!0}):e("span",{class:"char-counter",title:`${c}/${s}`,style:{"--percentage":a/s*100},children:[e("meter",{class:`${c<=-10?"explode":c<=0?"danger":c<=20?"warning":""}`,value:a,max:s}),e("span",{class:"counter",children:c})]})}function Zt(s,t,n,a){const c=Math.sqrt(t/s),l=Math.floor(n*c),o=Math.floor(a*c);return{newWidth:l,newHeight:o}}function Ci({attachment:s,disabled:t,lang:n,onDescriptionChange:a=()=>{},onRemove:c=()=>{}}){const{i18n:l}=Ke(),[o,x]=q("default"),_=Je("@mastodon/edit-media-attributes"),{type:z,id:N,file:g}=s,M=je(()=>g?URL.createObjectURL(g):s.url,[g,s.url]),C=!!(g!=null&&g.size),$=C?Qt():{},{mediaAttachments:{imageSizeLimit:T,imageMatrixLimit:ne,videoSizeLimit:ee,videoMatrixLimit:u,videoFrameRateLimit:h}={}}=$||{},[m,w]=q(()=>C?z.startsWith("image")&&T&&g.size>T?{type:"imageSizeLimit",details:{imageSize:g.size,imageSizeLimit:T}}:z.startsWith("video")&&ee&&g.size>ee?{type:"videoSizeLimit",details:{videoSize:g.size,videoSizeLimit:ee}}:null:null),[f,j]=q({});te(()=>{!C||!ne||(f==null?void 0:f.matrix)>ne&&w({type:"imageMatrixLimit",details:{imageMatrix:f==null?void 0:f.matrix,imageMatrixLimit:ne,width:f==null?void 0:f.width,height:f==null?void 0:f.height}})},[f,ne,C]);const[k,G]=q({});te(()=>{!C||!u||(k==null?void 0:k.matrix)>u&&w({type:"videoMatrixLimit",details:{videoMatrix:k==null?void 0:k.matrix,videoMatrixLimit:u,width:k==null?void 0:k.width,height:k==null?void 0:k.height}})},[k,u,C]);const[re,ue]=q(s.description),[X,pe]=z.split("/"),S=rt(a,250);te(()=>{S(re)},[re,S]);const[O,U]=q(!1),ie=V(null);te(()=>{let R;return O&&ie.current&&(R=setTimeout(()=>{ie.current.focus()},100)),()=>{clearTimeout(R)}},[O]);const se=e(Pe,{children:N&&!_?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(K,{id:"3wG7HI"})}),e("p",{title:re,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:ie,value:re||"",lang:n,placeholder:{image:l._({id:"Lh8B0N"}),video:l._({id:"mN4S+e"}),audio:l._({id:"ieZytw"})}[X],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||o==="loading",class:o==="loading"?"loading":"",maxlength:"1500",onInput:R=>{const{value:v}=R.target;ue(v)}})}),ae=V(null);te(()=>()=>{var R,v;(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)},[]);const D=V(null),de=R=>{const{type:v,details:L}=R;switch(v){case"imageSizeLimit":{const{imageSize:P,imageSizeLimit:J}=L;return l._({id:"d83/LB",values:{0:Xe(P),1:Xe(J)}})}case"imageMatrixLimit":{const{imageMatrix:P,imageMatrixLimit:J,width:Q,height:fe}=L,{newWidth:we,newHeight:Le}=Zt(P,J,Q,fe);return l._({id:"DuvOX/",values:{0:l.number(Q),1:l.number(fe),2:l.number(we),3:l.number(Le)}})}case"videoSizeLimit":{const{videoSize:P,videoSizeLimit:J}=L;return l._({id:"d83/LB",values:{0:Xe(P),1:Xe(J)}})}case"videoMatrixLimit":{const{videoMatrix:P,videoMatrixLimit:J,width:Q,height:fe}=L,{newWidth:we,newHeight:Le}=Zt(P,J,Q,fe);return l._({id:"DuvOX/",values:{0:l.number(Q),1:l.number(fe),2:l.number(we),3:l.number(Le)}})}case"videoFrameRateLimit":return l._({id:"S1fBwy"})}};return e(Pe,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{U(!0)},children:X==="image"?e("img",{src:M,alt:"",onLoad:R=>{if(!C)return;const{naturalWidth:v,naturalHeight:L}=R.target;j({matrix:v*L,width:v,height:L})}}):X==="video"||X==="gifv"?e("video",{src:M+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:R=>{if(!C)return;const{videoWidth:v,videoHeight:L}=R.target;v&&L&&G({matrix:v*L,width:v,height:L})}}):X==="audio"?e("audio",{src:M,controls:!0}):null}),se,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:c,children:e(Z,{icon:"x",alt:l._({id:"t/YqKh"})})}),!!m&&e("button",{type:"button",class:"media-error",title:de(m),onClick:()=>{D.current&&D.current.hideToast(),D.current=ze({text:de(m),duration:1e4})},children:e(Z,{icon:"alert",alt:l._({id:"SlfejT"})})})]})]}),O&&e(Qe,{onClose:()=>{U(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{U(!1)},children:e(Z,{icon:"x",alt:l._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:{image:l._({id:"oMslIB"}),video:l._({id:"WZw+zB"}),audio:l._({id:"KMtgtM"})}[X]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:X==="image"?e("img",{src:M,alt:""}):X==="video"||X==="gifv"?e("video",{src:M,playsinline:!0,controls:!0}):X==="audio"?e("audio",{src:M,controls:!0}):null}),e("div",{class:"media-form",children:[se,e("footer",{children:[X==="image"&&/^(png|jpe?g|gif|webp)$/i.test(pe)&&!!le.settings.mediaAltGenerator&&!!vt&&e(Dn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e(Z,{icon:"more",size:"l",alt:l._({id:"2FYpfJ"})})}),children:[e(Ot,{disabled:o==="loading",onClick:()=>{x("loading"),ae.current=ze({text:l._({id:"8zsp51"}),duration:-1}),async function(){var R,v;try{const L=new FormData;L.append("image",g);const P=await fetch(vt,{method:"POST",body:L}).then(J=>J.json());if(P.error)throw new Error(P.error);ue(P.description)}catch(L){ze(L.message?l._({id:"wy0Iwj",values:{0:L.message}}):l._({id:"xhYfVj"}))}finally{x("default"),(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)}}()},children:[e(Z,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(K,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(K,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e(Ot,{disabled:o==="loading",onClick:()=>{x("loading"),ae.current=ze({text:l._({id:"8zsp51"}),duration:-1}),async function(){var R,v;try{const L=new FormData;L.append("image",g);const P=`?lang=${n}`,J=await fetch(vt+P,{method:"POST",body:L}).then(Q=>Q.json());if(J.error)throw new Error(J.error);ue(J.description)}catch(L){ze(l._({id:"eNTGfp",values:{0:L!=null&&L.message?`: ${L.message}`:""}}))}finally{x("default"),(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)}}()},children:[e(Z,{icon:"sparkles2"}),e("small",{children:[e(K,{id:"o5sTJw"}),e("br",{}),e(K,{id:"m+pAEQ",values:{0:xt(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{U(!1)},disabled:o==="loading",children:e(K,{id:"DPfwMq"})})]})]})]})]})})]})}function zi({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:c,maxExpiration:l,minExpiration:o,maxCharactersPerOption:x}){const{_}=Ke(),{options:z,expiresIn:N,multiple:g}=t;return e("div",{class:`poll ${g?"multiple":""}`,children:[e("div",{class:"poll-choices",children:z.map((M,C)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:M,disabled:n,maxlength:x,placeholder:ge._({id:"LDUSXg",values:{0:C+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:$=>{const{value:T}=$.target;z[C]=T,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||z.length<=1,onClick:()=>{z.splice(C,1),a(t)},children:e(Z,{icon:"x",size:"s",alt:ge._({id:"t/YqKh"})})})]},C))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||z.length>=c,onClick:()=>{z.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:g,disabled:n,onChange:M=>{const{checked:C}=M.target;t.multiple=C,a(t)}})," ",e(K,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(K,{id:"lkz6PL"})," ",e("select",{value:N,disabled:n,onChange:M=>{const{value:C}=M.target;t.expiresIn=C,a(t)},children:Object.entries(sn).filter(([M])=>M>=o&&M<=l).map(([M,C])=>e("option",{value:M,children:C()},M))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(K,{id:"CDpQAX"})})})]})}function ke(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function Xt(s){for(let t in s)(s[t]===null||s[t]===void 0)&&delete s[t];return s}function _i({onClose:s=()=>{},onSelect:t=()=>{},defaultSearchTerm:n}){const{masto:a}=_t(),[c,l]=q("default"),[o,x]=q([]),[_,z]=q({}),[N,g]=q(0),M=async u=>{if(!(u!=null&&u.length))return;const h=await $n(u,_);h&&z({..._,...h})},C=u=>{u&&(l("loading"),(async()=>{try{const h=await a.v1.accounts.search.list({q:u,limit:40,resolve:!1});x(h),M(h),l("default")}catch{l("error")}})())},$=rt(C,1e3);te(()=>{C()},[C]);const T=V();te(()=>{T.current&&(T.current.focus(),T.current.value&&(T.current.selectionStart=T.current.value.length,T.current.selectionEnd=T.current.value.length))},[]),te(()=>{n&&C(n)},[n]);const ne=u=>{const h=u.acct;t(h),s()};$e("enter",()=>{const u=o[N];u&&ne(u)},{preventDefault:!0,enableOnFormTags:["input"]});const ee=V();return $e("down",()=>{N<o.length-1?g(N+1):g(0),setTimeout(()=>{const u=ee.current.querySelector(".selected");u&&u.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),$e("up",()=>{N>0?g(N-1):g(o.length-1),setTimeout(()=>{const u=ee.current.querySelector(".selected");u&&u.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),e("div",{id:"mention-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(Z,{icon:"x",alt:ge._({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:u=>{var h;u.preventDefault(),(h=$.flush)==null||h.call($)},children:e("input",{ref:T,required:!0,type:"search",class:"block",placeholder:ge._({id:"eH1bqp"}),onInput:u=>{const{value:h}=u.target;$(h)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:(o==null?void 0:o.length)>0?e("ul",{ref:ee,class:`accounts-list ${c==="loading"?"loading":""}`,children:o.map((u,h)=>{const m=_[u.id];return e("li",{class:h===N?"selected":"",children:[e(tn,{avatarSize:"xxl",account:u,relationship:m,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{ne(u)},children:e(Z,{icon:"plus",size:"xl",alt:ge._({id:"m16xKo"})})})]},u.id)})}):c==="loading"?e("div",{class:"ui-state",children:e(at,{abrupt:!0})}):c==="error"?e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"AThL/k"})})}):null})]})}function Li({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:c}){const[l,o]=q("default"),x=V([]),[_,z]=q([]),N=je(()=>Se.account.get("recentlyUsedCustomEmojis")||[]),g=V();te(()=>{o("loading"),(async()=>{try{const[h,m]=await rn(t,s);g.current=m,z(h),o("default")}catch{o("error")}})()},[]);const M=je(()=>{const h={"--recent--":N.filter(w=>_.find(f=>f.shortcode===w.shortcode))},m=[];return _.forEach(w=>{var f,j;if((j=(f=x.current)==null?void 0:f.push)==null||j.call(f,w),!w.category){m.push(w);return}h[w.category]||(h[w.category]=[]),h[w.category].push(w)}),m.length&&(h["--others--"]=m),h},[_]),C=V(),[$,T]=q(null),ne=$t(h=>{var w,f,j;const{value:m}=h.target;if(m){const k=(w=g.current)==null?void 0:w.search(m,{limit:zt});T(k.map(G=>G.item)),(j=(f=C.current)==null?void 0:f.scrollTo)==null||j.call(f,0,0)}else T(null)},[_]);te(()=>{c&&(_!=null&&_.length)&&ne({target:{value:c}})},[c,ne,_]);const ee=$t(h=>{a==null||a(h),n==null||n(),queueMicrotask(()=>{let m=Se.account.get("recentlyUsedCustomEmojis")||[];const w=m.findIndex(f=>f.shortcode===h.shortcode);w!==-1?(m.splice(w,1),m.unshift(h)):(m.unshift(h),m=m.filter(f=>{var j,k;return(k=(j=x.current)==null?void 0:j.find)==null?void 0:k.call(j,G=>G.shortcode===f.shortcode)}),m=m.slice(0,10)),Se.account.set("recentlyUsedCustomEmojis",m)})},[a]),u=V();return te(()=>{u.current&&(u.current.focus(),u.current.value&&(u.current.selectionStart=u.current.value.length,u.current.selectionEnd=u.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(Z,{icon:"x",alt:ge._({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(K,{id:"8i6Ueo"})})," ",l==="loading"?e(at,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:h=>{h.preventDefault();const m=$[0];m&&ee(`:${m.shortcode}:`)},children:e("input",{ref:u,type:"search",placeholder:ge._({id:"EarrCe"}),onInput:ne,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:c||""})})]}),e("main",{ref:C,children:$!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:$.map(h=>e("li",{class:"custom-emojis-match",children:e(on,{emoji:h,onClick:()=>{ee(`:${h.shortcode}:`)},showCode:!0})},h.shortcode))}):e("div",{class:"custom-emojis-list",children:[l==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"Kzwsg2"})})}),l==="default"&&Object.entries(M).map(([h,m])=>!!(m!=null&&m.length)&&e("div",{class:"section-container",children:[e("div",{class:"section-header",children:{"--recent--":ge._({id:"uabU9X"}),"--others--":ge._({id:"NuKR0h"})}[h]||h}),e(Ai,{emojis:m,onSelect:ee})]}))]})})]})}const Ai=en(({emojis:s,onSelect:t})=>{const{i18n:n}=Ke(),[a,c]=q(zt),l=s.length>a;return e("section",{children:[s.slice(0,a).map(o=>e(on,{emoji:o,onClick:()=>{t(`:${o.shortcode}:`)}},o.shortcode)),l&&e("button",{type:"button",class:"plain small",onClick:()=>c(a+zt),children:e(K,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),on=en(({emoji:s,onClick:t,showCode:n})=>{const a=c=>{const o=c.currentTarget.closest("main");if(o){const x=o.getBoundingClientRect(),_=c.currentTarget.getBoundingClientRect(),z=c.currentTarget.classList;_.left<x.left+88?(z.add("edge-left"),z.remove("edge-right")):_.right>x.right-88?(z.add("edge-right"),z.remove("edge-left")):z.remove("edge-left","edge-right")}};return e("button",{type:"button",className:"plain4",onClick:t,"data-title":n?void 0:s.shortcode,onPointerEnter:a,onFocus:a,children:[e("picture",{children:[!!s.staticUrl&&e("source",{srcSet:s.staticUrl,media:"(prefers-reduced-motion: reduce)"}),e("img",{className:"shortcode-emoji",src:s.url||s.staticUrl,alt:s.shortcode,width:"24",height:"24",loading:"lazy",decoding:"async"})]}),n&&e(Pe,{children:[" ",e("code",{children:s.shortcode})]})]})}),yt=20;function Si({onClose:s=()=>{},onSelect:t=()=>{}}){var C,$,T,ne,ee,u;const{i18n:n}=Ke(),[a,c]=q("default"),[l,o]=q([]),x=V(null),_=V(null),z=V(0),N=V(null);function g({offset:h}){var m,w,f;(m=_.current)!=null&&m.value&&(c("loading"),(f=(w=N.current)==null?void 0:w.scrollTo)==null||f.call(w,{top:0,left:0,behavior:"smooth"}),(async()=>{var j;try{const k={api_key:si,q:_.current.value,rating:"g",limit:yt,bundle:"messaging_non_clips",offset:h,lang:n.locale||"en"},G=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(k),{referrerPolicy:"no-referrer"}).then(re=>re.json());z.current=((j=G.pagination)==null?void 0:j.offset)||0,o(G),c("results")}catch{c("error")}})())}te(()=>{var h;(h=_.current)==null||h.focus()},[]);const M=rt(()=>{g({offset:0})},1e3);return e("div",{id:"gif-picker-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(Z,{icon:"x",alt:n._({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:x,onSubmit:h=>{h.preventDefault(),g({offset:0})},children:[e("input",{ref:_,type:"search",name:"q",placeholder:n._({id:"wxlF9B"}),required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:M}),e("input",{type:"image",class:"powered-button",src:ei,width:"86",height:"30",alt:n._({id:"c1Q/eU"})})]})}),e("main",{ref:N,class:a==="loading"?"loading":"",children:[a==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(K,{id:"9KEidY"})})}),a==="loading"&&!((C=l==null?void 0:l.data)!=null&&C.length)&&e("div",{class:"ui-state",children:e(at,{abrupt:!0})}),(($=l==null?void 0:l.data)==null?void 0:$.length)>0?e(Pe,{children:[e("ul",{children:l.data.map(h=>{const{id:m,images:w,title:f,alt_text:j}=h,{fixed_height_small:k,fixed_height_downsampled:G,fixed_height:re,original:ue}=w,X=k!=null&&k.url?k:G!=null&&G.url?G:re;let{url:pe,webp:S,width:O,height:U}=X;+U>100&&(O=O/U*100,U=100);const ie=URL.parse(pe),se=ie.origin+ie.pathname;let ae;if(S){const D=URL.parse(S);ae=D.origin+D.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:D,url:de}=ue,R=D||de,v=URL.parse(R),L=v.origin+v.pathname;s(),t({url:L,type:D?"video/mp4":"image/gif",alt_text:j||f})},children:e("figure",{style:{"--figure-width":O+"px"},children:[e("picture",{children:[ae&&e("source",{srcset:ae,type:"image/webp"}),e("img",{src:se,width:O,height:U,loading:"lazy",decoding:"async",alt:j,referrerpolicy:"no-referrer",onLoad:D=>{D.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:j||f})]})})},m)})}),e("p",{class:"pagination",children:[((T=l.pagination)==null?void 0:T.offset)>0&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var h;g({offset:((h=l.pagination)==null?void 0:h.offset)-yt})},children:[e(Z,{icon:"chevron-left"}),e("span",{children:e(K,{id:"DHhJ7s"})})]}),e("span",{}),((ne=l.pagination)==null?void 0:ne.offset)+((ee=l.pagination)==null?void 0:ee.count)<((u=l.pagination)==null?void 0:u.total_count)&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var h;g({offset:((h=l.pagination)==null?void 0:h.offset)+yt})},children:[e("span",{children:e(K,{id:"hXzOVo"})})," ",e(Z,{icon:"chevron-right"})]})]})]}):a==="results"&&e("div",{class:"ui-state",children:e("p",{children:"No results"})}),a==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"PbFw9n"})})})]})]})}export{Ti as default};
//# sourceMappingURL=compose-xua1VIA2.js.map