phanpy-cz/assets/compose-feY08m5z.js
archos 2afe460672 Enhance language preferences and RTL support
- Set sort order when filtering by Boosts in Catch-up
- Fix bugs related to user language preferences
- Improve RTL text direction handling
- Disable scroll snap for wider viewports
- Add support for new post languages (Jawi Malay, Kashubian, Mohawk, and more)
2024-08-11 19:34:25 +02:00

27 lines
81 KiB
JavaScript
Raw Permalink 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 Lt=s=>{throw TypeError(s)};var rt=(s,e,n)=>e.has(s)||Lt("Cannot "+n);var _=(s,e,n)=>(rt(s,e,"read from private field"),n?n.call(s):e.get(s)),re=(s,e,n)=>e.has(s)?Lt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,n),he=(s,e,n,a)=>(rt(s,e,"write to private field"),a?a.call(s,n):e.set(s,n),n),Y=(s,e,n)=>(rt(s,e,"access private method"),n);import{F as on,B as rn,_ as ln,a as _e,a8 as cn,w as zt,u as un,i as Ht,b as dn,I as V,y as At,h as Nt,a9 as hn,M as Ve,s as Ee,a4 as pn,a0 as mn,n as gn,O as fn,X as Qe,c as vn,d as St,l as bn,x as yn}from"./fuse-7xj_Hrid.js";import{s as le,a as bt,h as U,A as q,f as xn,al as Ut,d as ze,y as te,m as wn,am as kn,T as Re,c as t,k as Le,b as En,L as et,j as Fn,D as Cn,u as Ln,q as It,x as Wt}from"./useTitle-4zhrJw0D.js";import{e as zn}from"./tinyld-light-PxOyhYWY.js";import"./index-ELVm98zU.js";class An{constructor(e,n,{tabInsertsSuggestions:a,defaultFirstOption:r}={}){this.input=e,this.list=n,this.tabInsertsSuggestions=a??!0,this.defaultFirstOption=r??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=p=>Sn(p,this),this.compositionEventHandler=p=>Mn(p,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.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",Mt),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",Mt)}indicateDefaultOption(){var e;this.defaultFirstOption&&((e=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(lt)[0])===null||e===void 0||e.setAttribute("data-combobox-option-default","true"))}navigate(e=1){const n=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(lt)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(lt),r=a.indexOf(n);if(r===a.length-1&&e===1||r===0&&e===-1){this.clearSelection(),this.input.focus();return}let p=e===1?0:a.length-1;if(n&&r>=0){const v=r+e;v>=0&&v<a.length&&(p=v)}const u=a[p];if(u)for(const v of a)v.removeAttribute("data-combobox-option-default"),u===v?(this.input.setAttribute("aria-activedescendant",u.id),u.setAttribute("aria-selected","true"),$n(this.list,u)):v.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const e of this.list.querySelectorAll('[aria-selected="true"]'))e.removeAttribute("aria-selected");this.indicateDefaultOption()}}function Sn(s,e){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!e.ctrlBindings&&s.ctrlKey)&&!e.isComposing)switch(s.key){case"Enter":$t(e.input,e.list)&&s.preventDefault();break;case"Tab":e.tabInsertsSuggestions&&$t(e.input,e.list)&&s.preventDefault();break;case"Escape":e.clearSelection();break;case"ArrowDown":e.navigate(1),s.preventDefault();break;case"ArrowUp":e.navigate(-1),s.preventDefault();break;case"n":e.ctrlBindings&&s.ctrlKey&&(e.navigate(1),s.preventDefault());break;case"p":e.ctrlBindings&&s.ctrlKey&&(e.navigate(-1),s.preventDefault());break;default:if(s.ctrlKey)break;e.clearSelection()}}function Mt(s){if(!(s.target instanceof Element))return;const e=s.target.closest('[role="option"]');e&&e.getAttribute("aria-disabled")!=="true"&&In(e)}function $t(s,e){const n=e.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return n?(n.getAttribute("aria-disabled")==="true"||n.click(),!0):!1}function In(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function lt(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function Mn(s,e){e.isComposing=s.type==="compositionstart",document.getElementById(e.input.getAttribute("aria-controls")||"")&&e.clearSelection()}function $n(s,e){Tn(s,e)||(s.scrollTop=e.offsetTop)}function Tn(s,e){const n=s.scrollTop,a=n+s.clientHeight,r=e.offsetTop,p=r+e.clientHeight;return r>=n&&p<=a}const Bn=/\s|\(|\[/;function _n(s,e,n,{multiWord:a,lookBackIndex:r,lastMatchPosition:p}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let u=s.lastIndexOf(e,n-1);if(u===-1||u<r)return;if(a){if(p!=null){if(p===u)return;u=p-e.length}if(s[u+1]===" "&&n>=u+e.length+1||s.lastIndexOf(`
`,n-1)>u||s.lastIndexOf(".",n-1)>u)return}else if(s.lastIndexOf(" ",n-1)>u)return;const v=s[u-1];return v&&!Bn.test(v)?void 0:{text:s.substring(u+e.length,n),position:u+e.length}}class Rn extends HTMLElement{}class Dn extends Event{constructor(){super("update")}}const ct=new WeakMap;var De,je,Fe,ve,Z,Te,Ae,Se,pt,Ie,Ge,Ye,Ze,Pe,Ce;const xt=class xt extends Rn{constructor(n){super();re(this,Z);re(this,De,new MutationObserver(()=>Y(this,Z,Ye).call(this)));re(this,je,new ResizeObserver(()=>Y(this,Z,Ge).call(this)));re(this,Fe);re(this,ve);re(this,Ae,0);re(this,Se,0);re(this,Ie,!1);re(this,Pe,()=>Y(this,Z,Ze).call(this));re(this,Ce,n=>{Y(this,Z,Te).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&Y(this,Z,Ge).call(this)})});he(this,Fe,new WeakRef(n)),he(this,ve,document.createElement("div")),_(this,ve).style.position="absolute",_(this,ve).style.pointerEvents="none",n.after(_(this,ve)),_(this,ve).appendChild(this)}static for(n){const a=ct.get(n)??new xt(n);return ct.set(n,a),a}forceUpdate(){Y(this,Z,Ye).call(this),Y(this,Z,Ze).call(this)}connectedCallback(){const n=_(this,Fe).deref();if(!n)return this.remove();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,Z,Ye).call(this),Y(this,Z,Ze).call(this),_(this,De).observe(n,{attributeFilter:["style","dir"]}),_(this,je).observe(n),document.addEventListener("scroll",_(this,Ce),{capture:!0}),window.addEventListener("resize",_(this,Ce),{capture:!0}),n.addEventListener("input",_(this,Pe),{capture:!0})}disconnectedCallback(){_(this,ve).remove(),_(this,De).disconnect(),_(this,je).disconnect(),document.removeEventListener("scroll",_(this,Ce),{capture:!0}),window.removeEventListener("resize",_(this,Ce),{capture:!0});const n=_(this,Fe).deref();n&&(n.removeEventListener("input",_(this,Pe),{capture:!0}),ct.delete(n))}};De=new WeakMap,je=new WeakMap,Fe=new WeakMap,ve=new WeakMap,Z=new WeakSet,Te=function(n){const a=_(this,Fe).deref();return a?n(a):this.remove()},Ae=new WeakMap,Se=new WeakMap,pt=function(){Y(this,Z,Te).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 r=n.getBoundingClientRect(),p=this.getBoundingClientRect();he(this,Ae,_(this,Ae)+r.left-p.left),he(this,Se,_(this,Se)+r.top-p.top),this.style.transform=`translate(${_(this,Ae)}px, ${_(this,Se)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new Dn)})},Ie=new WeakMap,Ge=function(){_(this,Ie)||(he(this,Ie,!0),requestAnimationFrame(()=>{Y(this,Z,pt).call(this),he(this,Ie,!1)}))},Ye=function(){Y(this,Z,Te).call(this,n=>{const a=window.getComputedStyle(n);for(const r of jn)this.style[r]=a[r];Y(this,Z,Ge).call(this)})},Ze=function(){Y(this,Z,Te).call(this,n=>{this.textContent=n.value,Y(this,Z,pt).call(this)})},Pe=new WeakMap,Ce=new WeakMap;let Je=xt;const jn=["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",Je)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var ge,Me,$e,ce,gt,qt,ft,Be;const Xe=class Xe{constructor(e,n=0,a=n){re(this,ce);re(this,ge);re(this,Me);re(this,$e);he(this,ge,e),he(this,Me,n),he(this,$e,a)}static fromSelection(e){const{selectionStart:n,selectionEnd:a}=e;return new Xe(e,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return _(this,ge)}get endContainer(){return _(this,ge)}get startContainer(){return _(this,ge)}get startOffset(){return _(this,Me)}get endOffset(){return _(this,$e)}setStartOffset(e){he(this,Me,Y(this,ce,ft).call(this,e))}setEndOffset(e){he(this,$e,Y(this,ce,ft).call(this,e))}collapse(e=!1){e?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Y(this,ce,Be).call(this).cloneContents()}cloneRange(){return new Xe(_(this,ge),this.startOffset,this.endOffset)}getBoundingClientRect(){return Y(this,ce,Be).call(this).getBoundingClientRect()}getClientRects(){return Y(this,ce,Be).call(this).getClientRects()}toString(){return Y(this,ce,Be).call(this).toString()}getStyleClone(){return _(this,ce,gt)}};ge=new WeakMap,Me=new WeakMap,$e=new WeakMap,ce=new WeakSet,gt=function(){return Je.for(_(this,ge))},qt=function(){return _(this,ce,gt)},ft=function(e){return Math.max(0,Math.min(e,_(this,ge).value.length))},Be=function(){const e=document.createRange(),n=_(this,ce,qt).childNodes[0];return n&&(e.setStart(n,this.startOffset),e.setEnd(n,this.endOffset)),e};let mt=Xe;const qe=new WeakMap;class Pn{constructor(e,n){this.expander=e,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(e,n){var a,r;this.input!==document.activeElement&&this.input!==((r=(a=document.activeElement)===null||a===void 0?void 0:a.shadowRoot)===null||r===void 0?void 0:r.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 An(this.input,n),this.expander.dispatchEvent(new Event("text-expander-activate")),this.positionMenu(n,e.position),this.combobox.start(),n.addEventListener("combobox-commit",this.oncommit),n.addEventListener("mousedown",this.onmousedown),this.combobox.navigate(1))}positionMenu(e,n){const a=new mt(this.input,n).getBoundingClientRect(),r={left:a.left,top:a.top+a.height},p=e.getBoundingClientRect(),u={left:r.left-p.left,top:r.top-p.top};if(u.left!==0||u.top!==0){const v=getComputedStyle(e);e.style.left=v.left?`calc(${v.left} + ${u.left}px)`:`${u.left}px`,e.style.top=v.top?`calc(${v.top} + ${u.top}px)`:`${u.top}px`}}deactivate(){const e=this.menu;return!e||!this.combobox?!1:(this.expander.dispatchEvent(new Event("text-expander-deactivate")),this.menu=null,e.removeEventListener("combobox-commit",this.oncommit),e.removeEventListener("mousedown",this.onmousedown),this.combobox.destroy(),this.combobox=null,e.remove(),!0)}onCommit({target:e}){var n;const a=e;if(!(a instanceof HTMLElement)||!this.combobox)return;const r=this.match;if(!r)return;const p=this.input.value.substring(0,r.position-r.key.length),u=this.input.value.substring(r.position+r.text.length),v={item:a,key:r.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:v}))||!v.value)return;let R=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";v.continue&&(R="");const F=`${v.value}${R}`;this.input.value=p+F+u;const w=p.length+F.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=w,this.input.selectionEnd=w,v.continue||(this.lookBackIndex=w,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 e=this.findMatch();if(e){this.match=e;const n=await this.notifyProviders(e);if(!this.match)return;n?this.activate(e,n):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const e=this.input.selectionEnd||0,n=this.input.value;e<=this.lookBackIndex&&(this.lookBackIndex=e-1);for(const{key:a,multiWord:r}of this.expander.keys){const p=_n(n,a,e,{multiWord:r,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(p)return{text:p.text,key:a,position:p.position}}}async notifyProviders(e){const n=[],a=v=>n.push(v);return this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:e.text,key:e.key}}))?(await Promise.all(n)).filter(v=>v.matched).map(v=>v.fragment)[0]:void 0}onMousedown(){this.interactingWithList=!0}onKeydown(e){e.key==="Escape"&&(this.match=null,this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex,e.stopImmediatePropagation(),e.preventDefault()))}}class Tt extends HTMLElement{get keys(){const e=this.getAttribute("keys"),n=e?e.split(" "):[],a=this.getAttribute("multiword"),r=a?a.split(" "):[],p=r.length===0&&this.hasAttribute("multiword");return n.map(u=>({key:u,multiWord:p||r.includes(u)}))}connectedCallback(){const e=this.querySelector('input[type="text"], textarea');if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return;const n=new Pn(this,e);qe.set(this,n)}disconnectedCallback(){const e=qe.get(this);e&&(e.destroy(),qe.delete(this))}dismiss(){const e=qe.get(this);e&&e.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Tt,window.customElements.define("text-expander",Tt));function On({onlyFirst:s=!1}={}){const e=["[\\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(e,s?void 0:"g")}const Hn=On();function Nn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Hn,"")}const Un=new Intl.Segmenter;function Bt(s,{countAnsiEscapeCodes:e=!1}={}){if(s===""||(e||(s=Nn(s)),s===""))return 0;let n=0;for(const a of Un.segment(s))n++;return n}const Wn="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",yt=[["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","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],qn="(((?:[^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\\-_&=#\\/])?))",Kn="gi",_t={source:qn,flags:Kn};var Vn={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"};const{PHANPY_IMG_ALT_API_URL:ut,PHANPY_GIPHY_API_KEY:Gn}=Vn,Yn=yt.reduce((s,e)=>{const[n,a,r]=e;return s[n]={common:a,native:r},s},{}),Kt={"5 minutes":5*60,"30 minutes":30*60,"1 hour":60*60,"6 hours":6*60*60,"12 hours":12*60*60,"1 day":24*60*60,"3 days":3*24*60*60,"7 days":7*24*60*60},Zn=Object.values(Kt),Rt=24*60*60,Dt=s=>{if(!s)return Rt;const e=(new Date(s).getTime()-Date.now())/1e3;return Zn.find(n=>n>=e)||Rt},xe=document.createElement("ul");xe.role="listbox";xe.className="text-expander-menu";const Jn=16,Xn=new IntersectionObserver(s=>{s.forEach(e=>{if(e.isIntersecting){const{left:n,width:a}=e.boundingClientRect,{innerWidth:r}=window;if(n+a>r){const p=on()?"right":"left";xe.style[p]=r-a-Jn+"px"}}})});Xn.observe(xe);const ke=rn([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],yt.map(s=>s[0]),"en"),Vt=new RegExp(_t.source,_t.flags),Qn=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,ei="$2xxxxxxxxxxxxxxxxxxxxxxx";function ti(s){return s.replace(Vt,ei).replace(Qn,"$1@$3")}const ni=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,ii=new RegExp(`(^|[^=\\/\\w])(@${ni.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),si=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),ai="[a-zA-Z0-9_]{2,}",oi=new RegExp(`(^|[^=\\/\\w])(:${ai}:)(?=[^A-Za-z0-9_:]|$)`,"g"),ri=new Intl.Segmenter;function dt(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function li(s,{maxCharacters:e=1/0}){const{composerCharacterCount:n}=le;if(n>e){let a="",r="";const p=ri.segment(s);for(const{segment:u,index:v}of p)v<e?a+=u:r+=u;return r&&(r='<mark class="compose-highlight-exceeded">'+dt(r)+"</mark>"),dt(a)+r}return dt(s).replace(Vt,'$2<mark class="compose-highlight-url">$3</mark>').replace(ii,'$1<mark class="compose-highlight-mention">$2</mark>').replace(si,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(oi,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const ci=new Intl.RelativeTimeFormat,vt=100;function Ci({onClose:s,replyToStatus:e,editStatus:n,draftStatus:a,standalone:r,hasOpener:p}){var Ct;const{masto:u,instance:v}=bt(),[g,R]=U("default"),F=q((a==null?void 0:a.uid)||ln()),w=xn(),L=w.info,J=Ut(),{statuses:{maxCharacters:D,maxMediaAttachments:I,charactersReservedPerUrl:se}={},mediaAttachments:{supportedMimeTypes:X=[],imageSizeLimit:l,imageMatrixLimit:d,videoSizeLimit:h,videoMatrixLimit:f,videoFrameRateLimit:k}={},polls:{maxOptions:x,maxCharactersPerOption:T,maxExpiration:K,minExpiration:de}={}}=J||{},z=q(),Q=q(),[G,W]=U("public"),[P,ne]=U(!1),[O,ie]=U(ze.session.get("currentLanguage")||ke),ae=q(O),[M,S]=U([]),[$,C]=U(null),N=ze.account.get("preferences")||{},ee=()=>{z.current&&z.current.dispatchEvent(new Event("input"))},oe=()=>{setTimeout(()=>{var o,c,y;z.current&&((c=(o=a==null?void 0:a.status)==null?void 0:o.startsWith)!=null&&c.call(o,`
`)&&(z.current.selectionStart=0,z.current.selectionEnd=0),(y=z.current)==null||y.focus())},300)};te(()=>{var o,c;if(e){const{spoilerText:y,visibility:m,language:B,sensitive:E}=e;y&&Q.current&&(Q.current.value=y);const b=[...new Set([e.account.acct,...e.mentions.map(A=>A.acct)])].filter(A=>A!==L.acct);b.length>0&&(z.current.value=`${b.map(A=>`@${A}`).join(" ")} `,ee()),oe(),W(m==="public"&&N["posting:default:visibility"]?N["posting:default:visibility"].toLowerCase():m),ie(B||((o=N["posting:default:language"])==null?void 0:o.toLowerCase())||ke),ne(E&&!!y)}else if(n){const{visibility:y,language:m,sensitive:B,poll:E,mediaAttachments:j}=n,b=!!(E!=null&&E.options)&&{...E,options:E.options.map(A=>(A==null?void 0:A.title)||A),expiresIn:(E==null?void 0:E.expiresIn)||Dt(E.expiresAt)};R("loading"),(async()=>{var A;try{const H=await u.v1.statuses.$select(n.id).source.fetch(),{text:ue,spoilerText:pe}=H;z.current.value=ue,z.current.dataset.source=ue,ee(),oe(),Q.current.value=pe,W(y),ie(m||((A=N["posting:default:language"])==null?void 0:A.toLowerCase())||ke),ne(B),b&&C(b),S(j),R("default")}catch(H){alert((H==null?void 0:H.reason)||H),R("error")}})()}else oe(),N["posting:default:visibility"]&&W(N["posting:default:visibility"].toLowerCase()),N["posting:default:language"]&&ie(N["posting:default:language"].toLowerCase()),N["posting:default:sensitive"]&&ne(!!N["posting:default:sensitive"]);if(a){const{status:y,spoilerText:m,visibility:B,language:E,sensitive:j,poll:b,mediaAttachments:A}=a,H=!!(b!=null&&b.options)&&{...b,options:b.options.map(ue=>(ue==null?void 0:ue.title)||ue),expiresIn:(b==null?void 0:b.expiresIn)||Dt(b.expiresAt)};z.current.value=y,ee(),oe(),m&&(Q.current.value=m),B&&W(B),ie(E||((c=N["posting:default:language"])==null?void 0:c.toLowerCase())||ke),j!==null&&ne(j),H&&C(H),A&&S(A)}},[a,n,e]);const me=q(),be="You have unsaved changes. Discard this post?",we=()=>{const{value:o,dataset:c}=z.current;if(g==="loading")return!1;const y=(o||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),m=M.length>0;if(!y&&!m||M.length>0&&M.every(A=>A.id))return!0;const E=(e==null?void 0:e.account.id)===L.id,j=e&&o.trim()===`@${e.account.acct}`;return!!(!E&&j||o===(c==null?void 0:c.source))},Oe=()=>we()?!0:confirm(be);te(()=>{const o=c=>{we()||(c.preventDefault(),c.returnValue=be)};return window.addEventListener("beforeunload",o,{capture:!0}),()=>window.removeEventListener("beforeunload",o,{capture:!0})},[]);const Zt=()=>{const{value:o}=z.current,{value:c}=Q.current;return Bt(ti(o))+Bt(c)},tt=()=>{const o=Zt();le.composerCharacterCount=o};te(tt,[]);const wt=window.CloseWatcher,nt=q(!1);_e("esc",()=>{nt.current=!0},{enabled:!wt,enableOnFormTags:!0}),_e("esc",()=>{!r&&nt.current&&Oe()&&s(),nt.current=!1},{enabled:!wt,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:o=>{const c=document.querySelectorAll("#modal-container > *"),y=!!c,m=c.length===1&&c[0].querySelector("#compose-container");return y&&!m}}),cn(()=>{!r&&Oe()&&s()},[r,Oe,s]);const kt=q({}),Et=()=>`${wn()}#${F.current}`,it=()=>{if(n||le.composerState.minimized)return;const o=Et(),c={key:o,replyTo:e?{id:e.id,account:{id:e.account.id,username:e.account.username,acct:e.account.acct}}:null,draftStatus:{uid:F.current,status:z.current.value,spoilerText:Q.current.value,visibility:G,language:O,sensitive:P,poll:$,mediaAttachments:M}};!kn(c,kt.current)&&!we()&&(zt.drafts.set(o,{...c,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(y=>{}),kt.current=structuredClone(c))};un(it,5e3),te(()=>(it(),()=>{zt.drafts.del(Et())}),[]),te(()=>{const o=y=>{const{items:m}=y.clipboardData||y.dataTransfer,B=[];for(let E=0;E<m.length;E++){const j=m[E];if(j.kind==="file"){const b=j.getAsFile();b&&X.includes(b.type)&&B.push(b)}}if(B.length>0&&M.length>=I){alert(`You can only attach up to ${I} files.`);return}if(B.length>0){y.preventDefault(),y.stopPropagation();const E=I-M.length,j=B.slice(0,E);if(j.length<=0){alert(`You can only attach up to ${I} files.`);return}const b=j.map(A=>({file:A,type:A.type,size:A.size,url:URL.createObjectURL(A),id:null,description:null}));S([...M,...b])}};window.addEventListener("paste",o);const c=y=>{y.dataTransfer.items.length>0&&(y.preventDefault(),y.stopPropagation())};return window.addEventListener("dragover",c),window.addEventListener("drop",o),()=>{window.removeEventListener("paste",o),window.removeEventListener("dragover",c),window.removeEventListener("drop",o)}},[M]);const[He,st]=U(!1),[Ne,Ue]=U(!1),[Jt,at]=U(!1),[fe,Xt]=U(null),[Qt,en]=Re(()=>{const o=[],c=[],{contentTranslationHideLanguages:y=[]}=le.settings;return yt.forEach(m=>{const[B]=m;B===O||B===ae.current||B===ke||y.includes(B)||fe!=null&&fe.length&&fe.includes(B)?o.push(m):c.push(m)}),o.sort(([m,B],[E,j])=>m===O?-1:E===O?1:B.localeCompare(j)),c.sort(([m,B],[E,j])=>B.localeCompare(j)),[o,c]},[O,fe]),Ft=Re(()=>!!(e!=null&&e.createdAt)&&Math.floor((Date.now()-new Date(e.createdAt))/(1e3*60*60*24*30)),[e]),tn=()=>{it(),le.composerState.minimized=!0};return t("div",{id:"compose-container-outer",children:[t("div",{id:"compose-container",class:r?"standalone":"",children:[t("div",{class:"compose-top",children:[(L==null?void 0:L.avatarStatic)&&t(Ht,{account:L,accountInstance:w.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),r?p&&t("button",{type:"button",class:"light pop-button",disabled:g==="loading",onClick:()=>{var o;if(!window.opener){alert("Looks like you closed the parent window.");return}if(window.opener.__STATES__.showCompose){if((o=window.opener.__STATES__.composerState)!=null&&o.publishing){alert("Looks like you already have a compose field open in the parent window and currently publishing. Please wait for it to be done and try again later.");return}if(!confirm("Looks like you already have a compose field open in the parent window. Popping in this window will discard the changes you made in the parent window. Continue?"))return}s({fn:()=>{const c={editStatus:n,replyToStatus:e,draftStatus:{uid:F.current,status:z.current.value,spoilerText:Q.current.value,visibility:G,language:O,sensitive:P,poll:$,mediaAttachments:M}};window.opener.__COMPOSE__=c,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:t(V,{icon:"popin",alt:"Pop in"})}):t("span",{class:"compose-controls",children:[t("button",{type:"button",class:"plain4 pop-button",disabled:g==="loading",onClick:()=>{dn({editStatus:n,replyToStatus:e,draftStatus:{uid:F.current,status:z.current.value,spoilerText:Q.current.value,visibility:G,language:O,sensitive:P,poll:$,mediaAttachments:M}})&&s()},children:t(V,{icon:"popout",alt:"Pop out"})}),t("button",{type:"button",class:"plain4 min-button",onClick:tn,children:t(V,{icon:"minimize",alt:"Minimize"})})," ",t("button",{type:"button",class:"light close-button",disabled:g==="loading",onClick:()=>{Oe()&&s()},children:t(V,{icon:"x"})})]})]}),!!e&&t("div",{class:"status-preview",children:[t(At,{status:e,size:"s",previewMode:!0}),t("div",{class:"status-preview-legend reply-to",children:["Replying to @",e.account.acct||e.account.username,"s post",Ft>=3&&t(Le,{children:[" ","(",t("strong",{children:ci.format(-Ft,"month")}),")"]})]})]}),!!n&&t("div",{class:"status-preview",children:[t(At,{status:n,size:"s",previewMode:!0}),t("div",{class:"status-preview-legend",children:"Editing source post"})]}),t("form",{ref:me,class:`form-visibility-${G}`,style:{pointerEvents:g==="loading"?"none":"auto",opacity:g==="loading"?.5:1},onKeyDown:o=>{o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&me.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:o=>{o.preventDefault();const c=new FormData(o.target),y=Object.fromEntries(c.entries());let{status:m,visibility:B,sensitive:E,spoilerText:j}=y;if(E=E==="on",$){if($.options.length<2){alert("Poll must have at least 2 options");return}if($.options.some(b=>b==="")){alert("Some poll choices are empty");return}}M.length>0&&M.some(A=>{var H,ue;return!((ue=(H=A.description)==null?void 0:H.trim)!=null&&ue.call(H))})&&!confirm("Some media have no descriptions. Continue?")||(j=E&&j||void 0,m=m===""?void 0:m,le.composerState.publishing=!0,R("loading"),(async()=>{try{if(M.length>0){const H=M.map(pe=>{const{file:We,description:nn,id:sn}=pe;if(sn)return pe;{const an=Ot({file:We,description:nn});return u.v2.media.create(an).then(ot=>(ot.id&&(pe.id=ot.id),ot))}}),ue=await Promise.allSettled(H);if(ue.some(pe=>{var We;return pe.status==="rejected"||!((We=pe.value)!=null&&We.id)})){le.composerState.publishing=!1,le.composerState.publishingError=!0,R("error"),ue.forEach(pe=>{pe.status==="rejected"&&alert(pe.reason||`Attachment #${i} failed`)});return}}let b={status:m,spoiler_text:j,language:O,sensitive:E,poll:$,media_ids:M.map(H=>H.id)};n&&Nt("@mastodon/edit-media-attributes")?b.media_attributes=M.map(H=>({id:H.id,description:H.description})):n||(b.visibility=B,b.in_reply_to_id=(e==null?void 0:e.id)||void 0),b=Ot(b);let A;if(n)A=await u.v1.statuses.$select(n.id).update(b),En(A,v,{skipThreading:!0});else try{A=await u.v1.statuses.create(b,{requestInit:{headers:{"Idempotency-Key":F.current}}})}catch{A=await u.v1.statuses.create(b)}le.composerState.minimized=!1,le.composerState.publishing=!1,R("default"),s({type:n?"edit":e?"reply":"post",newStatus:A,instance:v})}catch(b){le.composerState.publishing=!1,le.composerState.publishingError=!0,alert((b==null?void 0:b.reason)||b),R("error")}})())},children:[t("div",{class:"toolbar stretch",children:[t("input",{ref:Q,type:"text",name:"spoilerText",placeholder:"Content warning",disabled:g==="loading",class:"spoiler-text-field",lang:O,spellCheck:"true",dir:"auto",style:{opacity:P?1:0,pointerEvents:P?"auto":"none"},onInput:()=>{tt()}}),t("label",{class:`toolbar-button ${P?"highlight":""}`,title:"Content warning or sensitive media",children:[t("input",{name:"sensitive",type:"checkbox",checked:P,disabled:g==="loading",onChange:o=>{var y,m;const c=o.target.checked;ne(c),c?(y=Q.current)==null||y.focus():(m=z.current)==null||m.focus()}}),t(V,{icon:`eye-${P?"close":"open"}`})]})," ",t("label",{class:`toolbar-button ${G!=="public"&&!P?"show-field":""} ${G!=="public"?"highlight":""}`,title:`Visibility: ${G}`,children:[t(V,{icon:hn[G],alt:G}),t("select",{name:"visibility",value:G,onChange:o=>{W(o.target.value)},disabled:g==="loading"||!!n,dir:"auto",children:[t("option",{value:"public",children:["Public ",t(V,{icon:"earth"})]}),t("option",{value:"unlisted",children:"Unlisted"}),t("option",{value:"private",children:"Followers only"}),t("option",{value:"direct",children:"Private mention"})]})]})," "]}),t(hi,{ref:z,placeholder:e?"Post your reply":n?"Edit your post":"What are you doing?",required:(M==null?void 0:M.length)===0,disabled:g==="loading",lang:O,onInput:()=>{tt()},maxCharacters:D,performSearch:o=>{const{type:c,q:y,limit:m}=o;return c==="accounts"?u.v1.accounts.search.list({q:y,limit:m,resolve:!1}):u.v2.search.fetch(o)},onTrigger:o=>{(o==null?void 0:o.name)==="custom-emojis"?Ue({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="mention"?st({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="auto-detect-language"&&(o!=null&&o.languages)&&Xt(o.languages)}}),(M==null?void 0:M.length)>0&&t("div",{class:"media-attachments",children:[M.map((o,c)=>{const{id:y,file:m}=o,B=(m==null?void 0:m.size)+(m==null?void 0:m.type)+(m==null?void 0:m.name);return t(mi,{attachment:o,disabled:g==="loading",lang:O,onDescriptionChange:E=>{S(j=>{const b=[...j];return b[c].description=E,b})},onRemove:()=>{S(E=>E.filter((j,b)=>b!==c))}},y||B||c)}),t("label",{class:"media-sensitive",children:[t("input",{name:"sensitive",type:"checkbox",checked:P,disabled:g==="loading",onChange:o=>{const c=o.target.checked;ne(c)}})," ",t("span",{children:"Mark media as sensitive"})," ",t(V,{icon:`eye-${P?"close":"open"}`})]})]}),!!$&&t(gi,{lang:O,maxOptions:x,maxExpiration:K,minExpiration:de,maxCharactersPerOption:T,poll:$,disabled:g==="loading",onInput:o=>{if(o){const c={...o};C(c)}else C(null)}}),t("div",{class:"toolbar wrap",style:{justifyContent:"flex-end"},children:[t("span",{children:[t("label",{class:"toolbar-button",children:[t("input",{type:"file",accept:X.join(","),multiple:M.length<I-1,disabled:g==="loading"||M.length>=I||!!$,onChange:o=>{const c=o.target.files;if(!c)return;const y=Array.from(c).map(m=>({file:m,type:m.type,size:m.size,url:URL.createObjectURL(m),id:null,description:null}));M.length+y.length>I?alert(`You can only attach up to ${I} files.`):S(m=>m.concat(y)),o.target.value=""}}),t(V,{icon:"attachment"})]}),x==null||x>1&&t(Le,{children:t("button",{type:"button",class:"toolbar-button",disabled:g==="loading"||!!$||!!M.length,onClick:()=>{C({options:["",""],expiresIn:24*60*60,multiple:!1})},children:t(V,{icon:"poll",alt:"Add poll"})})}),t("button",{type:"button",class:"toolbar-button",disabled:g==="loading",onClick:()=>{Ue(!0)},children:t(V,{icon:"emoji2"})}),!!le.settings.composerGIFPicker&&t("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:g==="loading"||M.length>=I||!!$,onClick:()=>{at(!0)},children:t("span",{children:"GIF"})})]}),t("div",{class:"spacer"}),g==="loading"?t(et,{abrupt:!0}):t(pi,{maxCharacters:D,hidden:g==="loading"}),t("label",{class:`toolbar-button ${O!==ae.current||fe!=null&&fe.length&&!fe.includes(O)?"highlight":""}`,children:[t("span",{class:"icon-text",children:(Ct=Yn[O])==null?void 0:Ct.native}),t("select",{name:"language",value:O,onChange:o=>{const{value:c}=o.target;ie(c||ke),ze.session.set("currentLanguage",c||ke)},disabled:g==="loading",dir:"auto",children:[Qt.map(([o,c,y])=>t("option",{value:o,children:[c," (",y,")"]},o)),t("hr",{}),en.map(([o,c,y])=>t("option",{value:o,children:[c," (",y,")"]},o))]})]})," ",t("button",{type:"submit",class:"large",disabled:g==="loading",children:e?"Reply":n?"Update":"Post"})]})]})]}),He&&t(Ve,{onClick:o=>{o.target===o.currentTarget&&st(!1)},children:t(fi,{masto:u,instance:v,onClose:()=>{st(!1)},defaultSearchTerm:He==null?void 0:He.defaultSearchTerm,onSelect:o=>{const c=z.current;if(!c)return;const{selectionStart:y,selectionEnd:m}=c,B=c.value,E=B.slice(0,y),j=E?/[\s\t\n\r]$/.test(E)?"":" ":"",b=B.slice(m),A=/^[\s\t\n\r]/.test(b)?"":" ",H=E+j+"@"+o+A+b;c.value=H,c.selectionStart=c.selectionEnd=m+1+o.length+A.length,c.focus(),c.dispatchEvent(new Event("input"))}})}),Ne&&t(Ve,{onClick:o=>{o.target===o.currentTarget&&Ue(!1)},children:t(vi,{masto:u,instance:v,onClose:()=>{Ue(!1)},defaultSearchTerm:Ne==null?void 0:Ne.defaultSearchTerm,onSelect:o=>{const c=z.current;if(!c)return;const{selectionStart:y,selectionEnd:m}=c,B=c.value,E=B.slice(0,y),j=E?/[\s\t\n\r]$/.test(E)?"":" ":"",b=B.slice(m),A=/^[\s\t\n\r]/.test(b)?"":" ",H=E+j+o+A+b;c.value=H,c.selectionStart=c.selectionEnd=m+o.length+A.length,c.focus(),c.dispatchEvent(new Event("input"))}})}),Jt&&t(Ve,{onClick:o=>{o.target===o.currentTarget&&at(!1)},children:t(yi,{onClose:()=>at(!1),onSelect:({url:o,type:c,alt_text:y})=>{if(M.length>=I){alert(`You can only attach up to ${I} files.`);return}(async()=>{var B,E;let m;try{m=Ee({text:"Downloading GIF…",duration:-1});const j=await fetch(o,{referrerPolicy:"no-referrer"}).then(H=>H.blob()),b=new File([j],c==="video/mp4"?"video.mp4":"image.gif",{type:c}),A=[...M,{file:b,type:c,size:b.size,id:null,description:y||""}];S(A),(B=m==null?void 0:m.hideToast)==null||B.call(m)}catch{(E=m==null?void 0:m.hideToast)==null||E.call(m),Ee("Failed to download GIF")}})()}})})]})}function jt(s){if(!s)return;const{value:e,offsetHeight:n,scrollHeight:a,clientHeight:r}=s;if(n<window.innerHeight){const p=n-r,u=e?a+p+"px":null;s.style.height=u}}async function ui(s,e){const a=(await e.v1.customEmojis.list()).filter(p=>p.visibleInPicker),r=new pn(a,{keys:["shortcode"],findAllMatches:!0});return[a,r]}const Gt=Fn(ui,{matchesArg:(s,e)=>s.instance===e.instance,maxAge:30*60*1e3}),di=s=>{const e=zn(s);return e!=null&&e.length?e.slice(0,2).map(n=>n.lang):null},hi=Cn((s,e)=>{var X;const{masto:n,instance:a}=bt(),[r,p]=U(((X=e.current)==null?void 0:X.value)||""),{maxCharacters:u,performSearch:v=()=>{},onTrigger:g=()=>{},...R}=s,F=q();te(()=>{Gt(a,n).then(l=>{const[d,h]=l;F.current=h}).catch(l=>{})},[]);const w=q(),L=q("");te(()=>{let l,d,h;return w.current&&(l=f=>{var de;const{key:k,provide:x,text:T}=f.detail;if(L.current=T,T===""){x(Promise.resolve({matched:!1}));return}if(k===":"){const z=(de=F.current)==null?void 0:de.search(T,{limit:5});let Q="";z.forEach(({item:G})=>{const{shortcode:W,url:P}=G;Q+=`
<li role="option" data-value="${ye(W)}">
<img src="${ye(P)}" width="16" height="16" alt="" loading="lazy" />
${ye(W)}
</li>`}),Q+=`<li role="option" data-value="" data-more="${T}">More…</li>`,xe.innerHTML=Q,x(Promise.resolve({matched:z.length>0,fragment:xe}));return}const K={"@":"accounts","#":"hashtags"}[k];x(new Promise(z=>{v({type:K,q:T,limit:5}).then(G=>{if(T!==L.current)return;const W=G[K]||G;let P="";W.forEach(ne=>{var ee;const{name:O,avatarStatic:ie,displayName:ae,username:M,acct:S,emojis:$,history:C}=ne,N=mn(ae,$);if(S)P+=`
<li role="option" data-value="${ye(S)}">
<span class="avatar">
<img src="${ye(ie)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${N||M}</b>
<br><span class="bidi-isolate">@${ye(S)}</span>
</span>
</li>
`;else{const oe=(ee=C==null?void 0:C.reduce)==null?void 0:ee.call(C,(me,be)=>me+ +be.uses,0);P+=`
<li role="option" data-value="${ye(O)}">
<span class="grow">#<b>${ye(O)}</b></span>
${oe?`<span class="count">${gn(oe)}</span>`:""}
</li>
`}}),K==="accounts"&&(P+=`<li role="option" data-value="" data-more="${T}">More…</li>`),xe.innerHTML=P,z({matched:W.length>0,fragment:xe})})}))},w.current.addEventListener("text-expander-change",l),d=f=>{const{key:k,item:x}=f.detail,{value:T,more:K}=x.dataset;k===":"?(f.detail.value=T?`:${T}:`:"",K&&(f.detail.continue=!0,setTimeout(()=>{g==null||g({name:"custom-emojis",defaultSearchTerm:K})},300))):k==="@"?(f.detail.value=T?`@${T} `:"",K&&(f.detail.continue=!0,setTimeout(()=>{g==null||g({name:"mention",defaultSearchTerm:K})},300))):f.detail.value=`${k}${T}`},w.current.addEventListener("text-expander-value",d),h=f=>{const{input:k}=f.detail;if(p(k.value),e.current){const x=new Event("input",{bubbles:!0});e.current.dispatchEvent(x)}},w.current.addEventListener("text-expander-committed",h)),()=>{w.current&&(w.current.removeEventListener("text-expander-change",l),w.current.removeEventListener("text-expander-value",d),w.current.removeEventListener("text-expander-committed",h))}},[]),te(()=>{const l=e.current;if(!l)return;new ResizeObserver(()=>{if(w.current){const{height:h}=l.getBoundingClientRect();w.current.style.height=h+"px"}}).observe(l)},[]);const J=q(0),D=q(),I=fn(l=>{var f;if(!D.current)return;if(J.current>3){D.current.innerHTML="",D.current=null,(f=I==null?void 0:I.cancel)==null||f.call(I);return}let d,h;J.current<=3&&(d=Date.now()),D.current.innerHTML=li(l,{maxCharacters:u})+`
`,J.current<=3&&(h=Date.now()),d&&h&&h-d>50&&J.current++},500),se=Qe(()=>{var f,k;const l=(f=D.current)==null?void 0:f.cloneNode(!0);if(!l)return;l.querySelectorAll("mark").forEach(x=>{x.remove()});const d=(k=l.innerText)==null?void 0:k.trim();if(!d)return;const h=di(d);h!=null&&h.length&&(g==null||g({name:"auto-detect-language",languages:h}))},2e3);return t("text-expander",{ref:w,keys:"@ # :",class:"compose-field-container",children:[t("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...R,ref:e,name:"status",value:r,onKeyDown:l=>{const{key:d,target:h}=l;if(d==="Enter"&&!(l.ctrlKey||l.metaKey))try{const{value:f,selectionStart:k}=h,T=f.slice(0,k).split(`
`).slice(-1)[0];if(T&&/^\s*(-|\d+\.)\s/.test(T)){const[K,de,z,Q,G]=T.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(G){l.preventDefault();const[W]=z.match(/\d+/)||[],P=W?`${+W+1}.`:"-",ne=`
${de}${P}${Q}`;h.setRangeText(ne,k,k);const O=k+ne.length;h.setSelectionRange(O,O)}else{const W=k-T.length;h.setRangeText("",W,k)}jt(h),h.dispatchEvent(new Event("input"))}}catch{}D.current&&(D.current.scrollTop=h.scrollTop)},onInput:l=>{var f;const{target:d}=l,h=d.value.replace(/\u200b/g,"");p(h),jt(d),(f=s.onInput)==null||f.call(s,l),I(h),se()},style:{width:"100%",height:"4em"},onScroll:l=>{if(D.current){const{scrollTop:d}=l.target;D.current.scrollTop=d}}}),t("div",{ref:D,class:"compose-highlight","aria-hidden":"true"})]})});function pi({maxCharacters:s=500,hidden:e}){const a=Ln(le).composerCharacterCount,r=s-a;return e?t("span",{class:"char-counter",hidden:!0}):t("span",{class:"char-counter",title:`${r}/${s}`,style:{"--percentage":a/s*100},children:[t("meter",{class:`${r<=-10?"explode":r<=0?"danger":r<=20?"warning":""}`,value:a,max:s}),t("span",{class:"counter",children:r})]})}function Ke(s){const e=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];let n=0;for(;s>=1024;)s/=1024,n++;return`${s.toFixed(0).toLocaleString()} ${e[n]}`}function Pt(s,e,n,a){const r=Math.sqrt(e/s),p=Math.floor(n*r),u=Math.floor(a*r);return{newWidth:p,newHeight:u}}function mi({attachment:s,disabled:e,lang:n,onDescriptionChange:a=()=>{},onRemove:r=()=>{}}){const[p,u]=U("default"),v=Nt("@mastodon/edit-media-attributes"),{type:g,id:R,file:F}=s,w=Re(()=>F?URL.createObjectURL(F):s.url,[F,s.url]),L=!!(F!=null&&F.size),J=L?Ut():{},{mediaAttachments:{imageSizeLimit:D,imageMatrixLimit:I,videoSizeLimit:se,videoMatrixLimit:X,videoFrameRateLimit:l}={}}=J||{},[d,h]=U(()=>L?g.startsWith("image")&&D&&F.size>D?{type:"imageSizeLimit",details:{imageSize:F.size,imageSizeLimit:D}}:g.startsWith("video")&&se&&F.size>se?{type:"videoSizeLimit",details:{videoSize:F.size,videoSizeLimit:se}}:null:null),[f,k]=U({});te(()=>{!L||!I||(f==null?void 0:f.matrix)>I&&h({type:"imageMatrixLimit",details:{imageMatrix:f==null?void 0:f.matrix,imageMatrixLimit:I,width:f==null?void 0:f.width,height:f==null?void 0:f.height}})},[f,I,L]);const[x,T]=U({});te(()=>{!L||!X||(x==null?void 0:x.matrix)>X&&h({type:"videoMatrixLimit",details:{videoMatrix:x==null?void 0:x.matrix,videoMatrixLimit:X,width:x==null?void 0:x.width,height:x==null?void 0:x.height}})},[x,X,L]);const[K,de]=U(s.description),[z,Q]=g.split("/"),G=Qe(a,250);te(()=>{G(K)},[K,G]);const[W,P]=U(!1),ne=q(null);te(()=>{let S;return W&&ne.current&&(S=setTimeout(()=>{ne.current.focus()},100)),()=>{clearTimeout(S)}},[W]);const O=t(Le,{children:R&&!v?t("div",{class:"media-desc",children:[t("span",{class:"tag",children:"Uploaded"}),t("p",{title:K,children:s.description||t("i",{children:"No description"})})]}):t("textarea",{ref:ne,value:K||"",lang:n,placeholder:{image:"Image description",video:"Video description",audio:"Audio description"}[z],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:e||p==="loading",class:p==="loading"?"loading":"",maxlength:"1500",onInput:S=>{const{value:$}=S.target;de($)}})}),ie=q(null);te(()=>()=>{var S,$;($=(S=ie.current)==null?void 0:S.hideToast)==null||$.call(S)},[]);const ae=q(null),M=S=>{const{type:$,details:C}=S;switch($){case"imageSizeLimit":{const{imageSize:N,imageSizeLimit:ee}=C;return`File size too large. Uploading might encounter issues. Try reduce the file size from ${Ke(N)} to ${Ke(ee)} or lower.`}case"imageMatrixLimit":{const{imageMatrix:N,imageMatrixLimit:ee,width:oe,height:me}=C,{newWidth:be,newHeight:we}=Pt(N,ee,oe,me);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${me.toLocaleString()}px to ${be.toLocaleString()}×${we.toLocaleString()}px.`}case"videoSizeLimit":{const{videoSize:N,videoSizeLimit:ee}=C;return`File size too large. Uploading might encounter issues. Try reduce the file size from ${Ke(N)} to ${Ke(ee)} or lower.`}case"videoMatrixLimit":{const{videoMatrix:N,videoMatrixLimit:ee,width:oe,height:me}=C,{newWidth:be,newHeight:we}=Pt(N,ee,oe,me);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${me.toLocaleString()}px to ${be.toLocaleString()}×${we.toLocaleString()}px.`}case"videoFrameRateLimit":return"Frame rate too high. Uploading might encounter issues."}};return t(Le,{children:[t("div",{class:"media-attachment",children:[t("div",{class:"media-preview",tabIndex:"0",onClick:()=>{P(!0)},children:z==="image"?t("img",{src:w,alt:"",onLoad:S=>{if(!L)return;const{naturalWidth:$,naturalHeight:C}=S.target;k({matrix:$*C,width:$,height:C})}}):z==="video"||z==="gifv"?t("video",{src:w+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:S=>{if(!L)return;const{videoWidth:$,videoHeight:C}=S.target;$&&C&&T({matrix:$*C,width:$,height:C})}}):z==="audio"?t("audio",{src:w,controls:!0}):null}),O,t("div",{class:"media-aside",children:[t("button",{type:"button",class:"plain close-button",disabled:e,onClick:r,children:t(V,{icon:"x"})}),!!d&&t("button",{type:"button",class:"media-error",title:M(d),onClick:()=>{ae.current&&ae.current.hideToast(),ae.current=Ee({text:M(d),duration:1e4})},children:t(V,{icon:"alert"})})]})]}),W&&t(Ve,{onClose:()=>{P(!1)},children:t("div",{id:"media-sheet",class:"sheet sheet-max",children:[t("button",{type:"button",class:"sheet-close",onClick:()=>{P(!1)},children:t(V,{icon:"x"})}),t("header",{children:t("h2",{children:{image:"Edit image description",video:"Edit video description",audio:"Edit audio description"}[z]})}),t("main",{tabIndex:"-1",children:[t("div",{class:"media-preview",children:z==="image"?t("img",{src:w,alt:""}):z==="video"||z==="gifv"?t("video",{src:w,playsinline:!0,controls:!0}):z==="audio"?t("audio",{src:w,controls:!0}):null}),t("div",{class:"media-form",children:[O,t("footer",{children:[z==="image"&&/^(png|jpe?g|gif|webp)$/i.test(Q)&&!!le.settings.mediaAltGenerator&&!!ut&&t(vn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:t("button",{type:"button",title:"More",class:"plain",children:t(V,{icon:"more",size:"l",alt:"More"})}),children:[t(St,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=Ee({text:"Generating description. Please wait...",duration:-1}),async function(){var S,$;try{const C=new FormData;C.append("image",F);const N=await fetch(ut,{method:"POST",body:C}).then(ee=>ee.json());if(N.error)throw new Error(N.error);de(N.description)}catch(C){Ee(`Failed to generate description${C!=null&&C.message?`: ${C.message}`:""}`)}finally{u("default"),($=(S=ie.current)==null?void 0:S.hideToast)==null||$.call(S)}}()},children:[t(V,{icon:"sparkles2"}),n&&n!=="en"?t("small",{children:["Generate description…",t("br",{}),"(English)"]}):t("span",{children:"Generate description…"})]}),!!n&&n!=="en"&&t(St,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=Ee({text:"Generating description. Please wait...",duration:-1}),async function(){var S,$;try{const C=new FormData;C.append("image",F);const N=`?lang=${n}`,ee=await fetch(ut+N,{method:"POST",body:C}).then(oe=>oe.json());if(ee.error)throw new Error(ee.error);de(ee.description)}catch(C){Ee(`Failed to generate description${C!=null&&C.message?`: ${C.message}`:""}`)}finally{u("default"),($=(S=ie.current)==null?void 0:S.hideToast)==null||$.call(S)}}()},children:[t(V,{icon:"sparkles2"}),t("small",{children:["Generate description…",t("br",{}),"(",bn(n),")"," ",t("span",{class:"more-insignificant",children:"— experimental"})]})]})]}),t("button",{type:"button",class:"light block",onClick:()=>{P(!1)},disabled:p==="loading",children:"Done"})]})]})]})]})})]})}function gi({lang:s,poll:e,disabled:n,onInput:a=()=>{},maxOptions:r,maxExpiration:p,minExpiration:u,maxCharactersPerOption:v}){const{options:g,expiresIn:R,multiple:F}=e;return t("div",{class:`poll ${F?"multiple":""}`,children:[t("div",{class:"poll-choices",children:g.map((w,L)=>t("div",{class:"poll-choice",children:[t("input",{required:!0,type:"text",value:w,disabled:n,maxlength:v,placeholder:`Choice ${L+1}`,lang:s,spellCheck:"true",dir:"auto",onInput:J=>{const{value:D}=J.target;g[L]=D,a(e)}}),t("button",{type:"button",class:"plain2 poll-button",disabled:n||g.length<=1,onClick:()=>{g.splice(L,1),a(e)},children:t(V,{icon:"x",size:"s"})})]},L))}),t("div",{class:"poll-toolbar",children:[t("button",{type:"button",class:"plain2 poll-button",disabled:n||g.length>=r,onClick:()=>{g.push(""),a(e)},children:"+"})," ",t("label",{class:"multiple-choices",children:[t("input",{type:"checkbox",checked:F,disabled:n,onChange:w=>{const{checked:L}=w.target;e.multiple=L,a(e)}})," ","Multiple choices"]}),t("label",{class:"expires-in",children:["Duration"," ",t("select",{value:R,disabled:n,onChange:w=>{const{value:L}=w.target;e.expiresIn=L,a(e)},children:Object.entries(Kt).filter(([w,L])=>L>=u&&L<=p).map(([w,L])=>t("option",{value:L,children:w},L))})]})]}),t("div",{class:"poll-toolbar",children:t("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:"Remove poll"})})]})}function ye(s){return s.replace(/[&<>"']/g,function(e){return"&#"+e.charCodeAt(0)+";"})}function Ot(s){for(let e in s)(s[e]===null||s[e]===void 0)&&delete s[e];return s}function fi({onClose:s=()=>{},onSelect:e=()=>{},defaultSearchTerm:n}){const{masto:a}=bt(),[r,p]=U("default"),[u,v]=U([]),[g,R]=U({}),[F,w]=U(0),L=async l=>{if(!(l!=null&&l.length))return;const d=await yn(l,g);d&&R({...g,...d})},J=l=>{l&&(p("loading"),(async()=>{try{const d=await a.v1.accounts.search.list({q:l,limit:40,resolve:!1});v(d),L(d),p("default")}catch{p("error")}})())},D=Qe(J,1e3);te(()=>{J()},[J]);const I=q();te(()=>{I.current&&(I.current.focus(),I.current.value&&(I.current.selectionStart=I.current.value.length,I.current.selectionEnd=I.current.value.length))},[]),te(()=>{n&&J(n)},[n]);const se=l=>{const d=l.acct;e(d),s()};_e("enter",()=>{const l=u[F];l&&se(l)},{preventDefault:!0,enableOnFormTags:["input"]});const X=q();return _e("down",()=>{F<u.length-1?w(F+1):w(0),setTimeout(()=>{const l=X.current.querySelector(".selected");l&&l.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),_e("up",()=>{F>0?w(F-1):w(u.length-1),setTimeout(()=>{const l=X.current.querySelector(".selected");l&&l.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),t("div",{id:"mention-sheet",class:"sheet",children:[!!s&&t("button",{type:"button",class:"sheet-close",onClick:s,children:t(V,{icon:"x"})}),t("header",{children:t("form",{onSubmit:l=>{var d;l.preventDefault(),(d=D.flush)==null||d.call(D)},children:t("input",{ref:I,required:!0,type:"search",class:"block",placeholder:"Search accounts",onInput:l=>{const{value:d}=l.target;D(d)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),t("main",{children:(u==null?void 0:u.length)>0?t("ul",{ref:X,class:`accounts-list ${r==="loading"?"loading":""}`,children:u.map((l,d)=>{const h=g[l.id];return t("li",{class:d===F?"selected":"",children:[t(Ht,{avatarSize:"xxl",account:l,relationship:h,showStats:!0,showActivity:!0}),t("button",{type:"button",class:"plain2",onClick:()=>{se(l)},children:t(V,{icon:"plus",size:"xl"})})]},l.id)})}):r==="loading"?t("div",{class:"ui-state",children:t(et,{abrupt:!0})}):r==="error"?t("div",{class:"ui-state",children:t("p",{children:"Error loading accounts"})}):null})]})}function vi({masto:s,instance:e,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:r}){const[p,u]=U("default"),v=q([]),[g,R]=U([]),F=Re(()=>ze.account.get("recentlyUsedCustomEmojis")||[]),w=q();te(()=>{u("loading"),(async()=>{try{const[d,h]=await Gt(e,s);w.current=h,R(d),u("default")}catch{u("error")}})()},[]);const L=Re(()=>{const d={"--recent--":F.filter(f=>g.find(k=>k.shortcode===f.shortcode))},h=[];return g.forEach(f=>{var k,x;if((x=(k=v.current)==null?void 0:k.push)==null||x.call(k,f),!f.category){h.push(f);return}d[f.category]||(d[f.category]=[]),d[f.category].push(f)}),h.length&&(d["--others--"]=h),d},[g]),J=q(),[D,I]=U(null),se=It(d=>{var f,k,x;const{value:h}=d.target;if(h){const T=(f=w.current)==null?void 0:f.search(h,{limit:vt});I(T.map(K=>K.item)),(x=(k=J.current)==null?void 0:k.scrollTo)==null||x.call(k,0,0)}else I(null)},[g]);te(()=>{r&&(g!=null&&g.length)&&se({target:{value:r}})},[r,se,g]);const X=It(d=>{a==null||a(d),n==null||n(),queueMicrotask(()=>{let h=ze.account.get("recentlyUsedCustomEmojis")||[];const f=h.findIndex(k=>k.shortcode===d.shortcode);f!==-1?(h.splice(f,1),h.unshift(d)):(h.unshift(d),h=h.filter(k=>{var x,T;return(T=(x=v.current)==null?void 0:x.find)==null?void 0:T.call(x,K=>K.shortcode===k.shortcode)}),h=h.slice(0,10)),ze.account.set("recentlyUsedCustomEmojis",h)})},[a]),l=q();return te(()=>{l.current&&(l.current.focus(),l.current.value&&(l.current.selectionStart=l.current.value.length,l.current.selectionEnd=l.current.value.length))},[]),t("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&t("button",{type:"button",class:"sheet-close",onClick:n,children:t(V,{icon:"x"})}),t("header",{children:[t("div",{children:[t("b",{children:"Custom emojis"})," ",p==="loading"?t(et,{}):t("small",{class:"insignificant",children:[" • ",e]})]}),t("form",{onSubmit:d=>{d.preventDefault();const h=D[0];h&&X(`:${h.shortcode}:`)},children:t("input",{ref:l,type:"search",placeholder:"Search emoji",onInput:se,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:r||""})})]}),t("main",{ref:J,children:D!==null?t("ul",{class:"custom-emojis-matches custom-emojis-list",children:D.map(d=>t("li",{class:"custom-emojis-match",children:t(Yt,{emoji:d,onClick:()=>{X(`:${d.shortcode}:`)},showCode:!0})},d.shortcode))}):t("div",{class:"custom-emojis-list",children:[p==="error"&&t("div",{class:"ui-state",children:t("p",{children:"Error loading custom emojis"})}),p==="default"&&Object.entries(L).map(([d,h])=>!!(h!=null&&h.length)&&t(Le,{children:[t("div",{class:"section-header",children:{"--recent--":"Recently used","--others--":"Others"}[d]||d}),t(bi,{emojis:h,onSelect:X})]}))]})})]})}const bi=Wt(({emojis:s,onSelect:e})=>{const[n,a]=U(vt),r=s.length>n;return t("section",{children:[s.slice(0,n).map(p=>t(Yt,{emoji:p,onClick:()=>{e(`:${p.shortcode}:`)}},p.shortcode)),r&&t("button",{type:"button",class:"plain small",onClick:()=>a(n+vt),children:[(s.length-n).toLocaleString()," more…"]})]})}),Yt=Wt(({emoji:s,onClick:e,showCode:n})=>{const a=r=>{const u=r.currentTarget.closest("main");if(u){const v=u.getBoundingClientRect(),g=r.currentTarget.getBoundingClientRect(),R=r.currentTarget.classList;g.left<v.left+88?(R.add("edge-left"),R.remove("edge-right")):g.right>v.right-88?(R.add("edge-right"),R.remove("edge-left")):R.remove("edge-left","edge-right")}};return t("button",{type:"button",className:"plain4",onClick:e,"data-title":n?void 0:s.shortcode,onPointerEnter:a,onFocus:a,children:[t("picture",{children:[!!s.staticUrl&&t("source",{srcSet:s.staticUrl,media:"(prefers-reduced-motion: reduce)"}),t("img",{className:"shortcode-emoji",src:s.url||s.staticUrl,alt:s.shortcode,width:"24",height:"24",loading:"lazy",decoding:"async"})]}),n&&t(Le,{children:[" ",t("code",{children:s.shortcode})]})]})}),ht=20;function yi({onClose:s=()=>{},onSelect:e=()=>{}}){var L,J,D,I,se,X;const[n,a]=U("default"),[r,p]=U([]),u=q(null),v=q(null),g=q(0),R=q(null);function F({offset:l}){var d,h,f;(d=v.current)!=null&&d.value&&(a("loading"),(f=(h=R.current)==null?void 0:h.scrollTo)==null||f.call(h,{top:0,left:0,behavior:"smooth"}),(async()=>{var k;try{const x={api_key:Gn,q:v.current.value,rating:"g",limit:ht,bundle:"messaging_non_clips",offset:l},T=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(x),{referrerPolicy:"no-referrer"}).then(K=>K.json());g.current=((k=T.pagination)==null?void 0:k.offset)||0,p(T),a("results")}catch{a("error")}})())}te(()=>{var l;(l=v.current)==null||l.focus()},[]);const w=Qe(()=>{F({offset:0})},1e3);return t("div",{id:"gif-picker-sheet",class:"sheet",children:[!!s&&t("button",{type:"button",class:"sheet-close",onClick:s,children:t(V,{icon:"x"})}),t("header",{children:t("form",{ref:u,onSubmit:l=>{l.preventDefault(),F({offset:0})},children:[t("input",{ref:v,type:"search",name:"q",placeholder:"Search GIFs",required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:w}),t("input",{type:"image",class:"powered-button",src:Wn,width:"86",height:"30"})]})}),t("main",{ref:R,class:n==="loading"?"loading":"",children:[n==="default"&&t("div",{class:"ui-state",children:t("p",{class:"insignificant",children:"Type to search GIFs"})}),n==="loading"&&!((L=r==null?void 0:r.data)!=null&&L.length)&&t("div",{class:"ui-state",children:t(et,{abrupt:!0})}),((J=r==null?void 0:r.data)==null?void 0:J.length)>0?t(Le,{children:[t("ul",{children:r.data.map(l=>{const{id:d,images:h,title:f,alt_text:k}=l,{fixed_height_small:x,fixed_height_downsampled:T,fixed_height:K,original:de}=h,z=x!=null&&x.url?x:T!=null&&T.url?T:K;let{url:Q,webp:G,width:W,height:P}=z;+P>100&&(W=W/P*100,P=100);const ne=URL.parse(Q),O=ne.origin+ne.pathname;let ie;if(G){const ae=URL.parse(G);ie=ae.origin+ae.pathname}return t("li",{children:t("button",{type:"button",onClick:()=>{const{mp4:ae,url:M}=de,S=ae||M,$=URL.parse(S),C=$.origin+$.pathname;s(),e({url:C,type:ae?"video/mp4":"image/gif",alt_text:k||f})},children:t("figure",{style:{"--figure-width":W+"px"},children:[t("picture",{children:[ie&&t("source",{srcset:ie,type:"image/webp"}),t("img",{src:O,width:W,height:P,loading:"lazy",decoding:"async",alt:k,referrerpolicy:"no-referrer",onLoad:ae=>{ae.target.style.backgroundColor="transparent"}})]}),t("figcaption",{children:k||f})]})})},d)})}),t("p",{class:"pagination",children:[((D=r.pagination)==null?void 0:D.offset)>0&&t("button",{type:"button",class:"light small",disabled:n==="loading",onClick:()=>{var l;F({offset:((l=r.pagination)==null?void 0:l.offset)-ht})},children:[t(V,{icon:"chevron-left"}),t("span",{children:"Previous"})]}),t("span",{}),((I=r.pagination)==null?void 0:I.offset)+((se=r.pagination)==null?void 0:se.count)<((X=r.pagination)==null?void 0:X.total_count)&&t("button",{type:"button",class:"light small",disabled:n==="loading",onClick:()=>{var l;F({offset:((l=r.pagination)==null?void 0:l.offset)+ht})},children:[t("span",{children:"Next"})," ",t(V,{icon:"chevron-right"})]})]})]}):n==="results"&&t("div",{class:"ui-state",children:t("p",{children:"No results"})}),n==="error"&&t("div",{class:"ui-state",children:t("p",{children:"Error loading GIFs"})})]})]})}export{Ci as default};
//# sourceMappingURL=compose-feY08m5z.js.map