import{j as o,_ as p}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e10.js";import{a as l}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e4.js";import{u as E,f as g,s as y,c as h,o as _,b as L}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e9.js";import{c as x}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e7.js";const v=x()(e=>({modalEmoji:null,options:{},childrenRef:null,offset:0,auxFunc:{mounted:null,desmouted:null},open:(i,t,a,s=10,n={mounted:null,desmouted:null})=>e(r=>(n.mounted&&n.mounted(),r.childrenRef!==a&&r.auxFunc.desmouted&&r.auxFunc.desmouted(),{modalEmoji:i,options:t,childrenRef:a,offset:s,auxFunc:n})),close:()=>e(i=>(i.auxFunc.desmouted&&i.auxFunc.desmouted(),{modalEmoji:null,options:{}}))}));function w(){const{modalEmoji:e,options:i,childrenRef:t,offset:a,close:s}=v(),{refs:n,floatingStyles:r,update:m,elements:c}=E({...i,middleware:[g({padding:5}),y({padding:5}),h({apply({availableWidth:d,availableHeight:u,elements:f}){Object.assign(f.floating.style,{maxWidth:`${d}px`,maxHeight:`${u}px`})}}),_(a)]});return l.useLayoutEffect(()=>{if(e&&c.reference&&c.floating)return L(c.reference,c.floating,m)},[e,c,m]),l.useLayoutEffect(()=>{const d=u=>{var j;const f=document.querySelector(".iziToast-wrapper");n.floating.current&&!n.floating.current.contains(u.target)&&!t.contains(u.target)&&(!f||!f.contains(u.target))&&!((j=document.querySelector("#pane-side ._21S-L span"))!=null&&j.contains(u.target))&&s()};return t&&(n.setReference(t),document.addEventListener("click",d)),()=>{document.removeEventListener("click",d)}},[e,t]),e&&o.jsx("section",{"data-id":"Modal Emoji",children:o.jsx("div",{ref:n.setFloating,role:"tooltip",className:"z-[9999]",style:r,children:o.jsx("div",{className:"py-[9px] overflow-visible text-left bg-[var(--dropdown-background)] rounded-2xl shadow-2xl",style:{position:"initial",maxWidth:"100vw"},role:"application",children:o.jsx("ul",{"data-testid":"attach-menu-popup",children:o.jsx("div",{className:"py-[3px]",children:e})})})})})}const z=()=>x()((e,i)=>({emojiArea:null,setUpdateText:t=>e(a=>(a.emojiArea.setText(t),{emojiArea:{...a.emojiArea,text:t}})),insertEmoji:t=>{const{emojiArea:a,setUpdateText:s}=i(),n=document.querySelector(`aside[render-name='emojiArea'] #${CSS.escape(a.id)}`),r=n.selectionStart||0,m=n.selectionEnd||0,c=n.value.slice(0,r)+t+n.value.slice(m);s(c),setTimeout(()=>{n.selectionStart=r+t.length,n.selectionEnd=r+t.length,n.focus()},150)}})),R=x()((e,i)=>({container:{},getContainer:t=>{const{container:a}=i();if(a[t])return a[t];{const s=z();return e(n=>({container:{...n.container,[t]:s}})),s}},deleteContainer:t=>e(a=>{const s={...a.container};return delete s[t],{container:s}})})),A=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e108.js")),[]));function I({id:e}){return o.jsx(l.Suspense,{fallback:o.jsx(o.Fragment,{}),children:o.jsx(A,{id:e})})}const S=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e110.js")),[]));function M({id:e}){return o.jsx(l.Suspense,{fallback:o.jsx(o.Fragment,{}),children:o.jsx(S,{id:e})})}const T=l.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e111.js")),[]));function O({id:e}){return o.jsx(l.Suspense,{fallback:o.jsx(o.Fragment,{}),children:o.jsx(T,{id:e})})}export{M as I,w as M,O as T,v as a,I as b,R as u};
