phanpy-cz/assets/compose-_xw4e_c5.js
2024-12-08 17:19:23 +01:00

27 lines
83 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 Kt=s=>{throw TypeError(s)};var vt=(s,t,n)=>t.has(s)||Kt("Cannot "+n);var T=(s,t,n)=>(vt(s,t,"read from private field"),n?n.call(s):t.get(s)),ce=(s,t,n)=>t.has(s)?Kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),ge=(s,t,n,a)=>(vt(s,t,"write to private field"),a?a.call(s,n):t.set(s,n),n),Q=(s,t,n)=>(vt(s,t,"access private method"),n);import{z as _n,s as re,V as an,j as Ve,a as St,h as H,A as W,M as Ln,aE as on,d as Be,y as ne,x as An,aF as Sn,l as He,c as e,T as q,b as In,f as Ne,w as ct,i as fe,r as Bn,af as Tn,P as Mn,u as Rn,t as qt,C as rn}from"./useTitle-6CgMxXiB.js";import{j as ze,G as Dn,$ as $n,a as Oe,a9 as jn,y as Wt,u as Pn,aa as On,m as ln,b as Hn,I as N,B as Ut,i as nt,ab as Nn,c as cn,d as Ie,l as Et,M as it,s as Le,a5 as Kn,a1 as qn,r as Wn,Q as Un,Y as ut,p as et,z as Vn}from"./fuse-3cGZwVM1.js";class Gn{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=>Yn(l,this),this.compositionEventHandler=l=>Jn(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",Vt),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",Vt)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(bt)[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(bt)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(bt),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 f=c+t;f>=0&&f<a.length&&(l=f)}const r=a[l];if(r)for(const f of a)f.removeAttribute("data-combobox-option-default"),r===f?(this.input.setAttribute("aria-activedescendant",r.id),r.setAttribute("aria-selected","true"),Xn(this.list,r)):f.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 Yn(s,t){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!t.ctrlBindings&&s.ctrlKey)&&!t.isComposing)switch(s.key){case"Enter":Gt(t.input,t.list)&&s.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&Gt(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 Vt(s){if(!(s.target instanceof Element))return;const t=s.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&Zn(t)}function Gt(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 Zn(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function bt(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function Jn(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Xn(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 ei=/\s|\(|\[/;function ti(s,t,n,{multiWord:a,lookBackIndex:c,lastMatchPosition:l}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let r=s.lastIndexOf(t,n-1);if(r===-1||r<c)return;if(a){if(l!=null){if(l===r)return;r=l-t.length}if(s[r+1]===" "&&n>=r+t.length+1||s.lastIndexOf(`
`,n-1)>r||s.lastIndexOf(".",n-1)>r)return}else if(s.lastIndexOf(" ",n-1)>r)return;const f=s[r-1];return f&&!ei.test(f)?void 0:{text:s.substring(r+t.length,n),position:r+t.length}}class ni extends HTMLElement{}class ii extends Event{constructor(){super("update")}}const xt=new WeakMap;var Ke,qe,We,ye,U,Ft,Se,Te,Me,Ct,Re,st,at,ot,Ue,Ae;const Bt=class Bt extends ni{constructor(){super(...arguments);ce(this,U);ce(this,Ke,new MutationObserver(()=>Q(this,U,at).call(this)));ce(this,qe,new ResizeObserver(()=>Q(this,U,st).call(this)));ce(this,We);ce(this,ye);ce(this,Te,0);ce(this,Me,0);ce(this,Re,!1);ce(this,Ue,()=>Q(this,U,ot).call(this));ce(this,Ae,n=>{Q(this,U,Se).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&Q(this,U,st).call(this)})})}static for(n){let a=xt.get(n);return a||(a=new Bt,a.connect(n),xt.set(n,a)),a}connect(n){ge(this,We,new WeakRef(n)),ge(this,ye,document.createElement("div")),T(this,ye).style.position="absolute",T(this,ye).style.pointerEvents="none",n.after(T(this,ye)),T(this,ye).appendChild(this)}forceUpdate(){Q(this,U,at).call(this),Q(this,U,ot).call(this)}connectedCallback(){Q(this,U,Se).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"),Q(this,U,at).call(this),Q(this,U,ot).call(this),T(this,Ke).observe(n,{attributeFilter:["style","dir"]}),T(this,qe).observe(n),document.addEventListener("scroll",T(this,Ae),{capture:!0}),window.addEventListener("resize",T(this,Ae),{capture:!0}),n.addEventListener("input",T(this,Ue),{capture:!0})})}disconnectedCallback(){var a;(a=T(this,ye))==null||a.remove(),T(this,Ke).disconnect(),T(this,qe).disconnect(),document.removeEventListener("scroll",T(this,Ae),{capture:!0}),window.removeEventListener("resize",T(this,Ae),{capture:!0});const n=T(this,U,Ft);n&&(n.removeEventListener("input",T(this,Ue),{capture:!0}),xt.delete(n))}};Ke=new WeakMap,qe=new WeakMap,We=new WeakMap,ye=new WeakMap,U=new WeakSet,Ft=function(){var n;return(n=T(this,We))==null?void 0:n.deref()},Se=function(n){const a=T(this,U,Ft);return a?n(a):this.remove()},Te=new WeakMap,Me=new WeakMap,Ct=function(){Q(this,U,Se).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();ge(this,Te,T(this,Te)+c.left-l.left),ge(this,Me,T(this,Me)+c.top-l.top),this.style.transform=`translate(${T(this,Te)}px, ${T(this,Me)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new ii)})},Re=new WeakMap,st=function(){T(this,Re)||(ge(this,Re,!0),requestAnimationFrame(()=>{Q(this,U,Ct).call(this),ge(this,Re,!1)}))},at=function(){Q(this,U,Se).call(this,n=>{const a=window.getComputedStyle(n);for(const c of si)this.style[c]=a[c];Q(this,U,st).call(this)})},ot=function(){Q(this,U,Se).call(this,n=>{this.textContent=n.value,Q(this,U,Ct).call(this)})},Ue=new WeakMap,Ae=new WeakMap;let rt=Bt;const si=["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",rt)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var be,De,$e,ue,_t,un,Lt,Pe;const lt=class lt{constructor(t,n=0,a=n){ce(this,ue);ce(this,be);ce(this,De);ce(this,$e);ge(this,be,t),ge(this,De,n),ge(this,$e,a)}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new lt(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return T(this,be)}get endContainer(){return T(this,be)}get startContainer(){return T(this,be)}get startOffset(){return T(this,De)}get endOffset(){return T(this,$e)}setStartOffset(t){ge(this,De,Q(this,ue,Lt).call(this,t))}setEndOffset(t){ge(this,$e,Q(this,ue,Lt).call(this,t))}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Q(this,ue,Pe).call(this).cloneContents()}cloneRange(){return new lt(T(this,be),this.startOffset,this.endOffset)}getBoundingClientRect(){return Q(this,ue,Pe).call(this).getBoundingClientRect()}getClientRects(){return Q(this,ue,Pe).call(this).getClientRects()}toString(){return Q(this,ue,Pe).call(this).toString()}getStyleClone(){return T(this,ue,_t)}};be=new WeakMap,De=new WeakMap,$e=new WeakMap,ue=new WeakSet,_t=function(){return rt.for(T(this,be))},un=function(){return T(this,ue,_t)},Lt=function(t){return Math.max(0,Math.min(t,T(this,be).value.length))},Pe=function(){const t=document.createRange(),n=T(this,ue,un).childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t};let zt=lt;const tt=new WeakMap;class ai{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 Gn(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 zt(this.input,n).getBoundingClientRect(),c={left:a.left,top:a.top+a.height},l=t.getBoundingClientRect(),r={left:c.left-l.left,top:c.top-l.top};if(r.left!==0||r.top!==0){const f=getComputedStyle(t);t.style.left=f.left?`calc(${f.left} + ${r.left}px)`:`${r.left}px`,t.style.top=f.top?`calc(${f.top} + ${r.top}px)`:`${r.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),r=this.input.value.substring(c.position+c.text.length),f={item:a,key:c.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:f}))||!f.value)return;let L=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";f.continue&&(L="");const M=`${f.value}${L}`;this.input.value=l+M+r;const y=l.length+M.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=y,this.input.selectionEnd=y,f.continue||(this.lookBackIndex=y,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=ti(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=f=>n.push(f);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(f=>f.matched).map(f=>f.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 Yt 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(r=>({key:r,multiWord:l||c.includes(r)}))}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 ai(this,t);tt.set(this,n)}disconnectedCallback(){const t=tt.get(this);t&&(t.destroy(),tt.delete(this))}dismiss(){const t=tt.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Yt,window.customElements.define("text-expander",Yt));function oi({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 ri=oi();function li(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(ri,"")}const ci=new Intl.Segmenter;function Zt(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=li(s)),s===""))return 0;let n=0;for(const a of ci.segment(s))n++;return n}const ui="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",It=[["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","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],di="(((?:[^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\\-_&=#\\/])?))",hi="gi",Jt={source:di,flags:hi},pi={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:yt,PHANPY_GIPHY_API_KEY:mi}=pi,gi=It.reduce((s,t)=>{const[n,a,c]=t;return s[n]={common:a,native:c},s},{}),dn={300:ze(5,"minute"),1800:ze(30,"minute"),3600:ze(1,"hour"),21600:ze(6,"hour"),86400:ze(1,"day"),259200:ze(3,"day"),604800:ze(1,"week")},fi=Object.keys(dn),Xt=24*60*60,Qt=s=>{if(!s)return Xt;const t=(new Date(s).getTime()-Date.now())/1e3;return fi.find(n=>n>=t)||Xt},Fe=document.createElement("ul");Fe.role="listbox";Fe.className="text-expander-menu";const vi=16,bi=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=Dn()?"right":"left";Fe.style[l]=c-a-vi+"px"}}})});bi.observe(Fe);const _e=_n([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],It.map(s=>s[0]),"en"),hn=new RegExp(Jt.source,Jt.flags),xi=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,yi="$2xxxxxxxxxxxxxxxxxxxxxxx";function wi(s){return s.replace(hn,yi).replace(xi,"$1@$3")}const ki=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,Ei=new RegExp(`(^|[^=\\/\\w])(@${ki.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),Fi=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),Ci="[a-zA-Z0-9_]{2,}",zi=new RegExp(`(^|[^=\\/\\w])(:${Ci}:)(?=[^A-Za-z0-9_:]|$)`,"g"),_i=new Intl.Segmenter;function wt(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Li(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=re;if(n>t){let a="",c="";const l=_i.segment(s);for(const{segment:r,index:f}of l)f<t?a+=r:c+=r;return c&&(c='<mark class="compose-highlight-exceeded">'+wt(c)+"</mark>"),wt(a)+c}return wt(s).replace(hn,'$2<mark class="compose-highlight-url">$3</mark>').replace(Ei,'$1<mark class="compose-highlight-mention">$2</mark>').replace(Fi,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(zi,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const Ai=an(s=>new Intl.RelativeTimeFormat(s||void 0)),Si=an(s=>new Intl.ListFormat(s||void 0)),At=100,ke={media:{id:"MfJ43d"},customEmoji:{id:"ggiJLM"},gif:{id:"Fm6c4W"},poll:{id:"cZJ92q"}};function qi({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:c,hasOpener:l}){var Nt;const{i18n:r,_:f}=Ve(),_=Ai(r.locale),L=Si(r.locale),{masto:M,instance:y}=St(),[w,z]=H("default"),R=W((a==null?void 0:a.uid)||$n()),$=Ln(),Z=$.info,ie=on(),{statuses:{maxCharacters:h,maxMediaAttachments:u,charactersReservedPerUrl:m}={},mediaAttachments:{supportedMimeTypes:b,imageSizeLimit:v,imageMatrixLimit:P,videoSizeLimit:E,videoMatrixLimit:Y,videoFrameRateLimit:de}={},polls:{maxOptions:oe,maxCharactersPerOption:ee,maxExpiration:pe,minExpiration:ae}={}}=ie||{},A=W(),V=W(),[J,me]=H("public"),[X,te]=H(!1),[K,B]=H(Be.session.get("currentLanguage")||_e),D=W(K),[g,G]=H([]),[j,le]=H(null),se=Be.account.get("preferences")||{},Ce=()=>{A.current&&A.current.dispatchEvent(new Event("input"))},we=()=>{setTimeout(()=>{var o,d,k;A.current&&((d=(o=a==null?void 0:a.status)==null?void 0:o.startsWith)!=null&&d.call(o,`
`)&&(A.current.selectionStart=0,A.current.selectionEnd=0),(k=A.current)==null||k.focus())},300)};ne(()=>{var o,d;if(t){const{spoilerText:k,visibility:p,language:S,sensitive:C}=t;k&&V.current&&(V.current.value=k);const x=[...new Set([t.account.acct,...t.mentions.map(F=>F.acct)])].filter(F=>F!==Z.acct);x.length>0&&(A.current.value=`${x.map(F=>`@${F}`).join(" ")} `,Ce()),we(),me(p==="public"&&se["posting:default:visibility"]?se["posting:default:visibility"].toLowerCase():p),B(S||((o=se["posting:default:language"])==null?void 0:o.toLowerCase())||_e),te(C&&!!k)}else if(n){const{visibility:k,language:p,sensitive:S,poll:C,mediaAttachments:I}=n,x=!!(C!=null&&C.options)&&{...C,options:C.options.map(F=>(F==null?void 0:F.title)||F),expiresIn:(C==null?void 0:C.expiresIn)||Qt(C.expiresAt)};z("loading"),(async()=>{var F;try{const O=await M.v1.statuses.$select(n.id).source.fetch(),{text:he,spoilerText:ve}=O;A.current.value=he,A.current.dataset.source=he,Ce(),we(),V.current.value=ve,me(k),B(p||((F=se["posting:default:language"])==null?void 0:F.toLowerCase())||_e),te(S),x&&le(x),G(I),z("default")}catch(O){alert((O==null?void 0:O.reason)||O),z("error")}})()}else we(),se["posting:default:visibility"]&&me(se["posting:default:visibility"].toLowerCase()),se["posting:default:language"]&&B(se["posting:default:language"].toLowerCase()),se["posting:default:sensitive"]&&te(!!se["posting:default:sensitive"]);if(a){const{status:k,spoilerText:p,visibility:S,language:C,sensitive:I,poll:x,mediaAttachments:F}=a,O=!!(x!=null&&x.options)&&{...x,options:x.options.map(he=>(he==null?void 0:he.title)||he),expiresIn:(x==null?void 0:x.expiresIn)||Qt(x.expiresAt)};A.current.value=k,Ce(),we(),p&&(V.current.value=p),S&&me(S),B(C||((d=se["posting:default:language"])==null?void 0:d.toLowerCase())||_e),I!==null&&te(I),O&&le(O),F&&G(F)}},[a,n,t]);const Tt=W(),Mt=r._({id:"hR9gtK"}),dt=()=>{const{value:o,dataset:d}=A.current;if(w==="loading")return!1;const k=(o||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),p=g.length>0;if(!k&&!p||g.length>0&&g.every(F=>F.id))return!0;const C=(t==null?void 0:t.account.id)===Z.id,I=t&&o.trim()===`@${t.account.acct}`;return!!(!C&&I||o===(d==null?void 0:d.source))},Ge=()=>dt()?!0:confirm(Mt);ne(()=>{const o=d=>{dt()||(d.preventDefault(),d.returnValue=Mt)};return window.addEventListener("beforeunload",o,{capture:!0}),()=>window.removeEventListener("beforeunload",o,{capture:!0})},[]);const gn=()=>{const{value:o}=A.current,{value:d}=V.current;return Zt(wi(o))+Zt(d)},ht=()=>{const o=gn();re.composerCharacterCount=o};ne(ht,[]);const Rt=window.CloseWatcher,pt=W(!1);Oe("esc",()=>{pt.current=!0},{enabled:!Rt,enableOnFormTags:!0}),Oe("esc",()=>{!c&&pt.current&&Ge()&&s(),pt.current=!1},{enabled:!Rt,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:o=>{const d=document.querySelectorAll("#modal-container > *"),k=!!d,p=d.length===1&&d[0].querySelector("#compose-container");return k&&!p}}),jn(()=>{!c&&Ge()&&s()},[c,Ge,s]);const Dt=W({}),$t=()=>`${An()}#${R.current}`,mt=()=>{if(n||re.composerState.minimized)return;const o=$t(),d={key:o,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:R.current,status:A.current.value,spoilerText:V.current.value,visibility:J,language:K,sensitive:X,poll:j,mediaAttachments:g}};!Sn(d,Dt.current)&&!dt()&&(Wt.drafts.set(o,{...d,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(k=>{}),Dt.current=structuredClone(d))};Pn(mt,5e3),ne(()=>(mt(),()=>{Wt.drafts.del($t())}),[]),ne(()=>{const o=k=>{const{items:p}=k.clipboardData||k.dataTransfer,S=[],C=[];for(let I=0;I<p.length;I++){const x=p[I];if(x.kind==="file"){const F=x.getAsFile();b!==void 0&&!b.includes(F.type)?C.push(F):S.push(F)}}if(C.length>0&&alert(r._({id:"rpXAF6",values:{0:C.length,1:C[0].name,2:L.format(C.map(I=>I.name))}})),S.length>0&&g.length>=u){alert(r._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}if(S.length>0){k.preventDefault(),k.stopPropagation();let I=S;if(u!==void 0){const F=u-g.length;if(I=I.slice(0,F),I.length<=0){alert(r._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}}const x=I.map(F=>({file:F,type:F.type,size:F.size,url:URL.createObjectURL(F),id:null,description:null}));G([...g,...x])}};window.addEventListener("paste",o);const d=k=>{k.dataTransfer.items.length>0&&(k.preventDefault(),k.stopPropagation())};return window.addEventListener("dragover",d),window.addEventListener("drop",o),()=>{window.removeEventListener("paste",o),window.removeEventListener("dragover",d),window.removeEventListener("drop",o)}},[g]);const[Ye,gt]=H(!1),[Ze,je]=H(!1),[fn,Je]=H(!1),[xe,vn]=H(null),[bn,xn]=He(()=>{const o=[],d=[],{contentTranslationHideLanguages:k=[]}=re.settings;return It.forEach(p=>{const[S]=p;S===K||S===D.current||S===_e||k.includes(S)||xe!=null&&xe.length&&xe.includes(S)?o.push(p):d.push(p)}),o.sort(([p,S],[C,I])=>p===K?-1:C===K?1:S.localeCompare(I)),d.sort(([p,S],[C,I])=>S.localeCompare(I)),[o,d]},[K,xe]),jt=He(()=>!!(t!=null&&t.createdAt)&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),yn=()=>{mt(),re.composerState.minimized=!0},Pt=w==="loading"||u!==void 0&&g.length>=u||!!j,wn=oe==null||oe>1,Ot=w==="loading"||!!j||!!g.length,Ht=()=>{le({options:["",""],expiresIn:24*60*60,multiple:!1})},Xe=W(),[kn,En]=H(!1);return On({ref:Xe,box:"border-box",onResize:({width:o})=>{const{scrollWidth:d}=Xe.current,k=d>o,p=o<84;En(p||k),Xe.current.hidden=p}}),e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:c?"standalone":"",children:[e("div",{class:"compose-top",children:[(Z==null?void 0:Z.avatarStatic)&&e(ln,{account:Z,accountInstance:$.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),c?l&&e("button",{type:"button",class:"light pop-button",disabled:w==="loading",onClick:()=>{var o;if(!window.opener){alert(r._({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if((o=window.opener.__STATES__.composerState)!=null&&o.publishing){alert(r._({id:"Z2l5Bt"}));return}let d=r._({id:"AB/GtR"});if(!confirm(d))return}s({fn:()=>{const d={editStatus:n,replyToStatus:t,draftStatus:{uid:R.current,status:A.current.value,spoilerText:V.current.value,visibility:J,language:K,sensitive:X,poll:j,mediaAttachments:g}};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(N,{icon:"popin",alt:r._({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:w==="loading",onClick:()=>{Hn({editStatus:n,replyToStatus:t,draftStatus:{uid:R.current,status:A.current.value,spoilerText:V.current.value,visibility:J,language:K,sensitive:X,poll:j,mediaAttachments:g}})&&s()},children:e(N,{icon:"popout",alt:r._({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:yn,children:e(N,{icon:"minimize",alt:r._({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:w==="loading",onClick:()=>{Ge()&&s()},children:e(N,{icon:"x",alt:r._({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(Ut,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:jt>0?e(q,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:_.format(-jt,"month")},components:{0:e("strong",{})}}):e(q,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(Ut,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(q,{id:"wKtOLH"})})]}),e("form",{ref:Tt,class:`form-visibility-${J}`,style:{pointerEvents:w==="loading"?"none":"auto",opacity:w==="loading"?.5:1},onKeyDown:o=>{o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&Tt.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:o=>{o.preventDefault();const d=new FormData(o.target),k=Object.fromEntries(d.entries());let{status:p,visibility:S,sensitive:C,spoilerText:I}=k;if(C=C==="on",j){if(j.options.length<2){alert(r._({id:"zhrMYj"}));return}if(j.options.some(x=>x==="")){alert(r._({id:"uNVxXX"}));return}}g.length>0&&g.some(F=>{var O,he;return!((he=(O=F.description)==null?void 0:O.trim)!=null&&he.call(O))})&&!confirm(r._({id:"MQYucx"}))||(I=C&&I||void 0,p=p===""?void 0:p,re.composerState.publishing=!0,z("loading"),(async()=>{try{if(g.length>0){const O=g.map(ve=>{const{file:Qe,description:Fn,id:Cn}=ve;if(Cn)return ve;{const zn=sn({file:Qe,description:Fn});return M.v2.media.create(zn).then(ft=>(ft.id&&(ve.id=ft.id),ft))}}),he=await Promise.allSettled(O);if(he.some(ve=>{var Qe;return ve.status==="rejected"||!((Qe=ve.value)!=null&&Qe.id)})){re.composerState.publishing=!1,re.composerState.publishingError=!0,z("error"),he.forEach(ve=>{ve.status==="rejected"&&alert(ve.reason||r._({id:"eIiurD",values:{i}}))});return}}let x={status:p,spoiler_text:I,language:K,sensitive:C,poll:j,media_ids:g.map(O=>O.id)};n&&nt("@mastodon/edit-media-attributes")?x.media_attributes=g.map(O=>({id:O.id,description:O.description})):n||(x.visibility=S,x.in_reply_to_id=(t==null?void 0:t.id)||void 0),x=sn(x);let F;if(n)F=await M.v1.statuses.$select(n.id).update(x),In(F,y,{skipThreading:!0});else try{F=await M.v1.statuses.create(x,{requestInit:{headers:{"Idempotency-Key":R.current}}})}catch{F=await M.v1.statuses.create(x)}re.composerState.minimized=!1,re.composerState.publishing=!1,z("default"),s({type:n?"edit":t?"reply":"post",newStatus:F,instance:y})}catch(x){re.composerState.publishing=!1,re.composerState.publishingError=!0,alert((x==null?void 0:x.reason)||x),z("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:V,type:"text",name:"spoilerText",placeholder:r._({id:"gnKo7f"}),disabled:w==="loading",class:"spoiler-text-field",lang:K,spellCheck:"true",dir:"auto",style:{opacity:X?1:0,pointerEvents:X?"auto":"none"},onInput:()=>{ht()}}),e("label",{class:`toolbar-button ${X?"highlight":""}`,title:r._({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:X,disabled:w==="loading",onChange:o=>{var k,p;const d=o.target.checked;te(d),d?(k=V.current)==null||k.focus():(p=A.current)==null||p.focus()}}),e(N,{icon:`eye-${X?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${J!=="public"&&!X?"show-field":""} ${J!=="public"?"highlight":""}`,title:J,children:[e(N,{icon:Nn[J],alt:J}),e("select",{name:"visibility",value:J,onChange:o=>{me(o.target.value)},disabled:w==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(q,{id:"7d1a0d"})}),(nt("@pleroma/local-visibility-post")||nt("@akkoma/local-visibility-post"))&&e("option",{value:"local",children:e(q,{id:"d5zxa4"})}),e("option",{value:"unlisted",children:e(q,{id:"WDcQq9"})}),e("option",{value:"private",children:e(q,{id:"o34OrG"})}),e("option",{value:"direct",children:e(q,{id:"IV4QaU"})})]})]})," "]}),e(Ti,{ref:A,placeholder:t?r._({id:"Sjj+EN"}):n?r._({id:"qzVesX"}):r._({id:"owpNF1"}),required:(g==null?void 0:g.length)===0,disabled:w==="loading",lang:K,onInput:()=>{ht()},maxCharacters:h,performSearch:o=>{const{type:d,q:k,limit:p}=o;return d==="accounts"?M.v1.accounts.search.list({q:k,limit:p,resolve:!1}):M.v2.search.fetch(o)},onTrigger:o=>{(o==null?void 0:o.name)==="custom-emojis"?je({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="mention"?gt({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="auto-detect-language"&&(o!=null&&o.languages)&&vn(o.languages)}}),(g==null?void 0:g.length)>0&&e("div",{class:"media-attachments",children:[g.map((o,d)=>{const{id:k,file:p}=o,S=(p==null?void 0:p.size)+(p==null?void 0:p.type)+(p==null?void 0:p.name);return e(Ri,{attachment:o,disabled:w==="loading",lang:K,onDescriptionChange:C=>{G(I=>{const x=[...I];return x[d]={...x[d],description:C},x})},onRemove:()=>{G(C=>C.filter((I,x)=>x!==d))}},k||S||d)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:X,disabled:w==="loading",onChange:o=>{const d=o.target.checked;te(d)}})," ",e("span",{children:e(q,{id:"jER18a"})})," ",e(N,{icon:`eye-${X?"close":"open"}`})]})]}),!!j&&e(Di,{lang:K,maxOptions:oe,maxExpiration:pe,minExpiration:ae,maxCharactersPerOption:ee,poll:j,disabled:w==="loading",onInput:o=>{if(o){const d={...o};le(d)}else le(null)}}),e("div",{class:"toolbar compose-footer",children:[e("span",{class:"add-toolbar-button-group spacer",children:[kn&&e(cn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},menuButton:({open:o})=>e("button",{type:"button",class:`toolbar-button add-button ${o?"active":""}`,children:e(N,{icon:"plus",title:r._({id:"m16xKo"})})}),children:[e(Ie,{className:"compose-menu-add-media",children:[e("label",{class:"compose-menu-add-media-field",children:e(en,{hidden:!0,supportedMimeTypes:b,maxMediaAttachments:u,mediaAttachments:g,disabled:w==="loading"||g.length>=u||!!j,setMediaAttachments:G})}),e(N,{icon:"media"})," ",e("span",{children:f(ke.media)})]}),e(Ie,{onClick:()=>{je(!0)},children:[e(N,{icon:"emoji2"})," ",e("span",{children:f(ke.customEmoji)})]}),!!re.settings.composerGIFPicker&&e(Ie,{disabled:Pt,onClick:()=>{Je(!0)},children:[e("span",{class:"icon icon-gif",role:"img"}),e("span",{children:f(ke.gif)})]}),e(Ie,{disabled:Ot,onClick:Ht,children:[e(N,{icon:"poll"})," ",e("span",{children:f(ke.poll)})]})]}),e("span",{class:"add-sub-toolbar-button-group",ref:Xe,children:[e("label",{class:"toolbar-button",children:[e(en,{supportedMimeTypes:b,maxMediaAttachments:u,mediaAttachments:g,disabled:w==="loading"||g.length>=u||!!j,setMediaAttachments:G}),e(N,{icon:"media",alt:f(ke.media)})]}),e("button",{type:"button",class:"toolbar-button",disabled:w==="loading",onClick:()=>{je(!0)},children:e(N,{icon:"emoji2",alt:f(ke.customEmoji)})}),!!re.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:Pt,onClick:()=>{Je(!0)},children:e("span",{class:"icon icon-gif","aria-label":f(ke.gif)})}),wn&&e(Ne,{children:e("button",{type:"button",class:"toolbar-button",disabled:Ot,onClick:Ht,children:e(N,{icon:"poll",alt:f(ke.poll)})})})]})]}),w==="loading"?e(ct,{abrupt:!0}):e(Mi,{maxCharacters:h,hidden:w==="loading"}),e("label",{class:`toolbar-button ${K!==D.current||xe!=null&&xe.length&&!xe.includes(K)?"highlight":""}`,children:[e("span",{class:"icon-text",children:(Nt=gi[K])==null?void 0:Nt.native}),e("select",{name:"language",value:K,onChange:o=>{const{value:d}=o.target;B(d||_e),Be.session.set("currentLanguage",d||_e)},disabled:w==="loading",dir:"auto",children:[bn.map(([o,d,k])=>{const p=Et({code:o,fallback:d});return e("option",{value:o,children:p!==k?`${k} - ${p}`:p},o)}),e("hr",{}),xn.map(([o,d,k])=>{const p=Et({code:o,fallback:d});return e("option",{value:o,children:p!==k?`${k} - ${p}`:p},o)})]})]})," ",e("button",{type:"submit",disabled:w==="loading",children:t?r._({id:"ImOQa9"}):n?r._({id:"EkH9pt"}):r._({id:"GMe2XV"})})]})]})]}),Ye&&e(it,{onClick:o=>{o.target===o.currentTarget&&gt(!1)},children:e($i,{masto:M,instance:y,onClose:()=>{gt(!1)},defaultSearchTerm:Ye==null?void 0:Ye.defaultSearchTerm,onSelect:o=>{const d=A.current;if(!d)return;const{selectionStart:k,selectionEnd:p}=d,S=d.value,C=S.slice(0,k),I=C?/[\s\t\n\r]$/.test(C)?"":" ":"",x=S.slice(p),F=/^[\s\t\n\r]/.test(x)?"":" ",O=C+I+"@"+o+F+x;d.value=O,d.selectionStart=d.selectionEnd=p+1+o.length+F.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),Ze&&e(it,{onClick:o=>{o.target===o.currentTarget&&je(!1)},children:e(ji,{masto:M,instance:y,onClose:()=>{je(!1)},defaultSearchTerm:Ze==null?void 0:Ze.defaultSearchTerm,onSelect:o=>{const d=A.current;if(!d)return;const{selectionStart:k,selectionEnd:p}=d,S=d.value,C=S.slice(0,k),I=C?/[\s\t\n\r]$/.test(C)?"":" ":"",x=S.slice(p),F=/^[\s\t\n\r]/.test(x)?"":" ",O=C+I+o+F+x;d.value=O,d.selectionStart=d.selectionEnd=p+o.length+F.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),fn&&e(it,{onClick:o=>{o.target===o.currentTarget&&Je(!1)},children:e(Oi,{onClose:()=>Je(!1),onSelect:({url:o,type:d,alt_text:k})=>{if(g.length>=u){alert(r._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}(async()=>{var S,C;let p;try{p=Le({text:r._({id:"/Cw4Tx"}),duration:-1});const I=await fetch(o,{referrerPolicy:"no-referrer"}).then(O=>O.blob()),x=new File([I],d==="video/mp4"?"video.mp4":"image.gif",{type:d}),F=[...g,{file:x,type:d,size:x.size,id:null,description:k||""}];G(F),(S=p==null?void 0:p.hideToast)==null||S.call(p)}catch{(C=p==null?void 0:p.hideToast)==null||C.call(p),Le(r._({id:"VKDnAx"}))}})()}})})]})}function en({hidden:s,supportedMimeTypes:t,maxMediaAttachments:n,mediaAttachments:a,disabled:c=!1,setMediaAttachments:l}){return e("input",{type:"file",hidden:s,accept:t==null?void 0:t.join(","),multiple:n===void 0||n-a>=2,disabled:c,onChange:r=>{const f=r.target.files;if(!f)return;const _=Array.from(f).map(L=>({file:L,type:L.type,size:L.size,url:URL.createObjectURL(L),id:null,description:null}));a.length+_.length>n?alert(fe._({id:"ctFhjs",values:{maxMediaAttachments:n}})):l(L=>L.concat(_)),r.target.value=""}})}function tn(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:c}=s;if(n<window.innerHeight){const l=n-c,r=t?a+l+"px":null;s.style.height=r}}async function Ii(s,t){const a=(await t.v1.customEmojis.list()).filter(l=>l.visibleInPicker),c=new Kn(a,{keys:["shortcode"],findAllMatches:!0});return[a,c]}const pn=Bn(Ii,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),Bi=async s=>{const{detectAll:t}=await Tn(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},Ti=Mn((s,t)=>{var ie;const{masto:n,instance:a}=St(),[c,l]=H(((ie=t.current)==null?void 0:ie.value)||""),{maxCharacters:r,performSearch:f=()=>{},onTrigger:_=()=>{},...L}=s,M=W();ne(()=>{pn(a,n).then(h=>{const[u,m]=h;M.current=m}).catch(h=>{})},[]);const y=W(),w=W("");ne(()=>{let h,u,m;return y.current&&(h=b=>{var de;const{key:v,provide:P,text:E}=b.detail;if(w.current=E,E===""){P(Promise.resolve({matched:!1}));return}if(v===":"){const oe=(de=M.current)==null?void 0:de.search(E,{limit:5});let ee="";oe.forEach(({item:pe})=>{const{shortcode:ae,url:A}=pe;ee+=`
<li role="option" data-value="${Ee(ae)}">
<img src="${Ee(A)}" width="16" height="16" alt="" loading="lazy" />
${Ee(ae)}
</li>`}),ee+=`<li role="option" data-value="" data-more="${E}">${fe._({id:"24misb"})}</li>`,Fe.innerHTML=ee,P(Promise.resolve({matched:oe.length>0,fragment:Fe}));return}const Y={"@":"accounts","#":"hashtags"}[v];P(new Promise(oe=>{f({type:Y,q:E,limit:5}).then(pe=>{if(E!==w.current)return;const ae=pe[Y]||pe;let A="";ae.forEach(V=>{var G;const{name:J,avatarStatic:me,displayName:X,username:te,acct:K,emojis:B,history:D}=V,g=qn(X,B);if(K)A+=`
<li role="option" data-value="${Ee(K)}">
<span class="avatar">
<img src="${Ee(me)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${g||te}</b>
<br><span class="bidi-isolate">@${Ee(K)}</span>
</span>
</li>
`;else{const j=(G=D==null?void 0:D.reduce)==null?void 0:G.call(D,(le,se)=>le+ +se.uses,0);A+=`
<li role="option" data-value="${Ee(J)}">
<span class="grow">#<b>${Ee(J)}</b></span>
${j?`<span class="count">${Wn(j)}</span>`:""}
</li>
`}}),Y==="accounts"&&(A+=`<li role="option" data-value="" data-more="${E}">${fe._({id:"24misb"})}</li>`),Fe.innerHTML=A,oe({matched:ae.length>0,fragment:Fe})})}))},y.current.addEventListener("text-expander-change",h),u=b=>{const{key:v,item:P}=b.detail,{value:E,more:Y}=P.dataset;v===":"?(b.detail.value=E?`:${E}:`:"",Y&&(b.detail.continue=!0,setTimeout(()=>{_==null||_({name:"custom-emojis",defaultSearchTerm:Y})},300))):v==="@"?(b.detail.value=E?`@${E} `:"",Y&&(b.detail.continue=!0,setTimeout(()=>{_==null||_({name:"mention",defaultSearchTerm:Y})},300))):b.detail.value=`${v}${E}`},y.current.addEventListener("text-expander-value",u),m=b=>{const{input:v}=b.detail;if(l(v.value),t.current){const P=new Event("input",{bubbles:!0});t.current.dispatchEvent(P)}},y.current.addEventListener("text-expander-committed",m)),()=>{y.current&&(y.current.removeEventListener("text-expander-change",h),y.current.removeEventListener("text-expander-value",u),y.current.removeEventListener("text-expander-committed",m))}},[]),ne(()=>{const h=t.current;if(!h)return;new ResizeObserver(()=>{if(y.current){const{height:m}=h.getBoundingClientRect();y.current.style.height=m+"px"}}).observe(h)},[]);const z=W(0),R=W(),$=Un(h=>{var b;if(!R.current)return;if(z.current>3){R.current.innerHTML="",R.current=null,(b=$==null?void 0:$.cancel)==null||b.call($);return}let u,m;z.current<=3&&(u=Date.now()),R.current.innerHTML=Li(h,{maxCharacters:r})+`
`,z.current<=3&&(m=Date.now()),u&&m&&m-u>50&&z.current++},500),Z=ut(()=>{var m,b;const h=(m=R.current)==null?void 0:m.cloneNode(!0);if(!h)return;h.querySelectorAll("mark").forEach(v=>{v.remove()});const u=(b=h.innerText)==null?void 0:b.trim();u&&(async()=>{const v=await Bi(u);v!=null&&v.length&&(_==null||_({name:"auto-detect-language",languages:v}))})()},2e3);return e("text-expander",{ref:y,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",...L,ref:t,name:"status",value:c,onKeyDown:h=>{const{key:u,target:m}=h;if(u==="Enter"&&!(h.ctrlKey||h.metaKey))try{const{value:b,selectionStart:v}=m,E=b.slice(0,v).split(`
`).slice(-1)[0];if(E&&/^\s*(-|\d+\.)\s/.test(E)){const[Y,de,oe,ee,pe]=E.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(pe){h.preventDefault();const[ae]=oe.match(/\d+/)||[],A=ae?`${+ae+1}.`:"-",V=`
${de}${A}${ee}`;m.setRangeText(V,v,v);const J=v+V.length;m.setSelectionRange(J,J)}else{const ae=v-E.length;m.setRangeText("",ae,v)}tn(m),m.dispatchEvent(new Event("input"))}}catch{}R.current&&(R.current.scrollTop=m.scrollTop)},onInput:h=>{var b;const{target:u}=h,m=u.value.replace(/\u200b/g,"");l(m),tn(u),(b=s.onInput)==null||b.call(s,h),$(m),Z()},style:{width:"100%",height:"4em"},onScroll:h=>{if(R.current){const{scrollTop:u}=h.target;R.current.scrollTop=u}}}),e("div",{ref:R,class:"compose-highlight","aria-hidden":"true"})]})});function Mi({maxCharacters:s=500,hidden:t}){const a=Rn(re).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 nn(s,t,n,a){const c=Math.sqrt(t/s),l=Math.floor(n*c),r=Math.floor(a*c);return{newWidth:l,newHeight:r}}function Ri({attachment:s,disabled:t,lang:n,onDescriptionChange:a=()=>{},onRemove:c=()=>{}}){const{i18n:l}=Ve(),[r,f]=H("default"),_=nt("@mastodon/edit-media-attributes"),{type:L,id:M,file:y}=s,w=He(()=>y?URL.createObjectURL(y):s.url,[y,s.url]),z=!!(y!=null&&y.size),R=z?on():{},{mediaAttachments:{imageSizeLimit:$,imageMatrixLimit:Z,videoSizeLimit:ie,videoMatrixLimit:h,videoFrameRateLimit:u}={}}=R||{},[m,b]=H(()=>z?L.startsWith("image")&&$&&y.size>$?{type:"imageSizeLimit",details:{imageSize:y.size,imageSizeLimit:$}}:L.startsWith("video")&&ie&&y.size>ie?{type:"videoSizeLimit",details:{videoSize:y.size,videoSizeLimit:ie}}:null:null),[v,P]=H({});ne(()=>{!z||!Z||(v==null?void 0:v.matrix)>Z&&b({type:"imageMatrixLimit",details:{imageMatrix:v==null?void 0:v.matrix,imageMatrixLimit:Z,width:v==null?void 0:v.width,height:v==null?void 0:v.height}})},[v,Z,z]);const[E,Y]=H({});ne(()=>{!z||!h||(E==null?void 0:E.matrix)>h&&b({type:"videoMatrixLimit",details:{videoMatrix:E==null?void 0:E.matrix,videoMatrixLimit:h,width:E==null?void 0:E.width,height:E==null?void 0:E.height}})},[E,h,z]);const[de,oe]=H(s.description),[ee,pe]=L.split("/"),ae=ut(a,250);ne(()=>{ae(de)},[de,ae]);const[A,V]=H(!1),J=W(null);ne(()=>{let B;return A&&J.current&&(B=setTimeout(()=>{J.current.focus()},100)),()=>{clearTimeout(B)}},[A]);const me=e(Ne,{children:M&&!_?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(q,{id:"3wG7HI"})}),e("p",{title:de,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:J,value:de||"",lang:n,placeholder:{image:l._({id:"Lh8B0N"}),video:l._({id:"mN4S+e"}),audio:l._({id:"ieZytw"})}[ee],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||r==="loading",class:r==="loading"?"loading":"",maxlength:"1500",onInput:B=>{const{value:D}=B.target;oe(D)}})}),X=W(null);ne(()=>()=>{var B,D;(D=(B=X.current)==null?void 0:B.hideToast)==null||D.call(B)},[]);const te=W(null),K=B=>{const{type:D,details:g}=B;switch(D){case"imageSizeLimit":{const{imageSize:G,imageSizeLimit:j}=g;return l._({id:"d83/LB",values:{0:et(G),1:et(j)}})}case"imageMatrixLimit":{const{imageMatrix:G,imageMatrixLimit:j,width:le,height:se}=g,{newWidth:Ce,newHeight:we}=nn(G,j,le,se);return l._({id:"DuvOX/",values:{0:l.number(le),1:l.number(se),2:l.number(Ce),3:l.number(we)}})}case"videoSizeLimit":{const{videoSize:G,videoSizeLimit:j}=g;return l._({id:"d83/LB",values:{0:et(G),1:et(j)}})}case"videoMatrixLimit":{const{videoMatrix:G,videoMatrixLimit:j,width:le,height:se}=g,{newWidth:Ce,newHeight:we}=nn(G,j,le,se);return l._({id:"DuvOX/",values:{0:l.number(le),1:l.number(se),2:l.number(Ce),3:l.number(we)}})}case"videoFrameRateLimit":return l._({id:"S1fBwy"})}};return e(Ne,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{V(!0)},children:ee==="image"?e("img",{src:w,alt:"",onLoad:B=>{if(!z)return;const{naturalWidth:D,naturalHeight:g}=B.target;P({matrix:D*g,width:D,height:g})}}):ee==="video"||ee==="gifv"?e("video",{src:w+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:B=>{if(!z)return;const{videoWidth:D,videoHeight:g}=B.target;D&&g&&Y({matrix:D*g,width:D,height:g})}}):ee==="audio"?e("audio",{src:w,controls:!0}):null}),me,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:c,children:e(N,{icon:"x",alt:l._({id:"t/YqKh"})})}),!!m&&e("button",{type:"button",class:"media-error",title:K(m),onClick:()=>{te.current&&te.current.hideToast(),te.current=Le({text:K(m),duration:1e4})},children:e(N,{icon:"alert",alt:l._({id:"SlfejT"})})})]})]}),A&&e(it,{onClose:()=>{V(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{V(!1)},children:e(N,{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"})}[ee]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:ee==="image"?e("img",{src:w,alt:""}):ee==="video"||ee==="gifv"?e("video",{src:w,playsinline:!0,controls:!0}):ee==="audio"?e("audio",{src:w,controls:!0}):null}),e("div",{class:"media-form",children:[me,e("footer",{children:[ee==="image"&&/^(png|jpe?g|gif|webp)$/i.test(pe)&&!!re.settings.mediaAltGenerator&&!!yt&&e(cn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e(N,{icon:"more",size:"l",alt:l._({id:"2FYpfJ"})})}),children:[e(Ie,{disabled:r==="loading",onClick:()=>{f("loading"),X.current=Le({text:l._({id:"8zsp51"}),duration:-1}),async function(){var B,D;try{const g=new FormData;g.append("image",y);const G=await fetch(yt,{method:"POST",body:g}).then(j=>j.json());if(G.error)throw new Error(G.error);oe(G.description)}catch(g){Le(g.message?l._({id:"wy0Iwj",values:{0:g.message}}):l._({id:"xhYfVj"}))}finally{f("default"),(D=(B=X.current)==null?void 0:B.hideToast)==null||D.call(B)}}()},children:[e(N,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(q,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(q,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e(Ie,{disabled:r==="loading",onClick:()=>{f("loading"),X.current=Le({text:l._({id:"8zsp51"}),duration:-1}),async function(){var B,D;try{const g=new FormData;g.append("image",y);const G=`?lang=${n}`,j=await fetch(yt+G,{method:"POST",body:g}).then(le=>le.json());if(j.error)throw new Error(j.error);oe(j.description)}catch(g){Le(l._({id:"eNTGfp",values:{0:g!=null&&g.message?`: ${g.message}`:""}}))}finally{f("default"),(D=(B=X.current)==null?void 0:B.hideToast)==null||D.call(B)}}()},children:[e(N,{icon:"sparkles2"}),e("small",{children:[e(q,{id:"o5sTJw"}),e("br",{}),e(q,{id:"m+pAEQ",values:{0:Et(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{V(!1)},disabled:r==="loading",children:e(q,{id:"DPfwMq"})})]})]})]})]})})]})}function Di({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:c,maxExpiration:l,minExpiration:r,maxCharactersPerOption:f}){const{_}=Ve(),{options:L,expiresIn:M,multiple:y}=t;return e("div",{class:`poll ${y?"multiple":""}`,children:[e("div",{class:"poll-choices",children:L.map((w,z)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:w,disabled:n,maxlength:f,placeholder:fe._({id:"LDUSXg",values:{0:z+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:R=>{const{value:$}=R.target;L[z]=$,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||L.length<=1,onClick:()=>{L.splice(z,1),a(t)},children:e(N,{icon:"x",size:"s",alt:fe._({id:"t/YqKh"})})})]},z))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||L.length>=c,onClick:()=>{L.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:y,disabled:n,onChange:w=>{const{checked:z}=w.target;t.multiple=z,a(t)}})," ",e(q,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(q,{id:"lkz6PL"})," ",e("select",{value:M,disabled:n,onChange:w=>{const{value:z}=w.target;t.expiresIn=z,a(t)},children:Object.entries(dn).filter(([w])=>w>=r&&w<=l).map(([w,z])=>e("option",{value:w,children:z()},w))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(q,{id:"CDpQAX"})})})]})}function Ee(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function sn(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}=St(),[c,l]=H("default"),[r,f]=H([]),[_,L]=H({}),[M,y]=H(0),w=async h=>{if(!(h!=null&&h.length))return;const u=await Vn(h,_);u&&L({..._,...u})},z=h=>{h&&(l("loading"),(async()=>{try{const u=await a.v1.accounts.search.list({q:h,limit:40,resolve:!1});f(u),w(u),l("default")}catch{l("error")}})())},R=ut(z,1e3);ne(()=>{z()},[z]);const $=W();ne(()=>{$.current&&($.current.focus(),$.current.value&&($.current.selectionStart=$.current.value.length,$.current.selectionEnd=$.current.value.length))},[]),ne(()=>{n&&z(n)},[n]);const Z=h=>{const u=h.acct;t(u),s()};Oe("enter",()=>{const h=r[M];h&&Z(h)},{preventDefault:!0,enableOnFormTags:["input"]});const ie=W();return Oe("down",()=>{M<r.length-1?y(M+1):y(0),setTimeout(()=>{const h=ie.current.querySelector(".selected");h&&h.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),Oe("up",()=>{M>0?y(M-1):y(r.length-1),setTimeout(()=>{const h=ie.current.querySelector(".selected");h&&h.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(N,{icon:"x",alt:fe._({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:h=>{var u;h.preventDefault(),(u=R.flush)==null||u.call(R)},children:e("input",{ref:$,required:!0,type:"search",class:"block",placeholder:fe._({id:"eH1bqp"}),onInput:h=>{const{value:u}=h.target;R(u)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:(r==null?void 0:r.length)>0?e("ul",{ref:ie,class:`accounts-list ${c==="loading"?"loading":""}`,children:r.map((h,u)=>{const m=_[h.id];return e("li",{class:u===M?"selected":"",children:[e(ln,{avatarSize:"xxl",account:h,relationship:m,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{Z(h)},children:e(N,{icon:"plus",size:"xl",alt:fe._({id:"m16xKo"})})})]},h.id)})}):c==="loading"?e("div",{class:"ui-state",children:e(ct,{abrupt:!0})}):c==="error"?e("div",{class:"ui-state",children:e("p",{children:e(q,{id:"AThL/k"})})}):null})]})}function ji({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:c}){const[l,r]=H("default"),f=W([]),[_,L]=H([]),M=He(()=>Be.account.get("recentlyUsedCustomEmojis")||[]),y=W();ne(()=>{r("loading"),(async()=>{try{const[u,m]=await pn(t,s);y.current=m,L(u),r("default")}catch{r("error")}})()},[]);const w=He(()=>{const u={"--recent--":M.filter(b=>_.find(v=>v.shortcode===b.shortcode))},m=[];return _.forEach(b=>{var v,P;if((P=(v=f.current)==null?void 0:v.push)==null||P.call(v,b),!b.category){m.push(b);return}u[b.category]||(u[b.category]=[]),u[b.category].push(b)}),m.length&&(u["--others--"]=m),u},[_]),z=W(),[R,$]=H(null),Z=qt(u=>{var b,v,P;const{value:m}=u.target;if(m){const E=(b=y.current)==null?void 0:b.search(m,{limit:At});$(E.map(Y=>Y.item)),(P=(v=z.current)==null?void 0:v.scrollTo)==null||P.call(v,0,0)}else $(null)},[_]);ne(()=>{c&&(_!=null&&_.length)&&Z({target:{value:c}})},[c,Z,_]);const ie=qt(u=>{a==null||a(u),n==null||n(),queueMicrotask(()=>{let m=Be.account.get("recentlyUsedCustomEmojis")||[];const b=m.findIndex(v=>v.shortcode===u.shortcode);b!==-1?(m.splice(b,1),m.unshift(u)):(m.unshift(u),m=m.filter(v=>{var P,E;return(E=(P=f.current)==null?void 0:P.find)==null?void 0:E.call(P,Y=>Y.shortcode===v.shortcode)}),m=m.slice(0,10)),Be.account.set("recentlyUsedCustomEmojis",m)})},[a]),h=W();return ne(()=>{h.current&&(h.current.focus(),h.current.value&&(h.current.selectionStart=h.current.value.length,h.current.selectionEnd=h.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(N,{icon:"x",alt:fe._({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(q,{id:"8i6Ueo"})})," ",l==="loading"?e(ct,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:u=>{u.preventDefault();const m=R[0];m&&ie(`:${m.shortcode}:`)},children:e("input",{ref:h,type:"search",placeholder:fe._({id:"EarrCe"}),onInput:Z,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:c||""})})]}),e("main",{ref:z,children:R!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:R.map(u=>e("li",{class:"custom-emojis-match",children:e(mn,{emoji:u,onClick:()=>{ie(`:${u.shortcode}:`)},showCode:!0})},u.shortcode))}):e("div",{class:"custom-emojis-list",children:[l==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(q,{id:"Kzwsg2"})})}),l==="default"&&Object.entries(w).map(([u,m])=>!!(m!=null&&m.length)&&e("div",{class:"section-container",children:[e("div",{class:"section-header",children:{"--recent--":fe._({id:"uabU9X"}),"--others--":fe._({id:"NuKR0h"})}[u]||u}),e(Pi,{emojis:m,onSelect:ie})]}))]})})]})}const Pi=rn(({emojis:s,onSelect:t})=>{const{i18n:n}=Ve(),[a,c]=H(At),l=s.length>a;return e("section",{children:[s.slice(0,a).map(r=>e(mn,{emoji:r,onClick:()=>{t(`:${r.shortcode}:`)}},r.shortcode)),l&&e("button",{type:"button",class:"plain small",onClick:()=>c(a+At),children:e(q,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),mn=rn(({emoji:s,onClick:t,showCode:n})=>{const a=c=>{const r=c.currentTarget.closest("main");if(r){const f=r.getBoundingClientRect(),_=c.currentTarget.getBoundingClientRect(),L=c.currentTarget.classList;_.left<f.left+88?(L.add("edge-left"),L.remove("edge-right")):_.right>f.right-88?(L.add("edge-right"),L.remove("edge-left")):L.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(Ne,{children:[" ",e("code",{children:s.shortcode})]})]})}),kt=20;function Oi({onClose:s=()=>{},onSelect:t=()=>{}}){var z,R,$,Z,ie,h;const{i18n:n}=Ve(),[a,c]=H("default"),[l,r]=H([]),f=W(null),_=W(null),L=W(0),M=W(null);function y({offset:u}){var m,b,v;(m=_.current)!=null&&m.value&&(c("loading"),(v=(b=M.current)==null?void 0:b.scrollTo)==null||v.call(b,{top:0,left:0,behavior:"smooth"}),(async()=>{var P;try{const E={api_key:mi,q:_.current.value,rating:"g",limit:kt,bundle:"messaging_non_clips",offset:u,lang:n.locale||"en"},Y=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(E),{referrerPolicy:"no-referrer"}).then(de=>de.json());L.current=((P=Y.pagination)==null?void 0:P.offset)||0,r(Y),c("results")}catch{c("error")}})())}ne(()=>{var u;(u=_.current)==null||u.focus()},[]);const w=ut(()=>{y({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(N,{icon:"x",alt:n._({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:f,onSubmit:u=>{u.preventDefault(),y({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:w}),e("input",{type:"image",class:"powered-button",src:ui,width:"86",height:"30",alt:n._({id:"c1Q/eU"})})]})}),e("main",{ref:M,class:a==="loading"?"loading":"",children:[a==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(q,{id:"9KEidY"})})}),a==="loading"&&!((z=l==null?void 0:l.data)!=null&&z.length)&&e("div",{class:"ui-state",children:e(ct,{abrupt:!0})}),((R=l==null?void 0:l.data)==null?void 0:R.length)>0?e(Ne,{children:[e("ul",{children:l.data.map(u=>{const{id:m,images:b,title:v,alt_text:P}=u,{fixed_height_small:E,fixed_height_downsampled:Y,fixed_height:de,original:oe}=b,ee=E!=null&&E.url?E:Y!=null&&Y.url?Y:de;let{url:pe,webp:ae,width:A,height:V}=ee;+V>100&&(A=A/V*100,V=100);const J=URL.parse(pe),me=J.origin+J.pathname;let X;if(ae){const te=URL.parse(ae);X=te.origin+te.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:te,url:K}=oe,B=te||K,D=URL.parse(B),g=D.origin+D.pathname;s(),t({url:g,type:te?"video/mp4":"image/gif",alt_text:P||v})},children:e("figure",{style:{"--figure-width":A+"px"},children:[e("picture",{children:[X&&e("source",{srcset:X,type:"image/webp"}),e("img",{src:me,width:A,height:V,loading:"lazy",decoding:"async",alt:P,referrerpolicy:"no-referrer",onLoad:te=>{te.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:P||v})]})})},m)})}),e("p",{class:"pagination",children:[(($=l.pagination)==null?void 0:$.offset)>0&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var u;y({offset:((u=l.pagination)==null?void 0:u.offset)-kt})},children:[e(N,{icon:"chevron-left"}),e("span",{children:e(q,{id:"DHhJ7s"})})]}),e("span",{}),((Z=l.pagination)==null?void 0:Z.offset)+((ie=l.pagination)==null?void 0:ie.count)<((h=l.pagination)==null?void 0:h.total_count)&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var u;y({offset:((u=l.pagination)==null?void 0:u.offset)+kt})},children:[e("span",{children:e(q,{id:"hXzOVo"})})," ",e(N,{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(q,{id:"PbFw9n"})})})]})]})}export{qi as default};
//# sourceMappingURL=compose-_xw4e_c5.js.map