diff --git a/assets/compose-URAu_ZrF.js b/assets/compose-URAu_ZrF.js new file mode 100644 index 0000000..a3c6a3a --- /dev/null +++ b/assets/compose-URAu_ZrF.js @@ -0,0 +1,2 @@ +import{a9 as _,h as l,i as o,U as g,M as v,a3 as T,y as u,T as t,c as e,I as m,w as y,aa as I,ac as C}from"./useTitle-6CgMxXiB.js";_();window.opener&&(console=window.opener.console);function x(){var d,r;const[s,p]=l("default"),[a,w]=l(null),{editStatus:c,replyToStatus:i,draftStatus:f}=window.__COMPOSE__||{};return g(c?o._({id:"Txus+H"}):i?o._({id:"03vjxE",values:{0:((d=i.account)==null?void 0:d.acct)||((r=i.account)==null?void 0:r.username)}}):o._({id:"QOhkyl"})),u(()=>{const n=v();w(!!n),n&&T()},[]),u(()=>{if(s==="closed"){try{window.opener.focus()}catch{}window.close()}},[s]),s==="closed"?e("div",{class:"box",children:[e("p",{children:e(t,{id:"mBdQnV"})}),e("p",{children:e("button",{onClick:()=>{window.close()},children:e(t,{id:"rf8fiC"})})})]}):a===!1?e("div",{class:"box",children:[e("h1",{children:e(t,{id:"SlfejT"})}),e("p",{children:e(t,{id:"D3vX+9"})}),e("p",{children:e("a",{href:"/",children:e(t,{id:"iWpEwy"})})})]}):a?e(m,{editStatus:c,replyToStatus:i,draftStatus:f,standalone:!0,hasOpener:window.opener,onClose:n=>{const{newStatus:h,fn:S=()=>{}}=n||{};try{h&&window.opener.__STATES__.reloadStatusPage++,S(),p("closed")}catch{}}}):e("div",{class:"box",children:e(y,{})})}C(e(I,{i18n:o,children:e(x,{})}),document.getElementById("app-standalone")); +//# sourceMappingURL=compose-URAu_ZrF.js.map diff --git a/assets/compose-URAu_ZrF.js.map b/assets/compose-URAu_ZrF.js.map new file mode 100644 index 0000000..699a055 --- /dev/null +++ b/assets/compose-URAu_ZrF.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compose-URAu_ZrF.js","sources":["../../src/compose.jsx"],"sourcesContent":["import './index.css';\nimport './app.css';\nimport './polyfills';\n\nimport { i18n } from '@lingui/core';\nimport { t, Trans } from '@lingui/macro';\nimport { I18nProvider } from '@lingui/react';\nimport { render } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport ComposeSuspense from './components/compose-suspense';\nimport Loader from './components/loader';\nimport { initActivateLang } from './utils/lang';\nimport { initStates } from './utils/states';\nimport { getCurrentAccount, setCurrentAccountID } from './utils/store-utils';\nimport useTitle from './utils/useTitle';\n\ninitActivateLang();\n\nif (window.opener) {\n console = window.opener.console;\n}\n\nfunction App() {\n const [uiState, setUIState] = useState('default');\n const [isLoggedIn, setIsLoggedIn] = useState(null);\n\n const { editStatus, replyToStatus, draftStatus } = window.__COMPOSE__ || {};\n\n useTitle(\n editStatus\n ? t`Editing source status`\n : replyToStatus\n ? t`Replying to @${\n replyToStatus.account?.acct || replyToStatus.account?.username\n }`\n : t`Compose`,\n );\n\n useEffect(() => {\n const account = getCurrentAccount();\n setIsLoggedIn(!!account);\n if (account) {\n initStates();\n }\n }, []);\n\n useEffect(() => {\n if (uiState === 'closed') {\n try {\n // Focus parent window\n window.opener.focus();\n } catch (e) {}\n window.close();\n }\n }, [uiState]);\n\n if (uiState === 'closed') {\n return (\n
\n

\n You may close this page now.\n

\n

\n {\n window.close();\n }}\n >\n Close window\n \n

\n
\n );\n }\n\n console.debug('OPEN COMPOSE');\n\n if (isLoggedIn === false) {\n return (\n
\n

\n Error\n

\n

\n Login required.\n

\n

\n \n Go home\n \n

\n
\n );\n }\n\n if (isLoggedIn) {\n return (\n {\n const { newStatus, fn = () => {} } = results || {};\n try {\n if (newStatus) {\n window.opener.__STATES__.reloadStatusPage++;\n }\n fn();\n setUIState('closed');\n } catch (e) {}\n }}\n />\n );\n }\n\n return (\n
\n \n
\n );\n}\n\nrender(\n \n \n ,\n document.getElementById('app-standalone'),\n);\n"],"names":["initActivateLang","window","opener","console","App","uiState","setUIState","useState","isLoggedIn","setIsLoggedIn","editStatus","replyToStatus","draftStatus","__COMPOSE__","useTitle","i18n","_","id","values","0","account","acct","username","useEffect","getCurrentAccount","initStates","focus","close","_jsxs","class","children","_jsx","Trans","onClick","href","ComposeSuspense","standalone","hasOpener","newStatus","results","fn","Loader","render","I18nProvider"],"mappings":"mIAiBAA,IAEIC,OAAOC,SACTC,QAAUF,OAAOC,OAAOC,SAG1B,SAASC,GAAM,SACb,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAS,SAAS,EAC1C,CAACC,EAAYC,CAAa,EAAIF,EAAS,IAAI,EAE3C,CAAEG,WAAAA,EAAYC,cAAAA,EAAeC,YAAAA,CAAAA,EAAgBX,OAAOY,aAAe,GA8BzE,OA5BAC,EACEJ,EAAUK,EAAAC,EACN,CAAAC,GAAA,QAAuB,CAAA,EACvBN,EAAaI,EAAAC,EACX,CAAAC,GAAA,SAAAC,OAAA,CAAAC,IACER,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBU,SAAQV,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBW,SAAQ,CAC/D,GAACP,EAAAC,EACF,CAAAC,GAAA,QAAS,CAAA,CACjB,EAEAM,EAAU,IAAM,CACd,MAAMH,EAAUI,IACFf,EAAA,CAAC,CAACW,CAAO,EACnBA,GACSK,GAEf,EAAG,CAAE,CAAA,EAELF,EAAU,IAAM,CACd,GAAIlB,IAAY,SAAU,CACpB,GAAA,CAEFJ,OAAOC,OAAOwB,aACJ,CAAC,CACbzB,OAAO0B,MAAM,CACf,CAAA,EACC,CAACtB,CAAO,CAAC,EAERA,IAAY,SAEZuB,EAAA,MAAA,CAAKC,MAAM,MAAKC,UACdC,EAAA,IAAA,CAAAD,SACEC,EAAAC,EAAA,CAAAf,GAAA,QAAA,CAA0C,CAAA,CACzC,EACHc,EAAA,IAAA,CAAAD,SACEC,EAAA,SAAA,CACEE,QAASA,IAAM,CACbhC,OAAO0B,MAAM,CACf,EAAEG,SAEFC,EAAAC,EAAA,CAAAf,GAAA,QAAA,CAA0B,CAAA,CACpB,CAAA,CACP,CAAC,CAAA,CACD,EAITd,IAA4B,WAEF,CACxB,YACO0B,SAAM,CAAAE,EAAA,KAAA,CAAKD,SACdC,EAAAC,EAAA,CAAAF,GAAAA,QACE,CAAA,CAAA,CAAA,EAAmBC,EAAA,IAAA,CAErBA,SAAAA,EAAAC,EAAA,CAAAF,GAAAA,QACE,CAAA,CAAA,CAAA,EAA6BC,EAAA,IAAA,CAE/BA,SAAAA,EAAA,IAAA,CAAAD,KAAAA,IACKI,SAAKH,EAAAC,EAAA,CAAGF,GAAAA,QACT,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAC,CACrB,CAAA,EAIXtB,EAEgBuB,EAAAI,EAAA,CACd,WAAAzB,EAEIA,cAAAA,EACAC,YAAAA,EACAC,WAAAA,GACAwB,UAAU,OAAA,OACVC,WAAkBnC,OAEV,UAAAoC,EAAEA,GAAAA,EAAAA,IAAAA,EAAsB,EAACC,GAAA,CAAA,EAAE,GAAIA,CACjCD,GACF,OAAe,OAAA,WAAA,mBAEfE,IACGlC,EAAA,QAAA,CACHA,MAAAA,EACW,CAAA,CACf,EAGNyB,EAAA,MAAA,CAEA,YACOF,SAAME,EAAAU,EAAA,EAAA,CAAA,CAAA,CACA,CAGfC,EAAAX,EAAAY,EAAA,CAEAD,KAAAA,EACgB3B,SAAAA,EAAAA,EAAAA,EAAAA,CAAAA,CAAAA,EACZgB,SAAAA,eAAM,gBAAA,CAAA"} \ No newline at end of file diff --git a/assets/compose-_xw4e_c5.js b/assets/compose-_xw4e_c5.js new file mode 100644 index 0000000..feade45 --- /dev/null +++ b/assets/compose-_xw4e_c5.js @@ -0,0 +1,26 @@ +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&&f0||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=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,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}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"),wt(a)+c}return wt(s).replace(hn,'$2$3').replace(Ei,'$1$2').replace(Fi,'$1$2').replace(zi,'$1$2')}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;I0&&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&>(!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(nl.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+=` +
  • + + ${Ee(ae)} +
  • `}),ee+=`
  • ${fe._({id:"24misb"})}
  • `,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+=` +
  • + + + + + ${g||te} +
    @${Ee(K)} +
    +
  • + `;else{const j=(G=D==null?void 0:D.reduce)==null?void 0:G.call(D,(le,se)=>le+ +se.uses,0);A+=` +
  • + #${Ee(J)} + ${j?`${Wn(j)}`:""} +
  • + `}}),Y==="accounts"&&(A+=`
  • ${fe._({id:"24misb"})}
  • `),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{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;_.leftf.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 diff --git a/assets/compose-_xw4e_c5.js.map b/assets/compose-_xw4e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A,SAAAqG,GAAAtD,CAAA,GACT,CAAS,EAAe3C,CACtB,EAAAlK,CAAA,EAAiC,EAChC,EAAA4J,EAAA,KAGN1I,MAAY,aACA,YAAAua,EAAA9P,EAAA,yBAAA8P,EAAA,WAAA7R,EAAA,UAAUM,KACnBJ,SAAc,oBAAE,SAAA5I,IAAA,UAGnByK,YAAwB,OACvBzB,EACE,CACGyB,aAAa/N,aAAb+N,cAA0B,QAAAoR,EACnB,EAAE/c,EAAI2d,eAAQ9Q,oBAAOsD,YAAajQ,cAClC,YACJ0d,EACAC,GACAC,6JACAO,cACF,MAAIV,cACJ,aAAqChV,UAKjC,mBAAEA,GAAKqV,mDAAMphB,CAAOmU,EAAO,SAAIgN,WAC/B,WAAe9S,EAAA,CACjBrO,WACS,GACX,MAAAkN,EAAAW,EAAA,CACMwT,oBACAC,GACFC,GACJ,GACQO,kBAAcC,EAAU,OACfD,iBACjB,SAAA5U,EAAA,KACA,qBACE,CAAAI,CACE,GAAAhJ,IACO,SAAA4I,EAAA,wBAEG,SAAAA,EAAA,KAAEyU,yBAAK5V,EACb,EACMsV,GACAC,GACE,EACC","names":["Combobox","input","list","tabInsertsSuggestions","defaultFirstOption","event","keyboardBindings","trackComposition","commitWithElement","_a","visible","indexDiff","focusEl","els","focusIndex","indexOfItem","newIndex","target","el","scrollTo","combobox","commit","fireCommitEvent","container","inViewport","element","scrollTop","containerBottom","top","bottom","boundary","query","text","key","cursor","multiWord","lookBackIndex","lastMatchPosition","keyIndex","pre","CustomHTMLElement","InputStyleCloneUpdateEvent","CloneRegistry","_InputStyleCloneElement","__privateAdd","_InputStyleCloneElement_instances","_styleObserver","__privateMethod","updateStyles_fn","_resizeObserver","requestUpdateLayout_fn","_inputRef","_container","_xOffset","_yOffset","_isLayoutUpdating","_onInput","updateText_fn","_onDocumentScrollOrResize","usingInput_fn","clone","__privateSet","__privateGet","input_get","fn","updateLayout_fn","inputStyle","inputRect","cloneRect","prop","propertiesToCopy","InputStyleCloneElement","e","_InputRange","startOffset","endOffset","_InputRange_instances","_inputElement","_startOffset","_endOffset","selectionStart","selectionEnd","offset","clampOffset_fn","toStart","createCloneRange_fn","styleClone_get","cloneElement_get","range","textNode","InputRange","states","TextExpander","expander","match","menu","_b","position","caretRect","targetPosition","currentPosition","delta","currentStyle","item","beginning","remaining","detail","suffix","value","found","providers","provide","result","x","TextExpanderElement","keysAttr","keys","multiWordAttr","globalMultiWord","state","ansiRegex","onlyFirst","pattern","regex","stripAnsi","string","segmenter","stringLength","countAnsiEscapeCodes","length","_","poweredByGiphyURL","PHANPY_IMG_ALT_API_URL","IMG_ALT_API_URL","PHANPY_GIPHY_API_KEY","GIPHY_API_KEY","import","supportedLanguagesMap","supportedLanguages","reduce","acc","l","code","common","native","expiryOptions","i18nDuration","expirySeconds","Object","oneDay","expiresInFromExpiresAt","expiresAt","Date","getTime","now","find","s","document","createElement","role","className","windowMargin","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","left","width","boundingClientRect","innerWidth","window","insetInlineStart","isRTL","style","observe","DEFAULT_LANG","localeMatch","Intl","DateTimeFormat","resolvedOptions","locale","navigator","languages","map","urlRegexObj","RegExp","urlRegex","source","flags","usernameRegex","urlPlaceholder","countableText","inputText","replace","USERNAME_RE","MENTION_RE","HASHTAG_RE","SHORTCODE_RE_FRAGMENT","SCAN_RE","Segmenter","escapeHTML","highlightText","maxCharacters","Infinity","composerCharacterCount","withinLimitHTML","exceedLimitHTML","htmlSegments","segment","index","RTF","mem","RelativeTimeFormat","undefined","LF","ListFormat","CUSTOM_EMOJIS_COUNT","ADD_LABELS","media","id","customEmoji","gif","poll","Compose","onClose","replyToStatus","editStatus","draftStatus","standalone","hasOpener","i18n","useLingui","rtf","lf","console","masto","instance","uiState","setUIState","useState","UID","uid","log","currentAccount","currentAccountInfo","maxMediaAttachments","charactersReservedPerUrl","imageMatrixLimit","supportedMimeTypes","imageSizeLimit","videoSizeLimit","videoMatrixLimit","videoFrameRateLimit","maxExpiration","maxOptions","maxCharactersPerOption","minExpiration","spoilerTextRef","useRef","textareaRef","store","prevLanguage","language","sensitive","setMediaAttachments","setLanguage","oninputTextarea","account","focusTextarea","dispatchEvent","setTimeout","spoilerText","useEffect","visibility2","language2","sensitive2","visibility","current","m","allMentions","prefs","setSensitive","poll2","mediaAttachments","options","expiresIn","statusSource","dataset","mediaAttachments2","setVisibility","composablePoll","status","o","formRef","canClose","hasValue","hasMediaAttachments","isSelf","hasOnlyAcct","confirmClose","hasIDMediaAttachments","beforeUnloadCopy","handleBeforeUnload","sameWithSource","getCharCount","updateCharCount","supportsCloseWatcher","useHotkeys","yes","addEventListener","capture","modals","hasModal","hasOnlyComposer","prevBackgroundDraft","count","escDownRef","ignoreEventWhen","useCloseWatcher","draftKey","getCurrentAccountNS","backgroundDraft","useInterval","db","handleItems","username","acct","i2","items","unsupportedFiles","i18n2","drafts","set","updatedAt","f","debug","error","files","clipboardData","max","file","alert","mediaFiles","allowedFiles","1","2","handleDragover","setShowMentionPicker","showEmoji2Picker","showGIFPicker","useMemo","contentTranslationHideLanguages","autoDetectedLanguages","topLanguages","restLanguages","commonB","type","size","url","codeA","commonA","codeB","onMinimize","saveUnsavedDraft","gifPickerDisabled","onPollButtonClick","setPoll","removeEventListener","addSubToolbarRef","setShowAddButton","useResizeObserver","showMentionPicker","scrollWidth","settings","push","_jsxs","sort","_jsx","AccountBlock","showPollButton","pollButtonDisabled","children","class","confirmText","passData","__STATES__","opener","composerState","Icon","openCompose","showAddButton","avatarStatic","disabled","onClick","Status","replyToStatusMonthsAgo","Trans","formData","components","0","onKeyDown","onSubmit","description","params2","res","attachment","results","mediaPromises","hasNoDescriptions","params","removeNullUndefined","newStatus","saveStatus","i","e2","media_attributes","in_reply_to_id","statuses","visibilityIconsMap","opacity","pointerEvents","checked","onChange","icon","title","limit","action","setShowEmoji2Picker","setAutoDetectedLanguages","Textarea","ref","placeholder","fileID","newAttachments","attachments","_2","j","performSearch","q","v1","resolve","v2","fetch","onTrigger","defaultSearchTerm","Poll","newPoll","onDescriptionChange","Menu2","open","MenuItem","FilePickerInput","onInput","setShowGIFPicker","body","zIndex","_Fragment","Loader","CharCountMeter","alt","localeCode2Text","commonText","composerGIFPicker","restSupportedLanguages","textarea","textBeforeMention","spaceAfterMention","textAfterMention","newText","Modal","CustomEmojisModal","textBeforeEmoji","textAfterEmoji","spaceBeforeEmoji","emojiShortcode","spaceAfterEmoji","onSelect","GIFPickerModal","alt_text","slice","theToast","showToast","blob","newMediaAttachments","hidden","then","autoResizeTextarea","offsetHeight","scrollHeight","clientHeight","height","visibleEmojis","__vitePreload","langs","detectAll","lang","setText","textareaProps","searcherRef","getCustomEmojis","r","searcher","handleChange","text2","_getCustomEmojis","emojis","filter","Fuse","matchesArg","cacheKeyArg","emoji","detectLangs","shortcode","encodeHTML","forwardRef","html","props","textExpanderTextRef","history","displayNameWithEmoji","emojifyText","displayName","search","total","cur","name","shortenNumber","Promise","matched","v","more","textExpanderRef","handleValue","handleCommited","slowHighlightPerf","composeHighlightRef","start","end","debouncedAutoDetectLanguage","useDebouncedCallback","dom","mark","resizeObserver","throttleHighlightText","lastLine","bullet","postSpaces","anything","number","newBullet","pos","dir","rows","cols","charCount","leftChars","ctrlKey","setRangeText","setSelectionRange","scaleDimension","matrix","matrixLimit","scalingFactor","newHeight","newWidth","MediaAttachment","supportsEdit","supports","onScroll","configuration","getCurrentInstanceConfiguration","maxError","setMaxError","checkMaxError","snapStates","imageMatrix","Math","videoMatrix","setDescription","debouncedOnDescriptionChange","timer","details","setImageMatrix","setVideoMatrix","toastRef","showModal","imageSizeLimit2","descTextarea","prettyBytes","videoSize","videoSizeLimit2","videoMatrixLimit2","videoMatrix2","maxErrorToast","maxErrorText","err","imageSize","suffixType","naturalWidth","naturalHeight","3","videoWidth","videoHeight","values","setShowModal","src","onLoad","onLoadedMetadata","onRemove","subtype","response","menuButton","append","multiple","option","required","label","splice","str","char","obj","MentionModal","api","accounts","setAccounts","relationshipsMap","setRelationshipsMap","setSelectedIndex","accounts2","fetchRelationships","relationships","loadAccounts","inputRef","filterShortcodes","searchTerm","bLower","aStartsWith","bStartsWith","aContains","bothContain","bContains","socialAddress","selectedAccount","selectedIndex","selectAccount","listRef","selectedItem","loadRelationships","term","debouncedLoadAccounts","enableOnFormTags","relationship","customEmojisList","recentlyUsedCustomEmojis","customEmojisCatList","emojisCat","customEmojis","othersCat","matches","setMatches","_c","scrollableRef","onFind","onSelectEmoji","useCallback","recentlyUsedCustomEmojis2","recentlyUsedEmojiIndex","emoji2","setCustomEmojis","category","queueMicrotask","CustomEmojisList","memo","setMax","CustomEmojiButton","showMore","showCode","parent","selfRect","rect","targetClassList","addEdges","GIFS_PER_PAGE","fetchGIFs","qRef","closest","currentTarget","remove","debouncedOnInput","onPointerEnter","staticUrl","decoding","setResults","currentOffset","images","fixed_height_small","fixed_height_downsampled","fixed_height","theImage","webp","urlObj","strippedURL","strippedWebP","preventDefault","original","theURL","mp4","url2","strippedURL2","webpObj","parse"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/@github/combobox-nav/dist/index.js","../../node_modules/@github/text-expander-element/dist/index.js","../../node_modules/ansi-regex/index.js","../../node_modules/strip-ansi/index.js","../../node_modules/string-length/index.js","../../src/assets/powered-by-giphy.svg","../../src/components/compose.jsx"],"sourcesContent":["export default class Combobox {\n constructor(input, list, { tabInsertsSuggestions, defaultFirstOption } = {}) {\n this.input = input;\n this.list = list;\n this.tabInsertsSuggestions = tabInsertsSuggestions !== null && tabInsertsSuggestions !== void 0 ? tabInsertsSuggestions : true;\n this.defaultFirstOption = defaultFirstOption !== null && defaultFirstOption !== void 0 ? defaultFirstOption : false;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random().toString().slice(2, 6)}`;\n }\n this.ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n this.indicateDefaultOption();\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n indicateDefaultOption() {\n var _a;\n if (this.defaultFirstOption) {\n (_a = Array.from(this.list.querySelectorAll('[role=\"option\"]:not([aria-disabled=\"true\"])'))\n .filter(visible)[0]) === null || _a === void 0 ? void 0 : _a.setAttribute('data-combobox-option-default', 'true');\n }\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n el.removeAttribute('data-combobox-option-default');\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.removeAttribute('aria-selected');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.removeAttribute('aria-selected');\n }\n this.indicateDefaultOption();\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!combobox.ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Tab':\n if (combobox.tabInsertsSuggestions && commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (combobox.ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (combobox.ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"], [data-combobox-option-default=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nconst boundary = /\\s|\\(|\\[/;\nfunction query(text, key, cursor, { multiWord, lookBackIndex, lastMatchPosition } = {\n multiWord: false,\n lookBackIndex: 0,\n lastMatchPosition: null\n}) {\n let keyIndex = text.lastIndexOf(key, cursor - 1);\n if (keyIndex === -1)\n return;\n if (keyIndex < lookBackIndex)\n return;\n if (multiWord) {\n if (lastMatchPosition != null) {\n if (lastMatchPosition === keyIndex)\n return;\n keyIndex = lastMatchPosition - key.length;\n }\n const charAfterKey = text[keyIndex + 1];\n if (charAfterKey === ' ' && cursor >= keyIndex + key.length + 1)\n return;\n const newLineIndex = text.lastIndexOf('\\n', cursor - 1);\n if (newLineIndex > keyIndex)\n return;\n const dotIndex = text.lastIndexOf('.', cursor - 1);\n if (dotIndex > keyIndex)\n return;\n }\n else {\n const spaceIndex = text.lastIndexOf(' ', cursor - 1);\n if (spaceIndex > keyIndex)\n return;\n }\n const pre = text[keyIndex - 1];\n if (pre && !boundary.test(pre))\n return;\n const queryString = text.substring(keyIndex + key.length, cursor);\n return {\n text: queryString,\n position: keyIndex + key.length\n };\n}\n\n/**\n * A custom element is implemented as a class which extends HTMLElement (in the\n * case of autonomous elements) or the interface you want to customize (in the\n * case of customized built-in elements).\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks\n */\nclass CustomHTMLElement extends HTMLElement {\n}\n\nclass InputStyleCloneUpdateEvent extends Event {\n constructor() {\n super(\"update\");\n }\n}\nconst CloneRegistry = new WeakMap();\n/**\n * Create an element that exactly matches an input pixel-for-pixel and automatically stays in sync with it. This\n * is a non-interactive overlay on to the input and can be used to affect the visual appearance of the input\n * without modifying its behavior. The clone element is hidden by default.\n *\n * This lower level API powers the `InputRange` but provides more advanced functionality including event updates.\n *\n * Emits `update` events whenever anything is recalculated: when the layout changes, when the user scrolls, when the\n * input is updated, etc. This event may be emitted more than once per change.\n *\n * @note There may be cases in which the clone cannot observe changes to the input and fails to automatically update.\n * For example, if the `value` property on the input is written to directly, no `input` event is emitted by the input\n * and the clone does not automatically update. In these cases, `forceUpdate` can be used to manually trigger an update.\n */\n// PRIOR ART: This approach was adapted from the following MIT-licensed sources:\n// - primer/react (Copyright (c) 2018 GitHub, Inc.): https://github.com/primer/react/blob/a0db832302702b869aa22b0c4049ad9305ef631f/src/drafts/utils/character-coordinates.ts\n// - component/textarea-caret-position (Copyright (c) 2015 Jonathan Ong me@jongleberry.com): https://github.com/component/textarea-caret-position/blob/b5db7a7e47dd149c2a66276183c69234e4dabe30/index.js\n// - koddsson/textarea-caret-position (Copyright (c) 2015 Jonathan Ong me@jongleberry.com): https://github.com/koddsson/textarea-caret-position/blob/eba40ec8488eed4d77815f109af22e1d9c0751d3/index.js\nclass InputStyleCloneElement extends CustomHTMLElement {\n #styleObserver = new MutationObserver(() => this.#updateStyles());\n #resizeObserver = new ResizeObserver(() => this.#requestUpdateLayout());\n // This class is unique in that it will prevent itself from getting garbage collected because of the subscribed\n // observers (if never detached). Because of this, we want to avoid preventing the existence of this class from also\n // preventing the garbage collection of the associated input. This also allows us to automatically detach if the\n // input gets collected.\n #inputRef;\n #container;\n /**\n * Get the clone for an input, reusing an existing one if available. This avoids creating unecessary clones, which\n * have a performance cost due to their high-frequency event-based updates. Because these elements are shared, they\n * should be mutated with caution.\n *\n * Upon initial creation the clone element will automatically be inserted into the DOM and begin observing the\n * linked input. Only one clone per input can ever exist at a time.\n * @param input The target input to clone.\n */\n static for(input) {\n let clone = CloneRegistry.get(input);\n if (!clone) {\n clone = new InputStyleCloneElement();\n clone.connect(input);\n CloneRegistry.set(input, clone);\n }\n return clone;\n }\n /**\n * Connect this instance to a target input element and insert this instance into the DOM in the correct location.\n *\n * NOTE: calling the static `for` method is nearly always preferable as it will reuse an existing clone if available.\n * However, if reusing clones is problematic (ie, if the clone needs to be mutated), a clone can be constructed\n * directly with `new InputStyleCloneElement()` and then bound to an input and inserted into the DOM with\n * `clone.connect(target)`.\n */\n connect(input) {\n this.#inputRef = new WeakRef(input);\n // We want position:absolute so it doesn't take space in the layout, but that doesn't work with display:table-cell\n // used in the HTMLInputElement approach. So we need a wrapper.\n this.#container = document.createElement(\"div\");\n this.#container.style.position = \"absolute\";\n this.#container.style.pointerEvents = \"none\";\n input.after(this.#container);\n this.#container.appendChild(this);\n }\n /**\n * Force a recalculation. Will emit an `update` event. This is typically not needed unless the input has changed in\n * an unobservable way, eg by directly writing to the `value` property.\n */\n forceUpdate() {\n this.#updateStyles();\n this.#updateText();\n }\n /** @private */\n connectedCallback() {\n this.#usingInput((input) => {\n this.style.pointerEvents = \"none\";\n this.style.userSelect = \"none\";\n this.style.overflow = \"hidden\";\n this.style.display = \"block\";\n // Important not to use display:none which would not render the content at all\n this.style.visibility = \"hidden\";\n if (input instanceof HTMLTextAreaElement) {\n this.style.whiteSpace = \"pre-wrap\";\n this.style.wordWrap = \"break-word\";\n }\n else {\n this.style.whiteSpace = \"nowrap\";\n // text in single-line inputs is vertically centered\n this.style.display = \"table-cell\";\n this.style.verticalAlign = \"middle\";\n }\n this.setAttribute(\"aria-hidden\", \"true\");\n this.#updateStyles();\n this.#updateText();\n this.#styleObserver.observe(input, {\n attributeFilter: [\n \"style\",\n \"dir\", // users can right-click in some browsers to change the text direction dynamically\n ],\n });\n this.#resizeObserver.observe(input);\n document.addEventListener(\"scroll\", this.#onDocumentScrollOrResize, { capture: true });\n window.addEventListener(\"resize\", this.#onDocumentScrollOrResize, { capture: true });\n // capture so this happens first, so other things can respond to `input` events after this data updates\n input.addEventListener(\"input\", this.#onInput, { capture: true });\n });\n }\n /** @private */\n disconnectedCallback() {\n this.#container?.remove();\n this.#styleObserver.disconnect();\n this.#resizeObserver.disconnect();\n document.removeEventListener(\"scroll\", this.#onDocumentScrollOrResize, { capture: true });\n window.removeEventListener(\"resize\", this.#onDocumentScrollOrResize, { capture: true });\n // Can't use `usingInput` here since that could infinitely recurse\n const input = this.#input;\n if (input) {\n input.removeEventListener(\"input\", this.#onInput, { capture: true });\n CloneRegistry.delete(input);\n }\n }\n // --- private ---\n get #input() {\n return this.#inputRef?.deref();\n }\n /** Perform `fn` using the `input` if it is still available. If not, clean up the clone instead. */\n #usingInput(fn) {\n const input = this.#input;\n if (!input)\n return this.remove();\n return fn(input);\n }\n /** Current relative x-adjustment in pixels, executed via CSS transform. */\n #xOffset = 0;\n /** Current relative y-adjustment in pixels, executed via CSS transform. */\n #yOffset = 0;\n /**\n * Update only geometric properties without recalculating styles. Typically call `#requestUpdateLayout` instead to\n * only update once per animation frame.\n */\n #updateLayout() {\n // This runs often, so keep it as fast as possible! Avoid all unecessary updates.\n this.#usingInput((input) => {\n const inputStyle = window.getComputedStyle(input);\n this.style.height = inputStyle.height;\n this.style.width = inputStyle.width;\n // Immediately re-adjust for browser inconsistencies in scrollbar handling, if necessary\n if (input.clientHeight !== this.clientHeight)\n this.style.height = `calc(${inputStyle.height} + ${input.clientHeight - this.clientHeight}px)`;\n if (input.clientWidth !== this.clientWidth)\n this.style.width = `calc(${inputStyle.width} + ${input.clientWidth - this.clientWidth}px)`;\n // Position on top of the input\n const inputRect = input.getBoundingClientRect();\n const cloneRect = this.getBoundingClientRect();\n this.#xOffset = this.#xOffset + inputRect.left - cloneRect.left;\n this.#yOffset = this.#yOffset + inputRect.top - cloneRect.top;\n this.style.transform = `translate(${this.#xOffset}px, ${this.#yOffset}px)`;\n this.scrollTop = input.scrollTop;\n this.scrollLeft = input.scrollLeft;\n this.dispatchEvent(new InputStyleCloneUpdateEvent());\n });\n }\n #isLayoutUpdating = false;\n /** Request a layout update. Will only happen once per animation frame, to avoid unecessary updates. */\n #requestUpdateLayout() {\n if (this.#isLayoutUpdating)\n return;\n this.#isLayoutUpdating = true;\n requestAnimationFrame(() => {\n this.#updateLayout();\n this.#isLayoutUpdating = false;\n });\n }\n /** Update the styles of the clone based on the styles of the input, then request a layout update. */\n #updateStyles() {\n this.#usingInput((input) => {\n const inputStyle = window.getComputedStyle(input);\n for (const prop of propertiesToCopy)\n this.style[prop] = inputStyle[prop];\n this.#requestUpdateLayout();\n });\n }\n /**\n * Update the text content of the clone based on the text content of the input. Triggers a layout update in case the\n * text update caused scrolling.\n */\n #updateText() {\n this.#usingInput((input) => {\n this.textContent = input.value;\n // This is often unecessary on a pure text update, but text updates could potentially cause layout updates like\n // scrolling or resizing. And we run the update on _every frame_ when scrolling, so this isn't that expensive.\n // We don't requestUpdateLayout here because this one should happen synchronously, so that clients can react\n // within their own `input` event handlers.\n this.#updateLayout();\n });\n }\n #onInput = () => this.#updateText();\n #onDocumentScrollOrResize = (event) => {\n this.#usingInput((input) => {\n if (event.target === document ||\n event.target === window ||\n (event.target instanceof Node && event.target.contains(input)))\n this.#requestUpdateLayout();\n });\n };\n}\n// Note that some browsers, such as Firefox, do not concatenate properties\n// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),\n// so we have to list every single property explicitly.\nconst propertiesToCopy = [\n // RTL / vertical writing modes support:\n \"direction\",\n \"writingMode\",\n \"unicodeBidi\",\n \"textOrientation\",\n \"boxSizing\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderStyle\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n \"fontStyle\",\n \"fontVariant\",\n \"fontWeight\",\n \"fontStretch\",\n \"fontSize\",\n \"fontSizeAdjust\",\n \"lineHeight\",\n \"fontFamily\",\n \"textAlign\",\n \"textTransform\",\n \"textIndent\",\n \"textDecoration\",\n \"letterSpacing\",\n \"wordSpacing\",\n \"tabSize\",\n \"MozTabSize\",\n];\n// Inspired by https://github.com/github/catalyst/blob/dc284dcf4f82329a9cac5c867462a8fa529b6c40/src/register.ts\ntry {\n customElements.define(\"input-style-clone\", InputStyleCloneElement);\n}\ncatch (e) {\n // Throws DOMException with NotSupportedError if already defined\n if (!(e instanceof DOMException && e.name === \"NotSupportedError\"))\n throw e;\n}\n\nclass InputRange {\n #inputElement;\n #startOffset;\n #endOffset;\n /**\n * Construct a new `InputRange`.\n * @param element The target input element that contains the content for the range.\n * @param startOffset The inclusive 0-based start index for the range. Will be adjusted to fit in the input contents.\n * @param endOffset The exclusive 0-based end index for the range. Will be adjusted to fit in the input contents.\n */\n constructor(element, startOffset = 0, endOffset = startOffset) {\n this.#inputElement = element;\n this.#startOffset = startOffset;\n this.#endOffset = endOffset;\n }\n /**\n * Create a new range from the current user selection. If the input is not focused, the range will just be the start\n * of the input (offsets `0` to `0`).\n *\n * This can be used to get the caret coordinates: if the resulting range is `collapsed`, the location of the\n * `getBoundingClientRect` will be the location of the caret caret (note, however, that the width will be `0` in\n * this case).\n */\n static fromSelection(input) {\n const { selectionStart, selectionEnd } = input;\n return new InputRange(input, selectionStart ?? undefined, selectionEnd ?? undefined);\n }\n /** Returns true if the start is equal to the end of this range. */\n get collapsed() {\n return this.startOffset === this.endOffset;\n }\n /** Always returns the containing input element. */\n get commonAncestorContainer() {\n return this.#inputElement;\n }\n /** Always returns the containing input element. */\n get endContainer() {\n return this.#inputElement;\n }\n /** Always returns the containing input element. */\n get startContainer() {\n return this.#inputElement;\n }\n get startOffset() {\n return this.#startOffset;\n }\n get endOffset() {\n return this.#endOffset;\n }\n /** Update the inclusive start offset. Will be adjusted to fit within the content size. */\n setStartOffset(offset) {\n this.#startOffset = this.#clampOffset(offset);\n }\n /** Update the exclusive end offset. Will be adjusted to fit within the content size. */\n setEndOffset(offset) {\n this.#endOffset = this.#clampOffset(offset);\n }\n /**\n * Collapse this range to one side.\n * @param toStart If `true`, will collapse to the start side. Otherwise, will collapse to the end.\n */\n collapse(toStart = false) {\n if (toStart)\n this.setEndOffset(this.startOffset);\n else\n this.setStartOffset(this.endOffset);\n }\n /** Returns a `DocumentFragment` containing a new `Text` node containing the content in the range. */\n cloneContents() {\n return this.#createCloneRange().cloneContents();\n }\n /** Create a copy of this range. */\n cloneRange() {\n return new InputRange(this.#inputElement, this.startOffset, this.endOffset);\n }\n /**\n * Obtain one rect that contains the entire contents of the range. If the range spans multiple lines, this box will\n * contain all pieces of the range but may also contain some space outside the range.\n * @see https://iansan5653.github.io/dom-input-range/demos/playground/\n */\n getBoundingClientRect() {\n return this.#createCloneRange().getBoundingClientRect();\n }\n /**\n * Obtain the rects that contain contents of this range. If the range spans multiple lines, there will be multiple\n * bounding boxes. These boxes can be used, for example, to draw a highlight over the range.\n * @see https://iansan5653.github.io/dom-input-range/demos/playground/\n */\n getClientRects() {\n return this.#createCloneRange().getClientRects();\n }\n /** Get the contents of the range as a string. */\n toString() {\n return this.#createCloneRange().toString();\n }\n /**\n * Get the underlying `InputStyleClone` instance powering these calculations. This can be used to listen for\n * updates to trigger layout recalculation.\n */\n getStyleClone() {\n return this.#styleClone;\n }\n // --- private ---\n get #styleClone() {\n return InputStyleCloneElement.for(this.#inputElement);\n }\n get #cloneElement() {\n return this.#styleClone;\n }\n #clampOffset(offset) {\n return Math.max(0, Math.min(offset, this.#inputElement.value.length));\n }\n #createCloneRange() {\n // It's tempting to create a single Range and reuse it across the lifetime of the class. However, this wouldn't be\n // accurate because the contents of the input can change and the contents of the range would become stale. So we\n // must create a new range every time we need it.\n const range = document.createRange();\n const textNode = this.#cloneElement.childNodes[0];\n if (textNode) {\n range.setStart(textNode, this.startOffset);\n range.setEnd(textNode, this.endOffset);\n }\n return range;\n }\n}\n\nconst states = new WeakMap();\nclass TextExpander {\n constructor(expander, input) {\n this.expander = expander;\n this.input = input;\n this.combobox = null;\n this.menu = null;\n this.match = null;\n this.justPasted = false;\n this.lookBackIndex = 0;\n this.oninput = this.onInput.bind(this);\n this.onpaste = this.onPaste.bind(this);\n this.onkeydown = this.onKeydown.bind(this);\n this.oncommit = this.onCommit.bind(this);\n this.onmousedown = this.onMousedown.bind(this);\n this.onblur = this.onBlur.bind(this);\n this.interactingWithList = false;\n input.addEventListener('paste', this.onpaste);\n input.addEventListener('input', this.oninput);\n input.addEventListener('keydown', this.onkeydown);\n input.addEventListener('blur', this.onblur);\n }\n destroy() {\n this.input.removeEventListener('paste', this.onpaste);\n this.input.removeEventListener('input', this.oninput);\n this.input.removeEventListener('keydown', this.onkeydown);\n this.input.removeEventListener('blur', this.onblur);\n }\n dismissMenu() {\n if (this.deactivate()) {\n this.lookBackIndex = this.input.selectionEnd || this.lookBackIndex;\n }\n }\n activate(match, menu) {\n var _a, _b;\n if (this.input !== document.activeElement && this.input !== ((_b = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement)) {\n return;\n }\n this.deactivate();\n this.menu = menu;\n if (!menu.id)\n menu.id = `text-expander-${Math.floor(Math.random() * 100000).toString()}`;\n this.expander.append(menu);\n this.combobox = new Combobox(this.input, menu);\n this.expander.dispatchEvent(new Event('text-expander-activate'));\n this.positionMenu(menu, match.position);\n this.combobox.start();\n menu.addEventListener('combobox-commit', this.oncommit);\n menu.addEventListener('mousedown', this.onmousedown);\n this.combobox.navigate(1);\n }\n positionMenu(menu, position) {\n const caretRect = new InputRange(this.input, position).getBoundingClientRect();\n const targetPosition = { left: caretRect.left, top: caretRect.top + caretRect.height };\n const currentPosition = menu.getBoundingClientRect();\n const delta = {\n left: targetPosition.left - currentPosition.left,\n top: targetPosition.top - currentPosition.top\n };\n if (delta.left !== 0 || delta.top !== 0) {\n const currentStyle = getComputedStyle(menu);\n menu.style.left = currentStyle.left ? `calc(${currentStyle.left} + ${delta.left}px)` : `${delta.left}px`;\n menu.style.top = currentStyle.top ? `calc(${currentStyle.top} + ${delta.top}px)` : `${delta.top}px`;\n }\n }\n deactivate() {\n const menu = this.menu;\n if (!menu || !this.combobox)\n return false;\n this.expander.dispatchEvent(new Event('text-expander-deactivate'));\n this.menu = null;\n menu.removeEventListener('combobox-commit', this.oncommit);\n menu.removeEventListener('mousedown', this.onmousedown);\n this.combobox.destroy();\n this.combobox = null;\n menu.remove();\n return true;\n }\n onCommit({ target }) {\n var _a;\n const item = target;\n if (!(item instanceof HTMLElement))\n return;\n if (!this.combobox)\n return;\n const match = this.match;\n if (!match)\n return;\n const beginning = this.input.value.substring(0, match.position - match.key.length);\n const remaining = this.input.value.substring(match.position + match.text.length);\n const detail = { item, key: match.key, value: null, continue: false };\n const canceled = !this.expander.dispatchEvent(new CustomEvent('text-expander-value', { cancelable: true, detail }));\n if (canceled)\n return;\n if (!detail.value)\n return;\n let suffix = (_a = this.expander.getAttribute('suffix')) !== null && _a !== void 0 ? _a : ' ';\n if (detail.continue) {\n suffix = '';\n }\n const value = `${detail.value}${suffix}`;\n this.input.value = beginning + value + remaining;\n const cursor = beginning.length + value.length;\n this.deactivate();\n this.input.focus({\n preventScroll: true\n });\n this.input.selectionStart = cursor;\n this.input.selectionEnd = cursor;\n if (!detail.continue) {\n this.lookBackIndex = cursor;\n this.match = null;\n }\n this.expander.dispatchEvent(new CustomEvent('text-expander-committed', { cancelable: false, detail: { input: this.input } }));\n }\n onBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.deactivate();\n }\n onPaste() {\n this.justPasted = true;\n }\n async onInput() {\n if (this.justPasted) {\n this.justPasted = false;\n return;\n }\n const match = this.findMatch();\n if (match) {\n this.match = match;\n const menu = await this.notifyProviders(match);\n if (!this.match)\n return;\n if (menu) {\n this.activate(match, menu);\n }\n else {\n this.deactivate();\n }\n }\n else {\n this.match = null;\n this.deactivate();\n }\n }\n findMatch() {\n const cursor = this.input.selectionEnd || 0;\n const text = this.input.value;\n if (cursor <= this.lookBackIndex) {\n this.lookBackIndex = cursor - 1;\n }\n for (const { key, multiWord } of this.expander.keys) {\n const found = query(text, key, cursor, {\n multiWord,\n lookBackIndex: this.lookBackIndex,\n lastMatchPosition: this.match ? this.match.position : null\n });\n if (found) {\n return { text: found.text, key, position: found.position };\n }\n }\n }\n async notifyProviders(match) {\n const providers = [];\n const provide = (result) => providers.push(result);\n const canceled = !this.expander.dispatchEvent(new CustomEvent('text-expander-change', { cancelable: true, detail: { provide, text: match.text, key: match.key } }));\n if (canceled)\n return;\n const all = await Promise.all(providers);\n const fragments = all.filter(x => x.matched).map(x => x.fragment);\n return fragments[0];\n }\n onMousedown() {\n this.interactingWithList = true;\n }\n onKeydown(event) {\n if (event.key === 'Escape') {\n this.match = null;\n if (this.deactivate()) {\n this.lookBackIndex = this.input.selectionEnd || this.lookBackIndex;\n event.stopImmediatePropagation();\n event.preventDefault();\n }\n }\n }\n}\nclass TextExpanderElement extends HTMLElement {\n get keys() {\n const keysAttr = this.getAttribute('keys');\n const keys = keysAttr ? keysAttr.split(' ') : [];\n const multiWordAttr = this.getAttribute('multiword');\n const multiWord = multiWordAttr ? multiWordAttr.split(' ') : [];\n const globalMultiWord = multiWord.length === 0 && this.hasAttribute('multiword');\n return keys.map(key => ({ key, multiWord: globalMultiWord || multiWord.includes(key) }));\n }\n set keys(value) {\n this.setAttribute('keys', value);\n }\n connectedCallback() {\n const input = this.querySelector('input[type=\"text\"], textarea');\n if (!(input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement))\n return;\n const state = new TextExpander(this, input);\n states.set(this, state);\n }\n disconnectedCallback() {\n const state = states.get(this);\n if (!state)\n return;\n state.destroy();\n states.delete(this);\n }\n dismiss() {\n const state = states.get(this);\n if (!state)\n return;\n state.dismissMenu();\n }\n}\n\nif (!window.customElements.get('text-expander')) {\n window.TextExpanderElement = TextExpanderElement;\n window.customElements.define('text-expander', TextExpanderElement);\n}\n\nexport { TextExpanderElement as default };\n","export default function ansiRegex({onlyFirst = false} = {}) {\n\tconst pattern = [\n\t '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))'\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n","import stripAnsi from 'strip-ansi';\n\nconst segmenter = new Intl.Segmenter();\n\nexport default function stringLength(string, {countAnsiEscapeCodes = false} = {}) {\n\tif (string === '') {\n\t\treturn 0;\n\t}\n\n\tif (!countAnsiEscapeCodes) {\n\t\tstring = stripAnsi(string);\n\t}\n\n\tif (string === '') {\n\t\treturn 0;\n\t}\n\n\tlet length = 0;\n\n\tfor (const _ of segmenter.segment(string)) { // eslint-disable-line no-unused-vars\n\t\tlength++;\n\t}\n\n\treturn length;\n}\n","export default \"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\"","import './compose.css';\nimport '@github/text-expander-element';\n\nimport { msg, plural, t, Trans } from '@lingui/macro';\nimport { useLingui } from '@lingui/react';\nimport { MenuItem } from '@szhsin/react-menu';\nimport { deepEqual } from 'fast-equals';\nimport Fuse from 'fuse.js';\nimport { forwardRef, memo } from 'preact/compat';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport { useHotkeys } from 'react-hotkeys-hook';\nimport stringLength from 'string-length';\n// import { detectAll } from 'tinyld/light';\nimport { uid } from 'uid/single';\nimport { useDebouncedCallback, useThrottledCallback } from 'use-debounce';\nimport useResizeObserver from 'use-resize-observer';\nimport { useSnapshot } from 'valtio';\n\nimport poweredByGiphyURL from '../assets/powered-by-giphy.svg';\n\nimport Menu2 from '../components/menu2';\nimport supportedLanguages from '../data/status-supported-languages';\nimport urlRegex from '../data/url-regex';\nimport { api } from '../utils/api';\nimport db from '../utils/db';\nimport emojifyText from '../utils/emojify-text';\nimport i18nDuration from '../utils/i18n-duration';\nimport isRTL from '../utils/is-rtl';\nimport localeMatch from '../utils/locale-match';\nimport localeCode2Text from '../utils/localeCode2Text';\nimport mem from '../utils/mem';\nimport openCompose from '../utils/open-compose';\nimport pmem from '../utils/pmem';\nimport prettyBytes from '../utils/pretty-bytes';\nimport { fetchRelationships } from '../utils/relationships';\nimport shortenNumber from '../utils/shorten-number';\nimport showToast from '../utils/show-toast';\nimport states, { saveStatus } from '../utils/states';\nimport store from '../utils/store';\nimport {\n getCurrentAccount,\n getCurrentAccountNS,\n getCurrentInstance,\n getCurrentInstanceConfiguration,\n} from '../utils/store-utils';\nimport supports from '../utils/supports';\nimport useCloseWatcher from '../utils/useCloseWatcher';\nimport useInterval from '../utils/useInterval';\nimport visibilityIconsMap from '../utils/visibility-icons-map';\n\nimport AccountBlock from './account-block';\n// import Avatar from './avatar';\nimport Icon from './icon';\nimport Loader from './loader';\nimport Modal from './modal';\nimport Status from './status';\n\nconst {\n PHANPY_IMG_ALT_API_URL: IMG_ALT_API_URL,\n PHANPY_GIPHY_API_KEY: GIPHY_API_KEY,\n} = import.meta.env;\n\nconst supportedLanguagesMap = supportedLanguages.reduce((acc, l) => {\n const [code, common, native] = l;\n acc[code] = {\n common,\n native,\n };\n return acc;\n}, {});\n\n/* NOTES:\n - Max character limit includes BOTH status text and Content Warning text\n*/\n\nconst expiryOptions = {\n 300: i18nDuration(5, 'minute'),\n 1_800: i18nDuration(30, 'minute'),\n 3_600: i18nDuration(1, 'hour'),\n 21_600: i18nDuration(6, 'hour'),\n 86_400: i18nDuration(1, 'day'),\n 259_200: i18nDuration(3, 'day'),\n 604_800: i18nDuration(1, 'week'),\n};\nconst expirySeconds = Object.keys(expiryOptions);\nconst oneDay = 24 * 60 * 60;\n\nconst expiresInFromExpiresAt = (expiresAt) => {\n if (!expiresAt) return oneDay;\n const delta = (new Date(expiresAt).getTime() - Date.now()) / 1000;\n return expirySeconds.find((s) => s >= delta) || oneDay;\n};\n\nconst menu = document.createElement('ul');\nmenu.role = 'listbox';\nmenu.className = 'text-expander-menu';\n\n// Set IntersectionObserver on menu, reposition it because text-expander doesn't handle it\nconst windowMargin = 16;\nconst observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n const { left, width } = entry.boundingClientRect;\n const { innerWidth } = window;\n if (left + width > innerWidth) {\n const insetInlineStart = isRTL() ? 'right' : 'left';\n menu.style[insetInlineStart] = innerWidth - width - windowMargin + 'px';\n }\n }\n });\n});\nobserver.observe(menu);\n\nconst DEFAULT_LANG = localeMatch(\n [new Intl.DateTimeFormat().resolvedOptions().locale, ...navigator.languages],\n supportedLanguages.map((l) => l[0]),\n 'en',\n);\n\n// https://github.com/mastodon/mastodon/blob/c4a429ed47e85a6bbf0d470a41cc2f64cf120c19/app/javascript/mastodon/features/compose/util/counter.js\nconst urlRegexObj = new RegExp(urlRegex.source, urlRegex.flags);\nconst usernameRegex = /(^|[^\\/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)/gi;\nconst urlPlaceholder = '$2xxxxxxxxxxxxxxxxxxxxxxx';\nfunction countableText(inputText) {\n return inputText\n .replace(urlRegexObj, urlPlaceholder)\n .replace(usernameRegex, '$1@$3');\n}\n\n// https://github.com/mastodon/mastodon/blob/c03bd2a238741a012aa4b98dc4902d6cf948ab63/app/models/account.rb#L69\nconst USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i;\nconst MENTION_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(@${USERNAME_RE.source}(?:@[\\\\p{L}\\\\w.-]+[\\\\w]+)?)`,\n 'uig',\n);\n\n// AI-generated, all other regexes are too complicated\nconst HASHTAG_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\\\/\\\\w])`,\n 'ig',\n);\n\n// https://github.com/mastodon/mastodon/blob/23e32a4b3031d1da8b911e0145d61b4dd47c4f96/app/models/custom_emoji.rb#L31\nconst SHORTCODE_RE_FRAGMENT = '[a-zA-Z0-9_]{2,}';\nconst SCAN_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(:${SHORTCODE_RE_FRAGMENT}:)(?=[^A-Za-z0-9_:]|$)`,\n 'g',\n);\n\nconst segmenter = new Intl.Segmenter();\nfunction escapeHTML(text) {\n return text\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\nfunction highlightText(text, { maxCharacters = Infinity }) {\n // Exceeded characters limit\n const { composerCharacterCount } = states;\n if (composerCharacterCount > maxCharacters) {\n // Highlight exceeded characters\n let withinLimitHTML = '',\n exceedLimitHTML = '';\n const htmlSegments = segmenter.segment(text);\n for (const { segment, index } of htmlSegments) {\n if (index < maxCharacters) {\n withinLimitHTML += segment;\n } else {\n exceedLimitHTML += segment;\n }\n }\n if (exceedLimitHTML) {\n exceedLimitHTML =\n '' +\n escapeHTML(exceedLimitHTML) +\n '';\n }\n return escapeHTML(withinLimitHTML) + exceedLimitHTML;\n }\n\n return escapeHTML(text)\n .replace(urlRegexObj, '$2$3') // URLs\n .replace(MENTION_RE, '$1$2') // Mentions\n .replace(HASHTAG_RE, '$1$2') // Hashtags\n .replace(\n SCAN_RE,\n '$1$2',\n ); // Emoji shortcodes\n}\n\n// const rtf = new Intl.RelativeTimeFormat();\nconst RTF = mem((locale) => new Intl.RelativeTimeFormat(locale || undefined));\nconst LF = mem((locale) => new Intl.ListFormat(locale || undefined));\n\nconst CUSTOM_EMOJIS_COUNT = 100;\n\nconst ADD_LABELS = {\n media: msg`Add media`,\n customEmoji: msg`Add custom emoji`,\n gif: msg`Add GIF`,\n poll: msg`Add poll`,\n};\n\nfunction Compose({\n onClose,\n replyToStatus,\n editStatus,\n draftStatus,\n standalone,\n hasOpener,\n}) {\n const { i18n, _ } = useLingui();\n const rtf = RTF(i18n.locale);\n const lf = LF(i18n.locale);\n\n console.warn('RENDER COMPOSER');\n const { masto, instance } = api();\n const [uiState, setUIState] = useState('default');\n const UID = useRef(draftStatus?.uid || uid());\n console.log('Compose UID', UID.current);\n\n const currentAccount = getCurrentAccount();\n const currentAccountInfo = currentAccount.info;\n\n const configuration = getCurrentInstanceConfiguration();\n console.log('⚙️ Configuration', configuration);\n\n const {\n statuses: {\n maxCharacters,\n maxMediaAttachments, // Beware: it can be undefined!\n charactersReservedPerUrl,\n } = {},\n mediaAttachments: {\n supportedMimeTypes,\n imageSizeLimit,\n imageMatrixLimit,\n videoSizeLimit,\n videoMatrixLimit,\n videoFrameRateLimit,\n } = {},\n polls: {\n maxOptions,\n maxCharactersPerOption,\n maxExpiration,\n minExpiration,\n } = {},\n } = configuration || {};\n\n const textareaRef = useRef();\n const spoilerTextRef = useRef();\n const [visibility, setVisibility] = useState('public');\n const [sensitive, setSensitive] = useState(false);\n const [language, setLanguage] = useState(\n store.session.get('currentLanguage') || DEFAULT_LANG,\n );\n const prevLanguage = useRef(language);\n const [mediaAttachments, setMediaAttachments] = useState([]);\n const [poll, setPoll] = useState(null);\n\n const prefs = store.account.get('preferences') || {};\n\n const oninputTextarea = () => {\n if (!textareaRef.current) return;\n textareaRef.current.dispatchEvent(new Event('input'));\n };\n const focusTextarea = () => {\n setTimeout(() => {\n if (!textareaRef.current) return;\n // status starts with newline, focus on first position\n if (draftStatus?.status?.startsWith?.('\\n')) {\n textareaRef.current.selectionStart = 0;\n textareaRef.current.selectionEnd = 0;\n }\n console.debug('FOCUS textarea');\n textareaRef.current?.focus();\n }, 300);\n };\n\n useEffect(() => {\n if (replyToStatus) {\n const { spoilerText, visibility, language, sensitive } = replyToStatus;\n if (spoilerText && spoilerTextRef.current) {\n spoilerTextRef.current.value = spoilerText;\n }\n const mentions = new Set([\n replyToStatus.account.acct,\n ...replyToStatus.mentions.map((m) => m.acct),\n ]);\n const allMentions = [...mentions].filter(\n (m) => m !== currentAccountInfo.acct,\n );\n if (allMentions.length > 0) {\n textareaRef.current.value = `${allMentions\n .map((m) => `@${m}`)\n .join(' ')} `;\n oninputTextarea();\n }\n focusTextarea();\n setVisibility(\n visibility === 'public' && prefs['posting:default:visibility']\n ? prefs['posting:default:visibility'].toLowerCase()\n : visibility,\n );\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n setSensitive(sensitive && !!spoilerText);\n } else if (editStatus) {\n const { visibility, language, sensitive, poll, mediaAttachments } =\n editStatus;\n const composablePoll = !!poll?.options && {\n ...poll,\n options: poll.options.map((o) => o?.title || o),\n expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),\n };\n setUIState('loading');\n (async () => {\n try {\n const statusSource = await masto.v1.statuses\n .$select(editStatus.id)\n .source.fetch();\n console.log({ statusSource });\n const { text, spoilerText } = statusSource;\n textareaRef.current.value = text;\n textareaRef.current.dataset.source = text;\n oninputTextarea();\n focusTextarea();\n spoilerTextRef.current.value = spoilerText;\n setVisibility(visibility);\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n setSensitive(sensitive);\n if (composablePoll) setPoll(composablePoll);\n setMediaAttachments(mediaAttachments);\n setUIState('default');\n } catch (e) {\n console.error(e);\n alert(e?.reason || e);\n setUIState('error');\n }\n })();\n } else {\n focusTextarea();\n console.log('Apply prefs', prefs);\n if (prefs['posting:default:visibility']) {\n setVisibility(prefs['posting:default:visibility'].toLowerCase());\n }\n if (prefs['posting:default:language']) {\n setLanguage(prefs['posting:default:language'].toLowerCase());\n }\n if (prefs['posting:default:sensitive']) {\n setSensitive(!!prefs['posting:default:sensitive']);\n }\n }\n if (draftStatus) {\n const {\n status,\n spoilerText,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n } = draftStatus;\n const composablePoll = !!poll?.options && {\n ...poll,\n options: poll.options.map((o) => o?.title || o),\n expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),\n };\n textareaRef.current.value = status;\n oninputTextarea();\n focusTextarea();\n if (spoilerText) spoilerTextRef.current.value = spoilerText;\n if (visibility) setVisibility(visibility);\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n if (sensitive !== null) setSensitive(sensitive);\n if (composablePoll) setPoll(composablePoll);\n if (mediaAttachments) setMediaAttachments(mediaAttachments);\n }\n }, [draftStatus, editStatus, replyToStatus]);\n\n const formRef = useRef();\n\n const beforeUnloadCopy = t`You have unsaved changes. Discard this post?`;\n const canClose = () => {\n const { value, dataset } = textareaRef.current;\n\n // check if loading\n if (uiState === 'loading') {\n console.log('canClose', { uiState });\n return false;\n }\n\n // check for status and media attachments\n const hasValue = (value || '')\n .trim()\n .replace(/^\\p{White_Space}+|\\p{White_Space}+$/gu, '');\n const hasMediaAttachments = mediaAttachments.length > 0;\n if (!hasValue && !hasMediaAttachments) {\n console.log('canClose', { value, mediaAttachments });\n return true;\n }\n\n // check if all media attachments have IDs\n const hasIDMediaAttachments =\n mediaAttachments.length > 0 &&\n mediaAttachments.every((media) => media.id);\n if (hasIDMediaAttachments) {\n console.log('canClose', { hasIDMediaAttachments });\n return true;\n }\n\n // check if status contains only \"@acct\", if replying\n const isSelf = replyToStatus?.account.id === currentAccountInfo.id;\n const hasOnlyAcct =\n replyToStatus && value.trim() === `@${replyToStatus.account.acct}`;\n // TODO: check for mentions, or maybe just generic \"@username\", including multiple mentions like \"@username1@username2\"\n if (!isSelf && hasOnlyAcct) {\n console.log('canClose', { isSelf, hasOnlyAcct });\n return true;\n }\n\n // check if status is same with source\n const sameWithSource = value === dataset?.source;\n if (sameWithSource) {\n console.log('canClose', { sameWithSource });\n return true;\n }\n\n console.log('canClose', {\n value,\n hasMediaAttachments,\n hasIDMediaAttachments,\n poll,\n isSelf,\n hasOnlyAcct,\n sameWithSource,\n uiState,\n });\n\n return false;\n };\n\n const confirmClose = () => {\n if (!canClose()) {\n const yes = confirm(beforeUnloadCopy);\n return yes;\n }\n return true;\n };\n\n useEffect(() => {\n // Show warning if user tries to close window with unsaved changes\n const handleBeforeUnload = (e) => {\n if (!canClose()) {\n e.preventDefault();\n e.returnValue = beforeUnloadCopy;\n }\n };\n window.addEventListener('beforeunload', handleBeforeUnload, {\n capture: true,\n });\n return () =>\n window.removeEventListener('beforeunload', handleBeforeUnload, {\n capture: true,\n });\n }, []);\n\n const getCharCount = () => {\n const { value } = textareaRef.current;\n const { value: spoilerText } = spoilerTextRef.current;\n return stringLength(countableText(value)) + stringLength(spoilerText);\n };\n const updateCharCount = () => {\n const count = getCharCount();\n states.composerCharacterCount = count;\n };\n useEffect(updateCharCount, []);\n\n const supportsCloseWatcher = window.CloseWatcher;\n const escDownRef = useRef(false);\n useHotkeys(\n 'esc',\n () => {\n escDownRef.current = true;\n // This won't be true if this event is already handled and not propagated 🤞\n },\n {\n enabled: !supportsCloseWatcher,\n enableOnFormTags: true,\n },\n );\n useHotkeys(\n 'esc',\n () => {\n if (!standalone && escDownRef.current && confirmClose()) {\n onClose();\n }\n escDownRef.current = false;\n },\n {\n enabled: !supportsCloseWatcher,\n enableOnFormTags: true,\n // Use keyup because Esc keydown will close the confirm dialog on Safari\n keyup: true,\n ignoreEventWhen: (e) => {\n const modals = document.querySelectorAll('#modal-container > *');\n const hasModal = !!modals;\n const hasOnlyComposer =\n modals.length === 1 && modals[0].querySelector('#compose-container');\n return hasModal && !hasOnlyComposer;\n },\n },\n );\n useCloseWatcher(() => {\n if (!standalone && confirmClose()) {\n onClose();\n }\n }, [standalone, confirmClose, onClose]);\n\n const prevBackgroundDraft = useRef({});\n const draftKey = () => {\n const ns = getCurrentAccountNS();\n return `${ns}#${UID.current}`;\n };\n const saveUnsavedDraft = () => {\n // Not enabling this for editing status\n // I don't think this warrant a draft mode for a status that's already posted\n // Maybe it could be a big edit change but it should be rare\n if (editStatus) return;\n if (states.composerState.minimized) return;\n const key = draftKey();\n const backgroundDraft = {\n key,\n replyTo: replyToStatus\n ? {\n /* Smaller payload of replyToStatus. Reasons:\n - No point storing whole thing\n - Could have media attachments\n - Could be deleted/edited later\n */\n id: replyToStatus.id,\n account: {\n id: replyToStatus.account.id,\n username: replyToStatus.account.username,\n acct: replyToStatus.account.acct,\n },\n }\n : null,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n };\n if (\n !deepEqual(backgroundDraft, prevBackgroundDraft.current) &&\n !canClose()\n ) {\n console.debug('not equal', backgroundDraft, prevBackgroundDraft.current);\n db.drafts\n .set(key, {\n ...backgroundDraft,\n state: 'unsaved',\n updatedAt: Date.now(),\n })\n .then(() => {\n console.debug('DRAFT saved', key, backgroundDraft);\n })\n .catch((e) => {\n console.error('DRAFT failed', key, e);\n });\n prevBackgroundDraft.current = structuredClone(backgroundDraft);\n }\n };\n useInterval(saveUnsavedDraft, 5000); // background save every 5s\n useEffect(() => {\n saveUnsavedDraft();\n // If unmounted, means user discarded the draft\n // Also means pop-out 🙈, but it's okay because the pop-out will persist the ID and re-create the draft\n return () => {\n db.drafts.del(draftKey());\n };\n }, []);\n\n useEffect(() => {\n const handleItems = (e) => {\n const { items } = e.clipboardData || e.dataTransfer;\n const files = [];\n const unsupportedFiles = [];\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.kind === 'file') {\n const file = item.getAsFile();\n if (\n supportedMimeTypes !== undefined &&\n !supportedMimeTypes.includes(file.type)\n ) {\n unsupportedFiles.push(file);\n } else {\n files.push(file);\n }\n }\n }\n if (unsupportedFiles.length > 0) {\n alert(\n plural(unsupportedFiles.length, {\n one: `File ${unsupportedFiles[0].name} is not supported.`,\n other: `Files ${lf.format(\n unsupportedFiles.map((f) => f.name),\n )} are not supported.`,\n }),\n );\n }\n if (files.length > 0 && mediaAttachments.length >= maxMediaAttachments) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n console.log({ files });\n if (files.length > 0) {\n e.preventDefault();\n e.stopPropagation();\n // Auto-cut-off files to avoid exceeding maxMediaAttachments\n let allowedFiles = files;\n if (maxMediaAttachments !== undefined) {\n const max = maxMediaAttachments - mediaAttachments.length;\n allowedFiles = allowedFiles.slice(0, max);\n if (allowedFiles.length <= 0) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n }\n const mediaFiles = allowedFiles.map((file) => ({\n file,\n type: file.type,\n size: file.size,\n url: URL.createObjectURL(file),\n id: null,\n description: null,\n }));\n setMediaAttachments([...mediaAttachments, ...mediaFiles]);\n }\n };\n window.addEventListener('paste', handleItems);\n const handleDragover = (e) => {\n // Prevent default if there's files\n if (e.dataTransfer.items.length > 0) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n window.addEventListener('dragover', handleDragover);\n window.addEventListener('drop', handleItems);\n return () => {\n window.removeEventListener('paste', handleItems);\n window.removeEventListener('dragover', handleDragover);\n window.removeEventListener('drop', handleItems);\n };\n }, [mediaAttachments]);\n\n const [showMentionPicker, setShowMentionPicker] = useState(false);\n const [showEmoji2Picker, setShowEmoji2Picker] = useState(false);\n const [showGIFPicker, setShowGIFPicker] = useState(false);\n\n const [autoDetectedLanguages, setAutoDetectedLanguages] = useState(null);\n const [topSupportedLanguages, restSupportedLanguages] = useMemo(() => {\n const topLanguages = [];\n const restLanguages = [];\n const { contentTranslationHideLanguages = [] } = states.settings;\n supportedLanguages.forEach((l) => {\n const [code] = l;\n if (\n code === language ||\n code === prevLanguage.current ||\n code === DEFAULT_LANG ||\n contentTranslationHideLanguages.includes(code) ||\n (autoDetectedLanguages?.length && autoDetectedLanguages.includes(code))\n ) {\n topLanguages.push(l);\n } else {\n restLanguages.push(l);\n }\n });\n topLanguages.sort(([codeA, commonA], [codeB, commonB]) => {\n if (codeA === language) return -1;\n if (codeB === language) return 1;\n return commonA.localeCompare(commonB);\n });\n restLanguages.sort(([codeA, commonA], [codeB, commonB]) =>\n commonA.localeCompare(commonB),\n );\n return [topLanguages, restLanguages];\n }, [language, autoDetectedLanguages]);\n\n const replyToStatusMonthsAgo = useMemo(\n () =>\n !!replyToStatus?.createdAt &&\n Math.floor(\n (Date.now() - new Date(replyToStatus.createdAt)) /\n (1000 * 60 * 60 * 24 * 30),\n ),\n [replyToStatus],\n );\n\n const onMinimize = () => {\n saveUnsavedDraft();\n states.composerState.minimized = true;\n };\n\n const gifPickerDisabled =\n uiState === 'loading' ||\n (maxMediaAttachments !== undefined &&\n mediaAttachments.length >= maxMediaAttachments) ||\n !!poll;\n\n // If maxOptions is not defined or defined and is greater than 1, show poll button\n const showPollButton = maxOptions == null || maxOptions > 1;\n const pollButtonDisabled =\n uiState === 'loading' || !!poll || !!mediaAttachments.length;\n const onPollButtonClick = () => {\n setPoll({\n options: ['', ''],\n expiresIn: 24 * 60 * 60, // 1 day\n multiple: false,\n });\n };\n\n const addSubToolbarRef = useRef();\n const [showAddButton, setShowAddButton] = useState(false);\n useResizeObserver({\n ref: addSubToolbarRef,\n box: 'border-box',\n onResize: ({ width }) => {\n // If scrollable, it's truncated\n const { scrollWidth } = addSubToolbarRef.current;\n const truncated = scrollWidth > width;\n const overTruncated = width < 84; // roughly two buttons width\n setShowAddButton(overTruncated || truncated);\n addSubToolbarRef.current.hidden = overTruncated;\n },\n });\n\n return (\n
    \n
    \n
    \n {currentAccountInfo?.avatarStatic && (\n // \n \n )}\n {!standalone ? (\n \n {\n // If there are non-ID media attachments (not yet uploaded), show confirmation dialog because they are not going to be passed to the new window\n // const containNonIDMediaAttachments =\n // mediaAttachments.length > 0 &&\n // mediaAttachments.some((media) => !media.id);\n // if (containNonIDMediaAttachments) {\n // const yes = confirm(\n // 'You have media attachments that are not yet uploaded. Opening a new window will discard them and you will need to re-attach them. Are you sure you want to continue?',\n // );\n // if (!yes) {\n // return;\n // }\n // }\n\n // const mediaAttachmentsWithIDs = mediaAttachments.filter(\n // (media) => media.id,\n // );\n\n const newWin = openCompose({\n editStatus,\n replyToStatus,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n });\n\n if (!newWin) {\n return;\n }\n\n onClose();\n }}\n >\n \n \n \n \n {' '}\n {\n if (confirmClose()) {\n onClose();\n }\n }}\n >\n \n \n \n ) : (\n hasOpener && (\n {\n // If there are non-ID media attachments (not yet uploaded), show confirmation dialog because they are not going to be passed to the new window\n // const containNonIDMediaAttachments =\n // mediaAttachments.length > 0 &&\n // mediaAttachments.some((media) => !media.id);\n // if (containNonIDMediaAttachments) {\n // const yes = confirm(\n // 'You have media attachments that are not yet uploaded. Opening a new window will discard them and you will need to re-attach them. Are you sure you want to continue?',\n // );\n // if (!yes) {\n // return;\n // }\n // }\n\n if (!window.opener) {\n alert(t`Looks like you closed the parent window.`);\n return;\n }\n\n if (window.opener.__STATES__.showCompose) {\n if (window.opener.__STATES__.composerState?.publishing) {\n alert(\n t`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.`,\n );\n return;\n }\n\n let confirmText = t`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?`;\n const yes = confirm(confirmText);\n if (!yes) return;\n }\n\n // const mediaAttachmentsWithIDs = mediaAttachments.filter(\n // (media) => media.id,\n // );\n\n onClose({\n fn: () => {\n const passData = {\n editStatus,\n replyToStatus,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n };\n window.opener.__COMPOSE__ = passData; // Pass it here instead of `showCompose` due to some weird proxy issue again\n if (window.opener.__STATES__.showCompose) {\n window.opener.__STATES__.showCompose = false;\n setTimeout(() => {\n window.opener.__STATES__.showCompose = true;\n }, 10);\n } else {\n window.opener.__STATES__.showCompose = true;\n }\n if (window.opener.__STATES__.composerState.minimized) {\n // Maximize it\n window.opener.__STATES__.composerState.minimized = false;\n }\n },\n });\n }}\n >\n \n \n )\n )}\n
    \n {!!replyToStatus && (\n
    \n \n
    \n {replyToStatusMonthsAgo > 0 ? (\n \n Replying to @\n {replyToStatus.account.acct || replyToStatus.account.username}\n ’s post (\n \n {rtf.format(-replyToStatusMonthsAgo, 'month')}\n \n )\n \n ) : (\n \n Replying to @\n {replyToStatus.account.acct || replyToStatus.account.username}\n ’s post\n \n )}\n
    \n
    \n )}\n {!!editStatus && (\n
    \n \n
    \n Editing source post\n
    \n
    \n )}\n {\n if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {\n formRef.current.dispatchEvent(\n new Event('submit', { cancelable: true }),\n );\n }\n }}\n onSubmit={(e) => {\n e.preventDefault();\n\n const formData = new FormData(e.target);\n const entries = Object.fromEntries(formData.entries());\n console.log('ENTRIES', entries);\n let { status, visibility, sensitive, spoilerText } = entries;\n\n // Pre-cleanup\n sensitive = sensitive === 'on'; // checkboxes return \"on\" if checked\n\n // Validation\n /* Let the backend validate this\n if (stringLength(status) > maxCharacters) {\n alert(`Status is too long! Max characters: ${maxCharacters}`);\n return;\n }\n if (\n sensitive &&\n stringLength(status) + stringLength(spoilerText) > maxCharacters\n ) {\n alert(\n `Status and content warning is too long! Max characters: ${maxCharacters}`,\n );\n return;\n }\n */\n if (poll) {\n if (poll.options.length < 2) {\n alert(t`Poll must have at least 2 options`);\n return;\n }\n if (poll.options.some((option) => option === '')) {\n alert(t`Some poll choices are empty`);\n return;\n }\n }\n // TODO: check for URLs and use `charactersReservedPerUrl` to calculate max characters\n\n if (mediaAttachments.length > 0) {\n // If there are media attachments, check if they have no descriptions\n const hasNoDescriptions = mediaAttachments.some(\n (media) => !media.description?.trim?.(),\n );\n if (hasNoDescriptions) {\n const yes = confirm(\n t`Some media have no descriptions. Continue?`,\n );\n if (!yes) return;\n }\n }\n\n // Post-cleanup\n spoilerText = (sensitive && spoilerText) || undefined;\n status = status === '' ? undefined : status;\n\n // states.composerState.minimized = true;\n states.composerState.publishing = true;\n setUIState('loading');\n (async () => {\n try {\n console.log('MEDIA ATTACHMENTS', mediaAttachments);\n if (mediaAttachments.length > 0) {\n // Upload media attachments first\n const mediaPromises = mediaAttachments.map((attachment) => {\n const { file, description, id } = attachment;\n console.log('UPLOADING', attachment);\n if (id) {\n // If already uploaded\n return attachment;\n } else {\n const params = removeNullUndefined({\n file,\n description,\n });\n return masto.v2.media.create(params).then((res) => {\n if (res.id) {\n attachment.id = res.id;\n }\n return res;\n });\n }\n });\n const results = await Promise.allSettled(mediaPromises);\n\n // If any failed, return\n if (\n results.some((result) => {\n return result.status === 'rejected' || !result.value?.id;\n })\n ) {\n states.composerState.publishing = false;\n states.composerState.publishingError = true;\n setUIState('error');\n // Alert all the reasons\n results.forEach((result) => {\n if (result.status === 'rejected') {\n console.error(result);\n alert(result.reason || t`Attachment #${i} failed`);\n }\n });\n return;\n }\n\n console.log({ results, mediaAttachments });\n }\n\n /* NOTE:\n Using snakecase here because masto.js's `isObject` returns false for `params`, ONLY happens when opening in pop-out window. This is maybe due to `window.masto` variable being passed from the parent window. The check that failed is `x.constructor === Object`, so maybe the `Object` in new window is different than parent window's?\n Code: https://github.com/neet/masto.js/blob/dd0d649067b6a2b6e60fbb0a96597c373a255b00/src/serializers/is-object.ts#L2\n\n // TODO: Note above is no longer true in Masto.js v6. Revisit this.\n */\n let params = {\n status,\n // spoilerText,\n spoiler_text: spoilerText,\n language,\n sensitive,\n poll,\n // mediaIds: mediaAttachments.map((attachment) => attachment.id),\n media_ids: mediaAttachments.map(\n (attachment) => attachment.id,\n ),\n };\n if (editStatus && supports('@mastodon/edit-media-attributes')) {\n params.media_attributes = mediaAttachments.map(\n (attachment) => {\n return {\n id: attachment.id,\n description: attachment.description,\n // focus\n // thumbnail\n };\n },\n );\n } else if (!editStatus) {\n params.visibility = visibility;\n // params.inReplyToId = replyToStatus?.id || undefined;\n params.in_reply_to_id = replyToStatus?.id || undefined;\n }\n params = removeNullUndefined(params);\n console.log('POST', params);\n\n let newStatus;\n if (editStatus) {\n newStatus = await masto.v1.statuses\n .$select(editStatus.id)\n .update(params);\n saveStatus(newStatus, instance, {\n skipThreading: true,\n });\n } else {\n try {\n newStatus = await masto.v1.statuses.create(params, {\n requestInit: {\n headers: {\n 'Idempotency-Key': UID.current,\n },\n },\n });\n } catch (_) {\n // If idempotency key fails, try again without it\n newStatus = await masto.v1.statuses.create(params);\n }\n }\n states.composerState.minimized = false;\n states.composerState.publishing = false;\n setUIState('default');\n\n // Close\n onClose({\n // type: post, reply, edit\n type: editStatus ? 'edit' : replyToStatus ? 'reply' : 'post',\n newStatus,\n instance,\n });\n } catch (e) {\n states.composerState.publishing = false;\n states.composerState.publishingError = true;\n console.error(e);\n alert(e?.reason || e);\n setUIState('error');\n }\n })();\n }}\n >\n
    \n {\n updateCharCount();\n }}\n />\n \n {\n const sensitive = e.target.checked;\n setSensitive(sensitive);\n if (sensitive) {\n spoilerTextRef.current?.focus();\n } else {\n textareaRef.current?.focus();\n }\n }}\n />\n \n {' '}\n \n \n {\n setVisibility(e.target.value);\n }}\n disabled={uiState === 'loading' || !!editStatus}\n dir=\"auto\"\n >\n \n {(supports('@pleroma/local-visibility-post') ||\n supports('@akkoma/local-visibility-post')) && (\n \n )}\n \n \n \n \n {' '}\n
    \n {\n updateCharCount();\n }}\n maxCharacters={maxCharacters}\n performSearch={(params) => {\n const { type, q, limit } = params;\n if (type === 'accounts') {\n return masto.v1.accounts.search.list({\n q,\n limit,\n resolve: false,\n });\n }\n return masto.v2.search.fetch(params);\n }}\n onTrigger={(action) => {\n if (action?.name === 'custom-emojis') {\n setShowEmoji2Picker({\n defaultSearchTerm: action?.defaultSearchTerm || null,\n });\n } else if (action?.name === 'mention') {\n setShowMentionPicker({\n defaultSearchTerm: action?.defaultSearchTerm || null,\n });\n } else if (\n action?.name === 'auto-detect-language' &&\n action?.languages\n ) {\n setAutoDetectedLanguages(action.languages);\n }\n }}\n />\n {mediaAttachments?.length > 0 && (\n
    \n {mediaAttachments.map((attachment, i) => {\n const { id, file } = attachment;\n const fileID = file?.size + file?.type + file?.name;\n return (\n {\n setMediaAttachments((attachments) => {\n const newAttachments = [...attachments];\n newAttachments[i] = {\n ...newAttachments[i],\n description: value,\n };\n return newAttachments;\n });\n }}\n onRemove={() => {\n setMediaAttachments((attachments) => {\n return attachments.filter((_, j) => j !== i);\n });\n }}\n />\n );\n })}\n \n
    \n )}\n {!!poll && (\n {\n if (poll) {\n const newPoll = { ...poll };\n setPoll(newPoll);\n } else {\n setPoll(null);\n }\n }}\n />\n )}\n
    \n \n {showAddButton && (\n (\n \n \n \n )}\n >\n \n \n {_(ADD_LABELS.media)}\n \n {\n setShowEmoji2Picker(true);\n }}\n >\n {' '}\n {_(ADD_LABELS.customEmoji)}\n \n {!!states.settings.composerGIFPicker && (\n {\n setShowGIFPicker(true);\n }}\n >\n \n {_(ADD_LABELS.gif)}\n \n )}\n \n {_(ADD_LABELS.poll)}\n \n \n )}\n \n \n {/* {\n setShowMentionPicker(true);\n }}\n >\n \n */}\n {\n setShowEmoji2Picker(true);\n }}\n >\n \n \n {!!states.settings.composerGIFPicker && (\n {\n setShowGIFPicker(true);\n }}\n >\n \n \n )}\n {}\n {showPollButton && (\n <>\n \n \n \n \n )}\n \n \n {/*
    */}\n {uiState === 'loading' ? (\n \n ) : (\n
    \n \n
    \n {showMentionPicker && (\n {\n if (e.target === e.currentTarget) {\n setShowMentionPicker(false);\n }\n }}\n >\n {\n setShowMentionPicker(false);\n }}\n defaultSearchTerm={showMentionPicker?.defaultSearchTerm}\n onSelect={(socialAddress) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n const { selectionStart, selectionEnd } = textarea;\n const text = textarea.value;\n const textBeforeMention = text.slice(0, selectionStart);\n const spaceBeforeMention = textBeforeMention\n ? /[\\s\\t\\n\\r]$/.test(textBeforeMention)\n ? ''\n : ' '\n : '';\n const textAfterMention = text.slice(selectionEnd);\n const spaceAfterMention = /^[\\s\\t\\n\\r]/.test(textAfterMention)\n ? ''\n : ' ';\n const newText =\n textBeforeMention +\n spaceBeforeMention +\n '@' +\n socialAddress +\n spaceAfterMention +\n textAfterMention;\n textarea.value = newText;\n textarea.selectionStart = textarea.selectionEnd =\n selectionEnd +\n 1 +\n socialAddress.length +\n spaceAfterMention.length;\n textarea.focus();\n textarea.dispatchEvent(new Event('input'));\n }}\n />\n \n )}\n {showEmoji2Picker && (\n {\n if (e.target === e.currentTarget) {\n setShowEmoji2Picker(false);\n }\n }}\n >\n {\n setShowEmoji2Picker(false);\n }}\n defaultSearchTerm={showEmoji2Picker?.defaultSearchTerm}\n onSelect={(emojiShortcode) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n const { selectionStart, selectionEnd } = textarea;\n const text = textarea.value;\n const textBeforeEmoji = text.slice(0, selectionStart);\n const spaceBeforeEmoji = textBeforeEmoji\n ? /[\\s\\t\\n\\r]$/.test(textBeforeEmoji)\n ? ''\n : ' '\n : '';\n const textAfterEmoji = text.slice(selectionEnd);\n const spaceAfterEmoji = /^[\\s\\t\\n\\r]/.test(textAfterEmoji)\n ? ''\n : ' ';\n const newText =\n textBeforeEmoji +\n spaceBeforeEmoji +\n emojiShortcode +\n spaceAfterEmoji +\n textAfterEmoji;\n textarea.value = newText;\n textarea.selectionStart = textarea.selectionEnd =\n selectionEnd + emojiShortcode.length + spaceAfterEmoji.length;\n textarea.focus();\n textarea.dispatchEvent(new Event('input'));\n }}\n />\n \n )}\n {showGIFPicker && (\n {\n if (e.target === e.currentTarget) {\n setShowGIFPicker(false);\n }\n }}\n >\n setShowGIFPicker(false)}\n onSelect={({ url, type, alt_text }) => {\n console.log('GIF URL', url);\n if (mediaAttachments.length >= maxMediaAttachments) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n // Download the GIF and insert it as media attachment\n (async () => {\n let theToast;\n try {\n theToast = showToast({\n text: t`Downloading GIF…`,\n duration: -1,\n });\n const blob = await fetch(url, {\n referrerPolicy: 'no-referrer',\n }).then((res) => res.blob());\n const file = new File(\n [blob],\n type === 'video/mp4' ? 'video.mp4' : 'image.gif',\n {\n type,\n },\n );\n const newMediaAttachments = [\n ...mediaAttachments,\n {\n file,\n type,\n size: file.size,\n id: null,\n description: alt_text || '',\n },\n ];\n setMediaAttachments(newMediaAttachments);\n theToast?.hideToast?.();\n } catch (err) {\n console.error(err);\n theToast?.hideToast?.();\n showToast(t`Failed to download GIF`);\n }\n })();\n }}\n />\n \n )}\n
    \n );\n}\n\nfunction FilePickerInput({\n hidden,\n supportedMimeTypes,\n maxMediaAttachments,\n mediaAttachments,\n disabled = false,\n setMediaAttachments,\n}) {\n return (\n
    \n {showModal && (\n {\n setShowModal(false);\n }}\n >\n
    \n {\n setShowModal(false);\n }}\n >\n \n \n
    \n

    \n {\n {\n image: t`Edit image description`,\n video: t`Edit video description`,\n audio: t`Edit audio description`,\n }[suffixType]\n }\n

    \n
    \n
    \n
    \n {suffixType === 'image' ? (\n \"\"\n ) : suffixType === 'video' || suffixType === 'gifv' ? (\n
    \n
    \n {descTextarea}\n
    \n {suffixType === 'image' &&\n /^(png|jpe?g|gif|webp)$/i.test(subtype) &&\n !!states.settings.mediaAltGenerator &&\n !!IMG_ALT_API_URL && (\n \n \n \n }\n >\n {\n setUIState('loading');\n toastRef.current = showToast({\n text: t`Generating description. Please wait…`,\n duration: -1,\n });\n // POST with multipart\n (async function () {\n try {\n const body = new FormData();\n body.append('image', file);\n const response = await fetch(IMG_ALT_API_URL, {\n method: 'POST',\n body,\n }).then((r) => r.json());\n if (response.error) {\n throw new Error(response.error);\n }\n setDescription(response.description);\n } catch (e) {\n console.error(e);\n showToast(\n e.message\n ? t`Failed to generate description: ${e.message}`\n : t`Failed to generate description`,\n );\n } finally {\n setUIState('default');\n toastRef.current?.hideToast?.();\n }\n })();\n }}\n >\n \n {lang && lang !== 'en' ? (\n \n Generate description…\n
    \n (English)\n
    \n ) : (\n \n Generate description…\n \n )}\n \n {!!lang && lang !== 'en' && (\n {\n setUIState('loading');\n toastRef.current = showToast({\n text: t`Generating description. Please wait…`,\n duration: -1,\n });\n // POST with multipart\n (async function () {\n try {\n const body = new FormData();\n body.append('image', file);\n const params = `?lang=${lang}`;\n const response = await fetch(\n IMG_ALT_API_URL + params,\n {\n method: 'POST',\n body,\n },\n ).then((r) => r.json());\n if (response.error) {\n throw new Error(response.error);\n }\n setDescription(response.description);\n } catch (e) {\n console.error(e);\n showToast(\n t`Failed to generate description${\n e?.message ? `: ${e.message}` : ''\n }`,\n );\n } finally {\n setUIState('default');\n toastRef.current?.hideToast?.();\n }\n })();\n }}\n >\n \n \n Generate description…\n
    \n \n ({localeCode2Text(lang)}){' '}\n \n — experimental\n \n \n
    \n \n )}\n \n )}\n {\n setShowModal(false);\n }}\n disabled={uiState === 'loading'}\n >\n Done\n \n
    \n
    \n
    \n
    \n \n )}\n \n );\n}\n\nfunction Poll({\n lang,\n poll,\n disabled,\n onInput = () => {},\n maxOptions,\n maxExpiration,\n minExpiration,\n maxCharactersPerOption,\n}) {\n const { _ } = useLingui();\n const { options, expiresIn, multiple } = poll;\n\n return (\n
    \n
    \n {options.map((option, i) => (\n
    \n {\n const { value } = e.target;\n options[i] = value;\n onInput(poll);\n }}\n />\n {\n options.splice(i, 1);\n onInput(poll);\n }}\n >\n \n \n
    \n ))}\n
    \n
    \n = maxOptions}\n onClick={() => {\n options.push('');\n onInput(poll);\n }}\n >\n +\n {' '}\n \n \n
    \n
    \n {\n onInput(null);\n }}\n >\n Remove poll\n \n
    \n
    \n );\n}\n\nfunction filterShortcodes(emojis, searchTerm) {\n searchTerm = searchTerm.toLowerCase();\n\n // Return an array of shortcodes that start with or contain the search term, sorted by relevance and limited to the first 5\n return emojis\n .sort((a, b) => {\n let aLower = a.shortcode.toLowerCase();\n let bLower = b.shortcode.toLowerCase();\n\n let aStartsWith = aLower.startsWith(searchTerm);\n let bStartsWith = bLower.startsWith(searchTerm);\n let aContains = aLower.includes(searchTerm);\n let bContains = bLower.includes(searchTerm);\n let bothStartWith = aStartsWith && bStartsWith;\n let bothContain = aContains && bContains;\n\n return bothStartWith\n ? a.length - b.length\n : aStartsWith\n ? -1\n : bStartsWith\n ? 1\n : bothContain\n ? a.length - b.length\n : aContains\n ? -1\n : bContains\n ? 1\n : 0;\n })\n .slice(0, 5);\n}\n\nfunction encodeHTML(str) {\n return str.replace(/[&<>\"']/g, function (char) {\n return '&#' + char.charCodeAt(0) + ';';\n });\n}\n\nfunction removeNullUndefined(obj) {\n for (let key in obj) {\n if (obj[key] === null || obj[key] === undefined) {\n delete obj[key];\n }\n }\n return obj;\n}\n\nfunction MentionModal({\n onClose = () => {},\n onSelect = () => {},\n defaultSearchTerm,\n}) {\n const { masto } = api();\n const [uiState, setUIState] = useState('default');\n const [accounts, setAccounts] = useState([]);\n const [relationshipsMap, setRelationshipsMap] = useState({});\n\n const [selectedIndex, setSelectedIndex] = useState(0);\n\n const loadRelationships = async (accounts) => {\n if (!accounts?.length) return;\n const relationships = await fetchRelationships(accounts, relationshipsMap);\n if (relationships) {\n setRelationshipsMap({\n ...relationshipsMap,\n ...relationships,\n });\n }\n };\n\n const loadAccounts = (term) => {\n if (!term) return;\n setUIState('loading');\n (async () => {\n try {\n const accounts = await masto.v1.accounts.search.list({\n q: term,\n limit: 40,\n resolve: false,\n });\n setAccounts(accounts);\n loadRelationships(accounts);\n setUIState('default');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n };\n\n const debouncedLoadAccounts = useDebouncedCallback(loadAccounts, 1000);\n\n useEffect(() => {\n loadAccounts();\n }, [loadAccounts]);\n\n const inputRef = useRef();\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n // Put cursor at the end\n if (inputRef.current.value) {\n inputRef.current.selectionStart = inputRef.current.value.length;\n inputRef.current.selectionEnd = inputRef.current.value.length;\n }\n }\n }, []);\n\n useEffect(() => {\n if (defaultSearchTerm) {\n loadAccounts(defaultSearchTerm);\n }\n }, [defaultSearchTerm]);\n\n const selectAccount = (account) => {\n const socialAddress = account.acct;\n onSelect(socialAddress);\n onClose();\n };\n\n useHotkeys(\n 'enter',\n () => {\n const selectedAccount = accounts[selectedIndex];\n if (selectedAccount) {\n selectAccount(selectedAccount);\n }\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n const listRef = useRef();\n useHotkeys(\n 'down',\n () => {\n if (selectedIndex < accounts.length - 1) {\n setSelectedIndex(selectedIndex + 1);\n } else {\n setSelectedIndex(0);\n }\n setTimeout(() => {\n const selectedItem = listRef.current.querySelector('.selected');\n if (selectedItem) {\n selectedItem.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, 1);\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n useHotkeys(\n 'up',\n () => {\n if (selectedIndex > 0) {\n setSelectedIndex(selectedIndex - 1);\n } else {\n setSelectedIndex(accounts.length - 1);\n }\n setTimeout(() => {\n const selectedItem = listRef.current.querySelector('.selected');\n if (selectedItem) {\n selectedItem.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, 1);\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n {\n e.preventDefault();\n debouncedLoadAccounts.flush?.();\n // const searchTerm = inputRef.current.value;\n // debouncedLoadAccounts(searchTerm);\n }}\n >\n {\n const { value } = e.target;\n debouncedLoadAccounts(value);\n }}\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellCheck=\"false\"\n dir=\"auto\"\n defaultValue={defaultSearchTerm || ''}\n />\n \n
    \n
    \n {accounts?.length > 0 ? (\n \n {accounts.map((account, i) => {\n const relationship = relationshipsMap[account.id];\n return (\n \n \n {\n selectAccount(account);\n }}\n >\n \n \n \n );\n })}\n \n ) : uiState === 'loading' ? (\n
    \n \n
    \n ) : uiState === 'error' ? (\n
    \n

    \n Error loading accounts\n

    \n
    \n ) : null}\n
    \n
    \n );\n}\n\nfunction CustomEmojisModal({\n masto,\n instance,\n onClose = () => {},\n onSelect = () => {},\n defaultSearchTerm,\n}) {\n const [uiState, setUIState] = useState('default');\n const customEmojisList = useRef([]);\n const [customEmojis, setCustomEmojis] = useState([]);\n const recentlyUsedCustomEmojis = useMemo(\n () => store.account.get('recentlyUsedCustomEmojis') || [],\n );\n const searcherRef = useRef();\n useEffect(() => {\n setUIState('loading');\n (async () => {\n try {\n const [emojis, searcher] = await getCustomEmojis(instance, masto);\n console.log('emojis', emojis);\n searcherRef.current = searcher;\n setCustomEmojis(emojis);\n setUIState('default');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n }, []);\n\n const customEmojisCatList = useMemo(() => {\n // Group emojis by category\n const emojisCat = {\n '--recent--': recentlyUsedCustomEmojis.filter((emoji) =>\n customEmojis.find((e) => e.shortcode === emoji.shortcode),\n ),\n };\n const othersCat = [];\n customEmojis.forEach((emoji) => {\n customEmojisList.current?.push?.(emoji);\n if (!emoji.category) {\n othersCat.push(emoji);\n return;\n }\n if (!emojisCat[emoji.category]) {\n emojisCat[emoji.category] = [];\n }\n emojisCat[emoji.category].push(emoji);\n });\n if (othersCat.length) {\n emojisCat['--others--'] = othersCat;\n }\n return emojisCat;\n }, [customEmojis]);\n\n const scrollableRef = useRef();\n const [matches, setMatches] = useState(null);\n const onFind = useCallback(\n (e) => {\n const { value } = e.target;\n if (value) {\n const results = searcherRef.current?.search(value, {\n limit: CUSTOM_EMOJIS_COUNT,\n });\n setMatches(results.map((r) => r.item));\n scrollableRef.current?.scrollTo?.(0, 0);\n } else {\n setMatches(null);\n }\n },\n [customEmojis],\n );\n useEffect(() => {\n if (defaultSearchTerm && customEmojis?.length) {\n onFind({ target: { value: defaultSearchTerm } });\n }\n }, [defaultSearchTerm, onFind, customEmojis]);\n\n const onSelectEmoji = useCallback(\n (emoji) => {\n onSelect?.(emoji);\n onClose?.();\n\n queueMicrotask(() => {\n let recentlyUsedCustomEmojis =\n store.account.get('recentlyUsedCustomEmojis') || [];\n const recentlyUsedEmojiIndex = recentlyUsedCustomEmojis.findIndex(\n (e) => e.shortcode === emoji.shortcode,\n );\n if (recentlyUsedEmojiIndex !== -1) {\n // Move emoji to index 0\n recentlyUsedCustomEmojis.splice(recentlyUsedEmojiIndex, 1);\n recentlyUsedCustomEmojis.unshift(emoji);\n } else {\n recentlyUsedCustomEmojis.unshift(emoji);\n // Remove unavailable ones\n recentlyUsedCustomEmojis = recentlyUsedCustomEmojis.filter((e) =>\n customEmojisList.current?.find?.(\n (emoji) => emoji.shortcode === e.shortcode,\n ),\n );\n // Limit to 10\n recentlyUsedCustomEmojis = recentlyUsedCustomEmojis.slice(0, 10);\n }\n\n // Store back\n store.account.set('recentlyUsedCustomEmojis', recentlyUsedCustomEmojis);\n });\n },\n [onSelect],\n );\n\n const inputRef = useRef();\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n // Put cursor at the end\n if (inputRef.current.value) {\n inputRef.current.selectionStart = inputRef.current.value.length;\n inputRef.current.selectionEnd = inputRef.current.value.length;\n }\n }\n }, []);\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n
    \n \n Custom emojis\n {' '}\n {uiState === 'loading' ? (\n \n ) : (\n • {instance}\n )}\n
    \n {\n e.preventDefault();\n const emoji = matches[0];\n if (emoji) {\n onSelectEmoji(`:${emoji.shortcode}:`);\n }\n }}\n >\n \n \n
    \n
    \n {matches !== null ? (\n
      \n {matches.map((emoji) => (\n
    • \n {\n onSelectEmoji(`:${emoji.shortcode}:`);\n }}\n showCode\n />\n
    • \n ))}\n
    \n ) : (\n
    \n {uiState === 'error' && (\n
    \n

    \n Error loading custom emojis\n

    \n
    \n )}\n {uiState === 'default' &&\n Object.entries(customEmojisCatList).map(\n ([category, emojis]) =>\n !!emojis?.length && (\n
    \n
    \n {{\n '--recent--': t`Recently used`,\n '--others--': t`Others`,\n }[category] || category}\n
    \n \n
    \n ),\n )}\n
    \n )}\n
    \n
    \n );\n}\n\nconst CustomEmojisList = memo(({ emojis, onSelect }) => {\n const { i18n } = useLingui();\n const [max, setMax] = useState(CUSTOM_EMOJIS_COUNT);\n const showMore = emojis.length > max;\n return (\n
    \n {emojis.slice(0, max).map((emoji) => (\n {\n onSelect(`:${emoji.shortcode}:`);\n }}\n />\n ))}\n {showMore && (\n setMax(max + CUSTOM_EMOJIS_COUNT)}\n >\n {i18n.number(emojis.length - max)} more…\n \n )}\n
    \n );\n});\n\nconst CustomEmojiButton = memo(({ emoji, onClick, showCode }) => {\n const addEdges = (e) => {\n // Add edge-left or edge-right class based on self position relative to scrollable parent\n // If near left edge, add edge-left, if near right edge, add edge-right\n const buffer = 88;\n const parent = e.currentTarget.closest('main');\n if (parent) {\n const rect = parent.getBoundingClientRect();\n const selfRect = e.currentTarget.getBoundingClientRect();\n const targetClassList = e.currentTarget.classList;\n if (selfRect.left < rect.left + buffer) {\n targetClassList.add('edge-left');\n targetClassList.remove('edge-right');\n } else if (selfRect.right > rect.right - buffer) {\n targetClassList.add('edge-right');\n targetClassList.remove('edge-left');\n } else {\n targetClassList.remove('edge-left', 'edge-right');\n }\n }\n };\n\n return (\n \n \n {!!emoji.staticUrl && (\n \n )}\n \n \n {showCode && (\n <>\n {' '}\n {emoji.shortcode}\n \n )}\n \n );\n});\n\nconst GIFS_PER_PAGE = 20;\nfunction GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {\n const { i18n } = useLingui();\n const [uiState, setUIState] = useState('default');\n const [results, setResults] = useState([]);\n const formRef = useRef(null);\n const qRef = useRef(null);\n const currentOffset = useRef(0);\n const scrollableRef = useRef(null);\n\n function fetchGIFs({ offset }) {\n console.log('fetchGIFs', { offset });\n if (!qRef.current?.value) return;\n setUIState('loading');\n scrollableRef.current?.scrollTo?.({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n (async () => {\n try {\n const query = {\n api_key: GIPHY_API_KEY,\n q: qRef.current.value,\n rating: 'g',\n limit: GIFS_PER_PAGE,\n bundle: 'messaging_non_clips',\n offset,\n lang: i18n.locale || 'en',\n };\n const response = await fetch(\n 'https://api.giphy.com/v1/gifs/search?' + new URLSearchParams(query),\n {\n referrerPolicy: 'no-referrer',\n },\n ).then((r) => r.json());\n currentOffset.current = response.pagination?.offset || 0;\n setResults(response);\n setUIState('results');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n }\n\n useEffect(() => {\n qRef.current?.focus();\n }, []);\n\n const debouncedOnInput = useDebouncedCallback(() => {\n fetchGIFs({ offset: 0 });\n }, 1000);\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n {\n e.preventDefault();\n fetchGIFs({ offset: 0 });\n }}\n >\n \n \n \n
    \n
    \n {uiState === 'default' && (\n
    \n

    \n Type to search GIFs\n

    \n
    \n )}\n {uiState === 'loading' && !results?.data?.length && (\n
    \n \n
    \n )}\n {results?.data?.length > 0 ? (\n <>\n
      \n {results.data.map((gif) => {\n const { id, images, title, alt_text } = gif;\n const {\n fixed_height_small,\n fixed_height_downsampled,\n fixed_height,\n original,\n } = images;\n const theImage = fixed_height_small?.url\n ? fixed_height_small\n : fixed_height_downsampled?.url\n ? fixed_height_downsampled\n : fixed_height;\n let { url, webp, width, height } = theImage;\n if (+height > 100) {\n width = (width / height) * 100;\n height = 100;\n }\n const urlObj = URL.parse(url);\n const strippedURL = urlObj.origin + urlObj.pathname;\n let strippedWebP;\n if (webp) {\n const webpObj = URL.parse(webp);\n strippedWebP = webpObj.origin + webpObj.pathname;\n }\n return (\n
    • \n {\n const { mp4, url } = original;\n const theURL = mp4 || url;\n const urlObj = URL.parse(theURL);\n const strippedURL = urlObj.origin + urlObj.pathname;\n onClose();\n onSelect({\n url: strippedURL,\n type: mp4 ? 'video/mp4' : 'image/gif',\n alt_text: alt_text || title,\n });\n }}\n >\n \n \n {strippedWebP && (\n \n )}\n {\n e.target.style.backgroundColor = 'transparent';\n }}\n />\n \n
      {alt_text || title}
      \n \n \n
    • \n );\n })}\n
    \n

    \n {results.pagination?.offset > 0 && (\n {\n fetchGIFs({\n offset: results.pagination?.offset - GIFS_PER_PAGE,\n });\n }}\n >\n \n \n Previous\n \n \n )}\n \n {results.pagination?.offset + results.pagination?.count <\n results.pagination?.total_count && (\n {\n fetchGIFs({\n offset: results.pagination?.offset + GIFS_PER_PAGE,\n });\n }}\n >\n \n Next\n {' '}\n \n \n )}\n

    \n \n ) : (\n uiState === 'results' && (\n
    \n

    No results

    \n
    \n )\n )}\n {uiState === 'error' && (\n
    \n

    \n Error loading GIFs\n

    \n
    \n )}\n
    \n
    \n );\n}\n\nexport default Compose;\n"],"file":"assets/compose-_xw4e_c5.js"} \ No newline at end of file diff --git a/assets/fuse-3cGZwVM1.js b/assets/fuse-3cGZwVM1.js new file mode 100644 index 0000000..01030d2 --- /dev/null +++ b/assets/fuse-3cGZwVM1.js @@ -0,0 +1,189 @@ +import{ad as lt,Q as ze,c as r,h as Z,t as Me,A as $,_ as Pt,y as ee,ae as Sa,E as vr,i as k,af as I,ag as Ia,d as Yo,ah as io,ai as Aa,l as ae,P as vt,p as Wi,aj as Ca,ak as Ki,O as Zi,f as F,C as Jt,V as Oe,q as Pa,s as B,al as La,j as po,a as so,z as bn,B as Ma,am as Ra,T as O,an as Gi,ao as Oa,ap as qi,r as mo,w as Yi,g as _r,aq as Da,ar as Ne,as as $a,at as Na,au as Un,J as it,u as In,b as ft,W as Xi,av as Fa,aw as za,ax as Va}from"./useTitle-6CgMxXiB.js";function Xo(){return Xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var qa=function(t,n,o){o===void 0&&(o=!1);var i=n.alt,s=n.meta,a=n.mod,c=n.shift,l=n.ctrl,d=n.keys,f=t.key,u=t.code,p=t.ctrlKey,h=t.metaKey,m=t.shiftKey,g=t.altKey,v=pt(u),T=f.toLowerCase();if(!(d!=null&&d.includes(v))&&!(d!=null&&d.includes(T))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(v))return!1;if(!o){if(i===!g&&T!=="alt"||c===!m&&T!=="shift")return!1;if(a){if(!h&&!p)return!1}else if(s===!h&&T!=="meta"&&T!=="os"||l===!p&&T!=="ctrl"&&T!=="control")return!1}return d&&d.length===1&&(d.includes(T)||d.includes(v))?!0:d?Ua(d):!d},Ya=lt(void 0),Xa=function(){return ze(Ya)};function ns(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,o){return n&&ns(e[o],t[o])},!0):e===t}var Qa=lt({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Ja=function(){return ze(Qa)};function ec(e){var t=$(void 0);return ns(t.current,e)||(t.current=e),t.current}var ei=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},tc=typeof window<"u"?Pt:ee;function Ut(e,t,n,o){var i=Z(null),s=i[0],a=i[1],c=$(!1),l=n instanceof Array?o instanceof Array?void 0:o:n,d=yr(e)?e.join(l==null?void 0:l.splitKey):e,f=n instanceof Array?n:o instanceof Array?o:void 0,u=Me(t,f??[]),p=$(u);f?p.current=u:p.current=t;var h=ec(l),m=Ja(),g=m.enabledScopes,v=Xa();return tc(function(){if(!((h==null?void 0:h.enabled)===!1||!Ga(g,h==null?void 0:h.scopes))){var T=function(b,S){var D;if(S===void 0&&(S=!1),!(Ka(b)&&!ts(b,h==null?void 0:h.enableOnFormTags))){if(s!==null){var L=s.getRootNode();if((L instanceof Document||L instanceof ShadowRoot)&&L.activeElement!==s&&!s.contains(L.activeElement)){ei(b);return}}(D=b.target)!=null&&D.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Io(d,h==null?void 0:h.splitKey).forEach(function(A){var C,R=Ao(A,h==null?void 0:h.combinationKey);if(qa(b,R,h==null?void 0:h.ignoreModifiers)||(C=R.keys)!=null&&C.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(b)||S&&c.current)return;if(ja(b,R,h==null?void 0:h.preventDefault),!Wa(b,R,h==null?void 0:h.enabled)){ei(b);return}p.current(b,R),S||(c.current=!0)}})}},y=function(b){b.key!==void 0&&(Ji(pt(b.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&T(b))},w=function(b){b.key!==void 0&&(es(pt(b.code)),c.current=!1,h!=null&&h.keyup&&T(b,!0))},E=s||(l==null?void 0:l.document)||document;return E.addEventListener("keyup",w),E.addEventListener("keydown",y),v&&Io(d,h==null?void 0:h.splitKey).forEach(function(x){return v.addHotkey(Ao(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){E.removeEventListener("keyup",w),E.removeEventListener("keydown",y),v&&Io(d,h==null?void 0:h.splitKey).forEach(function(x){return v.removeHotkey(Ao(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[s,d,h,g]),a}var br={exports:{}};/*! + * Toastify js 1.12.0 + * https://github.com/apvarun/toastify-js + * @license MIT licensed + * + * Copyright (C) 2018 Varun A P + */var jf=br.exports;(function(e){(function(t,n){e.exports?e.exports=n():t.Toastify=n()})(Sa,function(t){var n=function(a){return new n.lib.init(a)},o="1.12.0";n.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,ariaLive:"polite",style:{background:""}},n.lib=n.prototype={toastify:o,constructor:n,init:function(a){return a||(a={}),this.options={},this.toastElement=null,this.options.text=a.text||n.defaults.text,this.options.node=a.node||n.defaults.node,this.options.duration=a.duration===0?0:a.duration||n.defaults.duration,this.options.selector=a.selector||n.defaults.selector,this.options.callback=a.callback||n.defaults.callback,this.options.destination=a.destination||n.defaults.destination,this.options.newWindow=a.newWindow||n.defaults.newWindow,this.options.close=a.close||n.defaults.close,this.options.gravity=a.gravity==="bottom"?"toastify-bottom":n.defaults.gravity,this.options.positionLeft=a.positionLeft||n.defaults.positionLeft,this.options.position=a.position||n.defaults.position,this.options.backgroundColor=a.backgroundColor||n.defaults.backgroundColor,this.options.avatar=a.avatar||n.defaults.avatar,this.options.className=a.className||n.defaults.className,this.options.stopOnFocus=a.stopOnFocus===void 0?n.defaults.stopOnFocus:a.stopOnFocus,this.options.onClick=a.onClick||n.defaults.onClick,this.options.offset=a.offset||n.defaults.offset,this.options.escapeMarkup=a.escapeMarkup!==void 0?a.escapeMarkup:n.defaults.escapeMarkup,this.options.ariaLive=a.ariaLive||n.defaults.ariaLive,this.options.style=a.style||n.defaults.style,a.backgroundColor&&(this.options.style.background=a.backgroundColor),this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var a=document.createElement("div");a.className="toastify on "+this.options.className,this.options.position?a.className+=" toastify-"+this.options.position:this.options.positionLeft===!0?(a.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):a.className+=" toastify-right",a.className+=" "+this.options.gravity,this.options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');for(var c in this.options.style)a.style[c]=this.options.style[c];if(this.options.ariaLive&&a.setAttribute("aria-live",this.options.ariaLive),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)a.appendChild(this.options.node);else if(this.options.escapeMarkup?a.innerText=this.options.text:a.innerHTML=this.options.text,this.options.avatar!==""){var l=document.createElement("img");l.src=this.options.avatar,l.className="toastify-avatar",this.options.position=="left"||this.options.positionLeft===!0?a.appendChild(l):a.insertAdjacentElement("afterbegin",l)}if(this.options.close===!0){var d=document.createElement("button");d.type="button",d.setAttribute("aria-label","Close"),d.className="toast-close",d.innerHTML="✖",d.addEventListener("click",(function(v){v.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}).bind(this));var f=window.innerWidth>0?window.innerWidth:screen.width;(this.options.position=="left"||this.options.positionLeft===!0)&&f>360?a.insertAdjacentElement("afterbegin",d):a.appendChild(d)}if(this.options.stopOnFocus&&this.options.duration>0){var u=this;a.addEventListener("mouseover",function(v){window.clearTimeout(a.timeOutValue)}),a.addEventListener("mouseleave",function(){a.timeOutValue=window.setTimeout(function(){u.removeElement(a)},u.options.duration)})}if(typeof this.options.destination<"u"&&a.addEventListener("click",(function(v){v.stopPropagation(),this.options.newWindow===!0?window.open(this.options.destination,"_blank"):window.location=this.options.destination}).bind(this)),typeof this.options.onClick=="function"&&typeof this.options.destination>"u"&&a.addEventListener("click",(function(v){v.stopPropagation(),this.options.onClick()}).bind(this)),typeof this.options.offset=="object"){var p=i("x",this.options),h=i("y",this.options),m=this.options.position=="left"?p:"-"+p,g=this.options.gravity=="toastify-top"?h:"-"+h;a.style.transform="translate("+m+","+g+")"}return a},showToast:function(){this.toastElement=this.buildToast();var a;if(typeof this.options.selector=="string"?a=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||typeof ShadowRoot<"u"&&this.options.selector instanceof ShadowRoot?a=this.options.selector:a=document.body,!a)throw"Root element is not defined";var c=n.defaults.oldestFirst?a.firstChild:a.lastChild;return a.insertBefore(this.toastElement,c),n.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout((function(){this.removeElement(this.toastElement)}).bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(a){a.className=a.className.replace(" on",""),window.setTimeout((function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),a.parentNode&&a.parentNode.removeChild(a),this.options.callback.call(a),n.reposition()}).bind(this),400)}},n.reposition=function(){for(var a={top:15,bottom:15},c={top:15,bottom:15},l={top:15,bottom:15},d=document.getElementsByClassName("toastify"),f,u=0;u0?window.innerWidth:screen.width;m<=360?(d[u].style[f]=l[f]+"px",l[f]+=p+h):s(d[u],"toastify-left")===!0?(d[u].style[f]=a[f]+"px",a[f]+=p+h):(d[u].style[f]=c[f]+"px",c[f]+=p+h)}return this};function i(a,c){return c.offset[a]?isNaN(c.offset[a])?c.offset[a]:c.offset[a]+"px":"0px"}function s(a,c){return!a||typeof c!="string"?!1:!!(a.className&&a.className.trim().split(/\s+/gi).indexOf(c)>-1)}return n.lib.init.prototype=n.lib,n})})(br);var nc=br.exports;const oc=vr(nc);window._showToast=Re;function Re(e){typeof e=="string"&&(e={text:e});const{onClick:t,delay:n,...o}=e,i=oc({className:`${t||e.destination?"shiny-pill":""}`,gravity:"bottom",position:"center",...o,onClick:()=>{t==null||t(i)}});return n?setTimeout(()=>{i.showToast()},n):i.showToast(),i}function Wf(e,t,n,o){const i=$(e);ee(()=>{i.current=e},[e,n]),ee(()=>{!o||t===null||t===!1||i.current()},[o]),ee(()=>{if(t===null||t===!1)return;const a=setInterval(()=>i.current(),t);return()=>clearInterval(a)},[t])}function rc(e){const t=URL.parse("/compose/",window.location),{width:n,height:o}=window.screen,i=Math.max(0,(n-600)/2),s=Math.max(0,(o-450)/2),a=Math.min(n,600),c=Math.min(o,450),l=(e==null?void 0:e.uid)||Math.random(),d=window.open(t,"compose"+l,`width=${a},height=${c},left=${i},top=${s}`);return d?d.__COMPOSE__=e:alert(k._({id:"4S86wI"})),d}const ic=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function sc(){if(ic){const e=document.createElement("input");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.opacity="0",document.body.appendChild(e),e.focus(),setTimeout(()=>{document.body.removeChild(e)},500)}}const os={x:()=>I(()=>import("./icons/close-line-YTE7hIJE.js"),[],import.meta.url),heart:()=>I(()=>import("./icons/heart-line-VwvWYh8h.js"),[],import.meta.url),bookmark:()=>I(()=>import("./icons/bookmark-line-D6jQ7QFs.js"),[],import.meta.url),"check-circle":()=>I(()=>import("./icons/check-circle-line-sE41WGxF.js"),[],import.meta.url),"x-circle":()=>I(()=>import("./icons/close-circle-line-qd3g541O.js"),[],import.meta.url),transfer:()=>I(()=>import("./icons/transfer-4-line-Q9QJoxz3.js"),[],import.meta.url),rocket:()=>I(()=>import("./icons/rocket-line-rZbVYYCZ.js"),[],import.meta.url),"arrow-left":{module:()=>I(()=>import("./icons/arrow-left-line-_YC6-XGG.js"),[],import.meta.url),rtl:!0},"arrow-right":{module:()=>I(()=>import("./icons/arrow-right-line-PypiEqpu.js"),[],import.meta.url),rtl:!0},"arrow-up":()=>I(()=>import("./icons/arrow-up-line-fcuKqhVE.js"),[],import.meta.url),"arrow-down":()=>I(()=>import("./icons/arrow-down-line-0TRJUP_K.js"),[],import.meta.url),earth:()=>I(()=>import("./icons/earth-line-t1Um8wpQ.js"),[],import.meta.url),lock:()=>I(()=>import("./icons/lock-line-0jNHqZpm.js"),[],import.meta.url),unlock:()=>I(()=>import("./icons/unlock-line-w3piJMVb.js"),[],import.meta.url),"eye-close":()=>I(()=>import("./icons/eye-close-line-lBiePPv9.js"),[],import.meta.url),"eye-open":()=>I(()=>import("./icons/eye-2-line-vz_Kw-rK.js"),[],import.meta.url),message:()=>I(()=>import("./icons/mail-line-5XLS6FEo.js"),[],import.meta.url),comment:{module:()=>I(()=>import("./icons/chat-3-line-F0xcdpXY.js"),[],import.meta.url),rtl:!0},comment2:{module:()=>I(()=>import("./icons/comment-2-line-xEXuT-Ip.js"),[],import.meta.url),rtl:!0},home:()=>I(()=>import("./icons/home-3-line-qJiZhXUH.js"),[],import.meta.url),notification:()=>I(()=>import("./icons/notification-line-olNPLtgS.js"),[],import.meta.url),follow:()=>I(()=>import("./icons/user-follow-line-k_GCWTtp.js"),[],import.meta.url),"follow-add":()=>I(()=>import("./icons/user-add-line-zzW9OULB.js"),[],import.meta.url),poll:[()=>I(()=>import("./icons/chart-bar-line-5r_DfN2w.js"),[],import.meta.url),"90deg"],pencil:()=>I(()=>import("./icons/pencil-line-bKXqElLR.js"),[],import.meta.url),quill:()=>I(()=>import("./icons/quill-pen-line-h_5-FsGz.js"),[],import.meta.url),at:()=>I(()=>import("./icons/at-line-9vJS_Hnl.js"),[],import.meta.url),attachment:()=>I(()=>import("./icons/attachment-line-C2PUa1Ke.js"),[],import.meta.url),upload:()=>I(()=>import("./icons/upload-3-line-Qsjvubiw.js"),[],import.meta.url),gear:()=>I(()=>import("./icons/settings-3-line-kt4MSpRv.js"),[],import.meta.url),more:()=>I(()=>import("./icons/more-3-line-wUD-Yhmj.js"),[],import.meta.url),more2:()=>I(()=>import("./icons/more-1-fill-je1-slyh.js"),[],import.meta.url),external:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rtl:!0},popout:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rtl:!0},popin:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rotate:"180deg",rtl:!0},plus:()=>I(()=>import("./icons/add-circle-line--O-MfyNy.js"),[],import.meta.url),"chevron-left":{module:()=>I(()=>import("./icons/left-line-Jck0yVmC.js"),[],import.meta.url),rtl:!0},"chevron-right":{module:()=>I(()=>import("./icons/right-line-7VBoqLdz.js"),[],import.meta.url),rtl:!0},"chevron-down":()=>I(()=>import("./icons/down-line-9PeS5YhF.js"),[],import.meta.url),reply:{module:()=>I(()=>import("./icons/share-forward-line-4jL-2Q4u.js"),[],import.meta.url),rotate:"180deg",flip:"horizontal",rtl:!0},thread:()=>I(()=>import("./icons/route-line-2YYy3958.js"),[],import.meta.url),group:{module:()=>I(()=>import("./icons/group-line-JvhJklhQ.js"),[],import.meta.url),rtl:!0},bot:()=>I(()=>import("./icons/android-2-line-uPwvVubH.js"),[],import.meta.url),menu:()=>I(()=>import("./icons/rows-4-line-SxGPYpTa.js"),[],import.meta.url),list:{module:()=>I(()=>import("./icons/list-check-line-qNqx9Mm4.js"),[],import.meta.url),rtl:!0},search:()=>I(()=>import("./icons/search-2-line-G39AynEw.js"),[],import.meta.url),hashtag:()=>I(()=>import("./icons/hashtag-line-SS3QMu1R.js"),[],import.meta.url),info:()=>I(()=>import("./icons/information-line-8SOch6cR.js"),[],import.meta.url),shortcut:()=>I(()=>import("./icons/lightning-line-JMYUlCZM.js"),[],import.meta.url),user:()=>I(()=>import("./icons/user-4-line-zT_bpOrS.js"),[],import.meta.url),following:()=>I(()=>import("./icons/walk-line-CF7a5s4t.js"),[],import.meta.url),pin:()=>I(()=>import("./icons/pin-line-ULyRQyWZ.js"),[],import.meta.url),unpin:[()=>I(()=>import("./icons/pin-line-ULyRQyWZ.js"),[],import.meta.url),"180deg"],bus:()=>I(()=>import("./icons/bus-2-line-XuQdDZ_w.js"),[],import.meta.url),link:()=>I(()=>import("./icons/link-2-line-BUqp1EwN.js"),[],import.meta.url),history:()=>I(()=>import("./icons/history-line-yoG7K8wL.js"),[],import.meta.url),share:()=>I(()=>import("./icons/share-2-line-PYo-zN94.js"),[],import.meta.url),sparkles:()=>I(()=>import("./icons/sparkles-line-wjZWGZ1a.js"),[],import.meta.url),sparkles2:()=>I(()=>import("./icons/sparkles-2-line-g2FqdZ0R.js"),[],import.meta.url),exit:{module:()=>I(()=>import("./icons/exit-line-l-1uUgI7.js"),[],import.meta.url),rtl:!0},translate:()=>I(()=>import("./icons/translate-line-HpDtlqS2.js"),[],import.meta.url),play:()=>I(()=>import("./icons/play-fill-Ey-zv2eL.js"),[],import.meta.url),trash:()=>I(()=>import("./icons/delete-2-line-pjUduCFs.js"),[],import.meta.url),mute:{module:()=>I(()=>import("./icons/volume-mute-line-WthBoXru.js"),[],import.meta.url),rtl:!0},unmute:{module:()=>I(()=>import("./icons/volume-line-PZujbN8h.js"),[],import.meta.url),rtl:!0},block:()=>I(()=>import("./icons/forbid-circle-line-3FxopGoP.js"),[],import.meta.url),unblock:[()=>I(()=>import("./icons/forbid-circle-line-3FxopGoP.js"),[],import.meta.url),"180deg"],flag:()=>I(()=>import("./icons/flag-1-line-xvcg7G7Q.js"),[],import.meta.url),time:()=>I(()=>import("./icons/time-line-ThP0kTRr.js"),[],import.meta.url),refresh:()=>I(()=>import("./icons/refresh-2-line-t42qqclb.js"),[],import.meta.url),emoji2:()=>I(()=>import("./icons/emoji-2-line--uNVc2IC.js"),[],import.meta.url),filter:()=>I(()=>import("./icons/filter-2-line-KyjbFYlO.js"),[],import.meta.url),filters:()=>I(()=>import("./icons/filter-line-1KEfnWDm.js"),[],import.meta.url),chart:()=>I(()=>import("./icons/chart-line-line-pHaLt6yC.js"),[],import.meta.url),react:()=>I(()=>import("./icons/react-line-YfZPqZem.js"),[],import.meta.url),layout4:{module:()=>I(()=>import("./icons/layout-4-line-FOdnyEcZ.js"),[],import.meta.url),rtl:!0},layout5:()=>I(()=>import("./icons/layout-5-line-9Kks7dle.js"),[],import.meta.url),announce:{module:()=>I(()=>import("./icons/announcement-line-MSlAmDH1.js"),[],import.meta.url),rtl:!0},alert:()=>I(()=>import("./icons/alert-line-zyc6hy8V.js"),[],import.meta.url),round:()=>I(()=>import("./icons/round-fill-a0rplSmV.js"),[],import.meta.url),"arrow-up-circle":()=>I(()=>import("./icons/arrow-up-circle-line-e3kZqEZN.js"),[],import.meta.url),"arrow-down-circle":()=>I(()=>import("./icons/arrow-down-circle-line-mpqFtRtO.js"),[],import.meta.url),clipboard:{module:()=>I(()=>import("./icons/clipboard-line-9F_Yeo71.js"),[],import.meta.url),rtl:!0},"account-edit":()=>I(()=>import("./icons/user-edit-line-9VnWCh0X.js"),[],import.meta.url),"account-warning":()=>I(()=>import("./icons/user-warning-line-gL3RGb1N.js"),[],import.meta.url),keyboard:()=>I(()=>import("./icons/keyboard-line-10AZQcVH.js"),[],import.meta.url),cloud:()=>I(()=>import("./icons/cloud-line-abe0HgFS.js"),[],import.meta.url),month:{module:()=>I(()=>import("./icons/calendar-month-line-VoXZVWAe.js"),[],import.meta.url),rtl:!0},media:()=>I(()=>import("./icons/photo-album-line--GdJqjfq.js"),[],import.meta.url),speak:()=>I(()=>import("./icons/radar-line-ndI8IhOG.js"),[],import.meta.url),building:()=>I(()=>import("./icons/building-5-line-ew7lu83B.js"),[],import.meta.url),history2:{module:()=>I(()=>import("./icons/history-2-line-3yIVzoWo.js"),[],import.meta.url),rtl:!0},document:()=>I(()=>import("./icons/document-line--D6ooZg1.js"),[],import.meta.url),"arrows-right":{module:()=>I(()=>import("./icons/arrows-right-line-HF4HILdT.js"),[],import.meta.url),rtl:!0},code:()=>I(()=>import("./icons/code-line-h4RWLaak.js"),[],import.meta.url),copy:()=>I(()=>import("./icons/copy-2-line-mPSDKieb.js"),[],import.meta.url),quote:{module:()=>I(()=>import("./icons/quote-left-line-NQzeELMO.js"),[],import.meta.url),rtl:!0},settings:()=>I(()=>import("./icons/settings-6-line-ZgCBilgF.js"),[],import.meta.url),"heart-break":()=>I(()=>import("./icons/heart-crack-line-P3DoKfTT.js"),[],import.meta.url),"user-x":()=>I(()=>import("./icons/user-x-line-zIdph-gu.js"),[],import.meta.url),minimize:()=>I(()=>import("./icons/arrows-down-line-ovOF9r0o.js"),[],import.meta.url),celebrate:()=>I(()=>import("./icons/celebrate-line-2j4SZgI5.js"),[],import.meta.url)},ac={s:12,m:16,l:20,xl:24,xxl:32},ti={},cc=Ia(function({width:e,height:t,body:n,rotate:o,flip:i}){return r("svg",{viewBox:`0 0 ${e} ${t}`,dangerouslySetInnerHTML:{__html:n},style:{transform:`${o?`rotate(${o})`:""} ${i?"scaleX(-1)":""}`}})},{isShallowEqual:!0,maxSize:Object.keys(os).length,matchesArg:(e,t)=>e.icon===t.icon&&e.body===t.body});function M({icon:e,size:t="m",alt:n,title:o,class:i="",style:s={}}){if(!e)return null;const a=ac[t];let c=os[e];if(!c)return null;let l,d,f=!1;Array.isArray(c)?[c,l,d]=c:typeof c=="object"&&({rotate:l,flip:d,rtl:f}=c,c=c.module);const[u,p]=Z(ti[e]),h=$(e);return ee(()=>{u&&h.current===e||((async()=>{const m=await c();p(m.default),ti[e]=m.default})(),h.current=e)},[e]),r("span",{class:`icon ${i} ${f?"rtl-flip":""}`,title:o||n,style:{width:`${a}px`,height:`${a}px`,...s},"data-icon":e,children:u&&r(cc,{icon:e,width:u.width,height:u.height,body:u.body,rotate:l,flip:d})})}function lc(e,t=[]){!e||typeof e!="function"||ee(()=>{const n=new CloseWatcher;return n.addEventListener("close",e),()=>{n.destroy()}},t)}const uc=window.CloseWatcher?lc:()=>{},dc=document.getElementById("modal-container");function ni(){return getComputedStyle(document.documentElement).getPropertyValue("--backdrop-theme-color")}function Qo({children:e,onClose:t,onClick:n,class:o,minimized:i}){if(!e)return null;const s=$();ee(()=>{let u=setTimeout(()=>{var h;const p=(h=s.current)==null?void 0:h.querySelector('[tabindex="-1"]');p&&p.focus()},100);return()=>clearTimeout(u)},[]);const a=window.CloseWatcher,c=Ut("esc",()=>{setTimeout(()=>{t==null||t()},0)},{enabled:!a&&!!t,keydown:!1,keyup:!0},[t]);uc(t,[t]),ee(()=>{const u=document.querySelectorAll(".deck-container");if(i){const p=u[u.length-1];p&&p.tabIndex===-1&&p.focus()}else e?u.forEach(p=>{p.setAttribute("inert","")}):u.forEach(p=>{p.removeAttribute("inert")});return()=>{u.forEach(p=>{p.removeAttribute("inert")})}},[e,i]);const l=$(),d=$();Pt(()=>{if(e&&!i)if(Yo.local.get("theme")){const p=ni();l.current=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),l.current&&(d.current=l.current.content,l.current.content=p)}else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",h=ni();l.current=document.querySelector(`meta[name="theme-color"][media*="${p}"]`),l.current&&(d.current=l.current.content,l.current.content=h)}else l.current&&d.current&&(l.current.content=d.current);return()=>{l.current&&d.current&&(l.current.content=d.current)}},[e,i]);const f=r("div",{ref:u=>{var p;s.current=u,c(((p=u==null?void 0:u.querySelector)==null?void 0:p.call(u,'[tabindex="-1"]'))||u)},className:o,onClick:u=>{n==null||n(u),u.target===u.currentTarget&&(t==null||t(u))},tabIndex:i?0:"-1",inert:i,onFocus:u=>{var p,h;try{if(u.target===u.currentTarget){const m=(p=s.current)==null?void 0:p.querySelector('[tabindex="-1"]'),g=!!m&&((h=getComputedStyle(m))==null?void 0:h.pointerEvents)!=="none";m&&g&&m.focus()}}catch{}},children:e});return io(f,dc)}var Tr={exports:{}},fc="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",hc=fc;var pc=hc;function rs(){}function is(){}is.resetWarningCache=rs;var mc=function(){function e(o,i,s,a,c,l){if(l!==pc){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:is,resetWarningCache:rs};return n.PropTypes=n,n};var Kf=Tr.exports;if(0)var Zf,Gf;else Tr.exports=mc();var j=Tr.exports;const wr=e=>!!e&&e[0]==="o",Jo=Aa||(e=>e());const Tn=(e,t)=>e===!0||!!(e&&e[t]),Ve=(e,t)=>typeof e=="function"?e(t):e,gc="_szhsinMenu",vc=e=>e[gc];const en=(e,t)=>(t&&Object.keys(t).forEach(n=>{const o=e[n],i=t[n];typeof i=="function"&&o?e[n]=(...s)=>{i(...s),o(...s)}:e[n]=i}),e),_c=e=>{if(typeof e!="string")return{top:0,right:0,bottom:0,left:0};const t=e.trim().split(/\s+/,4).map(parseFloat),n=isNaN(t[0])?0:t[0],o=isNaN(t[1])?n:t[1];return{top:n,right:o,bottom:isNaN(t[2])?n:t[2],left:isNaN(t[3])?o:t[3]}},Co=e=>{for(;e;){if(e=e.parentNode,!e||e===document.body||!e.parentNode)return;const{overflow:t,overflowX:n,overflowY:o}=getComputedStyle(e);if(/auto|scroll|overlay|hidden/.test(t+o+n))return e}};function go(e,t){return{"aria-disabled":e||void 0,tabIndex:t?0:-1}}function oi(e,t){for(let n=0;n({[e?`${e}ClassName`:"className"]:j.oneOfType([j.string,j.func])}),bc={className:j.string,...yc("menu"),arrowProps:j.object,focusProps:j.object,menuStyle:j.object,arrow:j.bool,setDownOverflow:j.bool,gap:j.number,shift:j.number,align:j.oneOf(["start","center","end"]),direction:j.oneOf(["left","right","top","bottom"]),position:j.oneOf(["auto","anchor","initial"]),overflow:j.oneOf(["auto","visible","hidden"])},qf={...bc,containerProps:j.object,initialMounted:j.bool,unmountOnClose:j.bool,transition:j.oneOfType([j.bool,j.exact({open:j.bool,close:j.bool,item:j.bool})]),transitionTimeout:j.number,boundingBoxRef:j.object,boundingBoxPadding:j.string,reposition:j.oneOf(["auto","initial"]),repositionFlag:j.oneOfType([j.string,j.number]),viewScroll:j.oneOf(["auto","close","initial"]),submenuOpenDelay:j.number,submenuCloseDelay:j.number,portal:j.oneOfType([j.bool,j.exact({target:j.object,stablePosition:j.bool})]),theming:j.string,onItemClick:j.func},Yf={instanceRef:j.oneOfType([j.object,j.func]),onMenuChange:j.func},et=({block:e,element:t,modifiers:n,className:o})=>ae(()=>{const i=t?`${e}__${t}`:e;let s=i;n&&Object.keys(n).forEach(c=>{const l=n[c];l&&(s+=` ${i}--${l===!0?c:`${c}-${l}`}`)});let a=typeof o=="function"?o(n):o;return typeof a=="string"&&(a=a.trim(),a&&(s+=` ${a}`)),s},[e,t,n,o]),Tc="szh-menu-container",Je="szh-menu";const wc="arrow",Er="item",Ec="divider",xc="header",kc="group",Sc="submenu";const ss=lt(),xr=lt({}),ao=lt({}),kr=lt({}),Ic=lt({}),vo=lt({}),Fe=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),we=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),wn=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Wt=Object.freeze({FIRST:"first",LAST:"last"}),Ac=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),Po="absolute",En="none",Sr="menuitem";const Cc=({className:e,containerRef:t,containerProps:n,children:o,isOpen:i,theming:s,transition:a,onClose:c})=>{const l=Tn(a,"item");return r("div",{...en({onKeyDown:({key:u})=>{switch(u){case Fe.ESC:Ve(c,{key:u,reason:wn.CANCEL});break}},onBlur:u=>{i&&!u.currentTarget.contains(u.relatedTarget)&&Ve(c,{reason:wn.BLUR})}},n),className:et({block:Tc,modifiers:ae(()=>({theme:s,itemTransition:l}),[s,l]),className:e}),style:{position:"absolute",...n==null?void 0:n.style},ref:t,children:o})},Pc=()=>{let e,t=0;return{toggle:n=>{n?t++:t--,t=Math.max(t,0)},on:(n,o,i)=>{t?e||(e=setTimeout(()=>{e=0,o()},n)):i==null||i()},off:()=>{e&&(clearTimeout(e),e=0)}}},Lc=(e,t)=>{const[n,o]=Z(),s=$({items:[],hoverIndex:-1,sorted:!1}).current,a=Me((l,d)=>{const{items:f}=s;if(!l)s.items=[];else if(d)f.push(l);else{const u=f.indexOf(l);u>-1&&(f.splice(u,1),l.contains(document.activeElement)&&(t.current.focus(),o()))}s.hoverIndex=-1,s.sorted=!1},[s,t]),c=Me((l,d,f)=>{const{items:u,hoverIndex:p}=s,h=()=>{if(s.sorted)return;const v=e.current.querySelectorAll(".szh-menu__item");u.sort((T,y)=>oi(v,T)-oi(v,y)),s.sorted=!0};let m=-1,g;switch(l){case we.RESET:break;case we.SET:g=d;break;case we.UNSET:g=v=>v===d?void 0:v;break;case we.FIRST:h(),m=0,g=u[m];break;case we.LAST:h(),m=u.length-1,g=u[m];break;case we.SET_INDEX:h(),m=f,g=u[m];break;case we.INCREASE:h(),m=p,m<0&&(m=u.indexOf(d)),m++,m>=u.length&&(m=0),g=u[m];break;case we.DECREASE:h(),m=p,m<0&&(m=u.indexOf(d)),m--,m<0&&(m=u.length-1),g=u[m];break;default:}g||(m=-1),o(g),s.hoverIndex=m},[e,s]);return{hoverItem:n,dispatch:c,updateItems:a}},ri=(e,t)=>Math.round(e)===t?e:t,as=e=>{const t=e.getBoundingClientRect();return t.width=ri(t.width,e.offsetWidth),t.height=ri(t.height,e.offsetHeight),t},Mc=(e,t,n,o)=>{const i=as(t.current),s=e.current.getBoundingClientRect(),a=n===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:n.getBoundingClientRect(),c=_c(o),l=m=>m+s.left-a.left-c.left,d=m=>m+s.left+i.width-a.right+c.right,f=m=>m+s.top-a.top-c.top,u=m=>m+s.top+i.height-a.bottom+c.bottom;return{menuRect:i,containerRect:s,getLeftOverflow:l,getRightOverflow:d,getTopOverflow:f,getBottomOverflow:u,confineHorizontally:m=>{let g=l(m);if(g<0)m-=g;else{const v=d(m);v>0&&(m-=v,g=l(m),g<0&&(m-=g))}return m},confineVertically:m=>{let g=f(m);if(g<0)m-=g;else{const v=u(m);v>0&&(m-=v,g=f(m),g<0&&(m-=g))}return m}}},Rc=({arrowRef:e,menuY:t,anchorRect:n,containerRect:o,menuRect:i})=>{let s=n.top-o.top-t+n.height/2;const a=e.current.offsetHeight*1.25;return s=Math.max(a,s),s=Math.min(s,i.height-a),s},Oc=({anchorRect:e,containerRect:t,menuRect:n,placeLeftorRightY:o,placeLeftX:i,placeRightX:s,getLeftOverflow:a,getRightOverflow:c,confineHorizontally:l,confineVertically:d,arrowRef:f,arrow:u,direction:p,position:h})=>{let m=p,g=o;h!=="initial"&&(g=d(g),h==="anchor"&&(g=Math.min(g,e.bottom-t.top),g=Math.max(g,e.top-t.top-n.height)));let v,T,y;return m==="left"?(v=i,h!=="initial"&&(T=a(v),T<0&&(y=c(s),(y<=0||-T>y)&&(v=s,m="right")))):(v=s,h!=="initial"&&(y=c(v),y>0&&(T=a(i),(T>=0||-T{let s=n.left-o.left-t+n.width/2;const a=e.current.offsetWidth*1.25;return s=Math.max(a,s),s=Math.min(s,i.width-a),s},$c=({anchorRect:e,containerRect:t,menuRect:n,placeToporBottomX:o,placeTopY:i,placeBottomY:s,getTopOverflow:a,getBottomOverflow:c,confineHorizontally:l,confineVertically:d,arrowRef:f,arrow:u,direction:p,position:h})=>{let m=p==="top"?"top":"bottom",g=o;h!=="initial"&&(g=l(g),h==="anchor"&&(g=Math.min(g,e.right-t.left),g=Math.max(g,e.left-t.left-n.width)));let v,T,y;return m==="top"?(v=i,h!=="initial"&&(T=a(v),T<0&&(y=c(s),(y<=0||-T>y)&&(v=s,m="bottom")))):(v=s,h!=="initial"&&(y=c(v),y>0&&(T=a(i),(T>=0||-T{const{menuRect:d,containerRect:f}=l,u=n==="left"||n==="right";let p=u?o:i,h=u?i:o;if(e){const x=c.current;u?p+=x.offsetWidth:h+=x.offsetHeight}const m=a.left-f.left-d.width-p,g=a.right-f.left+p,v=a.top-f.top-d.height-h,T=a.bottom-f.top+h;let y,w;t==="end"?(y=a.right-f.left-d.width,w=a.bottom-f.top-d.height):t==="center"?(y=a.left-f.left-(d.width-a.width)/2,w=a.top-f.top-(d.height-a.height)/2):(y=a.left-f.left,w=a.top-f.top),y+=p,w+=h;const E={...l,anchorRect:a,placeLeftX:m,placeRightX:g,placeLeftorRightY:w,placeTopY:v,placeBottomY:T,placeToporBottomX:y,arrowRef:c,arrow:e,direction:n,position:s};switch(n){case"left":case"right":return Oc(E);case"top":case"bottom":default:return $c(E)}},Kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Pt:ee;function ii(e,t){typeof e=="function"?e(t):e.current=t}const tn=(e,t)=>ae(()=>e?t?n=>{ii(e,n),ii(t,n)}:e:t,[e,t]),si=-9999,cs=({ariaLabel:e,menuClassName:t,menuStyle:n,arrow:o,arrowProps:i={},anchorPoint:s,anchorRef:a,containerRef:c,containerProps:l,focusProps:d,externalRef:f,parentScrollingRef:u,align:p="start",direction:h="bottom",position:m="auto",overflow:g="visible",setDownOverflow:v,repositionFlag:T,captureFocus:y=!0,state:w,endTransition:E,isDisabled:x,menuItemFocus:b,gap:S=0,shift:D=0,children:L,onClose:A,...C})=>{const[R,K]=Z({x:si,y:si}),[U,oe]=Z({}),[Q,re]=Z(),[q,ie]=Z(h),[ce]=Z(Pc),[se,H]=Wi(X=>X+1,1),{transition:fe,boundingBoxRef:ne,boundingBoxPadding:Ee,rootMenuRef:ye,rootAnchorRef:xe,scrollNodesRef:De,reposition:Ie,viewScroll:$e,submenuCloseDelay:Ce}=ze(vo),{submenuCtx:he,reposSubmenu:N=T}=ze(ao),ge=$(null),Ge=$(),Mt=$(),V=$(!1),{hoverItem:le,dispatch:z,updateItems:J}=Lc(ge,Ge),Y=wr(w),be=Tn(fe,"open"),te=Tn(fe,"close"),pe=De.current,Rt=X=>{switch(X.key){case Fe.HOME:z(we.FIRST);break;case Fe.END:z(we.LAST);break;case Fe.UP:z(we.DECREASE,le);break;case Fe.DOWN:z(we.INCREASE,le);break;case Fe.SPACE:X.target&&X.target.className.indexOf(Je)!==-1&&X.preventDefault();return;default:return}X.preventDefault(),X.stopPropagation()},Ue=()=>{w==="closing"&&re(),Ve(E)},Ae=X=>{X.stopPropagation(),ce.on(Ce,()=>{z(we.RESET),Ge.current.focus()})},Pe=X=>{X.target===X.currentTarget&&ce.off()},ve=Me(X=>{var _e;const Te=a?(_e=a.current)==null?void 0:_e.getBoundingClientRect():s?{left:s.x,right:s.x,top:s.y,bottom:s.y,width:0,height:0}:null;if(!Te)return;pe.menu||(pe.menu=(ne?ne.current:Co(ye.current))||window);const He=Mc(c,ge,pe.menu,Ee);let{arrowX:ke,arrowY:nt,x:Ln,y:Tt,computedDirection:qe}=Nc({arrow:o,align:p,direction:h,gap:S,shift:D,position:m,anchorRect:Te,arrowRef:Mt,positionHelpers:He});const{menuRect:Mn}=He,je=Mn.height;if(!X&&g!=="visible"){const{getTopOverflow:wt,getBottomOverflow:bo}=He;let Et,de;const xt=bo(Tt);if(xt>0)Et=je-xt,de=xt;else{const Dt=wt(Tt);Dt<0&&(Et=je+Dt,de=0-Dt,Et>=0&&(Tt-=Dt))}Et>=0&&re({height:Et,overflowAmt:de})}o&&oe({x:ke,y:nt}),K({x:Ln,y:Tt}),ie(qe)},[o,p,Ee,h,S,D,m,g,s,a,c,ne,ye,pe]);Kt(()=>{Y&&(ve(),V.current&&H()),V.current=Y},[Y,ve,N]),Kt(()=>{Q&&!v&&(ge.current.scrollTop=0)},[Q,v]),Kt(()=>J,[J]),ee(()=>{let{menu:X}=pe;if(!Y||!X)return;if(X=X.addEventListener?X:window,!pe.anchors){pe.anchors=[];let ke=Co(xe&&xe.current);for(;ke&&ke!==X;)pe.anchors.push(ke),ke=Co(ke)}let _e=$e;if(pe.anchors.length&&_e==="initial"&&(_e="auto"),_e==="initial")return;const Te=()=>{_e==="auto"?Jo(()=>ve(!0)):Ve(A,{reason:wn.SCROLL})},He=pe.anchors.concat($e!=="initial"?X:[]);return He.forEach(ke=>ke.addEventListener("scroll",Te)),()=>He.forEach(ke=>ke.removeEventListener("scroll",Te))},[xe,pe,Y,A,$e,ve]);const Le=!!Q&&Q.overflowAmt>0;ee(()=>{if(Le||!Y||!u)return;const X=()=>Jo(ve),_e=u.current;return _e.addEventListener("scroll",X),()=>_e.removeEventListener("scroll",X)},[Y,Le,u,ve]),ee(()=>{if(!Y||typeof ResizeObserver!="function"||Ie==="initial")return;const X=[],_e=new ResizeObserver(ke=>ke.forEach(({target:nt})=>{X.indexOf(nt)<0?X.push(nt):Ca(()=>{ve(),H()})})),Te={box:"border-box"};_e.observe(ge.current,Te);const He=a==null?void 0:a.current;return He&&_e.observe(He,Te),()=>_e.disconnect()},[Y,Ie,a,ve]),ee(()=>{if(!Y){z(we.RESET),te||re();return}const{position:X,alwaysUpdate:_e}=b||{},Te=()=>{X===Wt.FIRST?z(we.FIRST):X===Wt.LAST?z(we.LAST):X>=-1&&z(we.SET_INDEX,void 0,X)};if(_e)Te();else if(y){const He=setTimeout(()=>{const ke=ge.current;ke&&!ke.contains(document.activeElement)&&(Ge.current.focus(),Te())},be?170:100);return()=>clearTimeout(He)}},[Y,be,te,y,b,z]);const Cn=ae(()=>({isParentOpen:Y,submenuCtx:ce,dispatch:z,updateItems:J}),[Y,ce,z,J]);let dt,yt;Q&&(v?yt=Q.overflowAmt:dt=Q.height);const yo=ae(()=>({reposSubmenu:se,submenuCtx:ce,overflow:g,overflowAmt:yt,parentMenuRef:ge,parentDir:q}),[se,ce,g,yt,q]),me=dt>=0?{maxHeight:dt,overflow:g}:void 0,Ot=ae(()=>({state:w,align:p,dir:q}),[w,p,q]),bt=ae(()=>({dir:q}),[q]),tt=et({block:Je,element:wc,modifiers:bt,className:i.className}),Pn=r("ul",{role:"menu","aria-label":e,...go(x),...en({onPointerEnter:he==null?void 0:he.off,onPointerMove:Ae,onPointerLeave:Pe,onKeyDown:Rt,onAnimationEnd:Ue},C),ref:tn(f,ge),className:et({block:Je,modifiers:Ot,className:t}),style:{...n,...me,margin:0,display:w==="closed"?"none":void 0,position:Po,left:R.x,top:R.y},children:[r("li",{tabIndex:-1,role:En,style:{position:Po,left:0,top:0,display:"block",outline:"none"},ref:Ge,...d}),o&&r("li",{role:En,...i,className:tt,style:{display:"block",position:Po,left:U.x,top:U.y,...i.style},ref:Mt}),r(ao.Provider,{value:yo,children:r(xr.Provider,{value:Cn,children:r(ss.Provider,{value:le,children:Ve(L,Ot)})})})]});return l?r(Cc,{...l,isOpen:Y,children:Pn}):Pn},ls=vt(function({"aria-label":t,className:n,containerProps:o,initialMounted:i,unmountOnClose:s,transition:a,transitionTimeout:c,boundingBoxRef:l,boundingBoxPadding:d,reposition:f="auto",submenuOpenDelay:u=300,submenuCloseDelay:p=150,viewScroll:h="initial",portal:m,theming:g,onItemClick:v,...T},y){const w=$(null),E=$({}),{anchorRef:x,state:b,onClose:S}=T,D=ae(()=>({initialMounted:i,unmountOnClose:s,transition:a,transitionTimeout:c,boundingBoxRef:l,boundingBoxPadding:d,rootMenuRef:w,rootAnchorRef:x,scrollNodesRef:E,reposition:f,viewScroll:h,submenuOpenDelay:u,submenuCloseDelay:p}),[i,s,a,c,x,l,d,f,h,u,p]),L=ae(()=>({handleClick(C,R){C.stopPropagation||Ve(v,C);let K=C.keepOpen;K===void 0&&(K=R&&C.key===Fe.SPACE),K||Ve(S,{value:C.value,key:C.key,reason:wn.CLICK})},handleClose(C){Ve(S,{key:C,reason:wn.CLICK})}}),[v,S]);if(!b)return null;const A=r(vo.Provider,{value:D,children:r(kr.Provider,{value:L,children:r(cs,{...T,ariaLabel:t||"Menu",externalRef:y,containerRef:w,containerProps:{className:n,containerRef:w,containerProps:o,theming:g,transition:a,onClose:S}})})});return m===!0&&typeof document<"u"?io(A,document.body):m?m.target?io(A,m.target):m.stablePosition?null:A:A}),er=0,tr=1,co=2,lo=3,uo=4,Fc=5,us=6,zc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ds=e=>({_s:e,status:zc[e],isEnter:euo}),nr=e=>e?us:Fc,Vc=(e,t)=>{switch(e){case tr:case er:return co;case uo:case lo:return nr(t)}},Hc=e=>typeof e=="object"?[e.enter,e.exit]:[e,e],Bc=(e,t)=>setTimeout(()=>{isNaN(document.body.offsetTop)||e(t+1)},0),ai=(e,t,n,o,i)=>{clearTimeout(o.current);const s=ds(e);t(s),n.current=s,i&&i({current:s})},Uc=({enter:e=!0,exit:t=!0,preEnter:n,preExit:o,timeout:i,initialEntered:s,mountOnEnter:a,unmountOnExit:c,onStateChange:l}={})=>{const[d,f]=Z(()=>ds(s?co:nr(a))),u=$(d),p=$(),[h,m]=Hc(i),g=Me(()=>{const T=Vc(u.current._s,c);T&&ai(T,f,u,p,l)},[l,c]),v=Me(T=>{const y=E=>{switch(ai(E,f,u,p,l),E){case tr:h>=0&&(p.current=setTimeout(g,h));break;case uo:m>=0&&(p.current=setTimeout(g,m));break;case er:case lo:p.current=Bc(y,E);break}},w=u.current.isEnter;typeof T!="boolean"&&(T=!w),T?!w&&y(e?n?er:tr:co):w&&y(t?o?lo:uo:nr(c))},[g,l,e,t,n,o,h,m,c]);return ee(()=>()=>clearTimeout(p.current),[]),[d,v,g]};const jc=({initialOpen:e,initialMounted:t,unmountOnClose:n,transition:o,transitionTimeout:i=500}={})=>{const[{status:s},a,c]=Uc({initialEntered:e,mountOnEnter:!t,unmountOnExit:n,timeout:i,enter:Tn(o,"open"),exit:Tn(o,"close")});return[{state:Ac[s],endTransition:c},a]},fs=e=>{const[t,n]=jc(e),[o,i]=Z(),s=(a,c)=>{i({position:a,alwaysUpdate:c}),n(!0)};return[{menuItemFocus:o,...t},n,s]},Wc=(e,t)=>{const[n]=Z({});return{onMouseDown:()=>{n.v=e&&e!=="closed"},onClick:o=>n.v?n.v=!1:t(!0,o)}},hs=(e,t)=>{const n=$(t);ee(()=>{n.current!==t&&Ve(e,{open:t}),n.current=t},[e,t])},Kc=vt(function({"aria-label":t,captureFocus:n,initialOpen:o,menuButton:i,instanceRef:s,onMenuChange:a,...c},l){const[d,f,u]=fs(c),{state:p}=d,h=wr(p),m=$(null),g=Wc(p,(x,b)=>u(b.detail?void 0:Wt.FIRST)),v=Me(x=>{f(!1),x.key&&m.current.focus()},[f]),T=x=>{switch(x.key){case Fe.UP:u(Wt.LAST);break;case Fe.DOWN:u(Wt.FIRST);break;default:return}x.preventDefault()},y=Ve(i,{open:h});if(!y||!y.type)throw new Error("Menu requires a menuButton prop.");const w={ref:tn(y.ref,m),...en({onKeyDown:T,...g},y.props)};vc(y.type)==="MenuButton"&&(w.isOpen=h);const E=Ki(y,w);return hs(a,h),Zi(s,()=>({openMenu:u,closeMenu:()=>f(!1)})),r(F,{children:[E,r(ls,{...c,...d,"aria-label":t||(typeof y.props.children=="string"?y.props.children:"Menu"),anchorRef:m,ref:l,onClose:v})]})}),Ir=(e,t)=>{const n=Jt(t),o=vt((i,s)=>{const a=$(null);return r(n,{...i,itemRef:a,externalRef:s,isHovering:ze(ss)===a.current})});return o.displayName=`WithHovering(${e})`,o},ps=(e,t,n)=>{Kt(()=>{if(e)return;const o=t.current;return n(o,!0),()=>{n(o)}},[e,t,n])},Zc=Ir("SubMenu",function({"aria-label":t,className:n,disabled:o,direction:i,label:s,openTrigger:a,onMenuChange:c,isHovering:l,instanceRef:d,itemRef:f,captureFocus:u,repositionFlag:p,itemProps:h={},...m}){const g=ze(vo),{rootMenuRef:v,submenuOpenDelay:T,submenuCloseDelay:y}=g,{parentMenuRef:w,parentDir:E,overflow:x}=ze(ao),{isParentOpen:b,submenuCtx:S,dispatch:D,updateItems:L}=ze(xr),A=x!=="visible",[C,R,K]=fs(g),{state:U}=C,oe=!!o,Q=wr(U),re=$(null),[q]=Z({v:0}),ie=()=>{S.off(),q.v&&(clearTimeout(q.v),q.v=0)},ce=(...N)=>{ie(),se(),!oe&&K(...N)},se=()=>!l&&!oe&&D(we.SET,f.current),H=N=>{se(),a||(q.v=setTimeout(()=>Jo(ce),Math.max(N,0)))},fe=N=>{oe||(N.stopPropagation(),!(q.v||Q)&&S.on(y,()=>H(T-y),()=>H(T)))},ne=()=>{ie(),Q||D(we.UNSET,f.current)},Ee=N=>{if(l)switch(N.key){case Fe.ENTER:N.preventDefault();case Fe.SPACE:case Fe.RIGHT:a!=="none"&&ce(Wt.FIRST)}},ye=N=>{let ge=!1;switch(N.key){case Fe.LEFT:Q&&(f.current.focus(),R(!1),ge=!0);break;case Fe.RIGHT:Q||(ge=!0);break}ge&&(N.preventDefault(),N.stopPropagation())};ps(oe,f,L),hs(c,Q),ee(()=>S.toggle(Q),[S,Q]),ee(()=>()=>clearTimeout(q.v),[q]),ee(()=>{l&&b?f.current.focus():R(!1)},[l,b,R,f]),Zi(d,()=>({openMenu:(...N)=>{b&&ce(...N)},closeMenu:()=>{Q&&(f.current.focus(),R(!1))}}));const xe=ae(()=>({open:Q,hover:l,disabled:oe,submenu:!0}),[Q,l,oe]),{ref:De,className:Ie,...$e}=h,Ce=en({onPointerEnter:S.off,onPointerMove:fe,onPointerLeave:ne,onKeyDown:Ee,onClick:()=>a!=="none"&&ce()},$e),he=()=>{const N=r(cs,{...m,...C,ariaLabel:t||(typeof s=="string"?s:"Submenu"),anchorRef:f,containerRef:A?v:re,direction:i||(E==="right"||E==="left"?E:"right"),parentScrollingRef:A&&w,isDisabled:oe}),ge=v.current;return A&&ge?io(N,ge):N};return r("li",{className:et({block:Je,element:Sc,className:n}),style:{position:"relative"},role:En,ref:re,onKeyDown:ye,children:[r("div",{role:Sr,"aria-haspopup":!0,"aria-expanded":Q,...go(oe,l),...Ce,ref:tn(De,f),className:et({block:Je,element:Er,modifiers:xe,className:Ie}),children:ae(()=>Ve(s,xe),[s,xe])}),U&&he()]})}),ms=(e,t,n,o)=>{const{submenuCloseDelay:i}=ze(vo),{isParentOpen:s,submenuCtx:a,dispatch:c,updateItems:l}=ze(xr),d=()=>{!n&&!o&&c(we.SET,e.current)},f=()=>{!o&&c(we.UNSET,e.current)},u=m=>{n&&!m.currentTarget.contains(m.relatedTarget)&&f()},p=m=>{o||(m.stopPropagation(),a.on(i,d,d))},h=(m,g)=>{a.off(),!g&&f()};return ps(o,e,l),ee(()=>{n&&s&&t.current&&t.current.focus()},[t,n,s]),{setHover:d,onBlur:u,onPointerMove:p,onPointerLeave:h}},Se=Ir("MenuItem",function({className:t,value:n,href:o,type:i,checked:s,disabled:a,children:c,onClick:l,isHovering:d,itemRef:f,externalRef:u,...p}){const h=!!a,{setHover:m,...g}=ms(f,f,d,h),v=ze(kr),T=ze(Ic),y=i==="radio",w=i==="checkbox",E=!!o&&!h&&!y&&!w,x=y?T.value===n:w?!!s:!1,b=C=>{if(h){C.stopPropagation(),C.preventDefault();return}const R={value:n,syntheticEvent:C};C.key!==void 0&&(R.key=C.key),w&&(R.checked=!x),y&&(R.name=T.name),Ve(l,R),y&&Ve(T.onRadioChange,R),v.handleClick(R,w||y)},S=C=>{if(d)switch(C.key){case Fe.ENTER:C.preventDefault();case Fe.SPACE:E?f.current.click():b(C)}},D=ae(()=>({type:i,disabled:h,hover:d,checked:x,anchor:E}),[i,h,d,x,E]),L=en({...g,onPointerDown:m,onKeyDown:S,onClick:b},p),A={role:y?"menuitemradio":w?"menuitemcheckbox":Sr,"aria-checked":y||w?x:void 0,...go(h,d),...L,ref:tn(u,f),className:et({block:Je,element:Er,modifiers:D,className:t}),children:ae(()=>Ve(c,D),[c,D])};return E?r("li",{role:En,children:r("a",{href:o,...A})}):r("li",{...A})}),Gc=Ir("FocusableItem",function({className:t,disabled:n,children:o,isHovering:i,itemRef:s,externalRef:a,...c}){const l=!!n,d=$(null),{setHover:f,onPointerLeave:u,...p}=ms(s,d,i,l),{handleClose:h}=ze(kr),m=ae(()=>({disabled:l,hover:i,focusable:!0}),[l,i]),g=ae(()=>Ve(o,{...m,ref:d,closeMenu:h}),[o,m,h]),v=en({...p,onPointerLeave:T=>u(T,!0),onFocus:f},c);return r("li",{role:Sr,...go(l),...v,ref:tn(a,s),className:et({block:Je,element:Er,modifiers:m,className:t}),children:g})}),an=Jt(vt(function({className:t,...n},o){return r("li",{role:"separator",...n,ref:o,className:et({block:Je,element:Ec,className:t})})})),Xf=Jt(vt(function({className:t,...n},o){return r("li",{role:En,...n,ref:o,className:et({block:Je,element:xc,className:t})})})),Qf=vt(function({className:t,style:n,takeOverflow:o,...i},s){const a=$(null),[c,l]=Z(),{overflow:d,overflowAmt:f}=ze(ao);return Kt(()=>{let u;o&&f>=0&&(u=as(a.current).height-f,u<0&&(u=0)),l(u>=0?{maxHeight:u,overflow:d}:void 0)},[o,d,f]),Kt(()=>{c&&(a.current.scrollTop=0)},[c]),r("div",{...i,ref:tn(s,a),className:et({block:Je,element:kc,className:t}),style:{...n,...c}})});const ci={s:16,m:20,l:24,xl:32,xxl:50,xxxl:64},cn={},fn=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),to=fn.getContext("2d",{willReadFrequently:!0});to.imageSmoothingEnabled=!1;const qc=/missing\.png$/;function Yc({url:e,size:t,alt:n="",squircle:o,...i}){t=ci[t]||t||ci.m;const s=$(),a=qc.test(e);return r("span",{ref:s,class:`avatar ${o?"squircle":""} ${cn[e]?"has-alpha":""}`,style:{width:t,height:t},title:n,...i,children:!!e&&r("img",{src:e,width:t,height:t,alt:n,loading:"lazy",decoding:"async",fetchPriority:"low",crossOrigin:cn[e]===void 0&&!a?"anonymous":void 0,onError:c=>{c.target.crossOrigin&&(c.target.crossOrigin=null,c.target.src=e)},onLoad:c=>{s.current&&(s.current.dataset.loaded=!0),cn[e]===void 0&&(a||setTimeout(()=>{try{const{width:l,height:d}=c.target;fn.width!==l&&(fn.width=l),fn.height!==d&&(fn.height=d),to.drawImage(c.target,0,0);const f=to.getImageData(0,0,l,d),u=f.data.filter((p,h)=>h%4===3&&p<=128).length/(f.data.length/4)>.1;u&&s.current.classList.add("has-alpha"),cn[e]=u,to.clearRect(0,0,l,d)}catch{cn[e]=!1}},1))}})})}const st=Oe(Yc),Gt=vt((e,t)=>{var c;let n;try{n=Pa()}catch{}let o=(location.hash||"").replace(/^#/,"").trim();o===""&&(o="/");const{to:i,...s}=e;if(o&&o!=="/"&&o.includes("?")){const l=URL.parse(o,location.origin);if((c=l==null?void 0:l.searchParams)!=null&&c.size){const d=Array.from(l.searchParams.entries()).map(([f,u])=>`${f}=${encodeURIComponent(u)}`).join("&");o=l.pathname+"?"+d}}const a=o===i||decodeURIComponent(o)===i;return r("a",{ref:t,href:`#${i}`,...s,class:`${e.class||""} ${a?"is-active":""}`,onClick:l=>{var d,f,u;(f=(d=l.currentTarget)==null?void 0:d.parentNode)!=null&&f.closest("a")&&l.stopPropagation(),n&&(B.prevLocation=n),(u=e.onClick)==null||u.call(e,l)}})});let or=!1;const Xc=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"){const{dir:n}=t.target;n==="rtl"?or=!0:or=!1}})});Xc.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});function rr(){return or}const Qc=document.documentElement,jn=getComputedStyle(Qc),Jc=8;let gs=[0,0,0,0];function vs(){const e=jn.getPropertyValue("--sai-top"),t=jn.getPropertyValue("--sai-right"),n=jn.getPropertyValue("--sai-bottom"),o=jn.getPropertyValue("--sai-left");gs=[Math.max(0,parseInt(e,10)),Math.max(0,parseInt(t,10)),Math.max(0,parseInt(n,10)),Math.max(0,parseInt(o,10))]}requestAnimationFrame(vs);function _s(e=[]){return gs.map((n,o)=>(n||Jc)+(e[o]||0)).join(" ")}CSS.supports("top: env(safe-area-inset-top)")&&window.addEventListener("resize",vs,{passive:!0});function el(){const[e,t]=Z({width:null,height:null});return Pt(()=>{const n=()=>{t({width:window.innerWidth,height:window.innerHeight})};return n(),window.addEventListener("resize",n,{passive:!0}),()=>{window.removeEventListener("resize",n)}},[]),e}function ys(e){const{containerProps:t,instanceRef:n,align:o}=e,i=el(),s=n!=null&&n.current?n:$(),a=rr()?o==="end"?"start":o==="start"?"end":o:o;return r(Kc,{boundingBoxPadding:_s(),repositionFlag:`${i.width}x${i.height}`,unmountOnClose:!0,...e,align:a,instanceRef:s,containerProps:{onClick:c=>{var l,d,f;c.target===c.currentTarget&&((d=(l=s.current)==null?void 0:l.closeMenu)==null||d.call(l)),(f=t==null?void 0:t.onClick)==null||f.call(t,c)},...t}})}function tl(e){const t=$();return r(Zc,{...e,instanceRef:t,itemProps:{onPointerMove:n=>{var o,i;n.pointerType==="touch"&&((i=(o=t.current)==null?void 0:o.openMenu)==null||i.call(o))},onPointerLeave:n=>{var o,i;n.pointerType==="touch"&&((i=(o=t.current)==null?void 0:o.openMenu)==null||i.call(o))},...e.itemProps}})}function Lo({subMenu:e=!1,confirm:t=!0,confirmLabel:n,menuItemClassName:o,menuFooter:i,menuExtras:s,...a}){const{children:c,onClick:l,...d}=a;return t?r(e?tl:ys,{openTrigger:"clickOnly",direction:"bottom",overflow:"auto",gap:-8,shift:8,menuClassName:"menu-emphasized",...d,menuButton:e?void 0:c,label:e?c:void 0,children:[r(Se,{className:o,onClick:l,children:n}),s,i]}):e?r(Se,{...a}):l?La(c,{onClick:l}):c}function li(e){const{className:t,disabled:n,...o}=e;return r(Gc,{className:t,disabled:n,children:({ref:i,closeMenu:s})=>r(Gt,{...o,ref:i,onClick:({detail:a})=>s(a===0?"Enter":void 0)})})}function ir({staticUrl:e,alt:t,url:n}){return r("picture",{children:[e&&r("source",{srcset:e,media:"(prefers-reduced-motion: reduce)"}),r("img",{src:n,alt:t,class:"shortcode-emoji emoji",width:"16",height:"16",loading:"lazy",decoding:"async",fetchPriority:"low"},t||n)]})}const nl=Oe(e=>new RegExp(`:(${e.join("|")}):`,"g"));function ol({text:e,emojis:t}){if(!e)return"";if(!(t!=null&&t.length)||e.indexOf(":")===-1)return e;const n=nl(t.map(i=>i.shortcode));return e.split(n).map((i,s)=>{const a=t.find(c=>c.shortcode===i);if(a){const{url:c,staticUrl:l}=a;return r(ir,{staticUrl:l,alt:i,url:c},i+"-"+s)}return i})}const qt=Oe(ol),rl=Oe(e=>{const t={sensitivity:"base"};try{return new Intl.Collator(e||void 0,t)}catch{return new Intl.Collator(void 0,t)}}),il=/([^@]+)(@.+)/i,sl=/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g,al=/\s+/g,cl=/[^a-z0-9@\.]/gi;function ll({account:e,instance:t,showAvatar:n,showAcct:o,short:i,external:s,onClick:a}){const{i18n:c}=po(),{acct:l,avatar:d,avatarStatic:f,id:u,url:p,displayName:h,emojis:m,bot:g,username:v}=e,[T,y,w]=l.match(il)||[,l];t||(t=so().instance);const E=v.toLowerCase().trim(),x=(h||"").toLowerCase().trim(),b=x.replace(sl,"").replace(al,""),S=b.replace(cl,""),D=!i&&(E===x||E===b||E===S||rl(c.locale).compare(E,b)===0)||S===l.toLowerCase();return r("a",{class:`name-text ${o?"show-acct":""} ${i?"short":""}`,href:p,target:s?"_blank":null,title:h?`${h} (${w?"":"@"}${l})`:`${w?"":"@"}${l}`,onClick:L=>{if(!s&&!L.shiftKey){if(L.preventDefault(),L.stopPropagation(),a)return a(L);if(L.metaKey||L.ctrlKey||L.shiftKey||L.which===2){const A=`#/${t}/a/${u}`;window.open(A,"_blank");return}B.showAccount={account:e,instance:t}}},children:[n&&r(F,{children:[r(st,{url:f||d,squircle:g})," "]}),h&&!i?r(F,{children:[r("b",{dir:"auto",children:r(qt,{text:h,emojis:m})}),!o&&!D&&r(F,{children:[" ",r("i",{class:"bidi-isolate",children:["@",v]})]})]}):i?r("i",{children:v}):r("b",{children:v}),o&&r(F,{children:[r("br",{}),r("i",{class:"bidi-isolate",children:[w?"":"@",y,!!w&&r("span",{class:"ib",children:w})]})]})]})}const gt=Oe(ll),Wn={"zh-YUE":"YUE",zh_HANT:"zh-Hant"},Mo=Oe(e=>new Intl.DisplayNames(e||void 0,{type:"language"}));function ul(e){let t,n;typeof e=="object"&&({code:e,locale:t,fallback:n}=e);try{const o=Mo(t||k.locale).of(e);if(o!==e)return o;if(!n){const i=Mo(e).of(e);if(i!==e)return i}return n||""}catch{if(Wn[e])try{const i=Mo(Wn[t]||t||k.locale).of(Wn[e]);return i!==Wn[e]?i:n||""}catch{}return n||""}}const ln=Oe(ul);function ui(e){if(e instanceof Date)return!isNaN(e.getTime());{const t=new Date(e);return!isNaN(t.getTime())}}const dl=Oe(()=>new Intl.DateTimeFormat().resolvedOptions().locale),di=Oe((e,t={})=>{const n=e.replace(/-[a-z]+$/i,""),o=bn([n],[dl()],e);try{return new Intl.DateTimeFormat(o,t)}catch{}try{return new Intl.DateTimeFormat(e,t)}catch{}return new Intl.DateTimeFormat(void 0,t)}),fl=Oe(e=>new Intl.RelativeTimeFormat(e||void 0)),Yt=60,Xt=60*Yt,sr=24*Xt,hl=e=>{const t=fl(k.locale),n=(e.getTime()-Date.now())/1e3,o=Math.abs(n);return o{const t=(Date.now()-e.getTime())/1e3;return tl+1,0),i=ae(()=>new Date(e),[e]),[s,a,c]=ae(()=>{if(!ui(i))return[""+e,"",""];let l;if(t==="micro"){const d=new Date;(d.getTime()-i.getTime())/1e3/sr<=1?l=pl(i):d.getFullYear()===i.getFullYear()?l=di(k.locale,{year:void 0,month:"short",day:"numeric"}).format(i):l=di(k.locale,{dateStyle:"short"}).format(i)}return l||(l=hl(i)),[l,i.toISOString(),i.toLocaleString()]},[i,t,n]);return ee(()=>{if(!ui(i))return;let l,d;function f(){d=requestAnimationFrame(()=>{o(),u()})}function u(){const p=(Date.now()-i.getTime())/1e3;p{clearTimeout(l),cancelAnimationFrame(d)}},[]),r("time",{datetime:a,title:c,children:s})}const ml=[{code:"af",name:"Afrikaans"},{code:"sq",name:"Albanian"},{code:"am",name:"Amharic"},{code:"ar",name:"Arabic"},{code:"hy",name:"Armenian"},{code:"as",name:"Assamese"},{code:"ay",name:"Aymara"},{code:"az",name:"Azerbaijani"},{code:"bm",name:"Bambara"},{code:"eu",name:"Basque"},{code:"be",name:"Belarusian"},{code:"bn",name:"Bengali"},{code:"bho",name:"Bhojpuri"},{code:"bs",name:"Bosnian"},{code:"bg",name:"Bulgarian"},{code:"ca",name:"Catalan"},{code:"ceb",name:"Cebuano"},{code:"ny",name:"Chichewa"},{code:"zh",name:"Chinese"},{code:"zh_HANT",name:"Chinese (Traditional)"},{code:"co",name:"Corsican"},{code:"hr",name:"Croatian"},{code:"cs",name:"Czech"},{code:"da",name:"Danish"},{code:"dv",name:"Dhivehi"},{code:"doi",name:"Dogri"},{code:"nl",name:"Dutch"},{code:"en",name:"English"},{code:"eo",name:"Esperanto"},{code:"et",name:"Estonian"},{code:"ee",name:"Ewe"},{code:"tl",name:"Filipino"},{code:"fi",name:"Finnish"},{code:"fr",name:"French"},{code:"fy",name:"Frisian"},{code:"gl",name:"Galician"},{code:"ka",name:"Georgian"},{code:"de",name:"German"},{code:"el",name:"Greek"},{code:"gn",name:"Guarani"},{code:"gu",name:"Gujarati"},{code:"ht",name:"Haitian Creole"},{code:"ha",name:"Hausa"},{code:"haw",name:"Hawaiian"},{code:"iw",name:"Hebrew"},{code:"hi",name:"Hindi"},{code:"hmn",name:"Hmong"},{code:"hu",name:"Hungarian"},{code:"is",name:"Icelandic"},{code:"ig",name:"Igbo"},{code:"ilo",name:"Ilocano"},{code:"id",name:"Indonesian"},{code:"ga",name:"Irish"},{code:"it",name:"Italian"},{code:"ja",name:"Japanese"},{code:"jw",name:"Javanese"},{code:"kn",name:"Kannada"},{code:"kk",name:"Kazakh"},{code:"km",name:"Khmer"},{code:"rw",name:"Kinyarwanda"},{code:"gom",name:"Konkani"},{code:"ko",name:"Korean"},{code:"kri",name:"Krio"},{code:"ku",name:"Kurdish (Kurmanji)"},{code:"ckb",name:"Kurdish (Sorani)"},{code:"ky",name:"Kyrgyz"},{code:"lo",name:"Lao"},{code:"la",name:"Latin"},{code:"lv",name:"Latvian"},{code:"ln",name:"Lingala"},{code:"lt",name:"Lithuanian"},{code:"lg",name:"Luganda"},{code:"lb",name:"Luxembourgish"},{code:"mk",name:"Macedonian"},{code:"mai",name:"Maithili"},{code:"mg",name:"Malagasy"},{code:"ms",name:"Malay"},{code:"ml",name:"Malayalam"},{code:"mt",name:"Maltese"},{code:"mi",name:"Maori"},{code:"mr",name:"Marathi"},{code:"mni-Mtei",name:"Meiteilon (Manipuri)"},{code:"lus",name:"Mizo"},{code:"mn",name:"Mongolian"},{code:"my",name:"Myanmar (Burmese)"},{code:"ne",name:"Nepali"},{code:"no",name:"Norwegian"},{code:"or",name:"Odia (Oriya)"},{code:"om",name:"Oromo"},{code:"ps",name:"Pashto"},{code:"fa",name:"Persian"},{code:"pl",name:"Polish"},{code:"pt",name:"Portuguese"},{code:"pa",name:"Punjabi"},{code:"qu",name:"Quechua"},{code:"ro",name:"Romanian"},{code:"ru",name:"Russian"},{code:"sm",name:"Samoan"},{code:"sa",name:"Sanskrit"},{code:"gd",name:"Scots Gaelic"},{code:"nso",name:"Sepedi"},{code:"sr",name:"Serbian"},{code:"st",name:"Sesotho"},{code:"sn",name:"Shona"},{code:"sd",name:"Sindhi"},{code:"si",name:"Sinhala"},{code:"sk",name:"Slovak"},{code:"sl",name:"Slovenian"},{code:"so",name:"Somali"},{code:"es",name:"Spanish"},{code:"su",name:"Sundanese"},{code:"sw",name:"Swahili"},{code:"sv",name:"Swedish"},{code:"tg",name:"Tajik"},{code:"ta",name:"Tamil"},{code:"tt",name:"Tatar"},{code:"te",name:"Telugu"},{code:"th",name:"Thai"},{code:"ti",name:"Tigrinya"},{code:"ts",name:"Tsonga"},{code:"tr",name:"Turkish"},{code:"tk",name:"Turkmen"},{code:"ak",name:"Twi"},{code:"uk",name:"Ukrainian"},{code:"ur",name:"Urdu"},{code:"ug",name:"Uyghur"},{code:"uz",name:"Uzbek"},{code:"vi",name:"Vietnamese"},{code:"cy",name:"Welsh"},{code:"xh",name:"Xhosa"},{code:"yi",name:"Yiddish"},{code:"yo",name:"Yoruba"},{code:"zu",name:"Zulu"}],gl=Oe(()=>[new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages]),vl=()=>bn(gl(),ml.map(e=>e.code.replace("_","-")),"en");function bs(e=!1){if(e){const{contentTranslationTargetLanguage:t}=B.settings;if(t)return t}return vl()}const fi=["byte","kilobyte","megabyte","gigabyte","terabyte","petabyte"];function Jf(e){const t=Math.min(Math.floor(Math.log2(e)/10),fi.length-1),n=e/1024**t;return k.number(n,{style:"unit",unit:fi[t],unitDisplay:"narrow",maximumFractionDigits:0})}const _l=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,fo=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(_l);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},hi=e=>e==="*"||e==="x"||e==="X",pi=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},yl=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],bl=(e,t)=>{if(hi(e)||hi(t))return 0;const[n,o]=yl(pi(e),pi(t));return n>o?1:n{for(let n=0;n{const n=fo(e),o=fo(t),i=n.pop(),s=o.pop(),a=jt(n,o);return a!==0?a:i&&s?jt(i.split("."),s.split(".")):i||s?i?-1:1:0},wl=(e,t,n)=>{El(n);const o=Tl(e,t);return Ts[n].includes(o)},Ts={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},mi=Object.keys(Ts),El=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(mi.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${mi.join("|")}`)},no=(e,t)=>{if(t=t.replace(/([><=]+)\s+/g,"$1"),t.includes("||"))return t.split("||").some(v=>no(e,v));if(t.includes(" - ")){const[v,T]=t.split(" - ",2);return no(e,`>=${v} <=${T}`)}else if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every(v=>no(e,v));const n=t.match(/^([<>=~^]+)/),o=n?n[1]:"=";if(o!=="^"&&o!=="~")return wl(e,t,o);const[i,s,a,,c]=fo(e),[l,d,f,,u]=fo(t),p=[i,s,a],h=[l,d??"x",f??"x"];if(u&&(!c||jt(p,h)!==0||jt(c.split("."),u.split("."))===-1))return!1;const m=h.findIndex(v=>v!=="0")+1,g=o==="~"?2:m>1?m:1;return!(jt(p.slice(0,g),h.slice(0,g))!==0||jt(p.slice(g),h.slice(g))===-1)};const xl={"@mastodon/edit-media-attributes":">=4.1","@mastodon/list-exclusive":">=4.2","@gotosocial/list-exclusive":">=0.17","@mastodon/filtered-notifications":"~4.3 || >=4.3","@mastodon/fetch-multiple-statuses":"~4.3 || >=4.3","@mastodon/trending-link-posts":"~4.3 || >=4.3","@mastodon/grouped-notifications":"~4.3 || >=4.3","@mastodon/annual-report":"~4.4 || >=4.4"},Ro=/pixelfed/i,ot=/^(?!.*pixelfed).*$/i,kl=/pleroma/i,Sl=/akkoma/i;const gi={"@mastodon/lists":ot,"@mastodon/filters":ot,"@mastodon/mentions":ot,"@mastodon/trending-hashtags":ot,"@mastodon/trending-links":ot,"@mastodon/post-bookmark":ot,"@mastodon/post-edit":ot,"@mastodon/profile-edit":ot,"@mastodon/profile-private-note":ot,"@pixelfed/trending":Ro,"@pixelfed/home-include-reblogs":Ro,"@pixelfed/global-feed":Ro,"@pleroma/local-visibility-post":kl,"@akkoma/local-visibility-post":Sl},Kn={};function Zn(e){var t,n;try{let{version:o,domain:i}=Ma(),s=((n=(t=Ra())==null?void 0:t.software)==null?void 0:n.name)||"mastodon";s==="hometown"&&(s="mastodon");const a=`${i}-${e}`;if(Kn[a])return Kn[a];if(gi[e])return Kn[a]=gi[e].test(o);const c=xl[e];if(!c)return!1;const d=e.match(/^@([a-z]+)\//)[1]===s.toLowerCase();return Kn[a]=d&&no(o,c,{includePrerelease:!0,loose:!0})}catch{return!1}}const Zt=2147483647,Ye=36,Ar=1,xn=26,Il=38,Al=700,ws=72,Es=128,xs="-",Cl=/^xn--/,Pl=/[^\0-\x7F]/,Ll=/[\x2E\u3002\uFF0E\uFF61]/g,Ml={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Oo=Ye-Ar,Xe=Math.floor,Do=String.fromCharCode;function ht(e){throw new RangeError(Ml[e])}function Rl(e,t){const n=[];let o=e.length;for(;o--;)n[o]=t(e[o]);return n}function ks(e,t){const n=e.split("@");let o="";n.length>1&&(o=n[0]+"@",e=n[1]),e=e.replace(Ll,".");const i=e.split("."),s=Rl(i,t).join(".");return o+s}function Ss(e){const t=[];let n=0;const o=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Dl=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Ye},vi=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Is=function(e,t,n){let o=0;for(e=n?Xe(e/Al):e>>1,e+=Xe(e/t);e>Oo*xn>>1;o+=Ye)e=Xe(e/Oo);return Xe(o+(Oo+1)*e/(e+Il))},As=function(e){const t=[],n=e.length;let o=0,i=Es,s=ws,a=e.lastIndexOf(xs);a<0&&(a=0);for(let c=0;c=128&&ht("not-basic"),t.push(e.charCodeAt(c));for(let c=a>0?a+1:0;c=n&&ht("invalid-input");const p=Dl(e.charCodeAt(c++));p>=Ye&&ht("invalid-input"),p>Xe((Zt-o)/f)&&ht("overflow"),o+=p*f;const h=u<=s?Ar:u>=s+xn?xn:u-s;if(pXe(Zt/m)&&ht("overflow"),f*=m}const d=t.length+1;s=Is(o-l,d,l==0),Xe(o/d)>Zt-i&&ht("overflow"),i+=Xe(o/d),o%=d,t.splice(o++,0,i)}return String.fromCodePoint(...t)},Cs=function(e){const t=[];e=Ss(e);const n=e.length;let o=Es,i=0,s=ws;for(const l of e)l<128&&t.push(Do(l));const a=t.length;let c=a;for(a&&t.push(xs);c=o&&fXe((Zt-i)/d)&&ht("overflow"),i+=(l-o)*d,o=l;for(const f of e)if(fZt&&ht("overflow"),f===o){let u=i;for(let p=Ye;;p+=Ye){const h=p<=s?Ar:p>=s+xn?xn:p-s;if(u{const{shortcode:o,staticUrl:i,url:s}=n;e=e.replace(new RegExp(`:${o}:`,"g"),`:${o}:`)}),e):""}const zt=document.createElement("div"),Fl=["u-url","mention","hashtag"],zl=/[&<>]/g;function $o(e){return e.replace(zl,t=>({"&":"&","<":"<",">":">"})[t])}const Vl=/{}}=t;let s=e;const a=Ql(s,o),c=Vl.test(s),l=s.includes("```");if(c){const f=a.querySelectorAll('a:not([target="_blank"])');for(const p of f)p.setAttribute("target","_blank");const u=a.querySelectorAll("a[class]");for(const p of u)for(const h of p.classList)Fl.includes(h)||p.classList.remove(h)}if(c){const f=a.querySelectorAll("a[href]");for(const u of f)Hl.test(u.textContent.trim())&&(u.classList.add("has-url-text"),ou(u))}if(c){const f=a.querySelectorAll("a[href]"),u=[];for(const p of f){const h=p.innerText.trim(),m=p.querySelector("*");if(Bl.test(h)){const[g,v,T]=h.split("@");m||(!u.some(([y])=>y===v)||u.some(([y,w])=>y===v&&w===T)?(p.innerHTML=`@${v}`,u.push([v,T])):p.innerHTML=`@${v}@${T}`),p.classList.add("mention")}Ul.test(h)&&(m||(p.innerHTML=`#${h.slice(1)}`),p.classList.add("mention","hashtag"))}}let d;if(s.includes(":")&&(n!=null&&n.length)){d=Fo(a);for(const f of d){let u=$o(f.nodeValue);u=ar(u,n),zt.innerHTML=u,f.replaceWith(...zt.childNodes)}}if(l){const f=[...a.querySelectorAll("p")].filter(u=>jl.test(u.innerText.trim()));for(const u of f){const p=document.createElement("pre");for(const h of u.querySelectorAll("br"))h.replaceWith(` +`);p.innerHTML=`${u.innerHTML.trim()}`,u.replaceWith(p)}}if(l){const u=[...a.querySelectorAll("p")].filter(p=>Wl.test(p.innerText));for(const p of u){const h=[p];let m=!1,g=p;for(;g.nextElementSibling;){const v=g.nextElementSibling;if(v&&v.tagName==="P")if(Kl.test(v.innerText)){h.push(v),m=!0;break}else h.push(v);else break;g=v}if(m){const v=document.createElement("pre");for(const y of h)for(const w of y.querySelectorAll("br"))w.replaceWith(` +`);const T=h.map(y=>y.innerHTML).join(` + +`);v.innerHTML=`${T}`,p.replaceWith(v);for(const y of h)y.remove()}}}if(s.includes("`")){d=Fo(a);for(const f of d){let u=$o(f.nodeValue);Zl.test(u)&&(u=u.replaceAll(Xl,"$1")),zt.innerHTML=u,f.replaceWith(...zt.childNodes)}}if(Gl.test(s)){d=Fo(a,{rejectFilter:["A"]});for(const f of d){let u=$o(f.nodeValue);ql.test(u)&&(u=u.replaceAll(Yl,'$1')),zt.innerHTML=u,f.replaceWith(...zt.childNodes)}}if(s.includes("#")){let f=null;const u=[...a.querySelectorAll("p")].filter((p,h)=>{let m=0;for(let g=0;g3||m>1&&f&&h===f+1)return f=h,!0});if(u!=null&&u.length)for(const p of u)p.classList.add("hashtag-stuffing"),p.title=p.innerText}if(s.includes("i(a)),o?a:a.innerHTML}const Ls=Oe(Jl),eu=["STYLE","IMG","VIDEO","AUDIO","AREA","MAP","TRACK","EMBED","IFRAME","OBJECT","PICTURE","PORTAL","SOURCE","SVG","MATH","CANVAS","NOSCRIPT","SCRIPT","INPUT","OPTION","TEXTAREA","SLOT","TEMPLATE"],tu=Object.fromEntries(eu.map(e=>[e,!0])),nu=/^(https?:\/\/(www\.)?|xmpp:)/,No=30;function ou(e){var t;if(!(!e||(t=e.querySelector)!=null&&t.call(e,"*")))try{const n=e.innerText.trim(),o=(n.match(nu)||[])[0]||"";if(!o)return;const i=n.slice(o.length,o.length+No),s=n.slice(o.length+No),a=n.slice(o.length).length>No;e.innerHTML=`${i}`}catch{}}function Fo(e,t={}){var a;const n=[],o=Object.assign({},tu,(a=t.rejectFilter)==null?void 0:a.reduce((c,l)=>(c[l]=!0,c),{})),i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(c){return o[c.parentNode.nodeName]?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1);let s;for(;s=i.nextNode();)n.push(s);return n}const Vt=document.createElement("div");function ru(e,t){if(!e)return"";const{preProcess:n}=t||{};return Vt.innerHTML=e.replace(/<\/p>/g,`

    + +`).replace(/<\/li>/g,` +`),Vt.querySelectorAll("br").forEach(o=>{o.replaceWith(` +`)}),n==null||n(Vt),Vt.querySelectorAll(".invisible").forEach(o=>{o.remove()}),Vt.querySelectorAll(".ellipsis").forEach(o=>{o.append("...")}),Vt.innerText.replace(/[\r\n]{3,}/g,` + +`).trim()}const _o=Oe(ru);function iu(e){const{mentions:t=[],instance:n,previewMode:o,statusURL:i}=e||{};return s=>{var f,u;let{target:a}=s;if(a=a.closest("a"),!a||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.which===2)return;const c=(f=a.previousSibling)==null?void 0:f.textContent,l=c==null?void 0:c.endsWith("@"),d=a.innerText.startsWith("@");if((a.classList.contains("u-url")||a.classList.contains("mention"))&&d||l&&!d){const p=(a.querySelector("span")||a).innerText.trim(),h=p.replace(/^@/,""),m=a.getAttribute("href"),g=t.find(v=>v.url===m)||t.find(v=>v.acct===h||v.username===h);if(g)s.preventDefault(),s.stopPropagation(),B.showAccount={account:g.acct,instance:n};else if(!/^http/i.test(p)){s.preventDefault(),s.stopPropagation();const v=a.getAttribute("href");B.showAccount={account:v,instance:n}}}else if(!o){const p=c==null?void 0:c.endsWith("#");if(a.classList.contains("hashtag")||p){s.preventDefault(),s.stopPropagation();const h=a.innerText.replace(/^#/,"").trim(),m=n?`#/${n}/t/${h}`:`#/t/${h}`;location.hash=m}else(u=B.unfurledLinks[a.href])!=null&&u.url&&i!==a.href&&(s.preventDefault(),s.stopPropagation(),B.prevLocation={pathname:location.hash.replace(/^#/,"")},location.hash=`#${B.unfurledLinks[a.href].url}`)}}}function eh(e,t){return()=>k.number(e,{style:"unit",unit:t,unitDisplay:"long"})}const su=Oe(()=>new Intl.DateTimeFormat().resolvedOptions().locale),au=e=>{const{locale:t,dateYear:n,hideTime:o,formatOpts:i,forceOpts:s}=e||{},a=t.replace(/-[a-z]+$/i,""),c=bn([a],[su],t),l=new Date().getFullYear(),d=s||{year:n===l?void 0:"numeric",month:"short",day:"numeric",hour:o?void 0:"numeric",minute:o?void 0:"numeric",...i};try{return Intl.DateTimeFormat(c,d)}catch{}try{return Intl.DateTimeFormat(t,d)}catch{}return Intl.DateTimeFormat(void 0,d)},cu=Oe(au);function kn(e,t){return e instanceof Date||(e=new Date(e)),cu({dateYear:e.getFullYear(),locale:k.locale,...t}).format(e)}function rt(e){try{return k.number(e,{notation:"compact",roundingMode:"floor"})}catch{return e}}const _i=5e3;function Gn(e){if(e||(e=!0),B.showCompose){B.composerState.minimized?Re({duration:_i,text:k._({id:"/4fHR1"})}):Re({duration:_i,text:k._({id:"vvl08N"})});return}sc(),B.showCompose=e}function th({skeleton:e,account:t,avatarSize:n="xl",useAvatarStatic:o=!1,instance:i,external:s,internal:a,onClick:c,showActivity:l=!1,showStats:d=!1,accountInstance:f,hideDisplayName:u=!1,relationship:p={},excludeRelationshipAttrs:h=[]}){if(e)return r("div",{class:"account-block skeleton",children:[r(st,{size:n}),r("span",{children:[r("b",{children:"████████"}),r("br",{}),r("span",{class:"account-block-acct",children:"██████"})]})]});if(!t)return null;const{id:m,acct:g,avatar:v,avatarStatic:T,displayName:y,username:w,emojis:E,url:x,statusesCount:b,lastStatusAt:S,bot:D,fields:L,note:A,group:C,followersCount:R,createdAt:K,locked:U}=t;let[oe,Q,re]=g.match(/([^@]+)(@.+)/i)||[,g];f&&(re=`@${f}`);const q=L==null?void 0:L.find(se=>!!se.verifiedAt&&!!se.value),ie={};for(const se in p)h.includes(se)||(ie[se]=p[se]);const ce=ie.following||ie.followedBy||ie.requested;return r("a",{class:"account-block",href:x,target:s?"_blank":null,title:re?g:`@${g}`,onClick:se=>{if(!s){if(se.preventDefault(),c)return c(se);a?location.hash=`/${i}/a/${m}`:B.showAccount={account:t,instance:i}}},children:[r("div",{class:"avatar-container",children:r(st,{url:o?T:v||T,size:n,squircle:D})}),r("span",{class:"account-block-content",children:[!u&&r(F,{children:y?r("b",{children:r(qt,{text:y,emojis:E})}):r("b",{children:w})})," ",r("span",{class:"account-block-acct bidi-isolate",children:[re?"":"@",Q,r("wbr",{}),re,U&&r(F,{children:[" ",r(M,{icon:"lock",size:"s",alt:k._({id:"G2fuEb"})})]})]}),l&&r("div",{class:"account-block-stats",children:[r(O,{id:"ajzDof",values:{0:rt(b)}}),!!S&&r(F,{children:[" ","·"," ",r(O,{id:"f8bJ3C",values:{0:kn(S,{hideTime:!0})}})]})]}),d&&r("div",{class:"account-block-stats",children:[D&&r(F,{children:r("span",{class:"tag collapsed",children:[r(M,{icon:"bot"})," ",r(O,{id:"9Vdq+j"})]})}),!!C&&r(F,{children:r("span",{class:"tag collapsed",children:[r(M,{icon:"group"})," ",r(O,{id:"L8fEEm"})]})}),ce&&r("div",{class:"shazam-container-horizontal",children:r("div",{class:"shazam-container-inner",children:ie.following&&ie.followedBy?r("span",{class:"tag minimal",children:r(O,{id:"7oRLbi"})}):ie.requested?r("span",{class:"tag minimal",children:r(O,{id:"Yx0Ud8"})}):ie.following?r("span",{class:"tag minimal",children:r(O,{id:"y6sq5j"})}):ie.followedBy?r("span",{class:"tag minimal",children:r(O,{id:"p3UO/y"})}):null})},p.id),!!R&&r("span",{class:"ib",children:r(O,{id:"Mn1E9C",values:{followersCount:R}})}),!!q&&r("span",{class:"verified-field",children:[r(M,{icon:"check-circle",size:"s",alt:k._({id:"QDEWii"})})," ",r("span",{dangerouslySetInnerHTML:{__html:Ls(q.value,{emojis:E})}})]}),!D&&!C&&!ce&&!R&&!q&&!!K&&r("span",{class:"created-at",children:r(O,{id:"PCcEFZ",values:{0:kn(K,{hideTime:!0})},components:{0:r("time",{datetime:K})}})})]})]})]})}var Ms={};function Ze(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var lu=Ze;Ze.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Ze.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Ze.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};Ze.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ze.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Ze.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Ze.prototype.start=Ze.prototype.try;Ze.prototype.errors=function(){return this._errors};Ze.prototype.attempts=function(){return this._attempts};Ze.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,o=0;o=n&&(t=i,n=a)}return t};(function(e){var t=lu;e.operation=function(n){var o=e.timeouts(n);return new t(o,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(n){if(n instanceof Array)return[].concat(n);var o={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in n)o[i]=n[i];if(o.minTimeout>o.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],a=0;afu.call(e)==="[object Error]",pu=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed"]);function mu(e){return e&&hu(e)&&e.name==="TypeError"&&typeof e.message=="string"?e.message==="Load failed"?e.stack===void 0:pu.has(e.message):!1}class gu extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const yi=(e,t,n)=>{const o=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=o,e};async function vu(e,t){return new Promise((n,o)=>{t={...t},t.onFailedAttempt??(t.onFailedAttempt=()=>{}),t.shouldRetry??(t.shouldRetry=()=>!0),t.retries??(t.retries=10);const i=du.operation(t),s=()=>{var c;i.stop(),o((c=t.signal)==null?void 0:c.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",s,{once:!0});const a=()=>{var c;(c=t.signal)==null||c.removeEventListener("abort",s),i.stop()};i.attempt(async c=>{try{const l=await e(c);a(),n(l)}catch(l){try{if(!(l instanceof Error))throw new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`);if(l instanceof gu)throw l.originalError;if(l instanceof TypeError&&!mu(l))throw l;if(yi(l,c,t),await t.shouldRetry(l)||(i.stop(),o(l)),await t.onFailedAttempt(l),!i.retry(l))throw i.mainError()}catch(d){yi(d,c,t),a(),o(d)}}})})}const _u=[{code:"auto",name:"Detect"},{code:"af",name:"Afrikaans"},{code:"sq",name:"Albanian"},{code:"am",name:"Amharic"},{code:"ar",name:"Arabic"},{code:"hy",name:"Armenian"},{code:"as",name:"Assamese"},{code:"ay",name:"Aymara"},{code:"az",name:"Azerbaijani"},{code:"bm",name:"Bambara"},{code:"eu",name:"Basque"},{code:"be",name:"Belarusian"},{code:"bn",name:"Bengali"},{code:"bho",name:"Bhojpuri"},{code:"bs",name:"Bosnian"},{code:"bg",name:"Bulgarian"},{code:"ca",name:"Catalan"},{code:"ceb",name:"Cebuano"},{code:"ny",name:"Chichewa"},{code:"zh",name:"Chinese"},{code:"co",name:"Corsican"},{code:"hr",name:"Croatian"},{code:"cs",name:"Czech"},{code:"da",name:"Danish"},{code:"dv",name:"Dhivehi"},{code:"doi",name:"Dogri"},{code:"nl",name:"Dutch"},{code:"en",name:"English"},{code:"eo",name:"Esperanto"},{code:"et",name:"Estonian"},{code:"ee",name:"Ewe"},{code:"tl",name:"Filipino"},{code:"fi",name:"Finnish"},{code:"fr",name:"French"},{code:"fy",name:"Frisian"},{code:"gl",name:"Galician"},{code:"ka",name:"Georgian"},{code:"de",name:"German"},{code:"el",name:"Greek"},{code:"gn",name:"Guarani"},{code:"gu",name:"Gujarati"},{code:"ht",name:"Haitian Creole"},{code:"ha",name:"Hausa"},{code:"haw",name:"Hawaiian"},{code:"iw",name:"Hebrew"},{code:"hi",name:"Hindi"},{code:"hmn",name:"Hmong"},{code:"hu",name:"Hungarian"},{code:"is",name:"Icelandic"},{code:"ig",name:"Igbo"},{code:"ilo",name:"Ilocano"},{code:"id",name:"Indonesian"},{code:"ga",name:"Irish"},{code:"it",name:"Italian"},{code:"ja",name:"Japanese"},{code:"jw",name:"Javanese"},{code:"kn",name:"Kannada"},{code:"kk",name:"Kazakh"},{code:"km",name:"Khmer"},{code:"rw",name:"Kinyarwanda"},{code:"gom",name:"Konkani"},{code:"ko",name:"Korean"},{code:"kri",name:"Krio"},{code:"ku",name:"Kurdish (Kurmanji)"},{code:"ckb",name:"Kurdish (Sorani)"},{code:"ky",name:"Kyrgyz"},{code:"lo",name:"Lao"},{code:"la",name:"Latin"},{code:"lv",name:"Latvian"},{code:"ln",name:"Lingala"},{code:"lt",name:"Lithuanian"},{code:"lg",name:"Luganda"},{code:"lb",name:"Luxembourgish"},{code:"mk",name:"Macedonian"},{code:"mai",name:"Maithili"},{code:"mg",name:"Malagasy"},{code:"ms",name:"Malay"},{code:"ml",name:"Malayalam"},{code:"mt",name:"Maltese"},{code:"mi",name:"Maori"},{code:"mr",name:"Marathi"},{code:"mni-Mtei",name:"Meiteilon (Manipuri)"},{code:"lus",name:"Mizo"},{code:"mn",name:"Mongolian"},{code:"my",name:"Myanmar (Burmese)"},{code:"ne",name:"Nepali"},{code:"no",name:"Norwegian"},{code:"or",name:"Odia (Oriya)"},{code:"om",name:"Oromo"},{code:"ps",name:"Pashto"},{code:"fa",name:"Persian"},{code:"pl",name:"Polish"},{code:"pt",name:"Portuguese"},{code:"pa",name:"Punjabi"},{code:"qu",name:"Quechua"},{code:"ro",name:"Romanian"},{code:"ru",name:"Russian"},{code:"sm",name:"Samoan"},{code:"sa",name:"Sanskrit"},{code:"gd",name:"Scots Gaelic"},{code:"nso",name:"Sepedi"},{code:"sr",name:"Serbian"},{code:"st",name:"Sesotho"},{code:"sn",name:"Shona"},{code:"sd",name:"Sindhi"},{code:"si",name:"Sinhala"},{code:"sk",name:"Slovak"},{code:"sl",name:"Slovenian"},{code:"so",name:"Somali"},{code:"es",name:"Spanish"},{code:"su",name:"Sundanese"},{code:"sw",name:"Swahili"},{code:"sv",name:"Swedish"},{code:"tg",name:"Tajik"},{code:"ta",name:"Tamil"},{code:"tt",name:"Tatar"},{code:"te",name:"Telugu"},{code:"th",name:"Thai"},{code:"ti",name:"Tigrinya"},{code:"ts",name:"Tsonga"},{code:"tr",name:"Turkish"},{code:"tk",name:"Turkmen"},{code:"ak",name:"Twi"},{code:"uk",name:"Ukrainian"},{code:"ur",name:"Urdu"},{code:"ug",name:"Uyghur"},{code:"uz",name:"Uzbek"},{code:"vi",name:"Vietnamese"},{code:"cy",name:"Welsh"},{code:"xh",name:"Xhosa"},{code:"yi",name:"Yiddish"},{code:"yo",name:"Yoruba"},{code:"zu",name:"Zulu"}];var yu=Object.defineProperty,bu=(e,t,n)=>t in e?yu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qn=(e,t,n)=>bu(e,typeof t!="symbol"?t+"":t,n),cr=new Map,Yn=new WeakMap,bi=0,Tu=void 0;function wu(e){return e?(Yn.has(e)||(bi+=1,Yn.set(e,bi.toString())),Yn.get(e)):"0"}function Eu(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?wu(e.root):e[t]}`).toString()}function xu(e){const t=Eu(e);let n=cr.get(t);if(!n){const o=new Map;let i;const s=new IntersectionObserver(a=>{a.forEach(c=>{var l;const d=c.isIntersecting&&i.some(f=>c.intersectionRatio>=f);e.trackVisibility&&typeof c.isVisible>"u"&&(c.isVisible=d),(l=o.get(c.target))==null||l.forEach(f=>{f(d,c)})})},e);i=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:s,elements:o},cr.set(t,n)}return n}function Rs(e,t,n={},o=Tu){if(typeof window.IntersectionObserver>"u"&&o!==void 0){const l=e.getBoundingClientRect();return t(o,{isIntersecting:o,target:e,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:i,observer:s,elements:a}=xu(n),c=a.get(e)||[];return a.has(e)||a.set(e,c),c.push(t),s.observe(e),function(){c.splice(c.indexOf(t),1),c.length===0&&(a.delete(e),s.unobserve(e)),a.size===0&&(s.disconnect(),cr.delete(i))}}function ku(e){return typeof e.children!="function"}var nh=class extends Gi{constructor(e){super(e),qn(this,"node",null),qn(this,"_unobserveCb",null),qn(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=t||null,this.observeNode()}),qn(this,"handleChange",(t,n)=>{t&&this.props.triggerOnce&&this.unobserve(),ku(this.props)||this.setState({inView:t,entry:n}),this.props.onChange&&this.props.onChange(t,n)}),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){(e.rootMargin!==this.props.rootMargin||e.root!==this.props.root||e.threshold!==this.props.threshold||e.skip!==this.props.skip||e.trackVisibility!==this.props.trackVisibility||e.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:n,trackVisibility:o,delay:i,fallbackInView:s}=this.props;this._unobserveCb=Rs(this.node,this.handleChange,{threshold:e,root:t,rootMargin:n,trackVisibility:o,delay:i},s)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if(typeof e=="function"){const{inView:h,entry:m}=this.state;return e({inView:h,entry:m,ref:this.handleNode})}const{as:t,triggerOnce:n,threshold:o,root:i,rootMargin:s,onChange:a,skip:c,trackVisibility:l,delay:d,initialInView:f,fallbackInView:u,...p}=this.props;return Oa(t||"div",{ref:this.handleNode,...p},e)}};function Su({threshold:e,delay:t,trackVisibility:n,rootMargin:o,root:i,triggerOnce:s,skip:a,initialInView:c,fallbackInView:l,onChange:d}={}){var f;const[u,p]=Z(null),h=$(),[m,g]=Z({inView:!!c,entry:void 0});h.current=d,ee(()=>{if(a||!u)return;let w;return w=Rs(u,(E,x)=>{g({inView:E,entry:x}),h.current&&h.current(E,x),x.isIntersecting&&s&&w&&(w(),w=void 0)},{root:i,rootMargin:o,threshold:e,trackVisibility:n,delay:t},l),()=>{w&&w()}},[Array.isArray(e)?e.toString():e,u,i,o,s,a,n,l,t]);const v=(f=m.entry)==null?void 0:f.target,T=$();!u&&v&&!s&&!a&&T.current!==v&&(T.current=v,g({inView:!!c,entry:void 0}));const y=[p,m.inView,m.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y}const Ti=48,zo={};function Os({id:e,children:t}){const n=$(),o=!!zo[e],[i,s]=Z(!1),[a,c]=Z(o||!1),{ref:l}=Su({root:null,rootMargin:`-${Ti}px 0px 0px 0px`,trackVisibility:!0,delay:1e3,onChange:d=>{d&&(s(!0),e&&(zo[e]=!0))},triggerOnce:!0,skip:a||i});return ee(()=>{if(!n.current)return;const d=n.current.getBoundingClientRect();d.bottom>Ti&&(d.top{let i=gn[Vo];return fetch(`https://${i}/api/v1/${t}/${n}/${encodeURIComponent(e)}`).then(s=>{if(!s.ok)throw new Error(s.statusText);return s.json()}).then(s=>{var a;return{provider:"lingva",content:s.translation,detectedSourceLanguage:(a=s.info)==null?void 0:a.detectedSource,info:s.info}})},{retries:3,onFailedAttempt:i=>{Vo=(Vo+1)%gn.length}})}const Ds=1e3*60*60,$s=mo(Cu,{maxAge:Ds}),Pu=mo(Au($s),{maxAge:Ds});function Lu({forceTranslate:e,sourceLanguage:t,onTranslate:n,text:o="",mini:i,autoDetected:s}){const a=bs(!0),[c,l]=Z("default"),[d,f]=Z(null),[u,p]=Z(null),[h,m]=Z(null),g=$(),v=t?ln(t):null,T=ln(a),y=$("auto");n||(n=i?Pu:$s);const w=async()=>{var E,x;l("loading");try{const{content:b,detectedSourceLanguage:S,provider:D,error:L,...A}=await n(o,y.current,a);if(b){if(S){const C=ln(S);m(C)}if(D==="lingva"){const C=(x=(E=A==null?void 0:A.info)==null?void 0:E.pronunciation)==null?void 0:x.query;C&&f(C)}p(b),l("default"),!i&&b.trim()!==o.trim()&&(g.current.open=!0,g.current.scrollIntoView({behavior:"smooth",block:"nearest"}))}else l("error")}catch{l("error")}};return ee(()=>{e&&w()},[e]),i?u&&u.trim()!==o.trim()&&h!==T?r(Os,{children:r("div",{class:"status-translation-block-mini",children:[r(M,{icon:"translate",alt:k._({id:"zVJKbG",values:{sourceLangText:v}})}),r("output",{lang:a,dir:"auto",title:d||"",children:u})]})}):null:r("div",{class:"status-translation-block",onClick:E=>{E.preventDefault()},children:r("details",{ref:g,children:[r("summary",{children:r("button",{type:"button",onClick:async E=>{E.preventDefault(),E.stopPropagation(),g.current.open=!g.current.open,c!=="loading"&&(u||w())},children:[r(M,{icon:"translate"})," ",r("span",{children:c==="loading"?k._({id:"Zxkt/v"}):t&&v&&!h?s?k._({id:"R20Yf9",values:{sourceLangText:v}}):k._({id:"h8zDAI",values:{sourceLangText:v}}):k._({id:"pi8x/S"})})]})}),r("div",{class:"translated-block",children:[r("div",{class:"translation-info insignificant",children:[r("select",{class:"translated-source-select",disabled:c==="loading",onChange:E=>{y.current=E.target.value,w()},children:_u.map(E=>{const x=ln({code:E.code,fallback:E.name}),b=ln({code:E.code,locale:E.code}),S=x!==b;return r("option",{value:E.code,children:E.code==="auto"?k._({id:"Bze3gr",values:{0:h??"…"}}):S?`${b} - ${x}`:b})})})," ",r("span",{children:["→ ",T]}),r(Yi,{abrupt:!0,hidden:c!=="loading"})]}),c==="error"?r("p",{class:"ui-state",children:r(O,{id:"m5LihO"})}):!!u&&r(F,{children:[r("output",{class:"translated-content",lang:a,dir:"auto",children:u}),!!d&&r("output",{class:"translated-pronunciation-content",tabIndex:-1,onClick:E=>{E.target.classList.toggle("expand")},children:d})]})]})]})})}const Mu=gn!=null&&gn.length?Lu:()=>null;function ut(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Ns(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const o=ut(n);return(i,s)=>o.then(a=>s(a.transaction(t,i).objectStore(t)))}let Ho;function Lt(){return Ho||(Ho=Ns("keyval-store","keyval")),Ho}function Ru(e,t=Lt()){return t("readonly",n=>ut(n.get(e)))}function Ou(e,t,n=Lt()){return n("readwrite",o=>(o.put(t,e),ut(o.transaction)))}function Du(e,t=Lt()){return t("readonly",n=>Promise.all(e.map(o=>ut(n.get(o)))))}function $u(e,t=Lt()){return t("readwrite",n=>(n.delete(e),ut(n.transaction)))}function Nu(e,t=Lt()){return t("readwrite",n=>(e.forEach(o=>n.delete(o)),ut(n.transaction)))}function Fu(e=Lt()){return e("readwrite",t=>(t.clear(),ut(t.transaction)))}function zu(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},ut(e.transaction)}function Vu(e=Lt()){return e("readonly",t=>{if(t.getAllKeys)return ut(t.getAllKeys());const n=[];return zu(t,o=>n.push(o.key)).then(()=>n)})}function Ei(e,t){const n=Ns(e,t);return{set:(o,i)=>Ou(o,i,n),get:o=>Ru(o,n),getMany:o=>Du(o,n),del:o=>$u(o,n),delMany:o=>Nu(o,n),clear:()=>Fu(n),keys:()=>Vu(n)}}const oh={drafts:Ei("drafts-db","drafts-store"),catchup:Ei("catchup-db","catchup-store")};async function rh(e,t={}){if(!(e!=null&&e.length))return;const{masto:n}=so(),o=_r(),i=e.reduce((s,a)=>(!s.includes(a.id)&&!t[a.id]&&a.id!==o&&s.push(a.id),s),[]);if(!i.length)return null;try{return(await n.v1.accounts.relationships.fetch({id:i})).reduce((c,l)=>(c[l.id]=l,c),{})}catch{return null}}class Be extends HTMLElement{constructor(){super(),this.isIframeLoaded=!1,this.setupDom()}static get observedAttributes(){return["videoid","playlistid","videoplay","videotitle"]}connectedCallback(){this.addEventListener("pointerover",()=>Be.warmConnections(this),{once:!0}),this.addEventListener("click",()=>this.addIframe())}get videoId(){return encodeURIComponent(this.getAttribute("videoid")||"")}set videoId(t){this.setAttribute("videoid",t)}get playlistId(){return encodeURIComponent(this.getAttribute("playlistid")||"")}set playlistId(t){this.setAttribute("playlistid",t)}get videoTitle(){return this.getAttribute("videotitle")||"Video"}set videoTitle(t){this.setAttribute("videotitle",t)}get videoPlay(){return this.getAttribute("videoplay")||"Play"}set videoPlay(t){this.setAttribute("videoplay",t)}get videoStartAt(){return this.getAttribute("videoStartAt")||"0"}get autoLoad(){return this.hasAttribute("autoload")}get autoPause(){return this.hasAttribute("autopause")}get noCookie(){return this.hasAttribute("nocookie")}get posterQuality(){return this.getAttribute("posterquality")||"hqdefault"}get posterLoading(){return this.getAttribute("posterloading")||"lazy"}get params(){return`start=${this.videoStartAt}&${this.getAttribute("params")}`}set params(t){this.setAttribute("params",t)}setupDom(){const t=this.attachShadow({mode:"open"});let n="";window.liteYouTubeNonce&&(n=`nonce="${window.liteYouTubeNonce}"`),t.innerHTML=` + +
    + + + + + + + + +
    + `,this.domRefFrame=t.querySelector("#frame"),this.domRefImg={fallback:t.querySelector("#fallbackPlaceholder"),webp:t.querySelector("#webpPlaceholder"),jpeg:t.querySelector("#jpegPlaceholder")},this.domRefPlayButton=t.querySelector("#playButton")}setupComponent(){this.initImagePlaceholder(),this.domRefPlayButton.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),this.setAttribute("title",`${this.videoPlay}: ${this.videoTitle}`),(this.autoLoad||this.isYouTubeShort()||this.autoPause)&&this.initIntersectionObserver()}attributeChangedCallback(t,n,o){n!==o&&(this.setupComponent(),this.domRefFrame.classList.contains("activated")&&(this.domRefFrame.classList.remove("activated"),this.shadowRoot.querySelector("iframe").remove(),this.isIframeLoaded=!1))}addIframe(t=!1){if(!this.isIframeLoaded){let n=t?0:1;const o=this.noCookie?"-nocookie":"";let i;this.playlistId?i=`?listType=playlist&list=${this.playlistId}&`:i=`${this.videoId}?`,this.autoPause&&(this.params="enablejsapi=1"),this.isYouTubeShort()&&(this.params=`loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`,n=1);const s=` +`;this.domRefFrame.insertAdjacentHTML("beforeend",s),this.domRefFrame.classList.add("activated"),this.isIframeLoaded=!0,this.attemptShortAutoPlay(),this.dispatchEvent(new CustomEvent("liteYoutubeIframeLoaded",{detail:{videoId:this.videoId},bubbles:!0,cancelable:!0}))}}initImagePlaceholder(){var o,i;const t=`https://i.ytimg.com/vi_webp/${this.videoId}/${this.posterQuality}.webp`,n=`https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`;this.domRefImg.fallback.loading=this.posterLoading,this.domRefImg.webp.srcset=t,this.domRefImg.jpeg.srcset=n,this.domRefImg.fallback.src=n,this.domRefImg.fallback.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),(i=(o=this.domRefImg)==null?void 0:o.fallback)==null||i.setAttribute("alt",`${this.videoPlay}: ${this.videoTitle}`)}initIntersectionObserver(){const t={root:null,rootMargin:"0px",threshold:0};new IntersectionObserver((o,i)=>{o.forEach(s=>{s.isIntersecting&&!this.isIframeLoaded&&(Be.warmConnections(this),this.addIframe(!0),i.unobserve(this))})},t).observe(this),this.autoPause&&new IntersectionObserver((i,s)=>{i.forEach(a=>{var c,l;a.intersectionRatio!==1&&((l=(c=this.shadowRoot.querySelector("iframe"))==null?void 0:c.contentWindow)==null||l.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"))})},{threshold:1}).observe(this)}attemptShortAutoPlay(){this.isYouTubeShort()&&setTimeout(()=>{var t,n;(n=(t=this.shadowRoot.querySelector("iframe"))==null?void 0:t.contentWindow)==null||n.postMessage('{"event":"command","func":"playVideo","args":""}',"*")},2e3)}isYouTubeShort(){return this.getAttribute("short")===""&&window.matchMedia("(max-width: 40em)").matches}static addPrefetch(t,n){const o=document.createElement("link");o.rel=t,o.href=n,o.crossOrigin="true",document.head.append(o)}static warmConnections(t){Be.isPreconnected||window.liteYouTubeIsPreconnected||(Be.addPrefetch("preconnect","https://i.ytimg.com/"),Be.addPrefetch("preconnect","https://s.ytimg.com"),t.noCookie?Be.addPrefetch("preconnect","https://www.youtube-nocookie.com"):(Be.addPrefetch("preconnect","https://www.youtube.com"),Be.addPrefetch("preconnect","https://www.google.com"),Be.addPrefetch("preconnect","https://googleads.g.doubleclick.net"),Be.addPrefetch("preconnect","https://static.doubleclick.net")),Be.isPreconnected=!0,window.liteYouTubeIsPreconnected=!0)}}Be.isPreconnected=!1;customElements.define("lite-youtube",Be);const Fs=new Uint8Array(128);for(let e=0;e<83;e++)Fs["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".charCodeAt(e)]=e;const oo=(e,t,n)=>{let o=0;for(;te>10.31475?zs(e/Hs+.052132,2.4):e/Vs,Bo=e=>~~(e>1227e-8?Hs*zs(e,.416666)-13.025:e*Vs+1),vn=e=>(e<0?-1:1)*e*e,xi=e=>{for(e+=Sn/2;e>Sn;)e-=Hu;const t=1.27323954*e-.405284735*vn(e);return .225*(vn(t)-t)+t};function Cr(e){const t=oo(e,2,6);return[t>>16,t>>8&255,t&255]}function Uu(e,t,n,o){const i=oo(e,0,1),s=i%9+1,a=~~(i/9)+1,c=s*a;let l=0,d=0,f=0,u=0,p=0,h=0,m=0,g=0,v=0,T=0,y=0,w=0;const E=(oo(e,1,2)+1)/13446*(o|1),x=new Float64Array(c*3),b=Cr(e);for(l=0;l<3;l++)x[l]=Bu(b[l]);for(l=1;l{const n=t.char||" ",o=t.count||2;let i=0;const s=[];return e.reverse().reduce((a,c)=>{s.length&&i&&s[i]&&s[i]===c.substring(1,s[i].length+1)&&(s.splice(i,1),i--);const d=[`${n.repeat(i?i*o:0)}${c}`,...a];return c.substring(0,2)==="e.trim().replace(/(^(\s|\t)+|(( |\t)+)$)/gm,""),Ku=e=>{const t=Bs(e).split(` +`),n=[];let o="";for(let i=0;i")){n.push(`${o}${s.slice(0,-2)} />`),o="";continue}if(s.endsWith(">")){n.push(`${o}${s.startsWith(">")||s.startsWith("<")?"":" "}${s}`),o="";continue}o+=o.length?` ${s}`:s}return n};var Zu={mergeAttributesWithElements:Ku,removeEmptyLines:Bs};const Gu=Wu,{mergeAttributesWithElements:qu}=Zu,Yu=(e,t={})=>{const n=qu(e);return Gu(n,t)};var Xu=Yu;const Qu=vr(Xu);var hn=(e=>(e.Mouse="mouse",e.Touch="touch",e.Pointer="pointer",e))(hn||{}),pn=(e=>(e.CancelledByMovement="cancelled-by-movement",e.CancelledByRelease="cancelled-by-release",e.CancelledOutsideElement="cancelled-outside-element",e))(pn||{});const Us=()=>typeof window=="object"?(window==null?void 0:window.PointerEvent)??null:null,Ju=()=>typeof window=="object"?(window==null?void 0:window.TouchEvent)??null:null;function js(e){const{nativeEvent:t}=e,n=Ju();return n&&t instanceof n||"touches"in e}function Ws(e){const t=Us();return e.nativeEvent instanceof MouseEvent&&!(t&&e.nativeEvent instanceof t)}function Ks(e){const{nativeEvent:t}=e;if(!t)return!1;const n=Us();return n&&t instanceof n||"pointerId"in t}function ki(e){return Ws(e)||js(e)||Ks(e)}function Si(e){return js(e)?{x:e.touches[0].pageX,y:e.touches[0].pageY}:Ws(e)||Ks(e)?{x:e.pageX,y:e.pageY}:null}function ed(e){return{target:e.target,currentTarget:e.currentTarget,nativeEvent:e,persist:()=>{}}}function Zs(e,{threshold:t=400,captureEvent:n=!1,detect:o=hn.Pointer,cancelOnMovement:i=!1,cancelOutsideElement:s=!0,filterEvents:a,onStart:c,onMove:l,onFinish:d,onCancel:f}={}){const u=$(!1),p=$(!1),h=$(),m=$(),g=$(e),v=$(null),T=Me(x=>b=>{p.current||ki(b)&&(a!==void 0&&!a(b)||(n&&b.persist(),c==null||c(b,{context:x}),v.current=Si(b),p.current=!0,h.current=b.currentTarget,m.current=setTimeout(()=>{g.current&&(g.current(b,{context:x}),u.current=!0)},t)))},[n,a,c,t]),y=Me(x=>(b,S)=>{ki(b)&&p.current&&(v.current=null,n&&b.persist(),u.current?d==null||d(b,{context:x}):p.current&&(f==null||f(b,{context:x,reason:S??pn.CancelledByRelease})),u.current=!1,p.current=!1,m.current!==void 0&&clearTimeout(m.current))},[n,d,f]),w=Me(x=>b=>{if(l==null||l(b,{context:x}),i!==!1&&v.current){const S=Si(b);if(S){const D=i===!0?25:i,L={x:Math.abs(S.x-v.current.x),y:Math.abs(S.y-v.current.y)};(L.x>D||L.y>D)&&y(x)(b,pn.CancelledByMovement)}}},[y,i,l]),E=Me(x=>{if(e===null)return{};switch(o){case hn.Mouse:{const b={onMouseDown:T(x),onMouseMove:w(x),onMouseUp:y(x)};return s&&(b.onMouseLeave=S=>{y(x)(S,pn.CancelledOutsideElement)}),b}case hn.Touch:return{onTouchStart:T(x),onTouchMove:w(x),onTouchEnd:y(x)};case hn.Pointer:{const b={onPointerDown:T(x),onPointerMove:w(x),onPointerUp:y(x)};return s&&(b.onPointerLeave=S=>y(x)(S,pn.CancelledOutsideElement)),b}}},[e,y,s,o,w,T]);return ee(()=>{if(!window)return;function x(b){const S=ed(b);y()(S)}return window.addEventListener("mouseup",x),window.addEventListener("touchend",x),window.addEventListener("pointerup",x),()=>{window.removeEventListener("mouseup",x),window.removeEventListener("touchend",x),window.removeEventListener("pointerup",x)}},[y]),ee(()=>()=>{m.current!==void 0&&clearTimeout(m.current)},[]),ee(()=>{g.current=e},[e]),E}function td({poll:e,lang:t,readOnly:n,refresh:o=()=>{},votePoll:i=()=>{}}){const[s,a]=Z("default"),{expired:c,expiresAt:l,id:d,multiple:f,options:u,ownVotes:p,voted:h,votersCount:m,votesCount:g,emojis:v}=e,T=!!l&&new Date(l),y=f?m:g;let w=0;y<=1e3?w=0:y<=1e4?w=1:y<=1e5&&(w=2);const[E,x]=Z(!1),b=u.every(S=>S.votesCount!==null);return r("div",{lang:t,dir:"auto",class:`poll ${n?"read-only":""} ${s==="loading"?"loading":""}`,children:[E&&b||h||c?r(F,{children:[r("div",{class:"poll-options",children:u.map((S,D)=>{const{title:L,votesCount:A}=S,C=y?A/y:0,R=C?C.toLocaleString(k.locale||void 0,{style:"percent",maximumFractionDigits:w}):"0%",K=A>0&&A===Math.max(...u.map(U=>U.votesCount));return r("div",{class:`poll-option poll-result ${K?"poll-option-leading":""}`,style:{"--percentage":`${C*100}%`},children:[r("div",{class:"poll-option-title",children:[r("span",{children:r(qt,{text:L,emojis:v})}),h&&p.includes(D)&&r(F,{children:[" ",r(M,{icon:"check-circle",alt:k._({id:"IeO7us"})})]})]}),r("div",{class:"poll-option-votes",title:k._({id:"+syLpm",values:{optionVotesCount:A}}),children:R})]},`${D}-${L}-${A}`)})}),!c&&!h&&r("button",{class:"poll-vote-button plain2",disabled:s==="loading",onClick:S=>{S.preventDefault(),x(!1)},children:[r(M,{icon:"arrow-left",size:"s"})," ",r(O,{id:"L96xSt"})]})]}):r("form",{onSubmit:async S=>{S.preventDefault();const D=S.target,L=new FormData(D),A=[];L.forEach((C,R)=>{R==="poll"&&A.push(C)}),A.length&&(a("loading"),await i(A),a("default"))},children:[r("div",{class:"poll-options",children:u.map((S,D)=>{const{title:L}=S;return r("div",{class:"poll-option",children:r("label",{class:"poll-label",children:[r("input",{type:f?"checkbox":"radio",name:"poll",value:D,disabled:s==="loading",readOnly:n}),r("span",{class:"poll-option-title",children:r(qt,{text:L,emojis:v})})]})})})}),!n&&r("button",{class:"poll-vote-button",type:"submit",disabled:s==="loading",children:r(O,{id:"lQXQKs"})})]}),r("p",{class:"poll-meta",children:[!c&&!n&&r("button",{type:"button",class:"plain small",disabled:s==="loading",onClick:S=>{S.preventDefault(),a("loading"),(async()=>(await o(),a("default")))()},title:k._({id:"lCF0wC"}),children:r(M,{icon:"refresh",alt:k._({id:"lCF0wC"})})}),!h&&!c&&!n&&b&&r("button",{type:"button",class:"plain small",disabled:s==="loading",onClick:S=>{S.preventDefault(),x(!E)},title:E?k._({id:"L96xSt"}):k._({id:"zCjei3"}),children:[r(M,{icon:E?"eye-open":"eye-close",alt:E?k._({id:"L96xSt"}):k._({id:"zCjei3"})})," "]}),!c&&!n&&" ",r(O,{id:"k7v0Rh",values:{0:rt(g),1:rt(g),votesCount:g},components:{0:r("span",{title:g}),1:r("span",{title:g})}}),!!m&&m!==g&&r(F,{children:[" ","•"," ",r(O,{id:"jf1i1L",values:{0:rt(m),1:rt(m),votersCount:m},components:{0:r("span",{title:m}),1:r("span",{title:m})}})]})," ","•"," ",c?T?r(O,{id:"5LwCCI",components:{0:r(at,{datetime:T})}}):k._({id:"237hSL"}):T?r(O,{id:"ooHDPY",components:{0:r(at,{datetime:T})}}):k._({id:"O2tNG0"})]})]})}const Gs=lt();function nd(e,t){if(!(e!=null&&e.length))return!1;const n=e.filter(s=>{const{filter:a}=s,c=a.context.includes(t);return c?a.expiresAt?new Date(a.expiresAt)>new Date:c:!1});if(!n.length)return!1;if(n.some(s=>s.filter.filterAction==="hide"))return{action:"hide"};if(n.some(s=>s.filter.filterAction==="warn")){const s=n.map(a=>a.filter.title);return{action:"warn",titles:s,titlesStr:s.join(" • ")}}return!1}const Pr=Oe(nd);function od(e,t,n){var a;const{filtered:o}=e;if(!(o!=null&&o.length)||n&&((a=e.account)==null?void 0:a.id)===n)return!0;const s=Pr(o,t);return s?s.action!=="hide":!0}function ih(e,t){if(!(e!=null&&e.length))return[];if(!t)return e;const n=_r();return e.filter(o=>od(o,t,n))}const Uo=document.createElement("div");function jo(e){return e?(Uo.innerHTML=e,Uo.querySelectorAll(".invisible").forEach(t=>{t.remove()}),Uo.innerText.length):0}const mn="speechSynthesis"in window;function Ii(e,t){if(mn)try{speechSynthesis.speaking&&speechSynthesis.cancel();const n=new SpeechSynthesisUtterance(e);t&&(n.lang=t),speechSynthesis.speak(n)}catch(n){alert(n)}}function qs(e){var a;const{spoilerText:t,content:n,poll:o,mediaAttachments:i}=e;let s="";return t!=null&&t.trim()?s+=t:s+=_o(n),s=s.trim(),(a=o==null?void 0:o.options)!=null&&a.length&&(s+=` + +📊: +${o.options.map(c=>`${o.multiple?"▪️":"•"} ${c.title}`).join(` +`)}`),i!=null&&i.length&&(s+=" "+i.map(c=>({image:"🖼️",gifv:"🎞️",video:"📹",audio:"🎵",unknown:""})[c.type]||"").join("")),s}function rd(e,t,n){var o=this,i=$(null),s=$(0),a=$(null),c=$([]),l=$(),d=$(),f=$(e),u=$(!0);f.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var m=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,v="maxWait"in n,T="debounceOnServer"in n&&!!n.debounceOnServer,y=v?Math.max(+n.maxWait||0,t):null;ee(function(){return u.current=!0,function(){u.current=!1}},[]);var w=ae(function(){var E=function(A){var C=c.current,R=l.current;return c.current=l.current=null,s.current=A,d.current=f.current.apply(R,C)},x=function(A,C){h&&cancelAnimationFrame(a.current),a.current=h?requestAnimationFrame(A):setTimeout(A,C)},b=function(A){if(!u.current)return!1;var C=A-i.current;return!i.current||C>=t||C<0||v&&A-s.current>=y},S=function(A){return a.current=null,g&&c.current?E(A):(c.current=l.current=null,d.current)},D=function A(){var C=Date.now();if(b(C))return S(C);if(u.current){var R=t-(C-i.current),K=v?Math.min(R,y-(C-s.current)):R;x(A,K)}},L=function(){if(p||T){var A=Date.now(),C=b(A);if(c.current=[].slice.call(arguments),l.current=o,i.current=A,C){if(!a.current&&u.current)return s.current=i.current,x(D,t),m?E(i.current):d.current;if(v)return x(D,t),E(i.current)}return a.current||x(D,t),d.current}};return L.cancel=function(){a.current&&(h?cancelAnimationFrame(a.current):clearTimeout(a.current)),s.current=0,c.current=i.current=l.current=a.current=null},L.isPending=function(){return!!a.current},L.flush=function(){return a.current?S(Date.now()):d.current},L},[m,v,t,y,g,h,p,T]);return w}function id(e,t,n){var o=n===void 0?{}:n,i=o.leading,s=o.trailing;return rd(e,t,{maxWait:t,leading:i===void 0||i,trailing:s===void 0||s})}function sd(e,t){var n=$(null),o=$(null);o.current=t;var i=$(null);ee(function(){s()});var s=Me(function(){var a=i.current,c=o.current,l=a||(c?c instanceof Element?c:c.current:null);n.current&&n.current.element===l&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:l,subscriber:e,cleanup:l?e(l):void 0})},[e]);return ee(function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}},[]),Me(function(a){i.current=a,s()},[s])}function Ai(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function ad(e){e===void 0&&(e={});var t=e.onResize,n=$(void 0);n.current=t;var o=e.round||Math.round,i=$(),s=Z({width:void 0,height:void 0}),a=s[0],c=s[1],l=$(!1);ee(function(){return l.current=!1,function(){l.current=!0}},[]);var d=$({width:void 0,height:void 0}),f=sd(Me(function(u){return(!i.current||i.current.box!==e.box||i.current.round!==o)&&(i.current={box:e.box,round:o,instance:new ResizeObserver(function(p){var h=p[0],m=e.box==="border-box"?"borderBoxSize":e.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=Ai(h,m,"inlineSize"),v=Ai(h,m,"blockSize"),T=g?o(g):void 0,y=v?o(v):void 0;if(d.current.width!==T||d.current.height!==y){var w={width:T,height:y};d.current.width=T,d.current.height=y,n.current?n.current(w):l.current||c(w)}})}),i.current.instance.observe(u,{box:e.box}),function(){i.current&&i.current.instance.unobserve(u)}},[e.box,o]),e.ref);return ae(function(){return{ref:f,width:a.width,height:a.height}},[f,a.width,a.height])}function ro({className:e="truncated"}={}){const t=$(),n=id(({height:o})=>{if(t.current){const{scrollHeight:i}=t.current;let s=i>o;if(s){const{height:a,maxHeight:c}=getComputedStyle(t.current),l=parseInt(c||a,10);s=i>l}t.current.classList.toggle(e,s)}},300);return ad({ref:t,box:"border-box",onResize:n}),t}const _n={public:"earth",unlisted:"group",private:"lock",direct:"message",local:"building"};var Ys="kvfysmfp",Xs="ufhsfnkm",cd=".".concat(Ys,"{overflow:hidden;touch-action:none}.").concat(Xs,"{transform-origin: 0 0}"),ld=typeof window>"u",ud=function(){return!ld&&("ontouchstart"in window||navigator.maxTouchPoints>0)};var dd=function(e){var t=e.x,n=e.y,o=e.scale;return"scale3d(".concat(o,",").concat(o,", 1) translate3d(").concat(t,"px, ").concat(n,"px, 0)")};var fd=Math.min,hd=Math.max;function Ci(e){var t=e.containerDimension,n=e.childDimension,o=e.padding,i=e.centerContained,s=n-t;return s+2*o<=0&&i?[s/2,s/2]:[fd(s+o,0)-o,hd(0,s+o)]}var Pi=function(e,t){return t?"".concat(e," ").concat(t):e},Xn=Math.abs,pd=Math.min,md=Math.sqrt,Qs=typeof window>"u",gd=Qs?!1:/(Mac)/i.test(navigator.platform),Ht=function(e){return e==="drag"},un=function(e){return e==="zoom"},vd=function(e){return gd&&e.ctrlKey},dn=function(e){e.stopPropagation(),e.preventDefault()},Li=function(e,t){var n=e.x-t.x,o=e.y-t.y;return md(n*n+o*o)},_d=function(e,t){var n=Li(e[0],e[1]),o=Li(t[0],t[1]);return o/n},yd=function(e,t){return e>t-.01&&et?t:n},Ed=function(e){return!(e.ctrlKey||e.metaKey)},xd=function(e){if(e){var t=e.offsetWidth,n=e.offsetHeight;if(t&&n)return{width:t,height:n};var o=getComputedStyle(e),i=parseFloat(o.width),s=parseFloat(o.height);if(s&&i)return{width:i,height:s}}return{width:0,height:0}},kd=function(e,t){return{x:t.x-e.x,y:t.y-e.y}},Sd=function(e,t){return e.x===t.x&&e.y===t.y},It=function(){},Jn={x:0,y:0},Ri=function(e){Da(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n._prevDragMovePoint=null,n._containerObserver=null,n._fingers=0,n._firstMove=!0,n._initialOffset=Ne({},Jn),n._interaction=null,n._isDoubleTap=!1,n._isOffsetsSet=!1,n._lastDragPosition=null,n._lastScale=1,n._lastTouchStart=0,n._lastZoomCenter=null,n._listenMouseMove=!1,n._nthZoom=0,n._offset=Ne({},Jn),n._startOffset=Ne({},Jn),n._startTouches=null,n._updatePlaned=!1,n._wheelTimeOut=null,n._zoomFactor=1,n._initialZoomFactor=1,n._draggingPoint=Ne({},Jn),n._ignoreNextClick=!1,n._containerRef=$a(),n._handleClick=function(o){n._ignoreNextClick&&(n._ignoreNextClick=!1,o.stopPropagation())},n._onResize=function(){var o;!((o=n._containerRef)===null||o===void 0)&&o.current&&(n._updateInitialZoomFactor(),n._setupOffsets(),n._update())},n._handlerOnTouchEnd=n._handlerIfEnable(function(o){n._fingers=o.touches.length,n.props.shouldCancelHandledTouchEndEvents&&(un(n._interaction)||Ht(n._interaction)&&(n._startOffset.x!==n._offset.x||n._startOffset.y!==n._offset.y))&&dn(o),Ht(n._interaction)&&!n._enoughToDrag()&&n._handleClick(o),n._updateInteraction(o)}),n._handlerOnTouchStart=n._handlerIfEnable(function(o){n._firstMove=!0,n._fingers=o.touches.length,n._detectDoubleTap(o)}),n._handlerOnTouchMove=n._handlerIfEnable(function(o){n._isDoubleTap||(n._collectInertia(o),n._firstMove?(n._updateInteraction(o),n._interaction&&dn(o),n._startOffset=Ne({},n._offset),n._startTouches=Qn(o.touches)):(un(n._interaction)?n._startTouches&&n._startTouches.length===2&&o.touches.length===2&&n._handleZoom(o,_d(n._startTouches,Qn(o.touches))):Ht(n._interaction)&&n._handleDrag(o),n._interaction&&(dn(o),n._update())),n._firstMove=!1)}),n._handlerWheel=function(o){if(!n.props.shouldInterceptWheel(o)){dn(o);var i=o.pageX,s=o.pageY,a=o.deltaY,c=o.deltaMode,l=1;(vd(o)||c===1)&&(l=15);var d={touches:[{pageX:i,pageY:s}]},f=n._getOffsetByFirstTouch(d),u=a*l;n._stopAnimation(),n._scaleTo(n._zoomFactor-u/n.props.wheelScaleFactor,f),n._update(),clearTimeout(n._wheelTimeOut),n._wheelTimeOut=setTimeout(function(){return n._sanitize()},100)}},n._handlers=n.props.isTouch()?[["touchstart",n._handlerOnTouchStart],["touchend",n._handlerOnTouchEnd],["touchmove",n._handlerOnTouchMove]]:[["mousemove",n.simulate(n._handlerOnTouchMove),n.props._document],["mouseup",n.simulate(n._handlerOnTouchEnd),n.props._document],["mousedown",n.simulate(n._handlerOnTouchStart)],["click",n._handleClick],["wheel",n._handlerWheel]],n}return t.prototype._handleDragStart=function(n){this._ignoreNextClick=!0,this.props.onDragStart(),this._stopAnimation(),this._resetInertia(),this._lastDragPosition=null,this._hasInteraction=!0,this._draggingPoint=this._offset,this._handleDrag(n)},t.prototype._handleDrag=function(n){var o=this._getOffsetByFirstTouch(n);this._enoughToDrag()?this._drag(o,this._lastDragPosition):this._virtualDrag(o,this._lastDragPosition),this._offset=this._sanitizeOffset(this._offset),this._lastDragPosition=o},t.prototype._resetInertia=function(){this._velocity=null,this._prevDragMovePoint=null},t.prototype._realizeInertia=function(){var n=this,o=this.props,i=o.inertiaFriction,s=o.inertia;if(!(!s||!this._velocity)){var a=this._velocity,c=a.x,l=a.y;if(c||l){this._stopAnimation(),this._resetInertia();var d=function(){if(c*=i,l*=i,!c&&!l)return n._stopAnimation();var f=Ne({},n._offset);if(n._addOffset({x:c,y:l}),n._offset=n._sanitizeOffset(n._offset),Sd(f,n._offset))return n._stopAnimation();n._update({isAnimation:!0})};this._animate(d,{duration:9999})}}},t.prototype._collectInertia=function(n){var o=n.touches;if(this.props.inertia){var i=Qn(o)[0],s=this._prevDragMovePoint;s&&(this._velocity=kd(i,s)),this._prevDragMovePoint=i}},t.prototype._handleDragEnd=function(){this.props.onDragEnd(),this._end(),this._realizeInertia()},t.prototype._handleZoomStart=function(){this.props.onZoomStart(),this._stopAnimation(),this._lastScale=1,this._nthZoom=0,this._lastZoomCenter=null,this._hasInteraction=!0},t.prototype._handleZoom=function(n,o){var i=wd(this._getOffsetTouches(n)),s=o/this._lastScale;this._lastScale=o,this._nthZoom+=1,this._nthZoom>3&&(this._scale(s,i),this._drag(i,this._lastZoomCenter),this.props.enforceBoundsDuringZoom&&(this._offset=this._sanitizeOffset(this._offset))),this._lastZoomCenter=i},t.prototype._handleZoomEnd=function(){this.props.onZoomEnd(),this._end()},t.prototype._handleDoubleTap=function(n){var o=this;if(!(this._hasInteraction||this.props.tapZoomFactor===0)){var i=this.props.doubleTapZoomOutOnMaxScale&&this._zoomFactor===this.props.maxZoom||this.props.doubleTapToggleZoom&&this._zoomFactor>1;this.props.onDoubleTap(),this._ignoreNextClick=!0;var s=this._zoomFactor+this.props.tapZoomFactor,a=this._zoomFactor,c=function(d){o._scaleTo(a+d*(s-a),l)},l=this._getOffsetByFirstTouch(n);this._isDoubleTap=!0,a>s&&(l=this._getCurrentZoomCenter()),i?this._zoomOutAnimation():this._animate(c)}},t.prototype._computeInitialOffset=function(){var n=this._getContainerRect(),o=this._getChildSize(),i=o.width,s=o.height,a=-Xn(i*this._getInitialZoomFactor()-n.width)/2,c=-Xn(s*this._getInitialZoomFactor()-n.height)/2;this._initialOffset={x:a,y:c}},t.prototype._resetOffset=function(){this._offset=Ne({},this._initialOffset)},t.prototype._setupOffsets=function(){this.props.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this._computeInitialOffset(),this._resetOffset())},t.prototype._sanitizeOffset=function(n){var o=this._getContainerRect(),i=this._getChildSize(),s=i.width,a=i.height,c=s*this._getInitialZoomFactor()*this._zoomFactor,l=a*this._getInitialZoomFactor()*this._zoomFactor,d=Ci({containerDimension:o.width,childDimension:c,padding:this.props.horizontalPadding,centerContained:this.props.centerContained}),f=d[0],u=d[1],p=Ci({containerDimension:o.height,childDimension:l,padding:this.props.verticalPadding,centerContained:this.props.centerContained}),h=p[0],m=p[1];return{x:Wo(f,u,n.x),y:Wo(h,m,n.y)}},t.prototype.alignCenter=function(n){var o=this,i=Ne({duration:250,animated:!0},n),s=i.x,a=i.y,c=i.scale,l=i.animated,d=i.duration,f=s*this._initialZoomFactor,u=a*this._initialZoomFactor,p=this._zoomFactor,h=Ne({},this._offset),m=this._getContainerRect(),g={x:m.width/2,y:m.height/2};if(this._zoomFactor=1,this._offset={x:-(g.x-f),y:-(g.y-u)},this._scaleTo(c,g),this._stopAnimation(),!l)return this._update();var v=this._zoomFactor-p,T={x:this._offset.x-h.x,y:this._offset.y-h.y};this._zoomFactor=p,this._offset=Ne({},h);var y=function(w){var E=h.x+T.x*w,x=h.y+T.y*w;o._zoomFactor=p+v*w,o._offset=o._sanitizeOffset({x:E,y:x}),o._update()};this._animate(y,{callback:function(){return o._sanitize()},duration:d})},t.prototype.scaleTo=function(n){var o=this,i=Ne({duration:250,animated:!0},n),s=i.x,a=i.y,c=i.scale,l=i.animated,d=i.duration,f=this._zoomFactor,u=Ne({},this._offset);if(this._zoomFactor=1,this._offset={x:0,y:0},this._scaleTo(c,{x:s,y:a}),this._stopAnimation(),!l)return this._update();var p=this._zoomFactor-f,h={x:this._offset.x-u.x,y:this._offset.y-u.y};this._zoomFactor=f,this._offset=Ne({},u);var m=function(g){var v=u.x+h.x*g,T=u.y+h.y*g;o._zoomFactor=f+p*g,o._offset={x:v,y:T},o._update()};this._animate(m,{callback:function(){return o._sanitize()},duration:d})},t.prototype._scaleTo=function(n,o){this._scale(n/this._zoomFactor,o),this._offset=this._sanitizeOffset(this._offset)},t.prototype._scale=function(n,o){n=this._scaleZoomFactor(n),this._addOffset({x:(n-1)*(o.x+this._offset.x),y:(n-1)*(o.y+this._offset.y)}),this.props.onZoomUpdate()},t.prototype._scaleZoomFactor=function(n){var o=this._zoomFactor;return this._zoomFactor*=n,this._zoomFactor=Wo(this.props.minZoom,this.props.maxZoom,this._zoomFactor),this._zoomFactor/o},t.prototype._canDrag=function(){return this.props.draggableUnZoomed||!yd(this._zoomFactor,1)},t.prototype._drag=function(n,o){if(o){var i=-(n.y-o.y),s=-(n.x-o.x);this.props.lockDragAxis?Xn(s)>Xn(i)?this._addOffset({x:s,y:0}):this._addOffset({y:i,x:0}):this._addOffset({x:s,y:i}),this.props.onDragUpdate()}},t.prototype._virtualDrag=function(n,o){if(o){var i=-(n.y-o.y),s=-(n.x-o.x);this._draggingPoint={x:s+this._draggingPoint.x,y:i+this._draggingPoint.y}}},t.prototype._addOffset=function(n){var o=this._offset,i=o.x,s=o.y;this._offset={x:i+n.x,y:s+n.y}},t.prototype._sanitize=function(){this._zoomFactor=d?(n(1),i._stopAnimation(),l(),i._update()):(p=c(p),n(p),i._update({isAnimation:!0}),requestAnimationFrame(f))}};this._inAnimation=!0,requestAnimationFrame(f)},t.prototype._stopAnimation=function(){this._inAnimation=!1},t.prototype._end=function(){this._hasInteraction=!1,this._sanitize(),this._update()},t.prototype._getContainerRect=function(){var n=this._containerRef.current;return n.getBoundingClientRect()},t.prototype._getChildSize=function(){var n=this._containerRef.current;return xd(n==null?void 0:n.firstElementChild)},t.prototype._updateInitialZoomFactor=function(){var n=this._getContainerRect(),o=this._getChildSize(),i=n.width/o.width,s=n.height/o.height;this._initialZoomFactor=pd(i,s)},t.prototype._bindEvents=function(){var n=this,o=this._containerRef.current;window.ResizeObserver?(this._containerObserver=new ResizeObserver(this._onResize),this._containerObserver.observe(o)):window.addEventListener("resize",this._onResize),this._handlers.forEach(function(i){var s=i[0],a=i[1],c=i[2];(c||o).addEventListener(s,a,!0)}),Array.from(o.querySelectorAll("img")).forEach(function(i){return i.addEventListener("load",n._onResize)})},t.prototype._unSubscribe=function(){var n=this,o=this._containerRef.current;this._containerObserver&&(this._containerObserver.disconnect(),this._containerObserver=null),window.removeEventListener("resize",this._onResize),this._handlers.forEach(function(i){var s=i[0],a=i[1],c=i[2];(c||o).removeEventListener(s,a,!0)}),Array.from(o.querySelectorAll("img")).forEach(function(i){return i.removeEventListener("load",n._onResize)})},t.prototype._update=function(n){var o=this;if(!this._updatePlaned){var i=function(){var s=o._getInitialZoomFactor()*o._zoomFactor,a=-o._offset.x/s,c=-o._offset.y/s;o.props.onUpdate({scale:s,x:a,y:c})};if(n!=null&&n.isAnimation)return i();this._updatePlaned=!0,requestAnimationFrame(function(){o._updatePlaned=!1,i()})}},t.prototype._handlerIfEnable=function(n){var o=this;return function(){for(var i=[],s=0;so?n-o:o-n},t.prototype._enoughToDrag=function(){return this._distanceBetweenNumbers(this._startOffset.x,this._draggingPoint.x)>5||this._distanceBetweenNumbers(this._startOffset.y,this._draggingPoint.y)>5},t.prototype._updateInteraction=function(n){var o=this._fingers;if(o===2)return this._setInteraction("zoom",n);if(o===1&&this._canDrag())return this._setInteraction("drag",n);this._setInteraction(null,n)},t.prototype._detectDoubleTap=function(n){var o=new Date().getTime();this._fingers>1&&(this._lastTouchStart=0),o-this._lastTouchStart<300?(dn(n),this._handleDoubleTap(n),un(this._interaction)?this._handleZoomEnd():Ht(this._interaction)&&this._handleDragEnd()):this._isDoubleTap=!1,this._fingers===1&&(this._lastTouchStart=o)},t.prototype.simulate=function(n){var o=this;return function(i){var s=i.pageX,a=i.pageY,c=i.type,l=c==="mouseup",d=c==="mousedown";d&&(i.preventDefault(),o._listenMouseMove=!0),o._listenMouseMove&&(i.touches=l?[]:[{pageX:s,pageY:a}],n(i)),l&&(o._listenMouseMove=!1)}},t.prototype.componentDidMount=function(){this._bindEvents(),this._update()},t.prototype.componentWillUnmount=function(){this._stopAnimation(),this._unSubscribe()},t.prototype.render=function(){var n=this.props,o=n.children,i=n.containerProps,s=Na.only(o),a=i||{};return Un.createElement(Un.Fragment,null,Un.createElement("style",null,cd),Un.createElement("div",Ne({},a,{ref:this._containerRef,className:Pi(Ys,a.className)}),Ki(s,{className:Pi(Xs,s.props.className)})))},t.defaultProps={animationDuration:250,draggableUnZoomed:!0,enforceBoundsDuringZoom:!1,centerContained:!1,enabled:!0,inertia:!0,inertiaFriction:.96,horizontalPadding:0,isTouch:ud,lockDragAxis:!1,maxZoom:5,minZoom:.5,onDoubleTap:It,onDragEnd:It,onDragStart:It,onDragUpdate:It,onZoomEnd:It,onZoomStart:It,onZoomUpdate:It,setOffsetsOnce:!1,shouldInterceptWheel:Ed,shouldCancelHandledTouchEndEvents:!1,tapZoomFactor:1,verticalPadding:0,wheelScaleFactor:1500,zoomOutFactor:1.3,doubleTapZoomOutOnMaxScale:!1,doubleTapToggleZoom:!1,_document:Qs?null:window.document},t}(Gi);if(0)var sh,ah,ch,lh,uh,dh,fh;function Ko(e){if(!e)return;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),o=Math.round(e%60);return t===0?`${n}:${o.toString().padStart(2,"0")}`:`${t}:${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}const Id=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Ad="ALT",Zo=e=>{const{alt:t,lang:n,index:o,...i}=e;return!t||!t.trim()?null:r("button",{type:"button",class:"alt-badge clickable",...i,onClick:s=>{s.stopPropagation(),s.preventDefault(),B.showMediaAlt={alt:t,lang:n}},title:k._({id:"5gfDMm"}),children:[Ad,!!o&&r("sup",{children:o})]})},Cd=140,Pd=280,Js=Oe(e=>e!=null&&e.length?e.length>Cd||/[\n\r].*[\n\r]/.test(e.trim()):!1);function Ld({class:e="",media:t,to:n,lang:o,showOriginal:i,autoAnimate:s,showCaption:a,allowLongerCaption:c,altIndex:l,checkAspectRatio:d=!0,onClick:f=()=>{}}){let{blurhash:u,description:p,meta:h,previewRemoteUrl:m,previewUrl:g,remoteUrl:v,url:T,type:y}=t;/no\-preview\./i.test(g)&&(g=null);const{original:w={},small:E,focus:x}=h||{},b=i?w==null?void 0:w.width:(E==null?void 0:E.width)||(w==null?void 0:w.width),S=i?w==null?void 0:w.height:(E==null?void 0:E.height)||(w==null?void 0:w.height),D=i?T:g||T,L=i?v:m||v,A=b&&S,C=A?b>S?"landscape":"portrait":null,R=u?Cr(u):null,K=$();let U;if(x){const V=(x.x+1)/2*100,le=(1-x.y)/2*100;U=`${V.toFixed(0)}% ${le.toFixed(0)}%`}const oe=$(),Q=Me(({x:V,y:le,scale:z})=>{const{current:J}=oe;if(J){const Y=dd({x:V,y:le,scale:z});z===1?J.style.removeProperty("transform"):J.style.setProperty("transform",Y),J.closest(".media-zoom").style.touchAction=z<=1.01?"pan-x":""}},[]),[re,q]=Z(!1),ie={enabled:re,draggableUnZoomed:!1,inertiaFriction:.9,tapZoomFactor:2,doubleTapToggleZoom:!0,containerProps:{className:"media-zoom",style:{overflow:"visible"}},onUpdate:Q},ce=ae(()=>n?V=>r(Gt,{to:n,...V}):"div",[n]),se=L?Md(L):null,H=y==="unknown"&&se&&/\.(mp4|m4r|m4v|mov|webm)$/i.test(se.pathname),fe=y==="unknown"&&se&&/\.(mp3|ogg|wav|m4a|m4p|m4b)$/i.test(se.pathname),ne=y==="image"||y==="unknown"&&g&&!H&&!fe,Ee=$(),[ye,xe]=Z(!1);Pt(()=>{if(!ne||!i||!Ee.current)return;const{offsetWidth:V,offsetHeight:le}=Ee.current,z=b{const{children:le,...z}=V;return r("figure",{...z,children:[le,r("figcaption",{class:"media-caption",lang:o,dir:"auto",onClick:J=>{J.preventDefault(),J.stopPropagation(),B.showMediaAlt={alt:p,lang:o}},children:p})]})}:F,[Ge,Mt]=Z(void 0);if(ne)return ie.containerProps.style.display="inherit",Pt(()=>{Id&&i&&(async()=>{try{await fetch(D,{mode:"no-cors"}),oe.current.src=D}catch{}})()},[D]),r(ge,{children:r(ce,{ref:Ee,class:`media media-image ${e}`,onClick:f,"data-orientation":C,"data-has-alt":!N||void 0,"data-has-natural-aspect-ratio":Ge||void 0,style:i?{backgroundImage:`url(${g})`,backgroundSize:ye?`${b}px ${S}px`:void 0,...$e}:Ce,children:i?r(Ri,{...ie,children:r("img",{ref:oe,src:D,alt:p,width:b,height:S,"data-orientation":C,loading:"eager",decoding:"sync",onLoad:V=>{V.target.closest(".media-image").style.backgroundImage="",V.target.closest(".media-zoom").style.display="",q(!0)},onError:V=>{const{src:le}=V.target;le===D&&L&&D!==L&&(V.target.src=L)}})}):r(F,{children:[r("img",{src:D,alt:N?"":p,width:b,height:S,"data-orientation":C,loading:"lazy",style:{objectPosition:U||"center","--anim-duration":`${Math.min(Math.max(Math.max(b,S)/100,5),120)}s`},onLoad:V=>{V.target.dataset.loaded=!0;const le=V.target.closest(".media");if(!A&&le){const{naturalWidth:z,naturalHeight:J}=V.target;le.dataset.orientation=z>J?"landscape":"portrait",le.style.setProperty("--width",`${z}px`),le.style.setProperty("--height",`${J}px`),le.style.aspectRatio=`${z}/${J}`}if(d&&le){const{clientWidth:z,clientHeight:J,naturalWidth:Y,naturalHeight:be}=V.target;if(z&&J&&Y&&be)if(Y<88||be<88)le.dataset.hasSmallDimension=!0;else{const pe=be*z/Y;Math.abs(pe-J)<5&&Mt(!0)}}},onError:V=>{const{src:le}=V.target;le===D&&D!==L&&(V.target.src=L)}}),!N&&r(Zo,{alt:p,lang:o,index:l})]})})});if(y==="gifv"||y==="video"||H){const V=w.duration>0,le=w.duration<31,z=y==="gifv"&&le,J=w.duration<61,Y=Ko(w.duration),be=!i&&!s&&z,te=!i&&s&&z,pe=w.duration>5,Rt=` + + `,Ue=` + + `;return r(ge,{children:r(ce,{class:`media ${e} media-${z?"gif":"video"} ${te?"media-contain":""} ${be?"media-hover-animate":""}`,"data-orientation":C,"data-formatted-duration":i?void 0:Y,"data-label":z&&!i&&!te?"GIF":void 0,"data-has-alt":!N||void 0,style:!i&&Ce,onClick:Ae=>{if(be)try{K.current.pause()}catch{}f(Ae)},onMouseEnter:()=>{if(be)try{K.current.play()}catch{}},onMouseLeave:()=>{if(be)try{K.current.pause()}catch{}},onFocus:()=>{if(be)try{K.current.play()}catch{}},onBlur:()=>{if(be)try{K.current.pause()}catch{}},children:[i||te?z&&i?r(Ri,{...ie,enabled:!0,children:r("div",{ref:oe,dangerouslySetInnerHTML:{__html:Rt}})}):z?r("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Rt}}):r("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Ue}}):z?r("video",{ref:K,src:T,poster:g,width:b,height:S,"data-orientation":C,preload:"auto",playsinline:!0,loop:!0,muted:!0,onTimeUpdate:pe?Ae=>{const{target:Pe}=Ae,ve=Pe==null?void 0:Pe.closest(".media-gif");if(ve){const Le=Pe.currentTime/Pe.duration*100;ve.style.setProperty("--progress",`${Le}%`)}}:void 0}):r(F,{children:[g?r("img",{src:g,alt:N?"":p,width:b,height:S,"data-orientation":C,loading:"lazy",decoding:"async",onLoad:Ae=>{if(!A){const Pe=Ae.target.closest(".media");if(Pe){const{naturalHeight:ve,naturalWidth:Le}=Ae.target;Pe.dataset.orientation=Le>ve?"landscape":"portrait",Pe.style.setProperty("--width",`${Le}px`),Pe.style.setProperty("--height",`${ve}px`),Pe.style.aspectRatio=`${Le}/${ve}`}}}}):r("video",{src:T+"#t=0.1",width:b,height:S,"data-orientation":C,preload:"metadata",muted:!0,disablePictureInPicture:!0,onLoadedMetadata:Ae=>{if(!V){const{duration:Pe}=Ae.target;if(Pe){const ve=Ko(Pe),Le=Ae.target.closest(".media-video");Le&&(Le.dataset.formattedDuration=ve)}}}}),r("div",{class:"media-play",children:r(M,{icon:"play",size:"xl",alt:"▶"})})]}),!i&&!N&&r(Zo,{alt:p,lang:o,index:l})]})})}else if(y==="audio"||fe){const V=Ko(w.duration);return r(ge,{children:r(ce,{class:`media media-audio ${e}`,"data-formatted-duration":i?void 0:V,"data-has-alt":!N||void 0,onClick:f,style:!i&&Ce,children:[i?r("audio",{src:v||T,preload:"none",controls:!0,autoPlay:!0}):g?r("img",{src:g,alt:N?"":p,width:b,height:S,"data-orientation":C,loading:"lazy",onError:le=>{var z,J;try{(J=(z=le.target)==null?void 0:z.remove)==null||J.call(z)}catch{}}}):null,!i&&r(F,{children:[r("div",{class:"media-play",children:r(M,{icon:"play",size:"xl",alt:"▶"})}),!N&&r(Zo,{alt:p,lang:o,index:l})]})]})})}}function Md(e){return URL.parse(e,location.origin)}const lr=Jt(Ld,(e,t)=>{const n=e.media||{},o=t.media||{};return(n==null?void 0:n.id)===(o==null?void 0:o.id)&&n.url===o.url&&e.to===t.to&&e.class===t.class}),Rd=280,Od=140,Dd=qi({limit:1,interval:1e3});function $d(e,t){return t.v1.accounts.$select(e).fetch()}const Nd=mo(Dd($d)),Ct={public:{id:"7d1a0d"},local:{id:"d5zxa4"},unlisted:{id:"WDcQq9"},private:{id:"o34OrG"},direct:{id:"IV4QaU"}},Fd=window.ontouchstart!==void 0&&/iPad|iPhone|iPod/.test(navigator.userAgent),zd=new Intl.RelativeTimeFormat,Oi=80;function Vd(e){var t;return(t=e==null?void 0:e.options)!=null&&t.length?`📊: +${e.options.map(n=>`- ${n.title}${n.votesCount>=0?` (${n.votesCount})`:""}`).join(` +`)}`:""}function Go(e){const{spoilerText:t,content:n,poll:o}=e;return(t?`${t} + +`:"")+_o(n)+Vd(o)}function ea(e=[],t=document){for(const n of e)try{return t.querySelectorAll(n)}catch{}return[]}function Hd(e){return!e||(e=e.trim(),!e)?!1:!!_o(e,{preProcess:n=>{for(const o of ea([".mention, pre, code, a:has(.invisible)",".mention, pre, code"],n))o.remove()}})}function Bd(e){return _o(e,{preProcess:t=>{for(const n of ea([".mention, .hashtag, pre, code, a:has(.invisible)",".mention, .hashtag, pre, code"],t))n.remove();for(const n of t.querySelectorAll("a")){const o=n.innerText.trim();(o.startsWith("https://")||o.startsWith("http://"))&&n.remove()}}})}const Ud=/^http/i,Di=({post:e,instance:t,previewMode:n})=>{const{content:o,emojis:i,language:s,mentions:a,url:c}=e,l=$();return Pt(()=>{if(!l.current)return;const d=Ls(o,{emojis:i,returnDOM:!0});for(const f of d.querySelectorAll('a.u-url[target="_blank"]'))Ud.test(f.innerText.trim())||f.removeAttribute("target");l.current.replaceChildren(d.cloneNode(!0))},[o,i.length]),r("div",{ref:l,lang:s,dir:"auto",class:"inner-content",onClick:iu({mentions:a,instance:t,previewMode:n,statusURL:c})})},jd={s:"small",m:"medium",l:"large"},Wd=mo(async e=>{const{detectAll:t}=await I(async()=>{const{detectAll:i}=await import("./tinyld-light-tbgyvj3S.js");return{detectAll:i}},[],import.meta.url);if(e=e==null?void 0:e.trim(),(e==null?void 0:e.length)>500)return null;const o=t(e)[0];return o!=null&&o.lang&&(o==null?void 0:o.accuracy)>.5?o.lang:null}),yn={id:"8fZueG"},ur={},$i=(e,t=[])=>{if(!e)return!1;const n=bs(!0),o=e!==n&&!bn([e],[n])&&!t.find(i=>e===i||bn([e],[i]));return ur[e+t]=!0,o};function Qt({statusID:e,status:t,instance:n,size:o="m",contentTextWeight:i,readOnly:s,enableCommentHint:a,withinContext:c,skeleton:l,enableTranslate:d,forceTranslate:f,previewMode:u,onMediaClick:p,quoted:h,onStatusLinkClick:m=()=>{},showFollowedTags:g,allowContextMenu:v,showActionsBar:T,showReplyParent:y,mediaFirst:w}){var Yr,Xr,Qr,Jr;const{_:E}=po();if(l)return r("div",{class:`status skeleton ${w?"status-media-first small":""}`,children:[!w&&r(st,{size:"xxl"}),r("div",{class:"container",children:[r("div",{class:"meta",children:[(o==="s"||w)&&r(st,{size:"m"})," ███ ████████"]}),r("div",{class:"content-container",children:[w&&r("div",{class:"media-first-container"}),r("div",{class:`content ${w?"media-first-content":""}`,children:r("p",{children:"████ ████████"})})]})]})]});const{masto:x,instance:b,authenticated:S}=so({instance:n}),{instance:D}=so(),L=b===D;let A=it(e||(t==null?void 0:t.id),b);const C=In(B);if(t||(t=C.statuses[A]||C.statuses[e],A=it(t==null?void 0:t.id,b)),!t)return null;const{account:{acct:R,avatar:K,avatarStatic:U,id:oe,url:Q,displayName:re,username:q,emojis:ie,bot:ce,group:se},id:H,repliesCount:fe,reblogged:ne,reblogsCount:Ee,favourited:ye,favouritesCount:xe,bookmarked:De,poll:Ie,muted:$e,sensitive:Ce,spoilerText:he,visibility:N,language:ge,editedAt:Ge,filtered:Mt,card:V,createdAt:le,inReplyToId:z,inReplyToAccountId:J,content:Y,mentions:be,mediaAttachments:te,reblog:pe,uri:Rt,url:Ue,emojis:Ae,tags:Pe,pinned:ve,_deleted:Le,_pinned:Cn,emojiReactions:dt}=t,[yt,yo]=Z(null);ee(()=>{if(!Y||ge||yt)return;let _;return _=setTimeout(async()=>{let P=await Wd(Bd(Y));yo(P)},1e3),()=>clearTimeout(_)},[Y,ge]);const me=ge||yt,Ot=!!(te!=null&&te.length);w&&Ot&&(o="s");const bt=ae(()=>_r(),[]),tt=ae(()=>bt&&bt===oe,[oe,bt]),Pn=ze(Gs),X=!tt&&!s&&!u&&Pr(Mt,Pn);if((X==null?void 0:X.action)==="hide")return null;const _e=_=>{_.shiftKey};if(o!=="l"&&X)return r(ef,{status:t,filterInfo:X,instance:b,containerProps:{onMouseEnter:_e},showFollowedTags:!0,quoted:h});const Te=new Date(le),He=new Date(Ge);let ke=be==null?void 0:be.find(_=>_.id===J);!ke&&J===H&&(ke={url:Q,username:q,displayName:re});const[nt,Ln]=Z(ke);if(!c&&!nt&&J){const _=B.accounts[J];_?Ln(_):Nd(J,x).then(P=>{Ln(P),B.accounts[P.id]=P}).catch(P=>{})}const Tt=J===bt||(be==null?void 0:be.find(_=>_.id===bt)),qe=ae(()=>!!(Yo.account.get("preferences")||{})["reading:expand:spoilers"],[]),Mn=ae(()=>{var P;return((P=(Yo.account.get("preferences")||{})["reading:expand:media"])==null?void 0:P.toLowerCase())||"default"},[]),je=u||qe||!!C.spoilers[H],wt=u||Mn==="show_all"||!!C.spoilersMedia[H];if(pe)return se?r("div",{"data-state-post-id":A,class:"status-group",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"group",size:"l",alt:k._({id:"L8fEEm"})})," ",r(gt,{account:t.account,instance:b,showAvatar:!0})]}),r(Qt,{status:e?null:pe,statusID:e?pe.id:null,instance:b,size:o,contentTextWeight:i,readOnly:s,mediaFirst:w})]}):r("div",{"data-state-post-id":A,class:"status-reblog",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"rocket",size:"l"})," ",r(O,{id:"DlhB4J",components:{0:r(gt,{account:t.account,instance:b,showAvatar:!0}),1:r("span",{})}})]}),r(Qt,{status:e?null:pe,statusID:e?pe.id:null,instance:b,size:o,contentTextWeight:i,readOnly:s,enableCommentHint:!0,mediaFirst:w})]});const bo=Me(({children:_})=>r("div",{"data-state-post-id":A,class:"status-followed-tags",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"hashtag",size:"l"})," ",C.statusFollowedTags[A].slice(0,3).map(P=>r(Gt,{to:b?`/${b}/t/${P}`:`/t/${P}`,class:"status-followed-tag-item",children:P},P))]}),_]}),[A,b,C.statusFollowedTags[A]]),Et=g&&((Yr=C.statusFollowedTags[A])!=null&&Yr.length)?bo:F,de=o==="l",[xt,Dt]=Z(f),{contentTranslation:To,contentTranslationAutoInline:Mr}=C.settings;To||(d=!1);const Rr=ae(()=>{if(!To||!Mr||s||c&&!de||u||he||Ce||Ie||V||te!=null&&te.length)return!1;const _=jo(Y);return _>0&&_<=Od},[To,Mr,s,c,de,u,he,Ce,Ie,V,te,Y]),[wo,Rn]=Z(!1),[fa,Eo]=Z(!1),Or=ro(),Dr=ro(),ha=ro(),$t=$(null),On=k._({id:"7jyUKe"}),$r=Me(()=>Math.max(Math.round((he.length+jo(Y))/140)||1,1),[he,Y]),Nr=kn(Te),Fr=Ge&&kn(He);let nn=S&&N!=="direct"&&N!=="private";N==="private"&&tt&&(nn=!0);const Dn=_=>{var P;if(!L||!S)return alert(On);(_!=null&&_.shiftKey||(P=_==null?void 0:_.syntheticEvent)!=null&&P.shiftKey)&&rc({replyToStatus:t})||Gn({replyToStatus:t})},zr=ae(()=>te.some(_=>{var P,G;return!((G=(P=_.description)==null?void 0:P.trim)!=null&&G.call(P))}),[te]),Vr=ae(()=>Math.floor((new Date-Te)/(1e3*60*60*24*30)),[Te]),xo=async()=>{if(!L||!S)return alert(On),!1;try{if(B.statuses[A]={...t,reblogged:!ne,reblogsCount:Ee+(ne?-1:1)},ne){const _=await x.v1.statuses.$select(H).unreblog();ft(_,b)}else{const _=await x.v1.statuses.$select(H).reblog();ft(_,b)}return!0}catch{return B.statuses[A]=t,!1}},Hr=async()=>{if(!L||!S)return alert(On),!1;try{if(B.statuses[A]={...t,favourited:!ye,favouritesCount:xe+(ye?-1:1)},ye){const _=await x.v1.statuses.$select(H).unfavourite();ft(_,b)}else{const _=await x.v1.statuses.$select(H).favourite();ft(_,b)}return!0}catch{return B.statuses[A]=t,!1}},ko=async()=>{try{const _=await Hr();!de&&_&&Re(ye?k._({id:"sZvpIt",values:{0:q||R}}):k._({id:"yUngDO",values:{0:q||R}}))}catch{}},Br=async()=>{if(Zn("@mastodon/post-bookmark")){if(!L||!S)return alert(On),!1;try{if(B.statuses[A]={...t,bookmarked:!De},De){const _=await x.v1.statuses.$select(H).unbookmark();ft(_,b)}else{const _=await x.v1.statuses.$select(H).bookmark();ft(_,b)}return!0}catch{return B.statuses[A]=t,!1}}},Ur=async()=>{try{const _=await Br();!de&&_&&Re(De?k._({id:"lWQguj",values:{0:q||R}}):k._({id:"Fb2K8h",values:{0:q||R}}))}catch{}},on=C.settings.contentTranslationHideLanguages||[],[Nt,pa]=Z(ur[me+on]?$i(me,on):!1);ee(()=>{if(!me||Nt||ur[me+on])return;let _=setTimeout(()=>{const P=$i(me,on);P&&pa(P)},1);return()=>clearTimeout(_)},[me,Nt,on]);const jr=$(),Wr=$();async function ma(_){var ue,We,Ft,So;_&&(jr.current=x.v1.statuses.$select(e).rebloggedBy.list({limit:Oi}),Wr.current=x.v1.statuses.$select(e).favouritedBy.list({limit:Oi}));const[{value:P},{value:G}]=await Promise.allSettled([jr.current.next(),Wr.current.next()]);if((ue=P.value)!=null&&ue.length||(We=G.value)!=null&&We.length){const kt=[];return(Ft=P.value)!=null&&Ft.length&&kt.push(...P.value.map(St=>(St._types=["reblog"],St))),(So=G.value)!=null&&So.length&&kt.push(...G.value.map(St=>(St._types=["favourite"],St))),{value:kt,done:P.done&&G.done}}return{value:[],done:!0}}const ga=$(),Kr=["public","unlisted"].includes(N),va=["public","unlisted","private"].includes(N),Zr=r(F,{children:[!de&&L&&r(F,{children:r("div",{class:"menu-control-group-horizontal status-menu",children:[r(Se,{onClick:Dn,children:[r(M,{icon:"comment"}),r("span",{children:fe>0?rt(fe):k._({id:"ImOQa9"})})]}),r(Lo,{subMenu:!0,confirmLabel:r(F,{children:[r(M,{icon:"rocket"}),r("span",{children:ne?k._({id:"QzzGsY"}):k._({id:"kulphB"})})]}),className:`menu-reblog ${ne?"checked":""}`,menuExtras:r(Se,{onClick:()=>{Gn({draftStatus:{status:` +${Ue}`}})},children:[r(M,{icon:"quote"}),r("span",{children:r(O,{id:"ZhhOwV"})})]}),menuFooter:zr&&!ne?r("div",{class:"footer",children:[r(M,{icon:"alert"}),r(O,{id:"MB+wJL"})]}):Vr>=3&&r("div",{class:"footer",children:[r(M,{icon:"info"}),r("span",{children:r(O,{id:"dBme/4",values:{0:zd.format(-Vr,"month")},components:{0:r("strong",{})}})})]}),disabled:!nn,onClick:async()=>{try{const _=await xo();!de&&_&&Re(ne?k._({id:"bpDheH",values:{0:q||R}}):k._({id:"dbNZdP",values:{0:q||R}}))}catch{}},children:[r(M,{icon:"rocket"}),r("span",{children:Ee>0?rt(Ee):ne?k._({id:"QzzGsY"}):k._({id:"PiVIlD"})})]}),r(Se,{onClick:ko,className:`menu-favourite ${ye?"checked":""}`,children:[r(M,{icon:"heart"}),r("span",{children:xe>0?rt(xe):ye?k._({id:"OcUmcH"}):k._({id:"W9FRBT"})})]}),Zn("@mastodon/post-bookmark")&&r(Se,{onClick:Ur,className:`menu-bookmark ${De?"checked":""}`,children:[r(M,{icon:"bookmark"}),r("span",{children:De?k._({id:"q8EQYI"}):k._({id:"PZlHt8"})})]})]})}),!de&&L&&(de||T)&&r(an,{}),(de||T)&&r(F,{children:r(Se,{onClick:()=>{B.showGenericAccounts={heading:k._({id:"+XOeb+"}),fetchAccounts:ma,instance:b,showReactions:!0,postID:A}},children:[r(M,{icon:"react"}),r("span",{children:r(O,{id:"+XOeb+"})})]})}),!w&&r(F,{children:[(d||!me||Nt)&&r(an,{}),d?r("div",{class:mn?"menu-horizontal":"",children:[r(Se,{disabled:xt,onClick:()=>{Dt(!0)},children:[r(M,{icon:"translate"}),r("span",{children:r(O,{id:"pi8x/S"})})]}),mn&&r(Se,{onClick:()=>{const _=Go(t);_&&Ii(_,me)},children:[r(M,{icon:"speak"}),r("span",{children:r(O,{id:"yIBLq8"})})]})]}):(!me||Nt)&&r("div",{class:mn?"menu-horizontal":"",children:[r(li,{to:`${b?`/${b}`:""}/s/${H}?translate=1`,children:[r(M,{icon:"translate"}),r("span",{children:r(O,{id:"pi8x/S"})})]}),mn&&r(Se,{onClick:()=>{const _=Go(t);_&&Ii(_,me)},children:[r(M,{icon:"speak"}),r("span",{children:r(O,{id:"yIBLq8"})})]})]})]}),(!de&&L||d||!me||Nt)&&r(an,{}),!de&&r(F,{children:r(li,{to:b?`/${b}/s/${H}`:`/s/${H}`,onClick:_=>{m(_,t)},children:[r(M,{icon:"arrows-right"}),r("small",{children:[r(O,{id:"8MkSAW",values:{0:q||R},components:{0:r("span",{class:"bidi-isolate"})}}),r("br",{}),r("span",{class:"more-insignificant",children:[E(Ct[N])," • ",Nr]})]})]})}),!!Ge&&r(F,{children:r(Se,{onClick:()=>{Rn(H)},children:[r(M,{icon:"history"}),r("small",{children:[r(O,{id:"QL+7Jw"}),r("br",{}),r("span",{class:"more-insignificant",children:r(O,{id:"DuJJm9",values:{editedDateText:Fr}})})]})]})}),r(Se,{href:Ue,target:"_blank",children:[r(M,{icon:"external"}),r("small",{class:"menu-double-lines",style:{maxWidth:"16em"},children:Qd(Ue)})]}),r("div",{class:"menu-horizontal",children:[r(Se,{onClick:()=>{try{navigator.clipboard.writeText(Ue),Re(k._({id:"edWbV6"}))}catch{Re(k._({id:"W1ewR0"}))}},children:[r(M,{icon:"link"}),r("span",{children:r(O,{id:"he3ygx"})})]}),Kr&&(navigator==null?void 0:navigator.share)&&((Xr=navigator==null?void 0:navigator.canShare)==null?void 0:Xr.call(navigator,{url:Ue}))&&r(Se,{onClick:()=>{try{navigator.share({url:Ue})}catch{alert(k._({id:"TtG3Uh"}))}},children:[r(M,{icon:"share"}),r("span",{children:r(O,{id:"LFKLqp"})})]})]}),Kr&&de&&r(Se,{onClick:()=>{Eo(!0)},children:[r(M,{icon:"code"}),r("span",{children:r(O,{id:"jdVwsS"})})]}),(tt||Tt)&&r(an,{}),(tt||Tt)&&r(Se,{onClick:async()=>{try{const _=await x.v1.statuses.$select(H)[$e?"unmute":"mute"]();ft(_,b),Re($e?k._({id:"Pm+5jw"}):k._({id:"ywB7JM"}))}catch{Re($e?k._({id:"c6jxNY"}):k._({id:"8SN9kN"}))}},children:$e?r(F,{children:[r(M,{icon:"unmute"}),r("span",{children:r(O,{id:"i51zUR"})})]}):r(F,{children:[r(M,{icon:"mute"}),r("span",{children:r(O,{id:"OiUYO5"})})]})}),tt&&va&&r(Se,{onClick:async()=>{try{const _=await x.v1.statuses.$select(H)[ve?"unpin":"pin"]();ft(_,b),Re(ve?k._({id:"Yx809+"}):k._({id:"S6P6E+"}))}catch{Re(ve?k._({id:"A6cs15"}):k._({id:"vgUfWO"}))}},children:ve?r(F,{children:[r(M,{icon:"unpin"}),r("span",{children:r(O,{id:"XQMQZw"})})]}):r(F,{children:[r(M,{icon:"pin"}),r("span",{children:r(O,{id:"lfHLsx"})})]})}),tt&&r("div",{class:"menu-horizontal",children:[Zn("@mastodon/post-edit")&&r(Se,{onClick:()=>{Gn({editStatus:t})},children:[r(M,{icon:"pencil"}),r("span",{children:r(O,{id:"ePK91l"})})]}),de&&r(Lo,{subMenu:!0,confirmLabel:r(F,{children:[r(M,{icon:"trash"}),r("span",{children:r(O,{id:"FbPNuJ"})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{(async()=>{try{await x.v1.statuses.$select(H).remove();const _=Xi(H,b);_._deleted=!0,Re(k._({id:"KiyvHV"}))}catch{Re(k._({id:"Yb6p2q"}))}})()},children:[r(M,{icon:"trash"}),r("span",{children:r(O,{id:"Jb6/SB"})})]})]}),!tt&&de&&r(F,{children:[r(an,{}),r(Se,{className:"danger",onClick:()=>{B.showReportModal={account:t.account,post:t}},children:[r(M,{icon:"flag"}),r("span",{children:r(O,{id:"7PQAMY"})})]})]})]}),Gr=$(),[$n,rn]=Z(!1),[Nn,Fn]=Z({}),zn=v||!de&&!u&&!Le&&!h,_a=Zs(Fd&&zn?_=>{var We;if(_.pointerType==="mouse")return;const{clientX:P,clientY:G}=((We=_.touches)==null?void 0:We[0])||_,ue=_.target.closest("a");ue&&$t.current.contains(ue)&&!ue.getAttribute("href").startsWith("#")||(_.preventDefault(),Fn({anchorPoint:{x:P,y:G},direction:"right"}),rn(!0))}:null,{threshold:600,captureEvent:!0,detect:"touch",cancelOnMovement:2}),Vn=!s&&!u&&!h,ya=Ut("r, shift+r",Dn,{enabled:Vn}),ba=Ut("f, l",ko,{enabled:Vn}),Ta=Ut("d",Ur,{enabled:Vn}),wa=Ut("shift+b",()=>{(async()=>{try{const _=await xo();!de&&_&&Re(ne?k._({id:"bpDheH",values:{0:q||R}}):k._({id:"dbNZdP",values:{0:q||R}}))}catch{}})()},{enabled:Vn&&nn}),Ea=Ut("x",_=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const G=P.querySelector(".spoiler-button:not(.spoiling)");if(G)_.stopPropagation(),G.click();else{const ue=P.querySelector(".spoiler-media-button:not(.spoiling)");ue&&(_.stopPropagation(),ue.click())}}}),Hn=te.slice(0,de?void 0:4),Bn=te.length>1&&Hn.some(_=>!!_.description&&!Js(_.description)),xa=ae(()=>{if(!Bn)return null;const _=[];return Hn.forEach((P,G)=>{if(!P.description)return;const ue=_.findIndex(We=>We.media.description===P.description);ue===-1?_.push({media:P,indices:[G]}):_[ue].indices.push(G)}),_.map(({media:P,indices:G})=>r("div",{"data-caption-index":G.map(ue=>ue+1).join(" "),onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),B.showMediaAlt={alt:P.description,lang:me}},title:P.description,children:[r("sup",{children:G.map(ue=>ue+1).join(" ")})," ",P.description]},P.id))},[Bn,Hn,me]),sn=ae(()=>{var _;return!!z&&J===((_=t.account)==null?void 0:_.id)||!!C.statusThreadNumber[A]},[z,J,(Qr=t.account)==null?void 0:Qr.id,C.statusThreadNumber[A]]),ka=ae(()=>a&&!sn&&!c&&!z&&N==="public"&&fe>0,[a,sn,c,z,fe,N]),qr=ae(()=>{if(V||Ie||Ce||he||te!=null&&te.length||sn||c||z||fe<=0||!/[???︖❓❔⁇⁈⁉¿‽؟]/.test(Y))return!1;const G=jo(Y);if(G>0&&G<=Rd)return!0},[V,Ie,Ce,he,te,pe,sn,c,z,fe,Y]);return r(Et,{children:[y&&!!(z&&J)&&r(Jd,{sKey:A}),r("article",{"data-state-post-id":A,ref:_=>{var G;$t.current=_;const P=((G=_==null?void 0:_.closest)==null?void 0:G.call(_,".timeline-item, .timeline-item-alt, .status-link, .status-focus"))||_;ya(P),ba(P),Ta(P),wa(P),Ea(P)},tabindex:"-1",class:`status ${!c&&z&&nt?"status-reply-to":""} visibility-${N} ${Cn?"status-pinned":""} ${jd[o]} ${Le?"status-deleted":""} ${h?"status-card":""} ${$n?"status-menu-open":""} ${w&&Ot?"status-media-first":""}`,onMouseEnter:_e,onContextMenu:_=>{var ue,We;if(!zn||_.metaKey)return;const P=_.target.closest("a");if(P&&$t.current.contains(P)&&!P.getAttribute("href").startsWith("#"))return;const G=(ue=window.getSelection)==null?void 0:ue.call(window);if(G.toString().length>0){const{anchorNode:Ft}=G;if((We=$t.current)!=null&&We.contains(Ft))return}_.preventDefault(),Fn({anchorPoint:{x:_.clientX,y:_.clientY},direction:"right"}),rn(!0)},...zn?_a():{},children:[zn&&r(ls,{ref:Gr,state:$n?"open":void 0,...Nn,onClose:_=>{var P,G,ue;rn(!1),(_==null?void 0:_.reason)==="click"&&((ue=(G=(P=$t.current)==null?void 0:P.closest("[tabindex]"))==null?void 0:G.focus)==null||ue.call(G))},portal:{target:document.body},containerProps:{style:{zIndex:1001},onClick:()=>{var _,P;(P=(_=Gr.current)==null?void 0:_.closeMenu)==null||P.call(_)}},overflow:"auto",boundingBoxPadding:_s(),unmountOnClose:!0,children:Zr}),T&&o!=="l"&&!u&&!s&&!Le&&!h&&r("div",{class:`status-actions ${$n==="actions-bar"?"open":""}`,ref:ga,children:[r(Bt,{size:"s",title:k._({id:"ImOQa9"}),alt:k._({id:"ImOQa9"}),class:"reply-button",icon:"comment",iconSize:"m",onClick:Dn}),r(Bt,{size:"s",checked:ye,title:[k._({id:"W9FRBT"}),k._({id:"OcUmcH"})],alt:[k._({id:"W9FRBT"}),k._({id:"8ab1sR"})],class:"favourite-button",icon:"heart",iconSize:"m",count:xe,onClick:ko}),r("button",{type:"button",title:k._({id:"2FYpfJ"}),class:"plain more-button",onClick:_=>{_.preventDefault(),_.stopPropagation(),Fn({anchorRef:{current:_.currentTarget},align:"start",direction:"left",gap:0,shift:-8}),rn("actions-bar")},children:r(M,{icon:"more2",size:"m",alt:k._({id:"2FYpfJ"})})})]}),o!=="l"&&r("div",{class:"status-badge",children:[ne&&r(M,{class:"reblog",icon:"rocket",size:"s",alt:k._({id:"b7T5Zj"})}),ye&&r(M,{class:"favourite",icon:"heart",size:"s",alt:k._({id:"8ab1sR"})}),De&&r(M,{class:"bookmark",icon:"bookmark",size:"s",alt:k._({id:"1C/9Sa"})}),Cn&&r(M,{class:"pin",icon:"pin",size:"s",alt:k._({id:"kNiQp6"})})]}),o!=="s"&&r("a",{href:Q,tabindex:"-1",title:`@${R}`,onClick:_=>{_.preventDefault(),_.stopPropagation(),B.showAccount={account:t.account,instance:b}},children:r(st,{url:U||K,size:"xxl",squircle:ce})}),r("div",{class:"container",children:[r("div",{class:"meta",children:[r("span",{class:"meta-name",children:r(gt,{account:t.account,instance:b,showAvatar:o==="s",showAcct:de})})," ",o!=="l"&&(Le?r("span",{class:"status-deleted-tag",children:r(O,{id:"vGjmyl"})}):Ue&&!u&&!s&&!h?r(Gt,{to:b?`/${b}/s/${H}`:`/s/${H}`,onClick:_=>{_.metaKey||_.ctrlKey||_.shiftKey||_.altKey||_.which===2||(_.preventDefault(),_.stopPropagation(),m==null||m(_,t),Fn({anchorRef:{current:_.currentTarget},align:"end",direction:"bottom",gap:4}),rn(!0))},class:`time ${$n&&(Nn!=null&&Nn.anchorRef)?"is-open":""}`,children:[ka&&!qr?r(M,{icon:"comment2",size:"s",alt:k._({id:"RXmXDR",values:{repliesCount:fe}})}):N!=="public"&&N!=="direct"&&r(M,{icon:_n[N],alt:E(Ct[N]),size:"s"})," ",r(at,{datetime:Te,format:"micro"}),!u&&!s&&r(M,{icon:"more2",class:"more",alt:k._({id:"2FYpfJ"})})]}):r("span",{class:"time",children:[N!=="public"&&N!=="direct"&&r(F,{children:[r(M,{icon:_n[N],alt:E(Ct[N]),size:"s"})," "]}),r(at,{datetime:Te,format:"micro"})]}))]}),N==="direct"&&r(F,{children:[r("div",{class:"status-direct-badge",children:r(O,{id:"IV4QaU"})})," "]}),!c&&r(F,{children:sn?r("div",{class:"status-thread-badge",children:[r(M,{icon:"thread",size:"s"}),r(O,{id:"lQ8zCz",values:{0:C.statusThreadNumber[A]?` ${C.statusThreadNumber[A]}/X`:""}})]}):!!z&&!!nt&&(!!he||!be.find(_=>_.id===J))&&r("div",{class:"status-reply-badge",children:[r(M,{icon:"reply"})," ",r(gt,{account:nt,instance:b,short:!0})]})}),r("div",{class:`content-container ${he||Ce?"has-spoiler":""} ${je?"show-spoiler":""} ${wt?"show-media":""}`,"data-content-text-weight":i?$r():null,style:(de||i)&&{"--content-text-weight":$r()},children:w&&Ot?r(F,{children:[(!!he||!!Ce)&&!qe&&r(F,{children:[!!he&&r("span",{class:"spoiler-content media-first-spoiler-content",lang:me,dir:"auto",ref:Or,"data-read-more":E(yn),children:[r(qt,{text:he,emojis:Ae})," "]}),r("button",{class:`light spoiler-button media-first-spoiler-button ${je?"spoiling":""}`,type:"button",onClick:_=>{_.preventDefault(),_.stopPropagation(),je?(delete B.spoilers[H],qe||delete B.spoilersMedia[H]):(B.spoilers[H]=!0,qe||(B.spoilersMedia[H]=!0))},children:[r(M,{icon:je?"eye-open":"eye-close"})," ",je?k._({id:"6lGV3K"}):k._({id:"lqBX03"})]})]}),r(Zd,{mediaAttachments:te,language:me,postID:H,instance:b}),!!Y&&r("div",{class:"media-first-content content",ref:Dr,children:r(Di,{post:t,instance:b,previewMode:u})})]}):r(F,{children:[!!he&&r(F,{children:[r("div",{class:"content spoiler-content",lang:me,dir:"auto",ref:Or,"data-read-more":E(yn),children:r("p",{children:r(qt,{text:he,emojis:Ae})})}),qe||u?r("div",{class:"spoiler-divider",children:[r(M,{icon:"eye-open"})," ",r(O,{id:"gnKo7f"})]}):r("button",{class:`light spoiler-button ${je?"spoiling":""}`,type:"button",onClick:_=>{_.preventDefault(),_.stopPropagation(),je?(delete B.spoilers[H],qe||delete B.spoilersMedia[H]):(B.spoilers[H]=!0,qe||(B.spoilersMedia[H]=!0))},children:[r(M,{icon:je?"eye-open":"eye-close"})," ",je?k._({id:"6lGV3K"}):k._({id:"lqBX03"})]})]}),!!Y&&r("div",{class:"content",ref:Dr,"data-read-more":E(yn),inert:he&&!je?!0:void 0,children:[r(Di,{post:t,instance:b,previewMode:u}),r(tf,{id:H,instance:b,level:h})]}),!!Ie&&r(td,{lang:me,poll:Ie,readOnly:s||!L||!S,onUpdate:_=>{B.statuses[A].poll=_},refresh:()=>x.v1.polls.$select(Ie.id).fetch().then(_=>{B.statuses[A].poll=_}).catch(_=>{}),votePoll:_=>x.v1.polls.$select(Ie.id).votes.create({choices:_}).then(P=>{B.statuses[A].poll=P}).catch(P=>{})}),((d||Rr)&&Hd(Y)&&Nt||xt)&&r(Mu,{forceTranslate:xt||Rr,mini:!de&&!c,sourceLanguage:me,autoDetected:yt,text:Go(t)}),!u&&Ce&&!!te.length&&Mn!=="show_all"&&r("button",{class:`plain spoiler-media-button ${wt?"spoiling":""}`,type:"button",hidden:!qe&&!!he,onClick:_=>{_.preventDefault(),_.stopPropagation(),wt?delete B.spoilersMedia[H]:B.spoilersMedia[H]=!0},children:[r(M,{icon:wt?"eye-open":"eye-close"})," ",wt?k._({id:"6lGV3K"}):k._({id:"9ZCilh"})]}),!!te.length&&(te.length>1&&(de||c&&o==="m")?r("div",{class:"media-large-container",children:te.map((_,P)=>r("div",{class:"media-container media-eq1",children:r(lr,{media:_,autoAnimate:!0,showCaption:!0,allowLongerCaption:!Y,lang:me,to:`/${b}/s/${H}?${c?"media":"media-only"}=${P+1}`,onClick:p?G=>p(G,P,_,t):void 0})},_.id))}):r(Kd,{lang:me,enabled:Bn,captionChildren:xa,children:r("div",{ref:ha,class:`media-container media-eq${te.length} ${te.length>2?"media-gt2":""} ${te.length>4?"media-gt4":""}`,children:Hn.map((_,P)=>r(lr,{media:_,autoAnimate:de,showCaption:te.length===1,allowLongerCaption:!Y&&te.length===1,lang:me,altIndex:Bn&&!!_.description&&P+1,to:`/${b}/s/${H}?${c?"media":"media-only"}=${P+1}`,onClick:p?G=>{p(G,P,_,t)}:void 0,checkAspectRatio:te.length===1},_.id))})})),!!V&&/^https/i.test(V==null?void 0:V.url)&&!Ce&&!he&&!Ie&&!te.length&&!C.statusQuotes[A]&&r(qd,{card:V,selfReferential:(V==null?void 0:V.url)===t.url||(V==null?void 0:V.url)===t.uri,selfAuthor:(Jr=V==null?void 0:V.authors)==null?void 0:Jr.some(_=>{var P;return((P=_.account)==null?void 0:P.url)===Q}),instance:D})]})}),!de&&qr&&r("div",{class:"content-comment-hint insignificant",children:[r(M,{icon:"comment2",alt:k._({id:"N8UzTV"})})," ",fe]}),de&&r(F,{children:[r("div",{class:"extra-meta",children:Le?r("span",{class:"status-deleted-tag",children:r(O,{id:"vGjmyl"})}):r(F,{children:[r("span",{children:E(Ct[N])})," •"," ",r("a",{href:Ue,target:"_blank",rel:"noopener noreferrer",children:[new Date().getTime()-Te.getTime()<864e5&&r(F,{children:[r(at,{datetime:Te,format:"micro"})," ","‒"," "]}),r("time",{class:"created",datetime:Te.toISOString(),title:Te.toLocaleString(),children:Nr})]}),Ge&&r(F,{children:[" ","• ",r(M,{icon:"pencil",alt:k._({id:"MRZxAn"})})," ",r("time",{tabIndex:"0",class:"edited",datetime:He.toISOString(),onClick:()=>{Rn(H)},children:Fr})]})]})}),!!(dt!=null&&dt.length)&&r("div",{class:"emoji-reactions",children:dt.map(_=>{const{name:P,count:G,me:ue,url:We,staticUrl:Ft}=_;if(We)return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[r(ir,{alt:P,url:We,staticUrl:Ft})," ",G]});if(/^:.+?:$/.test(P)){const kt=Ae.find(St=>St.shortcode===P.replace(/^:/,"").replace(/:$/,""));if(kt)return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[r(ir,{alt:P,url:kt.url,staticUrl:kt.staticUrl})," ",G]})}return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[P," ",G]})})}),r("div",{class:`actions ${Le?"disabled":""}`,children:[r("div",{class:"action has-count",children:r(Bt,{title:k._({id:"ImOQa9"}),alt:k._({id:"VbyRUy"}),class:"reply-button",icon:"comment",count:fe,onClick:Dn})}),r("div",{class:"action has-count",children:r(Lo,{disabled:!nn,onClick:xo,confirmLabel:r(F,{children:[r(M,{icon:"rocket"}),r("span",{children:ne?k._({id:"QzzGsY"}):k._({id:"kulphB"})})]}),menuExtras:r(Se,{onClick:()=>{Gn({draftStatus:{status:` +${Ue}`}})},children:[r(M,{icon:"quote"}),r("span",{children:r(O,{id:"ZhhOwV"})})]}),menuFooter:zr&&!ne&&r("div",{class:"footer",children:[r(M,{icon:"alert"}),r(O,{id:"MB+wJL"})]}),children:r(Bt,{checked:ne,title:[k._({id:"kulphB"}),k._({id:"QzzGsY"})],alt:[k._({id:"kulphB"}),k._({id:"b7T5Zj"})],class:"reblog-button",icon:"rocket",count:Ee,disabled:!nn})})}),r("div",{class:"action has-count",children:r(Bt,{checked:ye,title:[k._({id:"W9FRBT"}),k._({id:"OcUmcH"})],alt:[k._({id:"W9FRBT"}),k._({id:"8ab1sR"})],class:"favourite-button",icon:"heart",count:xe,onClick:Hr})}),Zn("@mastodon/post-bookmark")&&r("div",{class:"action",children:r(Bt,{checked:De,title:[k._({id:"PZlHt8"}),k._({id:"q8EQYI"})],alt:[k._({id:"PZlHt8"}),k._({id:"1C/9Sa"})],class:"bookmark-button",icon:"bookmark",onClick:Br})}),r(ys,{portal:{target:document.querySelector(".status-deck")||document.body},align:"end",gap:4,overflow:"auto",viewScroll:"close",menuButton:r("div",{class:"action",children:r("button",{type:"button",title:k._({id:"2FYpfJ"}),class:"plain more-button",children:r(M,{icon:"more",size:"l",alt:k._({id:"2FYpfJ"})})})}),children:Zr})]})]})]}),!!wo&&r(Qo,{onClick:_=>{_.target===_.currentTarget&&Rn(!1)},children:r(Yd,{statusID:wo,instance:b,fetchStatusHistory:()=>x.v1.statuses.$select(wo).history.list(),onClose:()=>{var _;Rn(!1),(_=$t.current)==null||_.focus()}})}),!!fa&&r(Qo,{onClick:_=>{_.target===_.currentTarget&&Eo(!1)},children:r(Xd,{post:t,instance:b,onClose:()=>{Eo(!1)}})})]})]})}function Kd(e){const{enabled:t,children:n,lang:o,captionChildren:i}=e;return!t||!i?n:r("figure",{class:"media-figure-multiple",children:[n,r("figcaption",{lang:o,dir:"auto",children:i})]})}function Zd(e){const{mediaAttachments:t,language:n,postID:o,instance:i}=e,s=t.length>1,a=$(),[c,l]=Z(0);return ee(()=>{let d=()=>{const{clientWidth:f,scrollLeft:u}=a.current,p=Math.round(Math.abs(u)/f);l(p)};return a.current&&a.current.addEventListener("scroll",d,{passive:!0}),()=>{a.current&&a.current.removeEventListener("scroll",d)}},[]),r(F,{children:[r("div",{class:"media-first-container",children:[r("div",{class:"media-first-carousel",ref:a,children:t.map((d,f)=>r("div",{class:"media-first-item",children:r(lr,{media:d,lang:n,to:`/${i}/s/${o}?media=${f+1}`})},d.id))}),s&&r("div",{class:"media-carousel-controls",children:[r("div",{class:"carousel-indexer",children:[c+1,"/",t.length]}),r("label",{class:"media-carousel-button",children:r("button",{type:"button",class:"carousel-button",hidden:c===0,onClick:d=>{d.preventDefault(),d.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(c-1)*(rr()?-1:1),behavior:"smooth"})},children:r(M,{icon:"arrow-left"})})}),r("label",{class:"media-carousel-button",children:r("button",{type:"button",class:"carousel-button",hidden:c===t.length-1,onClick:d=>{d.preventDefault(),d.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(c+1)*(rr()?-1:1),behavior:"smooth"})},children:r(M,{icon:"arrow-right"})})})]})]}),s&&r("div",{class:"media-carousel-dots",style:{"--dots-count":t.length},children:t.map((d,f)=>r("span",{class:`carousel-dot ${f===c?"active":""}`},d.id))})]})}function Ni(e){return Ps.toUnicode(URL.parse(e).hostname.replace(/^www\./,"").replace(/\/$/,""))}function Fi(e){return["x.com","twitter.com","threads.net","bsky.app"].includes(e)}function Gd({authors:e,hidden:t,children:n}){var i,s;if(t||!((s=(i=e==null?void 0:e[0])==null?void 0:i.account)!=null&&s.id))return n;const o=e[0].account;return r("div",{class:"card-byline",children:[n,r("div",{class:"card-byline-author",children:[r(M,{icon:"link",size:"s"})," ",r("small",{children:r(O,{id:"4LHHK6",components:{0:r(gt,{account:o,showAvatar:!0})}})})]})]})}function qd({card:e,selfReferential:t,selfAuthor:n,instance:o}){var Q;const i=In(B),{blurhash:s,title:a,description:c,html:l,providerName:d,providerUrl:f,authorName:u,authorUrl:p,width:h,height:m,image:g,imageDescription:v,url:T,type:y,embedUrl:w,language:E,publishedAt:x,authors:b}=e,S=a||d||u,L=h/m>=1.2?"large":"",[A,C]=Z(null);if(ee(()=>{S&&g&&!t&&Fa(T)&&za(o,T).then(re=>{if(!re)return;const{id:q,url:ie}=re;C("#"+ie)})},[S,g,t]),i.unfurledLinks[T])return null;const R=/`;\n this.domRefFrame.insertAdjacentHTML('beforeend', iframeHTML);\n this.domRefFrame.classList.add('activated');\n this.isIframeLoaded = true;\n this.attemptShortAutoPlay();\n this.dispatchEvent(new CustomEvent('liteYoutubeIframeLoaded', {\n detail: {\n videoId: this.videoId,\n },\n bubbles: true,\n cancelable: true,\n }));\n }\n }\n initImagePlaceholder() {\n const posterUrlWebp = `https://i.ytimg.com/vi_webp/${this.videoId}/${this.posterQuality}.webp`;\n const posterUrlJpeg = `https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`;\n this.domRefImg.fallback.loading = this.posterLoading;\n this.domRefImg.webp.srcset = posterUrlWebp;\n this.domRefImg.jpeg.srcset = posterUrlJpeg;\n this.domRefImg.fallback.src = posterUrlJpeg;\n this.domRefImg.fallback.setAttribute('aria-label', `${this.videoPlay}: ${this.videoTitle}`);\n this.domRefImg?.fallback?.setAttribute('alt', `${this.videoPlay}: ${this.videoTitle}`);\n }\n initIntersectionObserver() {\n const options = {\n root: null,\n rootMargin: '0px',\n threshold: 0,\n };\n const observer = new IntersectionObserver((entries, observer) => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !this.isIframeLoaded) {\n LiteYTEmbed.warmConnections(this);\n this.addIframe(true);\n observer.unobserve(this);\n }\n });\n }, options);\n observer.observe(this);\n if (this.autoPause) {\n const windowPause = new IntersectionObserver((e, o) => {\n e.forEach(entry => {\n if (entry.intersectionRatio !== 1) {\n this.shadowRoot\n .querySelector('iframe')\n ?.contentWindow?.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}', '*');\n }\n });\n }, { threshold: 1 });\n windowPause.observe(this);\n }\n }\n attemptShortAutoPlay() {\n if (this.isYouTubeShort()) {\n setTimeout(() => {\n this.shadowRoot\n .querySelector('iframe')\n ?.contentWindow?.postMessage('{\"event\":\"command\",\"func\":\"' + 'playVideo' + '\",\"args\":\"\"}', '*');\n }, 2000);\n }\n }\n isYouTubeShort() {\n return (this.getAttribute('short') === '' &&\n window.matchMedia('(max-width: 40em)').matches);\n }\n static addPrefetch(kind, url) {\n const linkElem = document.createElement('link');\n linkElem.rel = kind;\n linkElem.href = url;\n linkElem.crossOrigin = 'true';\n document.head.append(linkElem);\n }\n static warmConnections(context) {\n if (LiteYTEmbed.isPreconnected || window.liteYouTubeIsPreconnected)\n return;\n LiteYTEmbed.addPrefetch('preconnect', 'https://i.ytimg.com/');\n LiteYTEmbed.addPrefetch('preconnect', 'https://s.ytimg.com');\n if (!context.noCookie) {\n LiteYTEmbed.addPrefetch('preconnect', 'https://www.youtube.com');\n LiteYTEmbed.addPrefetch('preconnect', 'https://www.google.com');\n LiteYTEmbed.addPrefetch('preconnect', 'https://googleads.g.doubleclick.net');\n LiteYTEmbed.addPrefetch('preconnect', 'https://static.doubleclick.net');\n }\n else {\n LiteYTEmbed.addPrefetch('preconnect', 'https://www.youtube-nocookie.com');\n }\n LiteYTEmbed.isPreconnected = true;\n window.liteYouTubeIsPreconnected = true;\n }\n}\nLiteYTEmbed.isPreconnected = false;\ncustomElements.define('lite-youtube', LiteYTEmbed);\n//# sourceMappingURL=lite-youtube.js.map","const digitLookup = new Uint8Array(128);\nfor (let i = 0; i < 83; i++) {\n digitLookup[\n '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~'.charCodeAt(\n i,\n )\n ] = i;\n}\nconst decode83 = (str, start, end) => {\n let value = 0;\n while (start < end) {\n value *= 83;\n value += digitLookup[str.charCodeAt(start++)];\n }\n return value;\n};\n\nconst pow = Math.pow;\nconst PI = Math.PI;\nconst PI2 = PI * 2;\n\nconst d = 3294.6;\nconst e = 269.025;\nconst sRGBToLinear = (value) =>\n value > 10.31475 ? pow(value / e + 0.052132, 2.4) : value / d;\n\nconst linearTosRGB = (v) =>\n ~~(v > 0.00001227 ? e * pow(v, 0.416666) - 13.025 : v * d + 1);\n\nconst signSqr = (x) => (x < 0 ? -1 : 1) * x * x;\n\n/**\n * Fast approximate cosine implementation\n * Based on FTrig https://github.com/netcell/FTrig\n */\nconst fastCos = (x) => {\n x += PI / 2;\n while (x > PI) {\n x -= PI2;\n }\n const cos = 1.27323954 * x - 0.405284735 * signSqr(x);\n return 0.225 * (signSqr(cos) - cos) + cos;\n};\n\n/**\n * Extracts average color from BlurHash image\n * @param {string} blurHash BlurHash image string\n * @returns {[number, number, number]}\n */\nexport function getBlurHashAverageColor(blurHash) {\n const val = decode83(blurHash, 2, 6);\n return [val >> 16, (val >> 8) & 255, val & 255];\n}\n\n/**\n * Decodes BlurHash image\n * @param {string} blurHash BlurHash image string\n * @param {number} width Output image width\n * @param {number} height Output image height\n * @param {?number} punch\n * @returns {Uint8ClampedArray}\n */\nexport function decodeBlurHash(blurHash, width, height, punch) {\n const sizeFlag = decode83(blurHash, 0, 1);\n const numX = (sizeFlag % 9) + 1;\n const numY = ~~(sizeFlag / 9) + 1;\n const size = numX * numY;\n\n let i = 0,\n j = 0,\n x = 0,\n y = 0,\n r = 0,\n g = 0,\n b = 0,\n basis = 0,\n basisY = 0,\n colorIndex = 0,\n pixelIndex = 0,\n value = 0;\n\n const maximumValue = ((decode83(blurHash, 1, 2) + 1) / 13446) * (punch | 1);\n\n const colors = new Float64Array(size * 3);\n\n const averageColor = getBlurHashAverageColor(blurHash);\n for (i = 0; i < 3; i++) {\n colors[i] = sRGBToLinear(averageColor[i]);\n }\n\n for (i = 1; i < size; i++) {\n value = decode83(blurHash, 4 + i * 2, 6 + i * 2);\n colors[i * 3] = signSqr(~~(value / 361) - 9) * maximumValue;\n colors[i * 3 + 1] = signSqr((~~(value / 19) % 19) - 9) * maximumValue;\n colors[i * 3 + 2] = signSqr((value % 19) - 9) * maximumValue;\n }\n\n const cosinesY = new Float64Array(numY * height);\n const cosinesX = new Float64Array(numX * width);\n for (j = 0; j < numY; j++) {\n for (y = 0; y < height; y++) {\n cosinesY[j * height + y] = fastCos((PI * y * j) / height);\n }\n }\n for (i = 0; i < numX; i++) {\n for (x = 0; x < width; x++) {\n cosinesX[i * width + x] = fastCos((PI * x * i) / width);\n }\n }\n\n const bytesPerRow = width * 4;\n const pixels = new Uint8ClampedArray(bytesPerRow * height);\n\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n r = g = b = 0;\n for (j = 0; j < numY; j++) {\n basisY = cosinesY[j * height + y];\n for (i = 0; i < numX; i++) {\n basis = cosinesX[i * width + x] * basisY;\n colorIndex = (i + j * numX) * 3;\n r += colors[colorIndex] * basis;\n g += colors[colorIndex + 1] * basis;\n b += colors[colorIndex + 2] * basis;\n }\n }\n\n pixelIndex = 4 * x + y * bytesPerRow;\n pixels[pixelIndex] = linearTosRGB(r);\n pixels[pixelIndex + 1] = linearTosRGB(g);\n pixels[pixelIndex + 2] = linearTosRGB(b);\n pixels[pixelIndex + 3] = 255; // alpha\n }\n }\n return pixels;\n}\n","/**\n * @param {string[]} splittedHtml\n * @param {{ char?: string; count?: number}} options\n * @returns {string}\n */\nconst addIndentation = (splittedHtml, options = {}) => {\n const char = options.char || ' '\n const count = options.count || 2\n\n let level = 0\n const opened = []\n\n return splittedHtml.reverse().reduce((indented, elTag) => {\n if (opened.length\n && level\n && opened[level]\n /* if current element tag is the same as previously opened one */\n && opened[level] === elTag.substring(1, opened[level].length + 1)\n ) {\n opened.splice(level, 1)\n level--\n }\n\n const indentation = char.repeat(level ? level * count : 0)\n\n const newIndented = [\n `${indentation}${elTag}`,\n ...indented,\n ]\n\n // if current element tag is closing tag\n // add it to opened elements\n if (elTag.substring(0, 2) === ' (\n // Replace\n // - 1 or more spaces or tabs at the start of line\n // - 1 or more spaces or tabs at the end of line\n // - empty lines\n // with empty string\n nonFormattedString.trim().replace(/(^(\\s|\\t)+|(( |\\t)+)$)/gm, '')\n)\n\n/**\n * @param {string} markup\n * @returns {string[]} Array of strings splitted on new lines without empty lines\n */\nconst mergeAttributesWithElements = (markup) => {\n const splittedMarkup = removeEmptyLines(markup).split('\\n')\n\n const mergedLines = []\n let currentElement = ''\n for (let i = 0; i < splittedMarkup.length; i += 1) {\n const line = splittedMarkup[i]\n\n // If line is closing element/tag separate closing tag from rest of the line with space\n if (line.endsWith('/>')) {\n mergedLines.push(`${currentElement}${line.slice(0, -2)} />`)\n currentElement = ''\n // eslint-disable-next-line no-continue\n continue\n }\n\n if (line.endsWith('>')) {\n mergedLines.push(`${currentElement}${\n line.startsWith('>') || line.startsWith('<') ? '' : ' '\n }${line}`)\n currentElement = ''\n // eslint-disable-next-line no-continue\n continue\n }\n\n currentElement += currentElement.length ? ` ${line}` : line\n }\n\n return mergedLines\n}\n\nmodule.exports = {\n mergeAttributesWithElements,\n removeEmptyLines,\n}\n","const addIndentation = require('./utils/addIndentation')\nconst { mergeAttributesWithElements } = require('./utils/toLines')\n\n/**\n * @param {string} markup\n * @param {{ char?: string; count?: number }} options\n * @returns {string}\n */\nconst prettify = (markup, options = {}) => {\n const splitted = mergeAttributesWithElements(markup)\n\n return addIndentation(splitted, options)\n}\n\nmodule.exports = prettify\n","import { useRef as s, useCallback as h, useEffect as g } from \"react\";\nvar l = /* @__PURE__ */ ((e) => (e.Mouse = \"mouse\", e.Touch = \"touch\", e.Pointer = \"pointer\", e))(l || {}), d = /* @__PURE__ */ ((e) => (e.CancelledByMovement = \"cancelled-by-movement\", e.CancelledByRelease = \"cancelled-by-release\", e.CancelledOutsideElement = \"cancelled-outside-element\", e))(d || {});\nconst A = () => typeof window == \"object\" ? window?.PointerEvent ?? null : null, z = () => typeof window == \"object\" ? window?.TouchEvent ?? null : null;\nfunction U(e) {\n const { nativeEvent: t } = e, u = z();\n return u && t instanceof u || \"touches\" in e;\n}\nfunction X(e) {\n const t = A();\n return e.nativeEvent instanceof MouseEvent && !(t && e.nativeEvent instanceof t);\n}\nfunction Y(e) {\n const { nativeEvent: t } = e;\n if (!t)\n return !1;\n const u = A();\n return u && t instanceof u || \"pointerId\" in t;\n}\nfunction R(e) {\n return X(e) || U(e) || Y(e);\n}\nfunction j(e) {\n return U(e) ? {\n x: e.touches[0].pageX,\n y: e.touches[0].pageY\n } : X(e) || Y(e) ? {\n x: e.pageX,\n y: e.pageY\n } : null;\n}\nfunction G(e) {\n return {\n target: e.target,\n currentTarget: e.currentTarget,\n nativeEvent: e,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n persist: () => {\n }\n };\n}\nfunction J(e, {\n threshold: t = 400,\n captureEvent: u = !1,\n detect: y = l.Pointer,\n cancelOnMovement: w = !1,\n cancelOutsideElement: v = !0,\n filterEvents: p,\n onStart: M,\n onMove: C,\n onFinish: L,\n onCancel: b\n} = {}) {\n const P = s(!1), c = s(!1), I = s(), a = s(), T = s(e), f = s(null), E = h(\n (n) => (r) => {\n c.current || R(r) && (p !== void 0 && !p(r) || (u && r.persist(), M?.(r, { context: n }), f.current = j(r), c.current = !0, I.current = r.currentTarget, a.current = setTimeout(() => {\n T.current && (T.current(r, { context: n }), P.current = !0);\n }, t)));\n },\n [u, p, M, t]\n ), i = h(\n (n) => (r, o) => {\n R(r) && c.current && (f.current = null, u && r.persist(), P.current ? L?.(r, { context: n }) : c.current && b?.(r, { context: n, reason: o ?? d.CancelledByRelease }), P.current = !1, c.current = !1, a.current !== void 0 && clearTimeout(a.current));\n },\n [u, L, b]\n ), m = h(\n (n) => (r) => {\n if (C?.(r, { context: n }), w !== !1 && f.current) {\n const o = j(r);\n if (o) {\n const B = w === !0 ? 25 : w, D = {\n x: Math.abs(o.x - f.current.x),\n y: Math.abs(o.y - f.current.y)\n };\n (D.x > B || D.y > B) && i(n)(r, d.CancelledByMovement);\n }\n }\n },\n [i, w, C]\n ), q = h(\n (n) => {\n if (e === null)\n return {};\n switch (y) {\n case l.Mouse: {\n const r = {\n onMouseDown: E(n),\n onMouseMove: m(n),\n onMouseUp: i(n)\n };\n return v && (r.onMouseLeave = (o) => {\n i(n)(o, d.CancelledOutsideElement);\n }), r;\n }\n case l.Touch:\n return {\n onTouchStart: E(n),\n onTouchMove: m(n),\n onTouchEnd: i(n)\n };\n case l.Pointer: {\n const r = {\n onPointerDown: E(n),\n onPointerMove: m(n),\n onPointerUp: i(n)\n };\n return v && (r.onPointerLeave = (o) => i(n)(o, d.CancelledOutsideElement)), r;\n }\n }\n },\n [e, i, v, y, m, E]\n );\n return g(() => {\n if (!window)\n return;\n function n(r) {\n const o = G(r);\n i()(o);\n }\n return window.addEventListener(\"mouseup\", n), window.addEventListener(\"touchend\", n), window.addEventListener(\"pointerup\", n), () => {\n window.removeEventListener(\"mouseup\", n), window.removeEventListener(\"touchend\", n), window.removeEventListener(\"pointerup\", n);\n };\n }, [i]), g(\n () => () => {\n a.current !== void 0 && clearTimeout(a.current);\n },\n []\n ), g(() => {\n T.current = e;\n }, [e]), q;\n}\nexport {\n d as LongPressCallbackReason,\n l as LongPressEventType,\n J as useLongPress\n};\n","import { Plural, plural, t, Trans } from '@lingui/macro';\nimport { useState } from 'preact/hooks';\n\nimport shortenNumber from '../utils/shorten-number';\n\nimport EmojiText from './emoji-text';\nimport Icon from './icon';\nimport RelativeTime from './relative-time';\n\nexport default function Poll({\n poll,\n lang,\n readOnly,\n refresh = () => {},\n votePoll = () => {},\n}) {\n const [uiState, setUIState] = useState('default');\n const {\n expired,\n expiresAt,\n id,\n multiple,\n options,\n ownVotes,\n voted,\n votersCount,\n votesCount,\n emojis,\n } = poll;\n const expiresAtDate = !!expiresAt && new Date(expiresAt); // Update poll at point of expiry\n // NOTE: Disable this because setTimeout runs immediately if delay is too large\n // https://stackoverflow.com/a/56718027/20838\n // useEffect(() => {\n // let timeout;\n // if (!expired && expiresAtDate) {\n // const ms = expiresAtDate.getTime() - Date.now() + 1; // +1 to give it a little buffer\n // if (ms > 0) {\n // timeout = setTimeout(() => {\n // setUIState('loading');\n // (async () => {\n // // await refresh();\n // setUIState('default');\n // })();\n // }, ms);\n // }\n // }\n // return () => {\n // clearTimeout(timeout);\n // };\n // }, [expired, expiresAtDate]);\n\n const pollVotesCount = multiple ? votersCount : votesCount;\n let roundPrecision = 0;\n\n if (pollVotesCount <= 1000) {\n roundPrecision = 0;\n } else if (pollVotesCount <= 10000) {\n roundPrecision = 1;\n } else if (pollVotesCount <= 100000) {\n roundPrecision = 2;\n }\n\n const [showResults, setShowResults] = useState(false);\n const optionsHaveVoteCounts = options.every((o) => o.votesCount !== null);\n\n return (\n \n {(showResults && optionsHaveVoteCounts) || voted || expired ? (\n <>\n
    \n {options.map((option, i) => {\n const { title, votesCount: optionVotesCount } = option;\n const ratio = pollVotesCount\n ? optionVotesCount / pollVotesCount\n : 0;\n const percentage = ratio\n ? ratio.toLocaleString(i18n.locale || undefined, {\n style: 'percent',\n maximumFractionDigits: roundPrecision,\n })\n : '0%';\n\n const isLeading =\n optionVotesCount > 0 &&\n optionVotesCount ===\n Math.max(...options.map((o) => o.votesCount));\n return (\n \n
    \n \n \n \n {voted && ownVotes.includes(i) && (\n <>\n {' '}\n \n \n )}\n
    \n \n {percentage}\n
    \n \n );\n })}\n \n {!expired && !voted && (\n {\n e.preventDefault();\n setShowResults(false);\n }}\n >\n Hide results\n \n )}\n \n ) : (\n {\n e.preventDefault();\n const form = e.target;\n const formData = new FormData(form);\n const choices = [];\n formData.forEach((value, key) => {\n if (key === 'poll') {\n choices.push(value);\n }\n });\n if (!choices.length) return;\n setUIState('loading');\n await votePoll(choices);\n setUIState('default');\n }}\n >\n
    \n {options.map((option, i) => {\n const { title } = option;\n return (\n
    \n \n
    \n );\n })}\n
    \n {!readOnly && (\n \n Vote\n \n )}\n \n )}\n

    \n {!expired && !readOnly && (\n {\n e.preventDefault();\n setUIState('loading');\n\n (async () => {\n await refresh();\n setUIState('default');\n })();\n }}\n title={t`Refresh`}\n >\n \n \n )}\n {!voted && !expired && !readOnly && optionsHaveVoteCounts && (\n {\n e.preventDefault();\n setShowResults(!showResults);\n }}\n title={showResults ? t`Hide results` : t`Show results`}\n >\n {' '}\n \n )}\n {!expired && !readOnly && ' '}\n \n {shortenNumber(votesCount)} vote\n \n }\n other={\n \n {shortenNumber(votesCount)} votes\n \n }\n />\n {!!votersCount && votersCount !== votesCount && (\n <>\n {' '}\n •{' '}\n \n {shortenNumber(votersCount)}{' '}\n voter\n \n }\n other={\n \n {shortenNumber(votersCount)}{' '}\n voters\n \n }\n />\n \n )}{' '}\n •{' '}\n {expired ? (\n !!expiresAtDate ? (\n \n Ended \n \n ) : (\n t`Ended`\n )\n ) : !!expiresAtDate ? (\n \n Ending \n \n ) : (\n t`Ending`\n )}\n

    \n \n );\n}\n","import { createContext } from 'preact';\n\nconst FilterContext = createContext();\nexport default FilterContext;\n","import mem from './mem';\nimport { getCurrentAccountID } from './store-utils';\n\nfunction _isFiltered(filtered, filterContext) {\n if (!filtered?.length) return false;\n const appliedFilters = filtered.filter((f) => {\n const { filter } = f;\n const hasContext = filter.context.includes(filterContext);\n if (!hasContext) return false;\n if (!filter.expiresAt) return hasContext;\n return new Date(filter.expiresAt) > new Date();\n });\n if (!appliedFilters.length) return false;\n const isHidden = appliedFilters.some((f) => f.filter.filterAction === 'hide');\n if (isHidden)\n return {\n action: 'hide',\n };\n const isWarn = appliedFilters.some((f) => f.filter.filterAction === 'warn');\n if (isWarn) {\n const filterTitles = appliedFilters.map((f) => f.filter.title);\n return {\n action: 'warn',\n titles: filterTitles,\n titlesStr: filterTitles.join(' • '),\n };\n }\n return false;\n}\nexport const isFiltered = mem(_isFiltered);\n\nexport function filteredItem(item, filterContext, currentAccountID) {\n const { filtered } = item;\n if (!filtered?.length) return true;\n const isSelf = currentAccountID && item.account?.id === currentAccountID;\n if (isSelf) return true;\n const filterState = isFiltered(filtered, filterContext);\n if (!filterState) return true;\n if (filterState.action === 'hide') return false;\n // item._filtered = filterState;\n return true;\n}\nexport function filteredItems(items, filterContext) {\n if (!items?.length) return [];\n if (!filterContext) return items;\n const currentAccountID = getCurrentAccountID();\n return items.filter((item) =>\n filteredItem(item, filterContext, currentAccountID),\n );\n}\n","const div = document.createElement('div');\nexport default function htmlContentLength(html) {\n if (!html) return 0;\n div.innerHTML = html;\n // .invisible spans for links\n // e.g. https://mastodon.social\n div.querySelectorAll('.invisible').forEach((el) => {\n el.remove();\n });\n return div.innerText.length;\n}\n","export const supportsTTS = 'speechSynthesis' in window;\n\nexport function speak(text, lang) {\n if (!supportsTTS) return;\n try {\n if (speechSynthesis.speaking) {\n speechSynthesis.cancel();\n }\n const utterance = new SpeechSynthesisUtterance(text);\n if (lang) utterance.lang = lang;\n speechSynthesis.speak(utterance);\n } catch (e) {\n alert(e);\n }\n}\n","import getHTMLText from './getHTMLText';\n\nfunction statusPeek(status) {\n const { spoilerText, content, poll, mediaAttachments } = status;\n let text = '';\n if (spoilerText?.trim()) {\n text += spoilerText;\n } else {\n text += getHTMLText(content);\n }\n text = text.trim();\n if (poll?.options?.length) {\n text += `\\n\\n📊:\\n${poll.options\n .map((o) => `${poll.multiple ? '▪️' : '•'} ${o.title}`)\n .join('\\n')}`;\n }\n if (mediaAttachments?.length) {\n text +=\n ' ' +\n mediaAttachments\n .map(\n (m) =>\n ({\n image: '🖼️',\n gifv: '🎞️',\n video: '📹',\n audio: '🎵',\n unknown: '',\n })[m.type] || '',\n )\n .join('');\n }\n return text;\n}\n\nexport default statusPeek;\n","import{useRef as r,useEffect as n,useMemo as t,useState as e,useCallback as u}from\"react\";function c(e,u,c){var i=this,a=r(null),o=r(0),f=r(null),l=r([]),v=r(),m=r(),d=r(e),g=r(!0);d.current=e;var p=\"undefined\"!=typeof window,w=!u&&0!==u&&p;if(\"function\"!=typeof e)throw new TypeError(\"Expected a function\");u=+u||0;var s=!!(c=c||{}).leading,x=!(\"trailing\"in c)||!!c.trailing,h=\"maxWait\"in c,y=\"debounceOnServer\"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;n(function(){return g.current=!0,function(){g.current=!1}},[]);var A=t(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(n,t,a){var o=a&&a.equalityFn||i,f=r(n),l=e({})[1],v=c(u(function(r){f.current=r,l({})},[l]),t,a),m=r(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}function o(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})}export{a as useDebounce,c as useDebouncedCallback,o as useThrottledCallback};\n//# sourceMappingURL=index.module.js.map\n","import { useRef, useEffect, useCallback, useState, useMemo } from 'react';\n\n// This could've been more streamlined with internal state instead of abusing\n// refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.\nfunction useResolvedElement(subscriber, refOrElement) {\n var lastReportRef = useRef(null);\n var refOrElementRef = useRef(null);\n refOrElementRef.current = refOrElement;\n var cbElementRef = useRef(null); // Calling re-evaluation after each render without using a dep array,\n // as the ref object's current value could've changed since the last render.\n\n useEffect(function () {\n evaluateSubscription();\n });\n var evaluateSubscription = useCallback(function () {\n var cbElement = cbElementRef.current;\n var refOrElement = refOrElementRef.current; // Ugly ternary. But smaller than an if-else block.\n\n var element = cbElement ? cbElement : refOrElement ? refOrElement instanceof Element ? refOrElement : refOrElement.current : null;\n\n if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.subscriber === subscriber) {\n return;\n }\n\n if (lastReportRef.current && lastReportRef.current.cleanup) {\n lastReportRef.current.cleanup();\n }\n\n lastReportRef.current = {\n element: element,\n subscriber: subscriber,\n // Only calling the subscriber, if there's an actual element to report.\n // Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.\n cleanup: element ? subscriber(element) : undefined\n };\n }, [subscriber]); // making sure we call the cleanup function on unmount\n\n useEffect(function () {\n return function () {\n if (lastReportRef.current && lastReportRef.current.cleanup) {\n lastReportRef.current.cleanup();\n lastReportRef.current = null;\n }\n };\n }, []);\n return useCallback(function (element) {\n cbElementRef.current = element;\n evaluateSubscription();\n }, [evaluateSubscription]);\n}\n\n// We're only using the first element of the size sequences, until future versions of the spec solidify on how\n// exactly it'll be used for fragments in multi-column scenarios:\n// From the spec:\n// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,\n// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not\n// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single\n// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.\n// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)\n//\n// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,\n// regardless of the \"box\" option.\n// The spec states the following on this:\n// > This does not have any impact on which box dimensions are returned to the defined callback when the event\n// > is fired, it solely defines which box the author wishes to observe layout changes on.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// I'm not exactly clear on what this means, especially when you consider a later section stating the following:\n// > This section is non-normative. An author may desire to observe more than one CSS box.\n// > In this case, author will need to use multiple ResizeObservers.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.\n// For this reason I decided to only return the requested size,\n// even though it seems we have access to results for all box types.\n// This also means that we get to keep the current api, being able to return a simple { width, height } pair,\n// regardless of box option.\nfunction extractSize(entry, boxProp, sizeType) {\n if (!entry[boxProp]) {\n if (boxProp === \"contentBoxSize\") {\n // The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.\n // See the 6th step in the description for the RO algorithm:\n // https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h\n // > Set this.contentRect to logical this.contentBoxSize given target and observedBox of \"content-box\".\n // In real browser implementations of course these objects differ, but the width/height values should be equivalent.\n return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"];\n }\n\n return undefined;\n } // A couple bytes smaller than calling Array.isArray() and just as effective here.\n\n\n return entry[boxProp][0] ? entry[boxProp][0][sizeType] : // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current\n // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.\n // @ts-ignore\n entry[boxProp][sizeType];\n}\n\nfunction useResizeObserver(opts) {\n if (opts === void 0) {\n opts = {};\n }\n\n // Saving the callback as a ref. With this, I don't need to put onResize in the\n // effect dep array, and just passing in an anonymous function without memoising\n // will not reinstantiate the hook's ResizeObserver.\n var onResize = opts.onResize;\n var onResizeRef = useRef(undefined);\n onResizeRef.current = onResize;\n var round = opts.round || Math.round; // Using a single instance throughout the hook's lifetime\n\n var resizeObserverRef = useRef();\n\n var _useState = useState({\n width: undefined,\n height: undefined\n }),\n size = _useState[0],\n setSize = _useState[1]; // In certain edge cases the RO might want to report a size change just after\n // the component unmounted.\n\n\n var didUnmount = useRef(false);\n useEffect(function () {\n didUnmount.current = false;\n return function () {\n didUnmount.current = true;\n };\n }, []); // Using a ref to track the previous width / height to avoid unnecessary renders.\n\n var previous = useRef({\n width: undefined,\n height: undefined\n }); // This block is kinda like a useEffect, only it's called whenever a new\n // element could be resolved based on the ref option. It also has a cleanup\n // function.\n\n var refCallback = useResolvedElement(useCallback(function (element) {\n // We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.\n // This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.\n if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {\n resizeObserverRef.current = {\n box: opts.box,\n round: round,\n instance: new ResizeObserver(function (entries) {\n var entry = entries[0];\n var boxProp = opts.box === \"border-box\" ? \"borderBoxSize\" : opts.box === \"device-pixel-content-box\" ? \"devicePixelContentBoxSize\" : \"contentBoxSize\";\n var reportedWidth = extractSize(entry, boxProp, \"inlineSize\");\n var reportedHeight = extractSize(entry, boxProp, \"blockSize\");\n var newWidth = reportedWidth ? round(reportedWidth) : undefined;\n var newHeight = reportedHeight ? round(reportedHeight) : undefined;\n\n if (previous.current.width !== newWidth || previous.current.height !== newHeight) {\n var newSize = {\n width: newWidth,\n height: newHeight\n };\n previous.current.width = newWidth;\n previous.current.height = newHeight;\n\n if (onResizeRef.current) {\n onResizeRef.current(newSize);\n } else {\n if (!didUnmount.current) {\n setSize(newSize);\n }\n }\n }\n })\n };\n }\n\n resizeObserverRef.current.instance.observe(element, {\n box: opts.box\n });\n return function () {\n if (resizeObserverRef.current) {\n resizeObserverRef.current.instance.unobserve(element);\n }\n };\n }, [opts.box, round]), opts.ref);\n return useMemo(function () {\n return {\n ref: refCallback,\n width: size.width,\n height: size.height\n };\n }, [refCallback, size.width, size.height]);\n}\n\nexport { useResizeObserver as default };\n","import { useRef } from 'preact/hooks';\nimport { useThrottledCallback } from 'use-debounce';\nimport useResizeObserver from 'use-resize-observer';\n\nexport default function useTruncated({ className = 'truncated' } = {}) {\n const ref = useRef();\n const onResize = useThrottledCallback(({ height }) => {\n if (ref.current) {\n const { scrollHeight } = ref.current;\n let truncated = scrollHeight > height;\n if (truncated) {\n const { height: _height, maxHeight } = getComputedStyle(ref.current);\n const computedHeight = parseInt(maxHeight || _height, 10);\n truncated = scrollHeight > computedHeight;\n }\n ref.current.classList.toggle(className, truncated);\n }\n }, 300);\n useResizeObserver({\n ref,\n box: 'border-box',\n onResize,\n });\n return ref;\n}\n","export default {\n public: 'earth',\n unlisted: 'group',\n private: 'lock',\n direct: 'message',\n local: 'building',\n};\n","export var styleRoot = 'kvfysmfp';\nexport var styleChild = 'ufhsfnkm';\nexport var styles = \".\".concat(styleRoot, \"{overflow:hidden;touch-action:none}.\").concat(styleChild, \"{transform-origin: 0 0}\");\n","var isSsr = typeof window === 'undefined';\nexport var isTouch = function () {\n return !isSsr && ('ontouchstart' in window || navigator.maxTouchPoints > 0);\n};\nexport var make2dTransformValue = function (_a) {\n var x = _a.x, y = _a.y, scale = _a.scale;\n return \"scale(\".concat(scale, \") translate(\").concat(x, \"px, \").concat(y, \"px)\");\n};\nexport var make3dTransformValue = function (_a) {\n var x = _a.x, y = _a.y, scale = _a.scale;\n return \"scale3d(\".concat(scale, \",\").concat(scale, \", 1) translate3d(\").concat(x, \"px, \").concat(y, \"px, 0)\");\n};\nexport var hasTranslate3DSupport = function () {\n var css = !isSsr && window.CSS;\n return css && css.supports && css.supports('transform', 'translate3d(0,0,0)');\n};\n","var min = Math.min, max = Math.max;\nexport function getOffsetBounds(_a) {\n var containerDimension = _a.containerDimension, childDimension = _a.childDimension, padding = _a.padding, centerContained = _a.centerContained;\n var diff = childDimension - containerDimension;\n if (diff + 2 * padding <= 0 && centerContained) {\n return [diff / 2, diff / 2];\n }\n else {\n return [min(diff + padding, 0) - padding, max(0, diff + padding)];\n }\n}\n","import { __assign, __extends } from \"tslib\";\nimport React, { Component, createRef, Children, cloneElement } from 'react';\nimport { styleRoot, styleChild, styles } from './styles.css';\nimport { isTouch } from '../utils';\nimport { getOffsetBounds } from './getOffsetBounds';\nvar classnames = function (base, other) {\n return other ? \"\".concat(base, \" \").concat(other) : base;\n};\nvar abs = Math.abs, min = Math.min, sqrt = Math.sqrt;\nvar isSsr = typeof window === 'undefined';\nvar isMac = isSsr ? false : /(Mac)/i.test(navigator.platform);\nvar isDragInteraction = function (i) { return i === 'drag'; };\nvar isZoomInteraction = function (i) { return i === 'zoom'; };\nvar isZoomGesture = function (wheelEvent) { return isMac && wheelEvent.ctrlKey; };\nvar cancelEvent = function (event) {\n event.stopPropagation();\n event.preventDefault();\n};\nvar getDistance = function (a, b) {\n var x = a.x - b.x;\n var y = a.y - b.y;\n return sqrt(x * x + y * y);\n};\nvar calculateScale = function (startTouches, endTouches) {\n var startDistance = getDistance(startTouches[0], startTouches[1]);\n var endDistance = getDistance(endTouches[0], endTouches[1]);\n return endDistance / startDistance;\n};\nvar isCloseTo = function (value, expected) {\n return value > expected - 0.01 && value < expected + 0.01;\n};\nvar swing = function (p) { return -Math.cos(p * Math.PI) / 2 + 0.5; };\nvar getPointByPageCoordinates = function (touch) { return ({\n x: touch.pageX,\n y: touch.pageY,\n}); };\nvar getPageCoordinatesByTouches = function (touches) {\n return Array.from(touches).map(getPointByPageCoordinates);\n};\nvar sum = function (a, b) { return a + b; };\nvar getVectorAvg = function (vectors) { return ({\n x: vectors.map(function (_a) {\n var x = _a.x;\n return x;\n }).reduce(sum, 0) / vectors.length,\n y: vectors.map(function (_a) {\n var y = _a.y;\n return y;\n }).reduce(sum, 0) / vectors.length,\n}); };\nvar clamp = function (min, max, value) {\n return value < min ? min : value > max ? max : value;\n};\nvar shouldInterceptWheel = function (event) {\n return !(event.ctrlKey || event.metaKey);\n};\nvar getElementSize = function (element) {\n if (element) {\n var offsetWidth = element.offsetWidth, offsetHeight = element.offsetHeight;\n // Any DOMElement\n if (offsetWidth && offsetHeight) {\n return { width: offsetWidth, height: offsetHeight };\n }\n // Svg support\n var style = getComputedStyle(element);\n var width = parseFloat(style.width);\n var height = parseFloat(style.height);\n if (height && width) {\n return { width: width, height: height };\n }\n }\n return { width: 0, height: 0 };\n};\nvar calculateVelocity = function (startPoint, endPoint) { return ({\n x: endPoint.x - startPoint.x,\n y: endPoint.y - startPoint.y,\n}); };\nvar comparePoints = function (p1, p2) { return p1.x === p2.x && p1.y === p2.y; };\nvar noup = function () { };\nvar zeroPoint = { x: 0, y: 0 };\nvar PinchZoom = /** @class */ (function (_super) {\n __extends(PinchZoom, _super);\n function PinchZoom() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._prevDragMovePoint = null;\n _this._containerObserver = null;\n _this._fingers = 0;\n _this._firstMove = true;\n _this._initialOffset = __assign({}, zeroPoint);\n _this._interaction = null;\n _this._isDoubleTap = false;\n _this._isOffsetsSet = false;\n _this._lastDragPosition = null;\n _this._lastScale = 1;\n _this._lastTouchStart = 0;\n _this._lastZoomCenter = null;\n _this._listenMouseMove = false;\n _this._nthZoom = 0;\n _this._offset = __assign({}, zeroPoint);\n _this._startOffset = __assign({}, zeroPoint);\n _this._startTouches = null;\n _this._updatePlaned = false;\n _this._wheelTimeOut = null;\n _this._zoomFactor = 1;\n _this._initialZoomFactor = 1;\n _this._draggingPoint = __assign({}, zeroPoint);\n // It help reduce behavior difference between touch and mouse events\n _this._ignoreNextClick = false;\n // @ts-ignore\n _this._containerRef = createRef();\n _this._handleClick = function (clickEvent) {\n if (_this._ignoreNextClick) {\n _this._ignoreNextClick = false;\n clickEvent.stopPropagation();\n }\n };\n _this._onResize = function () {\n var _a;\n if ((_a = _this._containerRef) === null || _a === void 0 ? void 0 : _a.current) {\n _this._updateInitialZoomFactor();\n _this._setupOffsets();\n _this._update();\n }\n };\n _this._handlerOnTouchEnd = _this._handlerIfEnable(function (touchEndEvent) {\n _this._fingers = touchEndEvent.touches.length;\n if (_this.props.shouldCancelHandledTouchEndEvents &&\n (isZoomInteraction(_this._interaction) ||\n (isDragInteraction(_this._interaction) &&\n (_this._startOffset.x !== _this._offset.x ||\n _this._startOffset.y !== _this._offset.y)))) {\n cancelEvent(touchEndEvent);\n }\n if (isDragInteraction(_this._interaction) && !_this._enoughToDrag()) {\n _this._handleClick(touchEndEvent);\n }\n _this._updateInteraction(touchEndEvent);\n });\n _this._handlerOnTouchStart = _this._handlerIfEnable(function (touchStartEvent) {\n _this._firstMove = true;\n _this._fingers = touchStartEvent.touches.length;\n _this._detectDoubleTap(touchStartEvent);\n });\n _this._handlerOnTouchMove = _this._handlerIfEnable(function (touchMoveEvent) {\n if (_this._isDoubleTap) {\n return;\n }\n _this._collectInertia(touchMoveEvent);\n if (_this._firstMove) {\n _this._updateInteraction(touchMoveEvent);\n if (_this._interaction) {\n cancelEvent(touchMoveEvent);\n }\n _this._startOffset = __assign({}, _this._offset);\n _this._startTouches = getPageCoordinatesByTouches(touchMoveEvent.touches);\n }\n else {\n if (isZoomInteraction(_this._interaction)) {\n if (_this._startTouches &&\n _this._startTouches.length === 2 &&\n touchMoveEvent.touches.length === 2) {\n _this._handleZoom(touchMoveEvent, calculateScale(_this._startTouches, getPageCoordinatesByTouches(touchMoveEvent.touches)));\n }\n }\n else if (isDragInteraction(_this._interaction)) {\n _this._handleDrag(touchMoveEvent);\n }\n if (_this._interaction) {\n cancelEvent(touchMoveEvent);\n _this._update();\n }\n }\n _this._firstMove = false;\n });\n _this._handlerWheel = function (wheelEvent) {\n if (_this.props.shouldInterceptWheel(wheelEvent)) {\n return;\n }\n cancelEvent(wheelEvent);\n var pageX = wheelEvent.pageX, pageY = wheelEvent.pageY, deltaY = wheelEvent.deltaY, deltaMode = wheelEvent.deltaMode;\n var scaleDelta = 1;\n if (isZoomGesture(wheelEvent) || deltaMode === 1) {\n scaleDelta = 15;\n }\n var likeTouchEvent = {\n touches: [\n // @ts-ignore\n { pageX: pageX, pageY: pageY },\n ],\n };\n var center = _this._getOffsetByFirstTouch(likeTouchEvent);\n var dScale = deltaY * scaleDelta;\n _this._stopAnimation();\n _this._scaleTo(_this._zoomFactor - dScale / _this.props.wheelScaleFactor, center);\n _this._update();\n clearTimeout(\n // @ts-ignore\n _this._wheelTimeOut);\n _this._wheelTimeOut = setTimeout(function () { return _this._sanitize(); }, 100);\n };\n // @ts-ignore\n _this._handlers = _this.props.isTouch()\n ? [\n ['touchstart', _this._handlerOnTouchStart],\n ['touchend', _this._handlerOnTouchEnd],\n ['touchmove', _this._handlerOnTouchMove],\n ]\n : [\n [\n 'mousemove',\n _this.simulate(_this._handlerOnTouchMove),\n _this.props._document,\n ],\n [\n 'mouseup',\n _this.simulate(_this._handlerOnTouchEnd),\n _this.props._document,\n ],\n ['mousedown', _this.simulate(_this._handlerOnTouchStart)],\n ['click', _this._handleClick],\n ['wheel', _this._handlerWheel],\n ];\n return _this;\n }\n PinchZoom.prototype._handleDragStart = function (event) {\n this._ignoreNextClick = true;\n this.props.onDragStart();\n this._stopAnimation();\n this._resetInertia();\n this._lastDragPosition = null;\n this._hasInteraction = true;\n this._draggingPoint = this._offset;\n this._handleDrag(event);\n };\n PinchZoom.prototype._handleDrag = function (event) {\n var touch = this._getOffsetByFirstTouch(event);\n if (this._enoughToDrag()) {\n this._drag(touch, this._lastDragPosition);\n }\n else {\n this._virtualDrag(touch, this._lastDragPosition);\n }\n this._offset = this._sanitizeOffset(this._offset);\n this._lastDragPosition = touch;\n };\n PinchZoom.prototype._resetInertia = function () {\n this._velocity = null;\n this._prevDragMovePoint = null;\n };\n PinchZoom.prototype._realizeInertia = function () {\n var _this = this;\n var _a = this.props, inertiaFriction = _a.inertiaFriction, inertia = _a.inertia;\n if (!inertia || !this._velocity) {\n return;\n }\n var _b = this._velocity, x = _b.x, y = _b.y;\n if (x || y) {\n this._stopAnimation();\n this._resetInertia();\n var renderFrame = function () {\n x *= inertiaFriction;\n y *= inertiaFriction;\n if (!x && !y) {\n return _this._stopAnimation();\n }\n var prevOffset = __assign({}, _this._offset);\n _this._addOffset({ x: x, y: y });\n _this._offset = _this._sanitizeOffset(_this._offset);\n if (comparePoints(prevOffset, _this._offset)) {\n return _this._stopAnimation();\n }\n _this._update({ isAnimation: true });\n };\n this._animate(renderFrame, { duration: 9999 });\n }\n };\n PinchZoom.prototype._collectInertia = function (_a) {\n var touches = _a.touches;\n if (!this.props.inertia) {\n return;\n }\n var currentCoordinates = getPageCoordinatesByTouches(touches)[0];\n var prevPoint = this._prevDragMovePoint;\n if (prevPoint) {\n this._velocity = calculateVelocity(currentCoordinates, prevPoint);\n }\n this._prevDragMovePoint = currentCoordinates;\n };\n PinchZoom.prototype._handleDragEnd = function () {\n this.props.onDragEnd();\n this._end();\n this._realizeInertia();\n };\n PinchZoom.prototype._handleZoomStart = function () {\n this.props.onZoomStart();\n this._stopAnimation();\n this._lastScale = 1;\n this._nthZoom = 0;\n this._lastZoomCenter = null;\n this._hasInteraction = true;\n };\n PinchZoom.prototype._handleZoom = function (event, newScale) {\n var touchCenter = getVectorAvg(this._getOffsetTouches(event));\n var scale = newScale / this._lastScale;\n this._lastScale = newScale;\n // The first touch events are thrown away since they are not precise\n this._nthZoom += 1;\n if (this._nthZoom > 3) {\n this._scale(scale, touchCenter);\n this._drag(touchCenter, this._lastZoomCenter);\n if (this.props.enforceBoundsDuringZoom) {\n this._offset = this._sanitizeOffset(this._offset);\n }\n }\n this._lastZoomCenter = touchCenter;\n };\n PinchZoom.prototype._handleZoomEnd = function () {\n this.props.onZoomEnd();\n this._end();\n };\n PinchZoom.prototype._handleDoubleTap = function (event) {\n var _this = this;\n if (this._hasInteraction || this.props.tapZoomFactor === 0) {\n return;\n }\n var needZoomOut = (this.props.doubleTapZoomOutOnMaxScale &&\n this._zoomFactor === this.props.maxZoom) ||\n (this.props.doubleTapToggleZoom && this._zoomFactor > 1);\n this.props.onDoubleTap();\n this._ignoreNextClick = true;\n var zoomFactor = this._zoomFactor + this.props.tapZoomFactor;\n var startZoomFactor = this._zoomFactor;\n var updateProgress = function (progress) {\n _this._scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);\n };\n var center = this._getOffsetByFirstTouch(event);\n this._isDoubleTap = true;\n if (startZoomFactor > zoomFactor) {\n center = this._getCurrentZoomCenter();\n }\n needZoomOut ? this._zoomOutAnimation() : this._animate(updateProgress);\n };\n PinchZoom.prototype._computeInitialOffset = function () {\n var rect = this._getContainerRect();\n var _a = this._getChildSize(), width = _a.width, height = _a.height;\n var x = -abs(width * this._getInitialZoomFactor() - rect.width) / 2;\n var y = -abs(height * this._getInitialZoomFactor() - rect.height) / 2;\n this._initialOffset = { x: x, y: y };\n };\n PinchZoom.prototype._resetOffset = function () {\n this._offset = __assign({}, this._initialOffset);\n };\n PinchZoom.prototype._setupOffsets = function () {\n if (this.props.setOffsetsOnce && this._isOffsetsSet) {\n return;\n }\n this._isOffsetsSet = true;\n this._computeInitialOffset();\n this._resetOffset();\n };\n PinchZoom.prototype._sanitizeOffset = function (offset) {\n var rect = this._getContainerRect();\n var _a = this._getChildSize(), width = _a.width, height = _a.height;\n var elWidth = width * this._getInitialZoomFactor() * this._zoomFactor;\n var elHeight = height * this._getInitialZoomFactor() * this._zoomFactor;\n var _b = getOffsetBounds({\n containerDimension: rect.width,\n childDimension: elWidth,\n padding: this.props.horizontalPadding,\n centerContained: this.props.centerContained,\n }), minOffsetX = _b[0], maxOffsetX = _b[1];\n var _c = getOffsetBounds({\n containerDimension: rect.height,\n childDimension: elHeight,\n padding: this.props.verticalPadding,\n centerContained: this.props.centerContained,\n }), minOffsetY = _c[0], maxOffsetY = _c[1];\n return {\n x: clamp(minOffsetX, maxOffsetX, offset.x),\n y: clamp(minOffsetY, maxOffsetY, offset.y),\n };\n };\n PinchZoom.prototype.alignCenter = function (options) {\n var _this = this;\n var _a = __assign({ duration: 250, animated: true }, options), __x = _a.x, __y = _a.y, scale = _a.scale, animated = _a.animated, duration = _a.duration;\n // Bug-Fix: https://github.com/retyui/react-quick-pinch-zoom/issues/58\n var x = __x * this._initialZoomFactor;\n var y = __y * this._initialZoomFactor;\n var startZoomFactor = this._zoomFactor;\n var startOffset = __assign({}, this._offset);\n var rect = this._getContainerRect();\n var containerCenter = { x: rect.width / 2, y: rect.height / 2 };\n this._zoomFactor = 1;\n this._offset = { x: -(containerCenter.x - x), y: -(containerCenter.y - y) };\n this._scaleTo(scale, containerCenter);\n this._stopAnimation();\n if (!animated) {\n return this._update();\n }\n var diffZoomFactor = this._zoomFactor - startZoomFactor;\n var diffOffset = {\n x: this._offset.x - startOffset.x,\n y: this._offset.y - startOffset.y,\n };\n this._zoomFactor = startZoomFactor;\n this._offset = __assign({}, startOffset);\n var updateFrame = function (progress) {\n var x = startOffset.x + diffOffset.x * progress;\n var y = startOffset.y + diffOffset.y * progress;\n _this._zoomFactor = startZoomFactor + diffZoomFactor * progress;\n _this._offset = _this._sanitizeOffset({ x: x, y: y });\n _this._update();\n };\n this._animate(updateFrame, {\n callback: function () { return _this._sanitize(); },\n duration: duration,\n });\n };\n PinchZoom.prototype.scaleTo = function (options) {\n var _this = this;\n var _a = __assign({ duration: 250, animated: true }, options), x = _a.x, y = _a.y, scale = _a.scale, animated = _a.animated, duration = _a.duration;\n var startZoomFactor = this._zoomFactor;\n var startOffset = __assign({}, this._offset);\n this._zoomFactor = 1;\n this._offset = { x: 0, y: 0 };\n this._scaleTo(scale, { x: x, y: y });\n this._stopAnimation();\n if (!animated) {\n return this._update();\n }\n var diffZoomFactor = this._zoomFactor - startZoomFactor;\n var diffOffset = {\n x: this._offset.x - startOffset.x,\n y: this._offset.y - startOffset.y,\n };\n this._zoomFactor = startZoomFactor;\n this._offset = __assign({}, startOffset);\n var updateFrame = function (progress) {\n var x = startOffset.x + diffOffset.x * progress;\n var y = startOffset.y + diffOffset.y * progress;\n _this._zoomFactor = startZoomFactor + diffZoomFactor * progress;\n _this._offset = { x: x, y: y };\n _this._update();\n };\n this._animate(updateFrame, { callback: function () { return _this._sanitize(); }, duration: duration });\n };\n PinchZoom.prototype._scaleTo = function (zoomFactor, center) {\n this._scale(zoomFactor / this._zoomFactor, center);\n this._offset = this._sanitizeOffset(this._offset);\n };\n PinchZoom.prototype._scale = function (scale, center) {\n scale = this._scaleZoomFactor(scale);\n this._addOffset({\n x: (scale - 1) * (center.x + this._offset.x),\n y: (scale - 1) * (center.y + this._offset.y),\n });\n this.props.onZoomUpdate();\n };\n PinchZoom.prototype._scaleZoomFactor = function (scale) {\n var originalZoomFactor = this._zoomFactor;\n this._zoomFactor *= scale;\n this._zoomFactor = clamp(this.props.minZoom, this.props.maxZoom, this._zoomFactor);\n return this._zoomFactor / originalZoomFactor;\n };\n PinchZoom.prototype._canDrag = function () {\n return this.props.draggableUnZoomed || !isCloseTo(this._zoomFactor, 1);\n };\n PinchZoom.prototype._drag = function (center, lastCenter) {\n if (lastCenter) {\n var y = -(center.y - lastCenter.y);\n var x = -(center.x - lastCenter.x);\n if (!this.props.lockDragAxis) {\n this._addOffset({\n x: x,\n y: y,\n });\n }\n else {\n // lock scroll to position that was changed the most\n if (abs(x) > abs(y)) {\n this._addOffset({\n x: x,\n y: 0,\n });\n }\n else {\n this._addOffset({\n y: y,\n x: 0,\n });\n }\n }\n this.props.onDragUpdate();\n }\n };\n PinchZoom.prototype._virtualDrag = function (center, lastCenter) {\n if (lastCenter) {\n var y = -(center.y - lastCenter.y);\n var x = -(center.x - lastCenter.x);\n this._draggingPoint = {\n x: x + this._draggingPoint.x,\n y: y + this._draggingPoint.y,\n };\n }\n };\n PinchZoom.prototype._addOffset = function (offset) {\n var _a = this._offset, x = _a.x, y = _a.y;\n this._offset = {\n x: x + offset.x,\n y: y + offset.y,\n };\n };\n PinchZoom.prototype._sanitize = function () {\n if (this._zoomFactor < this.props.zoomOutFactor) {\n this._resetInertia();\n this._zoomOutAnimation();\n }\n else if (this._isInsaneOffset()) {\n this._sanitizeOffsetAnimation();\n }\n };\n PinchZoom.prototype._isInsaneOffset = function () {\n var offset = this._offset;\n var sanitizedOffset = this._sanitizeOffset(offset);\n return sanitizedOffset.x !== offset.x || sanitizedOffset.y !== offset.y;\n };\n PinchZoom.prototype._sanitizeOffsetAnimation = function () {\n var _this = this;\n var targetOffset = this._sanitizeOffset(this._offset);\n var startOffset = __assign({}, this._offset);\n var updateProgress = function (progress) {\n var x = startOffset.x + progress * (targetOffset.x - startOffset.x);\n var y = startOffset.y + progress * (targetOffset.y - startOffset.y);\n _this._offset = { x: x, y: y };\n _this._update();\n };\n this._animate(updateProgress);\n };\n PinchZoom.prototype._zoomOutAnimation = function () {\n var _this = this;\n if (this._zoomFactor === 1) {\n return;\n }\n var startZoomFactor = this._zoomFactor;\n var zoomFactor = 1;\n var center = this._getCurrentZoomCenter();\n var updateProgress = function (progress) {\n var scaleFactor = startZoomFactor + progress * (zoomFactor - startZoomFactor);\n _this._scaleTo(scaleFactor, center);\n };\n this._animate(updateProgress);\n };\n PinchZoom.prototype._getInitialZoomFactor = function () {\n return this._initialZoomFactor;\n };\n PinchZoom.prototype._getCurrentZoomCenter = function () {\n var _a = this._offset, x = _a.x, y = _a.y;\n var offsetLeft = x - this._initialOffset.x;\n var offsetTop = y - this._initialOffset.y;\n return {\n x: -1 * x - offsetLeft / (1 / this._zoomFactor - 1),\n y: -1 * y - offsetTop / (1 / this._zoomFactor - 1),\n };\n };\n PinchZoom.prototype._getOffsetByFirstTouch = function (event) {\n return this._getOffsetTouches(event)[0];\n };\n PinchZoom.prototype._getOffsetTouches = function (event) {\n var _document = this.props._document;\n var _html = _document.documentElement;\n var _body = _document.body;\n var _a = this._getContainerRect(), top = _a.top, left = _a.left;\n var scrollTop = _html.scrollTop || _body.scrollTop;\n var scrollLeft = _html.scrollLeft || _body.scrollLeft;\n var posTop = top + scrollTop;\n var posLeft = left + scrollLeft;\n return getPageCoordinatesByTouches(event.touches).map(function (_a) {\n var x = _a.x, y = _a.y;\n return ({\n x: x - posLeft,\n y: y - posTop,\n });\n });\n };\n PinchZoom.prototype._animate = function (frameFn, options) {\n var _this = this;\n var startTime = new Date().getTime();\n var _a = __assign({ timeFn: swing, callback: function () { }, duration: this.props.animationDuration }, options), timeFn = _a.timeFn, callback = _a.callback, duration = _a.duration;\n var renderFrame = function () {\n if (!_this._inAnimation) {\n return;\n }\n var frameTime = new Date().getTime() - startTime;\n var progress = frameTime / duration;\n if (frameTime >= duration) {\n frameFn(1);\n _this._stopAnimation();\n callback();\n _this._update();\n }\n else {\n progress = timeFn(progress);\n frameFn(progress);\n _this._update({ isAnimation: true });\n requestAnimationFrame(renderFrame);\n }\n };\n this._inAnimation = true;\n requestAnimationFrame(renderFrame);\n };\n PinchZoom.prototype._stopAnimation = function () {\n this._inAnimation = false;\n };\n PinchZoom.prototype._end = function () {\n this._hasInteraction = false;\n this._sanitize();\n this._update();\n };\n PinchZoom.prototype._getContainerRect = function () {\n var div = this._containerRef.current;\n return div.getBoundingClientRect();\n };\n PinchZoom.prototype._getChildSize = function () {\n var div = this._containerRef.current;\n return getElementSize(div === null || div === void 0 ? void 0 : div.firstElementChild);\n };\n PinchZoom.prototype._updateInitialZoomFactor = function () {\n var rect = this._getContainerRect();\n var size = this._getChildSize();\n var xZoomFactor = rect.width / size.width;\n var yZoomFactor = rect.height / size.height;\n this._initialZoomFactor = min(xZoomFactor, yZoomFactor);\n };\n PinchZoom.prototype._bindEvents = function () {\n var _this = this;\n var div = this._containerRef.current;\n if (window.ResizeObserver) {\n this._containerObserver = new ResizeObserver(this._onResize);\n this._containerObserver.observe(div);\n }\n else {\n window.addEventListener('resize', this._onResize);\n }\n this._handlers.forEach(function (_a) {\n var eventName = _a[0], fn = _a[1], target = _a[2];\n (target || div).addEventListener(eventName, fn, true);\n });\n Array.from(div.querySelectorAll('img')).forEach(function (img) {\n return img.addEventListener('load', _this._onResize);\n });\n };\n PinchZoom.prototype._unSubscribe = function () {\n var _this = this;\n var div = this._containerRef.current;\n if (this._containerObserver) {\n this._containerObserver.disconnect();\n this._containerObserver = null;\n }\n window.removeEventListener('resize', this._onResize);\n this._handlers.forEach(function (_a) {\n var eventName = _a[0], fn = _a[1], target = _a[2];\n (target || div).removeEventListener(eventName, fn, true);\n });\n Array.from(div.querySelectorAll('img')).forEach(function (img) {\n return img.removeEventListener('load', _this._onResize);\n });\n };\n PinchZoom.prototype._update = function (options) {\n var _this = this;\n if (this._updatePlaned) {\n return;\n }\n var updateFrame = function () {\n var scale = _this._getInitialZoomFactor() * _this._zoomFactor;\n var x = -_this._offset.x / scale;\n var y = -_this._offset.y / scale;\n _this.props.onUpdate({ scale: scale, x: x, y: y });\n };\n if (options === null || options === void 0 ? void 0 : options.isAnimation) {\n return updateFrame();\n }\n this._updatePlaned = true;\n requestAnimationFrame(function () {\n _this._updatePlaned = false;\n updateFrame();\n });\n };\n PinchZoom.prototype._handlerIfEnable = function (fn) {\n var _this = this;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this.props.enabled) {\n fn.apply(void 0, args);\n }\n };\n };\n PinchZoom.prototype._setInteraction = function (newInteraction, event) {\n var interaction = this._interaction;\n if (interaction !== newInteraction) {\n if (interaction && !newInteraction) {\n if (isZoomInteraction(interaction)) {\n this._handleZoomEnd();\n }\n else if (isDragInteraction(interaction)) {\n this._handleDragEnd();\n }\n }\n if (isZoomInteraction(newInteraction)) {\n this._handleZoomStart();\n }\n else if (isDragInteraction(newInteraction)) {\n this._handleDragStart(event);\n }\n }\n this._interaction = newInteraction;\n };\n PinchZoom.prototype._distanceBetweenNumbers = function (a, b) {\n return a > b ? a - b : b - a;\n };\n PinchZoom.prototype._enoughToDrag = function () {\n if (this._distanceBetweenNumbers(this._startOffset.x, this._draggingPoint.x) >\n 5 ||\n this._distanceBetweenNumbers(this._startOffset.y, this._draggingPoint.y) >\n 5)\n return true;\n return false;\n };\n PinchZoom.prototype._updateInteraction = function (event) {\n var fingers = this._fingers;\n if (fingers === 2) {\n return this._setInteraction('zoom', event);\n }\n if (fingers === 1 && this._canDrag()) {\n return this._setInteraction('drag', event);\n }\n this._setInteraction(null, event);\n };\n PinchZoom.prototype._detectDoubleTap = function (event) {\n var time = new Date().getTime();\n if (this._fingers > 1) {\n this._lastTouchStart = 0;\n }\n if (time - this._lastTouchStart < 300) {\n cancelEvent(event);\n this._handleDoubleTap(event);\n if (isZoomInteraction(this._interaction)) {\n this._handleZoomEnd();\n }\n else if (isDragInteraction(this._interaction)) {\n this._handleDragEnd();\n }\n }\n else {\n this._isDoubleTap = false;\n }\n if (this._fingers === 1) {\n this._lastTouchStart = time;\n }\n };\n PinchZoom.prototype.simulate = function (fn) {\n var _this = this;\n return function (mouseEvent) {\n var pageX = mouseEvent.pageX, pageY = mouseEvent.pageY, type = mouseEvent.type;\n var isEnd = type === 'mouseup';\n var isStart = type === 'mousedown';\n if (isStart) {\n mouseEvent.preventDefault();\n _this._listenMouseMove = true;\n }\n if (_this._listenMouseMove) {\n // @ts-ignore\n mouseEvent.touches = isEnd ? [] : [{ pageX: pageX, pageY: pageY }];\n fn(\n // @ts-ignore\n mouseEvent);\n }\n if (isEnd) {\n _this._listenMouseMove = false;\n }\n };\n };\n PinchZoom.prototype.componentDidMount = function () {\n this._bindEvents();\n this._update();\n };\n PinchZoom.prototype.componentWillUnmount = function () {\n this._stopAnimation();\n this._unSubscribe();\n };\n PinchZoom.prototype.render = function () {\n var _a = this.props, children = _a.children, containerProps = _a.containerProps;\n var child = Children.only(children);\n var props = containerProps || {};\n return (React.createElement(React.Fragment, null,\n React.createElement(\"style\", null, styles),\n React.createElement(\"div\", __assign({}, props, { ref: this._containerRef, className: classnames(styleRoot, props.className) }), cloneElement(child, {\n className: classnames(styleChild, child.props.className),\n }))));\n };\n PinchZoom.defaultProps = {\n animationDuration: 250,\n draggableUnZoomed: true,\n enforceBoundsDuringZoom: false,\n centerContained: false,\n enabled: true,\n inertia: true,\n inertiaFriction: 0.96,\n horizontalPadding: 0,\n isTouch: isTouch,\n lockDragAxis: false,\n maxZoom: 5,\n minZoom: 0.5,\n onDoubleTap: noup,\n onDragEnd: noup,\n onDragStart: noup,\n onDragUpdate: noup,\n onZoomEnd: noup,\n onZoomStart: noup,\n onZoomUpdate: noup,\n setOffsetsOnce: false,\n shouldInterceptWheel: shouldInterceptWheel,\n shouldCancelHandledTouchEndEvents: false,\n tapZoomFactor: 1,\n verticalPadding: 0,\n wheelScaleFactor: 1500,\n zoomOutFactor: 1.3,\n doubleTapZoomOutOnMaxScale: false,\n doubleTapToggleZoom: false,\n // @ts-expect-error\n _document: isSsr ? null : window.document,\n };\n return PinchZoom;\n}(Component));\nif (process.env.NODE_ENV !== 'production') {\n var _a = require('prop-types'), any = _a.any, element = _a.element, object = _a.object, number = _a.number, func = _a.func, bool = _a.bool;\n // @ts-ignore\n PinchZoom.propTypes = {\n children: element,\n containerProps: object,\n wheelScaleFactor: number,\n animationDuration: number,\n draggableUnZoomed: bool,\n enforceBoundsDuringZoom: bool,\n centerContained: bool,\n enabled: bool,\n horizontalPadding: number,\n lockDragAxis: bool,\n onUpdate: func.isRequired,\n maxZoom: number,\n minZoom: number,\n onDoubleTap: func,\n onDragEnd: func,\n onDragStart: func,\n onDragUpdate: func,\n onZoomEnd: func,\n onZoomStart: func,\n onZoomUpdate: func,\n setOffsetsOnce: bool,\n tapZoomFactor: number,\n verticalPadding: number,\n zoomOutFactor: number,\n doubleTapZoomOutOnMaxScale: bool,\n doubleTapToggleZoom: bool,\n isTouch: func,\n _document: any,\n };\n}\nexport default PinchZoom;\n","export default function formatDuration(time) {\n if (!time) return;\n let hours = Math.floor(time / 3600);\n let minutes = Math.floor((time % 3600) / 60);\n let seconds = Math.round(time % 60);\n\n if (hours === 0) {\n return `${minutes}:${seconds.toString().padStart(2, '0')}`;\n } else {\n return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds\n .toString()\n .padStart(2, '0')}`;\n }\n}\n","import { t, Trans } from '@lingui/macro';\nimport { getBlurHashAverageColor } from 'fast-blurhash';\nimport { Fragment } from 'preact';\nimport { memo } from 'preact/compat';\nimport {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport QuickPinchZoom, { make3dTransformValue } from 'react-quick-pinch-zoom';\n\nimport formatDuration from '../utils/format-duration';\nimport mem from '../utils/mem';\nimport states from '../utils/states';\n\nimport Icon from './icon';\nimport Link from './link';\n\nconst isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755\n\n/*\nMedia type\n===\nunknown = unsupported or unrecognized file type\nimage = Static image\ngifv = Looping, soundless animation\nvideo = Video clip\naudio = Audio track\n*/\n\nconst dataAltLabel = 'ALT';\nconst AltBadge = (props) => {\n const { alt, lang, index, ...rest } = props;\n if (!alt || !alt.trim()) return null;\n return (\n {\n e.stopPropagation();\n e.preventDefault();\n states.showMediaAlt = {\n alt,\n lang,\n };\n }}\n title={t`Media description`}\n >\n {dataAltLabel}\n {!!index && {index}}\n \n );\n};\n\nconst MEDIA_CAPTION_LIMIT = 140;\nconst MEDIA_CAPTION_LIMIT_LONGER = 280;\nexport const isMediaCaptionLong = mem((caption) =>\n caption?.length\n ? caption.length > MEDIA_CAPTION_LIMIT ||\n /[\\n\\r].*[\\n\\r]/.test(caption.trim())\n : false,\n);\n\nfunction Media({\n class: className = '',\n media,\n to,\n lang,\n showOriginal,\n autoAnimate,\n showCaption,\n allowLongerCaption,\n altIndex,\n checkAspectRatio = true,\n onClick = () => {},\n}) {\n let {\n blurhash,\n description,\n meta,\n previewRemoteUrl,\n previewUrl,\n remoteUrl,\n url,\n type,\n } = media;\n if (/no\\-preview\\./i.test(previewUrl)) {\n previewUrl = null;\n }\n const { original = {}, small, focus } = meta || {};\n\n const width = showOriginal\n ? original?.width\n : small?.width || original?.width;\n const height = showOriginal\n ? original?.height\n : small?.height || original?.height;\n const mediaURL = showOriginal ? url : previewUrl || url;\n const remoteMediaURL = showOriginal\n ? remoteUrl\n : previewRemoteUrl || remoteUrl;\n const hasDimensions = width && height;\n const orientation = hasDimensions\n ? width > height\n ? 'landscape'\n : 'portrait'\n : null;\n\n const rgbAverageColor = blurhash ? getBlurHashAverageColor(blurhash) : null;\n\n const videoRef = useRef();\n\n let focalPosition;\n if (focus) {\n // Convert focal point to CSS background position\n // Formula from jquery-focuspoint\n // x = -1, y = 1 => 0% 0%\n // x = 0, y = 0 => 50% 50%\n // x = 1, y = -1 => 100% 100%\n const x = ((focus.x + 1) / 2) * 100;\n const y = ((1 - focus.y) / 2) * 100;\n focalPosition = `${x.toFixed(0)}% ${y.toFixed(0)}%`;\n }\n\n const mediaRef = useRef();\n const onUpdate = useCallback(({ x, y, scale }) => {\n const { current: media } = mediaRef;\n\n if (media) {\n const value = make3dTransformValue({ x, y, scale });\n\n if (scale === 1) {\n media.style.removeProperty('transform');\n } else {\n media.style.setProperty('transform', value);\n }\n\n media.closest('.media-zoom').style.touchAction =\n scale <= 1.01 ? 'pan-x' : '';\n }\n }, []);\n\n const [pinchZoomEnabled, setPinchZoomEnabled] = useState(false);\n const quickPinchZoomProps = {\n enabled: pinchZoomEnabled,\n draggableUnZoomed: false,\n inertiaFriction: 0.9,\n tapZoomFactor: 2,\n doubleTapToggleZoom: true,\n containerProps: {\n className: 'media-zoom',\n style: {\n overflow: 'visible',\n // width: 'inherit',\n // height: 'inherit',\n // justifyContent: 'inherit',\n // alignItems: 'inherit',\n // display: 'inherit',\n },\n },\n onUpdate,\n };\n\n const Parent = useMemo(\n () => (to ? (props) => : 'div'),\n [to],\n );\n\n const remoteMediaURLObj = remoteMediaURL ? getURLObj(remoteMediaURL) : null;\n const isVideoMaybe =\n type === 'unknown' &&\n remoteMediaURLObj &&\n /\\.(mp4|m4r|m4v|mov|webm)$/i.test(remoteMediaURLObj.pathname);\n const isAudioMaybe =\n type === 'unknown' &&\n remoteMediaURLObj &&\n /\\.(mp3|ogg|wav|m4a|m4p|m4b)$/i.test(remoteMediaURLObj.pathname);\n const isImage =\n type === 'image' ||\n (type === 'unknown' && previewUrl && !isVideoMaybe && !isAudioMaybe);\n\n const parentRef = useRef();\n const [imageSmallerThanParent, setImageSmallerThanParent] = useState(false);\n useLayoutEffect(() => {\n if (!isImage) return;\n if (!showOriginal) return;\n if (!parentRef.current) return;\n const { offsetWidth, offsetHeight } = parentRef.current;\n const smaller = width < offsetWidth && height < offsetHeight;\n if (smaller) setImageSmallerThanParent(smaller);\n }, [width, height]);\n\n const maxAspectHeight =\n window.innerHeight * (orientation === 'portrait' ? 0.45 : 0.33);\n const maxHeight = orientation === 'portrait' ? 0 : 160;\n const averageColorStyle = {\n '--average-color': rgbAverageColor && `rgb(${rgbAverageColor.join(',')})`,\n };\n const mediaStyles =\n width && height\n ? {\n '--width': `${width}px`,\n '--height': `${height}px`,\n // Calculate '--aspectWidth' based on aspect ratio calculated from '--width' and '--height', max height has to be 160px\n '--aspectWidth': `${\n (width / height) * Math.max(maxHeight, maxAspectHeight)\n }px`,\n aspectRatio: `${width} / ${height}`,\n ...averageColorStyle,\n }\n : {\n ...averageColorStyle,\n };\n\n const longDesc = isMediaCaptionLong(description);\n let showInlineDesc =\n !!showCaption && !showOriginal && !!description && !longDesc;\n if (\n allowLongerCaption &&\n !showInlineDesc &&\n description?.length <= MEDIA_CAPTION_LIMIT_LONGER\n ) {\n showInlineDesc = true;\n }\n const Figure = !showInlineDesc\n ? Fragment\n : (props) => {\n const { children, ...restProps } = props;\n return (\n
    \n {children}\n {\n e.preventDefault();\n e.stopPropagation();\n states.showMediaAlt = {\n alt: description,\n lang,\n };\n }}\n >\n {description}\n \n
    \n );\n };\n\n const [hasNaturalAspectRatio, setHasNaturalAspectRatio] = useState(undefined);\n\n if (isImage) {\n // Note: type: unknown might not have width/height\n quickPinchZoomProps.containerProps.style.display = 'inherit';\n\n useLayoutEffect(() => {\n if (!isSafari) return;\n if (!showOriginal) return;\n (async () => {\n try {\n await fetch(mediaURL, { mode: 'no-cors' });\n mediaRef.current.src = mediaURL;\n } catch (e) {\n // Ignore\n }\n })();\n }, [mediaURL]);\n\n return (\n
    \n \n {showOriginal ? (\n \n {\n e.target.closest('.media-image').style.backgroundImage = '';\n e.target.closest('.media-zoom').style.display = '';\n setPinchZoomEnabled(true);\n }}\n onError={(e) => {\n const { src } = e.target;\n if (\n src === mediaURL &&\n remoteMediaURL &&\n mediaURL !== remoteMediaURL\n ) {\n e.target.src = remoteMediaURL;\n }\n }}\n />\n \n ) : (\n <>\n {\n // e.target.closest('.media-image').style.backgroundImage = '';\n e.target.dataset.loaded = true;\n const $media = e.target.closest('.media');\n if (!hasDimensions && $media) {\n const { naturalWidth, naturalHeight } = e.target;\n $media.dataset.orientation =\n naturalWidth > naturalHeight ? 'landscape' : 'portrait';\n $media.style.setProperty('--width', `${naturalWidth}px`);\n $media.style.setProperty('--height', `${naturalHeight}px`);\n $media.style.aspectRatio = `${naturalWidth}/${naturalHeight}`;\n }\n\n // Check natural aspect ratio vs display aspect ratio\n if (checkAspectRatio && $media) {\n const {\n clientWidth,\n clientHeight,\n naturalWidth,\n naturalHeight,\n } = e.target;\n if (\n clientWidth &&\n clientHeight &&\n naturalWidth &&\n naturalHeight\n ) {\n const minDimension = 88;\n if (\n naturalWidth < minDimension ||\n naturalHeight < minDimension\n ) {\n $media.dataset.hasSmallDimension = true;\n } else {\n const displayNaturalHeight =\n (naturalHeight * clientWidth) / naturalWidth;\n const almostSimilarHeight =\n Math.abs(displayNaturalHeight - clientHeight) < 5;\n\n if (almostSimilarHeight) {\n setHasNaturalAspectRatio(true);\n }\n }\n }\n }\n }}\n onError={(e) => {\n const { src } = e.target;\n if (src === mediaURL && mediaURL !== remoteMediaURL) {\n e.target.src = remoteMediaURL;\n }\n }}\n />\n {!showInlineDesc && (\n \n )}\n \n )}\n \n
    \n );\n } else if (type === 'gifv' || type === 'video' || isVideoMaybe) {\n const hasDuration = original.duration > 0;\n const shortDuration = original.duration < 31;\n const isGIF = type === 'gifv' && shortDuration;\n // If GIF is too long, treat it as a video\n const loopable = original.duration < 61;\n const formattedDuration = formatDuration(original.duration);\n const hoverAnimate = !showOriginal && !autoAnimate && isGIF;\n const autoGIFAnimate = !showOriginal && autoAnimate && isGIF;\n const showProgress = original.duration > 5;\n\n // This string is only for autoplay + muted to work on Mobile Safari\n const gifHTML = `\n \n `;\n\n const videoHTML = `\n \n `;\n\n return (\n
    \n {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n onClick(e);\n }}\n onMouseEnter={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.play();\n } catch (e) {}\n }\n }}\n onMouseLeave={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n }}\n onFocus={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.play();\n } catch (e) {}\n }\n }}\n onBlur={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n }}\n >\n {showOriginal || autoGIFAnimate ? (\n isGIF && showOriginal ? (\n \n \n \n ) : isGIF ? (\n \n ) : (\n \n )\n ) : isGIF ? (\n {\n const { target } = e;\n const container = target?.closest('.media-gif');\n if (container) {\n const percentage =\n (target.currentTime / target.duration) * 100;\n container.style.setProperty(\n '--progress',\n `${percentage}%`,\n );\n }\n }\n : undefined\n }\n />\n ) : (\n <>\n {previewUrl ? (\n {\n if (!hasDimensions) {\n const $media = e.target.closest('.media');\n if ($media) {\n const { naturalHeight, naturalWidth } = e.target;\n $media.dataset.orientation =\n naturalWidth > naturalHeight\n ? 'landscape'\n : 'portrait';\n $media.style.setProperty(\n '--width',\n `${naturalWidth}px`,\n );\n $media.style.setProperty(\n '--height',\n `${naturalHeight}px`,\n );\n $media.style.aspectRatio = `${naturalWidth}/${naturalHeight}`;\n }\n }\n }}\n />\n ) : (\n {\n if (!hasDuration) {\n const { duration } = e.target;\n if (duration) {\n const formattedDuration = formatDuration(duration);\n const container = e.target.closest('.media-video');\n if (container) {\n container.dataset.formattedDuration =\n formattedDuration;\n }\n }\n }\n }}\n />\n )}\n
    \n \n
    \n \n )}\n {!showOriginal && !showInlineDesc && (\n \n )}\n \n
    \n );\n } else if (type === 'audio' || isAudioMaybe) {\n const formattedDuration = formatDuration(original.duration);\n return (\n
    \n \n {showOriginal ? (\n
    \n );\n }\n}\n\nfunction getURLObj(url) {\n // Fake base URL if url doesn't have https:// prefix\n return URL.parse(url, location.origin);\n}\n\nexport default memo(Media, (oldProps, newProps) => {\n const oldMedia = oldProps.media || {};\n const newMedia = newProps.media || {};\n\n return (\n oldMedia?.id === newMedia?.id &&\n oldMedia.url === newMedia.url &&\n oldProps.to === newProps.to &&\n oldProps.class === newProps.class\n );\n});\n","import './status.css';\nimport '@justinribeiro/lite-youtube';\n\nimport { msg, plural, Plural, t, Trans } from '@lingui/macro';\nimport { useLingui } from '@lingui/react';\nimport {\n ControlledMenu,\n Menu,\n MenuDivider,\n MenuHeader,\n MenuItem,\n} from '@szhsin/react-menu';\nimport { decodeBlurHash, getBlurHashAverageColor } from 'fast-blurhash';\nimport { shallowEqual } from 'fast-equals';\nimport prettify from 'html-prettify';\nimport pThrottle from 'p-throttle';\nimport { Fragment } from 'preact';\nimport { forwardRef, memo } from 'preact/compat';\nimport {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport punycode from 'punycode/';\nimport { useHotkeys } from 'react-hotkeys-hook';\n// import { detectAll } from 'tinyld/light';\nimport { useLongPress } from 'use-long-press';\nimport { useSnapshot } from 'valtio';\n\nimport CustomEmoji from '../components/custom-emoji';\nimport EmojiText from '../components/emoji-text';\nimport LazyShazam from '../components/lazy-shazam';\nimport Loader from '../components/loader';\nimport MenuConfirm from '../components/menu-confirm';\nimport Menu2 from '../components/menu2';\nimport Modal from '../components/modal';\nimport NameText from '../components/name-text';\nimport Poll from '../components/poll';\nimport { api } from '../utils/api';\nimport emojifyText from '../utils/emojify-text';\nimport enhanceContent from '../utils/enhance-content';\nimport FilterContext from '../utils/filter-context';\nimport { isFiltered } from '../utils/filters';\nimport getTranslateTargetLanguage from '../utils/get-translate-target-language';\nimport getHTMLText from '../utils/getHTMLText';\nimport handleContentLinks from '../utils/handle-content-links';\nimport htmlContentLength from '../utils/html-content-length';\nimport isRTL from '../utils/is-rtl';\nimport isMastodonLinkMaybe from '../utils/isMastodonLinkMaybe';\nimport localeMatch from '../utils/locale-match';\nimport niceDateTime from '../utils/nice-date-time';\nimport openCompose from '../utils/open-compose';\nimport pmem from '../utils/pmem';\nimport safeBoundingBoxPadding from '../utils/safe-bounding-box-padding';\nimport shortenNumber from '../utils/shorten-number';\nimport showCompose from '../utils/show-compose';\nimport showToast from '../utils/show-toast';\nimport { speak, supportsTTS } from '../utils/speech';\nimport states, { getStatus, saveStatus, statusKey } from '../utils/states';\nimport statusPeek from '../utils/status-peek';\nimport store from '../utils/store';\nimport { getCurrentAccountID } from '../utils/store-utils';\nimport supports from '../utils/supports';\nimport unfurlMastodonLink from '../utils/unfurl-link';\nimport useTruncated from '../utils/useTruncated';\nimport visibilityIconsMap from '../utils/visibility-icons-map';\n\nimport Avatar from './avatar';\nimport Icon from './icon';\nimport Link from './link';\nimport Media, { isMediaCaptionLong } from './media';\nimport MenuLink from './menu-link';\nimport RelativeTime from './relative-time';\nimport TranslationBlock from './translation-block';\n\nconst SHOW_COMMENT_COUNT_LIMIT = 280;\nconst INLINE_TRANSLATE_LIMIT = 140;\n\nconst throttle = pThrottle({\n limit: 1,\n interval: 1000,\n});\nfunction fetchAccount(id, masto) {\n return masto.v1.accounts.$select(id).fetch();\n}\nconst memFetchAccount = pmem(throttle(fetchAccount));\n\nconst visibilityText = {\n public: msg`Public`,\n local: msg`Local`,\n unlisted: msg`Unlisted`,\n private: msg`Followers only`,\n direct: msg`Private mention`,\n};\n\nconst isIOS =\n window.ontouchstart !== undefined &&\n /iPad|iPhone|iPod/.test(navigator.userAgent);\n\nconst rtf = new Intl.RelativeTimeFormat();\n\nconst REACTIONS_LIMIT = 80;\n\nfunction getPollText(poll) {\n if (!poll?.options?.length) return '';\n return `📊:\\n${poll.options\n .map(\n (option) =>\n `- ${option.title}${\n option.votesCount >= 0 ? ` (${option.votesCount})` : ''\n }`,\n )\n .join('\\n')}`;\n}\nfunction getPostText(status) {\n const { spoilerText, content, poll } = status;\n return (\n (spoilerText ? `${spoilerText}\\n\\n` : '') +\n getHTMLText(content) +\n getPollText(poll)\n );\n}\n\nfunction forgivingQSA(selectors = [], dom = document) {\n // Run QSA for list of selectors\n // If a selector return invalid selector error, try the next one\n for (const selector of selectors) {\n try {\n return dom.querySelectorAll(selector);\n } catch (e) {}\n }\n return [];\n}\n\nfunction isTranslateble(content) {\n if (!content) return false;\n content = content.trim();\n if (!content) return false;\n const text = getHTMLText(content, {\n preProcess: (dom) => {\n // Remove .mention, pre, code, a:has(.invisible)\n for (const a of forgivingQSA(\n ['.mention, pre, code, a:has(.invisible)', '.mention, pre, code'],\n dom,\n )) {\n a.remove();\n }\n },\n });\n return !!text;\n}\n\nfunction getHTMLTextForDetectLang(content) {\n return getHTMLText(content, {\n preProcess: (dom) => {\n // Remove anything that can skew the language detection\n\n // Remove .mention, .hashtag, pre, code, a:has(.invisible)\n for (const a of forgivingQSA(\n [\n '.mention, .hashtag, pre, code, a:has(.invisible)',\n '.mention, .hashtag, pre, code',\n ],\n dom,\n )) {\n a.remove();\n }\n\n // Remove links that contains text that starts with https?://\n for (const a of dom.querySelectorAll('a')) {\n const text = a.innerText.trim();\n if (text.startsWith('https://') || text.startsWith('http://')) {\n a.remove();\n }\n }\n },\n });\n}\n\nconst HTTP_REGEX = /^http/i;\nconst PostContent =\n /*memo(*/\n ({ post, instance, previewMode }) => {\n const { content, emojis, language, mentions, url } = post;\n\n const divRef = useRef();\n useLayoutEffect(() => {\n if (!divRef.current) return;\n const dom = enhanceContent(content, {\n emojis,\n returnDOM: true,\n });\n // Remove target=\"_blank\" from links\n for (const a of dom.querySelectorAll('a.u-url[target=\"_blank\"]')) {\n if (!HTTP_REGEX.test(a.innerText.trim())) {\n a.removeAttribute('target');\n }\n }\n divRef.current.replaceChildren(dom.cloneNode(true));\n }, [content, emojis.length]);\n\n return (\n {\n // // Remove target=\"_blank\" from links\n // dom.querySelectorAll('a.u-url[target=\"_blank\"]').forEach((a) => {\n // if (!/http/i.test(a.innerText.trim())) {\n // a.removeAttribute('target');\n // }\n // });\n // },\n // }),\n // }}\n />\n );\n }; /*,\n (oldProps, newProps) => {\n const { post: oldPost } = oldProps;\n const { post: newPost } = newProps;\n return oldPost.content === newPost.content;\n },\n);*/\n\nconst SIZE_CLASS = {\n s: 'small',\n m: 'medium',\n l: 'large',\n};\n\nconst detectLang = pmem(async (text) => {\n const { detectAll } = await import('tinyld/light');\n text = text?.trim();\n\n // Ref: https://github.com/komodojp/tinyld/blob/develop/docs/benchmark.md\n // 500 should be enough for now, also the default max chars for Mastodon\n if (text?.length > 500) {\n return null;\n }\n const langs = detectAll(text);\n const lang = langs[0];\n if (lang?.lang && lang?.accuracy > 0.5) {\n // If > 50% accurate, use it\n // It can be accurate if < 50% but better be safe\n // Though > 50% also can be inaccurate 🤷‍♂️\n return lang.lang;\n }\n return null;\n});\n\nconst readMoreText = msg`Read more →`;\n\n// All this work just to make sure this only lazy-run once\n// Because first run is slow due to intl-localematcher\nconst DIFFERENT_LANG_CHECK = {};\nconst checkDifferentLanguage = (\n language,\n contentTranslationHideLanguages = [],\n) => {\n if (!language) return false;\n const targetLanguage = getTranslateTargetLanguage(true);\n const different =\n language !== targetLanguage &&\n !localeMatch([language], [targetLanguage]) &&\n !contentTranslationHideLanguages.find(\n (l) => language === l || localeMatch([language], [l]),\n );\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages] = true;\n return different;\n};\n\nfunction Status({\n statusID,\n status,\n instance: propInstance,\n size = 'm',\n contentTextWeight,\n readOnly,\n enableCommentHint,\n withinContext,\n skeleton,\n enableTranslate,\n forceTranslate: _forceTranslate,\n previewMode,\n // allowFilters,\n onMediaClick,\n quoted,\n onStatusLinkClick = () => {},\n showFollowedTags,\n allowContextMenu,\n showActionsBar,\n showReplyParent,\n mediaFirst,\n}) {\n const { _ } = useLingui();\n\n if (skeleton) {\n return (\n \n {!mediaFirst && }\n
    \n
    \n {(size === 's' || mediaFirst) && } ███ ████████\n
    \n
    \n {mediaFirst &&
    }\n
    \n

    ████ ████████

    \n
    \n
    \n
    \n
    \n );\n }\n const { masto, instance, authenticated } = api({ instance: propInstance });\n const { instance: currentInstance } = api();\n const sameInstance = instance === currentInstance;\n\n let sKey = statusKey(statusID || status?.id, instance);\n const snapStates = useSnapshot(states);\n if (!status) {\n status = snapStates.statuses[sKey] || snapStates.statuses[statusID];\n sKey = statusKey(status?.id, instance);\n }\n if (!status) {\n return null;\n }\n\n const {\n account: {\n acct,\n avatar,\n avatarStatic,\n id: accountId,\n url: accountURL,\n displayName,\n username,\n emojis: accountEmojis,\n bot,\n group,\n },\n id,\n repliesCount,\n reblogged,\n reblogsCount,\n favourited,\n favouritesCount,\n bookmarked,\n poll,\n muted,\n sensitive,\n spoilerText,\n visibility, // public, unlisted, private, direct\n language: _language,\n editedAt,\n filtered,\n card,\n createdAt,\n inReplyToId,\n inReplyToAccountId,\n content,\n mentions,\n mediaAttachments,\n reblog,\n uri,\n url,\n emojis,\n tags,\n pinned,\n // Non-API props\n _deleted,\n _pinned,\n // _filtered,\n // Non-Mastodon\n emojiReactions,\n } = status;\n\n const [languageAutoDetected, setLanguageAutoDetected] = useState(null);\n useEffect(() => {\n if (!content) return;\n if (_language) return;\n if (languageAutoDetected) return;\n let timer;\n timer = setTimeout(async () => {\n let detected = await detectLang(getHTMLTextForDetectLang(content));\n setLanguageAutoDetected(detected);\n }, 1000);\n return () => clearTimeout(timer);\n }, [content, _language]);\n const language = _language || languageAutoDetected;\n\n // if (!mediaAttachments?.length) mediaFirst = false;\n const hasMediaAttachments = !!mediaAttachments?.length;\n if (mediaFirst && hasMediaAttachments) size = 's';\n\n const currentAccount = useMemo(() => {\n return getCurrentAccountID();\n }, []);\n const isSelf = useMemo(() => {\n return currentAccount && currentAccount === accountId;\n }, [accountId, currentAccount]);\n\n const filterContext = useContext(FilterContext);\n const filterInfo =\n !isSelf && !readOnly && !previewMode && isFiltered(filtered, filterContext);\n\n if (filterInfo?.action === 'hide') {\n return null;\n }\n\n console.debug('RENDER Status', id, status?.account.displayName, quoted);\n\n const debugHover = (e) => {\n if (e.shiftKey) {\n console.log({\n ...status,\n });\n }\n };\n\n if (/*allowFilters && */ size !== 'l' && filterInfo) {\n return (\n \n );\n }\n\n const createdAtDate = new Date(createdAt);\n const editedAtDate = new Date(editedAt);\n\n let inReplyToAccountRef = mentions?.find(\n (mention) => mention.id === inReplyToAccountId,\n );\n if (!inReplyToAccountRef && inReplyToAccountId === id) {\n inReplyToAccountRef = { url: accountURL, username, displayName };\n }\n const [inReplyToAccount, setInReplyToAccount] = useState(inReplyToAccountRef);\n if (!withinContext && !inReplyToAccount && inReplyToAccountId) {\n const account = states.accounts[inReplyToAccountId];\n if (account) {\n setInReplyToAccount(account);\n } else {\n memFetchAccount(inReplyToAccountId, masto)\n .then((account) => {\n setInReplyToAccount(account);\n states.accounts[account.id] = account;\n })\n .catch((e) => {});\n }\n }\n const mentionSelf =\n inReplyToAccountId === currentAccount ||\n mentions?.find((mention) => mention.id === currentAccount);\n\n const readingExpandSpoilers = useMemo(() => {\n const prefs = store.account.get('preferences') || {};\n return !!prefs['reading:expand:spoilers'];\n }, []);\n const readingExpandMedia = useMemo(() => {\n // default | show_all | hide_all\n // Ignore hide_all because it means hide *ALL* media including non-sensitive ones\n const prefs = store.account.get('preferences') || {};\n return prefs['reading:expand:media']?.toLowerCase() || 'default';\n }, []);\n // FOR TESTING:\n // const readingExpandSpoilers = true;\n // const readingExpandMedia = 'show_all';\n const showSpoiler =\n previewMode || readingExpandSpoilers || !!snapStates.spoilers[id];\n const showSpoilerMedia =\n previewMode ||\n readingExpandMedia === 'show_all' ||\n !!snapStates.spoilersMedia[id];\n\n if (reblog) {\n // If has statusID, means useItemID (cached in states)\n\n if (group) {\n return (\n \n
    \n {' '}\n \n
    \n \n \n );\n }\n\n return (\n \n
    \n {' '}\n \n {' '}\n boosted\n \n
    \n \n \n );\n }\n\n // Check followedTags\n const FollowedTagsParent = useCallback(\n ({ children }) => (\n \n
    \n {' '}\n {snapStates.statusFollowedTags[sKey].slice(0, 3).map((tag) => (\n \n {tag}\n \n ))}\n
    \n {children}\n \n ),\n [sKey, instance, snapStates.statusFollowedTags[sKey]],\n );\n const StatusParent =\n showFollowedTags && !!snapStates.statusFollowedTags[sKey]?.length\n ? FollowedTagsParent\n : Fragment;\n\n const isSizeLarge = size === 'l';\n\n const [forceTranslate, setForceTranslate] = useState(_forceTranslate);\n // const targetLanguage = getTranslateTargetLanguage(true);\n // const contentTranslationHideLanguages =\n // snapStates.settings.contentTranslationHideLanguages || [];\n const { contentTranslation, contentTranslationAutoInline } =\n snapStates.settings;\n if (!contentTranslation) enableTranslate = false;\n const inlineTranslate = useMemo(() => {\n if (\n !contentTranslation ||\n !contentTranslationAutoInline ||\n readOnly ||\n (withinContext && !isSizeLarge) ||\n previewMode ||\n spoilerText ||\n sensitive ||\n poll ||\n card ||\n mediaAttachments?.length\n ) {\n return false;\n }\n const contentLength = htmlContentLength(content);\n return contentLength > 0 && contentLength <= INLINE_TRANSLATE_LIMIT;\n }, [\n contentTranslation,\n contentTranslationAutoInline,\n readOnly,\n withinContext,\n isSizeLarge,\n previewMode,\n spoilerText,\n sensitive,\n poll,\n card,\n mediaAttachments,\n content,\n ]);\n\n const [showEdited, setShowEdited] = useState(false);\n const [showEmbed, setShowEmbed] = useState(false);\n\n const spoilerContentRef = useTruncated();\n const contentRef = useTruncated();\n const mediaContainerRef = useTruncated();\n\n const statusRef = useRef(null);\n\n const unauthInteractionErrorMessage = t`Sorry, your current logged-in instance can't interact with this post from another instance.`;\n\n const textWeight = useCallback(\n () =>\n Math.max(\n Math.round((spoilerText.length + htmlContentLength(content)) / 140) ||\n 1,\n 1,\n ),\n [spoilerText, content],\n );\n\n const createdDateText = niceDateTime(createdAtDate);\n const editedDateText = editedAt && niceDateTime(editedAtDate);\n\n // Can boost if:\n // - authenticated AND\n // - visibility != direct OR\n // - visibility = private AND isSelf\n let canBoost =\n authenticated && visibility !== 'direct' && visibility !== 'private';\n if (visibility === 'private' && isSelf) {\n canBoost = true;\n }\n\n const replyStatus = (e) => {\n if (!sameInstance || !authenticated) {\n return alert(unauthInteractionErrorMessage);\n }\n // syntheticEvent comes from MenuItem\n if (e?.shiftKey || e?.syntheticEvent?.shiftKey) {\n const newWin = openCompose({\n replyToStatus: status,\n });\n if (newWin) return;\n }\n showCompose({\n replyToStatus: status,\n });\n };\n\n // Check if media has no descriptions\n const mediaNoDesc = useMemo(() => {\n return mediaAttachments.some(\n (attachment) => !attachment.description?.trim?.(),\n );\n }, [mediaAttachments]);\n\n const statusMonthsAgo = useMemo(() => {\n return Math.floor(\n (new Date() - createdAtDate) / (1000 * 60 * 60 * 24 * 30),\n );\n }, [createdAtDate]);\n\n // const boostStatus = async () => {\n // if (!sameInstance || !authenticated) {\n // alert(unauthInteractionErrorMessage);\n // return false;\n // }\n // try {\n // if (!reblogged) {\n // let confirmText = 'Boost this post?';\n // if (mediaNoDesc) {\n // confirmText += '\\n\\n⚠️ Some media have no descriptions.';\n // }\n // const yes = confirm(confirmText);\n // if (!yes) {\n // return false;\n // }\n // }\n // // Optimistic\n // states.statuses[sKey] = {\n // ...status,\n // reblogged: !reblogged,\n // reblogsCount: reblogsCount + (reblogged ? -1 : 1),\n // };\n // if (reblogged) {\n // const newStatus = await masto.v1.statuses.$select(id).unreblog();\n // saveStatus(newStatus, instance);\n // return true;\n // } else {\n // const newStatus = await masto.v1.statuses.$select(id).reblog();\n // saveStatus(newStatus, instance);\n // return true;\n // }\n // } catch (e) {\n // console.error(e);\n // // Revert optimistism\n // states.statuses[sKey] = status;\n // return false;\n // }\n // };\n const confirmBoostStatus = async () => {\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n reblogged: !reblogged,\n reblogsCount: reblogsCount + (reblogged ? -1 : 1),\n };\n if (reblogged) {\n const newStatus = await masto.v1.statuses.$select(id).unreblog();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).reblog();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n\n const favouriteStatus = async () => {\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n favourited: !favourited,\n favouritesCount: favouritesCount + (favourited ? -1 : 1),\n };\n if (favourited) {\n const newStatus = await masto.v1.statuses.$select(id).unfavourite();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).favourite();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n const favouriteStatusNotify = async () => {\n try {\n const done = await favouriteStatus();\n if (!isSizeLarge && done) {\n showToast(\n favourited\n ? t`Unliked @${username || acct}'s post`\n : t`Liked @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n };\n\n const bookmarkStatus = async () => {\n if (!supports('@mastodon/post-bookmark')) return;\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n bookmarked: !bookmarked,\n };\n if (bookmarked) {\n const newStatus = await masto.v1.statuses.$select(id).unbookmark();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).bookmark();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n const bookmarkStatusNotify = async () => {\n try {\n const done = await bookmarkStatus();\n if (!isSizeLarge && done) {\n showToast(\n bookmarked\n ? t`Unbookmarked @${username || acct}'s post`\n : t`Bookmarked @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n };\n\n // const differentLanguage =\n // !!language &&\n // language !== targetLanguage &&\n // !localeMatch([language], [targetLanguage]) &&\n // !contentTranslationHideLanguages.find(\n // (l) => language === l || localeMatch([language], [l]),\n // );\n const contentTranslationHideLanguages =\n snapStates.settings.contentTranslationHideLanguages || [];\n const [differentLanguage, setDifferentLanguage] = useState(\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages]\n ? checkDifferentLanguage(language, contentTranslationHideLanguages)\n : false,\n );\n useEffect(() => {\n if (\n !language ||\n differentLanguage ||\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages]\n ) {\n return;\n }\n let timeout = setTimeout(() => {\n const different = checkDifferentLanguage(\n language,\n contentTranslationHideLanguages,\n );\n if (different) setDifferentLanguage(different);\n }, 1);\n return () => clearTimeout(timeout);\n }, [language, differentLanguage, contentTranslationHideLanguages]);\n\n const reblogIterator = useRef();\n const favouriteIterator = useRef();\n async function fetchBoostedLikedByAccounts(firstLoad) {\n if (firstLoad) {\n reblogIterator.current = masto.v1.statuses\n .$select(statusID)\n .rebloggedBy.list({\n limit: REACTIONS_LIMIT,\n });\n favouriteIterator.current = masto.v1.statuses\n .$select(statusID)\n .favouritedBy.list({\n limit: REACTIONS_LIMIT,\n });\n }\n const [{ value: reblogResults }, { value: favouriteResults }] =\n await Promise.allSettled([\n reblogIterator.current.next(),\n favouriteIterator.current.next(),\n ]);\n if (reblogResults.value?.length || favouriteResults.value?.length) {\n const accounts = [];\n if (reblogResults.value?.length) {\n accounts.push(\n ...reblogResults.value.map((a) => {\n a._types = ['reblog'];\n return a;\n }),\n );\n }\n if (favouriteResults.value?.length) {\n accounts.push(\n ...favouriteResults.value.map((a) => {\n a._types = ['favourite'];\n return a;\n }),\n );\n }\n return {\n value: accounts,\n done: reblogResults.done && favouriteResults.done,\n };\n }\n return {\n value: [],\n done: true,\n };\n }\n\n const actionsRef = useRef();\n const isPublic = ['public', 'unlisted'].includes(visibility);\n const isPinnable = ['public', 'unlisted', 'private'].includes(visibility);\n const StatusMenuItems = (\n <>\n {!isSizeLarge && sameInstance && (\n <>\n
    \n \n \n \n {repliesCount > 0 ? shortenNumber(repliesCount) : t`Reply`}\n \n \n \n \n {reblogged ? t`Unboost` : t`Boost`}\n \n }\n className={`menu-reblog ${reblogged ? 'checked' : ''}`}\n menuExtras={\n {\n showCompose({\n draftStatus: {\n status: `\\n${url}`,\n },\n });\n }}\n >\n \n \n Quote\n \n \n }\n menuFooter={\n mediaNoDesc && !reblogged ? (\n
    \n \n Some media have no descriptions.\n
    \n ) : (\n statusMonthsAgo >= 3 && (\n
    \n \n \n \n Old post (\n \n {rtf.format(-statusMonthsAgo, 'month')}\n \n )\n \n \n
    \n )\n )\n }\n disabled={!canBoost}\n onClick={async () => {\n try {\n const done = await confirmBoostStatus();\n if (!isSizeLarge && done) {\n showToast(\n reblogged\n ? t`Unboosted @${username || acct}'s post`\n : t`Boosted @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n }}\n >\n \n \n {reblogsCount > 0\n ? shortenNumber(reblogsCount)\n : reblogged\n ? t`Unboost`\n : t`Boost…`}\n \n \n \n \n \n {favouritesCount > 0\n ? shortenNumber(favouritesCount)\n : favourited\n ? t`Unlike`\n : t`Like`}\n \n \n {supports('@mastodon/post-bookmark') && (\n \n \n {bookmarked ? t`Unbookmark` : t`Bookmark`}\n \n )}\n
    \n \n )}\n {!isSizeLarge && sameInstance && (isSizeLarge || showActionsBar) && (\n \n )}\n {(isSizeLarge || showActionsBar) && (\n <>\n {\n states.showGenericAccounts = {\n heading: t`Boosted/Liked by…`,\n fetchAccounts: fetchBoostedLikedByAccounts,\n instance,\n showReactions: true,\n postID: sKey,\n };\n }}\n >\n \n \n Boosted/Liked by…\n \n \n \n )}\n {!mediaFirst && (\n <>\n {(enableTranslate || !language || differentLanguage) && (\n \n )}\n {enableTranslate ? (\n
    \n {\n setForceTranslate(true);\n }}\n >\n \n \n Translate\n \n \n {supportsTTS && (\n {\n const postText = getPostText(status);\n if (postText) {\n speak(postText, language);\n }\n }}\n >\n \n \n Speak\n \n \n )}\n
    \n ) : (\n (!language || differentLanguage) && (\n
    \n \n \n \n Translate\n \n \n {supportsTTS && (\n {\n const postText = getPostText(status);\n if (postText) {\n speak(postText, language);\n }\n }}\n >\n \n \n Speak\n \n \n )}\n
    \n )\n )}\n \n )}\n {((!isSizeLarge && sameInstance) ||\n enableTranslate ||\n !language ||\n differentLanguage) && }\n {!isSizeLarge && (\n <>\n {\n onStatusLinkClick(e, status);\n }}\n >\n \n \n \n View post by{' '}\n @{username || acct}\n \n
    \n \n {_(visibilityText[visibility])} • {createdDateText}\n \n
    \n \n \n )}\n {!!editedAt && (\n <>\n {\n setShowEdited(id);\n }}\n >\n \n \n Show Edit History\n
    \n \n Edited: {editedDateText}\n \n
    \n \n \n )}\n \n \n \n {nicePostURL(url)}\n \n \n
    \n {\n // Copy url to clipboard\n try {\n navigator.clipboard.writeText(url);\n showToast(t`Link copied`);\n } catch (e) {\n console.error(e);\n showToast(t`Unable to copy link`);\n }\n }}\n >\n \n \n Copy\n \n \n {isPublic &&\n navigator?.share &&\n navigator?.canShare?.({\n url,\n }) && (\n {\n try {\n navigator.share({\n url,\n });\n } catch (e) {\n console.error(e);\n alert(t`Sharing doesn't seem to work.`);\n }\n }}\n >\n \n \n Share…\n \n \n )}\n
    \n {isPublic && isSizeLarge && (\n {\n setShowEmbed(true);\n }}\n >\n \n \n Embed post\n \n \n )}\n {(isSelf || mentionSelf) && }\n {(isSelf || mentionSelf) && (\n {\n try {\n const newStatus = await masto.v1.statuses\n .$select(id)\n [muted ? 'unmute' : 'mute']();\n saveStatus(newStatus, instance);\n showToast(\n muted ? t`Conversation unmuted` : t`Conversation muted`,\n );\n } catch (e) {\n console.error(e);\n showToast(\n muted\n ? t`Unable to unmute conversation`\n : t`Unable to mute conversation`,\n );\n }\n }}\n >\n {muted ? (\n <>\n \n \n Unmute conversation\n \n \n ) : (\n <>\n \n \n Mute conversation\n \n \n )}\n \n )}\n {isSelf && isPinnable && (\n {\n try {\n const newStatus = await masto.v1.statuses\n .$select(id)\n [pinned ? 'unpin' : 'pin']();\n saveStatus(newStatus, instance);\n showToast(\n pinned\n ? t`Post unpinned from profile`\n : t`Post pinned to profile`,\n );\n } catch (e) {\n console.error(e);\n showToast(\n pinned ? t`Unable to unpin post` : t`Unable to pin post`,\n );\n }\n }}\n >\n {pinned ? (\n <>\n \n \n Unpin from profile\n \n \n ) : (\n <>\n \n \n Pin to profile\n \n \n )}\n \n )}\n {isSelf && (\n
    \n {supports('@mastodon/post-edit') && (\n {\n showCompose({\n editStatus: status,\n });\n }}\n >\n \n \n Edit\n \n \n )}\n {isSizeLarge && (\n \n \n \n Delete this post?\n \n \n }\n itemProps={{\n className: 'danger',\n }}\n menuItemClassName=\"danger\"\n onClick={() => {\n // const yes = confirm('Delete this post?');\n // if (yes) {\n (async () => {\n try {\n await masto.v1.statuses.$select(id).remove();\n const cachedStatus = getStatus(id, instance);\n cachedStatus._deleted = true;\n showToast(t`Post deleted`);\n } catch (e) {\n console.error(e);\n showToast(t`Unable to delete post`);\n }\n })();\n // }\n }}\n >\n \n \n Delete…\n \n \n )}\n
    \n )}\n {!isSelf && isSizeLarge && (\n <>\n \n {\n states.showReportModal = {\n account: status.account,\n post: status,\n };\n }}\n >\n \n \n Report post…\n \n \n \n )}\n \n );\n\n const contextMenuRef = useRef();\n const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);\n const [contextMenuProps, setContextMenuProps] = useState({});\n\n const showContextMenu =\n allowContextMenu || (!isSizeLarge && !previewMode && !_deleted && !quoted);\n\n // Only iOS/iPadOS browsers don't support contextmenu\n // Some comments report iPadOS might support contextmenu if a mouse is connected\n const bindLongPressContext = useLongPress(\n isIOS && showContextMenu\n ? (e) => {\n if (e.pointerType === 'mouse') return;\n // There's 'pen' too, but not sure if contextmenu event would trigger from a pen\n\n const { clientX, clientY } = e.touches?.[0] || e;\n // link detection copied from onContextMenu because here it works\n const link = e.target.closest('a');\n if (\n link &&\n statusRef.current.contains(link) &&\n !link.getAttribute('href').startsWith('#')\n )\n return;\n e.preventDefault();\n setContextMenuProps({\n anchorPoint: {\n x: clientX,\n y: clientY,\n },\n direction: 'right',\n });\n setIsContextMenuOpen(true);\n }\n : null,\n {\n threshold: 600,\n captureEvent: true,\n detect: 'touch',\n cancelOnMovement: 2, // true allows movement of up to 25 pixels\n },\n );\n\n const hotkeysEnabled = !readOnly && !previewMode && !quoted;\n const rRef = useHotkeys('r, shift+r', replyStatus, {\n enabled: hotkeysEnabled,\n });\n const fRef = useHotkeys('f, l', favouriteStatusNotify, {\n enabled: hotkeysEnabled,\n });\n const dRef = useHotkeys('d', bookmarkStatusNotify, {\n enabled: hotkeysEnabled,\n });\n const bRef = useHotkeys(\n 'shift+b',\n () => {\n (async () => {\n try {\n const done = await confirmBoostStatus();\n if (!isSizeLarge && done) {\n showToast(\n reblogged\n ? t`Unboosted @${username || acct}'s post`\n : t`Boosted @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n })();\n },\n {\n enabled: hotkeysEnabled && canBoost,\n },\n );\n const xRef = useHotkeys('x', (e) => {\n const activeStatus = document.activeElement.closest(\n '.status-link, .status-focus',\n );\n if (activeStatus) {\n const spoilerButton = activeStatus.querySelector(\n '.spoiler-button:not(.spoiling)',\n );\n if (spoilerButton) {\n e.stopPropagation();\n spoilerButton.click();\n } else {\n const spoilerMediaButton = activeStatus.querySelector(\n '.spoiler-media-button:not(.spoiling)',\n );\n if (spoilerMediaButton) {\n e.stopPropagation();\n spoilerMediaButton.click();\n }\n }\n }\n });\n\n const displayedMediaAttachments = mediaAttachments.slice(\n 0,\n isSizeLarge ? undefined : 4,\n );\n const showMultipleMediaCaptions =\n mediaAttachments.length > 1 &&\n displayedMediaAttachments.some(\n (media) => !!media.description && !isMediaCaptionLong(media.description),\n );\n const captionChildren = useMemo(() => {\n if (!showMultipleMediaCaptions) return null;\n const attachments = [];\n displayedMediaAttachments.forEach((media, i) => {\n if (!media.description) return;\n const index = attachments.findIndex(\n (attachment) => attachment.media.description === media.description,\n );\n if (index === -1) {\n attachments.push({\n media,\n indices: [i],\n });\n } else {\n attachments[index].indices.push(i);\n }\n });\n return attachments.map(({ media, indices }) => (\n i + 1).join(' ')}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n states.showMediaAlt = {\n alt: media.description,\n lang: language,\n };\n }}\n title={media.description}\n >\n {indices.map((i) => i + 1).join(' ')} {media.description}\n \n ));\n\n // return displayedMediaAttachments.map(\n // (media, i) =>\n // !!media.description && (\n // {\n // e.preventDefault();\n // e.stopPropagation();\n // states.showMediaAlt = {\n // alt: media.description,\n // lang: language,\n // };\n // }}\n // title={media.description}\n // >\n // {i + 1} {media.description}\n // \n // ),\n // );\n }, [showMultipleMediaCaptions, displayedMediaAttachments, language]);\n\n const isThread = useMemo(() => {\n return (\n (!!inReplyToId && inReplyToAccountId === status.account?.id) ||\n !!snapStates.statusThreadNumber[sKey]\n );\n }, [\n inReplyToId,\n inReplyToAccountId,\n status.account?.id,\n snapStates.statusThreadNumber[sKey],\n ]);\n\n const showCommentHint = useMemo(() => {\n return (\n enableCommentHint &&\n !isThread &&\n !withinContext &&\n !inReplyToId &&\n visibility === 'public' &&\n repliesCount > 0\n );\n }, [\n enableCommentHint,\n isThread,\n withinContext,\n inReplyToId,\n repliesCount,\n visibility,\n ]);\n const showCommentCount = useMemo(() => {\n if (\n card ||\n poll ||\n sensitive ||\n spoilerText ||\n mediaAttachments?.length ||\n isThread ||\n withinContext ||\n inReplyToId ||\n repliesCount <= 0\n ) {\n return false;\n }\n const questionRegex = /[???︖❓❔⁇⁈⁉¿‽؟]/;\n const containsQuestion = questionRegex.test(content);\n if (!containsQuestion) return false;\n const contentLength = htmlContentLength(content);\n if (contentLength > 0 && contentLength <= SHOW_COMMENT_COUNT_LIMIT) {\n return true;\n }\n }, [\n card,\n poll,\n sensitive,\n spoilerText,\n mediaAttachments,\n reblog,\n isThread,\n withinContext,\n inReplyToId,\n repliesCount,\n content,\n ]);\n\n return (\n \n {showReplyParent && !!(inReplyToId && inReplyToAccountId) && (\n \n )}\n {\n statusRef.current = node;\n // Use parent node if it's in focus\n // Use case: \n // When navigating (j/k), the is focused instead of \n // Hotkey binding doesn't bubble up thus this hack\n const nodeRef =\n node?.closest?.(\n '.timeline-item, .timeline-item-alt, .status-link, .status-focus',\n ) || node;\n rRef(nodeRef);\n fRef(nodeRef);\n dRef(nodeRef);\n bRef(nodeRef);\n xRef(nodeRef);\n }}\n tabindex=\"-1\"\n class={`status ${\n !withinContext && inReplyToId && inReplyToAccount\n ? 'status-reply-to'\n : ''\n } visibility-${visibility} ${_pinned ? 'status-pinned' : ''} ${\n SIZE_CLASS[size]\n } ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''} ${\n isContextMenuOpen ? 'status-menu-open' : ''\n } ${mediaFirst && hasMediaAttachments ? 'status-media-first' : ''}`}\n onMouseEnter={debugHover}\n onContextMenu={(e) => {\n if (!showContextMenu) return;\n if (e.metaKey) return;\n // console.log('context menu', e);\n const link = e.target.closest('a');\n if (\n link &&\n statusRef.current.contains(link) &&\n !link.getAttribute('href').startsWith('#')\n )\n return;\n\n // If there's selected text, don't show custom context menu\n const selection = window.getSelection?.();\n if (selection.toString().length > 0) {\n const { anchorNode } = selection;\n if (statusRef.current?.contains(anchorNode)) {\n return;\n }\n }\n e.preventDefault();\n setContextMenuProps({\n anchorPoint: {\n x: e.clientX,\n y: e.clientY,\n },\n direction: 'right',\n });\n setIsContextMenuOpen(true);\n }}\n {...(showContextMenu ? bindLongPressContext() : {})}\n >\n {showContextMenu && (\n {\n setIsContextMenuOpen(false);\n // statusRef.current?.focus?.();\n if (e?.reason === 'click') {\n statusRef.current?.closest('[tabindex]')?.focus?.();\n }\n }}\n portal={{\n target: document.body,\n }}\n containerProps={{\n style: {\n // Higher than the backdrop\n zIndex: 1001,\n },\n onClick: () => {\n contextMenuRef.current?.closeMenu?.();\n },\n }}\n overflow=\"auto\"\n boundingBoxPadding={safeBoundingBoxPadding()}\n unmountOnClose\n >\n {StatusMenuItems}\n \n )}\n {showActionsBar &&\n size !== 'l' &&\n !previewMode &&\n !readOnly &&\n !_deleted &&\n !quoted && (\n \n \n \n {\n e.preventDefault();\n e.stopPropagation();\n setContextMenuProps({\n anchorRef: {\n current: e.currentTarget,\n },\n align: 'start',\n direction: 'left',\n gap: 0,\n shift: -8,\n });\n setIsContextMenuOpen('actions-bar');\n }}\n >\n \n \n \n )}\n {size !== 'l' && (\n
    \n {reblogged && (\n \n )}\n {favourited && (\n \n )}\n {bookmarked && (\n \n )}\n {_pinned && (\n \n )}\n
    \n )}\n {size !== 's' && (\n {\n e.preventDefault();\n e.stopPropagation();\n states.showAccount = {\n account: status.account,\n instance,\n };\n }}\n >\n \n
    \n )}\n
    \n
    \n \n \n \n {/* {inReplyToAccount && !withinContext && size !== 's' && (\n <>\n {' '}\n \n {' '}\n \n \n \n )} */}\n {/* */}{' '}\n {size !== 'l' &&\n (_deleted ? (\n \n Deleted\n \n ) : url && !previewMode && !readOnly && !quoted ? (\n {\n if (\n e.metaKey ||\n e.ctrlKey ||\n e.shiftKey ||\n e.altKey ||\n e.which === 2\n ) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n onStatusLinkClick?.(e, status);\n setContextMenuProps({\n anchorRef: {\n current: e.currentTarget,\n },\n align: 'end',\n direction: 'bottom',\n gap: 4,\n });\n setIsContextMenuOpen(true);\n }}\n class={`time ${\n isContextMenuOpen && contextMenuProps?.anchorRef\n ? 'is-open'\n : ''\n }`}\n >\n {showCommentHint && !showCommentCount ? (\n \n ) : (\n visibility !== 'public' &&\n visibility !== 'direct' && (\n \n )\n )}{' '}\n \n {!previewMode && !readOnly && (\n \n )}\n \n ) : (\n // {\n // if (e.target === e.currentTarget)\n // menuInstanceRef.current?.closeMenu?.();\n // },\n // }}\n // align=\"end\"\n // gap={4}\n // overflow=\"auto\"\n // viewScroll=\"close\"\n // boundingBoxPadding=\"8 8 8 8\"\n // unmountOnClose\n // menuButton={({ open }) => (\n // {\n // e.preventDefault();\n // e.stopPropagation();\n // onStatusLinkClick?.(e, status);\n // }}\n // class={`time ${open ? 'is-open' : ''}`}\n // >\n // {' '}\n // \n // \n // )}\n // >\n // {StatusMenuItems}\n // \n \n {visibility !== 'public' && visibility !== 'direct' && (\n <>\n {' '}\n \n )}\n \n \n ))}\n
    \n {visibility === 'direct' && (\n <>\n
    \n Private mention\n
    {' '}\n \n )}\n {!withinContext && (\n <>\n {isThread ? (\n
    \n \n \n Thread\n {snapStates.statusThreadNumber[sKey]\n ? ` ${snapStates.statusThreadNumber[sKey]}/X`\n : ''}\n \n
    \n ) : (\n !!inReplyToId &&\n !!inReplyToAccount &&\n (!!spoilerText ||\n !mentions.find((mention) => {\n return mention.id === inReplyToAccountId;\n })) && (\n
    \n {' '}\n \n
    \n )\n )}\n \n )}\n \n {mediaFirst && hasMediaAttachments ? (\n <>\n {(!!spoilerText || !!sensitive) && !readingExpandSpoilers && (\n <>\n {!!spoilerText && (\n \n {' '}\n \n )}\n {\n e.preventDefault();\n e.stopPropagation();\n if (showSpoiler) {\n delete states.spoilers[id];\n if (!readingExpandSpoilers) {\n delete states.spoilersMedia[id];\n }\n } else {\n states.spoilers[id] = true;\n if (!readingExpandSpoilers) {\n states.spoilersMedia[id] = true;\n }\n }\n }}\n >\n {' '}\n {showSpoiler ? t`Show less` : t`Show content`}\n \n \n )}\n \n {!!content && (\n
    \n \n
    \n )}\n \n ) : (\n <>\n {!!spoilerText && (\n <>\n \n

    \n \n

    \n
    \n {readingExpandSpoilers || previewMode ? (\n
    \n Content warning\n
    \n ) : (\n {\n e.preventDefault();\n e.stopPropagation();\n if (showSpoiler) {\n delete states.spoilers[id];\n if (!readingExpandSpoilers) {\n delete states.spoilersMedia[id];\n }\n } else {\n states.spoilers[id] = true;\n if (!readingExpandSpoilers) {\n states.spoilersMedia[id] = true;\n }\n }\n }}\n >\n {' '}\n {showSpoiler ? t`Show less` : t`Show content`}\n \n )}\n \n )}\n {!!content && (\n \n \n \n \n )}\n {!!poll && (\n {\n states.statuses[sKey].poll = newPoll;\n }}\n refresh={() => {\n return masto.v1.polls\n .$select(poll.id)\n .fetch()\n .then((pollResponse) => {\n states.statuses[sKey].poll = pollResponse;\n })\n .catch((e) => {}); // Silently fail\n }}\n votePoll={(choices) => {\n return masto.v1.polls\n .$select(poll.id)\n .votes.create({\n choices,\n })\n .then((pollResponse) => {\n states.statuses[sKey].poll = pollResponse;\n })\n .catch((e) => {}); // Silently fail\n }}\n />\n )}\n {(((enableTranslate || inlineTranslate) &&\n isTranslateble(content) &&\n differentLanguage) ||\n forceTranslate) && (\n \n )}\n {!previewMode &&\n sensitive &&\n !!mediaAttachments.length &&\n readingExpandMedia !== 'show_all' && (\n
    \n );\n}\n\nfunction MultipleMediaFigure(props) {\n const { enabled, children, lang, captionChildren } = props;\n if (!enabled || !captionChildren) return children;\n return (\n
    \n {children}\n
    \n {captionChildren}\n
    \n
    \n );\n}\n\nfunction MediaFirstContainer(props) {\n const { mediaAttachments, language, postID, instance } = props;\n const moreThanOne = mediaAttachments.length > 1;\n\n const carouselRef = useRef();\n const [currentIndex, setCurrentIndex] = useState(0);\n\n useEffect(() => {\n let handleScroll = () => {\n const { clientWidth, scrollLeft } = carouselRef.current;\n const index = Math.round(Math.abs(scrollLeft) / clientWidth);\n setCurrentIndex(index);\n };\n if (carouselRef.current) {\n carouselRef.current.addEventListener('scroll', handleScroll, {\n passive: true,\n });\n }\n return () => {\n if (carouselRef.current) {\n carouselRef.current.removeEventListener('scroll', handleScroll);\n }\n };\n }, []);\n\n return (\n <>\n
    \n
    \n {mediaAttachments.map((media, i) => (\n
    \n \n
    \n ))}\n
    \n {moreThanOne && (\n \n )}\n
    \n {moreThanOne && (\n \n {mediaAttachments.map((media, i) => (\n \n ))}\n \n )}\n \n );\n}\n\nfunction getDomain(url) {\n return punycode.toUnicode(\n URL.parse(url)\n .hostname.replace(/^www\\./, '')\n .replace(/\\/$/, ''),\n );\n}\n\n// \"Post\": Quote post + card link preview combo\n// Assume all links from these domains are \"posts\"\n// Mastodon links are \"posts\" too but they are converted to real quote posts and there's too many domains to check\n// This is just \"Progressive Enhancement\"\nfunction isCardPost(domain) {\n return ['x.com', 'twitter.com', 'threads.net', 'bsky.app'].includes(domain);\n}\n\nfunction Byline({ authors, hidden, children }) {\n if (hidden) return children;\n if (!authors?.[0]?.account?.id) return children;\n const author = authors[0].account;\n\n return (\n \n );\n}\n\nfunction Card({ card, selfReferential, selfAuthor, instance }) {\n const snapStates = useSnapshot(states);\n const {\n blurhash,\n title,\n description,\n html,\n providerName,\n providerUrl,\n authorName,\n authorUrl,\n width,\n height,\n image,\n imageDescription,\n url,\n type,\n embedUrl,\n language,\n publishedAt,\n authors,\n } = card;\n\n /* type\n link = Link OEmbed\n photo = Photo OEmbed\n video = Video OEmbed\n rich = iframe OEmbed. Not currently accepted, so won’t show up in practice.\n */\n\n const hasText = title || providerName || authorName;\n const isLandscape = width / height >= 1.2;\n const size = isLandscape ? 'large' : '';\n\n const [cardStatusURL, setCardStatusURL] = useState(null);\n // const [cardStatusID, setCardStatusID] = useState(null);\n useEffect(() => {\n if (hasText && image && !selfReferential && isMastodonLinkMaybe(url)) {\n unfurlMastodonLink(instance, url).then((result) => {\n if (!result) return;\n const { id, url } = result;\n setCardStatusURL('#' + url);\n\n // NOTE: This is for quote post\n // (async () => {\n // const { masto } = api({ instance });\n // const status = await masto.v1.statuses.$select(id).fetch();\n // saveStatus(status, instance);\n // setCardStatusID(id);\n // })();\n });\n }\n }, [hasText, image, selfReferential]);\n\n // if (cardStatusID) {\n // return (\n // \n // );\n // }\n\n if (snapStates.unfurledLinks[url]) return null;\n\n const hasIframeHTML = /