102 lines
657 KiB
JavaScript
102 lines
657 KiB
JavaScript
import{c as cv,s as oo,T as dv,u as Jt,r as Oc}from"./@vue/runtime-dom-DDAG46FW.js";import{i as qe,I as pv,a as fv,b as Zp,c as hv,d as ar,T as Es,_ as mv,u as Ee,e as ef,f as gv,g as vv,h as Fo,j as tf,k as yv,l as Bt,m as bv,n as _v,o as wv,p as Ev,q as nf,r as kv,s as Sv,t as Mv,v as Tv,w as Iv,x as xv,y as Ov,z as $v,A as Cv,B as Av,C as Rv}from"./@tencentcloud/uikit-base-component-vue3-YgTqL4da.js";import{f as G,ak as w,G as L,a as q,aN as A,I as z,J as V,H as ne,O as me,T as fu,A as P,aq as J,aF as of,at as lt,i as xe,F as he,ap as ze,ar as Dv,w as le,k as Pv,g as Ln,n as Te,a5 as hu,C as Nv,ab as ye,y as Lv,b as tt,d as Lt,ae as vi,aJ as At,am as mu,aK as rf,a9 as sf,aC as Bv,Z as vo,ad as Uv}from"./@vue/runtime-core-C6bnekPw.js";import{Q as Z,o as F,p as Mt,B as Fv,z as af,P as ln}from"./@vue/shared-mAAVTE9n.js";import{n as x,y as g,M as jv,K as Ht,L as rt,q as oa,r as Xr,B as lf,H as qv,C as uf,F as cf,a as Na,u as df,J as zv,c as So,m as gu}from"./@vue/reactivity-DiY1c2vO.js";import{X as ce,Q as $e,o as Tt,n as ot,i as gt,t as yi,r as pf,s as Gv}from"./@tencentcloud/chat-uikit-engine-zx802ozq.js";import{A as ra,R as _l,E as xn}from"./@tencentcloud/tui-core-8M7p1XHw.js";import{t as Hv}from"./vue-BVs68q8v.js";import{H as Vv}from"./@tencentcloud/tuiroom-engine-js-Br9swJyU.js";const lr=(t,e,n=!0,o=!1)=>{qe.addResourceBundle(t,"translation",e.translation,n,o)},vu=typeof wx<"u"&&typeof wx.getSystemInfoSync=="function"&&!!wx.getSystemInfoSync().fontSizeSetting,ff=typeof uni<"u"&&typeof window>"u",Wv=vu||ff,Wo=(typeof uni<"u"||typeof window<"u")&&!Wv,Rn=Wo&&window&&window.navigator&&window.navigator.userAgent||"",Kv=/Android/i.test(Rn),Yv=/(?:Windows Phone)/.test(Rn),Jv=/(?:SymbianOS)/.test(Rn),hf=/OpenHarmony/i.test(Rn),Xv=hf&&/\(PC[;,]/i.test(Rn),Qv=hf&&!Xv,Zv=Wo&&("ontouchstart"in window||navigator.maxTouchPoints>0)&&(function(){if(Wo){if(/Tablet|Pad/i.test(Rn))return!0;if(window.orientation===180||window.orientation===0)return window.innerWidth>=768&&window.innerHeight>=1024;if(window.orientation===90||window.orientation===-90)return window.innerWidth>=1024&&window.innerHeight>=768}return!1})(),ey=/iPhone/i.test(Rn)||/iPod/i.test(Rn),ty=vu,mf=Kv||Yv||Jv||ey||Zv||Qv,ny=Wo&&!mf,oy=ff&&!vu;function bi(){let t="";return ny?t="pc":mf?t="h5":ty?t="wechat":oy&&(t="app"),t}let ry=class ds{constructor(){if(ds.instance)return ds.instance;ds.instance=this,this.eventCallback=null,this.listener=null,this.button=0,this.init()}init(){Wo&&(this.eventCallback=e=>{this.listener&&this.listener(e)},document.addEventListener("mousedown",this.eventCallback))}listen(e){if(Wo){const{domRefs:n,ignoreDomRefs:o,handler:r,button:i=0}=e;this.button=i,this.listener=s=>{const a=Array.isArray(o)?o:[o];for(const u of a)if(u&&u.contains(s.target))return;const l=Array.isArray(n)?n:[n];for(const u of l)if(u&&u.contains(s.target)&&this.button===s.button)return;r(s),this.remove()}}}remove(){this.listener=null,this.button=-1}};console.log("UniversalAPI.VERSION:2.4.1");new ry;const iy={"The room does not exist, please confirm the room number or create a room!":"房间不存在,请确认房间号或创建房间!","Log out":"退出登录","Edit profile":"编辑资料","User Name":"用户名","Please input user name":"请输入名称","Username length should be greater than 0":"昵称长度应该大于0",Save:"保存",Camera:"摄像头",Mic:"麦克风","Off Camera":"摄像头已关闭","Mic settings":"麦克风设置",Output:"输出",Speaker:"扬声器",Test:"测试",Stop:"停止测试",Preview:"视频画面",Mirror:"视频镜像",Resolution:"分辨率","More Camera Settings":"更多摄像头设置","Join the room ?":"是否进入房间?","You are invited to room ":"您被邀请进入 ",Room:"房间",Join:"加入","Switch Theme":"换肤",Layout:"布局","New Room":"新建房间","Room Type":"房间类型","Your Name":"您的名字","Turn on the microphone":"开启麦克风","Turn on the speaker":"开启扬声器","Turn on the video":"开启视频","Free Speech Room":"自由发言房间","On-stage Speaking Room":"上台发言房间","Join Room":"进入房间","Enter room ID":"输入房间号","video conferencing":" 的视频会议","Quick Conference":"的快速会议","Room ID":"房间号","Low Definition":"流畅","Standard Definition":"标清","High Definition":"高清","Super Definition":"超清","End sharing":"结束共享","Stop sharing?":"是否停止屏幕共享?","Stop sharing":"停止共享","You are sharing the screen...":"你正在共享屏幕...",Sure:"确定",Sharing:"屏幕共享中","Share screen":"共享屏幕","Grant permission to screen recording":"打开屏幕录制权限","Open the system preferences settings":"打开系统便好设置",'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".':'由于macos 10.15 系统要求,请在"系统偏好设置-安全性与隐私-屏幕录制"中勾选当前应用程序。',"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?":"是否结束当前的共享屏幕,停止后所有人将无法继续观看屏幕内容","Others will no longer see your screen after you stop sharing.":"停止后所有人将无法继续观看屏幕内容","You currently do not have sharing permission, please raise your hand to apply for sharing permission first":"您当前没有共享权限,请先举手申请上台获取共享权限","You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first":"您当前没有白板权限,请先举手申请上台获取白板权限",Host:"房主",Me:"我",me:"我",Admin:"管理员",RoomOwner:"主持人",More:"更多","AI Assistant":"AI 助手","AI real-time conference content":"AI 实时会议内容","Turn on AI real-time subtitles":"开启AI实时字幕","Turn off AI real-time subtitles":"关闭AI实时字幕","Enable AI real-time meeting recording":"开启AI实时会议记录","Raise hand":"举手",Agree:"同意",Chat:"聊天",Cancel:"取消",Exit:"退出全屏","Full screen":"全屏",Members:"成员","Search Member":"搜索成员","Make host":"转交房主","Set as administrator":"设为管理员","Remove administrator":"撤销管理员","The administrator status of sb has been withdrawn":({named:t})=>`已将 ${t("name")} 的管理员身份撤回`,"sb has been set as administrator":({named:t})=>`已将 ${t("name")} 设为管理员`,"You have been invited by the administrator to step down, please raise your hand if you need to speak":"您已被管理员邀请下台,需要发言请先举手",Invite:"邀请",Settings:"设置",VirtualBackground:"虚拟背景",Close:"关闭",BlurredBackground:"背景模糊",EndPC:"结束房间",EndH5:"结束",Tips:"提示",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.':"您当前是房间主持人,请选择相应操作。若选择“结束房间”,将解散当前房间并将全体成员移出。若选择“离开房间”,当前房间不会解散,您的主持人权限将移交给其他成员。",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.':"您当前是房间主持人,请选择相应操作。若选择“结束房间”,将解散当前房间并将全体成员移出。","If you do not want to end the meeting, please designate a new host before leaving the meeting.":"如果您不想结束会议,请在离开会议前指定新的主持人。","Are you sure you want to leave this room?":"确定离开房间吗?","New host":"选择主持人","Transfer and leave":"移交并离开","Leave room?":"是否要离开房间","Select a new host":"请选择新的房间主持人","Appoint a new host":"指定一位新的主持人","The host closed the room.":"主持人结束会议,已解散房间",Note:"通知",Confirm:"确认",Leave:"离开房间",Dismiss:"结束房间","The administrator has been changed to ":"管理员已变更为","Muted by the moderator":"已被主持人禁言","Type a message":"说点什么...",Send:"发送","Failed to send the message":"发送消息失败","Applying for the stage":"正在申请上台","Apply for the stage":"申请上台","Cancel Apply":"取消申请","Are you sure you want to step down":"确定要下台吗",Check:"查看",Neglect:"忽略","Disable all audios":"全体静音","Enable all audios":"解除全体静音","Disable all videos":"全体静画","Enable all videos":"解除全体静画","All mute":"全体静音","All current and new members will be muted":"所有及新加入的成员将被静音","All and new members will be banned from the camera":"所有及新加入的成员将被禁止视频","All stop video":"全体禁画","Lift all mute":"取消全体静音","Lift stop all video":"取消全体禁画","No relevant user found.":"未找到相关用户","Member List":"成员列表",Unmute:"解除静音","Cancel Unmute":"取消解除禁言",Mute:"静音",members:"人","Failed to get chat message":"获取聊天消息失败","Agree to the stage":"同意上台","Take the stage now":"立即上台","Stay off the stage":"暂不上台","Cancel stage":"取消邀请上台","Invite stage":"邀请上台","Refuse stage":"拒绝上台","Members applying on stage":"成员上台申请","Enable video":"请求开启视频","Cancel Enable video":"取消解除禁画","Disable video":"关闭视频","Enable chat":"解除禁言","Disable chat":"禁言","Kick out":"踢出房间","is sharing their screen":"的屏幕分享","Apply to stage":"上台申请","Apply to stage application":"请求上台申请","Member Onstage Application":"成员上台申请",Reject:"拒绝","Reject All":"全部拒绝","Agree All":"全部同意","Please raise your hand to apply":"如果您想发言请先举手申请上麦","You can turn on the microphone and camera once you are on stage":"上台后可以打开麦克风和摄像头","Sb invites you to speak on stage":({named:t})=>`${t("role")}邀请您上台发言`,"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?":"同意上台后可打开摄像头和麦克风,是否同意上台?","Hand down":"手放下","Step down(Master)":"邀请下台","Step down":"下台","sb has rejected your application for the stage":({named:t})=>`${t("role")}拒绝了你的上台申请`,"You have been invited by the host to step down, please raise your hand if you need to speak":"您已被主持人邀请下台,需要发言请先举手","Select a screen/window":"选择屏幕/窗口",Screen:"屏幕",Window:"窗口",Share:"开始分享","Safety Reminder":"安全提醒","Continue sharing":"继续共享","Select a screen or window first":"请选择要分享的屏幕或者窗口",Grid:"一屏九等分","Gallery on right":"右侧成员列表","Gallery at top":"顶部成员列表","Network ":"网络",Latency:"延迟",Stability:"稳定",Fluctuation:"波动",Lag:"卡顿",Disconnected:"已断开","Packet loss":"丢包率","Share the room ID or invite link":"您可以通过复制房间号或者邀请链接的方式邀请更多人加入房间","Invite by room number":"通过房间号邀请","Invite via room link":"通过房间链接邀请","Room Link":"房间链接","You can share the room number or link to invite more people to join the room.":"您可以分享房间号或链接邀请更多人加入房间。","You can share the room number to invite more people to join the room":"您可以分享房间号邀请更多人加入房间","If you have any questions, please feel free to join our QQ group or send an email":"如果有任何问题欢迎加入我们的QQ群或者发送邮件。","If you have any questions, please email us.":"如果有任何问题欢迎加入我们的交流群或者发送邮件。","Join our product discussion group":"加入产品交流群","Our email address":"我们的邮件地址","Join now":"立即加入","Room QR code":"房间二维码",Participants:"参会成员","Search for conference attendees":"搜索参会成员","Invite via client scheme":"通过客户端 scheme 邀请","Contact us":"联系我们","Member management":"成员管理","Grid view":"宫格视图","Join our QQ group chat or email us.":"如果有任何问题欢迎加入我们的QQ群或者发送邮件","group chat":"QQ 群",Email:"邮箱地址","Audio settings":"声音设置","Camera settings":"摄像头设置",Copy:"复制","Copied successfully":"复制成功","Copied failure":"复制失败","This model does not support copying at this time":"此机型暂不支持复制","accepted the invitation to the stage":"接受了上台邀请","declined the invitation to the stage":"拒绝了上台邀请","All audios disabled":"已开启全体静音","All audios enabled":"已解除全体静音","Your microphone has been turned off":"已关闭您的麦克风","Sb invites you to turn on the microphone":({named:t})=>`${t("role")}邀请你打开麦克风`,"All videos disabled":"已开启全体禁画","All videos enabled":"已解除全体禁画","Your camera has been turned off":"已关闭您的摄像头","Sb invites you to turn on the camera":({named:t})=>`${t("role")}邀请你打开摄像头`,"The host has turned off your screen sharing":"主持人已关闭您的屏幕分享","Turn on the camera":"打开摄像头","Keep it closed":"保持关闭","You have been banned from text chat":"您被禁止文字聊天","You are allowed to text chat":"您被允许文字聊天","kicked out of the room by the host":"被主持人踢出房间","kicked out of the room":"被踢出房间","kicked out of the room by serve":"被服务端踢出房间","Reject sb on stage failed, please retry":({named:t})=>`拒绝 ${t("name")} 上台失败, 请重试`,"Agree sb on stage failed, please retry":({named:t})=>`同意 ${t("name")} 上台失败, 请重试`,"Has been fully muted and cannot open the microphone":"已被全员静音,无法打开麦克风","Has been muted by the host and cannot open the microphone":"已被主持人静音,无法打开麦克风","To apply to speak in the room, please raise your hand first to apply for the microphone":"申请发言房间,请先举手申请上麦","Has been full static painting, can not open the video":"已被全员静画,无法打开视频","It has been stilled by the host and cannot open the video":"已被主持人静画,无法打开视频","Failed to enter the room.":"进入房间失败!","Has been full static painting, can not share your screen":"已被全员静画,无法打开屏幕分享","Microphone not detected on current device":"当前设备未检测到麦克风","Camera not detected on current device":"当前设备未检测到摄像头","Camera And Microphone not detected on current device":"当前设备未检测到摄像头和麦克风","Another user is sharing the screen.":"其他成员正在屏幕共享","Screen sharing is currently active, cannot start the whiteboard.":"当前正在屏幕共享,无法开启白板","This action causes the room to be exited, does it continue?":"该操作会导致退出房间,是否继续?","This action causes the room to be disbanded, does it continue?":"该操作会导致解散房间,是否继续?","Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.":"共享屏幕时可能会泄露短信验证码、密码等隐私信息,造成财产损失,请警惕各种诈骗行为","Please enter the room number":"请输入房间号","The current browser does not support capturing audio and video":"当前浏览器不支持采集音频和视频","The current browser does not support getting microphone and camera list":"当前浏览器不支持获取麦克风和摄像头列表","The current browser does not support screen sharing":"当前浏览器不支持屏幕分享","The current browser does not support capturing audio":"当前浏览器不支持采集音频","The current browser does not support capturing video":"当前浏览器不支持采集视频","The current browser does not support audio and video communication capabilities":"当前浏览器不支持音视频通信能力","whether to kick sb off the room":({named:t})=>`是否将 ${t("name")} 移出房间`,"An invitation to open the microphone has been sent to sb.":({named:t})=>`已向 ${t("name")} 发出开启麦克风邀请`,"An invitation to open the camera has been sent to sb.":({named:t})=>`已向 ${t("name")} 发出开启摄像头邀请`,"Make host failed, please try again.":"转交房主失败,请重试","Sb has been set as an administrator":({named:t})=>`已将 ${t("name")} 设为管理员`,"Succeed on stage":"上台成功","After unlocking, users can freely turn on the microphone":"解除后用户可以自由开启麦克风","Members will not be able to open the microphone":"成员将无法开启麦克风","After unlocking, users can freely turn on the camera":"解除后用户可以自由开启视频","Members will not be able to open the camera":"成员将无法开启视频画面","You have become a administrator":"您已成为管理员","You are now a room owner":"您已成为房主","Your administrator status has been revoked":"您的管理员身份被收回","After transfer the room owner, you will become a general user":"转交房主后将成为普通成员","Transfer the roomOwner to sb":({named:t})=>`将房主转移给${t("name")}`,"Confirm transfer":"确认转交","The room owner has been transferred to sb":({named:t})=>`已将房主转交给${t("name")}`,"Application to go on stage was rejected":"上台申请被拒绝","You are now an administrator":"您已成为管理员","The RoomOwner has withdrawn your administrator privileges":"房主已收回您的管理员权限","This member has already received the same request, please try again later":"该成员已收到相同请求,请稍后再试","The request to go on stage has timed out":"上台请求已超时","The invitation to sb to go on stage has timed out":({named:t})=>`对${t("name")}的上台邀请已超时`,"Currently no member has applied to go on stage":"暂无成员申请上台",Operate:"操作","Stage management":"上台管理","On stage":"已上台","Not on stage":"未上台","To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve":"再次上台需重新发起申请,并等待房主/管理员通过","To go on stage again, a new application needs to be initiated":"再次上台需重新发起申请","The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it":"上台申请已发出,请等待房主/管理员通过","Cancellation request has been sent, please wait for the roomOwner/administrator to approve it":"取消上台申请已发出,请等待房主/管理员通过","Canceled application to go on stage":"已取消上台申请","and so on":"等","people applying to stage":"人正在申请上台","and so on number people applying to stage":({named:t})=>`等 ${t("number")} 人正在申请上台`,"The stage is full, please contact the host":"台上人数已满,请联系主持人","The stage is full":"台上人数已满","change name":"修改名称","quick conference":"快速会议",Meeting:"会议","Meeting in progress":"会议 进行中",Initiating:"正在发起","X people have joined":({named:t})=>`${t("number")} 人已入会`,"Waiting for members to join the meeting":"等待成员入会","X people are in the meeting":({named:t})=>`${t("number")} 人在会议中`,"Already joined":"已入会","Enter the meeting":"进入会议","Ending meeting":"正在结束会议","The meeting has ended":"会议已结束","Currently in a meeting, please exit the current meeting before proceeding.":"正在会议中,请先退出当前会议后再进行操作","Failed to initiate meeting":"发起会议失败","Failed to enter the meeting":"进入会议失败","Failed to disable chat":"禁言失败","All members can share screen":"全体成员可共享屏幕","Screen sharing for host/admin only":"仅房主/管理员可共享屏幕","Failed to initiate screen sharing, currently only host/admin can share screen.":"发起共享失败,当前仅房主/管理员可以共享","Is it turned on that only the host/admin can share the screen?":"是否开启仅房主/管理员可共享屏幕?","Other member is sharing the screen is now, the member's sharing will be terminated after you turning on":"当前有成员正在共享屏幕, 开启后该成员的共享将会被终止","Your screen sharing has been stopped":"共享屏幕停止","Your screen sharing has been stopped, Now only the host/admin can share the screen":"已停止您的共享,当前仅房主/管理员可以共享屏幕","The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.":"系统禁止当前浏览器获取屏幕内容, 请开启屏幕分享权限。","User canceled screen sharing":"用户取消屏幕分享","An unknown error occurred while screen sharing, please try again.":"屏幕分享发生了未知错误,请重试","I got it":"我知道了",Attention:"注意",'Audio playback failed. Click the "Confirm" to resume playback':"音频播放失败。单击 “确认 ”恢复播放。","x people selected":({named:t})=>`已选择${t("number")}人`,Modify:"修改","view details":"查看详情","modify room":"修改房间","cancel room":"取消房间","No room available for booking":"暂无预订房间",Ongoing:"进行中",finished:"已结束","History room":"历史房间","sb temporary room":({named:t})=>`${t("name")}的临时房间`,year:"年",month:"月",day:"日",Schedule:"预订房间","Modify Room":"修改房间","Room Name":"房间名称","please enter the room name":"请输入房间名称","Room type":"房间类型","Starting time":"开始时间","Room duration":"房间时长","Time zone":"时区",Attendees:"参与成员","Please enter the member name":"请输入成员名称",people:"人",Contacts:"联系人","No relevant members found":"暂无相关成员","Selected Contact":"已选联系人","Scheduled meetings":"预订的会议",minute:"分钟",hour:"小时",minutes:"分钟",hours:"小时","The start time cannot be earlier than the current time":"开始时间不能早于当前时间","Room Time":"房间时间",Creator:"发起人","Room Details":"房间详情","Enter Now":"立即进入","Invited members":"邀请成员","The room is closed":"房间已结束","Entry Time":"进房时间","Duration of participation":"参会时长","No cancellation":"暂不取消","Cancellation of scheduled rooms":"取消已预订的房间","Other members will not be able to join after cancellation":"取消后其他成员将无法加入","Inviting members to join":"邀请成员加入","Invitation by room ID":"通过房间号邀请","Invitation via room link":"通过房间链接邀请","Copy the conference number and link":"复制会议号与链接","Schedule successful, invite members to join":"预订成功,邀请成员加入","Name changed successfully":"名称修改成功","schedule year":"年","schedule month":"月","schedule day":"日","The room name cannot exceed 100 characters":"房间名称不能超过100个字节","The room name cannot be empty":"房间名不能为空","The meeting is in progress and any meeting information cannot be modified":"进行中的会议,不能修改任何会议信息","Schedule room loading":"预定房间加载中...","The user name cannot exceed 32 characters":"用户名称不能超过32个字节","sb invites you to join the conference":({named:t})=>`${t("name")} 邀请您加入会议`,microphone:"麦克风",camera:"摄像头","Unable to use the device":({named:t})=>`无法使用${t("deviceType")}`,"media device failed to open, please check the media device and try again":({named:t})=>`打开${t("deviceType")}失败, 请检查${t("deviceType")}设备并重试`,"Please check the current browser camera permission":"请检查当前浏览器的摄像头权限","The current device is not authorized, please allow access to the device permissions":({named:t})=>`${t("deviceType")}设备未授权, 请允许访问${t("deviceType")}权限`,"The current device is occupied by other apps, try to close other apps or change the device":({named:t})=>`当前${t("deviceType")}被其他应用程序占用,请尝试关闭其他应用程序或更换${t("deviceType")}`,"Turn on device privileges":({named:t})=>`打开${t("deviceType")}权限`,'You can go to "System Preferences - Security & Privacy - Device" to enable device permissions':({named:t})=>`你可前往"系统设置 - 隐私与安全性 - ${t("deviceType")}"开启设备权限。`,"Go to Settings":"前往设置",addMember:"添加成员",shareRoom:"分享房间","Invitation sent, waiting for members to join.":"邀请信息已发出,等待成员加入","Not joining for now":"暂不入会","Not Entered":"未进入",Entered:"已进房",Call:"呼叫","Calling...":"呼叫中...","Call all":"呼叫所有人","Busy line":"忙线中","Entering the room now...":"正在进入房间...","The room is encrypted":"房间已加密","Please enter the password":"请输入入会密码","Your room password format is incorrect, please check it":"房间密码格式不正确,请检查",Security:"安全设置","Room Password":"进房密码","Enter 6-digit password":"请输入6位进房密码","Wrong password":"密码错误",Encryption:"房间加密","Open whiteboard":"开启白板","Close whiteboard":"关闭白板","Start annotating":"开始批注","End annotating":"结束批注","You are sharing the whiteboard, please stop sharing first":"您正在共享白板,请先停止共享","Line Size":"线条粗细","Line Color":"线条颜色","Arrow Size":"箭头大小","Arrow Color":"箭头颜色","Text Size":"文字大小","Text Color":"文字颜色","Shape Type":"图形类型","Shape Style":"形状样式","Shape Color":"图形颜色","Shape Size":"图形大小",Beauty:"美颜","Beauty Effects":"美颜特效",Smoother:"磨皮",Whitening:"美白",Ruddy:"红润",Compare:"对比",Reset:"重置",Degree:"程度","Sure you want to reset the beauty effect?":"确定要重置美颜效果吗?","All beauty parameters will revert to default after reset":"重置后所有美颜参数将恢复至默认","Theme Colours":"主题色","Custom Themes":"自定义主题"},sy={"The room does not exist, please confirm the room number or create a room!":"The room does not exist, please confirm the room number or create a room!","Log out":"Log out","Edit profile":"Edit profile","User Name":"User Name","Please input user name":"Please input user name","Username length should be greater than 0":"Username length should be greater than 0",Save:"Save",Camera:"Camera",Mic:"Mic","Off Camera":"Off Camera","Mic settings":"Mic settings",Output:"Output",Speaker:"Speaker",Test:"Test",Stop:"Stop",Preview:"Preview",Mirror:"Mirror",Resolution:"Resolution","More Camera Settings":"More Camera Settings","Join the room ?":"Join the room ?","You are invited to room ":"You are invited to room ",Room:"Room",Join:"Join",Sure:"Sure","Switch Theme":"Theme",Layout:"Layout","New Room":"New Room","Room Type":"Room Type","Your Name":"Your Name","Grid view":"Grid view","Speaker view":"Speaker view","Turn on the microphone":"Turn on the microphone","Turn on the speaker":"Turn on the speaker","Turn on the video":"Turn on the video","Free Speech Room":"Free Speech Room","On-stage Speaking Room":"On-stage Speaking Room","Join Room":"Join Room","Enter room ID":"Enter room ID","video conferencing":" 's video conferencing","Quick Conference":" 's Quick Conference","Room ID":"Room ID","Low Definition":"Low Definition","Standard Definition":"Standard Definition","High Definition":"High Definition","Super Definition":"Super Definition","End sharing":"End sharing","Stop sharing?":"Stop sharing?","Stop sharing":"Stop sharing","You are sharing the screen...":"You are sharing the screen...",Sharing:"Sharing","Safety Reminder":"Safety Reminder","Share screen":"Share screen","Grant permission to screen recording":"Grant permission to screen recording","Open the system preferences settings":"Open the system preferences settings",'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".':'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".',"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?":"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?","Others will no longer see your screen after you stop sharing.":"Others will no longer see your screen after you stop sharing.","You currently do not have sharing permission, please raise your hand to apply for sharing permission first":"You currently do not have sharing permission, please raise your hand to apply for sharing permission first","You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first":"You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first",Host:"Host",Admin:"Admin",RoomOwner:"RoomOwner",Me:"Me",me:"me",More:"More","AI Assistant":"AI Assistant","AI real-time conference content":"AI real-time conference content","Turn on AI real-time subtitles":"Turn on AI real-time subtitles","Turn off AI real-time subtitles":"Turn off AI real-time subtitles","Enable AI real-time meeting recording":"Enable AI real-time meeting recording","Raise hand":"Raise hand",Agree:"Agree",Chat:"Chat",Cancel:"Cancel",Exit:"Exit full screen","Full screen":"Full screen",Members:"Members","Search Member":"Search Member","Make host":"Make host","Set as administrator":"Set as administrator","Remove administrator":"Remove administrator","The administrator status of sb has been withdrawn":({named:t})=>`The administrator status of ${t("name")} has been withdrawn`,"sb has been set as administrator":({named:t})=>`${t("name")} has been set as administrator`,"You have been invited by the administrator to step down, please raise your hand if you need to speak":"You have been invited by the administrator to step down, please raise your hand if you need to speak",Invite:"Invite",Settings:"Settings",VirtualBackground:"VirtualBackground",Close:"Close",BlurredBackground:"Blur",EndPC:"End",EndH5:"End",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.':'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.','You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.':'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.',"If you do not want to end the meeting, please designate a new host before leaving the meeting.":"If you do not want to end the meeting, please designate a new host before leaving the meeting.","Are you sure you want to leave this room?":"Are you sure you want to leave this room?","New host":"New host","Transfer and leave":"Transfer and leave","Leave room?":"Leave room?","Select a new host":"Select a new host","Appoint a new host":"Appoint a new host","The host closed the room.":"The host closed the room.",Note:"Note",Confirm:"Confirm",Leave:"Leave",Dismiss:"Dismiss","The administrator has been changed to ":"The administrator has been changed to ","Muted by the moderator":"Muted by the moderator","Type a message":"Type a message",Send:"Send","Failed to send the message":"Failed to send the message","Applying for the stage":"Applying for the stage","Apply for the stage":"Apply for the stage","Cancel Apply":"Cancel Apply","Are you sure you want to step down":"Are you sure you want to step down",Check:"Check",Neglect:"Neglect","Disable all audios":"Disable all audios","Enable all audios":"Enable all audios","Disable all videos":"Disable all videos","Enable all videos":"Enable all videos","Member List":"Member List","All mute":"All mute","All stop video":"All stop video","Lift all mute":"Lift all mute","Lift stop all video":"Lift stop all video",Unmute:"Unmute","Cancel Unmute":"Cancel Unmute",Mute:"Mute",members:"members","Failed to get chat message":"Failed to get chat message","Agree to the stage":"Agree to the stage","Take the stage now":"Take the stage now","Stay off the stage":"Stay off the stage","Cancel stage":"Cancel stage","Invite stage":"Invite stage","Refuse stage":"Refuse stage","Members applying on stage":"Members applying on stage","Step down":"Step down","Step down(Master)":"Step down","Enable video":"Enable video","Disable video":"Disable video","Enable chat":"Enable chat","Disable chat":"Disable chat","Kick out":"Kick out","is sharing their screen":"is sharing their screen","Apply to stage":"Apply to stage","Apply to stage application":"Apply to stage application","Member Onstage Application":"Member Onstage Application",Reject:"Reject","Reject All":"Reject All","Agree All":"Agree All","Please raise your hand to apply":"Please raise your hand to apply","You can turn on the microphone and camera once you are on stage":"You can turn on the microphone and camera once you are on stage","Sb invites you to speak on stage":({named:t})=>`${t("role")} invites you to speak on stage`,"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?":"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?","Hand down":"Hand down","sb has rejected your application for the stage":({named:t})=>`${t("role")} has rejected your application for the stage`,"You have been invited by the host to step down, please raise your hand if you need to speak":"You have been invited by the host to step down, please raise your hand if you need to speak","If you have any questions, please email us.":"If you have any questions, please email us.","Join our product discussion group":"Join our product discussion group","Our email address":"Our email address","Join now":"Join now","Select a screen/window":"Select a screen/window",Screen:"Screen",Window:"Window",Share:"Share","Continue sharing":"Continue sharing","Select a screen or window first":"Select a screen or window first",Grid:"Grid",Tips:"Tips","Gallery on right":"Gallery on right","Gallery at top":"Gallery at top","Network ":"Network ",Latency:"Latency",Stability:"Stability",Fluctuation:"Fluctuation",Lag:"Lag",Disconnected:"Disconnected","Packet loss":"Packet loss","Share the room ID or invite link":"Share the room ID or invite link","Invite by room number":"Invite by room number","Invite via room link":"Invite via room link","Room Link":"Room Link","You can share the room number or link to invite more people to join the room.":"You can share the room number or link to invite more people to join the room.","You can share the room number to invite more people to join the room":"You can share the room number to invite more people to join the room","If you have any questions, please feel free to join our QQ group or send an email":"If you have any questions, please feel free to join our QQ group or send an email","Room QR code":"Room QR code",Participants:"Participants","Search for conference attendees":"Search for conference attendees","Invite via client scheme":"Invite via client scheme","All current and new members will be muted":"All current and new members will be muted","All and new members will be banned from the camera":"All and new members will be banned from the camera","No relevant user found.":"No relevant user found.","Contact us":"Contact us","Member management":"Member management","Join our QQ group chat or email us.":"Join our QQ group chat or email us.","group chat":"group chat",Email:"Email","Audio settings":"Audio settings","Camera settings":"Camera settings",Copy:"Copy","Copied successfully":"Copied successfully","Copied failure":"Copied failure","This model does not support copying at this time":"This model does not support copying at this time","accepted the invitation to the stage":"accepted the invitation to the stage","declined the invitation to the stage":"declined the invitation to the stage","All audios disabled":"All audios disabled","All audios enabled":"All audios enabled","Your microphone has been turned off":"Your microphone has been turned off","Sb invites you to turn on the microphone":({named:t})=>`${t("role")} invites you to turn on the microphone`,"All videos disabled":"All videos disabled","All videos enabled":"All videos enabled","Your camera has been turned off":"Your camera has been turned off","Sb invites you to turn on the camera":({named:t})=>`${t("role")} invites you to turn on the camera`,"The host has turned off your screen sharing":"The host has turned off your screen sharing","Turn on the camera":"Turn on the camera","Keep it closed":"Keep it closed","You have been banned from text chat":"You have been banned from text chat","You are allowed to text chat":"You are allowed to text chat","kicked out of the room by the host":"kicked out of the room by the host","kicked out of the room":"kicked out of the room","kicked out of the room by serve":"kicked out of the room by serve","Reject sb on stage failed, please retry":({named:t})=>`Reject ${t("name")} on Stage failed, please retry`,"Agree sb on stage failed, please retry":({named:t})=>`Agree ${t("name")} on Stage failed, please retry`,"Has been fully muted and cannot open the microphone":"Has been fully muted and cannot open the microphone","Has been muted by the host and cannot open the microphone":"Has been muted by the host and cannot open the microphone","To apply to speak in the room, please raise your hand first to apply for the microphone":"To apply to speak in the room, please raise your hand first to apply for the microphone","Has been full static painting, can not open the video":"Has been full static painting, can not open the video","It has been stilled by the host and cannot open the video":"It has been stilled by the host and cannot open the video","Failed to enter the room.":"Failed to enter the room.","Has been full static painting, can not share your screen":"Has been full static painting, can not share your screen.","Microphone not detected on current device":"Microphone not detected on current device","Camera not detected on current device":"Camera not detected on current device","Camera And Microphone not detected on current device":"Camera And Microphone not detected on current device","Another user is sharing the screen.":"Another user is sharing the screen.","Screen sharing is currently active, cannot start the whiteboard.":"Screen sharing is currently active, cannot start the whiteboard.","This action causes the room to be disbanded, does it continue?":"This action causes the room to be disbanded, does it continue?","This action causes the room to be exited, does it continue?":"This action causes the room to be exited, does it continue?","Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.":"Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.","Please enter the room number":"Please enter the room number","whether to kick sb off the room":({named:t})=>`whether to kick ${t("name")} off the room`,"The current browser does not support capturing audio and video":"The current browser does not support capturing audio and video","The current browser does not support getting microphone and camera list":"The current browser does not support getting audio/video device list","The current browser does not support screen sharing":"The current browser does not support screen sharing","The current browser does not support capturing audio":"The current browser does not support capture audio","The current browser does not support capturing video":"The current browser does not support capture video","The current browser does not support audio and video communication capabilities":"The current browser does not support audio and video communication capabilities","An invitation to open the microphone has been sent to sb.":({named:t})=>`An invitation to open the microphone has been sent to ${t("name")}`,"An invitation to open the camera has been sent to sb.":({named:t})=>`An invitation to open the camera has been sent to ${t("name")}`,"Make host failed, please try again.":"Make host failed, please try again.","Sb has been set as an administrator":({named:t})=>`${t("name")} has been set as an administrator.`,"Succeed on stage":"Succeed on stage","After unlocking, users can freely turn on the microphone":"After unlocking, users can freely turn on the microphone","Members will not be able to open the microphone":"Members will not be able to open the microphone","After unlocking, users can freely turn on the camera":"After unlocking, users can freely turn on the camera","Members will not be able to open the camera":"Members will not be able to open the camera","You have become a administrator":"You have become a administrator","You are now a room owner":"You are now a room owner","Your administrator status has been revoked":"Your administrator status has been revoked","After transfer the room owner, you will become a general user":"After transfer the room owner, you will become a general user","Transfer the roomOwner to sb":({named:t})=>`Transfer the roomOwner to ${t("name")}`,"Confirm transfer":"Confirm transfer","The room owner has been transferred to sb":({named:t})=>`The room owner has been transferred to ${t("name")}`,"Application to go on stage was rejected":"Application to go on stage was rejected","You are now an administrator":"You are now an administrator","The RoomOwner has withdrawn your administrator privileges":"The RoomOwner has withdrawn your administrator privileges","This member has already received the same request, please try again later":"This member has already received the same request, please try again later","The request to go on stage has timed out":"The request to go on stage has timed out","The invitation to sb to go on stage has timed out":({named:t})=>`The invitation to ${t("name")} to go on stage has timed out`,"Currently no member has applied to go on stage":"Currently no member has applied to go on stage",Operate:"Operate","Stage management":"Stage management","On stage":"On stage","Not on stage":"Not on stage","To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve":"To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve","To go on stage again, a new application needs to be initiated":"To go on stage again, a new application needs to be initiated","The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it":"The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it","Cancellation request has been sent, please wait for the roomOwner/administrator to approve it":"Cancellation request has been sent, please wait for the roomOwner/administrator to approve it","Canceled application to go on stage":"Canceled application to go on stage","and so on":"and so on","people applying to stage":"people applying to stage","and so on number people applying to stage":({named:t})=>`and so on ${t("number")} people applying to stage`,"The stage is full, please contact the host":"The stage is full, please contact the host","The stage is full":"The stage is full","change name":"change name","quick conference":"quick conference",Meeting:"Meeting","Meeting in progress":"Meeting in progress",Initiating:"Initiating","X people have joined":({named:t})=>`${t("number")} people have joined`,"Waiting for members to join the meeting":"Waiting for members to join the meeting","X people are in the meeting":({named:t})=>`${t("number")} people are in the meeting`,"Already joined":"Already joined","Enter the meeting":"Enter the meeting","Ending meeting":"Ending meeting","The meeting has ended":"The meeting has ended","Currently in a meeting, please exit the current meeting before proceeding.":"Currently in a meeting, please exit the current meeting before proceeding.","Failed to initiate meeting":"Failed to initiate meeting","Failed to enter the meeting":"Failed to enter the meeting","Failed to disable chat":"Failed to disable chat","All members can share screen":"All members can share screen","Screen sharing for host/admin only":"Screen sharing for host/admin only","Failed to initiate screen sharing, currently only host/admin can share screen.":"Failed to initiate screen sharing, currently only host/admin can share screen.","Is it turned on that only the host/admin can share the screen?":"Is it turned on that only the host/admin can share the screen?","Other member is sharing the screen is now, the member's sharing will be terminated after you turning on":"Other member is sharing the screen now, the member's sharing will be terminated after you turning on","Your screen sharing has been stopped":"Your screen sharing has been stopped","Your screen sharing has been stopped, Now only the host/admin can share the screen":"Your screen sharing has been stopped, Now only the host/admin can share the screen","The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.":"The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.","User canceled screen sharing":"User canceled screen sharing","An unknown error occurred while screen sharing, please try again.":"An unknown error occurred while screen sharing, please try again.","I got it":"I got it",Attention:"Attention",'Audio playback failed. Click the "Confirm" to resume playback':'Audio playback failed. Click the "Confirm" to resume playback.',"x people selected":({named:t})=>`${t("number")} people selected`,"view details":"view details","modify room":"modify room","cancel room":"cancel room",Modify:"Modify","No room available for booking":"No room available for booking",Ongoing:"Ongoing",finished:"finished","History room":"History room","sb temporary room":({named:t})=>`${t("name")}'s temporary room`,year:"year",month:"month",day:"day",Schedule:"Schedule","Modify Room":"Modify Room","Room Name":"Room Name","please enter the room name":"please enter the room name","Room type":"Room type","Starting time":"Starting time","Room duration":"Room duration","Time zone":"Time zone",Attendees:"Attendees","Please enter the member name":"Please enter the member name",people:"people","Scheduled meetings":"scheduled meetings",minute:"minute",hour:"hour",minutes:"minutes",hours:"hours","The start time cannot be earlier than the current time":"The start time cannot be earlier than the current time","Room Time":"Room Time",Creator:"Creator","Room Details":"Room Details","Enter Now":"Enter Now","Invited members":"Invited members","The room is closed":"The room is closed","Entry Time":"Entry Time","Duration of participation":"Duration of participation","No cancellation":"No cancellation","Other members will not be able to join after cancellation":"Other members will not be able to join after cancellation","Inviting members to join":"Inviting members to join","Invitation by room ID":"Invitation by room ID","Invitation via room link":"Invitation via room link","Copy the conference number and link":"Copy the conference number and link","Schedule successful, invite members to join":"Schedule successful, invite members to join","Name changed successfully":"Name changed successfully","schedule year":"/","schedule month":"/","schedule day":" ","The room name cannot exceed 100 characters":"The room name cannot exceed 100 characters","The room name cannot be empty":"The room name cannot be empty","The meeting is in progress and any meeting information cannot be modified":"The meeting is in progress and any meeting information cannot be modified","Schedule room loading":"Schedule room loading...","The user name cannot exceed 32 characters":"The user name cannot exceed 32 characters","sb invites you to join the conference":({named:t})=>`${t("name")} invites you to join the conference`,microphone:"microphone",camera:"camera","Unable to use the device":({named:t})=>`Unable to use the ${t("deviceType")}`,"media device failed to open, please check the media device and try again":({named:t})=>`${t("deviceType")} failed to open, please check the ${t("deviceType")} and try again`,"Please check the current browser camera permission":"Please check the current browser camera permission","The current device is not authorized, please allow access to the device permissions":({named:t})=>`The ${t("deviceType")} is not authorized, please allow access to the ${t("deviceType")} permissions`,"The current device is occupied by other apps, try to close other apps or change the device":({named:t})=>`The ${t("deviceType")} is occupied by other apps, try to close other apps or change the device`,"Turn on device privileges":({named:t})=>`Turn on ${t("deviceType")} privileges`,'You can go to "System Preferences - Security & Privacy - Device" to enable device permissions':({named:t})=>`You can go to "System Preferences - Security & Privacy - ${t("deviceType")}" to enable device permissions.`,"Go to Settings":"Go to Settings",addMember:"addMember",shareRoom:"shareRoom","Invitation sent, waiting for members to join.":"Invitation sent, waiting for members to join.","Not joining for now":"Not joining for now","Not Entered":"Not Entered",Entered:"Entered",Call:"Call","Calling...":"Calling...","Call all":"Call all","Busy line":"Busy line","Entering the room now...":"Entering the room now...","The room is encrypted":"The room is encrypted","Please enter the password":"Please enter the password","Your room password format is incorrect, please check it":"Your room password format is incorrect, please check it",Security:"Security","Room Password":"Room Password","Enter 6-digit password":"Enter 6-digit password","Wrong password":"Wrong password",Encryption:"Encryption","Open whiteboard":"Open whiteboard","Close whiteboard":"Close whiteboard","Start annotating":"Start annotating","End annotating":"End annotating","You are sharing the whiteboard, please stop sharing first":"You are sharing the whiteboard, please stop sharing first","Line Size":"Line Size","Line Color":"Line Color","Arrow Size":"Arrow Size","Arrow Color":"Arrow Color","Text Size":"Text Size","Text Color":"Text Color","Shape Type":"Shape Type","Shape Style":"Shape Style","Shape Color":"Shape Color","Shape Size":"Shape Size",Beauty:"Beauty","Beauty Effects":"Beauty Effects",Smoother:"Smoother",Whitening:"Whitening",Ruddy:"ruddy",Compare:"Compare",Reset:"Reset",Degree:"Degree","Sure you want to reset the beauty effect?":"Sure you want to reset the beauty effect?","All beauty parameters will revert to default after reset":"All beauty parameters will revert to default after reset","Theme Colours":"Theme Colours","Custom Themes":"Custom Themes"};var ay=Object.defineProperty,ly=(t,e,n)=>e in t?ay(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$c=(t,e,n)=>ly(t,typeof e!="symbol"?e+"":e,n);const La=x("");let uy=class{constructor(e){$c(this,"messages"),$c(this,"global"),this.messages=e.messages,La.value=e.locale,this.global={},this.global.locale=La,this.global.t=this.t.bind(this)}getNamed(e){return n=>e[n]||n}t(e,n){const o=this.messages[La.value];if(!o[e])return e;if(typeof o[e]=="function"){const r=this.getNamed(n||{});return o[e]({named:r})}return o[e]}install(){}};const Cc=new uy({locale:"zh-CN",messages:{"zh-CN":iy,"en-US":sy}});function cy(){return{t:Cc.global.t.bind(Cc)}}const gf=x(null),ps=x(null),fs=x(null);function vf(){const t=navigator.userAgent,e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t);return{userAgent:t,platformCode:e?2:1}}function yf(){let t=sessionStorage.getItem("uikit_session_id");return t||(t=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,sessionStorage.setItem("uikit_session_id",t)),t}function bf(t){var e,n;try{(((n=(e=Vv)==null?void 0:e.Module)==null?void 0:n.logger)||console).info("[UIKitModal]",t)}catch{console.info("[UIKitModal]",t)}}function dy(t){const e=Date.now(),{userAgent:n,platformCode:o}=vf();gf.value=t,ps.value=t.id,fs.value=e,bf({eventType:1,modalId:t.id,timestamp:e,sessionId:yf(),platformCode:o,userAgent:n})}function py(t="confirm"){if(ps.value===null||!fs.value)return;const e=Date.now(),n=e-fs.value,{userAgent:o,platformCode:r}=vf(),i={confirm:1,cancel:2,timeout:3,mask:2};bf({eventType:2,modalId:ps.value,timestamp:e,stayDuration:n,closeReasonCode:i[t],sessionId:yf(),platformCode:r,userAgent:o}),gf.value=null,ps.value=null,fs.value=null}function fy(){return{openModal:dy,closeModal:py}}const hy={class:"uikit-modal-default uikit-modal-container"},my={class:"uikit-modal-header"},gy={class:"uikit-modal-title"},vy=["innerHTML"],yy={class:"uikit-modal-footer"},by=G({__name:"index",props:{visible:{type:Boolean,default:!1},id:{},title:{default:""},content:{default:""},type:{default:"info"},onConfirm:{},onCancel:{}},emits:["confirm","cancel"],setup(t,{emit:e}){const n=bi()==="pc",{t:o}=cy(),r=t,i=e,s=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i,a=/(https?:\/\/[^\s]+)/g,l=P(()=>{const{content:f}=r;if(!f||typeof f!="string")return f;if(s.test(f.trim())){const h=f.trim(),m=h.startsWith("http")?h:`https://${h}`;return`<a href="${u(m)}" target="_blank" rel="noopener noreferrer" class="uikit-modal-link">${u(h)}</a>`}return f.includes("<a ")||f.includes("<a>")?c(f):a.test(f)?u(f).replace(a,h=>`<a href="${h}" target="_blank" rel="noopener noreferrer" class="uikit-modal-link">${h}</a>`):u(f)});function u(f){const h=document.createElement("div");return h.textContent=f,h.innerHTML}function c(f){const h=new DOMParser().parseFromString(f,"text/html");return h.querySelectorAll("a").forEach(m=>{if(m.getAttribute("href")){m.setAttribute("target","_blank"),m.setAttribute("rel","noopener noreferrer"),m.classList.add("uikit-modal-link");const v=m.textContent||"";m.innerHTML=`<span style="padding: 0 0.2em; display: inline-block; color: var(--text-color-link)">${v}</span>`}}),h.body.innerHTML}function d(){var f;(f=r.onConfirm)==null||f.call(r),i("confirm")}function p(){var f;(f=r.onCancel)==null||f.call(r),i("cancel")}return(f,h)=>(w(),L(fu,{to:"body"},[q(dv,{name:"fade"},{default:A(()=>[t.visible?(w(),z("div",{key:0,class:"uikit-modal-mask",onClick:oo(d,["self"])},[V("div",hy,[V("div",my,[t.type==="success"?(w(),L(g(pv),{key:0,class:"uikit-modal-type-icon"})):ne("",!0),t.type==="info"?(w(),L(g(fv),{key:1,class:"uikit-modal-type-icon"})):ne("",!0),t.type==="error"?(w(),L(g(Zp),{key:2,class:"uikit-modal-type-icon"})):ne("",!0),t.type==="warning"?(w(),L(g(hv),{key:3,class:"uikit-modal-type-icon"})):ne("",!0),V("span",gy,Z(t.title),1),n?(w(),L(g(ar),{key:4,class:"uikit-modal-close-icon",onClick:p})):ne("",!0)]),V("div",{class:"uikit-modal-body",innerHTML:l.value},null,8,vy),V("div",yy,[q(g(Es),{type:"default",style:{"min-width":"88px"},onClick:p},{default:A(()=>[me(Z(g(o)("Cancel")),1)]),_:1}),q(g(Es),{type:"primary",style:{"min-width":"88px"},onClick:d},{default:A(()=>[me(Z(g(o)("Confirm")),1)]),_:1})])])])):ne("",!0)]),_:1})]))}});let Ur=null;const{openModal:_y,closeModal:wy}=fy(),Ey=()=>{const t=window.location.hostname,e=window.location.href;return!!(t==="localhost"||t==="127.0.0.1"||t.startsWith("192.168.")||e.startsWith("https://web.sdk.qcloud.com/trtc/livekit"))},Ac=()=>{Ur&&(Ur.unmount(),Ur=null)},ky=t=>new Promise(e=>{if(Ac(),_y({id:t.id,title:t.title,content:t.content,type:t.type,onConfirm:t.onConfirm,onCancel:t.onCancel}),!Ey()){e({action:"confirm"});return}const n=r=>{wy(r),Ac(),e({action:r})},o={...t,visible:!0,onConfirm:()=>{var r;(r=t.onConfirm)==null||r.call(t),n("confirm")},onCancel:()=>{var r;(r=t.onCancel)==null||r.call(t),n("cancel")}};Ur=cv(by,o),Ur.mount(document.createElement("div"))}),Sy={openModal:t=>ky(t)};var Fr=(t=>(t[t.LOGIN_INVALID_SDK_APP_ID=3e4]="LOGIN_INVALID_SDK_APP_ID",t[t.LOGIN_INVALID_USER_ID=30001]="LOGIN_INVALID_USER_ID",t[t.LOGIN_INVALID_SECRET_KEY=30004]="LOGIN_INVALID_SECRET_KEY",t[t.LOGIN_INVALID_USER_SIG=30005]="LOGIN_INVALID_USER_SIG",t[t.LOGIN_USER_SIG_EXPIRED=30006]="LOGIN_USER_SIG_EXPIRED",t[t.LOGIN_USER_SIG_INVALID=30042]="LOGIN_USER_SIG_INVALID",t[t.LOGIN_USER_ID_NOT_MATCH_USER_SIG=30007]="LOGIN_USER_ID_NOT_MATCH_USER_SIG",t[t.LOGIN_SDK_APP_ID_NOT_MATCH_USER_SIG=30008]="LOGIN_SDK_APP_ID_NOT_MATCH_USER_SIG",t[t.LOGIN_SDK_APP_ID_NOT_FOUND=30041]="LOGIN_SDK_APP_ID_NOT_FOUND",t[t.PACKAGE_NOT_PURCHASED=30002]="PACKAGE_NOT_PURCHASED",t[t.PACKAGE_GROUP_READ_RECEIPT_NOT_ENABLED=30014]="PACKAGE_GROUP_READ_RECEIPT_NOT_ENABLED",t[t.PACKAGE_ONLINE_USER_LIST_NOT_ENABLED=30015]="PACKAGE_ONLINE_USER_LIST_NOT_ENABLED",t[t.PACKAGE_CLOUD_SEARCH_NOT_ENABLED=30016]="PACKAGE_CLOUD_SEARCH_NOT_ENABLED",t[t.PACKAGE_TEXT_TRANSLATION_NOT_ENABLED=30018]="PACKAGE_TEXT_TRANSLATION_NOT_ENABLED",t[t.PACKAGE_SPEECH_TO_TEXT_NOT_ENABLED=30019]="PACKAGE_SPEECH_TO_TEXT_NOT_ENABLED",t[t.CALL_KIT_NOT_INTEGRATED=30010]="CALL_KIT_NOT_INTEGRATED",t[t.SEARCH_CLOUD_RATE_LIMIT=30017]="SEARCH_CLOUD_RATE_LIMIT",t[t.MESSAGE_VOICE_SIZE_EXCEEDED=30020]="MESSAGE_VOICE_SIZE_EXCEEDED",t[t.MESSAGE_IMAGE_INVALID_FORMAT=30021]="MESSAGE_IMAGE_INVALID_FORMAT",t[t.MESSAGE_IMAGE_SIZE_EXCEEDED=30022]="MESSAGE_IMAGE_SIZE_EXCEEDED",t[t.MESSAGE_IMAGE_SENSITIVE_CONTENT=30023]="MESSAGE_IMAGE_SENSITIVE_CONTENT",t[t.MESSAGE_VIDEO_INVALID_FORMAT=30024]="MESSAGE_VIDEO_INVALID_FORMAT",t[t.MESSAGE_VIDEO_SIZE_EXCEEDED=30025]="MESSAGE_VIDEO_SIZE_EXCEEDED",t[t.MESSAGE_FILE_NOT_EXIST=30026]="MESSAGE_FILE_NOT_EXIST",t[t.MESSAGE_FILE_SIZE_EXCEEDED=30027]="MESSAGE_FILE_SIZE_EXCEEDED",t[t.MESSAGE_FILE_SENDING_BANNED=30028]="MESSAGE_FILE_SENDING_BANNED",t[t.MESSAGE_TEXT_SENSITIVE_CONTENT=30029]="MESSAGE_TEXT_SENSITIVE_CONTENT",t[t.MESSAGE_LENGTH_EXCEEDED=30030]="MESSAGE_LENGTH_EXCEEDED",t[t.MESSAGE_LOCAL_AUDIT_BLOCKED=30031]="MESSAGE_LOCAL_AUDIT_BLOCKED",t[t.MESSAGE_RECALL_TIME_EXCEEDED=30039]="MESSAGE_RECALL_TIME_EXCEEDED",t[t.REACTION_EMOJI_LIMIT_REACHED=30033]="REACTION_EMOJI_LIMIT_REACHED",t[t.PROFILE_REMARK_LENGTH_EXCEEDED=30034]="PROFILE_REMARK_LENGTH_EXCEEDED",t[t.GROUP_ANNOUNCEMENT_LENGTH_EXCEEDED=30035]="GROUP_ANNOUNCEMENT_LENGTH_EXCEEDED",t[t.GROUP_NAME_INVALID=30036]="GROUP_NAME_INVALID",t[t.GROUP_ID_ALREADY_USED=30040]="GROUP_ID_ALREADY_USED",t))(Fr||{});const My={3e4:{i18nKey:"login_invalid_sdk_app_id"},30001:{i18nKey:"login_invalid_user_id"},30004:{i18nKey:"login_invalid_secret_key"},30005:{i18nKey:"login_invalid_user_sig"},30006:{i18nKey:"login_user_sig_expired"},30042:{i18nKey:"login_user_sig_invalid"},30007:{i18nKey:"login_user_id_not_match_user_sig"},30008:{i18nKey:"login_sdk_app_id_not_match_user_sig"},30041:{i18nKey:"login_sdk_app_id_not_found"},30002:{i18nKey:"package_not_purchased"},30014:{i18nKey:"package_group_read_receipt_not_enabled"},30015:{i18nKey:"package_online_user_list_not_enabled"},30016:{i18nKey:"package_cloud_search_not_enabled"},30018:{i18nKey:"package_text_translation_not_enabled"},30019:{i18nKey:"package_speech_to_text_not_enabled"},30010:{i18nKey:"call_kit_not_integrated"},30017:{i18nKey:"search_cloud_rate_limit"},30020:{i18nKey:"message_voice_size_exceeded"},30021:{i18nKey:"message_image_invalid_format"},30022:{i18nKey:"message_image_size_exceeded"},30023:{i18nKey:"message_image_sensitive_content"},30024:{i18nKey:"message_video_invalid_format"},30025:{i18nKey:"message_video_size_exceeded"},30026:{i18nKey:"message_file_not_exist"},30027:{i18nKey:"message_file_size_exceeded"},30028:{i18nKey:"message_file_sending_banned"},30029:{i18nKey:"message_text_sensitive_content"},30030:{i18nKey:"message_length_exceeded"},30031:{i18nKey:"message_local_audit_blocked"},30039:{i18nKey:"message_recall_time_exceeded"},30033:{i18nKey:"reaction_emoji_limit_reached"},30034:{i18nKey:"profile_remark_length_exceeded"},30035:{i18nKey:"group_announcement_length_exceeded"},30036:{i18nKey:"group_name_invalid"},30040:{i18nKey:"group_id_already_used"}},Ty={2e3:3e4,2002:30001,2003:30005,70001:30006,70003:30042,70013:30007,70014:30008,70020:30041,60018:30017,2301:30020,2252:30021,2253:30022,2352:30024,2351:30025,2401:30026,2402:30027,3123:30031,20016:30039,10031:30039,10021:30040};function jr(t){const e=My[t];e&&Sy.openModal({id:t,title:qe.t("ChatErrorModal.title"),content:qe.t(`ChatErrorModal.${e.i18nKey}`),type:"error"})}function ia(t){const e=t.code;if(e==null)return!1;const n=Ty[e];return n!==void 0?(jr(n),!0):!1}const yu=x(void 0);function Iy(t){yu.value=t}function xy(){return yu.value}function _f(){return{chatScene:yu,setChatScene:Iy,getChatScene:xy}}const ks=x(null),{getChatScene:Oy}=_f();async function $y(t){const{userId:e,userSig:n,sdkAppId:o,...r}=t,i={SDKAppID:o,userID:e,userSig:n,useUploadPlugin:!0,scene:Oy(),...r};try{await ra.login(i)}catch(s){throw ia(s)||(e?n?o||jr(Fr.LOGIN_INVALID_SDK_APP_ID):jr(Fr.LOGIN_INVALID_USER_SIG):jr(Fr.LOGIN_INVALID_USER_ID)),s}}async function Cy(t){const e=ks.value||{},{chat:n}=ra.getContext();if(n){const o=[];t.customInfo&&Object.keys(t.customInfo).forEach(r=>{var i;let s=r;r.includes("Tag_Profile_Custom")||(s=`Tag_Profile_Custom_${r}`),o.push({key:s,value:(i=t.customInfo)==null?void 0:i[r]})});try{const r=await n.updateMyProfile({nick:t.userName,avatar:t.avatarUrl,profileCustomField:o});return ks.value={...e,...t},r}catch(r){throw console.error("[loginState setSelfInfo] error",r),r}}else throw Error("[loginState setSelfInfo] not login")}async function Ay(){ks.value=null,ra.logout()}function Ry(){return{loginUserInfo:ks,login:$y,logout:Ay,setSelfInfo:Cy}}var wl=(t=>(t.CHAT_WEB="42",t.CHAT_H5="43",t))(wl||{});const Dy=bi()==="pc";bi();bi();bi();var Py=Object.defineProperty,Ny=(t,e,n)=>e in t?Py(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$o=(t,e,n)=>Ny(t,typeof e!="symbol"?e+"":e,n);const{setChatScene:Ly}=_f(),wf=class Sr{constructor(){$o(this,"isReady",!1),$o(this,"isEngineLoggingIn",!1),$o(this,"isLogin",x(!1)),$o(this,"resolveList",[]),$o(this,"rejectList",[]),this.init()}static getInstance(){return Sr.instance||(Sr.instance=new Sr),Sr.instance}init(){Ly(Dy?wl.CHAT_WEB:wl.CHAT_H5),this.isReady||(this.isReady=!0,_l.registerEvent(xn.TUILogin.EVENT.LOGIN_STATE_CHANGED,xn.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS,this))}onNotifyEvent(e,n){if(e===xn.TUILogin.EVENT.LOGIN_STATE_CHANGED)switch(n){case xn.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS:this.login();break;case xn.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS:this.logout();break}}async login(){const{chat:e,SDKAppID:n,userID:o,userSig:r}=ra.getContext();if(this.isEngineLoggingIn)return new Promise((i,s)=>{this.resolveList.push(i),this.rejectList.push(s)});try{this.isEngineLoggingIn=!0;const i=await ce.login({chat:e,SDKAppID:n,userID:o,userSig:r});this.isLogin.value=!0,this.resolveList.forEach(l=>{l()}),this.rejectList=[],this.resolveList=[];const{loginUserInfo:s}=Ry(),a=(await e.getUserProfile({userIDList:[o]})).data[0];return a.value||(s.value={userId:a.userID,userName:a.nick,avatarUrl:a.avatar,customInfo:a.profileCustomField}),i}catch(i){throw this.rejectList.forEach(s=>{s(i)}),this.rejectList=[],this.resolveList=[],i}finally{this.isEngineLoggingIn=!1}}logout(){this.isLogin.value=!1,this.isEngineLoggingIn=!1}};$o(wf,"instance");let By=wf;function Uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ef={exports:{}};/*!
|
||
Copyright (c) 2018 Jed Watson.
|
||
Licensed under the MIT License (MIT), see
|
||
http://jedwatson.github.io/classnames
|
||
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=r(i,o(a)))}return i}function o(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)e.call(i,a)&&i[a]&&(s=r(s,a));return s}function r(i,s){return s?i?i+" "+s:i+s:i}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(Ef);var Fy=Ef.exports;const pe=Uy(Fy),se=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},jy={class:"avatar-badge"},qy=G({name:"AvatarBadge",__name:"AvatarBadge",props:{size:{default:"md"},onlineStatus:{default:"online"}},setup(t){return(e,n)=>(w(),z("div",jy,[J(e.$slots,"default",{},void 0,!0),V("div",{class:F(["avatar-badge__indicator","avatar-badge__indicator--bottom-right",`avatar-badge__indicator--${t.size}`])},[t.onlineStatus?(w(),z("div",{key:0,class:F(["avatar-badge__online-status",`avatar-badge__online-status--${t.onlineStatus}`,`avatar-badge__online-status--${t.size}`])},null,2)):ne("",!0)],2)]))}}),zy=se(qy,[["__scopeId","data-v-a69536c2"]]),Gy="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_16.png",Hy=G({name:"Avatar",__name:"Avatar",props:{isShowOnlineStatus:{type:Boolean,default:!1},isOnline:{type:Boolean,default:!1},unreadCount:{default:0},maxUnreadCount:{default:99},isDotUnreadCount:{type:Boolean,default:!1},src:{},size:{default:"md"},shape:{default:"circular"},alt:{},className:{},style:{},onClick:{}},setup(t){const e=t,n=of(),o=Jt(),r=x(!1),i=x(!!e.src),s=P(()=>n.default),a=v=>{i.value=v},l=()=>{i.value=!1},u=()=>{r.value=!0,i.value=!1},c=()=>{e.onClick&&e.onClick()},d=()=>e.alt?e.alt.trim().charAt(0):"",p=P(()=>{let v=40;if(typeof e.size=="number"){const y=e.shape==="circular"?"50%":e.shape==="square"?"0%":`${e.size/6}px`;return{width:`${e.size}px`,height:`${e.size}px`,fontSize:`${Math.floor(e.size/2)}px`,borderRadius:y}}if(typeof e.size=="string")switch(e.size){case"xxl":v=96;break;case"xl":v=64;break;case"lg":v=48;break;case"md":v=40;break;case"sm":v=32;break;case"xs":v=24;break;default:v=40;break}return{fontSize:`${Math.floor(v/2)}px`}}),f=P(()=>pe(o.avatar,o[`avatar--shape-${e.shape}`],typeof e.size!="number"&&o[`size-${e.size}`],e.className)),h=P(()=>xe("div",{class:f.value,style:[p.value,e.style,{cursor:e.onClick?"pointer":"default"}],onClick:c,role:e.onClick?"button":void 0,tabindex:e.onClick?0:void 0,"aria-label":e.alt||"avatar"},[s.value?xe("div",{class:o.avatar__fallback},s.value):e.src&&!r.value?xe("img",{class:o.avatar__image,src:e.src,alt:e.alt||"avatar",onLoad:l,onError:u}):e.alt?xe("div",{class:o.avatar__fallback},d()):xe("img",{class:o.avatar__image,src:Gy,alt:"default avatar",onLoad:()=>a(!1),onError:()=>a(!1)}),i.value&&xe("div",{class:o.avatar__skeleton})])),m=P(()=>{let v=h.value;return e.unreadCount!==void 0&&(v=xe(mv,{hidden:e.unreadCount===0,value:typeof e.unreadCount=="number"?e.unreadCount:"",max:e.maxUnreadCount,isDot:e.isDotUnreadCount,type:"danger"},[v])),e.isShowOnlineStatus&&(v=xe(zy,{show:!0,onlineStatus:e.isOnline?"online":"offline",size:typeof e.size=="number"?"md":e.size},[v])),v});return(v,y)=>!t.isShowOnlineStatus&&!t.unreadCount?(w(),L(lt(h.value),{key:0})):(w(),L(lt(m.value),{key:1}))}}),Vy="_avatar_bq44a_1",Wy="_avatar__image_bq44a_61",Ky="_avatar__fallback_bq44a_67",Yy="_avatar__skeleton_bq44a_78",Jy="_shimmer_bq44a_1",Xy={avatar:Vy,"avatar--shape-circular":"_avatar--shape-circular_bq44a_10","avatar--shape-square":"_avatar--shape-square_bq44a_13","size-xs":"_size-xs_bq44a_16","size-sm":"_size-sm_bq44a_20","size-md":"_size-md_bq44a_24","size-lg":"_size-lg_bq44a_28","size-xl":"_size-xl_bq44a_32","size-xxl":"_size-xxl_bq44a_36","avatar--shape-rounded":"_avatar--shape-rounded_bq44a_40",avatar__image:Wy,avatar__fallback:Ky,avatar__skeleton:Yy,shimmer:Jy},Qy={$style:Xy},Ko=se(Hy,[["__cssModules",Qy]]),Zy=["onClick"],eb=G({__name:"ListMode",props:{dataSource:{},selectedKeys:{},lockedKeys:{},onItemClick:{type:Function},onReachEnd:{type:Function},renderItem:{}},setup(t){const e=t,{t:n}=Ee(),o=a=>e.selectedKeys.has(a),r=a=>e.lockedKeys.has(a),i=a=>{r(a)||e.onItemClick(a)},s=a=>{if(!e.onReachEnd)return;const l=a.currentTarget,{scrollTop:u,scrollHeight:c,clientHeight:d}=l;c-u-d<50&&e.onReachEnd()};return(a,l)=>t.dataSource.length===0?(w(),z("div",{key:0,class:F(a.$style.list__empty)},Z(g(n)("UserPicker.no_data_available")),3)):(w(),z("div",{key:1,class:F(a.$style.list__container),onScroll:s},[(w(!0),z(he,null,ze(t.dataSource,u=>(w(),z("div",{key:u.key},[V("div",{class:F([a.$style.list__item,{[a.$style["list__item--selected"]]:o(u.key),[a.$style["list__item--locked"]]:r(u.key)}]),onClick:c=>i(u.key)},[V("div",{class:F(a.$style["list__checkbox-wrapper"])},[V("div",{class:F([a.$style.list__checkbox,{[a.$style["list__checkbox--checked"]]:o(u.key)}])},[o(u.key)?(w(),L(g(ef),{key:0})):ne("",!0)],2)],2),t.renderItem?(w(),L(lt(t.renderItem),{key:0,item:u},null,8,["item"])):(w(),z("div",{key:1,class:F(a.$style.list__content)},[q(g(Ko),{src:u.avatarUrl||"",class:F(a.$style.list__avatar),alt:u.label},null,8,["src","class","alt"]),V("span",{class:F(a.$style.list__label)},Z(u.label),3)],2))],10,Zy)]))),128))],34))}}),tb="_list__container_101wg_1",nb="_list__item_101wg_21",ob="_list__checkbox_101wg_42",rb="_list__content_101wg_59",ib="_list__avatar_101wg_65",sb="_list__label_101wg_68",ab="_list__empty_101wg_84",lb={list__container:tb,list__item:nb,"list__item--selected":"_list__item--selected_101wg_32","list__item--locked":"_list__item--locked_101wg_38","list__checkbox-wrapper":"_list__checkbox-wrapper_101wg_42",list__checkbox:ob,"list__checkbox--checked":"_list__checkbox--checked_101wg_55",list__content:rb,list__avatar:ib,list__label:sb,"list__load-more":"_list__load-more_101wg_76",list__empty:ab,"list__end-marker":"_list__end-marker_101wg_93"},ub={$style:lb},cb=se(eb,[["__cssModules",ub]]),db=["placeholder","value"],pb=G({__name:"SearchBar",props:{placeholder:{},onSearch:{type:Function}},setup(t){const e=t,n=x(""),o=i=>{console.log("handleChange",i);const s=i.target.value;n.value=s,e.onSearch(s)},r=()=>{n.value="",e.onSearch("")};return(i,s)=>(w(),z("div",{class:F(i.$style.search__bar)},[V("div",{class:F(i.$style["search__input-wrapper"])},[q(g(gv),{name:"search",class:F(i.$style.search__icon)},null,8,["class"]),V("input",{type:"text",class:F(i.$style.search__input),placeholder:t.placeholder,value:n.value,onInput:o},null,42,db),n.value?(w(),L(g(ar),{key:0,name:"close",class:F(i.$style["search__clear-icon"]),size:"12px",onClick:r},null,8,["class"])):ne("",!0)],2)],2))}}),fb="_search__bar_ufjq9_1",hb="_search__icon_ufjq9_14",mb="_search__input_ufjq9_4",gb={search__bar:fb,"search__input-wrapper":"_search__input-wrapper_ufjq9_4",search__icon:hb,search__input:mb,"search__clear-icon":"_search__clear-icon_ufjq9_31"},vb={$style:gb},yb=se(pb,[["__cssModules",vb]]),bb=["onClick"],_b=G({__name:"SelectedPanel",props:{displayMode:{},selectedItems:{},lockedKeys:{},onRemove:{},maxCount:{default:Number.POSITIVE_INFINITY}},setup(t){const{t:e}=Ee(),n=t,o=P(()=>n.displayMode==="list"?n.selectedItems:n.displayMode==="tree"?n.selectedItems.filter(i=>i.isLeafNode):[]),r=Number.POSITIVE_INFINITY;return(i,s)=>o.value.length>0?(w(),z("div",{key:0,class:F(i.$style.selected__panel)},[V("div",{class:F(i.$style.selected__header)},[V("span",{class:F(i.$style.selected__title)},Z(g(e)("UserPicker.selected")),3),V("span",{class:F(i.$style.selected__count)},[me(Z(o.value.length)+" ",1),t.maxCount<g(r)?(w(),z(he,{key:0},[me(" / "+Z(t.maxCount),1)],64)):ne("",!0),me(" "+Z(g(e)("UserPicker.people_unit")),1)],2)],2),V("div",{class:F(i.$style.selected__list)},[(w(!0),z(he,null,ze(o.value,a=>(w(),z("div",{key:a.key,class:F(i.$style.selected__item)},[V("div",{class:F(i.$style["selected__item-content"])},[q(g(Ko),{src:a.avatarUrl,class:F(i.$style["selected__item-avatar"]),size:"sm",alt:a.label},null,8,["src","class","alt"]),V("div",{class:F(i.$style["selected__item-label"])},Z(a.label),3)],2),t.lockedKeys.has(a.key)?ne("",!0):(w(),z("button",{key:0,type:"button",class:F(i.$style["selected__remove-button"]),"aria-label":"remove",onClick:l=>t.onRemove(a.key)},[q(g(ar),{name:"close",size:"12px"})],10,bb))],2))),128))],2)],2)):ne("",!0)}}),wb="_selected__panel_1phj6_12",Eb="_selected__header_1phj6_17",kb="_selected__title_1phj6_23",Sb="_selected__count_1phj6_28",Mb="_selected__list_1phj6_32",Tb="_selected__item_1phj6_55",Ib={selected__panel:wb,selected__header:Eb,selected__title:kb,selected__count:Sb,selected__list:Mb,selected__item:Tb,"selected__item-content":"_selected__item-content_1phj6_64","selected__item-avatar":"_selected__item-avatar_1phj6_70","selected__item-label":"_selected__item-label_1phj6_83","selected__remove-button":"_selected__remove-button_1phj6_91"},xb={$style:Ib},Ob=se(_b,[["__cssModules",xb]]),$b=["data-level"],Cb={key:0,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},Ab=["data-level"],Rb=G({__name:"TreeNode",props:{node:{},level:{},selectedKeys:{},halfSelectedKeys:{},lockedKeys:{},expandedKeys:{},loadingKeys:{},renderItem:{}},emits:["item-click","expand"],setup(t,{emit:e}){const n=t,o=e,r=P(()=>n.selectedKeys.has(n.node.key)),i=P(()=>n.halfSelectedKeys.has(n.node.key)),s=P(()=>n.lockedKeys.has(n.node.key)),a=P(()=>n.expandedKeys.has(n.node.key)),l=P(()=>n.loadingKeys.has(n.node.key)),u=P(()=>n.node.children&&n.node.children.length>0),c=P(()=>a.value&&n.node.lazyLoad&&l.value),d=()=>{s.value||o("item-click",n.node.key)},p=f=>{f.stopPropagation(),o("expand",n.node)};return(f,h)=>{const m=Dv("TreeNode",!0);return w(),z("div",{class:F(f.$style["tree__node-wrapper"])},[V("div",{class:F([f.$style.tree__node,{[f.$style["tree__node--selected"]]:r.value,[f.$style["tree__node--half-selected"]]:i.value,[f.$style["tree__node--locked"]]:s.value}])},[V("div",{class:F(f.$style["tree__node-content"]),"data-level":t.level,style:Mt({paddingLeft:`${t.level*20+(t.level>0&&t.node.isLeafNode?32:0)}px`})},[t.node.isLeafNode?ne("",!0):(w(),L(g(vv),{key:0,name:"arrow-down",class:F([f.$style["tree__expand-icon"],{[f.$style["tree__expand-icon--expanded"]]:a.value}]),size:20,onClick:p},null,8,["class"])),V("div",{class:F(f.$style["tree__checkbox-wrapper"]),onClick:d},[V("div",{class:F([f.$style.tree__checkbox,{[f.$style["tree__checkbox--checked"]]:r.value,[f.$style["tree__checkbox--half-checked"]]:i.value}])},[i.value?(w(),z("svg",Cb,[...h[2]||(h[2]=[V("path",{d:"M19 13H5v-2h14v2z"},null,-1)])])):r.value?(w(),L(g(ef),{key:1,name:"check"})):ne("",!0)],2)],2),t.renderItem?(w(),L(lt(t.renderItem),{key:1,node:t.node},null,8,["node"])):(w(),z("div",{key:2,class:F(f.$style["tree__node-label"])},[h[3]||(h[3]=V("span",null,"头像",-1)),V("span",{class:F(f.$style.tree__label)},Z(t.node.label),3)],2))],14,$b)],2),u.value&&a.value||c.value?(w(),z("div",{key:0,class:F(f.$style["tree__child-nodes"])},[c.value&&!u.value?(w(),z("div",{key:0,class:F(f.$style["tree__loading-container"]),"data-level":t.level+1,style:Mt({paddingLeft:`${(t.level+1)*20+40}px`})},[V("span",{class:F(f.$style["tree__loading-indicator"])},[q(g(Fo))],2)],14,Ab)):(w(!0),z(he,{key:1},ze(t.node.children,v=>(w(),L(m,{key:v.key,node:v,level:t.level+1,"selected-keys":t.selectedKeys,"half-selected-keys":t.halfSelectedKeys,"locked-keys":t.lockedKeys,"expanded-keys":t.expandedKeys,"loading-keys":t.loadingKeys,"render-item":t.renderItem,onItemClick:h[0]||(h[0]=y=>f.$emit("item-click",y)),onExpand:h[1]||(h[1]=y=>f.$emit("expand",y))},null,8,["node","level","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","render-item"]))),128))],2)):ne("",!0)],2)}}}),Db="_tree__node_19f24_1",Pb="_tree__checkbox_19f24_47",Nb="_tree__label_19f24_75",Lb="_tree__avatar_19f24_83",Bb={"tree__node-wrapper":"_tree__node-wrapper_19f24_1",tree__node:Db,"tree__node--selected":"_tree__node--selected_19f24_12","tree__node--half-selected":"_tree__node--half-selected_19f24_18","tree__node--locked":"_tree__node--locked_19f24_21","tree__node-content":"_tree__node-content_19f24_25","tree__expand-icon":"_tree__expand-icon_19f24_30","tree__expand-icon--expanded":"_tree__expand-icon--expanded_19f24_41","tree__checkbox-wrapper":"_tree__checkbox-wrapper_19f24_47",tree__checkbox:Pb,"tree__checkbox--checked":"_tree__checkbox--checked_19f24_61","tree__checkbox--half-checked":"_tree__checkbox--half-checked_19f24_65","tree__node-label":"_tree__node-label_19f24_69",tree__label:Nb,tree__avatar:Lb,"tree__child-nodes":"_tree__child-nodes_19f24_95","tree__loading-container":"_tree__loading-container_19f24_98","tree__loading-indicator":"_tree__loading-indicator_19f24_102","tree-spin":"_tree-spin_19f24_1"},Ub={$style:Bb},Fb=se(Rb,[["__cssModules",Ub]]),jb=G({__name:"TreeMode",props:{dataSource:{},selectedKeys:{},halfSelectedKeys:{},lockedKeys:{},expandedKeys:{},loadingKeys:{},onItemClick:{type:Function},onExpand:{type:Function},renderItem:{}},setup(t){return(e,n)=>t.dataSource.length===0?(w(),z("div",{key:0,class:F(e.$style.tree__empty)},"No data available",2)):(w(),z("div",{key:1,class:F(e.$style.tree__container)},[(w(!0),z(he,null,ze(t.dataSource,o=>(w(),L(Fb,{key:o.key,node:o,level:0,"selected-keys":t.selectedKeys,"half-selected-keys":t.halfSelectedKeys,"locked-keys":t.lockedKeys,"expanded-keys":t.expandedKeys,"loading-keys":t.loadingKeys,"render-item":t.renderItem,onItemClick:t.onItemClick,onExpand:t.onExpand},null,8,["node","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","render-item","onItemClick","onExpand"]))),128))],2))}}),qb="_tree__container_1fo8v_1",zb="_tree__empty_1fo8v_21",Gb={tree__container:qb,tree__empty:zb},Hb={$style:Gb},Vb=se(jb,[["__cssModules",Hb]]);function Wb(t){return t.length===0?!1:"isLeafNode"in t[0]}function Kb(t,e){if(!e.trim())return t;const n=e.toLowerCase(),o=i=>i.key.toLowerCase().includes(n)||i.label.toLowerCase().includes(n),r=i=>{const s=[];return i.forEach(a=>{const l=o(a);let u=[];a.children&&a.children.length&&(u=r(a.children)),(l||u.length>0)&&s.push({...a,children:u.length>0?u:a.children})}),s};return r(t)}function Yb(t,e){if(!e.trim())return t;const n=e.toLowerCase();return t.filter(o=>o.key.toLowerCase().includes(n)||o.label.toLowerCase().includes(n))}function Jb({dataSource:t,isTreeMode:e=!1,onSearch:n,debounceTime:o=300}){const r=x(""),i=x(!1),s=P(()=>{const d=r.value.trim();return d?e&&Wb(t.value)?Kb(t.value,d):n?n(t.value,d):Yb(t.value,d):t.value}),a=d=>{i.value=!0,r.value=d,i.value=!1},l=()=>{r.value=""},u=d=>{r.value=d},c=P(()=>r.value.trim()?Array.isArray(s.value)&&s.value.length===0:!1);return{searchValue:r,setSearchValue:u,filteredData:s,isSearching:i,handleSearch:a,clearSearch:l,isSearchEmpty:c}}function Vi(t){return t.length===0?!1:"isLeafNode"in t[0]}function Xb(t){const e=new Map,n=o=>{o.forEach(r=>{e.set(r.key,r),r.children&&r.children.length&&n(r.children)})};return n(t),e}function Qb(t){const e=new Map,n=(o,r)=>{o.forEach(i=>{var s;r&&(e.has(r)||e.set(r,[]),(s=e.get(r))==null||s.push(i.key)),i.children&&i.children.length&&n(i.children,i.key)})};return n(t),e}function Zb(t){const e=new Map,n=(o,r)=>{o.forEach(i=>{r&&e.set(i.key,r),i.children&&i.children.length&&n(i.children,i.key)})};return n(t),e}function Rc(t,e){return t.size!==e.size?!1:Array.from(t).every(n=>e.has(n))}function e_({defaultSelectedKeys:t=[],lockedKeys:e=[],maxCount:n=1/0,minCount:o=0,isTreeMode:r=!1,dataSource:i,onSelectedChange:s,onMaxCountExceed:a}){const l=x(new Set(t)),u=x(new Set),c=x(new Set(e)),d=P(()=>r&&Vi(i.value)?Qb(i.value):new Map),p=P(()=>r&&Vi(i.value)?Zb(i.value):new Map),f=P(()=>r&&Vi(i.value)?Xb(i.value):new Map),h=P(()=>l.value.size),m=P(()=>h.value<n),v=P(()=>h.value>=n),y=T=>{const I=[],O=B=>{const $=d.value.get(B);$&&$.forEach(R=>{I.push(R),O(R)})};return O(T.key),I},_=T=>{const I=f.value.get(T);return I!=null&&I.isLeafNode&&!l.value.has(T)&&!c.value.has(T)?[I]:y({key:T}).filter(O=>!l.value.has(O)&&!c.value.has(O)).map(O=>f.value.get(O)).filter(O=>O==null?void 0:O.isLeafNode)},E=T=>{const I=f.value.get(T);return I!=null&&I.isLeafNode&&l.value.has(T)?[I]:y({key:T}).filter(O=>l.value.has(O)&&!c.value.has(O)).map(O=>f.value.get(O)).filter(O=>O==null?void 0:O.isLeafNode)},b=T=>{const I=[T];let O=T;for(;p.value.has(O);){const B=p.value.get(O);I.push(B),O=B}return I},N=()=>{if(!r)return;const T=new Set,I=new Set,O=new Set(Array.from(l.value));d.value.forEach((R,D)=>{O.add(D)}),d.value.forEach(R=>{R.forEach(D=>O.add(D))}),l.value.forEach(R=>{const D=d.value.get(R);(!D||D.length===0)&&l.value.has(R)&&T.add(R)});let B=!0;const $=R=>{if(c.value.has(R))return;const D=d.value.get(R);if(!D||D.length===0)return;const C=D.filter(we=>!c.value.has(we));if(C.length===0)return;const j=C.filter(we=>T.has(we)).length,W=C.filter(we=>I.has(we)).length,ee=T.has(R),oe=I.has(R);j===C.length?(!ee||oe)&&(T.add(R),I.delete(R),B=!0):j>0||W>0?(ee||!oe)&&(T.delete(R),I.add(R),B=!0):(ee||oe)&&(T.delete(R),I.delete(R),B=!0)};for(;B;)B=!1,O.forEach($);Rc(T,l.value)||(l.value=T),Rc(I,u.value)||(u.value=I)},S=T=>{if(c.value.has(T))return;const I=new Set(l.value);if(r){const O=I.has(T),B=u.value.has(T);if(O){const $=E(T),R=M().filter(D=>D.isLeafNode).length;$.length>0&&R-$.length>=o&&$.forEach(D=>{I.delete(D.key)})}else if(B){const $=_(T).length;if($===0){const R=E(T),D=M().filter(C=>C.isLeafNode).length;R.length>0&&D-R.length>=o&&R.forEach(C=>{I.delete(C.key)})}else $>0&&M().filter(R=>R.isLeafNode).length+$<=n&&_(T).forEach(R=>{I.add(R.key)})}else{const $=_(T);$.length>0&&M().filter(R=>R.isLeafNode).length+$.length<=n&&$.forEach(R=>{I.add(R.key)})}}else I.has(T)?I.delete(T):I.size<n?I.add(T):a==null||a(M());l.value=I},M=()=>{const T=[];if(r&&Vi(i.value)){const I=i.value,O=(B,$)=>{var R;const D=$.find(C=>C.key===B);if(D)return D;for(let C=0;C<$.length;C+=1){const j=$[C];if((R=j.children)!=null&&R.length){const W=O(B,j.children);if(W)return W}}return null};l.value.forEach(B=>{const $=O(B,I);$&&T.push({key:$.key,label:$.label,avatarUrl:$.avatarUrl,isLeafNode:$.isLeafNode,extraData:$.extraData,path:[...b($.key)].reverse()})})}else{const I=i.value;l.value.forEach(O=>{const B=I.find($=>$.key===O);B&&T.push({key:B.key,label:B.label,avatarUrl:B.avatarUrl,extraData:B.extraData})})}return T};return le([l,u],()=>{r&&N(),s&&s(M())},{deep:!0}),{selectedKeys:l,halfSelectedKeys:u,lockedKeys:c,isSelected:T=>l.value.has(T),isHalfSelected:T=>u.value.has(T),isLocked:T=>c.value.has(T),toggle:S,getSelectedItems:M,getNodeChildKeys:y,getSelectableLeafNodes:_,getCancelableLeafNodes:E,getNodeParentChildrenMap:()=>d.value,canSelectMore:m,reachMaxCount:v,allSelectedCount:h}}function t_({onExpand:t}={}){const e=x(new Set),n=x(new Set),o=s=>e.value.has(s),r=s=>n.value.has(s),i=(s,a)=>{const l=new Set(n.value);a?l.add(s):l.delete(s),n.value=l};return{expandedKeys:e,loadingKeys:n,checkNodeIsExpanded:o,checkNodeIsLoading:r,toggleExpand:s=>{if(s.isLeafNode)return;const a=new Set(e.value);a.has(s.key)?a.delete(s.key):(a.add(s.key),s.lazyLoad&&t&&(i(s.key,!0),t(s))),e.value=a},setNodeLoading:i}}const n_=["data-display-mode"],o_=["data-display-mode"],r_=G({__name:"UserPicker",props:{displayMode:{},dataSource:{default:()=>[]},defaultSelectedItems:{default:()=>[]},lockedItems:{default:()=>[]},maxCount:{default:Number.POSITIVE_INFINITY},minCount:{default:0},onMaxCountExceed:{},enableSearch:{type:Boolean,default:!0},searchPlaceholder:{},onSearch:{},renderItem:{},onSelectedChange:{},onReachEnd:{},onExpand:{}},setup(t,{expose:e}){const n=t,{t:o}=Ee(),r=P(()=>n.displayMode==="tree"),i=x(n.dataSource),s=P(()=>n.defaultSelectedItems.map(p=>p.key)),a=P(()=>n.lockedItems.map(p=>p.key)),l=e_({defaultSelectedKeys:s.value,lockedKeys:a.value,maxCount:n.maxCount,minCount:n.minCount,isTreeMode:r.value,dataSource:i,onSelectedChange:n.onSelectedChange||(()=>{}),onMaxCountExceed:n.onMaxCountExceed||(()=>{})}),u=Jb({dataSource:i,isTreeMode:r.value,onSearch:n.onSearch}),c=t_({onExpand:p=>{n.onExpand&&n.onExpand(p)}});le(()=>n.dataSource,p=>{r.value||(i.value=p)},{deep:!0});const d=(p,f)=>{if(!r.value)return;const h=JSON.parse(JSON.stringify(i.value)),m=v=>{for(let y=0;y<v.length;y+=1){if(v[y].key===p){const E={...v[y],...f,key:v[y].key};f.children&&v[y].lazyLoad&&(E.lazyLoad=!1);const b=[...v];return b[y]=E,v.splice(0,v.length,...b),!0}const{children:_}=v[y];if(_&&Array.isArray(_)&&_.length>0&&m(_))return!0}return!1};Array.isArray(h)&&m(h),i.value=h,f.children&&c.setNodeLoading(p,!1)};return e({getSelectedItems:()=>l.getSelectedItems(),updateListData:p=>{r.value||(i.value=p)},updateTreeData:(p,f)=>{d(p,f)}}),(p,f)=>(w(),z("div",{class:F(p.$style["user-picker"]),"data-display-mode":t.displayMode},[t.enableSearch?(w(),L(g(yb),{key:0,placeholder:t.searchPlaceholder||g(o)("UserPicker.search"),"on-search":g(u).handleSearch},null,8,["placeholder","on-search"])):ne("",!0),V("div",{class:F(p.$style["user-picker__panel"]),"data-display-mode":t.displayMode},[g(u).isSearchEmpty.value?(w(),z("div",{key:0,class:F(p.$style["empty-search"])},Z(g(o)("UserPicker.no_result")),3)):r.value?(w(),L(g(Vb),{key:2,"data-source":g(u).filteredData.value,"selected-keys":g(l).selectedKeys.value,"half-selected-keys":g(l).halfSelectedKeys.value,"locked-keys":g(l).lockedKeys.value,"expanded-keys":g(c).expandedKeys.value,"loading-keys":g(c).loadingKeys.value,"on-item-click":g(l).toggle,"on-expand":g(c).toggleExpand,"render-item":t.renderItem},null,8,["data-source","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","on-item-click","on-expand","render-item"])):(w(),L(g(cb),{key:1,"data-source":g(u).filteredData.value,"selected-keys":g(l).selectedKeys.value,"locked-keys":g(l).lockedKeys.value,"on-item-click":g(l).toggle,"on-reach-end":t.onReachEnd||(()=>{}),"render-item":t.renderItem},null,8,["data-source","selected-keys","locked-keys","on-item-click","on-reach-end","render-item"]))],10,o_),q(g(Ob),{"display-mode":t.displayMode,"selected-items":g(l).getSelectedItems(),"locked-keys":g(l).lockedKeys.value,"on-remove":g(l).toggle,"max-count":t.maxCount},null,8,["display-mode","selected-items","locked-keys","on-remove","max-count"])],10,n_))}}),i_={"user-picker":"_user-picker_1cf9q_1","user-picker__panel":"_user-picker__panel_1cf9q_8","user-picker__empty-search":"_user-picker__empty-search_1cf9q_17","user-picker__selection-status":"_user-picker__selection-status_1cf9q_25"},s_={$style:i_},a_=se(r_,[["__cssModules",s_]]),l_={search:"Search",no_result:"No result",no_data_available:"No data available",selected:"Selected",people_unit:"people"},u_={search:"搜索",no_result:"没有结果",no_data_available:"无数据",selected:"已选择",people_unit:"人"},kf={"en-US":l_,"zh-CN":u_};lr("en-US",{translation:{UserPicker:kf["en-US"]}});lr("zh-CN",{translation:{UserPicker:kf["zh-CN"]}});const bu=a_;var Ne=(t=>(t[t.C2C=ce.TYPES.CONV_C2C]="C2C",t[t.GROUP=ce.TYPES.CONV_GROUP]="GROUP",t[t.SYSTEM=ce.TYPES.CONV_SYSTEM]="SYSTEM",t))(Ne||{}),ie=(t=>(t[t.TEXT=ce.TYPES.MSG_TEXT]="TEXT",t[t.IMAGE=ce.TYPES.MSG_IMAGE]="IMAGE",t[t.AUDIO=ce.TYPES.MSG_AUDIO]="AUDIO",t[t.VIDEO=ce.TYPES.MSG_VIDEO]="VIDEO",t[t.FILE=ce.TYPES.MSG_FILE]="FILE",t[t.FACE=ce.TYPES.MSG_FACE]="FACE",t[t.LOCATION=ce.TYPES.MSG_LOCATION]="LOCATION",t[t.GRP_TIP=ce.TYPES.MSG_GRP_TIP]="GRP_TIP",t[t.CUSTOM=ce.TYPES.MSG_CUSTOM]="CUSTOM",t[t.MERGER=ce.TYPES.MSG_MERGER]="MERGER",t))(ie||{}),c_=(t=>(t[t.LOWEST=ce.TYPES.MSG_PRIORITY_LOWEST]="LOWEST",t[t.LOW=ce.TYPES.MSG_PRIORITY_LOW]="LOW",t[t.NORMAL=ce.TYPES.MSG_PRIORITY_NORMAL]="NORMAL",t[t.HIGH=ce.TYPES.MSG_PRIORITY_HIGH]="HIGH",t))(c_||{});const Q=G({name:"View",__name:"View",props:{gap:{default:void 0},dir:{default:"column"},justify:{default:void 0},align:{default:void 0}},setup(t){const e=t,n=P(()=>pe("view__v",{"view__v--dir-row":e.dir==="row",[`view__v--justify-${e.justify}`]:e.justify,[`view__v--align-${e.align}`]:e.align}));return(o,r)=>(w(),z("div",{class:F(n.value),style:Mt({gap:t.gap?`${t.gap}px`:void 0})},[J(o.$slots,"default")],6))}});function Xt(t,e){const n=typeof t=="string"&&!e?`${t}Context`:e,o=Symbol(n);return[r=>{const i=hu(o,r);if(i||i===null)return i;throw new Error(`Injection \`${o.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},r=>(mu(o,r),r)]}function Le(){let t=document.activeElement;if(t==null)return null;for(;t!=null&&t.shadowRoot!=null&&t.shadowRoot.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Sf(t,e,n){const o=n.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),o.dispatchEvent(r)}function d_(t){return t==null}function _u(t){return t?t.flatMap(e=>e.type===he?_u(e.children):[e]):[]}const[Mf]=Xt("ConfigProvider");function p_(t,e){var n;const o=oa();return At(()=>{o.value=t()},{...e,flush:(n=void 0)!==null&&n!==void 0?n:"sync"}),qv(o)}function Tf(t,e){return uf()?(cf(t,e),!0):!1}function f_(t){let e=!1,n;const o=lf(!0);return(...r)=>(e||(n=o.run(()=>t(...r)),e=!0),n)}const fn=typeof window<"u"&&typeof document<"u",h_=t=>typeof t<"u",m_=Object.prototype.toString,g_=t=>m_.call(t)==="[object Object]",Dc=v_();function v_(){var t,e,n;return fn&&!!(!((t=window)===null||t===void 0||(t=t.navigator)===null||t===void 0)&&t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window)===null||e===void 0||(e=e.navigator)===null||e===void 0?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test((n=window)===null||n===void 0?void 0:n.navigator.userAgent))}function Ba(t){return Array.isArray(t)?t:[t]}function y_(t){return Ln()}function If(t){if(!fn)return t;let e=0,n,o;const r=()=>{e-=1,o&&e<=0&&(o.stop(),n=void 0,o=void 0)};return(...i)=>(e+=1,o||(o=lf(!0),n=o.run(()=>t(...i))),Tf(r),n)}function b_(t){return Na(t)?Xr(new Proxy({},{get(e,n,o){return g(Reflect.get(t.value,n,o))},set(e,n,o){return Na(t.value[n])&&!Na(o)?t.value[n].value=o:t.value[n]=o,!0},deleteProperty(e,n){return Reflect.deleteProperty(t.value,n)},has(e,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}})):Xr(t)}function __(t){return b_(P(t))}function w_(t,...e){const n=e.flat(),o=n[0];return __(()=>Object.fromEntries(typeof o=="function"?Object.entries(Ht(t)).filter(([r,i])=>!o(rt(i),r)):Object.entries(Ht(t)).filter(r=>!n.includes(r[0]))))}function E_(t,e=1e4){return df((n,o)=>{let r=rt(t),i;const s=()=>setTimeout(()=>{r=rt(t),o()},rt(e));return Tf(()=>{clearTimeout(i)}),{get(){return n(),r},set(a){r=a,o(),clearTimeout(i),i=s()}}})}function k_(t,e){y_()&&vi(t,e)}function S_(t,e,n){return le(t,e,{...n,immediate:!0})}const wu=fn?window:void 0;function ur(t){var e;const n=rt(t);return(e=n==null?void 0:n.$el)!==null&&e!==void 0?e:n}function Ss(...t){const e=(o,r,i,s)=>(o.addEventListener(r,i,s),()=>o.removeEventListener(r,i,s)),n=P(()=>{const o=Ba(rt(t[0])).filter(r=>r!=null);return o.every(r=>typeof r!="string")?o:void 0});return S_(()=>{var o,r;return[(o=(r=n.value)===null||r===void 0?void 0:r.map(i=>ur(i)))!==null&&o!==void 0?o:[wu].filter(i=>i!=null),Ba(rt(n.value?t[1]:t[0])),Ba(g(n.value?t[2]:t[1])),rt(n.value?t[3]:t[2])]},([o,r,i,s],a,l)=>{if(!(o!=null&&o.length)||!(r!=null&&r.length)||!(i!=null&&i.length))return;const u=g_(s)?{...s}:s,c=o.flatMap(d=>r.flatMap(p=>i.map(f=>e(d,p,f,u))));l(()=>{c.forEach(d=>d())})},{flush:"post"})}function M_(){const t=oa(!1),e=Ln();return e&&tt(()=>{t.value=!0},e),t}function T_(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function I_(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:r=wu,eventName:i="keydown",passive:s=!1,dedupe:a=!1}=o,l=T_(e);return Ss(r,i,u=>{u.repeat&&rt(a)||l(u)&&n(u)},s)}function x_(t){return JSON.parse(JSON.stringify(t))}function sa(t,e,n,o={}){var r,i;const{clone:s=!1,passive:a=!1,eventName:l,deep:u=!1,defaultValue:c,shouldEmit:d}=o,p=Ln(),f=n||(p==null?void 0:p.emit)||(p==null||(r=p.$emit)===null||r===void 0?void 0:r.bind(p))||(p==null||(i=p.proxy)===null||i===void 0||(i=i.$emit)===null||i===void 0?void 0:i.bind(p==null?void 0:p.proxy));let h=l;e||(e="modelValue"),h=h||`update:${e.toString()}`;const m=_=>s?typeof s=="function"?s(_):x_(_):_,v=()=>h_(t[e])?m(t[e]):c,y=_=>{d?d(_)&&f(h,_):f(h,_)};if(a){const _=x(v());let E=!1;return le(()=>t[e],b=>{E||(E=!0,_.value=m(b),Te(()=>E=!1))}),le(_,b=>{!E&&(b!==t[e]||u)&&y(b)},{deep:u}),_}else return P({get(){return v()},set(_){y(_)}})}function Ua(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function El(t,e,n=".",o){if(!Ua(e))return El(t,{},n);const r=Object.assign({},e);for(const i in t){if(i==="__proto__"||i==="constructor")continue;const s=t[i];s!=null&&(Array.isArray(s)&&Array.isArray(r[i])?r[i]=[...s,...r[i]]:Ua(s)&&Ua(r[i])?r[i]=El(s,r[i],(n?`${n}.`:"")+i.toString()):r[i]=s)}return r}function O_(t){return(...e)=>e.reduce((n,o)=>El(n,o,""),{})}const $_=O_(),C_=If(()=>{const t=x(new Map),e=x(),n=P(()=>{for(const s of t.value.values())if(s)return!0;return!1}),o=Mf({scrollBody:x(!0)});let r=null;const i=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.documentElement.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",Dc&&(r==null||r()),e.value=void 0};return le(n,(s,a)=>{var l;if(!fn)return;if(!s){a&&i();return}e.value===void 0&&(e.value=document.body.style.overflow);const u=window.innerWidth-document.documentElement.clientWidth,c={padding:u,margin:0},d=(l=o.scrollBody)!=null&&l.value?typeof o.scrollBody.value=="object"?$_({padding:o.scrollBody.value.padding===!0?u:o.scrollBody.value.padding,margin:o.scrollBody.value.margin===!0?u:o.scrollBody.value.margin},c):c:{padding:0,margin:0};u>0&&(document.body.style.paddingRight=typeof d.padding=="number"?`${d.padding}px`:String(d.padding),document.body.style.marginRight=typeof d.margin=="number"?`${d.margin}px`:String(d.margin),document.documentElement.style.setProperty("--scrollbar-width",`${u}px`),document.body.style.overflow="hidden"),Dc&&(r=Ss(document,"touchmove",p=>A_(p),{passive:!1})),Te(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),t});function Eu(t){const e=Math.random().toString(36).substring(2,7),n=C_();n.value.set(e,t??!1);const o=P({get:()=>n.value.get(e)??!1,set:r=>n.value.set(e,r)});return k_(()=>{n.value.delete(e)}),o}function xf(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!(n instanceof Element)||n.tagName==="BODY"?!1:xf(n)}}function A_(t){const e=t||window.event,n=e.target;return n instanceof Element&&xf(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function _i(t){const e=Ln(),n=e==null?void 0:e.type.emits,o={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),n==null||n.forEach(r=>{o[Fv(af(r))]=(...i)=>t(r,...i)}),o}function ke(){const t=Ln(),e=x(),n=P(()=>o());Pv(()=>{n.value!==o()&&jv(e)});function o(){return e.value&&"$el"in e.value&&["#text","#comment"].includes(e.value.$el.nodeName)?e.value.$el.nextElementSibling:ur(e)}const r=Object.assign({},t.exposed),i={};for(const a in t.props)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>t.props[a]});if(Object.keys(r).length>0)for(const a in r)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>r[a]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=i;function s(a){if(e.value=a,!!a&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>a instanceof Element?a:a.$el}),!(a instanceof Element)&&!Object.prototype.hasOwnProperty.call(a,"$el"))){const l=a.$.exposed,u=Object.assign({},i);for(const c in l)Object.defineProperty(u,c,{enumerable:!0,configurable:!0,get:()=>l[c]});t.exposed=u}}return{forwardRef:s,currentRef:e,currentElement:n}}var R_=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Mo=new WeakMap,Wi=new WeakMap,Ki={},Fa=0,Of=function(t){return t&&(t.host||Of(t.parentNode))},D_=function(t,e){return e.map(function(n){if(t.contains(n))return n;var o=Of(n);return o&&t.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},P_=function(t,e,n,o){var r=D_(e,Array.isArray(t)?t:[t]);Ki[n]||(Ki[n]=new WeakMap);var i=Ki[n],s=[],a=new Set,l=new Set(r),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};r.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))c(p);else try{var f=p.getAttribute(o),h=f!==null&&f!=="false",m=(Mo.get(p)||0)+1,v=(i.get(p)||0)+1;Mo.set(p,m),i.set(p,v),s.push(p),m===1&&h&&Wi.set(p,!0),v===1&&p.setAttribute(n,"true"),h||p.setAttribute(o,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return c(e),a.clear(),Fa++,function(){s.forEach(function(d){var p=Mo.get(d)-1,f=i.get(d)-1;Mo.set(d,p),i.set(d,f),p||(Wi.has(d)||d.removeAttribute(o),Wi.delete(d)),f||d.removeAttribute(n)}),Fa--,Fa||(Mo=new WeakMap,Mo=new WeakMap,Wi=new WeakMap,Ki={})}},N_=function(t,e,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(t)?t:[t]),r=R_(t);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),P_(o,r,n,"aria-hidden")):function(){return null}};function ku(t){let e;le(()=>ur(t),n=>{n?e=N_(n):e&&e()}),Lt(()=>{e&&e()})}function L_(t,e){const n=x(t);function o(r){return e[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=o(r)}}}function B_(t,e){var n;const o=x({}),r=x("none"),i=x(t),s=t.value?"mounted":"unmounted";let a;const l=((n=e.value)==null?void 0:n.ownerDocument.defaultView)??wu,{state:u,dispatch:c}=L_(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),d=v=>{var y;if(fn){const _=new CustomEvent(v,{bubbles:!1,cancelable:!1});(y=e.value)==null||y.dispatchEvent(_)}};le(t,async(v,y)=>{var _;const E=y!==v;if(await Te(),E){const b=r.value,N=Yi(e.value);v?(c("MOUNT"),d("enter"),N==="none"&&d("after-enter")):N==="none"||N==="undefined"||((_=o.value)==null?void 0:_.display)==="none"?(c("UNMOUNT"),d("leave"),d("after-leave")):y&&b!==N?(c("ANIMATION_OUT"),d("leave")):(c("UNMOUNT"),d("after-leave"))}},{immediate:!0});const p=v=>{const y=Yi(e.value),_=y.includes(CSS.escape(v.animationName)),E=u.value==="mounted"?"enter":"leave";if(v.target===e.value&&_&&(d(`after-${E}`),c("ANIMATION_END"),!i.value)){const b=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",a=l==null?void 0:l.setTimeout(()=>{var N;((N=e.value)==null?void 0:N.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=b)})}v.target===e.value&&y==="none"&&c("ANIMATION_END")},f=v=>{v.target===e.value&&(r.value=Yi(e.value))},h=le(e,(v,y)=>{v?(o.value=getComputedStyle(v),v.addEventListener("animationstart",f),v.addEventListener("animationcancel",p),v.addEventListener("animationend",p)):(c("ANIMATION_END"),a!==void 0&&(l==null||l.clearTimeout(a)),y==null||y.removeEventListener("animationstart",f),y==null||y.removeEventListener("animationcancel",p),y==null||y.removeEventListener("animationend",p))},{immediate:!0}),m=le(u,()=>{const v=Yi(e.value);r.value=u.value==="mounted"?v:"none"});return Lt(()=>{h(),m()}),{isPresent:P(()=>["mounted","unmountSuspended"].includes(u.value))}}function Yi(t){return t&&getComputedStyle(t).animationName||"none"}var aa=G({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(t,{slots:e,expose:n}){var o;const{present:r,forceMount:i}=Ht(t),s=x(),{isPresent:a}=B_(r,s);n({present:a});let l=e.default({present:a.value});l=_u(l||[]);const u=Ln();if(l&&(l==null?void 0:l.length)>1){const c=(o=u==null?void 0:u.parent)!=null&&o.type.name?`<${u.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${c}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(d=>` - ${d}`).join(`
|
||
`)].join(`
|
||
`))}return()=>i.value||r.value||a.value?xe(e.default({present:a.value})[0],{ref:c=>{const d=ur(c);return typeof(d==null?void 0:d.hasAttribute)>"u"||(d!=null&&d.hasAttribute("data-reka-popper-content-wrapper")?s.value=d.firstElementChild:s.value=d),d}}):null}});const kl=G({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:n}){return()=>{var o;if(!n.default)return null;const r=_u(n.default()),i=r.findIndex(u=>u.type!==Nv);if(i===-1)return r;const s=r[i];(o=s.props)==null||delete o.ref;const a=s.props?ye(e,s.props):e,l=Lv({...s,props:{}},a);return r.length===1?l:(r[i]=l,r)}}}),U_=["area","img","input"],Vt=G({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:n}){const o=t.asChild?"template":t.as;return typeof o=="string"&&U_.includes(o)?()=>xe(o,e):o!=="template"?()=>xe(t.as,e,{default:n.default}):()=>xe(kl,e,{default:n.default})}}),F_="dismissableLayer.pointerDownOutside",j_="dismissableLayer.focusOutside";function $f(t,e){const n=e.closest("[data-dismissable-layer]"),o=t.dataset.dismissableLayer===""?t:t.querySelector("[data-dismissable-layer]"),r=Array.from(t.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&(o===n||r.indexOf(o)<r.indexOf(n)))}function q_(t,e,n=!0){var o;const r=((o=e==null?void 0:e.value)==null?void 0:o.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=x(!1),s=x(()=>{});return At(a=>{if(!fn||!rt(n))return;const l=async c=>{const d=c.target;if(!(!(e!=null&&e.value)||!d)){if($f(e.value,d)){i.value=!1;return}if(c.target&&!i.value){let p=function(){Sf(F_,t,f)};const f={originalEvent:c};c.pointerType==="touch"?(r.removeEventListener("click",s.value),s.value=p,r.addEventListener("click",s.value,{once:!0})):p()}else r.removeEventListener("click",s.value);i.value=!1}},u=window.setTimeout(()=>{r.addEventListener("pointerdown",l)},0);a(()=>{window.clearTimeout(u),r.removeEventListener("pointerdown",l),r.removeEventListener("click",s.value)})}),{onPointerDownCapture:()=>{rt(n)&&(i.value=!0)}}}function z_(t,e,n=!0){var o;const r=((o=e==null?void 0:e.value)==null?void 0:o.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=x(!1);return At(s=>{if(!fn||!rt(n))return;const a=async l=>{if(!(e!=null&&e.value))return;await Te(),await Te();const u=l.target;!e.value||!u||$f(e.value,u)||l.target&&!i.value&&Sf(j_,t,{originalEvent:l})};r.addEventListener("focusin",a),s(()=>r.removeEventListener("focusin",a))}),{onFocusCapture:()=>{rt(n)&&(i.value=!0)},onBlurCapture:()=>{rt(n)&&(i.value=!1)}}}const _t=Xr({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,originalBodyPointerEvents:void 0,branches:new Set});var G_=G({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(t,{emit:e}){const n=t,o=e,{forwardRef:r,currentElement:i}=ke(),s=P(()=>{var f;return((f=i.value)==null?void 0:f.ownerDocument)??globalThis.document}),a=P(()=>_t.layersRoot),l=P(()=>i.value?Array.from(a.value).indexOf(i.value):-1),u=P(()=>_t.layersWithOutsidePointerEventsDisabled.size>0),c=P(()=>{const f=Array.from(a.value),[h]=[..._t.layersWithOutsidePointerEventsDisabled].slice(-1),m=f.indexOf(h);return l.value>=m}),d=q_(async f=>{const h=[..._t.branches].some(m=>m==null?void 0:m.contains(f.target));!c.value||h||(o("pointerDownOutside",f),o("interactOutside",f),await Te(),f.defaultPrevented||o("dismiss"))},i),p=z_(f=>{[..._t.branches].some(h=>h==null?void 0:h.contains(f.target))||(o("focusOutside",f),o("interactOutside",f),f.defaultPrevented||o("dismiss"))},i);return I_("Escape",f=>{l.value===a.value.size-1&&(o("escapeKeyDown",f),f.defaultPrevented||o("dismiss"))}),At(f=>{i.value&&(n.disableOutsidePointerEvents&&(_t.layersWithOutsidePointerEventsDisabled.size===0&&(_t.originalBodyPointerEvents=s.value.body.style.pointerEvents,s.value.body.style.pointerEvents="none"),_t.layersWithOutsidePointerEventsDisabled.add(i.value)),a.value.add(i.value),f(()=>{n.disableOutsidePointerEvents&&_t.layersWithOutsidePointerEventsDisabled.size===1&&!d_(_t.originalBodyPointerEvents)&&(s.value.body.style.pointerEvents=_t.originalBodyPointerEvents)}))}),At(f=>{f(()=>{i.value&&(a.value.delete(i.value),_t.layersWithOutsidePointerEventsDisabled.delete(i.value))})}),(f,h)=>(w(),L(g(Vt),{ref:g(r),"as-child":f.asChild,as:f.as,"data-dismissable-layer":"",style:Mt({pointerEvents:u.value?c.value?"auto":"none":void 0}),onFocusCapture:g(p).onFocusCapture,onBlurCapture:g(p).onBlurCapture,onPointerdownCapture:g(d).onPointerDownCapture},{default:A(()=>[J(f.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),Su=G_;const H_=f_(()=>x([]));function V_(){const t=H_();return{add(e){const n=t.value[0];e!==n&&(n==null||n.pause()),t.value=Pc(t.value,e),t.value.unshift(e)},remove(e){var n;t.value=Pc(t.value,e),(n=t.value[0])==null||n.resume()}}}function Pc(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}const ja="focusScope.autoFocusOnMount",qa="focusScope.autoFocusOnUnmount",Nc={bubbles:!1,cancelable:!0};function W_(t,{select:e=!1}={}){const n=Le();for(const o of t)if(En(o,{select:e}),Le()!==n)return!0}function K_(t){const e=Cf(t),n=Lc(e,t),o=Lc(e.reverse(),t);return[n,o]}function Cf(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Lc(t,e){for(const n of t)if(!Y_(n,{upTo:e}))return n}function Y_(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function J_(t){return t instanceof HTMLInputElement&&"select"in t}function En(t,{select:e=!1}={}){if(t&&t.focus){const n=Le();t.focus({preventScroll:!0}),t!==n&&J_(t)&&e&&t.select()}}var X_=G({__name:"FocusScope",props:{loop:{type:Boolean,required:!1,default:!1},trapped:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["mountAutoFocus","unmountAutoFocus"],setup(t,{emit:e}){const n=t,o=e,{currentRef:r,currentElement:i}=ke(),s=x(null),a=V_(),l=Xr({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});At(c=>{if(!fn)return;const d=i.value;if(!n.trapped)return;function p(v){if(l.paused||!d)return;const y=v.target;d.contains(y)?s.value=y:En(s.value,{select:!0})}function f(v){if(l.paused||!d)return;const y=v.relatedTarget;y!==null&&(d.contains(y)||En(s.value,{select:!0}))}function h(v){d.contains(s.value)||En(d)}document.addEventListener("focusin",p),document.addEventListener("focusout",f);const m=new MutationObserver(h);d&&m.observe(d,{childList:!0,subtree:!0}),c(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",f),m.disconnect()})}),At(async c=>{const d=i.value;if(await Te(),!d)return;a.add(l);const p=Le();if(!d.contains(p)){const f=new CustomEvent(ja,Nc);d.addEventListener(ja,h=>o("mountAutoFocus",h)),d.dispatchEvent(f),f.defaultPrevented||(W_(Cf(d),{select:!0}),Le()===p&&En(d))}c(()=>{d.removeEventListener(ja,m=>o("mountAutoFocus",m));const f=new CustomEvent(qa,Nc),h=m=>{o("unmountAutoFocus",m)};d.addEventListener(qa,h),d.dispatchEvent(f),setTimeout(()=>{f.defaultPrevented||En(p??document.body,{select:!0}),d.removeEventListener(qa,h),a.remove(l)},0)})});function u(c){if(!n.loop&&!n.trapped||l.paused)return;const d=c.key==="Tab"&&!c.altKey&&!c.ctrlKey&&!c.metaKey,p=Le();if(d&&p){const f=c.currentTarget,[h,m]=K_(f);h&&m?!c.shiftKey&&p===m?(c.preventDefault(),n.loop&&En(h,{select:!0})):c.shiftKey&&p===h&&(c.preventDefault(),n.loop&&En(m,{select:!0})):p===f&&c.preventDefault()}}return(c,d)=>(w(),L(g(Vt),{ref_key:"currentRef",ref:r,tabindex:"-1","as-child":c.asChild,as:c.as,onKeydown:u},{default:A(()=>[J(c.$slots,"default")]),_:3},8,["as-child","as"]))}}),Mu=X_,Q_=G({__name:"Teleport",props:{to:{type:null,required:!1,default:"body"},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=M_();return(n,o)=>g(e)||n.forceMount?(w(),L(fu,{key:0,to:n.to,disabled:n.disabled,defer:n.defer},[J(n.$slots,"default")],8,["to","disabled","defer"])):ne("v-if",!0)}}),Tu=Q_;let za=0;function Af(){At(t=>{if(!fn)return;const e=document.querySelectorAll("[data-reka-focus-guard]");document.body.insertAdjacentElement("afterbegin",e[0]??Bc()),document.body.insertAdjacentElement("beforeend",e[1]??Bc()),za++,t(()=>{za===1&&document.querySelectorAll("[data-reka-focus-guard]").forEach(n=>n.remove()),za--})})}function Bc(){const t=document.createElement("span");return t.setAttribute("data-reka-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}function Rf(t){const e=Ln(),n=Object.keys((e==null?void 0:e.type.props)??{}).reduce((r,i)=>{const s=(e==null?void 0:e.type.props[i]).default;return s!==void 0&&(r[i]=s),r},{}),o=zv(t);return P(()=>{const r={},i=(e==null?void 0:e.vnode.props)??{};return Object.keys(i).forEach(s=>{r[af(s)]=i[s]}),Object.keys({...n,...r}).reduce((s,a)=>(o.value[a]!==void 0&&(s[a]=o.value[a]),s),{})})}function yo(t,e){const n=Rf(t),o=e?_i(e):{};return P(()=>({...n.value,...o}))}function Z_(t){const e=x(),n=P(()=>{var r;return((r=e.value)==null?void 0:r.width)??0}),o=P(()=>{var r;return((r=e.value)==null?void 0:r.height)??0});return tt(()=>{const r=ur(t);if(r){e.value={width:r.offsetWidth,height:r.offsetHeight};const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,u;if("borderBoxSize"in a){const c=a.borderBoxSize,d=Array.isArray(c)?c[0]:c;l=d.inlineSize,u=d.blockSize}else l=r.offsetWidth,u=r.offsetHeight;e.value={width:l,height:u}});return i.observe(r,{box:"border-box"}),()=>i.unobserve(r)}else e.value=void 0}),{width:n,height:o}}const[Df,ew]=Xt("PopperRoot");var tw=G({inheritAttrs:!1,__name:"PopperRoot",setup(t){const e=x();return ew({anchor:e,onAnchorChange:n=>e.value=n}),(n,o)=>J(n.$slots,"default")}}),Pf=tw,nw=G({__name:"PopperAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t,{forwardRef:n,currentElement:o}=ke(),r=Df();return rf(()=>{r.onAnchorChange(e.reference??o.value)}),(i,s)=>(w(),L(g(Vt),{ref:g(n),as:i.as,"as-child":i.asChild},{default:A(()=>[J(i.$slots,"default")]),_:3},8,["as","as-child"]))}}),Iu=nw;function ow(t){return t!==null}function rw(t){return{name:"transformOrigin",options:t,fn(e){var n,o,r;const{placement:i,rects:s,middlewareData:a}=e,l=((n=a.arrow)==null?void 0:n.centerOffset)!==0,u=l?0:t.arrowWidth,c=l?0:t.arrowHeight,[d,p]=Sl(i),f={start:"0%",center:"50%",end:"100%"}[p],h=(((o=a.arrow)==null?void 0:o.x)??0)+u/2,m=(((r=a.arrow)==null?void 0:r.y)??0)+c/2;let v="",y="";return d==="bottom"?(v=l?f:`${h}px`,y=`${-c}px`):d==="top"?(v=l?f:`${h}px`,y=`${s.floating.height+c}px`):d==="right"?(v=`${-c}px`,y=l?f:`${m}px`):d==="left"&&(v=`${s.floating.width+c}px`,y=l?f:`${m}px`),{data:{x:v,y}}}}}function Sl(t){const[e,n="center"]=t.split("-");return[e,n]}const iw=["top","right","bottom","left"],Dn=Math.min,ft=Math.max,Ms=Math.round,Ji=Math.floor,zt=t=>({x:t,y:t}),sw={left:"right",right:"left",bottom:"top",top:"bottom"};function Ml(t,e,n){return ft(t,Dn(e,n))}function un(t,e){return typeof t=="function"?t(e):t}function cn(t){return t.split("-")[0]}function cr(t){return t.split("-")[1]}function xu(t){return t==="x"?"y":"x"}function Ou(t){return t==="y"?"height":"width"}function qt(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function $u(t){return xu(qt(t))}function aw(t,e,n){n===void 0&&(n=!1);const o=cr(t),r=$u(t),i=Ou(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ts(s)),[s,Ts(s)]}function lw(t){const e=Ts(t);return[Tl(t),e,Tl(e)]}function Tl(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Uc=["left","right"],Fc=["right","left"],uw=["top","bottom"],cw=["bottom","top"];function dw(t,e,n){switch(t){case"top":case"bottom":return n?e?Fc:Uc:e?Uc:Fc;case"left":case"right":return e?uw:cw;default:return[]}}function pw(t,e,n,o){const r=cr(t);let i=dw(cn(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Tl)))),i}function Ts(t){const e=cn(t);return sw[e]+t.slice(e.length)}function fw(t){return{top:0,right:0,bottom:0,left:0,...t}}function Nf(t){return typeof t!="number"?fw(t):{top:t,right:t,bottom:t,left:t}}function Is(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function jc(t,e,n){let{reference:o,floating:r}=t;const i=qt(e),s=$u(e),a=Ou(s),l=cn(e),u=i==="y",c=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2;let f;switch(l){case"top":f={x:c,y:o.y-r.height};break;case"bottom":f={x:c,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-r.width,y:d};break;default:f={x:o.x,y:o.y}}switch(cr(e)){case"start":f[s]-=p*(n&&u?-1:1);break;case"end":f[s]+=p*(n&&u?-1:1);break}return f}async function hw(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=un(e,t),h=Nf(f),m=a[p?d==="floating"?"reference":"floating":d],v=Is(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),y=d==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),E=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Is(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:l}):y);return{top:(v.top-b.top+h.top)/E.y,bottom:(b.bottom-v.bottom+h.bottom)/E.y,left:(v.left-b.left+h.left)/E.x,right:(b.right-v.right+h.right)/E.x}}const mw=50,gw=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:hw},l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:c,y:d}=jc(u,o,l),p=o,f=0;const h={};for(let m=0;m<i.length;m++){const v=i[m];if(!v)continue;const{name:y,fn:_}=v,{x:E,y:b,data:N,reset:S}=await _({x:c,y:d,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:u,platform:a,elements:{reference:t,floating:e}});c=E??c,d=b??d,h[y]={...h[y],...N},S&&f<mw&&(f++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(u=S.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):S.rects),{x:c,y:d}=jc(u,p,l)),m=-1)}return{x:c,y:d,placement:p,strategy:r,middlewareData:h}},vw=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:i,platform:s,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=un(t,e)||{};if(u==null)return{};const d=Nf(c),p={x:n,y:o},f=$u(r),h=Ou(f),m=await s.getDimensions(u),v=f==="y",y=v?"top":"left",_=v?"bottom":"right",E=v?"clientHeight":"clientWidth",b=i.reference[h]+i.reference[f]-p[f]-i.floating[h],N=p[f]-i.reference[f],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=S?S[E]:0;(!M||!await(s.isElement==null?void 0:s.isElement(S)))&&(M=a.floating[E]||i.floating[h]);const T=b/2-N/2,I=M/2-m[h]/2-1,O=Dn(d[y],I),B=Dn(d[_],I),$=O,R=M-m[h]-B,D=M/2-m[h]/2+T,C=Ml($,D,R),j=!l.arrow&&cr(r)!=null&&D!==C&&i.reference[h]/2-(D<$?O:B)-m[h]/2<0,W=j?D<$?D-$:D-R:0;return{[f]:p[f]+W,data:{[f]:C,centerOffset:D-C-W,...j&&{alignmentOffset:W}},reset:j}}}),yw=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=un(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=cn(r),_=qt(a),E=cn(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),N=p||(E||!m?[Ts(a)]:lw(a)),S=h!=="none";!p&&S&&N.push(...pw(a,m,h,b));const M=[a,...N],T=await l.detectOverflow(e,v),I=[];let O=((o=i.flip)==null?void 0:o.overflows)||[];if(c&&I.push(T[y]),d){const D=aw(r,s,b);I.push(T[D[0]],T[D[1]])}if(O=[...O,{placement:r,overflows:I}],!I.every(D=>D<=0)){var B,$;const D=(((B=i.flip)==null?void 0:B.index)||0)+1,C=M[D];if(C&&(!(d==="alignment"&&_!==qt(C))||O.every(W=>qt(W.placement)===_?W.overflows[0]>0:!0)))return{data:{index:D,overflows:O},reset:{placement:C}};let j=($=O.filter(W=>W.overflows[0]<=0).sort((W,ee)=>W.overflows[1]-ee.overflows[1])[0])==null?void 0:$.placement;if(!j)switch(f){case"bestFit":{var R;const W=(R=O.filter(ee=>{if(S){const oe=qt(ee.placement);return oe===_||oe==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(oe=>oe>0).reduce((oe,we)=>oe+we,0)]).sort((ee,oe)=>ee[1]-oe[1])[0])==null?void 0:R[0];W&&(j=W);break}case"initialPlacement":j=a;break}if(r!==j)return{reset:{placement:j}}}return{}}}};function qc(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function zc(t){return iw.some(e=>t[e]>=0)}const bw=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...i}=un(t,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),a=qc(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zc(a)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),a=qc(s,n.floating);return{data:{escapedOffsets:a,escaped:zc(a)}}}default:return{}}}}},Lf=new Set(["left","top"]);async function _w(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=cn(n),a=cr(n),l=qt(n)==="y",u=Lf.has(s)?-1:1,c=i&&l?-1:1,d=un(e,t);let{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof h=="number"&&(f=a==="end"?h*-1:h),l?{x:f*c,y:p*u}:{x:p*u,y:f*c}}const ww=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:a}=e,l=await _w(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},Ew=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:_,y:E}=y;return{x:_,y:E}}},...u}=un(t,e),c={x:n,y:o},d=await i.detectOverflow(e,u),p=qt(cn(r)),f=xu(p);let h=c[f],m=c[p];if(s){const y=f==="y"?"top":"left",_=f==="y"?"bottom":"right",E=h+d[y],b=h-d[_];h=Ml(E,h,b)}if(a){const y=p==="y"?"top":"left",_=p==="y"?"bottom":"right",E=m+d[y],b=m-d[_];m=Ml(E,m,b)}const v=l.fn({...e,[f]:h,[p]:m});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[f]:s,[p]:a}}}}}},kw=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:i,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=un(t,e),c={x:n,y:o},d=qt(r),p=xu(d);let f=c[p],h=c[d];const m=un(a,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=p==="y"?"height":"width",b=i.reference[p]-i.floating[E]+v.mainAxis,N=i.reference[p]+i.reference[E]-v.mainAxis;f<b?f=b:f>N&&(f=N)}if(u){var y,_;const E=p==="y"?"width":"height",b=Lf.has(cn(r)),N=i.reference[d]-i.floating[E]+(b&&((y=s.offset)==null?void 0:y[d])||0)+(b?0:v.crossAxis),S=i.reference[d]+i.reference[E]+(b?0:((_=s.offset)==null?void 0:_[d])||0)-(b?v.crossAxis:0);h<N?h=N:h>S&&(h=S)}return{[p]:f,[d]:h}}}},Sw=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:s,elements:a}=e,{apply:l=()=>{},...u}=un(t,e),c=await s.detectOverflow(e,u),d=cn(r),p=cr(r),f=qt(r)==="y",{width:h,height:m}=i.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=p==="end"?"top":"bottom");const _=m-c.top-c.bottom,E=h-c.left-c.right,b=Dn(m-c[v],_),N=Dn(h-c[y],E),S=!e.middlewareData.shift;let M=b,T=N;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(T=E),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(M=_),S&&!p){const O=ft(c.left,0),B=ft(c.right,0),$=ft(c.top,0),R=ft(c.bottom,0);f?T=h-2*(O!==0||B!==0?O+B:ft(c.left,c.right)):M=m-2*($!==0||R!==0?$+R:ft(c.top,c.bottom))}await l({...e,availableWidth:T,availableHeight:M});const I=await s.getDimensions(a.floating);return h!==I.width||m!==I.height?{reset:{rects:!0}}:{}}}};function la(){return typeof window<"u"}function bo(t){return Cu(t)?(t.nodeName||"").toLowerCase():"#document"}function ht(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qt(t){var e;return(e=(Cu(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Cu(t){return la()?t instanceof Node||t instanceof ht(t).Node:!1}function Rt(t){return la()?t instanceof Element||t instanceof ht(t).Element:!1}function hn(t){return la()?t instanceof HTMLElement||t instanceof ht(t).HTMLElement:!1}function Gc(t){return!la()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ht(t).ShadowRoot}function wi(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=Dt(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&r!=="inline"&&r!=="contents"}function Mw(t){return/^(table|td|th)$/.test(bo(t))}function ua(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const Tw=/transform|translate|scale|rotate|perspective|filter/,Iw=/paint|layout|strict|content/,Vn=t=>!!t&&t!=="none";let Ga;function Au(t){const e=Rt(t)?Dt(t):t;return Vn(e.transform)||Vn(e.translate)||Vn(e.scale)||Vn(e.rotate)||Vn(e.perspective)||!Ru()&&(Vn(e.backdropFilter)||Vn(e.filter))||Tw.test(e.willChange||"")||Iw.test(e.contain||"")}function xw(t){let e=Pn(t);for(;hn(e)&&!Yo(e);){if(Au(e))return e;if(ua(e))return null;e=Pn(e)}return null}function Ru(){return Ga==null&&(Ga=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ga}function Yo(t){return/^(html|body|#document)$/.test(bo(t))}function Dt(t){return ht(t).getComputedStyle(t)}function ca(t){return Rt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Pn(t){if(bo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Gc(t)&&t.host||Qt(t);return Gc(e)?e.host:e}function Bf(t){const e=Pn(t);return Yo(e)?t.ownerDocument?t.ownerDocument.body:t.body:hn(e)&&wi(e)?e:Bf(e)}function Qr(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Bf(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=ht(r);if(i){const a=Il(s);return e.concat(s,s.visualViewport||[],wi(r)?r:[],a&&n?Qr(a):[])}else return e.concat(r,Qr(r,[],n))}function Il(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Uf(t){const e=Dt(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=hn(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,a=Ms(n)!==i||Ms(o)!==s;return a&&(n=i,o=s),{width:n,height:o,$:a}}function Du(t){return Rt(t)?t:t.contextElement}function qo(t){const e=Du(t);if(!hn(e))return zt(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Uf(e);let s=(i?Ms(n.width):n.width)/o,a=(i?Ms(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Ow=zt(0);function Ff(t){const e=ht(t);return!Ru()||!e.visualViewport?Ow:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $w(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ht(t)?!1:e}function po(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=Du(t);let s=zt(1);e&&(o?Rt(o)&&(s=qo(o)):s=qo(t));const a=$w(i,n,o)?Ff(i):zt(0);let l=(r.left+a.x)/s.x,u=(r.top+a.y)/s.y,c=r.width/s.x,d=r.height/s.y;if(i){const p=ht(i),f=o&&Rt(o)?ht(o):o;let h=p,m=Il(h);for(;m&&o&&f!==h;){const v=qo(m),y=m.getBoundingClientRect(),_=Dt(m),E=y.left+(m.clientLeft+parseFloat(_.paddingLeft))*v.x,b=y.top+(m.clientTop+parseFloat(_.paddingTop))*v.y;l*=v.x,u*=v.y,c*=v.x,d*=v.y,l+=E,u+=b,h=ht(m),m=Il(h)}}return Is({width:c,height:d,x:l,y:u})}function da(t,e){const n=ca(t).scrollLeft;return e?e.left+n:po(Qt(t)).left+n}function jf(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-da(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function Cw(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=Qt(o),a=e?ua(e.floating):!1;if(o===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=zt(1);const c=zt(0),d=hn(o);if((d||!d&&!i)&&((bo(o)!=="body"||wi(s))&&(l=ca(o)),d)){const f=po(o);u=qo(o),c.x=f.x+o.clientLeft,c.y=f.y+o.clientTop}const p=s&&!d&&!i?jf(s,l):zt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+p.x,y:n.y*u.y-l.scrollTop*u.y+c.y+p.y}}function Aw(t){return Array.from(t.getClientRects())}function Rw(t){const e=Qt(t),n=ca(t),o=t.ownerDocument.body,r=ft(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=ft(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+da(t);const a=-n.scrollTop;return Dt(o).direction==="rtl"&&(s+=ft(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}const Hc=25;function Dw(t,e){const n=ht(t),o=Qt(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,a=0,l=0;if(r){i=r.width,s=r.height;const c=Ru();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const u=da(o);if(u<=0){const c=o.ownerDocument,d=c.body,p=getComputedStyle(d),f=c.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(o.clientWidth-d.clientWidth-f);h<=Hc&&(i-=h)}else u<=Hc&&(i+=u);return{width:i,height:s,x:a,y:l}}function Pw(t,e){const n=po(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=hn(t)?qo(t):zt(1),s=t.clientWidth*i.x,a=t.clientHeight*i.y,l=r*i.x,u=o*i.y;return{width:s,height:a,x:l,y:u}}function Vc(t,e,n){let o;if(e==="viewport")o=Dw(t,n);else if(e==="document")o=Rw(Qt(t));else if(Rt(e))o=Pw(e,n);else{const r=Ff(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Is(o)}function qf(t,e){const n=Pn(t);return n===e||!Rt(n)||Yo(n)?!1:Dt(n).position==="fixed"||qf(n,e)}function Nw(t,e){const n=e.get(t);if(n)return n;let o=Qr(t,[],!1).filter(a=>Rt(a)&&bo(a)!=="body"),r=null;const i=Dt(t).position==="fixed";let s=i?Pn(t):t;for(;Rt(s)&&!Yo(s);){const a=Dt(s),l=Au(s);!l&&a.position==="fixed"&&(r=null),(i?!l&&!r:!l&&a.position==="static"&&r&&(r.position==="absolute"||r.position==="fixed")||wi(s)&&!l&&qf(t,s))?o=o.filter(u=>u!==s):r=a,s=Pn(s)}return e.set(t,o),o}function Lw(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?ua(e)?[]:Nw(e,this._c):[].concat(n),o],s=Vc(e,i[0],r);let a=s.top,l=s.right,u=s.bottom,c=s.left;for(let d=1;d<i.length;d++){const p=Vc(e,i[d],r);a=ft(p.top,a),l=Dn(p.right,l),u=Dn(p.bottom,u),c=ft(p.left,c)}return{width:l-c,height:u-a,x:c,y:a}}function Bw(t){const{width:e,height:n}=Uf(t);return{width:e,height:n}}function Uw(t,e,n){const o=hn(e),r=Qt(e),i=n==="fixed",s=po(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=zt(0);function u(){l.x=da(r)}if(o||!o&&!i)if((bo(e)!=="body"||wi(r))&&(a=ca(e)),o){const f=po(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else r&&u();i&&!o&&r&&u();const c=r&&!o&&!i?jf(r,a):zt(0),d=s.left+a.scrollLeft-l.x-c.x,p=s.top+a.scrollTop-l.y-c.y;return{x:d,y:p,width:s.width,height:s.height}}function Ha(t){return Dt(t).position==="static"}function Wc(t,e){if(!hn(t)||Dt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qt(t)===n&&(n=n.ownerDocument.body),n}function zf(t,e){const n=ht(t);if(ua(t))return n;if(!hn(t)){let r=Pn(t);for(;r&&!Yo(r);){if(Rt(r)&&!Ha(r))return r;r=Pn(r)}return n}let o=Wc(t,e);for(;o&&Mw(o)&&Ha(o);)o=Wc(o,e);return o&&Yo(o)&&Ha(o)&&!Au(o)?n:o||xw(t)||n}const Fw=async function(t){const e=this.getOffsetParent||zf,n=this.getDimensions,o=await n(t.floating);return{reference:Uw(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function jw(t){return Dt(t).direction==="rtl"}const qw={convertOffsetParentRelativeRectToViewportRelativeRect:Cw,getDocumentElement:Qt,getClippingRect:Lw,getOffsetParent:zf,getElementRects:Fw,getClientRects:Aw,getDimensions:Bw,getScale:qo,isElement:Rt,isRTL:jw};function Gf(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function zw(t,e){let n=null,o;const r=Qt(t);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const u=t.getBoundingClientRect(),{left:c,top:d,width:p,height:f}=u;if(a||e(),!p||!f)return;const h=Ji(d),m=Ji(r.clientWidth-(c+p)),v=Ji(r.clientHeight-(d+f)),y=Ji(c),_={rootMargin:-h+"px "+-m+"px "+-v+"px "+-y+"px",threshold:ft(0,Dn(1,l))||1};let E=!0;function b(N){const S=N[0].intersectionRatio;if(S!==l){if(!E)return s();S?s(!1,S):o=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!Gf(u,t.getBoundingClientRect())&&s(),E=!1}try{n=new IntersectionObserver(b,{..._,root:r.ownerDocument})}catch{n=new IntersectionObserver(b,_)}n.observe(t)}return s(!0),i}function Gw(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=Du(t),c=r||i?[...u?Qr(u):[],...e?Qr(e):[]]:[];c.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=u&&a?zw(u,n):null;let p=-1,f=null;s&&(f=new ResizeObserver(y=>{let[_]=y;_&&_.target===u&&f&&e&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=f)==null||E.observe(e)})),n()}),u&&!l&&f.observe(u),e&&f.observe(e));let h,m=l?po(t):null;l&&v();function v(){const y=po(t);m&&!Gf(m,y)&&n(),m=y,h=requestAnimationFrame(v)}return n(),()=>{var y;c.forEach(_=>{r&&_.removeEventListener("scroll",n),i&&_.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const Hw=ww,Vw=Ew,Kc=yw,Ww=Sw,Kw=bw,Yw=vw,Jw=kw,Xw=(t,e,n)=>{const o=new Map,r={platform:qw,...n},i={...r.platform,_c:o};return gw(t,e,{...r,platform:i})};function Qw(t){return t!=null&&typeof t=="object"&&"$el"in t}function xl(t){if(Qw(t)){const e=t.$el;return Cu(e)&&bo(e)==="#comment"?null:e}return t}function Co(t){return typeof t=="function"?t():g(t)}function Zw(t){return{name:"arrow",options:t,fn(e){const n=xl(Co(t.element));return n==null?{}:Yw({element:n,padding:t.padding}).fn(e)}}}function Hf(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Yc(t,e){const n=Hf(t);return Math.round(e*n)/n}function e0(t,e,n){n===void 0&&(n={});const o=n.whileElementsMounted,r=P(()=>{var M;return(M=Co(n.open))!=null?M:!0}),i=P(()=>Co(n.middleware)),s=P(()=>{var M;return(M=Co(n.placement))!=null?M:"bottom"}),a=P(()=>{var M;return(M=Co(n.strategy))!=null?M:"absolute"}),l=P(()=>{var M;return(M=Co(n.transform))!=null?M:!0}),u=P(()=>xl(t.value)),c=P(()=>xl(e.value)),d=x(0),p=x(0),f=x(a.value),h=x(s.value),m=oa({}),v=x(!1),y=P(()=>{const M={position:f.value,left:"0",top:"0"};if(!c.value)return M;const T=Yc(c.value,d.value),I=Yc(c.value,p.value);return l.value?{...M,transform:"translate("+T+"px, "+I+"px)",...Hf(c.value)>=1.5&&{willChange:"transform"}}:{position:f.value,left:T+"px",top:I+"px"}});let _;function E(){if(u.value==null||c.value==null)return;const M=r.value;Xw(u.value,c.value,{middleware:i.value,placement:s.value,strategy:a.value}).then(T=>{d.value=T.x,p.value=T.y,f.value=T.strategy,h.value=T.placement,m.value=T.middlewareData,v.value=M!==!1})}function b(){typeof _=="function"&&(_(),_=void 0)}function N(){if(b(),o===void 0){E();return}if(u.value!=null&&c.value!=null){_=o(u.value,c.value,E);return}}function S(){r.value||(v.value=!1)}return le([i,s,a,r],E,{flush:"sync"}),le([u,c],N,{flush:"sync"}),le(r,S,{flush:"sync"}),uf()&&cf(b),{x:So(d),y:So(p),strategy:So(f),placement:So(h),middlewareData:So(m),isPositioned:So(v),floatingStyles:y,update:E}}const Vf={side:"bottom",sideOffset:0,sideFlip:!0,align:"center",alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:"partial",hideWhenDetached:!1,positionStrategy:"fixed",updatePositionStrategy:"optimized",prioritizePosition:!1},[qP,t0]=Xt("PopperContent");var n0=G({inheritAttrs:!1,__name:"PopperContent",props:sf({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Vf}),emits:["placed"],setup(t,{emit:e}){const n=t,o=e,r=Df(),{forwardRef:i,currentElement:s}=ke(),a=x(),l=x(),{width:u,height:c}=Z_(l),d=P(()=>n.side+(n.align!=="center"?`-${n.align}`:"")),p=P(()=>typeof n.collisionPadding=="number"?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),f=P(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),h=P(()=>({padding:p.value,boundary:f.value.filter(ow),altBoundary:f.value.length>0})),m=P(()=>({mainAxis:n.sideFlip,crossAxis:n.alignFlip})),v=p_(()=>[Hw({mainAxis:n.sideOffset+c.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&Kc({...h.value,...m.value}),n.avoidCollisions&&Vw({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky==="partial"?Jw():void 0,...h.value}),!n.prioritizePosition&&n.avoidCollisions&&Kc({...h.value,...m.value}),Ww({...h.value,apply:({elements:$,rects:R,availableWidth:D,availableHeight:C})=>{const{width:j,height:W}=R.reference,ee=$.floating.style;ee.setProperty("--reka-popper-available-width",`${D}px`),ee.setProperty("--reka-popper-available-height",`${C}px`),ee.setProperty("--reka-popper-anchor-width",`${j}px`),ee.setProperty("--reka-popper-anchor-height",`${W}px`)}}),l.value&&Zw({element:l.value,padding:n.arrowPadding}),rw({arrowWidth:u.value,arrowHeight:c.value}),n.hideWhenDetached&&Kw({strategy:"referenceHidden",...h.value})]),y=P(()=>n.reference??r.anchor.value),{floatingStyles:_,placement:E,isPositioned:b,middlewareData:N}=e0(y,a,{strategy:n.positionStrategy,placement:d,whileElementsMounted:(...$)=>Gw(...$,{layoutShift:!n.disableUpdateOnLayoutShift,animationFrame:n.updatePositionStrategy==="always"}),middleware:v}),S=P(()=>Sl(E.value)[0]),M=P(()=>Sl(E.value)[1]);rf(()=>{b.value&&o("placed")});const T=P(()=>{var $;const R=(($=N.value.arrow)==null?void 0:$.centerOffset)!==0;return n.hideShiftedArrow&&R}),I=x("");At(()=>{s.value&&(I.value=window.getComputedStyle(s.value).zIndex)});const O=P(()=>{var $;return(($=N.value.arrow)==null?void 0:$.x)??0}),B=P(()=>{var $;return(($=N.value.arrow)==null?void 0:$.y)??0});return t0({placedSide:S,onArrowChange:$=>l.value=$,arrowX:O,arrowY:B,shouldHideArrow:T}),($,R)=>{var D,C,j;return w(),z("div",{ref_key:"floatingRef",ref:a,"data-reka-popper-content-wrapper":"",style:Mt({...g(_),transform:g(b)?g(_).transform:"translate(0, -200%)",minWidth:"max-content",zIndex:I.value,"--reka-popper-transform-origin":[(D=g(N).transformOrigin)==null?void 0:D.x,(C=g(N).transformOrigin)==null?void 0:C.y].join(" "),...((j=g(N).hide)==null?void 0:j.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}})},[q(g(Vt),ye({ref:g(i)},$.$attrs,{"as-child":n.asChild,as:$.as,"data-side":S.value,"data-align":M.value,style:{animation:g(b)?void 0:"none"}}),{default:A(()=>[J($.$slots,"default")]),_:3},16,["as-child","as","data-side","data-align","style"])],4)}}}),Wf=n0;function xs(t,e="reka"){var n;let o;return o=(n=Bv)==null?void 0:n.call(Hv),e?`${e}-${o}`:o}const[dr,o0]=Xt("PopoverRoot");var r0=G({__name:"PopoverRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},modal:{type:Boolean,required:!1,default:!1}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{modal:r}=Ht(n),i=sa(n,"open",o,{defaultValue:n.defaultOpen,passive:n.open===void 0}),s=x(),a=x(!1);return o0({contentId:"",triggerId:"",modal:r,open:i,onOpenChange:l=>{i.value=l},onOpenToggle:()=>{i.value=!i.value},triggerElement:s,hasCustomAnchor:a}),(l,u)=>(w(),L(g(Pf),null,{default:A(()=>[J(l.$slots,"default",{open:g(i),close:()=>i.value=!1})]),_:3}))}}),Pu=r0,i0=G({__name:"PopoverContentImpl",props:{trapFocus:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Rf(w_(n,"trapFocus","disableOutsidePointerEvents")),{forwardRef:i}=ke(),s=dr();return Af(),(a,l)=>(w(),L(g(Mu),{"as-child":"",loop:"",trapped:a.trapFocus,onMountAutoFocus:l[5]||(l[5]=u=>o("openAutoFocus",u)),onUnmountAutoFocus:l[6]||(l[6]=u=>o("closeAutoFocus",u))},{default:A(()=>[q(g(Su),{"as-child":"","disable-outside-pointer-events":a.disableOutsidePointerEvents,onPointerDownOutside:l[0]||(l[0]=u=>o("pointerDownOutside",u)),onInteractOutside:l[1]||(l[1]=u=>o("interactOutside",u)),onEscapeKeyDown:l[2]||(l[2]=u=>o("escapeKeyDown",u)),onFocusOutside:l[3]||(l[3]=u=>o("focusOutside",u)),onDismiss:l[4]||(l[4]=u=>g(s).onOpenChange(!1))},{default:A(()=>[q(g(Wf),ye(g(r),{id:g(s).contentId,ref:g(i),"data-state":g(s).open.value?"open":"closed","aria-labelledby":g(s).triggerId,style:{"--reka-popover-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-popover-content-available-width":"var(--reka-popper-available-width)","--reka-popover-content-available-height":"var(--reka-popper-available-height)","--reka-popover-trigger-width":"var(--reka-popper-anchor-width)","--reka-popover-trigger-height":"var(--reka-popper-anchor-height)"},role:"dialog"}),{default:A(()=>[J(a.$slots,"default")]),_:3},16,["id","data-state","aria-labelledby"])]),_:3},8,["disable-outside-pointer-events"])]),_:3},8,["trapped"]))}}),Kf=i0,s0=G({__name:"PopoverContentModal",props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=dr(),i=x(!1);Eu(!0);const s=yo(n,o),{forwardRef:a,currentElement:l}=ke();return ku(l),(u,c)=>(w(),L(Kf,ye(g(s),{ref:g(a),"trap-focus":g(r).open.value,"disable-outside-pointer-events":"",onCloseAutoFocus:c[0]||(c[0]=oo(d=>{var p;o("closeAutoFocus",d),i.value||(p=g(r).triggerElement.value)==null||p.focus()},["prevent"])),onPointerDownOutside:c[1]||(c[1]=d=>{o("pointerDownOutside",d);const p=d.detail.originalEvent,f=p.button===0&&p.ctrlKey===!0,h=p.button===2||f;i.value=h}),onFocusOutside:c[2]||(c[2]=oo(()=>{},["prevent"]))}),{default:A(()=>[J(u.$slots,"default")]),_:3},16,["trap-focus"]))}}),a0=s0,l0=G({__name:"PopoverContentNonModal",props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=dr(),i=x(!1),s=x(!1),a=yo(n,o);return(l,u)=>(w(),L(Kf,ye(g(a),{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:u[0]||(u[0]=c=>{var d;o("closeAutoFocus",c),c.defaultPrevented||(i.value||(d=g(r).triggerElement.value)==null||d.focus(),c.preventDefault()),i.value=!1,s.value=!1}),onInteractOutside:u[1]||(u[1]=async c=>{var d;o("interactOutside",c),c.defaultPrevented||(i.value=!0,c.detail.originalEvent.type==="pointerdown"&&(s.value=!0));const p=c.target;(d=g(r).triggerElement.value)!=null&&d.contains(p)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.value&&c.preventDefault()})}),{default:A(()=>[J(l.$slots,"default")]),_:3},16))}}),u0=l0,c0=G({__name:"PopoverContent",props:{forceMount:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=dr(),i=yo(n,o),{forwardRef:s}=ke();return r.contentId||(r.contentId=xs(void 0,"reka-popover-content")),(a,l)=>(w(),L(g(aa),{present:a.forceMount||g(r).open.value},{default:A(()=>[g(r).modal.value?(w(),L(a0,ye({key:0},g(i),{ref:g(s)}),{default:A(()=>[J(a.$slots,"default")]),_:3},16)):(w(),L(u0,ye({key:1},g(i),{ref:g(s)}),{default:A(()=>[J(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),Nu=c0,d0=G({__name:"PopoverPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(w(),L(g(Tu),ln(vo(e)),{default:A(()=>[J(n.$slots,"default")]),_:3},16))}}),Lu=d0,p0=G({__name:"PopoverTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(t){const e=t,n=dr(),{forwardRef:o,currentElement:r}=ke();return n.triggerId||(n.triggerId=xs(void 0,"reka-popover-trigger")),tt(()=>{n.triggerElement.value=r.value}),(i,s)=>(w(),L(lt(g(n).hasCustomAnchor.value?g(Vt):g(Iu)),{"as-child":""},{default:A(()=>[q(g(Vt),{id:g(n).triggerId,ref:g(o),type:i.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":g(n).open.value,"aria-controls":g(n).contentId,"data-state":g(n).open.value?"open":"closed",as:i.as,"as-child":e.asChild,onClick:g(n).onOpenToggle},{default:A(()=>[J(i.$slots,"default")]),_:3},8,["id","type","aria-expanded","aria-controls","data-state","as","as-child","onClick"])]),_:3}))}}),Yf=p0,_e=(t=>(t.TEXT="text",t.IMAGE="image",t.VIDEO="video",t.FILE="file",t.MENTION="mention",t.EMOJI="emoji",t))(_e||{});function Jf(t){switch(t.type){case _e.TEXT:return{type:"text",text:t.content};case _e.IMAGE:{const e=t.content,n=URL.createObjectURL(e);return{type:_e.IMAGE,attrs:{src:n,alt:e==null?void 0:e.name,fileData:e,title:e==null?void 0:e.name}}}case _e.EMOJI:{const e=t.content;return{type:_e.EMOJI,attrs:{src:e.url,alt:e.key,title:e.text}}}default:return{type:"text",text:String(t.content)}}}function f0(t){if(t.length===0)return[];let e=-1,n=-1;for(let o=0;o<t.length;o++){const r=t[o];(r.type!==_e.TEXT||r.content.trim().length>0)&&(e===-1&&(e=o),n=o)}return e===-1?[]:t.slice(e,n+1).map((o,r,i)=>{if(o.type===_e.TEXT){let s=o.content;return r===0&&(s=s.trimStart()),r===i.length-1&&(s=s.trimEnd()),{...o,content:s}}return o}).filter(o=>o.type===_e.TEXT?o.content.length>0:!0)}function Xf(t){return t!=null&&t.content?t.content.flatMap((e,n)=>{var o,r,i,s,a,l,u;switch(e.type){case"text":return e.text?[{type:_e.TEXT,content:e.text}]:[];case"image":return[{type:_e.IMAGE,content:(o=e.attrs)==null?void 0:o.fileData}];case"emoji":return[{type:_e.EMOJI,content:{url:(r=e.attrs)==null?void 0:r.src,key:(i=e.attrs)==null?void 0:i.alt,text:(s=e.attrs)==null?void 0:s.title}}];case"hardBreak":return[{type:_e.TEXT,content:`
|
||
`}];case"mention":return[{type:_e.MENTION,content:{id:(a=e.attrs)==null?void 0:a.id,label:(l=e.attrs)==null?void 0:l.label,mentionSuggestionChar:(u=e.attrs)==null?void 0:u.mentionSuggestionChar}}];default:{const c=Xf(e);return e.type==="paragraph"&&n>0?[{type:_e.TEXT,content:`
|
||
`},...c]:c}}}):[]}const Va="https://web.sdk.qcloud.com/im/assets/emoji-plugin/",Mr={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"};function Ei(t){if(!t)return"";const e=/(\[.+?\])/g;let n=t;return e.test(t)&&(n=t.replace(e,o=>Mr[o]?qe.t(`Emoji.${o}`):o)),n}const Wa={};function Ol(t){var e;if(!t)return"";const n=/(\[.+?\])/g;let o=t;if(n.test(t)){const r=qe.language;if(!Wa[r]){const i=qe.getDataByLanguage(r);(e=i==null?void 0:i.translation)!=null&&e.Emoji&&(Wa[r]=Object.fromEntries(Object.entries(i.translation.Emoji).map(([s,a])=>[a,s])))}o=t.replace(n,i=>{var s;return((s=Wa[r])==null?void 0:s[i])??i})}return o}function h0(t){var e;const n=$e.getData(Tt.USER,"userProfile");return t.type===Ne.C2C?(n==null?void 0:n.nick)||(n==null?void 0:n.userID)||"":((e=t.getShowName)==null?void 0:e.call(t))||""}function m0(t,e,n){if(t===ie.TEXT)return Ei((e==null?void 0:e.text)||"");if(t===ie.CUSTOM&&e.description)return e.description;const o={[ie.TEXT]:"OfflinePush.text",[ie.IMAGE]:"OfflinePush.image",[ie.VIDEO]:"OfflinePush.video",[ie.FILE]:"OfflinePush.file",[ie.AUDIO]:"OfflinePush.audio",[ie.FACE]:"OfflinePush.face",[ie.LOCATION]:"OfflinePush.location",[ie.MERGER]:"OfflinePush.merger",[ie.CUSTOM]:"OfflinePush.custom"}[t]||"OfflinePush.custom";return n(o)}function g0(t){var e;const n=$e.getData(Tt.USER,"userProfile"),o={sender:t.type===Ne.GROUP?(e=t.groupProfile)==null?void 0:e.groupID:n==null?void 0:n.userID,nickName:(n==null?void 0:n.nick)||"",chatType:t.type===Ne.GROUP?2:1,version:1,action:1};return JSON.stringify({entity:o})}function v0(t,e,n,o,r,i){return{title:h0(t),description:m0(e,n,o),extension:g0(t),androidInfo:r,apnsInfo:i}}const Xi=x(null);function Bu(){function t(r){Xi.value=r}function e(r){const i=Xi.value;if(!(i!=null&&i.chatOfflinePushInfo))return;const s=i.chatOfflinePushInfo,a=l=>qe.t(l);return v0(r.conversation,r.messageType,r.payload||{},a,s.androidInfo,s.apnsInfo)}function n(){const r=Xi.value;return r==null?void 0:r.callOfflinePushInfo}function o(){return Xi.value!==null}return{setOfflinePushInfo:t,createChatOfflinePushInfo:e,createCallOfflinePushInfo:n,isEnabled:o}}let Jc;const Os=x(void 0),$s=x(void 0),Uu=x(void 0),Qf=x(void 0),Zf=x(void 0),Fu=x(void 0),eh=x(new Set),Cs=x(new Set);function y0(){Os.value=void 0,$s.value=void 0,Uu.value=void 0,Qf.value=void 0,Fu.value=void 0,Cs.value=new Set}function b0(t){Zf.value=t}function _0(t){Fu.value=t}function w0({messageID:t,duration:e}){Cs.value.add(t),setTimeout(()=>{Cs.value.delete(t)},e)}async function E0(){return ot.getMessageList()}function ki(){return{activeConversationID:Os,messageList:$s,hasMoreOlderMessage:Uu,hasMoreNewerMessage:Qf,enableReadReceipt:Zf,isDisableScroll:Fu,recalledMessageIDSet:eh,highlightMessageIDSet:Cs,loadMoreOlderMessage:E0,setEnableReadReceipt:b0,setIsDisableScroll:_0,highlightMessage:w0}}const k0=()=>{function t(o){if(!Os.value)return;function r(s){return{...s,status:s.status,progress:s.progress,isRevoked:s.isRevoked,isDeleted:s.isDeleted,isPeerRead:s.isPeerRead,readReceiptInfo:s.readReceiptInfo?{...s.readReceiptInfo,readCount:s.readReceiptInfo.readCount,unreadCount:s.readReceiptInfo.unreadCount,isPeerRead:s.readReceiptInfo.isPeerRead}:s.readReceiptInfo,getMessageContent:()=>s.getMessageContent(),deleteMessage:()=>s.deleteMessage(),revokeMessage:()=>s.revokeMessage(),resendMessage:()=>s.resendMessage(),getSignalingInfo:()=>s.getSignalingInfo(),modifyMessage:a=>s.modifyMessage(a),quoteMessage:()=>s.quoteMessage(),replyMessage:()=>s.replyMessage()}}const i=o.map(r);$s.value=i,$s.value.forEach(s=>{s.isRevoked&&eh.value.add(s.ID)})}function e(o){Uu.value=!o}function n(o){(!o||o!==Jc)&&(y0(),Os.value=o),Jc=o||void 0}$e.watch(Tt.CONV,{currentConversationID:n}),$e.watch(Tt.CHAT,{messageList:t,isCompleted:e})};k0();const ju=x(void 0),qu=x(void 0),th=x(0),S0=x(ce.TYPES.NET_STATE_CONNECTED),M0=t=>{ju.value=t},T0=t=>{th.value=t},I0=t=>{qu.value=t},pa=t=>{var e;return(e=ju.value)==null?void 0:e.find(n=>n.conversationID===t)},nh=(t,e)=>{const n=pa(t),{markList:o=[],unreadCount:r=0}=n||{},i=o.includes(ce.TYPES.CONV_MARK_TYPE_UNREAD),s=r>0;return!n||e&&(s||i)||!e&&!s&&!i?Promise.resolve():s&&!e?n==null?void 0:n.setMessageRead():yi.markConversation({conversationIDList:[t],markType:ce.TYPES.CONV_MARK_TYPE_UNREAD,enableMark:e})},x0=async t=>{const e=qu.value;t!==(e==null?void 0:e.conversationID)&&(t&&nh(t,!1),await yi.switchConversation(t))},O0=(t,e)=>{const n=pa(t);return!n||(n==null?void 0:n.isPinned)===e?Promise.resolve():n==null?void 0:n.pinConversation()},$0=t=>{const e=pa(t);return e?e==null?void 0:e.deleteConversation():Promise.resolve()},C0=(t,e)=>{const n=pa(t);return!n||(n==null?void 0:n.isMuted)===e?Promise.resolve():n==null?void 0:n.muteConversation()},A0=t=>yi.setConversationDraft(t),R0=async t=>(await yi.getConversationProfile(`C2C${t}`)).data.conversation,D0=async t=>{const{groupID:e,...n}=t,o=n;t.type!==ce.TYPES.GRP_COMMUNITY&&(o.groupID=e||"");const r=await gt.createGroup(o),{type:i}=r.data.group;return i===ce.TYPES.GRP_AVCHATROOM&&await gt.joinGroup({groupID:r.data.group.groupID,applyMessage:""}),(await yi.getConversationProfile(`GROUP${r.data.group.groupID}`)).data.conversation};function P0(){$e.watch(Tt.CONV,{conversationList:t=>{M0(t)},currentConversation:t=>{I0(t??void 0)},totalUnreadCount:t=>{T0(t)}})}P0();function Bn(){return{conversationList:ju,activeConversation:qu,totalUnRead:th,netStatus:S0,setActiveConversation:x0,markConversationUnread:nh,pinConversation:O0,deleteConversation:$0,muteConversation:C0,setConversationDraft:A0,createC2CConversation:R0,createGroupConversation:D0}}const Xe=x(null),As=x(""),oh=x(!1),{setOfflinePushInfo:N0,createChatOfflinePushInfo:L0,isEnabled:B0}=Bu();function Qn(t){const{messageType:e,payload:n,options:o}=t;if(o!=null&&o.offlinePushInfo||!B0())return o;const{activeConversation:r}=Bn();if(!r.value)return o;const i=L0({conversation:r.value,messageType:e,payload:n||{}});return i?{...o,offlinePushInfo:i}:o}const U0=t=>{if(typeof t!="string"&&!Array.isArray(t)){console.warn("Invalid input type for updateRawValue");return}typeof t=="string"?As.value=t.trim():As.value=(t==null?void 0:t.length)>0?t:""},F0=t=>{Xe.value&&Xe.value.destroy(),Xe.value=t},j0=t=>{if(Xe.value){if(typeof t=="string")Xe.value.commands.setContent(t,!0);else{const e=t.map(Jf);Xe.value.commands.setContent(e,!0)}Xe.value.commands.focus()}},q0=(t,e=!0)=>{if(Xe.value){if(typeof t=="string")Xe.value.commands.insertContent(t);else{const n=t.map(Jf);Xe.value.commands.insertContent(n)}e&&Xe.value.commands.focus()}},z0=()=>{var t;(t=Xe.value)==null||t.commands.focus()},G0=()=>{var t;(t=Xe.value)==null||t.commands.blur()},H0=async t=>{const{enableReadReceipt:e}=ki(),n={needReadReceipt:e.value||!1};let o=t;o===void 0&&Xe.value&&(o=Xf(Xe.value.getJSON()));const r=V0(o??As.value);if(r)try{typeof r=="string"?await ot.sendTextMessage({payload:{text:Ol(r)},...n},Qn({messageType:ie.TEXT,payload:{text:Ol(r)}})):await W0(r,n)}catch(i){throw ia(i),i}};function V0(t){if(typeof t=="string")return t.trim()||null;const e=f0(t);return e.length>0?e:null}async function W0(t,e){const n=[],o=[],r=async()=>{if(n.length===0)return;const l=Ei(n.join("")),u=Ol(l);n.length=0,o.length>0?(await ot.sendTextAtMessage({payload:{text:u,atUserList:o},...e},Qn({messageType:ie.TEXT,payload:{text:l}})),o.length=0):await ot.sendTextMessage({payload:{text:u},...e},Qn({messageType:ie.TEXT,payload:{text:l}}))},i=async l=>{switch(l.type){case _e.TEXT:n.push(l.content);break;case _e.EMOJI:n.push(l.content.key);break;case _e.MENTION:o.push(l.content.id),n.push(l.content.mentionSuggestionChar+l.content.label);break;case _e.IMAGE:await r(),await ot.sendImageMessage({payload:{file:l.content},...e},Qn({messageType:ie.IMAGE,payload:{file:l.content.name}}));break;case _e.VIDEO:await r(),await ot.sendVideoMessage({payload:{file:l.content},...e},Qn({messageType:ie.VIDEO,payload:{file:l.content.name}}));break;case _e.FILE:await r(),await ot.sendFileMessage({payload:{file:l.content},...e},Qn({messageType:ie.FILE,payload:{file:l.content.name}}));break;default:console.warn(`[MessageInput] Unknown message type: ${l==null?void 0:l.type}, skipping`);break}};let s=0;const a=t.length;for(;s<a;)await i(t[s]),s+=1;await r()}const K0=(t,e)=>ot.sendCustomMessage(t,Qn({messageType:ie.CUSTOM,payload:t.payload,options:e}));function Un(){return{inputRawValue:As,isPeerTyping:oh,updateRawValue:U0,setEditorInstance:F0,setContent:j0,insertContent:q0,focusEditor:z0,blurEditor:G0,sendMessage:H0,sendCustomMessage:K0,setOfflinePushInfo:N0}}function Y0(){$e.watch(Tt.CHAT,{typingStatus:t=>{oh.value=t}})}Y0();const J0=["accept"],X0=G({__name:"FilePicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e={ACCEPT_TYPE:"*/*"},n=t,o=Jt(),{sendMessage:r}=Un(),i=x(null);function s(){var l;n.disabled||(l=i.value)==null||l.click()}function a(l){var u;const c=l.target,d=(u=c.files)==null?void 0:u[0];d&&(r([{type:_e.FILE,content:d}]),c.value="")}return(l,u)=>(w(),L(g(Q),null,{default:A(()=>[V("div",{onClick:s},[J(l.$slots,"default",{},()=>[V("div",{class:F(g(pe)(g(o)["file-picker__button"],{[g(o).disabled]:n.disabled}))},[q(g(tf),{size:n.iconSize,class:F(g(pe)(g(o)["file-picker__icon"]))},null,8,["size","class"])],2)])]),V("input",{ref_key:"fileInputRef",ref:i,type:"file",accept:e.ACCEPT_TYPE,hidden:"",onChange:a},null,40,J0)]),_:3}))}}),Q0="_disabled_o5cim_16",Z0={"file-picker__button":"_file-picker__button_o5cim_1",disabled:Q0,"file-picker__icon":"_file-picker__icon_o5cim_22"},eE={$style:Z0},zu=se(X0,[["__cssModules",eE]]),tE=["accept"],nE=G({__name:"ImagePicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const{t:e}=Ee(),n=["image/jpg","image/jpeg","image/gif","image/bmp","image/png","image/webp"];function o(c){return n.includes(c.type)}const r=t,i=Jt(),{sendMessage:s}=Un(),a=x(null);function l(){var c;r.disabled||(c=a.value)==null||c.click()}function u(c){var d;const p=c.target,f=(d=p.files)==null?void 0:d[0];if(f){if(!o(f)){Bt.error({message:e("MessageInput.invalid_image_type")});return}s([{type:_e.IMAGE,content:f}]),p.value=""}}return(c,d)=>(w(),L(g(Q),null,{default:A(()=>[V("div",{onClick:l},[J(c.$slots,"default",{},()=>[V("div",{class:F(g(pe)(g(i)["image-picker__button"],{[g(i).disabled]:r.disabled}))},[q(g(yv),{size:r.iconSize,class:F(g(pe)(g(i)["image-picker__icon"]))},null,8,["size","class"])],2)])]),V("input",{ref_key:"fileInputRef",ref:a,type:"file",accept:n.join(","),hidden:"",onChange:u},null,40,tE)]),_:3}))}}),oE="_disabled_xwls5_16",rE={"image-picker__button":"_image-picker__button_xwls5_1",disabled:oE,"image-picker__icon":"_image-picker__icon_xwls5_22"},iE={$style:rE},Gu=se(nE,[["__cssModules",iE]]),sE=["accept"],aE=G({__name:"VideoPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e={ACCEPT_TYPE:".mp4,.mov,.qt"},n=t,o=Jt(),{sendMessage:r}=Un(),i=x(null);function s(){var l;n.disabled||(l=i.value)==null||l.click()}function a(l){var u;const c=l.target,d=(u=c.files)==null?void 0:u[0];d&&(r([{type:_e.VIDEO,content:d}]),c.value="")}return(l,u)=>(w(),L(g(Q),null,{default:A(()=>[V("div",{onClick:s},[J(l.$slots,"default",{},()=>[V("div",{class:F(g(pe)(g(o)["video-picker__button"],{[g(o).disabled]:n.disabled}))},[q(g(bv),{size:n.iconSize,class:F(g(pe)(g(o)["video-picker__icon"]))},null,8,["size","class"])],2)])]),V("input",{ref_key:"fileInputRef",ref:i,type:"file",accept:e.ACCEPT_TYPE,hidden:"",onChange:a},null,40,sE)]),_:3}))}}),lE="_disabled_1skpb_16",uE={"video-picker__button":"_video-picker__button_1skpb_1",disabled:lE,"video-picker__icon":"_video-picker__icon_1skpb_22"},cE={$style:uE},rh=se(aE,[["__cssModules",cE]]),Qi={"attachment-picker":"_attachment-picker_1bduq_1","attachment-picker__icon":"_attachment-picker__icon_1bduq_5","attachment-picker__popup":"_attachment-picker__popup_1bduq_9","attachment-picker--expanded":"_attachment-picker--expanded_1bduq_19","attachment-picker__item":"_attachment-picker__item_1bduq_24","attachment-picker__item-icon":"_attachment-picker__item-icon_1bduq_48"},Xc=G({__name:"AttachmentPicker",props:{attachmentPickerMode:{default:"collapsed"}},setup(t){const e={COLLAPSED:18,EXPANDED:24},n=t,{t:o}=Ee(),r=P(()=>n.attachmentPickerMode==="collapsed"),i=P(()=>[{type:"file",Component:zu},{type:"image",Component:Gu},{type:"video",Component:rh}].map(({type:s,Component:a})=>({Component:a,props:{label:r.value?o(`MessageInput.${s}`):"",iconSize:r.value?e.COLLAPSED:e.EXPANDED}})));return(s,a)=>(w(),z("div",{class:F([g(Qi)["attachment-picker"]])},[r.value?(w(),L(g(Pu),{key:0},{default:A(()=>[q(g(Yf),{as:"div"},{default:A(()=>[J(s.$slots,"default",{},()=>[q(g(_v),{class:F(g(Qi)["attachment-picker__icon"]),size:"20"},null,8,["class"])])]),_:3}),q(g(Lu),null,{default:A(()=>[q(g(Nu),{side:"top",align:"start","side-offset":5},{default:A(()=>[V("div",{class:F(g(Qi)["attachment-picker__popup"])},[(w(!0),z(he,null,ze(i.value,(l,u)=>(w(),L(lt(l.Component),ye({key:u},{ref_for:!0},l.props),null,16))),128))],2)]),_:1})]),_:1})]),_:3})):(w(),z("div",{key:1,class:F(g(Qi)["attachment-picker--expanded"])},[(w(!0),z(he,null,ze(i.value,(l,u)=>(w(),L(lt(l.Component),ye({key:u},{ref_for:!0},l.props),null,16))),128))],2))],2))}}),dE=["onClick"],pE=["src","alt"],fE=G({name:"EmojiPicker",inheritAttrs:!1,__name:"EmojiPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=x(!1),o=Jt(),{t:r}=Ee(),{insertContent:i}=Un();tt(()=>{Object.values(Mr).forEach(l=>{const u=new Image;u.src=Va+l})});const s=l=>{e.disabled||(n.value=l)};function a(l){l&&i([{type:_e.EMOJI,content:{url:Va+Mr[l],key:l,text:Ei(l)}}])}return(l,u)=>(w(),L(g(Q),null,{default:A(()=>[q(g(Pu),{open:n.value,"onUpdate:open":s},{default:A(()=>[q(g(Yf),{as:"div",disabled:e.disabled},{default:A(()=>[V("div",ye({"data-test":"test",class:g(pe)(g(o)["emoji-picker__button"],{[g(o).disabled]:e.disabled})},l.$attrs),[J(l.$slots,"default",{},()=>[q(g(wv),{class:F(g(o)["emoji-picker__icon"]),size:e.iconSize},null,8,["class","size"])])],16)]),_:3},8,["disabled"]),q(g(Lu),null,{default:A(()=>[q(g(Nu),{side:"top",align:"start","side-offset":5},{default:A(()=>[V("div",null,[V("div",{class:F(g(o)["emoji-picker__list"])},[(w(!0),z(he,null,ze(Object.keys(g(Mr)),c=>(w(),z("div",{key:c,class:F(g(o)["emoji-picker__list-item"]),onClick:d=>a(c)},[V("img",{class:F(g(o)["emoji-picker__list-item"]),src:g(Va)+g(Mr)[c],alt:g(r)(`Emoji.${c}`)},null,10,pE)],10,dE))),128))],2)])]),_:1})]),_:1})]),_:3},8,["open"])]),_:3}))}}),hE="_disabled_kxj4t_16",mE={"emoji-picker__button":"_emoji-picker__button_kxj4t_1",disabled:hE,"emoji-picker__icon":"_emoji-picker__icon_kxj4t_22","emoji-picker__list":"_emoji-picker__list_kxj4t_25","emoji-picker__list-item":"_emoji-picker__list-item_kxj4t_36"},gE={$style:mE},ih=se(fE,[["__cssModules",gE]]);function Ae(t){this.content=t}Ae.prototype={constructor:Ae,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new Ae(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ae(n)},addToStart:function(t,e){return new Ae([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ae(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new Ae(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ae.from(t),t.size?new Ae(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ae.from(t),t.size?new Ae(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ae.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ae.from=function(t){if(t instanceof Ae)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ae(e)};function sh(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=sh(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function ah(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,o-=l;continue}if(!s.sameMarkup(a))return{a:n,b:o};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,o--;return{a:n,b:o}}if(s.content.size||a.content.size){let u=ah(s.content,a.content,n-1,o-1);if(u)return u}n-=l,o-=l}}let H=class Je{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&o(l,r+a,i||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),o,r+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?r?typeof r=="function"?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Je(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),o.push(a),r+=a.nodeSize),s=l}return new Je(o,r)}cutByIndex(e,n){return e==n?Je.empty:e==0&&n==this.content.length?this:new Je(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new Je(r,i)}addToStart(e){return new Je([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Je(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return sh(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return ah(this,e,n,o)}findIndex(e){if(e==0)return Zi(0,e);if(e==this.size)return Zi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Zi(n+1,i):Zi(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Je.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Je(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Je.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new Je(n||e,o)}static from(e){if(!e)return Je.empty;if(e instanceof Je)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Je([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};H.empty=new H([],0);const Ka={index:0,offset:0};function Zi(t,e){return Ka.index=t,Ka.offset=e,Ka}function Rs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!Rs(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!Rs(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let be=class $l{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $l.none;if(e instanceof $l)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};be.none=[];let Ds=class extends Error{},K=class Ao{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=uh(this.content,e+this.openStart,n);return o&&new Ao(o,this.openStart,this.openEnd)}removeBetween(e,n){return new Ao(lh(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ao.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ao(H.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new Ao(e,o,r)}};K.empty=new K(H.empty,0,0);function lh(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:a}=t.findIndex(n);if(r==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(lh(i.content,e-r-1,n-r-1)))}function uh(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=uh(s.content,e-i-1,n,s);return a&&t.replaceChild(r,s.copy(a))}function vE(t,e,n){if(n.openStart>t.depth)throw new Ds("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ds("Inconsistent open depths");return ch(t,e,n,0)}function ch(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=ch(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,a=s.content;return io(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=yE(n,t);return io(i,ph(t,s,a,e,o))}else return io(i,Ps(t,e,o))}function dh(t,e){if(!e.type.compatibleContent(t.type))throw new Ds("Cannot join "+e.type.name+" onto "+t.type.name)}function Cl(t,e,n){let o=t.node(n);return dh(o,e.node(n)),o}function ro(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(ro(t.nodeAfter,o),i++));for(let a=i;a<s;a++)ro(r.child(a),o);e&&e.depth==n&&e.textOffset&&ro(e.nodeBefore,o)}function io(t,e){return t.type.checkContent(e),t.copy(e)}function ph(t,e,n,o,r){let i=t.depth>r&&Cl(t,e,r+1),s=o.depth>r&&Cl(n,o,r+1),a=[];return qr(null,t,r,a),i&&s&&e.index(r)==n.index(r)?(dh(i,s),ro(io(i,ph(t,e,n,o,r+1)),a)):(i&&ro(io(i,Ps(t,e,r+1)),a),qr(e,n,r,a),s&&ro(io(s,Ps(n,o,r+1)),a)),qr(o,null,r,a),new H(a)}function Ps(t,e,n){let o=[];if(qr(null,t,n,o),t.depth>n){let r=Cl(t,e,n+1);ro(io(r,Ps(t,e,n+1)),o)}return qr(e,null,n,o),new H(o)}function yE(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let r=n-1;r>=0;r--)o=e.node(r).copy(H.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}let Qc=class Al{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return be.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let a=o;o=r,r=a}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Ns(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),u=i-l;if(o.push(s,a,r+l),!u||(s=s.child(a),s.isText))break;i=u-1,r+=l+1}return new Al(n,o,i)}static resolveCached(e,n){let o=Zc.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Zc.set(e,o=new bE);let r=o.elts[o.i]=Al.resolve(e,n);return o.i=(o.i+1)%_E,r}};class bE{constructor(){this.elts=[],this.i=0}}const _E=12,Zc=new WeakMap;let Ns=class{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const wE=Object.create(null);let rn=class Rl{constructor(e,n,o,r=be.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||H.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&Rs(this.attrs,n||e.defaultAttrs||wE)&&be.sameSet(this.marks,o||be.none)}copy(e=null){return e==this.content?this:new Rl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Rl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return K.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),a=r.start(s),l=r.node(s).content.cut(r.pos-a,i.pos-a);return new K(l,r.depth-s,i.depth-s)}replace(e,n,o){return vE(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Qc.resolveCached(this,e)}resolveNoCache(e){return Qc.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fh(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=H.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=r;l<i;l++)if(!this.type.allowsMarks(o.child(l).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=be.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!be.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=H.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};rn.prototype.text=void 0;let EE=class Dl extends rn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):fh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Dl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Dl(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function fh(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}let Zr=class hh{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new kE(e,n);if(o.next==null)return hh.empty;let r=mh(o);o.next&&o.err("Unexpected trailing text");let i=$E(OE(r));return CE(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,a){let l=s.matchFragment(e,o);if(l&&(!n||l.validEnd))return H.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=i(d,a.concat(c));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let a=r;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!r.type||l.validEnd)&&(o.push({match:a.contentMatch,type:a,via:r}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
|
||
`)}};Zr.empty=new Zr(!0);class kE{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function mh(t){let e=[];do e.push(SE(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function SE(t){let e=[];do e.push(ME(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ME(t){let e=xE(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=TE(t,e);else break;return e}function ed(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function TE(t,e){let n=ed(t),o=n;return t.eat(",")&&(t.next!="}"?o=ed(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function IE(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function xE(t){if(t.eat("(")){let e=mh(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=IE(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function OE(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function r(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=i(s.exprs[l],a);if(l==s.exprs.length-1)return u;r(u,a=n())}else if(s.type=="star"){let l=n();return o(a,l),r(i(s.expr,l),l),[o(l)]}else if(s.type=="plus"){let l=n();return r(i(s.expr,a),l),r(i(s.expr,l),l),[o(l)]}else{if(s.type=="opt")return[o(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let c=n();r(i(s.expr,l),c),l=c}if(s.max==-1)r(i(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();o(l,c),r(i(s.expr,l),c),l=c}return[o(l)]}else{if(s.type=="name")return[o(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function gh(t,e){return e-t}function td(t,e){let n=[];return o(e),n.sort(gh);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&o(l)}}}function $E(t){let e=Object.create(null);return n(td(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<r.length;c++)r[c][0]==a&&(u=r[c][1]);td(t,l).forEach(c=>{u||r.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=e[o.join(",")]=new Zr(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let a=r[s][1].sort(gh);i.next.push({type:r[s][0],next:e[a.join(",")]||n(a)})}return i}}function CE(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let a=0;a<r.next.length;a++){let{type:l,next:u}=r.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vh(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function yh(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function bh(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function _h(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new RE(t,o,e[o]);return n}let nd=class wh{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=_h(e,o.attrs),this.defaultAttrs=vh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Zr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:yh(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new rn(this,this.computeAttrs(e),H.from(n),be.setFrom(o))}createChecked(e=null,n,o){return n=H.from(n),this.checkContent(n),new rn(this,this.computeAttrs(e),n,be.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=H.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(H.empty,!0);return i?new rn(this,e,n.append(i),be.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){bh(this.attrs,e,"node")}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:be.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new wh(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function AE(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class RE{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?AE(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}let Eh=class kh{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=_h(e,r.attrs),this.excluded=null;let i=vh(this.attrs);this.instance=i?new be(this,i):null}create(e=null){return!e&&this.instance?this.instance:new be(this,yh(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new kh(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){bh(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}};class Sh{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Ae.from(e.nodes),n.marks=Ae.from(e.marks||{}),this.nodes=nd.compile(this.spec.nodes,this),this.marks=Eh.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=Zr.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?od(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:od(this,s.split(" "))}this.nodeFromJSON=r=>rn.fromJSON(this,r),this.markFromJSON=r=>be.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nd){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new EE(o,o.defaultAttrs,e,be.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function od(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function DE(t){return t.tag!=null}function PE(t){return t.style!=null}let zr=class Pl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(DE(r))this.tags.push(r);else if(PE(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new id(this,n,!1);return o.addAll(e,be.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new id(this,n,!0);return o.addAll(e,be.none,n.from,n.to),K.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(BE(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=sd(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=sd(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Pl(e,Pl.schemaRules(e)))}};const Mh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},NE={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Th={ol:!0,ul:!0},ei=1,Nl=2,Gr=4;function rd(t,e,n){return e!=null?(e?ei:0)|(e==="full"?Nl:0):t&&t.whitespace=="pre"?ei|Nl:n&~Gr}let es=class{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=be.none,this.match=i||(s&Gr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(H.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ei)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=H.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(H.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},id=class{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=rd(null,n.preserveWhitespace,0)|(o?Gr:0);r?i=new es(r.type,r.attrs,be.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new es(null,null,be.none,!0,null,s):i=new es(e.schema.topNodeType,null,be.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Nl?"full":this.localPreserveWS||(r.options&ei)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
||
`);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=o.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(s.text(a[l]),n,!/\S/.test(a[l]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let a=r.content[r.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),n,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Th.hasOwnProperty(s)&&this.parser.normalizeLists&&LE(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,o));e:if(l?l.ignore:NE.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Mh.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(i),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let l=this.enter(s,n.attrs||null,o,n.preserveWhitespace);l&&(i=!0,o=l)}else{let l=this.parser.schema.marks[n.mark];o=o.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,o,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,o),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,a=r==null?null:e.childNodes[r];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],u=l.findWrapping(e);if(u&&(!r||r.length>u.length+a)&&(r=u,i=l,!u.length))break;if(l.solid){if(o)break;a+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=be.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):ad(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=rd(e,i,s.options);s.options&Gr&&s.content.length==0&&(a|=Gr);let l=be.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):ad(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new es(e,n,l,r,null,a)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ei)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&r?this.nodes[l].type:o&&l>=i?o.node(l-i).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}};function LE(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Th.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function BE(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function sd(t){let e={};for(let n in t)e[n]=t[n];return e}function ad(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||i.indexOf(c)<0&&s(c))return!0}};if(s(r.contentMatch))return!0}}let Si=class Ih{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ya(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(i[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)r=i.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(i.push([u,r]),r.appendChild(c.dom),r=c.contentDOM||c.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=hs(Ya(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&hs(Ya(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return hs(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ih(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ld(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return ld(e.marks)}};function ld(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ya(t){return t.document||window.document}const ud=new WeakMap;function UE(t){let e=ud.get(t);return e===void 0&&ud.set(t,e=FE(t)),e}function FE(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function hs(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=UE(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let a,l=n?t.createElementNS(n,r):t.createElement(r),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=hs(t,p,n,o);if(l.appendChild(f),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const xh=65535,Oh=Math.pow(2,16);function jE(t,e){return t+e*Oh}function cd(t){return t&xh}function qE(t){return(t-(t&xh))/Oh}const $h=1,Ch=2,ms=4,Ah=8;let Ll=class{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&Ah)>0}get deletedBefore(){return(this.delInfo&($h|ms))>0}get deletedAfter(){return(this.delInfo&(Ch|ms))>0}get deletedAcross(){return(this.delInfo&ms)>0}},fo=class Ro{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ro.empty)return Ro.empty}recover(e){let n=0,o=cd(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+qE(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+i],c=this.ranges[a+s],d=l+u;if(e<=d){let p=u?e==l?-1:e==d?1:n:n,f=l+r+(p<0?0:c);if(o)return f;let h=e==(n<0?l:d)?null:jE(a/3,e-l),m=e==l?Ch:e==d?$h:ms;return(n<0?e!=l:e!=d)&&(m|=Ah),new Ll(f,m,h)}r+=c-u}return o?e+r:new Ll(e+r,0,null)}touches(e,n){let o=0,r=cd(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let u=this.ranges[a+i],c=l+u;if(e<=c&&a==r*3)return!0;o+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),u=this.ranges[r+n],c=this.ranges[r+o];e(a,a+u,l,l+c),i+=c-u}}invert(){return new Ro(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ro.empty:new Ro(e<0?[0,-e,0]:[0,0,e])}};fo.empty=new fo([]);let Rh=class Bl{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Bl(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Bl;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}r|=a.delInfo,e=a.pos}return o?e:new Ll(e,r,null)}};const Ja=Object.create(null);let We=class{getMap(){return fo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ja[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ja)throw new RangeError("Duplicate use of step JSON ID "+e);return Ja[e]=n,n.prototype.jsonID=e,n}},Qe=class Tr{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Tr(e,null)}static fail(e){return new Tr(null,e)}static fromReplace(e,n,o,r){try{return Tr.ok(e.replace(n,o,r))}catch(i){if(i instanceof Ds)return Tr.fail(i.message);throw i}}};function Hu(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(Hu(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return H.fromArray(o)}let Vu=class Ir extends We{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new K(Hu(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return Qe.fromReplace(e,this.from,this.to,i)}invert(){return new Mi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new Ir(n.pos,o.pos,this.mark)}merge(e){return e instanceof Ir&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ir(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ir(n.from,n.to,e.markFromJSON(n.mark))}};We.jsonID("addMark",Vu);let Mi=class xr extends We{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new K(Hu(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Qe.fromReplace(e,this.from,this.to,o)}invert(){return new Vu(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new xr(n.pos,o.pos,this.mark)}merge(e){return e instanceof xr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new xr(n.from,n.to,e.markFromJSON(n.mark))}};We.jsonID("removeMark",Mi);let Wu=class Or extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qe.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Qe.fromReplace(e,this.pos,this.pos+1,new K(H.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Or(this.pos,n.marks[r]);return new Or(this.pos,this.mark)}}return new Ls(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Or(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Or(n.pos,e.markFromJSON(n.mark))}};We.jsonID("addNodeMark",Wu);let Ls=class Ul extends We{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qe.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Qe.fromReplace(e,this.pos,this.pos+1,new K(H.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Wu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ul(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ul(n.pos,e.markFromJSON(n.mark))}};We.jsonID("removeNodeMark",Ls);let Pt=class Yn extends We{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Fl(e,this.from,this.to)?Qe.fail("Structure replace would overwrite content"):Qe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fo([this.from,this.to-this.from,this.slice.size])}invert(e){return new Yn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new Yn(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Yn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?K.empty:new K(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Yn(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?K.empty:new K(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Yn(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Yn(n.from,n.to,K.fromJSON(e,n.slice),!!n.structure)}};We.jsonID("replace",Pt);let ut=class gs extends We{constructor(e,n,o,r,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Fl(e,this.from,this.gapFrom)||Fl(e,this.gapTo,this.to)))return Qe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Qe.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?Qe.fromReplace(e,this.from,this.to,o):Qe.fail("Content does not fit in gap")}getMap(){return new fo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new gs(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new gs(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gs(n.from,n.to,n.gapFrom,n.gapTo,K.fromJSON(e,n.slice),n.insert,!!n.structure)}};We.jsonID("replaceAround",ut);function Fl(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function zE(t,e,n,o){let r=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!o.isInSet(d)&&c.type.allowsMarkType(o.type)){let p=Math.max(u,e),f=Math.min(u+l.nodeSize,n),h=o.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==p&&s.mark.eq(d[m])?s.to=f:r.push(s=new Mi(p,f,d[m])));a&&a.to==p?a.to=f:i.push(a=new Vu(p,f,o))}}),r.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function GE(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(o instanceof Eh){let u=s.marks,c;for(;c=o.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else o?o.isInSet(s.marks)&&(l=[o]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],p;for(let f=0;f<r.length;f++){let h=r[f];h.step==i-1&&d.eq(r[f].style)&&(p=h)}p?(p.to=u,p.step=i):r.push({style:d,from:Math.max(a,e),to:u,step:i})}}}),r.forEach(s=>t.step(new Mi(s.from,s.to,s.style)))}function Ku(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let u=i.child(l),c=a+u.nodeSize,d=o.matchType(u.type);if(!d)s.push(new Pt(a,c,K.empty));else{o=d;for(let p=0;p<u.marks.length;p++)n.allowsMarkType(u.marks[p].type)||t.step(new Mi(a,c,u.marks[p]));if(r&&u.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(u.text);)h||(h=new K(H.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new Pt(a+p.index,a+p.index+p[0].length,h))}}a=c}if(!o.validEnd){let l=o.fillBefore(H.empty,!0);t.replace(a,a,new K(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function HE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function pr(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,o=0,r=0;;--n){let i=t.$from.node(n),s=t.$from.index(n)+o,a=t.$to.indexAfter(n)-r;if(n<t.depth&&i.canReplace(s,a,e))return n;if(n==0||i.type.spec.isolating||!HE(i,s,a))break;s&&(o=1),a<i.childCount&&(r=1)}return null}function VE(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),a=r.after(i+1),l=s,u=a,c=H.empty,d=0;for(let h=i,m=!1;h>n;h--)m||o.index(h)>0?(m=!0,c=H.from(o.node(h).copy(c)),d++):l--;let p=H.empty,f=0;for(let h=i,m=!1;h>n;h--)m||r.after(h+1)<r.end(h)?(m=!0,p=H.from(r.node(h).copy(p)),f++):u++;t.step(new ut(l,u,s,a,new K(c.append(p),d,f),c.size-d,!0))}function Yu(t,e,n=null,o=t){let r=WE(t,e),i=r&&KE(o,e);return i?r.map(dd).concat({type:e,attrs:n}).concat(i.map(dd)):null}function dd(t){return{type:t,attrs:null}}function WE(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function KE(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=o;a&&l<r;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function YE(t,e,n){let o=H.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let a=n[s].type.contentMatch.matchFragment(o);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=H.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new ut(r,i,r,i,new K(o,0,0),n.length,!0))}function JE(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,l)&&XE(t.doc,t.mapping.slice(i).map(a),o)){let u=null;if(o.schema.linebreakReplacement){let f=o.whitespace=="pre",h=!!o.contentMatch.matchType(o.schema.linebreakReplacement);f&&!h?u=!1:!f&&h&&(u=!0)}u===!1&&Ph(t,s,a,i),Ku(t,t.mapping.slice(i).map(a,1),o,void 0,u===null);let c=t.mapping.slice(i),d=c.map(a,1),p=c.map(a+s.nodeSize,1);return t.step(new ut(d,p,d+1,p-1,new K(H.from(o.create(l,null,s.marks)),0,0),1,!0)),u===!0&&Dh(t,s,a,i),!1}})}function Dh(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(r.text);){let l=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Ph(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
||
`))}})}function XE(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function QE(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ut(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new K(H.from(s),0,0),1,!0))}function zo(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,c=n-2;u>i;u--,c--){let d=r.node(u),p=r.index(u);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=o&&o[c+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=o&&o[c]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))return!1}let a=r.indexAfter(i),l=o&&o[0];return r.node(i).canReplaceWith(a,a,l?l.type:r.node(i+1).type)}function ZE(t,e,n=1,o){let r=t.doc.resolve(e),i=H.empty,s=H.empty;for(let a=r.depth,l=r.depth-n,u=n-1;a>l;a--,u--){i=H.from(r.node(a).copy(i));let c=o&&o[u];s=H.from(c?c.type.create(c.attrs,s):r.node(a).copy(s))}t.step(new Pt(e,e,new K(i.append(s),n,n),!0))}function Fn(t,e){let n=t.resolve(e),o=n.index();return Nh(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function ek(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Nh(t,e){return!!(t&&e&&!t.isLeaf&&ek(t,e))}function fa(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,a=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),a++,s=o.node(r).maybeChild(a)):(i=o.node(r).maybeChild(a-1),s=o.node(r+1)),i&&!i.isTextblock&&Nh(i,s)&&o.node(r).canReplace(a,a+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function tk(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let c=s.whitespace=="pre",d=!!s.contentMatch.matchType(r);c&&!d?o=!1:!c&&d&&(o=!0)}let a=t.steps.length;if(o===!1){let c=t.doc.resolve(e+n);Ph(t,c.node(),c.before(),a)}s.inlineContent&&Ku(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new Pt(u,l.map(e+n,-1),K.empty,!0)),o===!0){let c=t.doc.resolve(u);Dh(t,c.node(),c.before(),t.steps.length)}return t}function nk(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Lh(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let a=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,l=o.index(s)+(a>0?1:0),u=o.node(s),c=!1;if(i==1)c=u.canReplace(l,l,r);else{let d=u.contentMatchAt(l).findWrapping(r.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?o.pos:a<0?o.before(s+1):o.after(s+1)}return null}function ha(t,e,n=e,o=K.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return Bh(r,i,o)?new Pt(e,n,o):new ok(r,i,o).fit()}function Bh(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class ok{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=H.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=H.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,a=r.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new K(i,s,a);return e>-1?new ut(o.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||o.pos!=this.$to.pos?new Pt(o.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Xa(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(n==1&&(s?u.matchType(s.type)||(d=u.fillBefore(H.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:a,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Xa(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new K(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Xa(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new K($r(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new K($r(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=o?o.content:s.content,l=s.openStart-e,u=0,c=[],{match:d,type:p}=this.frontier[n];if(r){for(let m=0;m<r.childCount;m++)c.push(r.child(m));d=d.matchFragment(r)}let f=a.size+e-(s.content.size-s.openEnd);for(;u<a.childCount;){let m=a.child(u),v=d.matchType(m.type);if(!v)break;u++,(u>1||l==0||m.content.size)&&(d=v,c.push(Uh(m.mark(p.allowedMarks(m.marks)),u==1?l:0,u==a.childCount?f:-1)))}let h=u==a.childCount;h||(f=-1),this.placed=Cr(this.placed,n,H.from(c)),this.frontier[n].match=d,h&&f<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,v=a;m<f;m++){let y=v.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),v=y.content}this.unplaced=h?e==0?K.empty:new K($r(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new K($r(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Qa(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,H.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(H.empty,!0);e.childCount&&(this.placed=Cr(this.placed,this.frontier.length,e))}}function $r(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy($r(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Xa(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Uh(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Uh(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(H.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=o.fillBefore(i.content,!0,s);return a&&!rk(n,i.content,s)?a:null}function rk(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function ik(t){return t.spec.defining||t.spec.definingForContent}function sk(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(Bh(r,i,o))return t.step(new Pt(e,n,o));let s=jh(r,i);s[s.length-1]==0&&s.pop();let a=-(r.depth+1);s.unshift(a);for(let p=r.depth,f=r.pos-1;p>0;p--,f--){let h=r.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?a=p:r.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),u=[],c=o.openStart;for(let p=o.content,f=0;;f++){let h=p.firstChild;if(u.push(h),f==o.openStart)break;p=h.content}for(let p=c-1;p>=0;p--){let f=u[p],h=ik(f.type);if(h&&!f.sameMarkup(r.node(Math.abs(a)-1)))c=p;else if(h||!f.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let f=(p+c+1)%(o.openStart+1),h=u[f];if(h)for(let m=0;m<s.length;m++){let v=s[(m+l)%s.length],y=!0;v<0&&(y=!1,v=-v);let _=r.node(v-1),E=r.index(v-1);if(_.canReplaceWith(E,E,h.type,h.marks))return t.replace(r.before(v),y?i.after(v):n,new K(Fh(o.content,0,o.openStart,f),f,o.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>d));p--){let f=s[p];f<0||(e=r.before(f),n=i.after(f))}}function Fh(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Fh(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(H.empty,!0))}return t}function ak(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=nk(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new K(H.from(o),0,0))}function lk(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=jh(o,r);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||o.node(a).type.contentMatch.validEnd)return t.delete(o.start(a),r.end(a));if(a>0&&(l||o.node(a-1).canReplace(o.index(a-1),r.indexAfter(a-1))))return t.delete(o.before(a),r.after(a))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function jh(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}let qh=class vs extends We{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qe.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return Qe.fromReplace(e,this.pos,this.pos+1,new K(H.from(r),0,n.isLeaf?0:1))}getMap(){return fo.empty}invert(e){return new vs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vs(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vs(n.pos,n.attr,n.value)}};We.jsonID("attr",qh);let zh=class jl extends We{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return Qe.ok(o)}getMap(){return fo.empty}invert(e){return new jl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new jl(n.attr,n.value)}};We.jsonID("docAttr",zh);let Jo=class extends Error{};Jo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Jo.prototype=Object.create(Error.prototype);Jo.prototype.constructor=Jo;Jo.prototype.name="TransformError";class uk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Rh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Jo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),n=r.map(n,-1)),r.forEach((i,s,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=K.empty){let r=ha(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new K(H.from(o),0,0))}delete(e,n){return this.replace(e,n,K.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return sk(this,e,n,o),this}replaceRangeWith(e,n,o){return ak(this,e,n,o),this}deleteRange(e,n){return lk(this,e,n),this}lift(e,n){return VE(this,e,n),this}join(e,n=1){return tk(this,e,n),this}wrap(e,n){return YE(this,e,n),this}setBlockType(e,n=e,o,r=null){return JE(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return QE(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new qh(e,n,o)),this}setDocAttribute(e,n){return this.step(new zh(e,n)),this}addNodeMark(e,n){return this.step(new Wu(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof be)n.isInSet(o.marks)&&this.step(new Ls(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Ls(e,i)),r=i.removeFromSet(r);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,o){return ZE(this,e,n,o),this}addMark(e,n,o){return zE(this,e,n,o),this}removeMark(e,n,o){return GE(this,e,n,o),this}clearIncompatible(e,n,o){return Ku(this,e,n,o),this}}const Za=Object.create(null);let ae=class{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new ck(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=K.empty){let o=n.content.lastChild,r=null;for(let a=0;a<n.openEnd;a++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:u}=s[a],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(u.pos),a?K.empty:n),a==0&&hd(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:a}=r[i],l=e.mapping.slice(o),u=l.map(s.pos),c=l.map(a.pos);i?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),hd(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new de(e):Do(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Do(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Do(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new $n(e.node(0))}static atStart(e){return Do(e,e,0,0,1)||new $n(e)}static atEnd(e){return Do(e,e,e.content.size,e.childCount,-1)||new $n(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}};ae.prototype.visible=!0;class ck{constructor(e,n){this.$from=e,this.$to=n}}let pd=!1;function fd(t){!pd&&!t.parent.inlineContent&&(pd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let de=class Ar extends ae{constructor(e,n=e){fd(e),fd(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return ae.near(o);let r=e.resolve(n.map(this.anchor));return new Ar(r.parent.inlineContent?r:o,o)}replace(e,n=K.empty){if(super.replace(e,n),n==K.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Ar&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Gh(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ar(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=ae.findFrom(n,o,!0)||ae.findFrom(n,-o,!0);if(i)n=i.$head;else return ae.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(ae.findFrom(e,-o,!0)||ae.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Ar(e,n)}};ae.jsonID("text",de);let Gh=class Hh{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Hh(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}},te=class Rr extends ae{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?ae.near(i):new Rr(i)}content(){return new K(H.from(this.node),0,0)}eq(e){return e instanceof Rr&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ju(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Rr(e.resolve(n.anchor))}static create(e,n){return new Rr(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};te.prototype.visible=!1;ae.jsonID("node",te);class Ju{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Gh(o,o):new Ju(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&te.isSelectable(o)?new te(n):ae.near(n)}}let $n=class ys extends ae{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=K.empty){if(n==K.empty){e.delete(0,e.doc.content.size);let o=ae.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ys(e)}map(e){return new ys(e)}eq(e){return e instanceof ys}getBookmark(){return dk}};ae.jsonID("all",$n);const dk={map(){return this},resolve(t){return new $n(t)}};function Do(t,e,n,o,r,i=!1){if(e.inlineContent)return de.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let a=e.child(s);if(a.isAtom){if(!i&&te.isSelectable(a))return te.create(t,n-(r<0?a.nodeSize:0))}else{let l=Do(t,a,n+r,r<0?a.childCount:0,r,i);if(l)return l}n+=a.nodeSize*r}return null}function hd(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof Pt||r instanceof ut))return;let i=t.mapping.maps[o],s;i.forEach((a,l,u,c)=>{s==null&&(s=c)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const md=1,ts=2,gd=4;class pk extends uk{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|md)&~ts,this.storedMarks=null,this}get selectionSet(){return(this.updated&md)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ts,this}ensureMarks(e){return be.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ts)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ts,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||be.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ae.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=gd,this}get scrolledIntoView(){return(this.updated&gd)>0}}function vd(t,e){return!e||!t?t:t.bind(e)}let Dr=class{constructor(e,n,o){this.name=e,this.init=vd(n.init,o),this.apply=vd(n.apply,o)}};const fk=[new Dr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Dr("selection",{init(t,e){return t.selection||ae.atStart(e.doc)},apply(t){return t.selection}}),new Dr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Dr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let el=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=fk.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Dr(o.key,o.spec.state,o))})}},hk=class Pr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=r?r[s].n:0,u=r?r[s].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,o);if(c&&o.filterTransaction(c,s)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let d=0;d<this.config.plugins.length;d++)r.push(d<s?{state:o,n:n.length}:{state:this,n:0})}n.push(c),o=o.applyInner(c),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Pr(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new pk(this)}static create(e){let n=new el(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Pr(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new el(this.schema,e.plugins),o=n.fields,r=new Pr(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new el(e.schema,e.plugins),i=new Pr(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=rn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ae.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let a in o){let l=o[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=u.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function Vh(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Vh(r,e,{})),n[o]=r}return n}let Ie=class{constructor(e){this.spec=e,this.props={},e.props&&Vh(e.props,this,this.props),this.key=e.key?e.key.key:Wh("plugin")}getState(e){return e[this.key]}};const tl=Object.create(null);function Wh(t){return t in tl?t+"$"+ ++tl[t]:(tl[t]=0,t+"$")}let Be=class{constructor(e="key"){this.key=Wh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const Re=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Xo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ql=null;const tn=function(t,e,n){let o=ql||(ql=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},mk=function(){ql=null},ho=function(t,e,n,o){return n&&(yd(t,e,n,o,-1)||yd(t,e,n,o,1))},gk=/^(img|br|input|textarea|hr)$/i;function yd(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Et(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Ti(t)||gk.test(t.nodeName)||t.contentEditable=="false")return!1;e=Re(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Et(t):0}else return!1}}function Et(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vk(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Et(t)}else if(t.parentNode&&!Ti(t))e=Re(t),t=t.parentNode;else return null}}function yk(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ti(t))e=Re(t)+1,t=t.parentNode;else return null}}function bk(t,e,n){for(let o=e==0,r=e==Et(t);o||r;){if(t==n)return!0;let i=Re(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Et(t)}}function Ti(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ma=function(t){return t.focusNode&&ho(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Zn(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function _k(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function wk(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Et(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Et(o.startContainer),o.startOffset)}}}const Wt=typeof navigator<"u"?navigator:null,bd=typeof document<"u"?document:null,_o=Wt&&Wt.userAgent||"",zl=/Edge\/(\d+)/.exec(_o),Kh=/MSIE \d/.exec(_o),Gl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_o),it=!!(Kh||Gl||zl),Cn=Kh?document.documentMode:Gl?+Gl[1]:zl?+zl[1]:0,Ct=!it&&/gecko\/(\d+)/i.test(_o),Hl=!it&&/Chrome\/(\d+)/.exec(_o),Pe=!!Hl,Yh=Hl?+Hl[1]:0,Ge=!it&&!!Wt&&/Apple Computer/.test(Wt.vendor),Qo=Ge&&(/Mobile\/\w+/.test(_o)||!!Wt&&Wt.maxTouchPoints>2),wt=Qo||(Wt?/Mac/.test(Wt.platform):!1),Jh=Wt?/Win/.test(Wt.platform):!1,nn=/Android \d/.test(_o),Ii=!!bd&&"webkitFontSmoothing"in bd.documentElement.style,Ek=Ii?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kk(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function en(t,e){return typeof t=="number"?t:t[e]}function Sk(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function _d(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Xo(s);continue}let a=s,l=a==i.body,u=l?kk(i):Sk(a),c=0,d=0;if(e.top<u.top+en(o,"top")?d=-(u.top-e.top+en(r,"top")):e.bottom>u.bottom-en(o,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+en(r,"top")-u.top:e.bottom-u.bottom+en(r,"bottom")),e.left<u.left+en(o,"left")?c=-(u.left-e.left+en(r,"left")):e.right>u.right-en(o,"right")&&(c=e.right-u.right+en(r,"right")),c||d)if(l)i.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-f,v=a.scrollTop-h;e={left:e.left-m,top:e.top-v,right:e.right-m,bottom:e.bottom-v}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Xo(s)}}function Mk(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){o=a,r=l.top;break}}return{refDOM:o,refTop:r,stack:Xh(t.dom)}}function Xh(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Xo(o));return e}function Tk({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qh(n,o==0?0:o-e)}function Qh(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let To=null;function Ik(t){if(t.setActive)return t.setActive();if(To)return t.focus(To);let e=Xh(t);t.focus(To==null?{get preventScroll(){return To={preventScroll:!0},!0}}:void 0),To||(To=!1,Qh(e,0))}function Zh(t,e){let n,o=2e8,r,i=0,s=e.top,a=e.top,l,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let p;if(c.nodeType==1)p=c.getClientRects();else if(c.nodeType==3)p=tn(c).getClientRects();else continue;for(let f=0;f<p.length;f++){let h=p[f];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<o){n=c,o=m,r=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,c.nodeType==1&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=c,u={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!n&&l&&(n=l,r=u,o=0),n&&n.nodeType==3?xk(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zh(n,r)}function xk(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=kn(o,1);if(s.top!=s.bottom&&Xu(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function Xu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Ok(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function $k(t,e,n){let{node:o,offset:r}=Zh(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function Ck(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>o.left||l.top>o.top?r=a.posBefore:(!s&&l.right<o.left||l.bottom<o.top)&&(r=a.posAfter),s=!0),!a.contentDOM&&r<0&&!a.node.isText))return(a.node.isBlock?o.top<(l.top+l.bottom)/2:o.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function em(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Xu(e,u))return em(s,e,u)}}if((i=(i+1)%o)==r)break}return t}function Ak(t,e){let n=t.dom.ownerDocument,o,r=0,i=wk(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=t.dom.getBoundingClientRect();if(!Xu(e,u)||(s=em(t.dom,e,u),!s))return null}if(Ge)for(let u=s;o&&u;u=Xo(u))u.draggable&&(o=void 0);if(s=Ok(s,e),o){if(Ct&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let c=o.childNodes[r],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&r++}let u;Ii&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(a=Ck(t,o,r,e))}a==null&&(a=$k(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function wd(t){return t.top<t.bottom||t.left<t.right}function kn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(wd(o))return o}return Array.prototype.find.call(n,wd)||t.getBoundingClientRect()}const Rk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tm(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Ii||Ct;if(o.nodeType==3)if(s&&(Rk.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let a=kn(tn(o,r,r),n);if(Ct&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let l=kn(tn(o,r-1,r-1),-1);if(l.top==a.top){let u=kn(tn(o,r,r+1),-1);if(u.top!=a.top)return _r(u,u.left<l.left)}}return a}else{let a=r,l=r,u=n<0?1:-1;return n<0&&!r?(l++,u=-1):n>=0&&r==o.nodeValue.length?(a--,u=1):n<0?a--:l++,_r(kn(tn(o,a,l),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Et(o))){let a=o.childNodes[r-1];if(a.nodeType==1)return nl(a.getBoundingClientRect(),!1)}if(i==null&&r<Et(o)){let a=o.childNodes[r];if(a.nodeType==1)return nl(a.getBoundingClientRect(),!0)}return nl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Et(o))){let a=o.childNodes[r-1],l=a.nodeType==3?tn(a,Et(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return _r(kn(l,1),!1)}if(i==null&&r<Et(o)){let a=o.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?tn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return _r(kn(l,-1),!0)}return _r(kn(o.nodeType==3?tn(o):o,-n),n>=0)}function _r(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function nl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function nm(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function Dk(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return nm(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=tm(t,r.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=tn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}const Pk=/[\u0590-\u08ac]/;function Nk(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,a=t.domSelection();return a?!Pk.test(o.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:nm(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let f=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),v=h&&!f.contains(h.nodeType==1?h:h.parentNode)||l==h&&u==m;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return p!=null&&(a.caretBidiLevel=p),v}):o.pos==o.start()||o.pos==o.end()}let Ed=null,kd=null,Sd=!1;function Lk(t,e,n){return Ed==e&&kd==n?Sd:(Ed=e,kd=n,Sd=n=="up"||n=="down"?Dk(t,e,n):Nk(t,e,n))}const kt=0,Md=1,to=2,Kt=3;let xi=class{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=kt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>Re(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let a=r.children[s];if(a.size){r=a;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],a=i+s.size;if(a>e||s instanceof am){r=e-i;break}i=a}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof om&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Re(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Re(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,a=0;;a++){let l=this.children[a],u=s+l.size;if(r==-1&&e<=u){let c=s+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let d=a;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Re(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=Re(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let f=0,h=0;f<this.children.length;f++){let m=this.children[f],v=h+m.size;if(i>h&&s<v)return m.setSelection(e-h-m.border,n-h-m.border,o,r);h=v}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=o.root.getSelection(),c=o.domSelectionRange(),d=!1;if((Ct||Ge)&&e==n){let{node:f,offset:h}=a;if(f.nodeType==3){if(d=!!(h&&f.nodeValue[h-1]==`
|
||
`),d&&h==f.nodeValue.length)for(let m=f,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=l={node:v.parentNode,offset:Re(v)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=f.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ct&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(r=!0)}if(!(r||d&&Ge)&&ho(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ho(l.node,l.offset,c.focusNode,c.focusOffset))return;let p=!1;if((u.extend||e==n)&&!(d&&Ct)){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let a=o+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==o||n==s?to:Md,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Kt:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?to:Kt}o=s}this.dirty=to}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?to:Md;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};class om extends xi{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==kt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Bk extends xi{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}let Bs=class Vl extends xi{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=Si.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new Vl(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Kt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Kt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=kt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=kt}}slice(e,n,o){let r=Vl.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=Kl(i,n,s,o)),e>0&&(i=Kl(i,0,e,o));for(let a=0;a<i.length;a++)i[a].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Go=class rm extends xi{constructor(e,n,o,r,i,s,a,l,u){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=a}static create(e,n,o,r,i,s){let a=i.nodeViews[n.type.name],l,u=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},o,r),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=Si.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let p=c;return c=cm(c,o,n),u?l=new Uk(e,n,o,r,c,d||null,p,u,i,s+1):n.isText?new im(e,n,o,r,c,p,i):new rm(e,n,o,r,c,d||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>H.empty)}return e}matchesNode(e,n,o){return this.dirty==kt&&e.eq(this.node)&&Us(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new jk(this,s&&s.node,e);Gk(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,o,e,c):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?be.none:this.node.child(c).marks,o,e,c),l.placeWidget(u,e,r)},(u,c,d,p)=>{l.syncToMarks(u.marks,o,e,p);let f;l.findNodeMatch(u,c,d,p)||a&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(u,c,d,f,e)||l.updateNextNode(u,c,d,e,p,r)||l.addNode(u,c,d,e,r),r+=u.nodeSize}),l.syncToMarks([],o,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==to)&&(s&&this.protectLocalComposition(e,s),lm(this.contentDOM,this.children,e),Qo&&Hk(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof de)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=Vk(this.node.content,s,o-n,r-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Bk(this,i,n,r);e.input.compositionNodes.push(s),this.children=Kl(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==Kt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=kt}updateOuterDeco(e){if(Us(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=um(this.dom,this.nodeDOM,Wl(this.outerDeco,this.node,n),Wl(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Td(t,e,n,o,r){cm(o,e,t);let i=new Go(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}let im=class sm extends Go{constructor(e,n,o,r,i,s,a){super(e,n,o,r,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==Kt||this.dirty!=kt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=kt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=kt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new sm(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Kt)}get domAtom(){return!1}isText(e){return this.node.text==e}};class am extends xi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==kt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Uk extends Go{constructor(e,n,o,r,i,s,a,l,u,c){super(e,n,o,r,i,s,a,u,c),this.spec=l}update(e,n,o,r){if(this.dirty==Kt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function lm(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=o;)o=Id(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(a,o);if(s instanceof Bs){let l=o?o.previousSibling:t.lastChild;lm(s.contentDOM,s.children,n),o=l?l.nextSibling:t.firstChild}}for(;o;)o=Id(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Hr=function(t){t&&(this.nodeName=t)};Hr.prototype=Object.create(null);const no=[new Hr];function Wl(t,e,n){if(t.length==0)return no;let o=n?no[0]:new Hr,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Hr(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&r.length==1&&r.push(o=new Hr(e.isInline?"span":"div")),a=="class"?o.class=(o.class?o.class+" ":"")+l:a=="style"?o.style=(o.style?o.style+";":"")+l:a!="nodeName"&&(o[a]=l))}}}return r}function um(t,e,n,o){if(n==no&&o==no)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&r!=t&&(l=r.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(r),a=no[0]),r=l}Fk(r,a||no[0],s)}return r}function Fk(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function cm(t,e,n){return um(t,t,no,Wl(e,n,t.nodeType!=1))}function Us(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Id(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class jk{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=qk(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;i<a&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=kt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;r<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=c;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=Bs.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,o)&&!this.preMatch.matched.has(u)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==Kt&&s.dom==s.contentDOM&&(s.dirty=to),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Go){let u=this.preMatch.matched.get(l);if(u!=null&&u!=i)return!1;let c=l.dom,d,p=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Kt&&Us(n,l.outerDeco));if(!p&&l.update(e,n,o,r))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(l,e,n,o,r,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=to,d.updateChildren(r,s+1),d.dirty=kt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Us(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let a=Go.create(this.top,n,o,r,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,o,r,i){let s=Go.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new om(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Bs;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof im)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ge||Pe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new am(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function qk(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let a;for(;;)if(o){let u=n.children[o-1];if(u instanceof Bs)n=u,o=u.children.length;else{a=u,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(r-1))break;--r,i.set(a,r),s.push(a)}}return{index:r,matched:i,matches:s.reverse()}}function zk(t,e){return t.type.side-e.type.side}function Gk(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);o(c,r,e.forChild(i,c),u),i+=c.nodeSize}return}let s=0,a=[],l=null;for(let u=0;;){let c,d;for(;s<r.length&&r[s].to==i;){let v=r[s++];v.widget&&(c?(d||(d=[c])).push(v):c=v)}if(c)if(d){d.sort(zk);for(let v=0;v<d.length;v++)n(d[v],u,!!l)}else n(c,u,!!l);let p,f;if(l)f=-1,p=l,l=null;else if(u<t.childCount)f=u,p=t.child(u++);else break;for(let v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)a.push(r[s++]);let h=i+p.nodeSize;if(p.isText){let v=h;s<r.length&&r[s].from<v&&(v=r[s].from);for(let y=0;y<a.length;y++)a[y].to<v&&(v=a[y].to);v<h&&(l=p.cut(v-i),p=p.cut(0,v-i),h=v,f=-1)}else for(;s<r.length&&r[s].to<h;)s++;let m=p.isInline&&!p.isLeaf?a.filter(v=>!v.inline):a.slice();o(p,m,e.forChild(i,p),f),i=h}}function Hk(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Vk(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;r<t.childCount;){let u=t.child(r++);if(i+=u.nodeSize,!u.isText)break;l+=u.text}if(i>=n){if(i>=o&&l.slice(o-e.length-a,o-a)==e)return o-e.length;let u=a<o?l.lastIndexOf(e,o-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==o&&l.length>=o+e.length-a&&l.slice(o-a,o-a+e.length)==e)return o}}return-1}function Kl(t,e,n,o,r){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],u=a,c=a+=l.size;u>=n||c<=e?i.push(l):(u<e&&i.push(l.slice(0,e-u,o)),r&&(i.push(r),r=void 0),c>n&&i.push(l.slice(n-u,l.size,o)))}return i}function Qu(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=o.resolve(s),l,u;if(ma(n)){for(l=s;r&&!r.node;)r=r.parent;let d=r.node;if(r&&d.isAtom&&te.isSelectable(d)&&r.parent&&!(d.isInline&&bk(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;u=new te(s==p?a:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let f=0;f<n.rangeCount;f++){let h=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,s]=p==t.state.selection.anchor?[p,d]:[d,p],a=o.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=o.resolve(l);if(!u){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;u=Zu(t,c,a,d)}return u}function dm(t){return t.editable?t.hasFocus():fm(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function sn(t,e=!1){let n=t.state.selection;if(pm(t,n),!!dm(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Pe){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ho(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Kk(t);else{let{anchor:o,head:r}=n,i,s;xd&&!(n instanceof de)&&(n.$from.parent.inlineContent||(i=Od(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Od(t,n.to))),t.docView.setSelection(o,r,t,e),xd&&(i&&$d(i),s&&$d(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Wk(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const xd=Ge||Pe&&Yh<63;function Od(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(Ge&&r&&r.contentEditable=="false")return ol(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return ol(r);if(i)return ol(i)}}function ol(t){return t.contentEditable="true",Ge&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function $d(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Wk(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!dm(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Kk(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,Re(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&it&&Cn<=11&&(n.disabled=!0,n.disabled=!1)}function pm(t,e){if(e instanceof te){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Cd(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Cd(t)}function Cd(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Zu(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||de.between(e,n,o)}function Ad(t){return t.editable&&!t.hasFocus()?!1:fm(t)}function fm(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Yk(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ho(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Yl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&ae.findFrom(i,e)}function Tn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Rd(t,e,n){let o=t.state.selection;if(o instanceof de)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return Tn(t,new de(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=Yl(t.state,e);return r&&r instanceof te?Tn(t,r):!1}else if(!(wt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?te.isSelectable(i)?Tn(t,new te(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):Ii?Tn(t,new de(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof te&&o.node.isInline)return Tn(t,new de(e>0?o.$to:o.$from));{let r=Yl(t.state,e);return r?Tn(t,r):!1}}}function Fs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Vr(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Io(t,e){return e<0?Jk(t):Xk(t)}function Jk(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Ct&&n.nodeType==1&&o<Fs(n)&&Vr(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let a=n.childNodes[o-1];if(Vr(a,-1))r=n,i=--o;else if(a.nodeType==3)n=a,o=n.nodeValue.length;else break}}else{if(hm(n))break;{let a=n.previousSibling;for(;a&&Vr(a,-1);)r=n.parentNode,i=Re(a),a=a.previousSibling;if(a)n=a,o=Fs(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?Jl(t,n,o):r&&Jl(t,r,i)}function Xk(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Fs(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let a=n.childNodes[o];if(Vr(a,1))i=n,s=++o;else break}else{if(hm(n))break;{let a=n.nextSibling;for(;a&&Vr(a,1);)i=a.parentNode,s=Re(a)+1,a=a.nextSibling;if(a)n=a,o=0,r=Fs(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&Jl(t,i,s)}function hm(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Qk(t,e){for(;t&&e==t.childNodes.length&&!Ti(t);)e=Re(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Zk(t,e){for(;t&&!e&&!Ti(t);)e=Re(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Jl(t,e,n){if(e.nodeType!=3){let i,s;(s=Qk(e,n))?(e=s,n=0):(i=Zk(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ma(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&sn(t)},50)}function Dd(t,e){let n=t.state.doc.resolve(e);if(!(Pe||Jh)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let r=t.coordsAtPos(e-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<n.end()){let r=t.coordsAtPos(e+1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Pd(t,e,n){let o=t.state.selection;if(o instanceof de&&!o.empty||n.indexOf("s")>-1||wt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Yl(t.state,e);if(s&&s instanceof te)return Tn(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,a=o instanceof $n?ae.near(s,e):ae.findFrom(s,e);return a?Tn(t,a):!1}return!1}function Nd(t,e){if(!(t.state.selection instanceof de))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function Ld(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function eS(t){if(!Ge||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;Ld(t,o,"true"),setTimeout(()=>Ld(t,o,"false"),20)}return!1}function tS(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function nS(t,e){let n=e.keyCode,o=tS(e);if(n==8||wt&&n==72&&o=="c")return Nd(t,-1)||Io(t,-1);if(n==46&&!e.shiftKey||wt&&n==68&&o=="c")return Nd(t,1)||Io(t,1);if(n==13||n==27)return!0;if(n==37||wt&&n==66&&o=="c"){let r=n==37?Dd(t,t.state.selection.from)=="ltr"?-1:1:-1;return Rd(t,r,o)||Io(t,r)}else if(n==39||wt&&n==70&&o=="c"){let r=n==39?Dd(t,t.state.selection.from)=="ltr"?1:-1:1;return Rd(t,r,o)||Io(t,r)}else{if(n==38||wt&&n==80&&o=="c")return Pd(t,-1,o)||Io(t,-1);if(n==40||wt&&n==78&&o=="c")return eS(t)||Pd(t,1,o)||Io(t,1);if(o==(wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ec(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let f=o.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),o=f.content}let s=t.someProp("clipboardSerializer")||Si.fromSchema(t.state.schema),a=_m(),l=a.createElement("div");l.appendChild(s.serializeFragment(o,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=bm[u.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let h=a.createElement(c[f]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
||
|
||
`);return{dom:l,text:p,slice:e}}function mm(t,e,n,o,r){let i=r.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=!!e&&(o||i||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return a=new K(H.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
||
`))),0,0),t.someProp("transformPasted",p=>{a=p(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(d)a=d;else{let p=r.marks(),{schema:f}=t.state,h=Si.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(h.serializeNode(f.text(m,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=sS(n),Ii&&aS(s);let u=s&&s.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||zr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:r,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!oS.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=lS(Bd(a,+c[1],+c[2]),c[4]);else if(a=K.maxOpen(rS(a.content,r),!0),a.openStart||a.openEnd){let d=0,p=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;p<a.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);a=Bd(a,d,p)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const oS=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function rS(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),r,i=[];if(t.forEach(s=>{if(!i)return;let a=o.findWrapping(s.type),l;if(!a)return i=null;if(l=i.length&&r.length&&vm(a,r,s,i[i.length-1],0))i[i.length-1]=l;else{i.length&&(i[i.length-1]=ym(i[i.length-1],r.length));let u=gm(s,a);i.push(u),o=o.matchType(u.type),r=a}}),i)return H.from(i)}return t}function gm(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,H.from(t));return t}function vm(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=vm(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(H.from(gm(n,t,r+1))))}}function ym(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ym(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(H.empty,!0);return t.copy(n.append(o))}function Xl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),r<o-1&&(a=Xl(a,e,n,o,r+1,i)),r>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=r).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(H.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Bd(t,e,n){return e<t.openStart&&(t=new K(Xl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new K(Xl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const bm={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ud=null;function _m(){return Ud||(Ud=document.implementation.createHTMLDocument("title"))}let rl=null;function iS(t){let e=window.trustedTypes;return e?(rl||(rl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),rl.createHTML(t)):t}function sS(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=_m().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&bm[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=iS(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function aS(t){let e=t.querySelectorAll(Pe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function lS(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let a=o.length-2;a>=0;a-=2){let l=n.nodes[o[a]];if(!l||l.hasRequiredAttrs())break;r=H.from(l.create(o[a+1],r)),i++,s++}return new K(r,i,s)}const Ze={},et={},uS={touchstart:!0,touchmove:!0};class cS{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function dS(t){for(let e in Ze){let n=Ze[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{fS(t,o)&&!tc(t,o)&&(t.editable||!(o.type in et))&&n(t,o)},uS[e]?{passive:!0}:void 0)}Ge&&t.dom.addEventListener("input",()=>null),Ql(t)}function On(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function pS(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Ql(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>tc(t,o))})}function tc(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function fS(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function hS(t,e){!tc(t,e)&&Ze[e.type]&&(t.editable||!(e.type in et))&&Ze[e.type](t,e)}et.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Em(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(nn&&Pe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Qo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,Zn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||nS(t,n)?n.preventDefault():On(t,"key")};et.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};et.keypress=(t,e)=>{let n=e;if(Em(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||wt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof de)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function ga(t){return{left:t.clientX,top:t.clientY}}function mS(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function nc(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),r,!0):a(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ho(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function gS(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&te.isSelectable(o)?(Ho(t,new te(n)),!0):!1}function vS(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof te&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(te.isSelectable(a)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ho(t,te.create(t.state.doc,r)),!0):!1}function yS(t,e,n,o,r){return nc(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?vS(t,n):gS(t,n))}function bS(t,e,n,o){return nc(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function _S(t,e,n,o){return nc(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||wS(t,n,o)}function wS(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ho(t,de.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),a=r.before(i);if(s.inlineContent)Ho(t,de.create(o,a+1,a+1+s.content.size));else if(te.isSelectable(s))Ho(t,te.create(o,a));else continue;return!0}}function oc(t){return js(t)}const wm=wt?"metaKey":"ctrlKey";Ze.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=oc(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&mS(n,t.input.lastClick)&&!n[wm]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(ga(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new ES(t,s,n,!!o)):(i=="doubleClick"?bS:_S)(t,s.pos,s.inside,n)?n.preventDefault():On(t,"pointer"))};class ES{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[wm],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const a=r?null:o.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof te&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ct&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),On(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>sn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ga(e))),this.updateAllowDefault(e),this.allowDefault||!n?On(this.view,"pointer"):yS(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ge&&this.mightDrag&&!this.mightDrag.node.isAtom||Pe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ho(this.view,ae.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):On(this.view,"pointer")}move(e){this.updateAllowDefault(e),On(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ze.touchstart=t=>{t.input.lastTouch=Date.now(),oc(t),On(t,"pointer")};Ze.touchmove=t=>{t.input.lastTouch=Date.now(),On(t,"pointer")};Ze.contextmenu=t=>oc(t);function Em(t,e){return t.composing?!0:Ge&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const kS=nn?5e3:-1;et.compositionstart=et.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||Pe&&Jh&&SS(t)))t.markCursor=t.state.storedMarks||n.marks(),js(t,!0),t.markCursor=null;else if(js(t,!e.selection.empty),Ct&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}km(t,kS)};function SS(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}et.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,km(t,20))};function km(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>js(t),e))}function Sm(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=TS());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function MS(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=vk(e.focusNode,e.focusOffset),o=yk(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function TS(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function js(t,e=!1){if(!(nn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Sm(t),e||t.docView&&t.docView.dirty){let n=Qu(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function IS(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ti=it&&Cn<15||Qo&&Ek<604;Ze.copy=et.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=ti?null:n.clipboardData,s=o.content(),{dom:a,text:l}=ec(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):IS(t,a),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xS(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function OS(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?ni(t,o.value,null,r,e):ni(t,o.textContent,o.innerHTML,r,e)},50)}function ni(t,e,n,o,r){let i=mm(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,r,i||K.empty)))return!0;if(!i)return!1;let s=xS(i),a=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Mm(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}et.paste=(t,e)=>{let n=e;if(t.composing&&!nn)return;let o=ti?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&ni(t,Mm(o),o.getData("text/html"),r,n)?n.preventDefault():OS(t,n)};class Tm{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const $S=wt?"altKey":"ctrlKey";function Im(t,e){return t.someProp("dragCopies",o=>!o(e))??!e[$S]}Ze.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(ga(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof te?r.to-1:r.to))){if(o&&o.mightDrag)s=te.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=te.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u,slice:c}=ec(t,a);(!n.dataTransfer.files.length||!Pe||Yh>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ti?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ti||n.dataTransfer.setData("text/plain",u),t.dragging=new Tm(c,Im(t,n),s)};Ze.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};et.dragover=et.dragenter=(t,e)=>e.preventDefault();et.drop=(t,e)=>{try{CS(t,e,t.dragging)}finally{t.dragging=null}};function CS(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(ga(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",f=>{i=f(i,t,!1)}):i=mm(t,Mm(e.dataTransfer),ti?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Im(t,e));if(t.someProp("handleDrop",f=>f(t,e,i||K.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Lh(t.state.doc,r.pos,i):r.pos;a==null&&(a=r.pos);let l=t.state.tr;if(s){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let u=l.mapping.map(a),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,i.content.firstChild):l.replaceRange(u,u,i),l.doc.eq(d))return;let p=l.doc.resolve(u);if(c&&te.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new te(p));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((h,m,v,y)=>f=y),l.setSelection(Zu(t,p,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Ze.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&sn(t)},20))};Ze.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ze.beforeinput=(t,e)=>{if(Pe&&nn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",r=>r(t,Zn(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in et)Ze[t]=et[t];function oi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let Fd=class xm{constructor(e,n){this.toDOM=e,this.spec=n||so,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new mn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof xm&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&oi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Wr=class Zl{constructor(e,n){this.attrs=e,this.spec=n||so}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new mn(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Zl&&oi(this.attrs,e.attrs)&&oi(this.spec,e.spec)}static is(e){return e.type instanceof Zl}destroy(){}},AS=class Om{constructor(e,n){this.attrs=e,this.spec=n||so}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new mn(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof Om&&oi(this.attrs,e.attrs)&&oi(this.spec,e.spec)}destroy(){}},mn=class Nr{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new Nr(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new Nr(e,e,new Fd(n,o))}static inline(e,n,o,r){return new Nr(e,n,new Wr(o,r))}static node(e,n,o,r){return new Nr(e,n,new AS(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Wr}get widget(){return this.type instanceof Fd}};const Po=[],so={};let mt=class Sn{constructor(e,n){this.local=e.length?e:Po,this.children=n.length?n:Po}static create(e,n){return n.length?qs(n,e,0,so):je}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&o.push(a.copy(a.from+r,a.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,o,r+a,i)}}map(e,n,o){return this==je||e.maps.length==0?this:this.mapInner(e,n,0,0,o||so)}mapInner(e,n,o,r,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,o,r);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?RS(this.children,s||[],e,n,o,r,i):s?new Sn(s.sort(ao),Po):je}add(e,n){return n.length?this==je?Sn.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((a,l)=>{let u=l+o,c;if(c=Am(n,a,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<l;)i+=3;r[i]==l?r[i+2]=r[i+2].addInner(a,c,u+1):r.splice(i,0,l,l+a.nodeSize,qs(c,a,u+1,so)),i+=3}});let s=Cm(i?Rm(n):n,-o);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Sn(s.length?this.local.concat(s).sort(ao):this.local,r||this.children)}remove(e){return e.length==0||this==je?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,a=o[i]+n,l=o[i+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,a+1);u!=je?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<r.length;a++)r[a].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(a--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Sn(r,o):je}forChild(e,n){if(this==je)return this;if(n.isLeaf)return Sn.empty;let o,r;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(o=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Wr){let u=Math.max(i,l.from)-i,c=Math.min(s,l.to)-i;u<c&&(r||(r=[])).push(l.copy(u,c))}}if(r){let a=new Sn(r.sort(ao),Po);return o?new $m([a,o]):a}return o||je}eq(e){if(this==e)return!0;if(!(e instanceof Sn)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return rc(this.localsInner(e))}localsInner(e){if(this==je)return Po;if(e.inlineContent||!this.local.some(Wr.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Wr||n.push(this.local[o]);return n}forEachSet(e){e(this)}};mt.empty=new mt([],[]);mt.removeOverlap=rc;const je=mt.empty;let $m=class No{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,so));return No.from(o)}forChild(e,n){if(n.isLeaf)return mt.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=je&&(i instanceof No?o=o.concat(i.members):o.push(i))}return No.from(o)}eq(e){if(!(e instanceof No)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?rc(o?n:n.sort(ao)):Po}static from(e){switch(e.length){case 0:return je;case 1:return e[0];default:return new No(e.every(n=>n instanceof mt)?e:e.reduce((n,o)=>n.concat(o instanceof mt?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function RS(t,e,n,o,r,i,s){let a=t.slice();for(let u=0,c=i;u<n.maps.length;u++){let d=0;n.maps[u].forEach((p,f,h,m)=>{let v=m-h-(f-p);for(let y=0;y<a.length;y+=3){let _=a[y+1];if(_<0||p>_+c-d)continue;let E=a[y]+c-d;f>=E?a[y+1]=p<=E?-2:-1:p>=c&&v&&(a[y]+=v,a[y+1]+=v)}d+=v}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+i),d=c-r;if(d<0||d>=o.content.size){l=!0;continue}let p=n.map(t[u+1]+i,-1),f=p-r,{index:h,offset:m}=o.content.findIndex(d),v=o.maybeChild(h);if(v&&m==d&&m+v.nodeSize==f){let y=a[u+2].mapInner(n,v,c+1,t[u]+i+1,s);y!=je?(a[u]=d,a[u+1]=f,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=DS(a,t,e,n,r,i,s),c=qs(u,o,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,p=0;d<c.children.length;d+=3){let f=c.children[d];for(;p<a.length&&a[p]<f;)p+=3;a.splice(p,0,c.children[d],c.children[d+1],c.children[d+2])}}return new mt(e.sort(ao),a)}function Cm(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new mn(r.from+e,r.to+e,r.type))}return n}function DS(t,e,n,o,r,i,s){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(o,r,u);d?n.push(d):s.onRemove&&s.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function Am(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Rm(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function qs(t,e,n,o){let r=[],i=!1;e.forEach((a,l)=>{let u=Am(t,a,l+n);if(u){i=!0;let c=qs(u,a,n+l+1,o);c!=je&&r.push(l,l+a.nodeSize,c)}});let s=Cm(i?Rm(t):t,-n).sort(ao);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(o.onRemove&&o.onRemove(s[a].spec),s.splice(a--,1));return s.length||r.length?new mt(s,r):je}function ao(t,e){return t.from-e.from||t.to-e.to}function rc(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),jd(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),jd(e,r,o.copy(i.from,o.to)));break}}}return e}function jd(t,e,n){for(;e<t.length&&ao(n,t[e])>0;)e++;t.splice(e,0,n)}function il(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=je&&e.push(o)}),t.cursorWrapper&&e.push(mt.create(t.state.doc,[t.cursorWrapper.deco])),$m.from(e)}const PS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},NS=it&&Cn<=11;class LS{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class BS{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new LS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);it&&Cn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():Ge&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),NS&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,PS)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ad(this.view)){if(this.suppressingSelectionUpdates)return sn(this.view);if(it&&Cn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ho(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Xo(i))n.add(i);for(let i=e.anchorNode;i;i=Xo(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Ad(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}else if(Ct&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,p]=c;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of c){let f=p.parentNode;f&&f.nodeName=="LI"&&(!d||jS(e,d)!=f)&&p.remove()}}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ma(o)&&(u=Qu(e))&&u.eq(ae.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,sn(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),US(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,qS(e,l)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||sn(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(it&&Cn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:p}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(r=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?Re(r)+1:0,a=o.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?Re(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let qd=new WeakMap,zd=!1;function US(t){if(!qd.has(t)&&(qd.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ct,zd)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),zd=!0}}function Gd(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ho(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function FS(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Gd(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Gd(t,n):null}function jS(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function qS(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let a=s;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(i,a.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function zS(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),u,c=l.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],ma(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Pe&&t.input.lastKeyCode===8)for(let v=i;v>r;v--){let y=o.childNodes[v-1],_=y.pmViewDesc;if(y.nodeName=="BR"&&!_){i=v;break}if(!_||_.size)break}let d=t.state.doc,p=t.someProp("domParser")||zr.fromSchema(t.state.schema),f=d.resolve(s),h=null,m=p.parse(o,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:r,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:GS,context:f});if(u&&u[0].pos!=null){let v=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=v),h={anchor:v+s,head:y+s}}return{doc:m,sel:h,from:s,to:a}}function GS(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ge&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ge&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const HS=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function VS(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let M=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Qu(t,M);if(T&&!t.state.selection.eq(T)){if(Pe&&nn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,Zn(13,"Enter"))))return;let I=t.state.tr.setSelection(T);M=="pointer"?I.setMeta("pointer",!0):M=="key"&&I.scrollIntoView(),i&&I.setMeta("composition",i),t.dispatch(I)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=zS(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let h=YS(d.content,u.doc.content,u.from,p,f);if(h&&t.input.domChangeCount++,(Qo&&t.input.lastIOSEnter>Date.now()-225||nn)&&r.some(M=>M.nodeType==1&&!HS.test(M.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",M=>M(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(o&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let M=Hd(t,t.state.doc,u.sel);if(M&&!M.eq(t.state.selection)){let T=t.state.tr.setSelection(M);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof de&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),it&&Cn<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=u.doc.resolveNoCache(h.start-u.from),v=u.doc.resolveNoCache(h.endB-u.from),y=c.resolve(h.start),_=m.sameParent(v)&&m.parent.inlineContent&&y.end()>=h.endA;if((Qo&&t.input.lastIOSEnter>Date.now()-225&&(!_||r.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!_&&m.pos<u.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(u.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",M=>M(t,Zn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&KS(c,h.start,h.endA,m,v)&&t.someProp("handleKeyDown",M=>M(t,Zn(8,"Backspace")))){nn&&Pe&&t.domObserver.suppressSelectionUpdates();return}Pe&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),nn&&!_&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,v=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(M){return M(t,Zn(13,"Enter"))})},20));let E=h.start,b=h.endA,N=M=>{let T=M||t.state.tr.replace(E,b,u.doc.slice(h.start-u.from,h.endB-u.from));if(u.sel){let I=Hd(t,T.doc,u.sel);I&&!(Pe&&t.composing&&I.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==E||I.head==T.mapping.map(b)-1)||it&&I.empty&&I.head==E)&&T.setSelection(I)}return i&&T.setMeta("composition",i),T.scrollIntoView()},S;if(_)if(m.pos==v.pos){it&&Cn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>sn(t),20));let M=N(t.state.tr.delete(E,b)),T=c.resolve(h.start).marksAcross(c.resolve(h.endA));T&&M.ensureMarks(T),t.dispatch(M)}else if(h.endA==h.endB&&(S=WS(m.parent.content.cut(m.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let M=N(t.state.tr);S.type=="add"?M.addMark(E,b,S.mark):M.removeMark(E,b,S.mark),t.dispatch(M)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let M=m.parent.textBetween(m.parentOffset,v.parentOffset),T=()=>N(t.state.tr.insertText(M,E,b));t.someProp("handleTextInput",I=>I(t,E,b,M,T))||t.dispatch(T())}else t.dispatch(N());else t.dispatch(N())}function Hd(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Zu(t,e.resolve(n.anchor),e.resolve(n.head))}function WS(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,a,l;for(let c=0;c<o.length;c++)r=o[c].removeFromSet(r);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(r.length==1&&i.length==0)a=r[0],s="add",l=c=>c.mark(a.addToSet(c.marks));else if(r.length==0&&i.length==1)a=i[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(H.from(u).eq(t))return{mark:a,type:s}}function KS(t,e,n,o,r){if(n-e<=r.pos-o.pos||sl(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(sl(i,!0,!0));return!s.parent.isTextblock||s.pos>n||sl(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function sl(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function YS(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let l=Math.max(0,i-Math.min(s,a));o-=s+l-i}if(s<i&&t.size<e.size){let l=o<=i&&o>=s?i-o:0;i-=l,i&&i<e.size&&Vd(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=o<=i&&o>=a?i-o:0;i-=l,i&&i<t.size&&Vd(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function Vd(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Dm{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new cS,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Xd),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Yd(this),Kd(this),this.nodeViews=Jd(this),this.docView=Td(this.state.doc,Wd(this),il(this),this.dom,this),this.domObserver=new BS(this,(o,r,i,s)=>VS(this,o,r,i,s)),this.domObserver.start(),dS(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ql(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Xd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Sm(this),s=!0),this.state=e;let a=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Jd(this);XS(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ql(this),this.editable=Yd(this),Kd(this);let l=il(this),u=Wd(this),c=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(r.selection))&&(s=!0);let p=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Mk(this);if(s){this.domObserver.stop();let f=d&&(it||Pe)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&JS(r.selection,e.selection);if(d){let h=Pe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=MS(this)),(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Td(e.doc,u,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Yk(this))?sn(this,f):(pm(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():p&&Tk(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&_d(this,n.getBoundingClientRect(),e)}else _d(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new Tm(e.slice,e.move,r<0?void 0:te.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(r=n?n(a):a))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(r=n?n(a):a))return r}}hasFocus(){if(it){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ik(this.dom),sn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Ak(this,e)}coordsAtPos(e,n=1){return tm(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Lk(this,n||this.state,e)}pasteHTML(e,n){return ni(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ni(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ec(this,e)}destroy(){this.docView&&(pS(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],il(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,mk())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return hS(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ge&&this.root.nodeType===11&&_k(this.dom.ownerDocument)==this.dom&&FS(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Dm.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Wd(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[mn.node(0,t.state.doc.content.size,e)]}function Kd(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:mn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Yd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function JS(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Jd(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function XS(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function Xd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Nn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},QS=typeof navigator<"u"&&/Mac/.test(navigator.platform),ZS=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var De=0;De<10;De++)Nn[48+De]=Nn[96+De]=String(De);for(var De=1;De<=24;De++)Nn[De+111]="F"+De;for(var De=65;De<=90;De++)Nn[De]=String.fromCharCode(De+32),zs[De]=String.fromCharCode(De);for(var al in Nn)zs.hasOwnProperty(al)||(zs[al]=Nn[al]);function eM(t){var e=QS&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ZS&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zs:Nn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const tM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),nM=typeof navigator<"u"&&/Win/.test(navigator.platform);function oM(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))tM?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+l)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function rM(t){let e=Object.create(null);for(let n in t)e[oM(n)]=t[n];return e}function ll(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function iM(t){return new Ie({props:{handleKeyDown:Pm(t)}})}function Pm(t){let e=rM(t);return function(n,o){let r=eM(o),i,s=e[ll(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let a=e[ll(r,o,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(nM&&o.ctrlKey&&o.altKey)&&(i=Nn[o.keyCode])&&i!=r){let a=e[ll(i,o)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const sM=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Nm(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const aM=(t,e,n)=>{let o=Nm(t,n);if(!o)return!1;let r=ic(o);if(!r){let s=o.blockRange(),a=s&&pr(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=r.nodeBefore;if(Fm(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Zo(i,"end")||te.isSelectable(i)))for(let s=o.depth;;s--){let a=ha(t.doc,o.before(s),o.after(s),K.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Zo(i,"end")?ae.findFrom(l.doc.resolve(l.mapping.map(r.pos,-1)),-1):te.create(l.doc,r.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},lM=(t,e,n)=>{let o=Nm(t,n);if(!o)return!1;let r=ic(o);return r?Lm(t,r,e):!1},uM=(t,e,n)=>{let o=Bm(t);if(!o)return!1;let r=sc(o);return r?Lm(t,r,e):!1};function Lm(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let c=r.lastChild;if(!c)return!1;r=c}let s=e.nodeAfter,a=s,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=ha(t.doc,i,l,K.empty);if(!u||u.from!=i||u instanceof Pt&&u.slice.size>=l-i)return!1;if(n){let c=t.tr.step(u);c.setSelection(de.create(c.doc,i)),n(c.scrollIntoView())}return!0}function Zo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const cM=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(o.parentOffset>0)return!1;i=ic(o)}let s=i&&i.nodeBefore;return!s||!te.isSelectable(s)?!1:(e&&e(t.tr.setSelection(te.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function ic(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Bm(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const dM=(t,e,n)=>{let o=Bm(t);if(!o)return!1;let r=sc(o);if(!r)return!1;let i=r.nodeAfter;if(Fm(t,r,e,1))return!0;if(o.parent.content.size==0&&(Zo(i,"start")||te.isSelectable(i))){let s=ha(t.doc,o.before(),o.after(),K.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(Zo(i,"start")?ae.findFrom(a.doc.resolve(a.mapping.map(r.pos)),1):te.create(a.doc,a.mapping.map(r.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},pM=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(o.parentOffset<o.parent.content.size)return!1;i=sc(o)}let s=i&&i.nodeAfter;return!s||!te.isSelectable(s)?!1:(e&&e(t.tr.setSelection(te.create(t.doc,i.pos)).scrollIntoView()),!0)};function sc(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const fM=(t,e)=>{let n=t.selection,o=n instanceof te,r;if(o){if(n.node.isTextblock||!Fn(t.doc,n.from))return!1;r=n.from}else if(r=fa(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(te.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},hM=(t,e)=>{let n=t.selection,o;if(n instanceof te){if(n.node.isTextblock||!Fn(t.doc,n.to))return!1;o=n.to}else if(o=fa(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},mM=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&pr(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},gM=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
|
||
`).scrollIntoView()),!0)};function Um(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const vM=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=Um(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(ae.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},yM=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof $n||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Um(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(de.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},bM=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(zo(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&pr(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)},_M=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(te.create(t.doc,r))),!0)};function wM(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Fn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Fm(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,a,l=r.type.spec.isolating||i.type.spec.isolating;if(!l&&wM(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,h=H.empty;for(let y=s.length-1;y>=0;y--)h=H.from(s[y].create(null,h));h=H.from(r.copy(h));let m=t.tr.step(new ut(e.pos-1,f,e.pos,f,new K(h,1,0),s.length,!0)),v=m.doc.resolve(f+2*s.length);v.nodeAfter&&v.nodeAfter.type==r.type&&Fn(m.doc,v.pos)&&m.join(v.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||o>0&&l?null:ae.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),p=d&&pr(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(u&&Zo(i,"start",!0)&&Zo(r,"end")){let f=r,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let m=i,v=1;for(;!m.isTextblock;m=m.firstChild)v++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let y=H.empty;for(let E=h.length-1;E>=0;E--)y=H.from(h[E].copy(y));let _=t.tr.step(new ut(e.pos-h.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new K(y,h.length,0),0,!0));n(_.scrollIntoView())}return!0}}return!1}function jm(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(de.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const EM=jm(-1),kM=jm(1);function SM(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),a=s&&Yu(s,t,e);return a?(o&&o(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Qd(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,u)=>{if(r)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)r=!0;else{let c=n.doc.resolve(u),d=c.index();r=c.parent.canReplaceWith(d,d+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e)}o(i.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function MM(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let a=o?n.tr:null;return TM(a,s,t,e)?(o&&o(a.scrollIntoView()),!0):!1}}function TM(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);i=new Ns(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ns(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let a=Yu(i,n,o,e);return a?(t&&IM(t,e,a,r,n),!0):!1}function IM(t,e,n,o,r){let i=H.empty;for(let c=n.length-1;c>=0;c--)i=H.from(n[c].type.create(n[c].attrs,i));t.step(new ut(e.start-(o?2:0),e.end,e.start,e.end,new K(i,0,0),n.length,!0));let s=0;for(let c=0;c<n.length;c++)n[c].type==r&&(s=c+1);let a=n.length-s,l=e.start+n.length-(o?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,p=!0;c<d;c++,p=!1)!p&&zo(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function xM(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?OM(e,n,t,i):$M(e,n,i):!0:!1}}function OM(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new ut(i-1,s,i,s,new K(H.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Ns(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const a=pr(o);if(a==null)return!1;r.lift(o,a);let l=r.doc.resolve(r.mapping.map(i,-1)-1);return Fn(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function $M(t,e,n){let o=t.tr,r=n.parent;for(let f=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)f-=r.child(h).nodeSize,o.delete(f-1,f+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==r.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?H.empty:H.from(r))))return!1;let d=i.pos,p=d+s.nodeSize;return o.step(new ut(d-(a?1:0),p+(l?1:0),d+1,p-1,new K((a?H.empty:H.from(r.copy(H.empty))).append(l?H.empty:H.from(r.copy(H.empty))),a?0:1,l?0:1),a?0:1)),e(o.scrollIntoView()),!0}function CM(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=H.from(u?t.create():null),d=new K(H.from(t.create(null,H.from(a.type.create(null,c)))),u?3:1,0),p=i.start,f=i.end;n(e.tr.step(new ut(p-(u?3:1),f,p,f,d,1,!0)).scrollIntoView())}return!0}}function va(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}let ya=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:o}=this,{view:r}=n,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const c=l(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,a=[],l=!!e,u=e||i.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(o).map(([p,f])=>[p,(...h)=>{const m=this.buildProps(u,n),v=f(...h)(m);return a.push(v),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,n=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,a={tr:e,editor:r,view:s,state:va({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}};class AM{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const o=this.callbacks[e];return o&&o.forEach(r=>r.apply(this,n)),this}off(e,n){const o=this.callbacks[e];return o&&(n?this.callbacks[e]=o.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const o=(...r)=>{this.off(e,o),n.apply(this,r)};return this.on(e,o)}removeAllListeners(){this.callbacks={}}}function Y(t,e,n){return t.config[e]===void 0&&t.parent?Y(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Y(t.parent,e,n):null}):t.config[e]}function ba(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function qm(t){const e=[],{nodeExtensions:n,markExtensions:o}=ba(t),r=[...n,...o],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:r},l=Y(s,"addGlobalAttributes",a);l&&l().forEach(u=>{u.types.forEach(c=>{Object.entries(u.attributes).forEach(([d,p])=>{e.push({type:c,name:d,attribute:{...i,...p}})})})})}),r.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},l=Y(s,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const p={...i,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:s.name,name:c,attribute:p})})}),e}function Ce(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Me(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const s=i?String(i).split(" "):[],a=o[r]?o[r].split(" "):[],l=s.filter(u=>!a.includes(u));o[r]=[...a,...l].join(" ")}else if(r==="style"){const s=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],l=new Map;a.forEach(u=>{const[c,d]=u.split(":").map(p=>p.trim());l.set(c,d)}),s.forEach(u=>{const[c,d]=u.split(":").map(p=>p.trim());l.set(c,d)}),o[r]=Array.from(l.entries()).map(([u,c])=>`${u}: ${c}`).join("; ")}else o[r]=i}),o},{})}function eu(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Me(n,o),{})}function zm(t){return typeof t=="function"}function ue(t,e=void 0,...n){return zm(t)?e?t.bind(e)(...n):t(...n):t}function RM(t={}){return Object.keys(t).length===0&&t.constructor===Object}function DM(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Zd(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):DM(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...o,...r}}}}function ep(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&RM(n)?!1:n!=null))}function PM(t,e){var n;const o=qm(t),{nodeExtensions:r,markExtensions:i}=ba(t),s=(n=r.find(u=>Y(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(r.map(u=>{const c=o.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},p=t.reduce((y,_)=>{const E=Y(_,"extendNodeSchema",d);return{...y,...E?E(u):{}}},{}),f=ep({...p,content:ue(Y(u,"content",d)),marks:ue(Y(u,"marks",d)),group:ue(Y(u,"group",d)),inline:ue(Y(u,"inline",d)),atom:ue(Y(u,"atom",d)),selectable:ue(Y(u,"selectable",d)),draggable:ue(Y(u,"draggable",d)),code:ue(Y(u,"code",d)),whitespace:ue(Y(u,"whitespace",d)),linebreakReplacement:ue(Y(u,"linebreakReplacement",d)),defining:ue(Y(u,"defining",d)),isolating:ue(Y(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var _;return[y.name,{default:(_=y==null?void 0:y.attribute)===null||_===void 0?void 0:_.default}]}))}),h=ue(Y(u,"parseHTML",d));h&&(f.parseDOM=h.map(y=>Zd(y,c)));const m=Y(u,"renderHTML",d);m&&(f.toDOM=y=>m({node:y,HTMLAttributes:eu(y,c)}));const v=Y(u,"renderText",d);return v&&(f.toText=v),[u.name,f]})),l=Object.fromEntries(i.map(u=>{const c=o.filter(v=>v.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},p=t.reduce((v,y)=>{const _=Y(y,"extendMarkSchema",d);return{...v,..._?_(u):{}}},{}),f=ep({...p,inclusive:ue(Y(u,"inclusive",d)),excludes:ue(Y(u,"excludes",d)),group:ue(Y(u,"group",d)),spanning:ue(Y(u,"spanning",d)),code:ue(Y(u,"code",d)),attrs:Object.fromEntries(c.map(v=>{var y;return[v.name,{default:(y=v==null?void 0:v.attribute)===null||y===void 0?void 0:y.default}]}))}),h=ue(Y(u,"parseHTML",d));h&&(f.parseDOM=h.map(v=>Zd(v,c)));const m=Y(u,"renderHTML",d);return m&&(f.toDOM=v=>m({mark:v,HTMLAttributes:eu(v,c)})),[u.name,f]}));return new Sh({topNode:s,nodes:a,marks:l})}function ul(t,e){return e.nodes[t]||e.marks[t]||null}function tp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ac(t,e){const n=Si.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const NM=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,a)=>{var l,u;const c=((u=(l=r.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:r,pos:i,parent:s,index:a}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?c:c.slice(0,Math.max(0,o-i))}),n};function lc(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class _a{constructor(e){this.find=e.find,this.handler=e.handler}}const LM=(t,e)=>{if(lc(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ns(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(o);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(p=>p.type.spec.code))return!1;let c=!1;const d=NM(u)+i;return s.forEach(p=>{if(c)return;const f=LM(d,p.find);if(!f)return;const h=l.state.tr,m=va({state:l.state,transaction:h}),v={from:o-(f[0].length-i.length),to:r},{commands:y,chain:_,can:E}=new ya({editor:n,state:m});p.handler({state:m,range:v,match:f,commands:y,chain:_,can:E})===null||!h.steps.length||(h.setMeta(a,{transform:h,from:o,to:r,text:i}),l.dispatch(h),c=!0)}),c}function BM(t){const{editor:e,rules:n}=t,o=new Ie({state:{init(){return null},apply(r,i,s){const a=r.getMeta(o);if(a)return a;const l=r.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=ac(H.from(u),s.schema);const{from:c}=l,d=c+u.length;ns({editor:e,from:c,to:d,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,a){return ns({editor:e,from:i,to:s,text:a,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ns({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ns({editor:e,from:s.pos,to:s.pos,text:`
|
||
`,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function UM(t){return Object.prototype.toString.call(t).slice(8,-1)}function rs(t){return UM(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wa(t,e){const n={...t};return rs(t)&&rs(e)&&Object.keys(e).forEach(o=>{rs(e[o])&&rs(t[o])?n[o]=wa(t[o],e[o]):n[o]=e[o]}),n}let Oi=class tu{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(Y(this,"addOptions",{name:this.name}))),this.storage=ue(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new tu(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new tu(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ue(Y(n,"addOptions",{name:n.name})),n.storage=ue(Y(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const i=r.marks();if(!i.find(a=>(a==null?void 0:a.type.name)===n.name))return!1;const s=i.find(a=>(a==null?void 0:a.type.name)===n.name);return s&&o.removeStoredMark(s),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}};function FM(t){return typeof t=="number"}class jM{constructor(e){this.find=e.find,this.handler=e.handler}}const qM=(t,e,n)=>{if(lc(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function zM(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new ya({editor:e,state:n}),d=[];return n.doc.nodesBetween(o,r,(p,f)=>{if(!p.isTextblock||p.type.spec.code)return;const h=Math.max(o,f),m=Math.min(r,f+p.content.size),v=p.textBetween(h-f,m-f,void 0,"");qM(v,i.find,s).forEach(y=>{if(y.index===void 0)return;const _=h+y.index+1,E=_+y[0].length,b={from:n.tr.mapping.map(_),to:n.tr.mapping.map(E)},N=i.handler({state:n,range:b,match:y,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});d.push(N)})}),d.every(p=>p!==null)}let is=null;const GM=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function HM(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:c,to:d,rule:p,pasteEvt:f})=>{const h=u.tr,m=va({state:u,transaction:h});if(!(!zM({editor:e,state:m,from:Math.max(c-1,0),to:d.b-1,rule:p,pasteEvent:f,dropEvent:a})||!h.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,h}};return n.map(u=>new Ie({view(c){const d=f=>{var h;o=!((h=c.dom.parentElement)===null||h===void 0)&&h.contains(f.target)?c.dom.parentElement:null,o&&(is=e)},p=()=>{is&&(is=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(c,d)=>{if(i=o===c.dom.parentElement,a=d,!i){const p=is;p!=null&&p.isEditable&&setTimeout(()=>{const f=p.state.selection;f&&p.commands.deleteRange({from:f.from,to:f.to})},10)}return!1},paste:(c,d)=>{var p;const f=(p=d.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=d,r=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(c,d,p)=>{const f=c[0],h=f.getMeta("uiEvent")==="paste"&&!r,m=f.getMeta("uiEvent")==="drop"&&!i,v=f.getMeta("applyPasteRules"),y=!!v;if(!h&&!m&&!y)return;if(y){let{text:b}=v;typeof b=="string"?b=b:b=ac(H.from(b),p.schema);const{from:N}=v,S=N+b.length,M=GM(b);return l({rule:u,state:p,from:N,to:{b:S},pasteEvt:M})}const _=d.doc.content.findDiffStart(p.doc.content),E=d.doc.content.findDiffEnd(p.doc.content);if(!(!FM(_)||!E||_===E.b))return l({rule:u,state:p,from:_,to:E,pasteEvt:s})}}))}function VM(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}let WM=class Lr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Lr.resolve(e),this.schema=PM(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Lr.sort(Lr.flatten(e)),o=VM(n.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const o={name:n.name,options:n.options,storage:n.storage},r=Y(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((n,o)=>{const r=Y(n,"priority")||100,i=Y(o,"priority")||100;return r>i?-1:r<i?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const o={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:ul(n.name,this.schema)},r=Y(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=Lr.sort([...this.extensions].reverse()),o=[],r=[],i=n.map(s=>{const a={name:s.name,options:s.options,storage:s.storage,editor:e,type:ul(s.name,this.schema)},l=[],u=Y(s,"addKeyboardShortcuts",a);let c={};if(s.type==="mark"&&Y(s,"exitable",a)&&(c.ArrowRight=()=>Oi.handleExit({editor:e,mark:s})),u){const m=Object.fromEntries(Object.entries(u()).map(([v,y])=>[v,()=>y({editor:e})]));c={...c,...m}}const d=iM(c);l.push(d);const p=Y(s,"addInputRules",a);tp(s,e.options.enableInputRules)&&p&&o.push(...p());const f=Y(s,"addPasteRules",a);tp(s,e.options.enablePasteRules)&&f&&r.push(...f());const h=Y(s,"addProseMirrorPlugins",a);if(h){const m=h();l.push(...m)}return l}).flat();return[BM({editor:e,rules:o}),...HM({editor:e,rules:r}),...i]}get attributes(){return qm(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ba(this.extensions);return Object.fromEntries(n.filter(o=>!!Y(o,"addNodeView")).map(o=>{const r=this.attributes.filter(l=>l.type===o.name),i={name:o.name,options:o.options,storage:o.storage,editor:e,type:Ce(o.name,this.schema)},s=Y(o,"addNodeView",i);if(!s)return[];const a=(l,u,c,d,p)=>{const f=eu(l,r);return s()({node:l,view:u,getPos:c,decorations:d,innerDecorations:p,editor:e,extension:o,HTMLAttributes:f})};return[o.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:ul(e.name,this.schema)};e.type==="mark"&&(!((n=ue(Y(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=Y(e,"onBeforeCreate",o),i=Y(e,"onCreate",o),s=Y(e,"onUpdate",o),a=Y(e,"onSelectionUpdate",o),l=Y(e,"onTransaction",o),u=Y(e,"onFocus",o),c=Y(e,"onBlur",o),d=Y(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}},Ue=class nu{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(Y(this,"addOptions",{name:this.name}))),this.storage=ue(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new nu(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new nu({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ue(Y(n,"addOptions",{name:n.name})),n.storage=ue(Y(n,"addStorage",{name:n.name,options:n.options})),n}};function Gm(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
|
||
|
||
`,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(o,r,(l,u,c,d)=>{var p;l.isBlock&&u>o&&(a+=i);const f=s==null?void 0:s[l.type.name];if(f)return c&&(a+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(p=l==null?void 0:l.text)===null||p===void 0?void 0:p.slice(Math.max(o,u)-u,r-u))}),a}function uc(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const KM=Ue.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ie({key:new Be("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=uc(n);return Gm(o,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),YM=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),JM=(t=!1)=>({commands:e})=>e.setContent("",t),XM=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),p=u.resolve(c.map(l+a.nodeSize)),f=d.blockRange(p);if(!f)return;const h=pr(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(h||h===0)&&e.lift(f,h)})}),!0},QM=t=>e=>t(e),ZM=()=>({state:t,dispatch:e})=>yM(t,e),e1=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new de(o.doc.resolve(Math.max(s-1,0)))),!0},t1=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const s=r.before(i),a=r.after(i);t.delete(s,a).scrollIntoView()}return!0}return!1},n1=t=>({tr:e,state:n,dispatch:o})=>{const r=Ce(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const a=i.before(s),l=i.after(s);e.delete(a,l).scrollIntoView()}return!0}return!1},o1=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},r1=()=>({state:t,dispatch:e})=>sM(t,e),i1=()=>({commands:t})=>t.keyboardShortcut("Enter"),s1=()=>({state:t,dispatch:e})=>vM(t,e);function Gs(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:lc(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function Hm(t,e,n={}){return t.find(o=>o.type===e&&Gs(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function np(t,e,n={}){return!!Hm(t,e,n)}function cc(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!Hm([...r.node.marks],e,n)))return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(;i>0&&np([...t.parent.child(i-1).marks],e,n);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&np([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function jn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const a1=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=jn(t,o.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(r){const d=cc(l,i,e);if(d&&d.from<=u&&d.to>=c){const p=de.create(s,d.from,d.to);n.setSelection(p)}}return!0},l1=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function dc(t){return t instanceof de}function on(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Vm(t,e=null){if(!e)return null;const n=ae.atStart(t),o=ae.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?de.create(t,on(0,r,i),on(t.content.size,r,i)):de.create(t,on(e,r,i),on(e,r,i))}function op(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Hs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function u1(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const c1=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Hs()||op())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),u1()&&!Hs()&&!op()&&o.dom.focus({preventScroll:!0}))})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!dc(n.state.selection))return s(),!0;const a=Vm(r.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||r.setSelection(a),l&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},d1=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),p1=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Wm=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&Wm(o)}return t};function ss(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Wm(n)}function ri(t,e,n){if(t instanceof rn||t instanceof H)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return H.fromArray(t.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),ri("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Sh({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?zr.fromSchema(l).parseSlice(ss(t),n.parseOptions):zr.fromSchema(l).parse(ss(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=zr.fromSchema(e);return n.slice?i.parseSlice(ss(t),n.parseOptions).content:i.parse(ss(t),n.parseOptions)}return ri("",e,n)}function f1(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof Pt||r instanceof ut))return;const i=t.mapping.maps[o];let s=0;i.forEach((a,l,u,c)=>{s===0&&(s=c)}),t.setSelection(ae.near(t.doc.resolve(s),n))}const h1=t=>!("type"in t),m1=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=m=>{i.emit("contentError",{editor:i,error:m,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ri(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(m){l(m)}try{a=ri(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(m){return l(m),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,f=!0;if((h1(a)?a:[a]).forEach(m=>{m.check(),p=p?m.isText&&m.marks.length===0:!1,f=f?m.isBlock:!1}),c===d&&f){const{parent:m}=o.doc.resolve(c);m.isTextblock&&!m.type.spec.code&&!m.childCount&&(c-=1,d+=1)}let h;if(p){if(Array.isArray(e))h=e.map(m=>m.text||"").join("");else if(e instanceof H){let m="";e.forEach(v=>{v.text&&(m+=v.text)}),h=m}else typeof e=="object"&&e&&e.text?h=e.text:h=e;o.insertText(h,c,d)}else h=a,o.replaceWith(c,d,h);n.updateSelection&&f1(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:c,text:h})}return!0},g1=()=>({state:t,dispatch:e})=>fM(t,e),v1=()=>({state:t,dispatch:e})=>hM(t,e),y1=()=>({state:t,dispatch:e})=>aM(t,e),b1=()=>({state:t,dispatch:e})=>dM(t,e),_1=()=>({state:t,dispatch:e,tr:n})=>{try{const o=fa(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},w1=()=>({state:t,dispatch:e,tr:n})=>{try{const o=fa(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},E1=()=>({state:t,dispatch:e})=>lM(t,e),k1=()=>({state:t,dispatch:e})=>uM(t,e);function Km(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function S1(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Hs()||Km()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}const M1=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=S1(t).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const c=u.map(o.mapping);c&&r&&o.maybeStep(c)}),!0};function ii(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?Ce(e,t.schema):null,a=[];t.doc.nodesBetween(o,r,(c,d)=>{if(c.isText)return;const p=Math.max(o,d),f=Math.min(r,d+c.nodeSize);a.push({node:c,from:p,to:f})});const l=r-o,u=a.filter(c=>s?s.name===c.node.type.name:!0).filter(c=>Gs(c.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const T1=(t,e={})=>({state:n,dispatch:o})=>{const r=Ce(t,n.schema);return ii(n,r,e)?mM(n,o):!1},I1=()=>({state:t,dispatch:e})=>bM(t,e),x1=t=>({state:e,dispatch:n})=>{const o=Ce(t,e.schema);return xM(o)(e,n)},O1=()=>({state:t,dispatch:e})=>gM(t,e);function Ea(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function rp(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}const $1=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const a=Ea(typeof t=="string"?t:t.name,o.schema);return a?(a==="node"&&(i=Ce(t,o.schema)),a==="mark"&&(s=jn(t,o.schema)),r&&n.selection.ranges.forEach(l=>{o.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{i&&i===u.type&&n.setNodeMarkup(c,void 0,rp(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(d=>{s===d.type&&n.addMark(c,c+u.nodeSize,s.create(rp(d.attrs,e)))})})}),!0):!1},C1=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),A1=()=>({tr:t,dispatch:e})=>{if(e){const n=new $n(t.doc);t.setSelection(n)}return!0},R1=()=>({state:t,dispatch:e})=>cM(t,e),D1=()=>({state:t,dispatch:e})=>pM(t,e),P1=()=>({state:t,dispatch:e})=>_M(t,e),N1=()=>({state:t,dispatch:e})=>kM(t,e),L1=()=>({state:t,dispatch:e})=>EM(t,e);function ou(t,e,n={},o={}){return ri(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const B1=(t,e=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:a})=>{var l,u;const{doc:c}=i;if(n.preserveWhitespace!=="full"){const d=ou(t,r.schema,n,{errorOnInvalidContent:(l=o.errorOnInvalidContent)!==null&&l!==void 0?l:r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return s&&i.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=o.errorOnInvalidContent)!==null&&u!==void 0?u:r.options.enableContentCheck})};function Ym(t,e){const n=jn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,l=>{s.push(...l.marks)});const a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function U1(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function F1(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function pc(t){return e=>F1(e.$from,t)}function Jm(t,e){const n={from:0,to:t.content.size};return Gm(t,n,e)}function j1(t,e){const n=Ce(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function q1(t,e){const n=Ea(typeof e=="string"?e:e.name,t.schema);return n==="node"?j1(t,e):n==="mark"?Ym(t,e):{}}function Xm(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=cc(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}function bs(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function ru(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?jn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>i?i.name===c.type.name:!0).find(c=>Gs(c.attrs,n,{strict:!1}));let s=0;const a=[];if(r.forEach(({$from:c,$to:d})=>{const p=c.pos,f=d.pos;t.doc.nodesBetween(p,f,(h,m)=>{if(!h.isText&&!h.marks.length)return;const v=Math.max(p,m),y=Math.min(f,m+h.nodeSize),_=y-v;s+=_,a.push(...h.marks.map(E=>({mark:E,from:v,to:y})))})}),s===0)return!1;const l=a.filter(c=>i?i.name===c.mark.type.name:!0).filter(c=>Gs(c.mark.attrs,n,{strict:!1})).reduce((c,d)=>c+d.to-d.from,0),u=a.filter(c=>i?c.mark.type!==i&&c.mark.type.excludes(i):!0).reduce((c,d)=>c+d.to-d.from,0);return(l>0?l+u:l)>=s}function z1(t,e,n={}){if(!e)return ii(t,null,n)||ru(t,null,n);const o=Ea(e,t.schema);return o==="node"?ii(t,e,n):o==="mark"?ru(t,e,n):!1}function ip(t,e){const{nodeExtensions:n}=ba(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=ue(Y(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function ka(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!==null&&o!==void 0?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(ka(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function Qm(t){return t instanceof te}function Zm(t,e,n){const o=t.state.doc.content.size,r=on(e,0,o),i=on(n,0,o),s=t.coordsAtPos(r),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom),c=Math.min(s.left,a.left),d=Math.max(s.right,a.right),p=d-c,f=u-l,h={top:l,bottom:u,left:c,right:d,width:p,height:f,x:c,y:l};return{...h,toJSON:()=>h}}function G1(t,e,n){var o;const{selection:r}=e;let i=null;if(dc(r)&&(i=r.$cursor),i){const a=(o=t.storedMarks)!==null&&o!==void 0?o:i.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:s}=r;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,p)=>{if(u)return!1;if(c.isInline){const f=!p||p.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=f&&h}return!u}),u})}const H1=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=jn(t,o.schema);if(r)if(s){const u=Ym(o,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;o.doc.nodesBetween(c,d,(p,f)=>{const h=Math.max(f,c),m=Math.min(f+p.nodeSize,d);p.marks.find(v=>v.type===l)?p.marks.forEach(v=>{l===v.type&&n.addMark(h,m,l.create({...v.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return G1(o,n,l)},V1=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),W1=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=Ce(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:a})=>Qd(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Qd(i,{...s,...e})(a,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},K1=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=on(t,0,o.content.size),i=te.create(o,r);e.setSelection(i)}return!0},Y1=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=de.atStart(o).from,a=de.atEnd(o).to,l=on(r,s,a),u=on(i,s,a),c=de.create(o,l,u);e.setSelection(c)}return!0},J1=t=>({state:e,dispatch:n})=>{const o=Ce(t,e.schema);return CM(o)(e,n)};function sp(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e==null?void 0:e.includes(r.type.name));t.tr.ensureMarks(o)}}const X1=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:a,$to:l}=i,u=r.extensionManager.attributes,c=bs(u,a.node().type.name,a.node().attrs);if(i instanceof te&&i.node.isBlock)return!a.parentOffset||!zo(s,a.pos)?!1:(o&&(t&&sp(n,r.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=a.depth===0?void 0:U1(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&p?[{type:p,attrs:c}]:void 0,h=zo(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!h&&zo(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(h=!0,f=p?[{type:p,attrs:c}]:void 0),o){if(h&&(i instanceof de&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),p&&!d&&!a.parentOffset&&a.parent.type!==p)){const m=e.mapping.map(a.before()),v=e.doc.resolve(m);a.node(-1).canReplaceWith(v.index(),v.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}t&&sp(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return h},Q1=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const a=Ce(t,o.schema),{$from:l,$to:u}=o.selection,c=o.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const p=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let y=H.empty;const _=l.index(-1)?1:l.index(-2)?2:3;for(let T=l.depth-_;T>=l.depth-3;T-=1)y=H.from(l.node(T).copy(y));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,b={...bs(p,l.node().type.name,l.node().attrs),...e},N=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(b))||void 0;y=y.append(H.from(a.createAndFill(null,N)||void 0));const S=l.before(l.depth-(_-1));n.replace(S,l.after(-E),new K(y,4-_,0));let M=-1;n.doc.nodesBetween(S,n.doc.content.size,(T,I)=>{if(M>-1)return!1;T.isTextblock&&T.content.size===0&&(M=I+1)}),M>-1&&n.setSelection(de.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}const f=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...bs(p,d.type.name,d.attrs),...e},m={...bs(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const v=f?[{type:a,attrs:h},{type:f,attrs:m}]:[{type:a,attrs:h}];if(!zo(n.doc,l.pos,2))return!1;if(r){const{selection:y,storedMarks:_}=o,{splittableMarks:E}=i.extensionManager,b=_||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,v).scrollIntoView(),!b||!r)return!0;const N=b.filter(S=>E.includes(S.type.name));n.ensureMarks(N)}return!0},cl=(t,e)=>{const n=pc(i=>i.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&Fn(t.doc,n.pos)&&t.join(n.pos),!0},dl=(t,e)=>{const n=pc(i=>i.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&Fn(t.doc,o)&&t.join(o),!0},Z1=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:p}=r.extensionManager,f=Ce(t,s.schema),h=Ce(e,s.schema),{selection:m,storedMarks:v}=s,{$from:y,$to:_}=m,E=y.blockRange(_),b=v||m.$to.parentOffset&&m.$from.marks();if(!E)return!1;const N=pc(S=>ip(S.type.name,d))(m);if(E.depth>=1&&N&&E.depth-N.depth<=1){if(N.node.type===f)return u.liftListItem(h);if(ip(N.node.type.name,d)&&f.validContent(N.node.content)&&a)return l().command(()=>(i.setNodeMarkup(N.pos,f),!0)).command(()=>cl(i,f)).command(()=>dl(i,f)).run()}return!n||!b||!a?l().command(()=>c().wrapInList(f,o)?!0:u.clearNodes()).wrapInList(f,o).command(()=>cl(i,f)).command(()=>dl(i,f)).run():l().command(()=>{const S=c().wrapInList(f,o),M=b.filter(T=>p.includes(T.type.name));return i.ensureMarks(M),S?!0:u.clearNodes()}).wrapInList(f,o).command(()=>cl(i,f)).command(()=>dl(i,f)).run()},eT=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=jn(t,o.schema);return ru(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},tT=(t,e,n={})=>({state:o,commands:r})=>{const i=Ce(t,o.schema),s=Ce(e,o.schema),a=ii(o,i,n);let l;return o.selection.$anchor.sameParent(o.selection.$head)&&(l=o.selection.$anchor.parent.attrs),a?r.setNode(s,l):r.setNode(i,{...l,...n})},nT=(t,e={})=>({state:n,commands:o})=>{const r=Ce(t,n.schema);return ii(n,r,e)?o.lift(r):o.wrapIn(r,e)},oT=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1},rT=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},iT=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=jn(t,o.schema),{$from:u,empty:c,ranges:d}=a;if(!r)return!0;if(c&&s){let{from:p,to:f}=a;const h=(i=u.marks().find(v=>v.type===l))===null||i===void 0?void 0:i.attrs,m=cc(u,l,h);m&&(p=m.from,f=m.to),n.removeMark(p,f,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},sT=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const a=Ea(typeof t=="string"?t:t.name,o.schema);return a?(a==="node"&&(i=Ce(t,o.schema)),a==="mark"&&(s=jn(t,o.schema)),r&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;let d,p,f,h;n.selection.empty?o.doc.nodesBetween(u,c,(m,v)=>{i&&i===m.type&&(f=Math.max(v,u),h=Math.min(v+m.nodeSize,c),d=v,p=m)}):o.doc.nodesBetween(u,c,(m,v)=>{v<u&&i&&i===m.type&&(f=Math.max(v,u),h=Math.min(v+m.nodeSize,c),d=v,p=m),v>=u&&v<=c&&(i&&i===m.type&&n.setNodeMarkup(v,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(y=>{if(s===y.type){const _=Math.max(v,u),E=Math.min(v+m.nodeSize,c);n.addMark(_,E,s.create({...y.attrs,...e}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(m=>{s===m.type&&n.addMark(f,h,s.create({...m.attrs,...e}))}))}),!0):!1},aT=(t,e={})=>({state:n,dispatch:o})=>{const r=Ce(t,n.schema);return SM(r,e)(n,o)},lT=(t,e={})=>({state:n,dispatch:o})=>{const r=Ce(t,n.schema);return MM(r,e)(n,o)};var uT=Object.freeze({__proto__:null,blur:YM,clearContent:JM,clearNodes:XM,command:QM,createParagraphNear:ZM,cut:e1,deleteCurrentNode:t1,deleteNode:n1,deleteRange:o1,deleteSelection:r1,enter:i1,exitCode:s1,extendMarkRange:a1,first:l1,focus:c1,forEach:d1,insertContent:p1,insertContentAt:m1,joinBackward:y1,joinDown:v1,joinForward:b1,joinItemBackward:_1,joinItemForward:w1,joinTextblockBackward:E1,joinTextblockForward:k1,joinUp:g1,keyboardShortcut:M1,lift:T1,liftEmptyBlock:I1,liftListItem:x1,newlineInCode:O1,resetAttributes:$1,scrollIntoView:C1,selectAll:A1,selectNodeBackward:R1,selectNodeForward:D1,selectParentNode:P1,selectTextblockEnd:N1,selectTextblockStart:L1,setContent:B1,setMark:H1,setMeta:V1,setNode:W1,setNodeSelection:K1,setTextSelection:Y1,sinkListItem:J1,splitBlock:X1,splitListItem:Q1,toggleList:Z1,toggleMark:eT,toggleNode:tT,toggleWrap:nT,undoInputRule:oT,unsetAllMarks:rT,unsetMark:iT,updateAttributes:sT,wrapIn:aT,wrapInList:lT});const cT=Ue.create({name:"commands",addCommands(){return{...uT}}}),dT=Ue.create({name:"drop",addProseMirrorPlugins(){return[new Ie({key:new Be("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),pT=Ue.create({name:"editable",addProseMirrorPlugins(){return[new Ie({key:new Be("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fT=new Be("focusEvents"),hT=Ue.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ie({key:fT,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),mT=Ue.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:a,doc:l}=s,{empty:u,$anchor:c}=a,{pos:d,parent:p}=c,f=c.parent.isTextblock&&d>0?s.doc.resolve(d-1):c,h=f.parent.type.spec.isolating,m=c.pos-c.parentOffset,v=h&&f.parent.childCount===1?m===c.pos:ae.atStart(l).from===d;return!u||!p.type.isTextblock||p.textContent.length||!v||v&&c.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},r={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Hs()||Km()?r:o},addProseMirrorPlugins(){return[new Ie({key:new Be("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(f=>f.getMeta("composition")))return;const o=t.some(f=>f.docChanged)&&!e.doc.eq(n.doc),r=t.some(f=>f.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:a}=e.selection,l=ae.atStart(e.doc).from,u=ae.atEnd(e.doc).to;if(i||!(s===l&&a===u)||!ka(n.doc))return;const c=n.tr,d=va({state:n,transaction:c}),{commands:p}=new ya({editor:this.editor,state:d});if(p.clearNodes(),!!c.steps.length)return c}})]}}),gT=Ue.create({name:"paste",addProseMirrorPlugins(){return[new Ie({key:new Be("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),vT=Ue.create({name:"tabindex",addProseMirrorPlugins(){return[new Ie({key:new Be("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});let yT=class Lo{get name(){return this.node.type.name}constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Lo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Lo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Lo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!r&&a.depth<=this.depth)return;const l=new Lo(a,this.editor,r,r?n:null);r&&(l.actualDepth=this.depth+1),e.push(new Lo(a,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;)r.node.type.name===e&&(Object.keys(n).length>0||(o=r)),r=r.parent;return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(a=>n[a]===s.node.attrs[a])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const bT=`.ProseMirror {
|
||
position: relative;
|
||
}
|
||
|
||
.ProseMirror {
|
||
word-wrap: break-word;
|
||
white-space: pre-wrap;
|
||
white-space: break-spaces;
|
||
-webkit-font-variant-ligatures: none;
|
||
font-variant-ligatures: none;
|
||
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] {
|
||
white-space: normal;
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
.ProseMirror pre {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
img.ProseMirror-separator {
|
||
display: inline !important;
|
||
border: none !important;
|
||
margin: 0 !important;
|
||
width: 0 !important;
|
||
height: 0 !important;
|
||
}
|
||
|
||
.ProseMirror-gapcursor {
|
||
display: none;
|
||
pointer-events: none;
|
||
position: absolute;
|
||
margin: 0;
|
||
}
|
||
|
||
.ProseMirror-gapcursor:after {
|
||
content: "";
|
||
display: block;
|
||
position: absolute;
|
||
top: -2px;
|
||
width: 20px;
|
||
border-top: 1px solid black;
|
||
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||
}
|
||
|
||
@keyframes ProseMirror-cursor-blink {
|
||
to {
|
||
visibility: hidden;
|
||
}
|
||
}
|
||
|
||
.ProseMirror-hideselection *::selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection *::-moz-selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection * {
|
||
caret-color: transparent;
|
||
}
|
||
|
||
.ProseMirror-focused .ProseMirror-gapcursor {
|
||
display: block;
|
||
}
|
||
|
||
.tippy-box[data-animation=fade][data-state=hidden] {
|
||
opacity: 0
|
||
}`;function _T(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let wT=class extends AM{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:n,moved:o})=>this.options.onDrop(e,n,o)),this.on("paste",({event:e,slice:n})=>this.options.onPaste(e,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=_T(bT,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=zm(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(r=>{const i=typeof r=="string"?`${r}$`:r.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;const o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[pT,KM.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),cT,hT,mT,vT,dT,gT].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new WM(n,this)}createCommandManager(){this.commandManager=new ya({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=ou(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(i){if(!(i instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(i.message))throw i;this.emit("contentError",{editor:this,error:i,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=ou(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=Vm(e,this.options.autofocus);this.view=new Dm(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:hk.create({doc:e,selection:n||void 0})});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(i=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(i)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),r=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),r&&this.emit("blur",{editor:this,event:r.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return q1(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,o=typeof t=="string"?e:t;return z1(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ac(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
||
|
||
`,textSerializers:n={}}=t||{};return Jm(this.state.doc,{blockSeparator:e,textSerializers:{...uc(this.schema),...n}})}get isEmpty(){return ka(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new yT(e,this)}get $doc(){return this.$pos(0)}};function er(t){return new _a({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ue(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],a=o[0];if(s){const l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(Xm(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(f=>f===t.type&&f!==p.mark.type)).filter(p=>p.to>u).length)return null;c<n.to&&i.delete(c,n.to),u>n.from&&i.delete(n.from+l,u);const d=n.from+l+s.length;i.addMark(n.from+l,d,t.type.create(r||{})),i.removeStoredMark(t.type)}}})}function eg(t){return new _a({find:t.find,handler:({state:e,range:n,match:o})=>{const r=ue(t.getAttributes,void 0,o)||{},{tr:i}=e,s=n.from;let a=n.to;const l=t.type.create(r);if(o[1]){const u=o[0].lastIndexOf(o[1]);let c=s+u;c>a?c=a:a=c+o[1].length;const d=o[0][o[0].length-1];i.insertText(d,s+o[0].length-1),i.replaceWith(c,a,l)}else if(o[0]){const u=t.type.isInline?s:s-1;i.insert(u,t.type.create(r)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()}})}function iu(t){return new _a({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),i=ue(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)}})}function si(t){return new _a({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=ue(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Yu(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:c,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionManager,f=d||c.$to.parentOffset&&c.$from.marks();if(f){const h=f.filter(m=>p.includes(m.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const c=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(c,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Fn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)}})}class He{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(Y(this,"addOptions",{name:this.name}))),this.storage=ue(Y(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new He(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wa(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new He(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ue(Y(n,"addOptions",{name:n.name})),n.storage=ue(Y(n,"addStorage",{name:n.name,options:n.options})),n}}function tr(t){return new jM({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const i=ue(t.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,a=o[o.length-1],l=o[0];let u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),p=d+a.length;if(Xm(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+c,d),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function ET(t,e){const{selection:n}=t,{$from:o}=n;if(n instanceof te){const i=o.index();return o.parent.canReplaceWith(i,i+1,e)}let r=o.depth;for(;r>=0;){const i=o.index(r);if(o.node(r).contentMatchAt(i).matchType(e))return!0;r-=1}return!1}function kT(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var st="top",It="bottom",xt="right",at="left",fc="auto",$i=[st,It,xt,at],nr="start",ai="end",ST="clippingParents",tg="viewport",wr="popper",MT="reference",ap=$i.reduce(function(t,e){return t.concat([e+"-"+nr,e+"-"+ai])},[]),ng=[].concat($i,[fc]).reduce(function(t,e){return t.concat([e,e+"-"+nr,e+"-"+ai])},[]),TT="beforeRead",IT="read",xT="afterRead",OT="beforeMain",$T="main",CT="afterMain",AT="beforeWrite",RT="write",DT="afterWrite",PT=[TT,IT,xT,OT,$T,CT,AT,RT,DT];function Yt(t){return t?(t.nodeName||"").toLowerCase():null}function vt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function mo(t){var e=vt(t).Element;return t instanceof e||t instanceof Element}function St(t){var e=vt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function hc(t){if(typeof ShadowRoot>"u")return!1;var e=vt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function NT(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},r=e.attributes[n]||{},i=e.elements[n];!St(i)||!Yt(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var a=r[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function LT(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),a=s.reduce(function(l,u){return l[u]="",l},{});!St(r)||!Yt(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(l){r.removeAttribute(l)}))})}}const og={name:"applyStyles",enabled:!0,phase:"write",fn:NT,effect:LT,requires:["computeStyles"]};function Gt(t){return t.split("-")[0]}var lo=Math.max,Vs=Math.min,or=Math.round;function su(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function rg(){return!/^((?!chrome|android).)*safari/i.test(su())}function rr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,i=1;e&&St(t)&&(r=t.offsetWidth>0&&or(o.width)/t.offsetWidth||1,i=t.offsetHeight>0&&or(o.height)/t.offsetHeight||1);var s=mo(t)?vt(t):window,a=s.visualViewport,l=!rg()&&n,u=(o.left+(l&&a?a.offsetLeft:0))/r,c=(o.top+(l&&a?a.offsetTop:0))/i,d=o.width/r,p=o.height/i;return{width:d,height:p,top:c,right:u+d,bottom:c+p,left:u,x:u,y:c}}function mc(t){var e=rr(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function ig(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&hc(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function dn(t){return vt(t).getComputedStyle(t)}function BT(t){return["table","td","th"].indexOf(Yt(t))>=0}function qn(t){return((mo(t)?t.ownerDocument:t.document)||window.document).documentElement}function Sa(t){return Yt(t)==="html"?t:t.assignedSlot||t.parentNode||(hc(t)?t.host:null)||qn(t)}function lp(t){return!St(t)||dn(t).position==="fixed"?null:t.offsetParent}function UT(t){var e=/firefox/i.test(su()),n=/Trident/i.test(su());if(n&&St(t)){var o=dn(t);if(o.position==="fixed")return null}var r=Sa(t);for(hc(r)&&(r=r.host);St(r)&&["html","body"].indexOf(Yt(r))<0;){var i=dn(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function Ci(t){for(var e=vt(t),n=lp(t);n&&BT(n)&&dn(n).position==="static";)n=lp(n);return n&&(Yt(n)==="html"||Yt(n)==="body"&&dn(n).position==="static")?e:n||UT(t)||e}function gc(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Kr(t,e,n){return lo(t,Vs(e,n))}function FT(t,e,n){var o=Kr(t,e,n);return o>n?n:o}function sg(){return{top:0,right:0,bottom:0,left:0}}function ag(t){return Object.assign({},sg(),t)}function lg(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var jT=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ag(typeof t!="number"?t:lg(t,$i))};function qT(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=Gt(n.placement),l=gc(a),u=[at,xt].indexOf(a)>=0,c=u?"height":"width";if(!(!i||!s)){var d=jT(r.padding,n),p=mc(i),f=l==="y"?st:at,h=l==="y"?It:xt,m=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],v=s[l]-n.rects.reference[l],y=Ci(i),_=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,E=m/2-v/2,b=d[f],N=_-p[c]-d[h],S=_/2-p[c]/2+E,M=Kr(b,S,N),T=l;n.modifiersData[o]=(e={},e[T]=M,e.centerOffset=M-S,e)}}function zT(t){var e=t.state,n=t.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||ig(e.elements.popper,r)&&(e.elements.arrow=r))}const GT={name:"arrow",enabled:!0,phase:"main",fn:qT,effect:zT,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ir(t){return t.split("-")[1]}var HT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function VT(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:or(n*r)/r||0,y:or(o*r)/r||0}}function up(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,p=s.x,f=p===void 0?0:p,h=s.y,m=h===void 0?0:h,v=typeof c=="function"?c({x:f,y:m}):{x:f,y:m};f=v.x,m=v.y;var y=s.hasOwnProperty("x"),_=s.hasOwnProperty("y"),E=at,b=st,N=window;if(u){var S=Ci(n),M="clientHeight",T="clientWidth";if(S===vt(n)&&(S=qn(n),dn(S).position!=="static"&&a==="absolute"&&(M="scrollHeight",T="scrollWidth")),S=S,r===st||(r===at||r===xt)&&i===ai){b=It;var I=d&&S===N&&N.visualViewport?N.visualViewport.height:S[M];m-=I-o.height,m*=l?1:-1}if(r===at||(r===st||r===It)&&i===ai){E=xt;var O=d&&S===N&&N.visualViewport?N.visualViewport.width:S[T];f-=O-o.width,f*=l?1:-1}}var B=Object.assign({position:a},u&&HT),$=c===!0?VT({x:f,y:m},vt(n)):{x:f,y:m};if(f=$.x,m=$.y,l){var R;return Object.assign({},B,(R={},R[b]=_?"0":"",R[E]=y?"0":"",R.transform=(N.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",R))}return Object.assign({},B,(e={},e[b]=_?m+"px":"",e[E]=y?f+"px":"",e.transform="",e))}function WT(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=o===void 0?!0:o,i=n.adaptive,s=i===void 0?!0:i,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Gt(e.placement),variation:ir(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,up(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,up(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const KT={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:WT,data:{}};var as={passive:!0};function YT(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,a=s===void 0?!0:s,l=vt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(c){c.addEventListener("scroll",n.update,as)}),a&&l.addEventListener("resize",n.update,as),function(){i&&u.forEach(function(c){c.removeEventListener("scroll",n.update,as)}),a&&l.removeEventListener("resize",n.update,as)}}const JT={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:YT,data:{}};var XT={left:"right",right:"left",bottom:"top",top:"bottom"};function _s(t){return t.replace(/left|right|bottom|top/g,function(e){return XT[e]})}var QT={start:"end",end:"start"};function cp(t){return t.replace(/start|end/g,function(e){return QT[e]})}function vc(t){var e=vt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function yc(t){return rr(qn(t)).left+vc(t).scrollLeft}function ZT(t,e){var n=vt(t),o=qn(t),r=n.visualViewport,i=o.clientWidth,s=o.clientHeight,a=0,l=0;if(r){i=r.width,s=r.height;var u=rg();(u||!u&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:i,height:s,x:a+yc(t),y:l}}function eI(t){var e,n=qn(t),o=vc(t),r=(e=t.ownerDocument)==null?void 0:e.body,i=lo(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=lo(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-o.scrollLeft+yc(t),l=-o.scrollTop;return dn(r||n).direction==="rtl"&&(a+=lo(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function bc(t){var e=dn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function ug(t){return["html","body","#document"].indexOf(Yt(t))>=0?t.ownerDocument.body:St(t)&&bc(t)?t:ug(Sa(t))}function Yr(t,e){var n;e===void 0&&(e=[]);var o=ug(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),i=vt(o),s=r?[i].concat(i.visualViewport||[],bc(o)?o:[]):o,a=e.concat(s);return r?a:a.concat(Yr(Sa(s)))}function au(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function tI(t,e){var n=rr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function dp(t,e,n){return e===tg?au(ZT(t,n)):mo(e)?tI(e,n):au(eI(qn(t)))}function nI(t){var e=Yr(Sa(t)),n=["absolute","fixed"].indexOf(dn(t).position)>=0,o=n&&St(t)?Ci(t):t;return mo(o)?e.filter(function(r){return mo(r)&&ig(r,o)&&Yt(r)!=="body"}):[]}function oI(t,e,n,o){var r=e==="clippingParents"?nI(t):[].concat(e),i=[].concat(r,[n]),s=i[0],a=i.reduce(function(l,u){var c=dp(t,u,o);return l.top=lo(c.top,l.top),l.right=Vs(c.right,l.right),l.bottom=Vs(c.bottom,l.bottom),l.left=lo(c.left,l.left),l},dp(t,s,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function cg(t){var e=t.reference,n=t.element,o=t.placement,r=o?Gt(o):null,i=o?ir(o):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(r){case st:l={x:s,y:e.y-n.height};break;case It:l={x:s,y:e.y+e.height};break;case xt:l={x:e.x+e.width,y:a};break;case at:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=r?gc(r):null;if(u!=null){var c=u==="y"?"height":"width";switch(i){case nr:l[u]=l[u]-(e[c]/2-n[c]/2);break;case ai:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function li(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=o===void 0?t.placement:o,i=n.strategy,s=i===void 0?t.strategy:i,a=n.boundary,l=a===void 0?ST:a,u=n.rootBoundary,c=u===void 0?tg:u,d=n.elementContext,p=d===void 0?wr:d,f=n.altBoundary,h=f===void 0?!1:f,m=n.padding,v=m===void 0?0:m,y=ag(typeof v!="number"?v:lg(v,$i)),_=p===wr?MT:wr,E=t.rects.popper,b=t.elements[h?_:p],N=oI(mo(b)?b:b.contextElement||qn(t.elements.popper),l,c,s),S=rr(t.elements.reference),M=cg({reference:S,element:E,placement:r}),T=au(Object.assign({},E,M)),I=p===wr?T:S,O={top:N.top-I.top+y.top,bottom:I.bottom-N.bottom+y.bottom,left:N.left-I.left+y.left,right:I.right-N.right+y.right},B=t.modifiersData.offset;if(p===wr&&B){var $=B[r];Object.keys(O).forEach(function(R){var D=[xt,It].indexOf(R)>=0?1:-1,C=[st,It].indexOf(R)>=0?"y":"x";O[R]+=$[C]*D})}return O}function rI(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?ng:l,c=ir(o),d=c?a?ap:ap.filter(function(h){return ir(h)===c}):$i,p=d.filter(function(h){return u.indexOf(h)>=0});p.length===0&&(p=d);var f=p.reduce(function(h,m){return h[m]=li(t,{placement:m,boundary:r,rootBoundary:i,padding:s})[Gt(m)],h},{});return Object.keys(f).sort(function(h,m){return f[h]-f[m]})}function iI(t){if(Gt(t)===fc)return[];var e=_s(t);return[cp(t),e,cp(e)]}function sI(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,h=f===void 0?!0:f,m=n.allowedAutoPlacements,v=e.options.placement,y=Gt(v),_=y===v,E=l||(_||!h?[_s(v)]:iI(v)),b=[v].concat(E).reduce(function(pt,nt){return pt.concat(Gt(nt)===fc?rI(e,{placement:nt,boundary:c,rootBoundary:d,padding:u,flipVariations:h,allowedAutoPlacements:m}):nt)},[]),N=e.rects.reference,S=e.rects.popper,M=new Map,T=!0,I=b[0],O=0;O<b.length;O++){var B=b[O],$=Gt(B),R=ir(B)===nr,D=[st,It].indexOf($)>=0,C=D?"width":"height",j=li(e,{placement:B,boundary:c,rootBoundary:d,altBoundary:p,padding:u}),W=D?R?xt:at:R?It:st;N[C]>S[C]&&(W=_s(W));var ee=_s(W),oe=[];if(i&&oe.push(j[$]<=0),a&&oe.push(j[W]<=0,j[ee]<=0),oe.every(function(pt){return pt})){I=B,T=!1;break}M.set(B,oe)}if(T)for(var we=h?3:1,Ke=function(pt){var nt=b.find(function(gn){var zn=M.get(gn);if(zn)return zn.slice(0,pt).every(function(vn){return vn})});if(nt)return I=nt,"break"},Fe=we;Fe>0;Fe--){var dt=Ke(Fe);if(dt==="break")break}e.placement!==I&&(e.modifiersData[o]._skip=!0,e.placement=I,e.reset=!0)}}const aI={name:"flip",enabled:!0,phase:"main",fn:sI,requiresIfExists:["offset"],data:{_skip:!1}};function pp(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function fp(t){return[st,xt,It,at].some(function(e){return t[e]>=0})}function lI(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=li(e,{elementContext:"reference"}),a=li(e,{altBoundary:!0}),l=pp(s,o),u=pp(a,r,i),c=fp(l),d=fp(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const uI={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:lI};function cI(t,e,n){var o=Gt(t),r=[at,st].indexOf(o)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*r,[at,xt].indexOf(o)>=0?{x:a,y:s}:{x:s,y:a}}function dI(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=r===void 0?[0,0]:r,s=ng.reduce(function(c,d){return c[d]=cI(d,e.rects,i),c},{}),a=s[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const pI={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:dI};function fI(t){var e=t.state,n=t.name;e.modifiersData[n]=cg({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const hI={name:"popperOffsets",enabled:!0,phase:"read",fn:fI,data:{}};function mI(t){return t==="x"?"y":"x"}function gI(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=r===void 0?!0:r,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,p=n.tether,f=p===void 0?!0:p,h=n.tetherOffset,m=h===void 0?0:h,v=li(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=Gt(e.placement),_=ir(e.placement),E=!_,b=gc(y),N=mI(b),S=e.modifiersData.popperOffsets,M=e.rects.reference,T=e.rects.popper,I=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,O=typeof I=="number"?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),B=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(S){if(i){var R,D=b==="y"?st:at,C=b==="y"?It:xt,j=b==="y"?"height":"width",W=S[b],ee=W+v[D],oe=W-v[C],we=f?-T[j]/2:0,Ke=_===nr?M[j]:T[j],Fe=_===nr?-T[j]:-M[j],dt=e.elements.arrow,pt=f&&dt?mc(dt):{width:0,height:0},nt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:sg(),gn=nt[D],zn=nt[C],vn=Kr(0,M[j],pt[j]),Ri=E?M[j]/2-we-vn-gn-O.mainAxis:Ke-vn-gn-O.mainAxis,yn=E?-M[j]/2+we+vn+zn+O.mainAxis:Fe+vn+zn+O.mainAxis,wo=e.elements.arrow&&Ci(e.elements.arrow),Di=wo?b==="y"?wo.clientTop||0:wo.clientLeft||0:0,mr=(R=B==null?void 0:B[b])!=null?R:0,Pi=W+Ri-mr-Di,Ni=W+yn-mr,gr=Kr(f?Vs(ee,Pi):ee,W,f?lo(oe,Ni):oe);S[b]=gr,$[b]=gr-W}if(a){var vr,Li=b==="x"?st:at,Bi=b==="x"?It:xt,Zt=S[N],bn=N==="y"?"height":"width",yr=Zt+v[Li],Gn=Zt-v[Bi],br=[st,at].indexOf(y)!==-1,Ui=(vr=B==null?void 0:B[N])!=null?vr:0,Fi=br?yr:Zt-M[bn]-T[bn]-Ui+O.altAxis,ji=br?Zt+M[bn]+T[bn]-Ui-O.altAxis:Gn,qi=f&&br?FT(Fi,Zt,ji):Kr(f?Fi:yr,Zt,f?ji:Gn);S[N]=qi,$[N]=qi-Zt}e.modifiersData[o]=$}}const vI={name:"preventOverflow",enabled:!0,phase:"main",fn:gI,requiresIfExists:["offset"]};function yI(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function bI(t){return t===vt(t)||!St(t)?vc(t):yI(t)}function _I(t){var e=t.getBoundingClientRect(),n=or(e.width)/t.offsetWidth||1,o=or(e.height)/t.offsetHeight||1;return n!==1||o!==1}function wI(t,e,n){n===void 0&&(n=!1);var o=St(e),r=St(e)&&_I(e),i=qn(e),s=rr(t,r,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!n)&&((Yt(e)!=="body"||bc(i))&&(a=bI(e)),St(e)?(l=rr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):i&&(l.x=yc(i))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function EI(t){var e=new Map,n=new Set,o=[];t.forEach(function(i){e.set(i.name,i)});function r(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&r(l)}}),o.push(i)}return t.forEach(function(i){n.has(i.name)||r(i)}),o}function kI(t){var e=EI(t);return PT.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function SI(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function MI(t){var e=t.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(e).map(function(n){return e[n]})}var hp={placement:"bottom",modifiers:[],strategy:"absolute"};function mp(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function TI(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,i=r===void 0?hp:r;return function(s,a,l){l===void 0&&(l=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},hp,i),modifiersData:{},elements:{reference:s,popper:a},attributes:{},styles:{}},c=[],d=!1,p={state:u,setOptions:function(m){var v=typeof m=="function"?m(u.options):m;h(),u.options=Object.assign({},i,u.options,v),u.scrollParents={reference:mo(s)?Yr(s):s.contextElement?Yr(s.contextElement):[],popper:Yr(a)};var y=kI(MI([].concat(o,u.options.modifiers)));return u.orderedModifiers=y.filter(function(_){return _.enabled}),f(),p.update()},forceUpdate:function(){if(!d){var m=u.elements,v=m.reference,y=m.popper;if(mp(v,y)){u.rects={reference:wI(v,Ci(y),u.options.strategy==="fixed"),popper:mc(y)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(T){return u.modifiersData[T.name]=Object.assign({},T.data)});for(var _=0;_<u.orderedModifiers.length;_++){if(u.reset===!0){u.reset=!1,_=-1;continue}var E=u.orderedModifiers[_],b=E.fn,N=E.options,S=N===void 0?{}:N,M=E.name;typeof b=="function"&&(u=b({state:u,options:S,name:M,instance:p})||u)}}}},update:SI(function(){return new Promise(function(m){p.forceUpdate(),m(u)})}),destroy:function(){h(),d=!0}};if(!mp(s,a))return p;p.setOptions(l).then(function(m){!d&&l.onFirstUpdate&&l.onFirstUpdate(m)});function f(){u.orderedModifiers.forEach(function(m){var v=m.name,y=m.options,_=y===void 0?{}:y,E=m.effect;if(typeof E=="function"){var b=E({state:u,name:v,instance:p,options:_}),N=function(){};c.push(b||N)}})}function h(){c.forEach(function(m){return m()}),c=[]}return p}}var II=[JT,hI,KT,og,pI,aI,vI,GT,uI],xI=TI({defaultModifiers:II}),OI="tippy-box",dg="tippy-content",$I="tippy-backdrop",pg="tippy-arrow",fg="tippy-svg-arrow",Jn={passive:!0,capture:!0},hg=function(){return document.body};function pl(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function _c(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function mg(t,e){return typeof t=="function"?t.apply(void 0,e):t}function gp(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function CI(t){return t.split(/\s+/).filter(Boolean)}function Bo(t){return[].concat(t)}function vp(t,e){t.indexOf(e)===-1&&t.push(e)}function AI(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function RI(t){return t.split("-")[0]}function Ws(t){return[].slice.call(t)}function yp(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Jr(){return document.createElement("div")}function Ma(t){return["Element","Fragment"].some(function(e){return _c(t,e)})}function DI(t){return _c(t,"NodeList")}function PI(t){return _c(t,"MouseEvent")}function NI(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function LI(t){return Ma(t)?[t]:DI(t)?Ws(t):Array.isArray(t)?t:Ws(document.querySelectorAll(t))}function fl(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function bp(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function BI(t){var e,n=Bo(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function UI(t,e){var n=e.clientX,o=e.clientY;return t.every(function(r){var i=r.popperRect,s=r.popperState,a=r.props,l=a.interactiveBorder,u=RI(s.placement),c=s.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,p=u==="top"?c.bottom.y:0,f=u==="right"?c.left.x:0,h=u==="left"?c.right.x:0,m=i.top-o+d>l,v=o-i.bottom-p>l,y=i.left-n+f>l,_=n-i.right-h>l;return m||v||y||_})}function hl(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function _p(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var Ut={isTouch:!1},wp=0;function FI(){Ut.isTouch||(Ut.isTouch=!0,window.performance&&document.addEventListener("mousemove",gg))}function gg(){var t=performance.now();t-wp<20&&(Ut.isTouch=!1,document.removeEventListener("mousemove",gg)),wp=t}function jI(){var t=document.activeElement;if(NI(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function qI(){document.addEventListener("touchstart",FI,Jn),window.addEventListener("blur",jI)}var zI=typeof window<"u"&&typeof document<"u",GI=zI?!!window.msCrypto:!1,HI={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},VI={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},$t=Object.assign({appendTo:hg,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},HI,VI),WI=Object.keys($t),KI=function(t){var e=Object.keys(t);e.forEach(function(n){$t[n]=t[n]})};function vg(t){var e=t.plugins||[],n=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var a;o[i]=t[i]!==void 0?t[i]:(a=$t[i])!=null?a:s}return o},{});return Object.assign({},t,n)}function YI(t,e){var n=e?Object.keys(vg(Object.assign({},$t,{plugins:e}))):WI,o=n.reduce(function(r,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function Ep(t,e){var n=Object.assign({},e,{content:mg(e.content,[t])},e.ignoreAttributes?{}:YI(t,e.plugins));return n.aria=Object.assign({},$t.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var JI=function(){return"innerHTML"};function lu(t,e){t[JI()]=e}function kp(t){var e=Jr();return t===!0?e.className=pg:(e.className=fg,Ma(t)?e.appendChild(t):lu(e,t)),e}function Sp(t,e){Ma(e.content)?(lu(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?lu(t,e.content):t.textContent=e.content)}function uu(t){var e=t.firstElementChild,n=Ws(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(dg)}),arrow:n.find(function(o){return o.classList.contains(pg)||o.classList.contains(fg)}),backdrop:n.find(function(o){return o.classList.contains($I)})}}function yg(t){var e=Jr(),n=Jr();n.className=OI,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=Jr();o.className=dg,o.setAttribute("data-state","hidden"),Sp(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(i,s){var a=uu(e),l=a.box,u=a.content,c=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&Sp(u,t.props),s.arrow?c?i.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(kp(s.arrow))):l.appendChild(kp(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:r}}yg.$$tippy=!0;var XI=1,ls=[],ml=[];function QI(t,e){var n=Ep(t,Object.assign({},$t,vg(yp(e)))),o,r,i,s=!1,a=!1,l=!1,u=!1,c,d,p,f=[],h=gp(Pi,n.interactiveDebounce),m,v=XI++,y=null,_=AI(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:v,reference:t,popper:Jr(),popperInstance:y,props:n,state:E,plugins:_,clearDelayTimeouts:Fi,setProps:ji,setContent:qi,show:rv,hide:iv,hideWithInteractivity:sv,enable:br,disable:Ui,unmount:av,destroy:lv};if(!n.render)return b;var N=n.render(b),S=N.popper,M=N.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+b.id,b.popper=S,t._tippy=b,S._tippy=b;var T=_.map(function(U){return U.fn(b)}),I=t.hasAttribute("aria-expanded");return wo(),we(),W(),ee("onCreate",[b]),n.showOnCreate&&yr(),S.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&D().addEventListener("mousemove",h)}),b;function O(){var U=b.props.touch;return Array.isArray(U)?U:[U,0]}function B(){return O()[0]==="hold"}function $(){var U;return!!((U=b.props.render)!=null&&U.$$tippy)}function R(){return m||t}function D(){var U=R().parentNode;return U?BI(U):document}function C(){return uu(S)}function j(U){return b.state.isMounted&&!b.state.isVisible||Ut.isTouch||c&&c.type==="focus"?0:pl(b.props.delay,U?0:1,$t.delay)}function W(U){U===void 0&&(U=!1),S.style.pointerEvents=b.props.interactive&&!U?"":"none",S.style.zIndex=""+b.props.zIndex}function ee(U,X,re){if(re===void 0&&(re=!0),T.forEach(function(fe){fe[U]&&fe[U].apply(fe,X)}),re){var ge;(ge=b.props)[U].apply(ge,X)}}function oe(){var U=b.props.aria;if(U.content){var X="aria-"+U.content,re=S.id,ge=Bo(b.props.triggerTarget||t);ge.forEach(function(fe){var Ye=fe.getAttribute(X);if(b.state.isVisible)fe.setAttribute(X,Ye?Ye+" "+re:re);else{var bt=Ye&&Ye.replace(re,"").trim();bt?fe.setAttribute(X,bt):fe.removeAttribute(X)}})}}function we(){if(!(I||!b.props.aria.expanded)){var U=Bo(b.props.triggerTarget||t);U.forEach(function(X){b.props.interactive?X.setAttribute("aria-expanded",b.state.isVisible&&X===R()?"true":"false"):X.removeAttribute("aria-expanded")})}}function Ke(){D().removeEventListener("mousemove",h),ls=ls.filter(function(U){return U!==h})}function Fe(U){if(!(Ut.isTouch&&(l||U.type==="mousedown"))){var X=U.composedPath&&U.composedPath()[0]||U.target;if(!(b.props.interactive&&_p(S,X))){if(Bo(b.props.triggerTarget||t).some(function(re){return _p(re,X)})){if(Ut.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else ee("onClickOutside",[b,U]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||gn())}}}function dt(){l=!0}function pt(){l=!1}function nt(){var U=D();U.addEventListener("mousedown",Fe,!0),U.addEventListener("touchend",Fe,Jn),U.addEventListener("touchstart",pt,Jn),U.addEventListener("touchmove",dt,Jn)}function gn(){var U=D();U.removeEventListener("mousedown",Fe,!0),U.removeEventListener("touchend",Fe,Jn),U.removeEventListener("touchstart",pt,Jn),U.removeEventListener("touchmove",dt,Jn)}function zn(U,X){Ri(U,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&X()})}function vn(U,X){Ri(U,X)}function Ri(U,X){var re=C().box;function ge(fe){fe.target===re&&(hl(re,"remove",ge),X())}if(U===0)return X();hl(re,"remove",d),hl(re,"add",ge),d=ge}function yn(U,X,re){re===void 0&&(re=!1);var ge=Bo(b.props.triggerTarget||t);ge.forEach(function(fe){fe.addEventListener(U,X,re),f.push({node:fe,eventType:U,handler:X,options:re})})}function wo(){B()&&(yn("touchstart",mr,{passive:!0}),yn("touchend",Ni,{passive:!0})),CI(b.props.trigger).forEach(function(U){if(U!=="manual")switch(yn(U,mr),U){case"mouseenter":yn("mouseleave",Ni);break;case"focus":yn(GI?"focusout":"blur",gr);break;case"focusin":yn("focusout",gr);break}})}function Di(){f.forEach(function(U){var X=U.node,re=U.eventType,ge=U.handler,fe=U.options;X.removeEventListener(re,ge,fe)}),f=[]}function mr(U){var X,re=!1;if(!(!b.state.isEnabled||vr(U)||a)){var ge=((X=c)==null?void 0:X.type)==="focus";c=U,m=U.currentTarget,we(),!b.state.isVisible&&PI(U)&&ls.forEach(function(fe){return fe(U)}),U.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||s)&&b.props.hideOnClick!==!1&&b.state.isVisible?re=!0:yr(U),U.type==="click"&&(s=!re),re&&!ge&&Gn(U)}}function Pi(U){var X=U.target,re=R().contains(X)||S.contains(X);if(!(U.type==="mousemove"&&re)){var ge=bn().concat(S).map(function(fe){var Ye,bt=fe._tippy,Eo=(Ye=bt.popperInstance)==null?void 0:Ye.state;return Eo?{popperRect:fe.getBoundingClientRect(),popperState:Eo,props:n}:null}).filter(Boolean);UI(ge,U)&&(Ke(),Gn(U))}}function Ni(U){var X=vr(U)||b.props.trigger.indexOf("click")>=0&&s;if(!X){if(b.props.interactive){b.hideWithInteractivity(U);return}Gn(U)}}function gr(U){b.props.trigger.indexOf("focusin")<0&&U.target!==R()||b.props.interactive&&U.relatedTarget&&S.contains(U.relatedTarget)||Gn(U)}function vr(U){return Ut.isTouch?B()!==U.type.indexOf("touch")>=0:!1}function Li(){Bi();var U=b.props,X=U.popperOptions,re=U.placement,ge=U.offset,fe=U.getReferenceClientRect,Ye=U.moveTransition,bt=$()?uu(S).arrow:null,Eo=fe?{getBoundingClientRect:fe,contextElement:fe.contextElement||R()}:t,zi={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Gi){var ko=Gi.state;if($()){var uv=C(),Pa=uv.box;["placement","reference-hidden","escaped"].forEach(function(Hi){Hi==="placement"?Pa.setAttribute("data-placement",ko.placement):ko.attributes.popper["data-popper-"+Hi]?Pa.setAttribute("data-"+Hi,""):Pa.removeAttribute("data-"+Hi)}),ko.attributes.popper={}}}},Hn=[{name:"offset",options:{offset:ge}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ye}},zi];$()&&bt&&Hn.push({name:"arrow",options:{element:bt,padding:3}}),Hn.push.apply(Hn,(X==null?void 0:X.modifiers)||[]),b.popperInstance=xI(Eo,S,Object.assign({},X,{placement:re,onFirstUpdate:p,modifiers:Hn}))}function Bi(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Zt(){var U=b.props.appendTo,X,re=R();b.props.interactive&&U===hg||U==="parent"?X=re.parentNode:X=mg(U,[re]),X.contains(S)||X.appendChild(S),b.state.isMounted=!0,Li()}function bn(){return Ws(S.querySelectorAll("[data-tippy-root]"))}function yr(U){b.clearDelayTimeouts(),U&&ee("onTrigger",[b,U]),nt();var X=j(!0),re=O(),ge=re[0],fe=re[1];Ut.isTouch&&ge==="hold"&&fe&&(X=fe),X?o=setTimeout(function(){b.show()},X):b.show()}function Gn(U){if(b.clearDelayTimeouts(),ee("onUntrigger",[b,U]),!b.state.isVisible){gn();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(U.type)>=0&&s)){var X=j(!1);X?r=setTimeout(function(){b.state.isVisible&&b.hide()},X):i=requestAnimationFrame(function(){b.hide()})}}function br(){b.state.isEnabled=!0}function Ui(){b.hide(),b.state.isEnabled=!1}function Fi(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function ji(U){if(!b.state.isDestroyed){ee("onBeforeUpdate",[b,U]),Di();var X=b.props,re=Ep(t,Object.assign({},X,yp(U),{ignoreAttributes:!0}));b.props=re,wo(),X.interactiveDebounce!==re.interactiveDebounce&&(Ke(),h=gp(Pi,re.interactiveDebounce)),X.triggerTarget&&!re.triggerTarget?Bo(X.triggerTarget).forEach(function(ge){ge.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),we(),W(),M&&M(X,re),b.popperInstance&&(Li(),bn().forEach(function(ge){requestAnimationFrame(ge._tippy.popperInstance.forceUpdate)})),ee("onAfterUpdate",[b,U])}}function qi(U){b.setProps({content:U})}function rv(){var U=b.state.isVisible,X=b.state.isDestroyed,re=!b.state.isEnabled,ge=Ut.isTouch&&!b.props.touch,fe=pl(b.props.duration,0,$t.duration);if(!(U||X||re||ge)&&!R().hasAttribute("disabled")&&(ee("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,$()&&(S.style.visibility="visible"),W(),nt(),b.state.isMounted||(S.style.transition="none"),$()){var Ye=C(),bt=Ye.box,Eo=Ye.content;fl([bt,Eo],0)}p=function(){var zi;if(!(!b.state.isVisible||u)){if(u=!0,S.style.transition=b.props.moveTransition,$()&&b.props.animation){var Hn=C(),Gi=Hn.box,ko=Hn.content;fl([Gi,ko],fe),bp([Gi,ko],"visible")}oe(),we(),vp(ml,b),(zi=b.popperInstance)==null||zi.forceUpdate(),ee("onMount",[b]),b.props.animation&&$()&&vn(fe,function(){b.state.isShown=!0,ee("onShown",[b])})}},Zt()}}function iv(){var U=!b.state.isVisible,X=b.state.isDestroyed,re=!b.state.isEnabled,ge=pl(b.props.duration,1,$t.duration);if(!(U||X||re)&&(ee("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,s=!1,$()&&(S.style.visibility="hidden"),Ke(),gn(),W(!0),$()){var fe=C(),Ye=fe.box,bt=fe.content;b.props.animation&&(fl([Ye,bt],ge),bp([Ye,bt],"hidden"))}oe(),we(),b.props.animation?$()&&zn(ge,b.unmount):b.unmount()}}function sv(U){D().addEventListener("mousemove",h),vp(ls,h),h(U)}function av(){b.state.isVisible&&b.hide(),b.state.isMounted&&(Bi(),bn().forEach(function(U){U._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),ml=ml.filter(function(U){return U!==b}),b.state.isMounted=!1,ee("onHidden",[b]))}function lv(){!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),Di(),delete t._tippy,b.state.isDestroyed=!0,ee("onDestroy",[b]))}}function fr(t,e){e===void 0&&(e={});var n=$t.plugins.concat(e.plugins||[]);qI();var o=Object.assign({},e,{plugins:n}),r=LI(t),i=r.reduce(function(s,a){var l=a&&QI(a,o);return l&&s.push(l),s},[]);return Ma(t)?i[0]:i}fr.defaultProps=$t;fr.setDefaultProps=KI;fr.currentInput=Ut;Object.assign({},og,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}});fr.setDefaultProps({render:yg});class ZI{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{const{doc:d,selection:p}=l,{empty:f}=p,h=!d.textBetween(u,c).length&&dc(l.selection),m=this.element.contains(document.activeElement);return!(!(a.hasFocus()||m)||f||h||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget)||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{const u=!(l!=null&&l.selection.eq(a.state.selection)),c=!(l!=null&&l.doc.eq(a.state.doc));!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var d,p,f;const{state:h,composing:m}=a,{selection:v}=h;if(m||!l&&!u)return;this.createTooltip();const{ranges:y}=v,_=Math.min(...y.map(b=>b.$from.pos)),E=Math.max(...y.map(b=>b.$to.pos));if(!(!((d=this.shouldShow)===null||d===void 0)&&d.call(this,{editor:this.editor,element:this.element,view:a,state:h,oldState:c,from:_,to:E}))){this.hide();return}(p=this.tippy)===null||p===void 0||p.setProps({getReferenceClientRect:((f=this.tippyOptions)===null||f===void 0?void 0:f.getReferenceClientRect)||(()=>{if(Qm(h.selection)){let b=a.nodeDOM(_);if(b){const N=b.dataset.nodeViewWrapper?b:b.querySelector("[data-node-view-wrapper]");if(N&&(b=N.firstChild),b)return b.getBoundingClientRect()}}return Zm(a,_,E)})}),this.show()},this.editor=e,this.element=n,this.view=o,this.updateDelay=i,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=fr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=o.selection.from!==o.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,n);return}const i=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,i,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ex=t=>new Ie({key:typeof t.pluginKey=="string"?new Be(t.pluginKey):t.pluginKey,view:e=>new ZI({view:e,...t})});Ue.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[ex({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class tx{getTextContent(e){return Jm(e,{textSerializers:uc(this.editor.schema)})}constructor({editor:e,element:n,view:o,tippyOptions:r={},shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:s,state:a})=>{const{selection:l}=a,{$anchor:u,empty:c}=l,d=u.depth===1,p=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!s.hasFocus()||!c||!d||!p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var a;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&!((a=this.element.parentNode)===null||a===void 0)&&a.contains(s.relatedTarget)||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=o,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=fr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var o,r,i;const{state:s}=e,{doc:a,selection:l}=s,{from:u,to:c}=l;if(!(n&&n.doc.eq(a)&&n.selection.eq(l))){if(this.createTooltip(),!(!((o=this.shouldShow)===null||o===void 0)&&o.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(r=this.tippy)===null||r===void 0||r.setProps({getReferenceClientRect:((i=this.tippyOptions)===null||i===void 0?void 0:i.getReferenceClientRect)||(()=>Zm(e,u,c))}),this.show()}}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const nx=t=>new Ie({key:typeof t.pluginKey=="string"?new Be(t.pluginKey):t.pluginKey,view:e=>new tx({view:e,...t})});Ue.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[nx({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function Mp(t){return df((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class ox extends wT{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Mp(this.view.state),this.reactiveExtensionStorage=Mp(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),gu(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const o=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=o),o}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const rx=G({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=x(),n=Ln();return At(()=>{const o=t.editor;o&&o.options.element&&e.value&&Te(()=>{if(!e.value||!o.options.element.firstChild)return;const r=g(e.value);e.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:r}),o.createNodeViews()})}),vi(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return xe("div",{ref:t=>{this.rootEl=t}})}}),ix=(t={})=>{const e=oa();return tt(()=>{e.value=new ox(t)}),vi(()=>{var n,o,r;const i=(n=e.value)===null||n===void 0?void 0:n.options.element,s=i==null?void 0:i.cloneNode(!0);(o=i==null?void 0:i.parentNode)===null||o===void 0||o.replaceChild(s,i),(r=e.value)===null||r===void 0||r.destroy()}),e};class sx{constructor(e,{props:n={},editor:o}){this.editor=o,this.component=gu(e),this.el=document.createElement("div"),this.props=Xr(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,o,r;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(r=(o=this.renderedComponent.vNode)===null||o===void 0?void 0:o.component)===null||r===void 0?void 0:r.proxy}renderComponent(){let e=xe(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&Oc(e,this.el),{vNode:e,destroy:()=>{this.el&&Oc(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,o])=>{this.props[n]=o}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const ax=Ue.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Ie({key:new Be("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=o>=a&&o<=a+s.nodeSize,u=!s.isLeaf&&ka(s);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];i&&c.push(this.options.emptyEditorClass);const d=mn.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});r.push(d)}return this.options.includeChildren}),mt.create(t,r)}}})]}}),lx=/^\s*>\s$/,ux=He.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[si({find:lx,type:this.type})]}}),cx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,px=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,fx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,hx=Oi.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[er({find:cx,type:this.type}),er({find:px,type:this.type})]},addPasteRules(){return[tr({find:dx,type:this.type}),tr({find:fx,type:this.type})]}}),mx="listItem",Tp="textStyle",Ip=/^\s*([-+*])\s$/,gx=He.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(mx,this.editor.getAttributes(Tp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=si({find:Ip,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=si({find:Ip,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Tp),editor:this.editor})),[t]}}),vx=/(^|[^`])`([^`]+)`(?!`)/,yx=/(^|[^`])`([^`]+)`(?!`)/g,bx=Oi.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[er({find:vx,type:this.type})]},addPasteRules(){return[tr({find:yx,type:this.type})]}}),_x=/^```([a-z]+)?[\s\n]$/,Ex=/^~~~([a-z]+)?[\s\n]$/,kx=He.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Me(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
|
||
|
||
`);return!i||!s?!1:t.chain().command(({tr:a})=>(a.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==r.parent.nodeSize-2)return!1;const s=r.after();return s===void 0?!1:o.nodeAt(s)?t.commands.command(({tr:a})=>(a.setSelection(ae.near(o.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[iu({find:_x,type:this.type,getAttributes:t=>({language:t[1]})}),iu({find:Ex,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ie({key:new Be("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!n||!i)return!1;const{tr:s,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
||
`));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(de.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),Sx=He.create({name:"doc",topNode:!0,content:"block+"});function Mx(t={}){return new Ie({view(e){return new Tx(e,t)}})}let Tx=class{constructor(e,n){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=n.width)!==null&&o!==void 0?o:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,o,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,a=i.height/r.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*a;o={left:h.left,right:h.right,top:m-v,bottom:m+v}}}}if(!o){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;u=d.left-l.scrollLeft*p,c=d.top-l.scrollTop*f}this.element.style.left=(o.left-u)/s+"px",this.element.style.top=(o.top-c)/a+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Lh(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};const Ix=Ue.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Mx(this.options)]}});let ct=class Mn extends ae{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return Mn.valid(o)?new Mn(o):ae.near(o)}content(){return K.empty}eq(e){return e instanceof Mn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Mn(e.resolve(n.pos))}getBookmark(){return new xx(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Ox(e)||!$x(e))return!1;let o=n.type.spec.allowGapCursor;if(o!=null)return o;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,o=!1){e:for(;;){if(!o&&Mn.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let l=e.doc.resolve(r);if(Mn.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!te.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*n),o=!1;continue e}break}i=s,r+=n;let a=e.doc.resolve(r);if(Mn.valid(a))return a}return null}}};ct.prototype.visible=!1;ct.findFrom=ct.findGapCursorFrom;ae.jsonID("gapcursor",ct);let xx=class bg{constructor(e){this.pos=e}map(e){return new bg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ct.valid(n)?new ct(n):ae.near(n)}};function _g(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Ox(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(n==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||_g(r.type))return!0;if(r.inlineContent)return!1}}return!0}function $x(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||_g(r.type))return!0;if(r.inlineContent)return!1}}return!0}function Cx(){return new Ie({props:{decorations:Px,createSelectionBetween(t,e,n){return e.pos==n.pos&&ct.valid(n)?new ct(n):null},handleClick:Rx,handleKeyDown:Ax,handleDOMEvents:{beforeinput:Dx}}})}const Ax=Pm({ArrowLeft:us("horiz",-1),ArrowRight:us("horiz",1),ArrowUp:us("vert",-1),ArrowDown:us("vert",1)});function us(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof de){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=o.doc.resolve(e>0?a.after():a.before())}let u=ct.findGapCursorFrom(a,e,l);return u?(r&&r(o.tr.setSelection(new ct(u))),!0):!1}}function Rx(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!ct.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&te.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ct(o))),!0)}function Dx(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ct))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=H.empty;for(let s=o.length-1;s>=0;s--)r=H.from(o[s].createAndFill(null,r));let i=t.state.tr.replace(n.pos,n.pos,new K(r,0,0));return i.setSelection(de.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Px(t){if(!(t.selection instanceof ct))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",mt.create(t.doc,[mn.widget(t.selection.head,e,{key:"gapcursor"})])}const Nx=Ue.create({name:"gapCursor",addProseMirrorPlugins(){return[Cx()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=ue(Y(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),Lx=He.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Me(this.options.HTMLAttributes,t)]},renderText(){return`
|
||
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:a}=o.extensionManager,l=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&s){const d=l.filter(p=>a.includes(p.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Bx=He.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Me(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>iu({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ks=200,Oe=function(){};Oe.prototype.append=function(t){return t.length?(t=Oe.from(t),!this.length&&t||t.length<Ks&&this.leafAppend(t)||this.length<Ks&&t.leafPrepend(this)||this.appendInner(t)):this};Oe.prototype.prepend=function(t){return t.length?Oe.from(t).append(this):this};Oe.prototype.appendInner=function(t){return new Ux(this,t)};Oe.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Oe.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Oe.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Oe.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};Oe.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(r,i){return o.push(t(r,i))},e,n),o};Oe.from=function(t){return t instanceof Oe?t:t&&t.length?new wg(t):Oe.empty};var wg=(function(t){function e(o){t.call(this),this.values=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,r){return o==0&&r==this.length?this:new e(this.values.slice(o,r))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,r,i,s){for(var a=r;a<i;a++)if(o(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){for(var a=r-1;a>=i;a--)if(o(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ks)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ks)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Oe);Oe.empty=new wg([]);var Ux=(function(t){function e(n,o){t.call(this),this.left=n,this.right=o,this.length=n.length+o.length,this.depth=Math.max(n.depth,o.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,o,r,i){var s=this.left.length;if(o<s&&this.left.forEachInner(n,o,Math.min(r,s),i)===!1||r>s&&this.right.forEachInner(n,Math.max(o-s,0),Math.min(this.length,r)-s,i+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,o,r,i){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(n,o-s,Math.max(r,s)-s,i+s)===!1||r<s&&this.left.forEachInvertedInner(n,Math.min(o,s),r,i)===!1)return!1},e.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var r=this.left.length;return o<=r?this.left.slice(n,o):n>=r?this.right.slice(n-r,o-r):this.left.slice(n,r).append(this.right.slice(0,o-r))},e.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new e(o,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Oe);const Fx=500;let ui=class Uo{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;n&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,c.push(d);return}if(r){c.push(new _n(d.map));let f=d.step.map(r.slice(i)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],u.push(new _n(h,void 0,void 0,u.length+c.length))),i--,h&&r.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return a=r?d.selection.map(r.slice(i)):d.selection,l=new Uo(this.items.slice(0,o).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,o,r){let i=[],s=this.eventCount,a=this.items,l=!r&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),p=new _n(e.mapping.maps[c],d,n),f;(f=l&&l.merge(p))&&(p=f,c?i.pop():a=a.slice(0,a.length-1)),i.push(p),n&&(s++,n=void 0),r||(l=p)}let u=s-o.depth;return u>qx&&(a=jx(a,u),s-=u),new Uo(a.append(i),s)}remapping(e,n){let o=new Rh;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,n),o}addMaps(e){return this.eventCount==0?this:new Uo(this.items.append(e.map(n=>new _n(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},r);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;s=Math.min(s,f);let h=i.maps[f];if(p.step){let m=e.steps[f].invert(e.docs[f]),v=p.selection&&p.selection.map(i.slice(l+1,f));v&&a++,o.push(new _n(h,m,v))}else o.push(new _n(h))},r);let u=[];for(let p=n;p<s;p++)u.push(new _n(i.maps[p]));let c=this.items.slice(0,r).append(u).append(o),d=new Uo(c,a);return d.emptyItemCount()>Fx&&(d=d.compress(this.items.length-o.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),o=n.maps.length,r=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)r.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(o)),u=l&&l.getMap();if(o--,u&&n.appendMap(u,o),l){let c=s.selection&&s.selection.map(n.slice(o));c&&i++;let d=new _n(u.invert(),l,c),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else s.map&&o--},this.items.length,0),new Uo(Oe.from(r.reverse()),i)}};ui.empty=new ui(Oe.empty,0);function jx(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}let _n=class Eg{constructor(e,n,o,r){this.map=e,this.step=n,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Eg(n.getMap().invert(),n,this.selection)}}},In=class{constructor(e,n,o,r,i){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}};const qx=20;function zx(t,e,n,o){let r=n.getMeta(uo),i;if(r)return r.historyState;n.getMeta(Vx)&&(t=new In(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(uo))return s.getMeta(uo).redo?new In(t.done.addTransform(n,void 0,o,ws(e)),t.undone,xp(n.mapping.maps),t.prevTime,t.prevComposition):new In(t.done,t.undone.addTransform(n,void 0,o,ws(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-o.newGroupDelay||!Gx(n,t.prevRanges)),u=s?gl(t.prevRanges,n.mapping):xp(n.mapping.maps);return new In(t.done.addTransform(n,l?e.selection.getBookmark():void 0,o,ws(e)),ui.empty,u,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new In(t.done.rebased(n,i),t.undone.rebased(n,i),gl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new In(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),gl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Gx(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(n=!0)}),n}function xp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((o,r,i,s)=>e.push(i,s));return e}function gl(t,e){if(!t)return null;let n=[];for(let o=0;o<t.length;o+=2){let r=e.map(t[o],1),i=e.map(t[o+1],-1);r<=i&&n.push(r,i)}return n}function Hx(t,e,n){let o=ws(e),r=uo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),l=new In(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(uo,{redo:n,historyState:l})}let vl=!1,Op=null;function ws(t){let e=t.plugins;if(Op!=e){vl=!1,Op=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){vl=!0;break}}return vl}const uo=new Be("history"),Vx=new Be("closeHistory");function Wx(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ie({key:uo,state:{init(){return new In(ui.empty,ui.empty,null,0,-1)},apply(e,n,o){return zx(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?Sg:o=="historyRedo"?Mg:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function kg(t,e){return(n,o)=>{let r=uo.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let i=Hx(r,n,t);i&&o(i.scrollIntoView())}return!0}}const Sg=kg(!1),Mg=kg(!0),Kx=Ue.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Sg(t,e),redo:()=>({state:t,dispatch:e})=>Mg(t,e)}},addProseMirrorPlugins(){return[Wx(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Yx=He.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Me(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!ET(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:o,$to:r}=n,i=t();return o.parentOffset===0?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):Qm(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:a})=>{var l;if(a){const{$to:u}=s.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?s.setSelection(de.create(s.doc,u.pos+1)):u.nodeAfter.isBlock?s.setSelection(te.create(s.doc,u.pos)):s.setSelection(de.create(s.doc,u.pos));else{const d=(l=u.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(c,d),s.setSelection(de.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[eg({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Jx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Xx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Qx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Zx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,eO=Oi.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[er({find:Jx,type:this.type}),er({find:Qx,type:this.type})]},addPasteRules(){return[tr({find:Xx,type:this.type}),tr({find:Zx,type:this.type})]}}),tO=He.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Me(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),nO="listItem",$p="textStyle",Cp=/^(\d+)\.\s$/,oO=He.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Me(this.options.HTMLAttributes,n),0]:["ol",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nO,this.editor.getAttributes($p)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=si({find:Cp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=si({find:Cp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($p)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),rO=He.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sO=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,aO=Oi.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Me(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[er({find:iO,type:this.type})]},addPasteRules(){return[tr({find:sO,type:this.type})]}}),lO=He.create({name:"text",group:"inline"}),uO=Ue.create({name:"starterKit",addExtensions(){var t,e,n,o,r,i,s,a,l,u,c,d,p,f,h,m,v,y;const _=[];return this.options.bold!==!1&&_.push(hx.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&_.push(ux.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&_.push(gx.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&_.push(bx.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&_.push(kx.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&_.push(Sx.configure((i=this.options)===null||i===void 0?void 0:i.document)),this.options.dropcursor!==!1&&_.push(Ix.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&_.push(Nx.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&_.push(Lx.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&_.push(Bx.configure((u=this.options)===null||u===void 0?void 0:u.heading)),this.options.history!==!1&&_.push(Kx.configure((c=this.options)===null||c===void 0?void 0:c.history)),this.options.horizontalRule!==!1&&_.push(Yx.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&_.push(eO.configure((p=this.options)===null||p===void 0?void 0:p.italic)),this.options.listItem!==!1&&_.push(tO.configure((f=this.options)===null||f===void 0?void 0:f.listItem)),this.options.orderedList!==!1&&_.push(oO.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&_.push(rO.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&_.push(aO.configure((v=this.options)===null||v===void 0?void 0:v.strike)),this.options.text!==!1&&_.push(lO.configure((y=this.options)===null||y===void 0?void 0:y.text)),_}}),Ap=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("en",{granularity:"grapheme"}):null;function cO(t){return Ap?Array.from(Ap.segment(t)).length:[...t].length}const dO=Ue.create({name:"characterCount",addOptions(){return{limit:null,textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;let n=0;return e.descendants(o=>{o.isText&&o.text?n+=cO(o.text):o.type.name==="emoji"&&(n+=1)}),n},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ie({key:new Be("characterCount"),appendTransaction:(e,n,o)=>{if(t)return null;const{limit:r}=this.options;if(r==null||r===0)return t=!0,null;const i=this.storage.characters({node:o.doc});if(i>r){const s=i-r,a=0,l=s,u=o.tr.deleteRange(a,l);return t=!0,u}return t=!0,null},filterTransaction:(e,n)=>{const{limit:o}=this.options;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc}),s=e.getMeta("paste");if(i<=o||r>o&&i>o&&i<=r)return!0;if(r>o&&i>o&&i>r||!s)return!1;const{pos:a}=e.selection.$head,l=i-o,u=a-l,c=a;return!(u<0||(e.deleteRange(u,c),this.storage.characters({node:e.doc})>o))}})]}});function pO(t){return Ue.create({name:"enterKey",addKeyboardShortcuts(){return{Enter:()=>(t==null||t(),!0),"Mod-Enter":({editor:e})=>(e.commands.setHardBreak(),!0)}}})}const fO=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Tg=He.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Me(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[eg({find:fO,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}});function hO(){return Tg.extend({name:_e.EMOJI,inline:!0,group:"inline",draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"message-emoji"}}}})}function mO(){return Tg.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"message-image"}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fileData:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){return[new Ie({key:new Be("imagePaste"),props:{handlePaste:(t,e)=>{var n;const o=Array.from(((n=e.clipboardData)==null?void 0:n.items)||[]).filter(r=>r.type.indexOf("image")===0);return o.length===0?!1:(o.forEach(r=>{const i=r.getAsFile();if(i){const s=new FileReader;s.onload=a=>{var l;const u=(l=a.target)==null?void 0:l.result,c=t.state.schema.nodes.image.create({src:u,fileData:i}),d=t.state.tr.replaceSelectionWith(c);t.dispatch(d)},s.onerror=a=>{console.error("[MessageInput]::Failed to read image file:",a)},s.onabort=()=>{console.warn("[MessageInput]::Image file reading was aborted.")},s.readAsDataURL(i)}}),!0)}}})]}}).configure({inline:!0})}const Ig="Expected a function";function wc(t,e,n){let o=!0,r=!0;if(typeof t!="function")throw new TypeError(Ig);return n&&xg(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),gO(t,e,{leading:o,maxWait:e,trailing:r})}function gO(t,e,n){let o,r,i,s,a,l,u=0,c=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(Ig);e=e||0,n&&xg(n)&&(c=!!n.leading,d="maxWait"in n,i=d?Math.max(n.maxWait||0,e):i,p="trailing"in n?!!n.trailing:p);function f(S){const M=o,T=r;return o=r=void 0,u=S,s=t.apply(T,M),s}function h(S){return u=S,a=setTimeout(y,e),c?f(S):s}function m(S){const M=S-l,T=S-u,I=e-M;return d?Math.min(I,i-T):I}function v(S){const M=S-l,T=S-u;return l===void 0||M>=e||M<0||d&&T>=i}function y(){const S=Date.now();if(v(S))return _(S);a=setTimeout(y,m(S))}function _(S){return a=void 0,p&&o?f(S):(o=r=void 0,s)}function E(){a!==void 0&&clearTimeout(a),u=0,o=l=r=a=void 0}function b(){return a===void 0?s:_(Date.now())}function N(...S){const M=Date.now(),T=v(M);if(o=S,r=this,l=M,T){if(a===void 0)return h(l);if(d)return clearTimeout(a),a=setTimeout(y,e),f(l)}return a===void 0&&(a=setTimeout(y,e)),s}return N.cancel=E,N.flush=b,N}function xg(t){const e=typeof t;return t!=null&&(e=="object"||e=="function")}var Se=(t=>(t.OWNER="Owner",t.ADMIN="Admin",t.COMMON="Member",t))(Se||{}),eo=(t=>(t.WORK="Private",t.PUBLIC="Public",t.MEETING="ChatRoom",t.AVCHATROOM="AVChatRoom",t.COMMUNITY="Community",t))(eo||{}),Br=(t=>(t.FREE_ACCESS="FREE_ACCESS",t.NEED_PERMISSION="NEED_PERMISSION",t.DISABLE_APPLY="DISABLE_APPLY",t))(Br||{}),k=(t=>(t.VIEW_GROUP_INFO="VIEW_GROUP_INFO",t.VIEW_MEMBER_LIST="VIEW_MEMBER_LIST",t.EDIT_GROUP_PROFILE_NAME="EDIT_GROUP_PROFILE_NAME",t.EDIT_GROUP_PROFILE_AVATAR="EDIT_GROUP_PROFILE_AVATAR",t.EDIT_GROUP_PROFILE_INTRODUCTION="EDIT_GROUP_PROFILE_INTRODUCTION",t.EDIT_GROUP_PROFILE_NOTIFICATION="EDIT_GROUP_PROFILE_NOTIFICATION",t.EDIT_GROUP_PROFILE_ELSE="EDIT_GROUP_PROFILE_ELSE",t.REMOVE_MEMBER="REMOVE_MEMBER",t.SET_MEMBER_ROLE="SET_MEMBER_ROLE",t.MUTE_MEMBER="MUTE_MEMBER",t.MUTE_ALL_MEMBERS="MUTE_ALL_MEMBERS",t.TRANSFER_OWNERSHIP="TRANSFER_OWNERSHIP",t.DISMISS_GROUP="DISMISS_GROUP",t.QUIT_GROUP="QUIT_GROUP",t))(k||{});const cu={[eo.WORK]:{[Se.OWNER]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!0,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!0,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.ADMIN]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.COMMON]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0}},[eo.PUBLIC]:{[Se.OWNER]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!0,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!0,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!0,[k.DISMISS_GROUP]:!0,[k.QUIT_GROUP]:!1},[Se.ADMIN]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.COMMON]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!1,[k.EDIT_GROUP_PROFILE_AVATAR]:!1,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0}},[eo.MEETING]:{[Se.OWNER]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!0,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!0,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!0,[k.DISMISS_GROUP]:!0,[k.QUIT_GROUP]:!1},[Se.ADMIN]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.COMMON]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!1,[k.EDIT_GROUP_PROFILE_AVATAR]:!1,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0}},[eo.COMMUNITY]:{[Se.OWNER]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!0,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!0,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!0,[k.DISMISS_GROUP]:!0,[k.QUIT_GROUP]:!1},[Se.ADMIN]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!0,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.COMMON]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!1,[k.EDIT_GROUP_PROFILE_AVATAR]:!1,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0}},[eo.AVCHATROOM]:{[Se.OWNER]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!0,[k.EDIT_GROUP_PROFILE_AVATAR]:!0,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[k.EDIT_GROUP_PROFILE_ELSE]:!0,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!0,[k.MUTE_ALL_MEMBERS]:!0,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.ADMIN]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!1,[k.EDIT_GROUP_PROFILE_AVATAR]:!1,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0},[Se.COMMON]:{[k.VIEW_GROUP_INFO]:!0,[k.VIEW_MEMBER_LIST]:!0,[k.EDIT_GROUP_PROFILE_NAME]:!1,[k.EDIT_GROUP_PROFILE_AVATAR]:!1,[k.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[k.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[k.EDIT_GROUP_PROFILE_ELSE]:!1,[k.REMOVE_MEMBER]:!1,[k.SET_MEMBER_ROLE]:!1,[k.MUTE_MEMBER]:!1,[k.MUTE_ALL_MEMBERS]:!1,[k.TRANSFER_OWNERSHIP]:!1,[k.DISMISS_GROUP]:!1,[k.QUIT_GROUP]:!0}}},an=x(void 0),Ve=x(void 0),co=x(void 0),ci=x(void 0),di=x(void 0),pi=x(void 0),fi=x(void 0),hi=x(void 0),Ta=x(void 0),Ia=x(void 0),sr=x([]),Nt=x([]),Ec=x(void 0),kc=x(void 0),pn=x(void 0),xa=x(void 0),Oa=x(void 0),$a=x(void 0),Ys=x(void 0),jo=x(void 0);async function Ca(t){var e;const n=(t==null?void 0:t.groupID)||Ve.value;if(!n)throw new Error("getGroupMemberList::groupID is required");const o=await gt.getGroupMemberList({groupID:n,count:(t==null?void 0:t.count)||100,offset:(t==null?void 0:t.offset)||0});if((e=o==null?void 0:o.data)!=null&&e.memberList){const r=o.data.memberList.map(c=>({userID:c.userID,nick:c.nick||c.userID,avatar:c.avatar||"",role:c.role,joinTime:c.joinTime,muteUntil:c.muteUntil||"",memberCustomField:c.memberCustomField||""})),i=Nt.value||[],s=(t==null?void 0:t.offset)||0;let a;s===0?a=r:(a=[...i],r.forEach((c,d)=>{const p=s+d;p<a.length?a[p]=c:a.push(c)}));const l=a.find(c=>c.role===Se.OWNER),u=a.filter(c=>c.role===Se.ADMIN);return l&&(Ia.value=l),sr.value=u,Nt.value=a,a}throw new Error("getGroupMemberList::getGroupMemberList failed")}async function vO(t){const e=t.groupID||Ve.value;if(!e)throw new Error("updateGroupProfile::groupID is required");const n={groupID:e};if(t.name!==void 0){if(typeof t.name!="string")throw new Error("updateGroupProfile::name must be a string");if(t.name.length===0)throw new Error("updateGroupProfile::name cannot be empty");if(t.name.length>30)throw new Error("updateGroupProfile::name must be less than or equal to 25 characters");if(t.name===ci.value)throw new Error("updateGroupProfile::name cannot be the same as current value");n.name=t.name}if(t.introduction!==void 0){if(typeof t.introduction!="string")throw new Error("updateGroupProfile::introduction must be a string");if(t.introduction.length>130)throw new Error("updateGroupProfile::introduction must be less than 100 characters");if(t.introduction===pi.value)throw new Error("updateGroupProfile::introduction cannot be the same as current value");n.introduction=t.introduction}if(t.notification!==void 0){if(typeof t.notification!="string")throw new Error("updateGroupProfile::notification must be a string");if(t.notification.length>130)throw new Error("updateGroupProfile::notification must be less than 100 characters");if(t.notification===fi.value)throw new Error("updateGroupProfile::notification cannot be the same as current value");n.notification=t.notification}if(t.avatar!==void 0){if(typeof t.avatar!="string")throw new Error("updateGroupProfile::avatar must be a string");if(t.avatar.length>500)throw new Error("updateGroupProfile::avatar must be less than 500 characters");if(t.avatar===di.value)throw new Error("updateGroupProfile::avatar cannot be the same as current value");n.avatar=t.avatar}try{await gt.updateGroupProfile(n)}catch(o){throw ia(o),o}t.name!==void 0&&(ci.value=t.name),t.introduction!==void 0&&(pi.value=t.introduction),t.notification!==void 0&&(fi.value=t.notification),t.avatar!==void 0&&(di.value=t.avatar)}async function yO(t){const e=t.groupID||Ve.value;if(!e)throw new Error("addGroupMember::groupID is required");const n=await gt.addGroupMember({groupID:e,userIDList:t.userIDList});return Ca({count:100}),n}async function bO(t){var e,n;const o=t.groupID||Ve.value;if(!o)throw new Error("deleteGroupMember::groupID is required");await gt.deleteGroupMember({groupID:o,userIDList:t.userIDList});const r=(e=Nt.value)==null?void 0:e.filter(s=>!t.userIDList.includes(s.userID)),i=(n=sr.value)==null?void 0:n.filter(s=>!t.userIDList.includes(s.userID));Nt.value=r,sr.value=i}async function _O(t){const e=t.groupID||Ve.value;e&&await gt.changeGroupOwner({groupID:e,newOwnerID:t.newOwnerID})}async function wO(t){const e=t.groupID||Ve.value;e&&(await gt.setGroupMemberRole({groupID:e,userID:t.userID,role:t.role}),Ca({count:100}))}async function EO(t){const e=t.groupID||Ve.value;!e||!pn.value||(Oa.value=t.nameCard,await gt.setGroupMemberNameCard({groupID:e,userID:t.userID||pn.value,nameCard:t.nameCard}))}async function kO(t){if(!an.value)throw new Error("setChatPinned::currentConversation is required");t!==an.value.isPinned&&(Ta.value=t,await an.value.pinConversation())}async function SO(t){if(!an.value)throw new Error("setChatMuted::currentConversation is required");if(t!==an.value.isMuted){hi.value=t;try{await an.value.muteConversation()}catch(e){throw hi.value=!t,e}}}async function MO(t){const e=t.groupID||Ve.value;if(!e)throw new Error("setGroupMemberMuteTime::groupID is required");await gt.setGroupMemberMuteTime({groupID:e,userID:t.userID,muteTime:t.time}),Ca({count:100})}async function TO(t){if(!Ve.value)throw new Error("setMuteAllMember::groupID is required");await gt.updateGroupProfile({groupID:Ve.value,muteAllMembers:t}),$a.value=t}async function IO(t){const e=t||Ve.value;if(!e)throw new Error("dismissGroup::groupID is required");await gt.dismissGroup(e)}async function xO(t){const e=t||Ve.value;if(!e)throw new Error("quitGroup::groupID is required");await gt.quitGroup(e)}function OO(t,e,n){const o=n||co.value,r=e||xa.value||Se.COMMON;if(!o||!r)throw new Error("hasPermission::groupType or userRole is required");const i=cu[o][r][t];if(typeof i!="boolean")throw new Error(`hasPermission::${t}-${o}-${r} is not defined`);return i}function $O(t){if(!pn.value||!Nt.value)return!1;const e=Nt.value.find(n=>n.userID===pn.value);return!e||e.userID===t.userID?!1:e.role===Se.OWNER?!0:e.role===Se.ADMIN?t.role===Se.COMMON:!1}function CO(){if(!co.value||!pn.value||!Nt.value)return[];const t=Nt.value.find(e=>e.userID===pn.value);return t?cu[co.value][t.role]?Object.keys(cu[co.value][t.role]):[]:[]}function AO(){an.value=void 0,Ve.value=void 0,co.value=void 0,ci.value=void 0,di.value=void 0,pi.value=void 0,fi.value=void 0,hi.value=void 0,Ta.value=void 0,Ia.value=void 0,sr.value=[],Nt.value=[],Ec.value=void 0,kc.value=void 0,pn.value=void 0,xa.value=void 0,Oa.value=void 0,$a.value=void 0,Ys.value=void 0,jo.value=void 0}function RO(){$e.watch(Tt.CONV,{currentConversation:t=>{var e;if(t&&t.type==="GROUP"){((e=an.value)==null?void 0:e.conversationID)!==t.conversationID&&(Nt.value=void 0,sr.value=void 0,Ia.value=void 0),an.value=t;const{groupProfile:{groupID:n,name:o,avatar:r,introduction:i,muteAllMembers:s,memberCount:a,maxMemberCount:l,notification:u,type:c,inviteOption:d,selfInfo:{role:p,userID:f,nameCard:h}},isMuted:m,isPinned:v,operationType:y}=t;switch(Ve.value=n,co.value=c,ci.value=o,di.value=r,pi.value=i,hi.value=m,Ta.value=v,$a.value=s,Ec.value=a,pn.value=f,xa.value=p,Oa.value=h,kc.value=l,fi.value=u,d){case ce.TYPES.JOIN_OPTIONS_FREE_ACCESS:jo.value=Br.FREE_ACCESS;break;case ce.TYPES.JOIN_OPTIONS_NEED_PERMISSION:jo.value=Br.NEED_PERMISSION;break;case ce.TYPES.JOIN_OPTIONS_DISABLE_INVITE:jo.value=Br.DISABLE_APPLY;break;default:jo.value=Br.DISABLE_APPLY}[4,5,8].includes(y)?Ys.value=!1:y===0&&(Ys.value=!0)}else AO()}}),$e.watch(Tt.GRP,{groupProfile:t=>{typeof t=="object"&&t&&"groupID"in t&&(Ve.value=t.groupID)}})}RO();function Ai(){return{groupID:Ve,groupType:co,groupName:ci,avatar:di,introduction:pi,notification:fi,isMuted:hi,isPinned:Ta,groupOwner:Ia,adminMembers:sr,allMembers:Nt,memberCount:Ec,maxMemberCount:kc,currentUserID:pn,currentUserRole:xa,nameCard:Oa,isMuteAllMembers:$a,isInGroup:Ys,inviteOption:jo,hasPermission:OO,canOperateOnMember:$O,getAvailablePermissions:CO,getGroupMemberList:Ca,updateGroupProfile:vO,addGroupMember:yO,deleteGroupMember:bO,changeGroupOwner:_O,setGroupMemberRole:wO,setGroupMemberNameCard:EO,setChatPinned:kO,setChatMuted:SO,setGroupMemberMuteTime:MO,setMuteAllMember:TO,dismissGroup:IO,quitGroup:xO}}var DO=G({__name:"PopoverAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t;ke();const n=dr();return Uv(()=>{n.hasCustomAnchor.value=!0}),Lt(()=>{n.hasCustomAnchor.value=!1}),(o,r)=>(w(),L(g(Iu),ln(vo(e)),{default:A(()=>[J(o.$slots,"default")]),_:3},16))}}),PO=DO;const NO=["onClick","onMouseenter"],LO={class:"mention-suggestion__name"},BO={key:0,class:"mention-suggestion__loading"},UO={key:1,class:"mention-suggestion__empty"},FO=G({__name:"MentionSuggestion",props:{editor:{},range:{},query:{},text:{},items:{},command:{type:Function},decorationNode:{},clientRect:{type:[Function,null]}},setup(t,{expose:e}){const n=t,{t:o}=Ee(),r=x(0),i=x(!0),s=x(null),a=x(null),l=x(!1),u=x(0),{allMembers:c,currentUserID:d,groupID:p,memberCount:f,getGroupMemberList:h}=Ai(),m=P(()=>{if(!c.value||!d.value||!f.value)return[];const R=c.value.filter(D=>D.userID!==d.value);return f.value&&f.value>2&&R.unshift({userID:ce.TYPES.MSG_AT_ALL,nick:o("MessageInput.at_all_members")||"all",avatar:"/at_all_members.png"}),R}),v=P(()=>{var R;return(((R=c.value)==null?void 0:R.length)||0)<(f.value||0)}),y=P(()=>{const R=n.query.toLowerCase().trim();return R?m.value.filter(D=>D.nick.toLowerCase().includes(R)):m.value}),_=P(()=>y.value[r.value]||null),E=P(()=>v.value||l.value||y.value.length===0),b=async()=>{var R;if(!(l.value||!v.value||!p.value)){l.value=!0;try{await h({count:100,offset:((R=c.value)==null?void 0:R.length)||0})}catch(D){console.error("[MentionSuggestion] Failed to load more members:",D)}finally{l.value=!1}}};le([()=>n.query,y,v],([R,D,C])=>{R.toLowerCase().trim()&&D.length===0&&!C?i.value=!1:i.value=!0,D.length<10&&C&&!l.value&&b()},{immediate:!0});const N=P(()=>{var R;const D=(R=n.clientRect)==null?void 0:R.call(n);return D?{getBoundingClientRect:()=>({width:0,height:D.height,x:D.left,y:D.top,top:D.top,left:D.left,right:D.left,bottom:D.top+D.height})}:null});le(y,(R,D)=>{!D||R.length<D.length||R.length===0?r.value=0:R.length>D.length&&r.value>=R.length&&(r.value=R.length-1)},{immediate:!0});let S=null;const M=()=>{S&&(S.disconnect(),S=null),!(!s.value||!a.value)&&(S=new IntersectionObserver(R=>{R.forEach(D=>{D.isIntersecting&&b()})},{root:s.value,rootMargin:"0px",threshold:.1}),S.observe(a.value))};le([s,a,E],()=>{E.value&&s.value&&a.value&&setTimeout(M,0)},{flush:"post"}),tt(()=>{window.addEventListener("resize",wc(T,30))}),vi(()=>{S&&(S.disconnect(),S=null),window.removeEventListener("resize",T)});const T=()=>{u.value+=1},I=R=>{const D=y.value[R];D&&n.command({id:D.userID,label:D.nick,mentionSuggestionChar:"@"})},O=()=>{if(!s.value)return;const R=s.value.children[r.value];R&&(R.scrollIntoView({block:"nearest"}),r.value===y.value.length-1&&v.value&&a.value&&a.value.scrollIntoView({block:"nearest"}))},B=R=>{const{event:D}=R;if(D.key==="ArrowDown"){D.preventDefault();const C=Math.min(r.value+1,y.value.length-1);return r.value=C,O(),C===y.value.length-1&&v.value&&!l.value&&b(),!0}return D.key==="ArrowUp"?(D.preventDefault(),r.value=Math.max(r.value-1,0),O(),!0):D.key==="Enter"&&(D.preventDefault(),_.value)?(I(r.value),!0):D.key==="Escape"},$=R=>{R.preventDefault()};return e({onKeyDown:B}),(R,D)=>(w(),L(g(Pu),{open:i.value,"onUpdate:open":D[0]||(D[0]=C=>i.value=C),modal:!1},{default:A(()=>[N.value?(w(),L(g(PO),{key:0,reference:N.value},null,8,["reference"])):ne("",!0),q(g(Lu),null,{default:A(()=>[q(g(Nu),{class:"mention-suggestion__content",side:"top",align:"start","side-offset":8,"collision-padding":8,"avoid-collisions":!1,onOpenAutoFocus:$},{default:A(()=>[V("div",{ref_key:"listboxRef",ref:s,class:"mention-suggestion__listbox"},[(w(!0),z(he,null,ze(y.value,(C,j)=>(w(),z("div",{key:C.userID,class:F(["mention-suggestion__item",{"mention-suggestion__item--selected":j===r.value}]),onClick:W=>I(j),onMouseenter:W=>r.value=j},[C.avatar!=="/at_all_members.png"?(w(),L(g(Ko),{key:0,class:"mention-suggestion__avatar",src:C.avatar},null,8,["src"])):ne("",!0),V("span",LO,Z(C.nick||C.userID),1)],42,NO))),128)),E.value?(w(),z("div",{key:0,ref_key:"sentinelRef",ref:a,class:"mention-suggestion__sentinel"},[v.value?(w(),z("div",BO,[D[1]||(D[1]=V("div",{class:"mention-suggestion__spinner"},null,-1)),V("span",null,Z(g(o)("MessageInput.loading")),1)])):y.value.length===0&&!v.value?(w(),z("div",UO,Z(g(o)("MessageInput.no_matching_members")),1)):ne("",!0)],512)):ne("",!0)],512)]),_:1})]),_:1})]),_:1},8,["open"]))}}),jO=se(FO,[["__scopeId","data-v-bb944499"]]);function qO(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=o&&!r,u=kT(n),c=new RegExp(`\\s${u}$`),d=s?"^":"",p=r?"":u,f=l?new RegExp(`${d}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${u}[^\\s${p}]*`,"gm"),h=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!h)return null;const m=a.pos-h.length,v=Array.from(h.matchAll(f)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),_=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!_)return null;const E=m+v.index;let b=E+v[0].length;return l&&c.test(h.slice(b-1,b+1))&&(v[0]+=" ",b+=1),E<a.pos&&b>=a.pos?{range:{from:E,to:b},query:v[0].slice(n.length),text:v[0]}:null}const zO=new Be("suggestion");function GO({pluginKey:t=zO,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:c=()=>[],render:d=()=>({}),allow:p=()=>!0,findSuggestionMatch:f=qO}){let h;const m=d==null?void 0:d(),v=new Ie({key:t,view(){return{update:async(y,_)=>{var E,b,N,S,M,T,I;const O=(E=this.key)===null||E===void 0?void 0:E.getState(_),B=(b=this.key)===null||b===void 0?void 0:b.getState(y.state),$=O.active&&B.active&&O.range.from!==B.range.from,R=!O.active&&B.active,D=O.active&&!B.active,C=!R&&!D&&O.query!==B.query,j=R||$&&C,W=C||$,ee=D||$&&C;if(!j&&!W&&!ee)return;const oe=ee&&!j?O:B,we=y.dom.querySelector(`[data-decoration-id="${oe.decorationId}"]`);h={editor:e,range:oe.range,query:oe.query,text:oe.text,items:[],command:Ke=>u({editor:e,range:oe.range,props:Ke}),decorationNode:we,clientRect:we?()=>{var Ke;const{decorationId:Fe}=(Ke=this.key)===null||Ke===void 0?void 0:Ke.getState(e.state),dt=y.dom.querySelector(`[data-decoration-id="${Fe}"]`);return(dt==null?void 0:dt.getBoundingClientRect())||null}:null},j&&((N=m==null?void 0:m.onBeforeStart)===null||N===void 0||N.call(m,h)),W&&((S=m==null?void 0:m.onBeforeUpdate)===null||S===void 0||S.call(m,h)),(W||j)&&(h.items=await c({editor:e,query:oe.query})),ee&&((M=m==null?void 0:m.onExit)===null||M===void 0||M.call(m,h)),W&&((T=m==null?void 0:m.onUpdate)===null||T===void 0||T.call(m,h)),j&&((I=m==null?void 0:m.onStart)===null||I===void 0||I.call(m,h))},destroy:()=>{var y;h&&((y=m==null?void 0:m.onExit)===null||y===void 0||y.call(m,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,_,E,b){const{isEditable:N}=e,{composing:S}=e.view,{selection:M}=y,{empty:T,from:I}=M,O={..._};if(O.composing=S,N&&(T||e.view.composing)){(I<_.range.from||I>_.range.to)&&!S&&!_.composing&&(O.active=!1);const B=f({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:M.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;B&&p({editor:e,state:b,range:B.range,isActive:_.active})?(O.active=!0,O.decorationId=_.decorationId?_.decorationId:$,O.range=B.range,O.query=B.query,O.text=B.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(y,_){var E;const{active:b,range:N}=v.getState(y.state);return b&&((E=m==null?void 0:m.onKeyDown)===null||E===void 0?void 0:E.call(m,{view:y,event:_,range:N}))||!1},decorations(y){const{active:_,range:E,decorationId:b}=v.getState(y);return _?mt.create(y.doc,[mn.inline(E.from,E.to,{nodeName:a,class:l,"data-decoration-id":b})]):null}}});return v}function HO({editor:t,overrideSuggestionOptions:e,extensionName:n,char:o="@"}){const r=new Be;return{editor:t,char:o,pluginKey:r,command:({editor:i,range:s,props:a})=>{var l,u,c;const d=i.view.state.selection.$to.nodeAfter;!((l=d==null?void 0:d.text)===null||l===void 0)&&l.startsWith(" ")&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:o}},{type:"text",text:" "}]).run(),(c=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||c===void 0||c.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function Og(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>HO({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Rp(t,e){const n=Og(t);return n.find(r=>r.char===e)||(n.length?n[0]:null)}const VO=He.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,o;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(o=t.attrs.label)!==null&&o!==void 0?o:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var o,r;return["span",Me(this.HTMLAttributes,t.HTMLAttributes),`${(o=n==null?void 0:n.char)!==null&&o!==void 0?o:"@"}${(r=e.attrs.label)!==null&&r!==void 0?r:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Rp(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Me({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const o={...this.options};o.HTMLAttributes=Me({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:t,suggestion:n});return typeof r=="string"?["span",Me({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){const e={options:this.options,node:t,suggestion:Rp(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:o}=e,{empty:r,anchor:i}=o;if(!r)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new rn,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return Og(this).map(GO)}});function WO(){return VO.configure({deleteTriggerWithBackspace:!0,HTMLAttributes:{class:"uikit-message-input-mention-tag"},suggestion:{char:"@",items:()=>[],render:()=>{let t=null,e=null;const n=()=>{e!=null&&e.parentNode&&e.parentNode.removeChild(e),t==null||t.destroy(),t=null,e=null};return{onStart:o=>{var r;const{activeConversation:i}=Bn(),{memberCount:s,groupType:a}=Ai();((r=i.value)==null?void 0:r.type)===Ne.GROUP&&s.value&&s.value>1&&a.value!==eo.AVCHATROOM&&(t=new sx(jO,{props:o,editor:o.editor}),t.element&&(e=t.element,document.body.appendChild(e)))},onUpdate(o){t==null||t.updateProps(o)},onKeyDown(o){var r,i;return o.event.key==="Escape"?(n(),!0):((i=(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown)==null?void 0:i.call(r,o))||!1},onExit(){n()}}}}})}function KO(t={}){const{placeholder:e="",maxLength:n,showPlaceholderOnlyWhenEditable:o=!0,onEnter:r}=t;return[uO.configure({heading:!1,blockquote:!1,codeBlock:!1,bulletList:!1,orderedList:!1,listItem:!1,horizontalRule:!1,bold:!1,italic:!1,strike:!1,code:!1}),dO.configure({limit:n}),pO(r),hO(),mO(),WO(),ax.configure({placeholder:e,showOnlyWhenEditable:o})]}const YO="_disabled_ihh75_11",JO="_editor_ihh75_21",Er={"input-wrapper":"_input-wrapper_ihh75_1",disabled:YO,"input-prefix":"_input-prefix_ihh75_15","input-suffix":"_input-suffix_ihh75_16",editor:JO},XO=G({__name:"TextEditor",props:{autoFocus:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},maxLength:{default:void 0}},setup(t){const e=t,{t:n,language:o}=Ee(),{activeConversation:r}=Bn(),{sendMessage:i,setEditorInstance:s,setContent:a}=Un();let l=null;const u=P(()=>e.placeholder??n("MessageInput.enter_a_message")),c=()=>{i(),a("")},d=ix({autofocus:e.autoFocus,editable:!e.disabled,extensions:KO({placeholder:u.value,maxLength:e.maxLength,showPlaceholderOnlyWhenEditable:e.placeholder===void 0,onEnter:c}),onUpdate:()=>{ot.enterTypingState(),l&&clearTimeout(l),l=setTimeout(()=>{ot.leaveTypingState(),l=null},3e3)}});return le(d,p=>{s(p??null)},{immediate:!0}),le(()=>e.disabled,p=>{var f;(f=d.value)==null||f.setEditable(!p),p&&a("")}),le([u,o],()=>{if(!d.value)return;const p=d.value.extensionManager.extensions.find(f=>f.name==="placeholder");p&&(p.options.placeholder=u.value,d.value.view.updateState(d.value.state))}),le(()=>e.maxLength,p=>{if(!d.value)return;const f=d.value.extensionManager.extensions.find(h=>h.name==="characterCount");f&&(f.options.limit=p)}),le(r,(p,f)=>{(p==null?void 0:p.conversationID)!==(f==null?void 0:f.conversationID)&&a("")}),vi(()=>{s(null)}),(p,f)=>(w(),z("div",{class:F([g(Er)["input-wrapper"],e.disabled&&g(Er).disabled])},[V("div",{class:F(g(Er)["input-prefix"])},[J(p.$slots,"inputPrefix")],2),q(g(rx),{editor:g(d),class:F([g(Er).editor,"message-input"])},null,8,["editor","class"]),V("div",{class:F(g(Er)["input-suffix"])},[J(p.$slots,"inputSuffix")],2)],2))}});function mi(t,e,n){if(!t)return e;try{const o=t.trim();return!o||o==="undefined"?e:o==="null"?null:JSON.parse(o,n)??e}catch{return e}}function An(t){try{const e=mi(t.payload.data,{});if(e.businessID===1&&e.data){const n=mi(e.data,{});if(n.businessID==="av_call"||n.businessID==="rtc_call")return!0}}catch{return!1}return!1}function gi(t){if(!_l.getService(xn.TUICalling.SERVICE.NAME)){jr(Fr.CALL_KIT_NOT_INTEGRATED);return}const{createCallOfflinePushInfo:e}=Bu(),n=e();_l.callService({serviceName:xn.TUICalling.SERVICE.NAME,method:xn.TUICalling.SERVICE.METHOD.START_CALL,params:{...t,version:"v3",...n&&!t.offlinePushInfo?{offlinePushInfo:n}:{}}})}function $g(t){const e=mi(t.payload.data,void 0);if(!e)return;const n=mi(e.data,void 0);return n?{description:t.payload.description,extension:t.payload.extension,data:{businessID:e.businessID,timeout:e.timeout,data:{businessID:n.businessID,call_end:n.call_end,call_type:n.call_type,data:{cmd:n.data.cmd,inviter:n.data.inviter,message:n.data.message,room_id:n.data.room_id,str_room_id:n.data.str_room_id},platform:n.platform,room_id:n.room_id,userData:n.userData,version:n.version},inviteID:e.inviteID,groupID:e.groupID,actionType:e.actionType,inviter:e.inviter,inviteeList:e.inviteeList}}:void 0}function QO(t){if(!t||t<=0)return"00:00";const e=Math.floor(t/3600),n=Math.floor(t%3600/60),o=Math.floor(t%60);return e>0?`${e.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}function Dp(t,e=12){return!t||t.length<=e?t:`${t.substring(0,e)}...`}function ZO(t){return pf.getFriendRemark([t])[t]||""}const du=new Map,Pp=new Map;function Cg(t,e){var n,o,r,i,s,a,l,u,c,d,p;const f=$g(t);if(!f||f.data.businessID!==1)return"";const{data:h}=f,m=h.data,v=t.fromAccount||t.from,y=ZO(v),_=ce.getMyUserID();let E=y||t.nameCard||t.nick||v;switch(E=Dp(E),h.actionType){case 1:return(((n=m==null?void 0:m.data)==null?void 0:n.cmd)==="audioCall"||((o=m==null?void 0:m.data)==null?void 0:o.cmd)==="videoCall")&&h.groupID?e("CallMessage.start_call",{messageSender:E}):((r=m==null?void 0:m.data)==null?void 0:r.cmd)==="hangup"?h.groupID?e("CallMessage.call_ended"):`${e("CallMessage.call_duration")}: ${QO(m==null?void 0:m.call_end)}`:((i=m==null?void 0:m.data)==null?void 0:i.cmd)==="switchToAudio"?e("CallMessage.switch_to_audio_call"):((s=m==null?void 0:m.data)==null?void 0:s.cmd)==="switchToVideo"?e("CallMessage.switch_to_video_call"):e("CallMessage.start_call",{messageSender:""});case 2:return h.groupID?`${E} ${e("CallMessage.cancel_call")}`:h.inviter===_?e("CallMessage.canceled"):e("CallMessage.canceled_by_recipient");case 3:return((a=m==null?void 0:m.data)==null?void 0:a.cmd)==="switchToAudio"?e("CallMessage.switch_to_audio_call"):((l=m==null?void 0:m.data)==null?void 0:l.cmd)==="switchToVideo"?e("CallMessage.switch_to_video_call"):h.groupID?`${E} ${e("CallMessage.answered")}`:e("CallMessage.answered");case 4:return h.groupID?`${E} ${e("CallMessage.decline_call")}`:(m==null?void 0:m.line_busy)==="line_busy"||((u=m==null?void 0:m.data)==null?void 0:u.message)==="lineBusy"?h.inviter===_?e("CallMessage.line_busy"):e("CallMessage.missed_due_to_busy"):h.inviter===_?e("CallMessage.declined_by_recipient"):e("CallMessage.declined");case 5:if(((c=m==null?void 0:m.data)==null?void 0:c.cmd)==="switchToAudio")return e("CallMessage.switch_to_audio_call");if(((d=m==null?void 0:m.data)==null?void 0:d.cmd)==="switchToVideo")return e("CallMessage.switch_to_video_call");if(h.groupID){if(v===h.inviter){e$(h.inviteeList);let b="";return(p=h.inviteeList)==null||p.forEach(N=>{const S=du.get(N)||N;b+=`${Dp(S)}、`}),b=b.substring(0,b.lastIndexOf("、")),`${b} ${e("CallMessage.no_answer")}`}return`${E} ${e("CallMessage.no_answer")}`}return h.inviter===_?e("CallMessage.no_answer_from_recipient"):e("CallMessage.no_answer_timeout");default:return""}}function e$(t=[]){if(t.length===0)return;const e=pf.getFriendRemark(t),n=[];t.forEach(o=>{const r=e[o];r?du.set(o,r):Pp.has(o)||(n.push(o),Pp.set(o,1))}),n.length>0&&Gv.getUserProfile({userIDList:n}).then(o=>{(o.data||[]).forEach(r=>{const{userID:i,nick:s}=r,a=s||i;du.set(i,a)})}).catch(()=>{})}const Np=1,t$=80,n$=9,o$=1,r$=G({__name:"AudioCallPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=Jt(),{t:o}=Ee(),{activeConversation:r}=Bn(),{allMembers:i,getGroupMemberList:s,memberCount:a,currentUserID:l}=Ai(),u=x(!1),c=x(),d=P(()=>{var S;return((S=r.value)==null?void 0:S.type)===Ne.C2C}),p=P(()=>{var S;return(((S=i.value)==null?void 0:S.map(M=>({key:M.userID,label:M.nick||M.userID,avatarUrl:M.avatar})))??[]).filter(M=>M.key!==l.value)}),f=P(()=>!(!r.value||e.disabled));function h(){var S,M;const T=(M=(S=r.value)==null?void 0:S.userProfile)==null?void 0:M.userID;if(!T){console.warn("No peer user ID found for private call");return}try{gi({userIDList:[T],chatGroupID:void 0,type:Np})}catch(I){console.error("Failed to start private audio call:",I)}}function m(){var S,M;if(((S=r.value)==null?void 0:S.type)!==Ne.GROUP)return;const T=((M=i.value)==null?void 0:M.length)||0,I=a.value||0;T<I&&s({count:t$,offset:T})}function v(){m(),u.value=!0}function y(){u.value=!1}function _(){var S,M;const T=(M=(S=r.value)==null?void 0:S.groupProfile)==null?void 0:M.groupID;if(!c.value||!T){console.warn("Missing group information for group call");return}const I=c.value.getSelectedItems();if(!Array.isArray(I)||I.length===0){console.warn("No members selected for group call");return}const O=I.map(B=>B.key);try{gi({userIDList:O,chatGroupID:T,type:Np}),y()}catch(B){console.error("Failed to start group audio call:",B)}}function E(){if(!f.value){console.warn("Cannot start audio call");return}d.value?h():v()}const b=()=>{var S;((S=r.value)==null?void 0:S.type)===Ne.GROUP&&m()},N=()=>_();return(S,M)=>(w(),L(g(Q),null,{default:A(()=>[V("div",{class:F(g(pe)(g(n)["audio-call-picker__button"],{[g(n).disabled]:e.disabled})),onClick:E},[J(S.$slots,"default",{},()=>[q(g(Ev),{size:e.iconSize,class:F(g(n)["audio-call-picker__icon"])},null,8,["size","class"])])],2),q(g(nf),{visible:u.value,title:g(o)("MessageInput.select_call_members"),cancelText:g(o)("MessageInput.cancel"),cancel:y,close:y,confirmText:g(o)("MessageInput.initiate_call"),confirm:N,customClasses:["group-call-dialog"],appendTo:"body"},{default:A(()=>[q(g(bu),{ref_key:"groupMemberPickerRef",ref:c,"display-mode":"list","data-source":p.value,"max-count":n$,"min-count":o$,class:"group-member-picker",style:{width:"100%"},onReachEnd:b},null,8,["data-source"])]),_:1},8,["visible","title","cancelText","confirmText"])]),_:3}))}}),i$="_disabled_1xb1g_16",s$={"audio-call-picker__button":"_audio-call-picker__button_1xb1g_1",disabled:i$,"audio-call-picker__icon":"_audio-call-picker__icon_1xb1g_22"},a$={$style:s$},Ag=se(r$,[["__cssModules",a$]]),Lp=2,l$=80,u$=9,c$=1,d$=G({__name:"VideoCallPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=Jt(),{t:o}=Ee(),{activeConversation:r}=Bn(),{allMembers:i,getGroupMemberList:s,memberCount:a,currentUserID:l}=Ai(),u=x(!1),c=x(),d=P(()=>{var M;return((M=r.value)==null?void 0:M.type)===Ne.C2C}),p=P(()=>{var M;return(((M=i.value)==null?void 0:M.map(T=>({key:T.userID,label:T.nick||T.userID,avatarUrl:T.avatar})))??[]).filter(T=>T.key!==l.value)}),f=P(()=>!(!r.value||e.disabled));function h(){var M,T;return(T=(M=r.value)==null?void 0:M.userProfile)==null?void 0:T.userID}function m(){const M=h();if(!M){console.warn("No peer user ID found for private call");return}try{gi({userIDList:[M],chatGroupID:"",type:Lp})}catch(T){console.error("Failed to start private video call:",T)}}function v(){var M,T;if(((M=r.value)==null?void 0:M.type)!==Ne.GROUP)return;const I=((T=i.value)==null?void 0:T.length)||0,O=a.value||0;I<O&&s({count:l$,offset:I})}function y(){v(),u.value=!0}function _(){u.value=!1}function E(){var M,T;const I=(T=(M=r.value)==null?void 0:M.groupProfile)==null?void 0:T.groupID;if(!c.value||!I){console.warn("Missing group information for group call");return}const O=c.value.getSelectedItems();if(!Array.isArray(O)||O.length===0){console.warn("No members selected for group call");return}const B=O.map($=>$.key);try{gi({userIDList:B,chatGroupID:I,type:Lp}),_()}catch($){console.error("Failed to start group video call:",$)}}function b(){if(!f.value){console.warn("Cannot start video call");return}d.value?m():y()}const N=()=>{var M;((M=r.value)==null?void 0:M.type)===Ne.GROUP&&v()},S=()=>E();return(M,T)=>(w(),L(g(Q),null,{default:A(()=>[V("div",{class:F(g(pe)(g(n)["video-call-picker__button"],{[g(n).disabled]:e.disabled})),onClick:b},[J(M.$slots,"default",{},()=>[q(g(kv),{size:e.iconSize,class:F(g(n)["video-call-picker__icon"])},null,8,["size","class"])])],2),q(g(nf),{visible:u.value,title:g(o)("MessageInput.select_call_members"),cancelText:g(o)("MessageInput.cancel"),cancel:_,close:_,confirmText:g(o)("MessageInput.initiate_call"),confirm:S,customClasses:["group-call-dialog"],appendTo:"body"},{default:A(()=>[q(g(bu),{ref_key:"groupMemberPickerRef",ref:c,"display-mode":"list","data-source":p.value,"max-count":u$,"min-count":c$,class:"group-member-picker",style:{width:"100%"},onReachEnd:N},null,8,["data-source"])]),_:1},8,["visible","title","cancelText","confirmText"])]),_:3}))}}),p$="_disabled_18fa2_16",f$={"video-call-picker__button":"_video-call-picker__button_18fa2_1",disabled:p$,"video-call-picker__icon":"_video-call-picker__icon_18fa2_22"},h$={$style:f$},Rg=se(d$,[["__cssModules",h$]]);async function m$(t){var e;if((e=navigator.clipboard)!=null&&e.writeText)try{return await navigator.clipboard.writeText(t),!0}catch(n){console.warn("Clipboard API failed:",n)}try{const n=document.createElement("textarea");if(n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),navigator.userAgent.match(/ipad|iphone/i)){n.contentEditable="true",n.readOnly=!1;const r=document.createRange();r.selectNodeContents(n);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(r),n.setSelectionRange(0,999999))}else n.select();const o=document.execCommand("copy");return document.body.removeChild(n),o}catch(n){console.warn("execCommand failed:",n)}throw new Error("Failed to copy text to clipboard, please copy manually")}let Bp;const Js=x([]),Sc=x(!1),Xs=x([]),Qs=x(void 0);function g$(t){Js.value=[...new Set([...Js.value,...t])]}function v$(t){Sc.value=t}function y$(t){Xs.value=[...new Set([...Xs.value,...t])]}function b$(t){const{messageIDList:e,conversationIDList:n,isMergeForward:o}=t;if(e.length===0||n.length===0||o===void 0)throw new Error("Invalid forward message parameters");const{enableReadReceipt:r}=ki(),{createChatOfflinePushInfo:i,isEnabled:s}=Bu(),a=n.map(c=>$e.getConversationModel(c)),l=e.map(c=>$e.getMessageModel(c)).sort((c,d)=>c.time-d.time),u=a.map(c=>{const d=s()?i({conversation:c,messageType:ie.MERGER,payload:{}}):void 0;return ot.sendForwardMessage([c],l,{needMerge:o,params:{needReadReceipt:!!r},offlinePushInfo:d,...t==null?void 0:t.sendForwardMessageOptions})});return Promise.allSettled(u)}function _$(t){$e.update(Tt.CHAT,"quoteMessage",{message:t,type:"quote"})}function Dg(){$e.update(Tt.CHAT,"quoteMessage",{message:void 0,type:"quote"}),Qs.value=void 0}function w$(t){return m$(Ei(t.payload.text||""))}function E$(t){return t.deleteMessage()}function k$(t){return t.revokeMessage()}function Pg(){Dg(),Js.value=[],Sc.value=!1,Xs.value=[]}function Mc(){return{forwardMessageIDList:Js,isForwardMessageSelectionDone:Sc,forwardConversationIDList:Xs,quotedMessage:Qs,setForwardMessageIDList:g$,setIsForwardMessageSelectionDone:v$,setForwardConversationIDList:y$,forwardMessage:b$,quoteMessage:_$,clearQuotedMessage:Dg,copyTextMessage:w$,deleteMessage:E$,recallMessage:k$,resetMessageActionState:Pg}}function S$(){function t(n){n.message===void 0?Qs.value=void 0:Qs.value=n.message}function e(n){n!==Bp&&(Pg(),Bp=n)}$e.watch(Tt.CHAT,{quoteMessage:t}),$e.watch(Tt.CONV,{currentConversationID:e})}S$();const M$="_quoted__message__preview_1u7zw_1",T$="_quoted__message__preview__content_1u7zw_15",I$="_quoted__message__preview__close_1u7zw_44",xo={quoted__message__preview:M$,"slide-in":"_slide-in_1u7zw_1",quoted__message__preview__content:T$,"quoted__message__preview__content--header":"_quoted__message__preview__content--header_1u7zw_23","quoted__message__preview__content--title":"_quoted__message__preview__content--title_1u7zw_29","quoted__message__preview__content--text":"_quoted__message__preview__content--text_1u7zw_34",quoted__message__preview__close:I$},x$=G({__name:"QuotedMessagePreview",setup(t){const{t:e}=Ee(),{focusEditor:n}=Un(),{quotedMessage:o,clearQuotedMessage:r}=Mc();Lt(()=>{r()}),le(o,a=>{a&&n()});const i=()=>{r()},s=a=>{var l;if(!a)return"no reference";switch(a.type){case ie.TEXT:return Ei(((l=a.payload)==null?void 0:l.text)||"");case ie.IMAGE:return e("MessageInput.image");case ie.AUDIO:return e("MessageInput.audio");case ie.VIDEO:return e("MessageInput.video");case ie.FILE:return e("MessageInput.file");case ie.LOCATION:return e("MessageInput.location");case ie.CUSTOM:return e("MessageInput.custom_message");default:return e("MessageInput.unknown")}};return(a,l)=>g(o)?(w(),z("div",{key:0,class:F(g(xo).quoted__message__preview)},[V("div",{class:F(g(xo).quoted__message__preview__content)},[V("div",{class:F(g(xo)["quoted__message__preview__content--header"])},[V("div",{class:F(g(xo)["quoted__message__preview__content--title"])},Z(g(o).nick||g(o).from),3)],2),V("div",{class:F(g(xo)["quoted__message__preview__content--text"])},Z(s(g(o))),3)],2),q(g(ar),{class:F(g(xo).quoted__message__preview__close),size:"16",onClick:i},null,8,["class"])],2)):ne("",!0)}}),O$=G({__name:"SendButton",props:{onClick:{type:Function},disabled:{type:Boolean}},setup(t){const e=t,{t:n}=Ee();function o(r){!e.disabled&&e.onClick&&e.onClick(r)}return(r,i)=>(w(),L(g(Es),{type:"primary",radius:"round",size:"medium",disabled:t.disabled,onClick:o},{default:A(()=>[me(Z(g(n)("MessageInput.send")),1)]),_:1},8,["disabled"]))}}),Wn={"message-input":"_message-input_2z5ho_1","message-input__toolbar":"_message-input__toolbar_2z5ho_12","message-input__wrapper":"_message-input__wrapper_2z5ho_20","message-input__leftInline":"_message-input__leftInline_2z5ho_25","message-input__rightInline":"_message-input__rightInline_2z5ho_25","message-input__actions":"_message-input__actions_2z5ho_29","message-input__footerToolbar":"_message-input__footerToolbar_2z5ho_35"},$$=G({__name:"MessageInput",props:{autoFocus:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},hideSendButton:{type:Boolean,default:!1},placeholder:{default:void 0},attachmentPickerMode:{default:"collapsed"},maxLength:{default:void 0},actions:{default:()=>["EmojiPicker","ImagePicker","FilePicker","VideoPicker"]},slots:{}},setup(t){const e=[{key:"EmojiPicker",component:ih},{key:"AttachmentPicker",component:Xc},{key:"FilePicker",component:zu},{key:"ImagePicker",component:Gu},{key:"VideoPicker",component:rh},{key:"AudioCallPicker",component:Ag},{key:"VideoCallPicker",component:Rg}],n=t,{setContent:o,sendMessage:r}=Un(),i=(c,d)=>Object.fromEntries(d.map(p=>[p,c[p]]).filter(([,p])=>p!==void 0)),s=c=>{const{component:d=()=>null}=e.find(({key:p})=>p===c)??{};return{Component:d,props:{disabled:n.disabled}}},a=c=>{var d;const{key:p,component:f,...h}=c,m=((d=e.find(({key:v})=>v===p))==null?void 0:d.component)??(()=>null);return{Component:f??m,props:i(h,["label","className","style","iconSize"])}},l=P(()=>n.actions.map(c=>typeof c=="string"?s(c):a(c)).filter(({Component:c})=>c!==null)),u=()=>{r(),o("")};return(c,d)=>(w(),z("div",{class:F([g(Wn)["message-input"]])},[J(c.$slots,"headerToolbar",{},()=>[V("div",{class:F(g(Wn)["message-input__toolbar"])},[(w(!0),z(he,null,ze(l.value,(p,f)=>(w(),L(lt(p.Component),ye({key:f},{ref_for:!0},{...p.props,...p.Component===g(Xc)?{attachmentPickerMode:t.attachmentPickerMode}:{}}),null,16))),128))],2)]),V("div",{class:F(g(Wn)["message-input__wrapper"])},[q(g(x$)),V("div",{class:F(g(Wn)["message-input__leftInline"])},[J(c.$slots,"leftInline")],2),J(c.$slots,"textEditor",{},()=>[(w(),L(g(XO),{key:t.disabled?"disabled-editor":"enabled-editor",autoFocus:t.autoFocus,disabled:t.disabled,placeholder:t.placeholder,maxLength:t.maxLength},{inputPrefix:A(()=>[J(c.$slots,"inputPrefix")]),inputSuffix:A(()=>[J(c.$slots,"inputSuffix")]),_:3},8,["autoFocus","disabled","placeholder","maxLength"]))]),V("div",{class:F(g(Wn)["message-input__rightInline"])},[J(c.$slots,"rightInline")],2)],2),J(c.$slots,"footerToolbar",{},()=>[V("div",{class:F(g(Wn)["message-input__footerToolbar"])},[t.hideSendButton?ne("",!0):(w(),L(g(O$),{key:0,class:F(g(Wn)["message-input__send-button"]),disabled:n.disabled,onClick:u},null,8,["class","disabled"]))],2)])],2))}}),C$={file:"File",image:"Image",video:"Video",audio:"Audio",location:"Location",custom_message:"Custom Message",unknown:"Unknown",enter_a_message:"Enter a message",send:"Send",select_call_members:"Select call members",cancel:"Cancel",confirm:"Confirm",initiate_call:"Initiate call",loading:"Loading...",no_matching_members:"No matching members",at_all_members:"All members",invalid_image_type:"Invalid image type"},A$={text:"[Text Message]",image:"[Image Message]",video:"[Video Message]",file:"[File Message]",audio:"[Audio Message]",face:"[Sticker Message]",location:"[Location Message]",merger:"[Forward Message]",custom:"[Custom Message]"},R$={OfflinePush:A$,MessageInput:C$},D$={file:"文件",image:"图片",video:"视频",audio:"音频",location:"位置",custom_message:"自定义消息",unknown:"未知",enter_a_message:"输入消息",send:"发送",select_call_members:"选择成员",cancel:"取消",confirm:"确认",initiate_call:"发起通话",loading:"加载中...",no_matching_members:"暂无匹配成员",at_all_members:"所有人",invalid_image_type:"无效的图片类型"},P$={text:"[文本消息]",image:"[图片消息]",video:"[视频消息]",file:"[文件消息]",audio:"[语音消息]",face:"[动画表情]",location:"[地理位置]",merger:"[转发消息]",custom:"[自定义消息]"},N$={MessageInput:D$,OfflinePush:P$},Zs={"en-US":R$,"zh-CN":N$};lr("en-US",{translation:{MessageInput:Zs["en-US"].MessageInput,OfflinePush:Zs["en-US"].OfflinePush}});lr("zh-CN",{translation:{MessageInput:Zs["zh-CN"].MessageInput,OfflinePush:Zs["zh-CN"].OfflinePush}});const iN=$$,sN=ih,aN=zu,lN=Gu,uN=Ag,cN=Rg;function L$(t,e=12){return t.length>e?`${t.slice(0,e)}...`:t}function B$(t){const{t:e}=qe,{nick:n,payload:o}=t,{newGroupProfile:r,memberList:i,operatorID:s}=o;let a="";const l=n||s,u=Object.keys(r)[0];switch(u){case"muteAllMembers":r[u]?a=`${e("MessageList.administrator")} ${l} ${e("MessageList.enabled_mute_all_members")}`:a=`${e("MessageList.administrator")} ${l} ${e("MessageList.disabled_mute_all_members")}`;break;case"ownerID":a=`${i[0].nick||i[0].userID} ${e("MessageList.became_new_group_owner")}`;break;case"groupName":a=`${l} ${e("MessageList.changed_group_name_to")} ${r[u]}`;break;case"notification":a=`${l} ${e("MessageList.published_new_announcement")}`;break}return a}function U$(t){var e,n,o,r,i,s;const a={text:""},{t:l}=qe;let u=(t==null?void 0:t.nick)||((n=(e=t==null?void 0:t.payload)==null?void 0:e.userIDList)==null?void 0:n.join(","));switch(((r=(o=t==null?void 0:t.payload)==null?void 0:o.memberList)==null?void 0:r.length)>0&&(u="",(s=(i=t==null?void 0:t.payload)==null?void 0:i.memberList)==null||s.map(c=>{const d=(c==null?void 0:c.nick)||(c==null?void 0:c.userID);return u+=`${L$(d)},`,c}),u=u==null?void 0:u.slice(0,-1)),t.payload.operationType){case ce.TYPES.GRP_TIP_MBR_JOIN:a.text=`${u} ${l("MessageList.joined_group")}`;break;case ce.TYPES.GRP_TIP_MBR_QUIT:a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.left_group")}`;break;case ce.TYPES.GRP_TIP_MBR_KICKED_OUT:a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.was")} ${l("MessageList.kicked_out_of_group")}`;break;case ce.TYPES.GRP_TIP_MBR_SET_ADMIN:a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.became_admin")}`;break;case ce.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.admin_privileges_revoked")}`;break;case ce.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:a.text=B$(t);break;case ce.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:t.payload.memberList.forEach(c=>{c.muteTime>0?a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.was_muted")}`:a.text=`${l("MessageList.group_member")}: ${u} ${l("MessageList.was_unmuted")}`});break;default:a.text=`[${l("MessageList.group_tip_message")}]`;break}return a}const Ng=6048e5,F$=864e5,Up=Symbol.for("constructDateFrom");function yt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Up in t?t[Up](e):t instanceof Date?new t.constructor(e):new Date(e)}function Ot(t,e){return yt(e||t,t)}function j$(t,e,n){const o=Ot(t,void 0);return isNaN(e)?yt(t,NaN):(o.setDate(o.getDate()+e),o)}let q$={};function Aa(){return q$}function go(t,e){var n,o,r,i;const s=Aa(),a=(e==null?void 0:e.weekStartsOn)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.weekStartsOn)??s.weekStartsOn??((i=(r=s.locale)==null?void 0:r.options)==null?void 0:i.weekStartsOn)??0,l=Ot(t,e==null?void 0:e.in),u=l.getDay(),c=(u<a?7:0)+u-a;return l.setDate(l.getDate()-c),l.setHours(0,0,0,0),l}function ea(t,e){return go(t,{...e,weekStartsOn:1})}function Lg(t,e){const n=Ot(t,void 0),o=n.getFullYear(),r=yt(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);const i=ea(r),s=yt(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);const a=ea(s);return n.getTime()>=i.getTime()?o+1:n.getTime()>=a.getTime()?o:o-1}function Fp(t){const e=Ot(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Ra(t,...e){const n=yt.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function ta(t,e){const n=Ot(t,void 0);return n.setHours(0,0,0,0),n}function z$(t,e,n){const[o,r]=Ra(void 0,t,e),i=ta(o),s=ta(r),a=+i-Fp(i),l=+s-Fp(s);return Math.round((a-l)/F$)}function G$(t,e){const n=Lg(t),o=yt(t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),ea(o)}function Tc(t){return yt(t,Date.now())}function Bg(t,e,n){const[o,r]=Ra(void 0,t,e);return+ta(o)==+ta(r)}function H$(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function V$(t){return!(!H$(t)&&typeof t!="number"||isNaN(+Ot(t)))}function W$(t,e){const n=Ot(t,void 0);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const K$={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Y$=(t,e,n)=>{let o;const r=K$[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Vo(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const J$={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},X$={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Q$={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Z$={date:Vo({formats:J$,defaultWidth:"full"}),time:Vo({formats:X$,defaultWidth:"full"}),dateTime:Vo({formats:Q$,defaultWidth:"full"})},eC={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},tC=(t,e,n,o)=>eC[t];function Ft(t){return(e,n)=>{const o=n!=null&&n.context?String(n.context):"standalone";let r;if(o==="formatting"&&t.formattingValues){const s=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):s;r=t.formattingValues[a]||t.formattingValues[s]}else{const s=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[s]}const i=t.argumentCallback?t.argumentCallback(e):e;return r[i]}}const nC={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},oC={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rC={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},iC={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},sC={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},aC={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},lC=(t,e)=>{const n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},uC={ordinalNumber:lC,era:Ft({values:nC,defaultWidth:"wide"}),quarter:Ft({values:oC,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ft({values:rC,defaultWidth:"wide"}),day:Ft({values:iC,defaultWidth:"wide"}),dayPeriod:Ft({values:sC,defaultWidth:"wide",formattingValues:aC,defaultFormattingWidth:"wide"})};function jt(t){return(e,n={})=>{const o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],i=e.match(r);if(!i)return null;const s=i[0],a=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?dC(a,d=>d.test(s)):cC(a,d=>d.test(s));let u;u=t.valueCallback?t.valueCallback(l):l,u=n.valueCallback?n.valueCallback(u):u;const c=e.slice(s.length);return{value:u,rest:c}}}function cC(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function dC(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Ug(t){return(e,n={})=>{const o=e.match(t.matchPattern);if(!o)return null;const r=o[0],i=e.match(t.parsePattern);if(!i)return null;let s=t.valueCallback?t.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;const a=e.slice(r.length);return{value:s,rest:a}}}const pC=/^(\d+)(th|st|nd|rd)?/i,fC=/\d+/i,hC={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},mC={any:[/^b/i,/^(a|c)/i]},gC={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vC={any:[/1/i,/2/i,/3/i,/4/i]},yC={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bC={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_C={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},wC={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},EC={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},kC={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},SC={ordinalNumber:Ug({matchPattern:pC,parsePattern:fC,valueCallback:t=>parseInt(t,10)}),era:jt({matchPatterns:hC,defaultMatchWidth:"wide",parsePatterns:mC,defaultParseWidth:"any"}),quarter:jt({matchPatterns:gC,defaultMatchWidth:"wide",parsePatterns:vC,defaultParseWidth:"any",valueCallback:t=>t+1}),month:jt({matchPatterns:yC,defaultMatchWidth:"wide",parsePatterns:bC,defaultParseWidth:"any"}),day:jt({matchPatterns:_C,defaultMatchWidth:"wide",parsePatterns:wC,defaultParseWidth:"any"}),dayPeriod:jt({matchPatterns:EC,defaultMatchWidth:"any",parsePatterns:kC,defaultParseWidth:"any"})},Fg={code:"en-US",formatDistance:Y$,formatLong:Z$,formatRelative:tC,localize:uC,match:SC,options:{weekStartsOn:0,firstWeekContainsDate:1}};function MC(t,e){const n=Ot(t,void 0);return z$(n,W$(n))+1}function TC(t,e){const n=Ot(t,void 0),o=+ea(n)-+G$(n);return Math.round(o/Ng)+1}function jg(t,e){var n,o,r,i;const s=Ot(t,e==null?void 0:e.in),a=s.getFullYear(),l=Aa(),u=(e==null?void 0:e.firstWeekContainsDate)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.firstWeekContainsDate)??l.firstWeekContainsDate??((i=(r=l.locale)==null?void 0:r.options)==null?void 0:i.firstWeekContainsDate)??1,c=yt((e==null?void 0:e.in)||t,0);c.setFullYear(a+1,0,u),c.setHours(0,0,0,0);const d=go(c,e),p=yt((e==null?void 0:e.in)||t,0);p.setFullYear(a,0,u),p.setHours(0,0,0,0);const f=go(p,e);return+s>=+d?a+1:+s>=+f?a:a-1}function IC(t,e){var n,o,r,i;const s=Aa(),a=(e==null?void 0:e.firstWeekContainsDate)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.firstWeekContainsDate)??s.firstWeekContainsDate??((i=(r=s.locale)==null?void 0:r.options)==null?void 0:i.firstWeekContainsDate)??1,l=jg(t,e),u=yt((e==null?void 0:e.in)||t,0);return u.setFullYear(l,0,a),u.setHours(0,0,0,0),go(u,e)}function xC(t,e){const n=Ot(t,e==null?void 0:e.in),o=+go(n,e)-+IC(n,e);return Math.round(o/Ng)+1}function ve(t,e){const n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}const wn={y(t,e){const n=t.getFullYear(),o=n>0?n:1-n;return ve(e==="yy"?o%100:o,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):ve(n+1,2)},d(t,e){return ve(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return ve(t.getHours()%12||12,e.length)},H(t,e){return ve(t.getHours(),e.length)},m(t,e){return ve(t.getMinutes(),e.length)},s(t,e){return ve(t.getSeconds(),e.length)},S(t,e){const n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return ve(r,e.length)}},Oo={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},jp={G:function(t,e,n){const o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});case"GGGG":default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return wn.y(t,e)},Y:function(t,e,n,o){const r=jg(t,o),i=r>0?r:1-r;if(e==="YY"){const s=i%100;return ve(s,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):ve(i,e.length)},R:function(t,e){const n=Lg(t);return ve(n,e.length)},u:function(t,e){const n=t.getFullYear();return ve(n,e.length)},Q:function(t,e,n){const o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return ve(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){const o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return ve(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){const o=t.getMonth();switch(e){case"M":case"MM":return wn.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){const o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return ve(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){const r=xC(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):ve(r,e.length)},I:function(t,e,n){const o=TC(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):ve(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):wn.d(t,e)},D:function(t,e,n){const o=MC(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):ve(o,e.length)},E:function(t,e,n){const o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});case"EEEE":default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){const r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return ve(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});case"eeee":default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){const r=t.getDay(),i=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return ve(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){const o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return ve(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});case"iiii":default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){const o=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,e,n){const o=t.getHours();let r;switch(o===12?r=Oo.noon:o===0?r=Oo.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){const o=t.getHours();let r;switch(o>=17?r=Oo.evening:o>=12?r=Oo.afternoon:o>=4?r=Oo.morning:r=Oo.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return wn.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):wn.H(t,e)},K:function(t,e,n){const o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):ve(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):ve(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):wn.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):wn.s(t,e)},S:function(t,e){return wn.S(t,e)},X:function(t,e,n){const o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return zp(o);case"XXXX":case"XX":return Xn(o);case"XXXXX":case"XXX":default:return Xn(o,":")}},x:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"x":return zp(o);case"xxxx":case"xx":return Xn(o);case"xxxxx":case"xxx":default:return Xn(o,":")}},O:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+qp(o,":");case"OOOO":default:return"GMT"+Xn(o,":")}},z:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+qp(o,":");case"zzzz":default:return"GMT"+Xn(o,":")}},t:function(t,e,n){const o=Math.trunc(+t/1e3);return ve(o,e.length)},T:function(t,e,n){return ve(+t,e.length)}};function qp(t,e=""){const n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),i=o%60;return i===0?n+String(r):n+String(r)+e+ve(i,2)}function zp(t,e){return t%60===0?(t>0?"-":"+")+ve(Math.abs(t)/60,2):Xn(t,e)}function Xn(t,e=""){const n=t>0?"-":"+",o=Math.abs(t),r=ve(Math.trunc(o/60),2),i=ve(o%60,2);return n+r+e+i}const Gp=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},qg=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},OC=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return Gp(t,e);let i;switch(o){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",Gp(o,e)).replace("{{time}}",qg(r,e))},$C={p:qg,P:OC},CC=/^D+$/,AC=/^Y+$/,RC=["D","DD","YY","YYYY"];function DC(t){return CC.test(t)}function PC(t){return AC.test(t)}function NC(t,e,n){const o=LC(t,e,n);if(console.warn(o),RC.includes(t))throw new RangeError(o)}function LC(t,e,n){const o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BC=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,UC=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,FC=/^'([^]*?)'?$/,jC=/''/g,qC=/[a-zA-Z]/;function Kn(t,e,n){var o,r,i,s,a,l,u,c;const d=Aa(),p=(n==null?void 0:n.locale)??d.locale??Fg,f=(n==null?void 0:n.firstWeekContainsDate)??((r=(o=n==null?void 0:n.locale)==null?void 0:o.options)==null?void 0:r.firstWeekContainsDate)??d.firstWeekContainsDate??((s=(i=d.locale)==null?void 0:i.options)==null?void 0:s.firstWeekContainsDate)??1,h=(n==null?void 0:n.weekStartsOn)??((l=(a=n==null?void 0:n.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((c=(u=d.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,m=Ot(t,n==null?void 0:n.in);if(!V$(m))throw new RangeError("Invalid time value");let v=e.match(UC).map(_=>{const E=_[0];if(E==="p"||E==="P"){const b=$C[E];return b(_,p.formatLong)}return _}).join("").match(BC).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const E=_[0];if(E==="'")return{isToken:!1,value:zC(_)};if(jp[E])return{isToken:!0,value:_};if(E.match(qC))throw new RangeError("Format string contains an unescaped latin alphabet character `"+E+"`");return{isToken:!1,value:_}});p.localize.preprocessor&&(v=p.localize.preprocessor(m,v));const y={firstWeekContainsDate:f,weekStartsOn:h,locale:p};return v.map(_=>{if(!_.isToken)return _.value;const E=_.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&PC(E)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&DC(E))&&NC(E,e,String(t));const b=jp[E[0]];return b(m,E,p.localize,y)}).join("")}function zC(t){const e=t.match(FC);return e?e[1].replace(jC,"'"):t}function zg(t,e,n){const[o,r]=Ra(n==null?void 0:n.in,t,e);return+go(o,n)==+go(r,n)}function GC(t,e,n){const[o,r]=Ra(void 0,t,e);return o.getFullYear()===r.getFullYear()}function HC(t,e){return GC(yt(t,t),Tc(t))}function VC(t,e){return Bg(yt(t,t),Tc(t))}function WC(t,e,n){return j$(t,-1)}function KC(t,e){return Bg(yt(t,t),WC(Tc(t)))}const YC={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},JC=(t,e,n)=>{let o;const r=YC[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",String(e)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?o+"内":o+"前":o},XC={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},QC={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},ZC={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},eA={date:Vo({formats:XC,defaultWidth:"full"}),time:Vo({formats:QC,defaultWidth:"full"}),dateTime:Vo({formats:ZC,defaultWidth:"full"})};function Hp(t,e,n){const o="eeee p";return zg(t,e,n)?o:t.getTime()>e.getTime()?"'下个'"+o:"'上个'"+o}const tA={lastWeek:Hp,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Hp,other:"PP p"},nA=(t,e,n,o)=>{const r=tA[t];return typeof r=="function"?r(e,n,o):r},oA={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},rA={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},iA={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},sA={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},aA={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},lA={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},uA=(t,e)=>{const n=Number(t);switch(e==null?void 0:e.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},cA={ordinalNumber:uA,era:Ft({values:oA,defaultWidth:"wide"}),quarter:Ft({values:rA,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ft({values:iA,defaultWidth:"wide"}),day:Ft({values:sA,defaultWidth:"wide"}),dayPeriod:Ft({values:aA,defaultWidth:"wide",formattingValues:lA,defaultFormattingWidth:"wide"})},dA=/^(第\s*)?\d+(日|时|分|秒)?/i,pA=/\d+/i,fA={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},hA={any:[/^(前)/i,/^(公元)/i]},mA={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},gA={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},vA={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},yA={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},bA={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},_A={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},wA={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},EA={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},kA={ordinalNumber:Ug({matchPattern:dA,parsePattern:pA,valueCallback:t=>parseInt(t,10)}),era:jt({matchPatterns:fA,defaultMatchWidth:"wide",parsePatterns:hA,defaultParseWidth:"any"}),quarter:jt({matchPatterns:mA,defaultMatchWidth:"wide",parsePatterns:gA,defaultParseWidth:"any",valueCallback:t=>t+1}),month:jt({matchPatterns:vA,defaultMatchWidth:"wide",parsePatterns:yA,defaultParseWidth:"any"}),day:jt({matchPatterns:bA,defaultMatchWidth:"wide",parsePatterns:_A,defaultParseWidth:"any"}),dayPeriod:jt({matchPatterns:wA,defaultMatchWidth:"any",parsePatterns:EA,defaultParseWidth:"any"})},SA={code:"zh-CN",formatDistance:JC,formatLong:eA,formatRelative:nA,localize:cA,match:kA,options:{weekStartsOn:1,firstWeekContainsDate:4}};function MA({time:t,language:e="en-US"}){const{t:n}=Ee(),o={"zh-CN":SA,"en-US":Fg},r="HH:mm",i=o[e]||o["en-US"],s=n("MessageList.yesterday",{defaultValue:"Yesterday"});return t?VC(t)?Kn(t,r,{locale:i}):KC(t)?`${s} ${Kn(t,r,{locale:i})}`:zg(t,new Date,{weekStartsOn:1})?`${Kn(t,"EEEE",{locale:i})} ${Kn(t,r)}`:HC(t)?e.startsWith("zh")?Kn(t,"M月d日 HH:mm",{locale:i}):Kn(t,"MMMM d HH:mm",{locale:i}):Kn(t,"yyyy/MM/dd HH:mm",{locale:i}):""}function Gg(t){const{language:e}=Ee();return MA({time:t,language:e.value})}const TA={administrator:"Administrator",enabled_mute_all_members:"enabled mute all members",disabled_mute_all_members:"disabled mute all members",became_new_group_owner:"became the new group owner",changed_group_name_to:"changed group name to",published_new_announcement:"published new group notification",joined_group:"joined the group",group_member:"Group member",left_group:"left the group",was:"was",kicked_out_of_group:"kicked out of the group",became_admin:"became admin",admin_privileges_revoked:"admin privileges revoked",was_muted:"was muted",was_unmuted:"was unmuted",group_tip_message:"Group tip message",download_failed:"Download failed",create_group:"Create Group",unread:"Unread",all_read:"All Read",read:"Read",you:"You",recalled_a_message:"recalled a message",reedit:"Re-edit",origin_message_has_been_recalled:"Original message has been recalled",forward:"Forward",copy:"Copy",recall:"Recall",quote:"Quote",delete:"Delete",max_count_exceed:"Max Count Exceed",read_receipt_detail:"Read Receipt Detail",read_count:"Read Count",unread_count:"Unread Count",loading:"Loading",no_read_members:"No Read Members",no_more:"No More",no_unread_members:"No Unread Members",yesterday:"Yesterday",copy_success:"Copied",copy_failed:"Copy Failed",recall_success:"Message recalled",recall_failed:"Recall Failed",recall_time_limit_exceeded:"Recall time limit exceeded",delete_success:"Deleted",delete_failed:"Delete Failed"},IA={start_call:"{{messageSender}} start call",call_ended:"Call ended",call_duration:"Call duration",switch_to_audio_call:"Switch to audio call",switch_to_video_call:"Switch to video call",cancel_call:"Cancel call",canceled:"Canceled",canceled_by_recipient:"Call canceled by caller",answered:"Answered",decline_call:"Decline call",declined:"Declined",line_busy:"Line busy",missed_due_to_busy:"Missed due to busy line",declined_by_recipient:"Call declined by user",no_answer:"No answer",no_answer_from_recipient:"Call wasn't answered",no_answer_timeout:"Call not answered (timeout)"},xA={"[TUIEmoji_Smile]":"[Smile]","[TUIEmoji_Expect]":"[Expect]","[TUIEmoji_Blink]":"[Blink]","[TUIEmoji_Guffaw]":"[Guffaw]","[TUIEmoji_KindSmile]":"[KindSmile]","[TUIEmoji_Haha]":"[Haha]","[TUIEmoji_Cheerful]":"[Cheerful]","[TUIEmoji_Speechless]":"[Speechless]","[TUIEmoji_Amazed]":"[Amazed]","[TUIEmoji_Sorrow]":"[Sorrow]","[TUIEmoji_Complacent]":"[Complacent]","[TUIEmoji_Silly]":"[Silly]","[TUIEmoji_Lustful]":"[Lustful]","[TUIEmoji_Giggle]":"[Giggle]","[TUIEmoji_Kiss]":"[Kiss]","[TUIEmoji_Wail]":"[Wail]","[TUIEmoji_TearsLaugh]":"[TearsLaugh]","[TUIEmoji_Trapped]":"[Trapped]","[TUIEmoji_Mask]":"[Mask]","[TUIEmoji_Fear]":"[Fear]","[TUIEmoji_BareTeeth]":"[BareTeeth]","[TUIEmoji_FlareUp]":"[FlareUp]","[TUIEmoji_Yawn]":"[Yawn]","[TUIEmoji_Tact]":"[Tact]","[TUIEmoji_Stareyes]":"[StarEyes]","[TUIEmoji_ShutUp]":"[ShutUp]","[TUIEmoji_Sigh]":"[Sigh]","[TUIEmoji_Hehe]":"[Hehe]","[TUIEmoji_Silent]":"[Silent]","[TUIEmoji_Surprised]":"[Surprised]","[TUIEmoji_Askance]":"[Askance]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[Shit]","[TUIEmoji_Monster]":"[Monster]","[TUIEmoji_Daemon]":"[Daemon]","[TUIEmoji_Rage]":"[Rage]","[TUIEmoji_Fool]":"[Fool]","[TUIEmoji_Pig]":"[Pig]","[TUIEmoji_Cow]":"[Cow]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[Skull]","[TUIEmoji_Bombs]":"[Bombs]","[TUIEmoji_Coffee]":"[Coffee]","[TUIEmoji_Cake]":"[Cake]","[TUIEmoji_Beer]":"[Beer]","[TUIEmoji_Flower]":"[Flower]","[TUIEmoji_Watermelon]":"[Watermelon]","[TUIEmoji_Rich]":"[Rich]","[TUIEmoji_Heart]":"[Heart]","[TUIEmoji_Moon]":"[Moon]","[TUIEmoji_Sun]":"[Sun]","[TUIEmoji_Star]":"[Star]","[TUIEmoji_RedPacket]":"[RedPacket]","[TUIEmoji_Celebrate]":"[Celebrate]","[TUIEmoji_Bless]":"[Bless]","[TUIEmoji_Fortune]":"[Fortune]","[TUIEmoji_Convinced]":"[Convinced]","[TUIEmoji_Prohibit]":"[Prohibit]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[Knife]","[TUIEmoji_Like]":"[Like]"},OA={administrator:"管理员",enabled_mute_all_members:"开启全员禁言",disabled_mute_all_members:"取消全员禁言",became_new_group_owner:"成为新的群主",changed_group_name_to:"修改群名为",published_new_announcement:"发布新公告",joined_group:"加入群组",group_member:"群成员",left_group:"退出群组",was:"被",kicked_out_of_group:"踢出群组",became_admin:"成为管理员",admin_privileges_revoked:"被撤销管理员",was_muted:"被禁言",was_unmuted:"被取消禁言",group_tip_message:"群提示消息",download_failed:"下载失败",create_group:"创建群组",unread:"未读",all_read:"全部已读",read:"已读",you:"你",recalled_a_message:"撤回了一条消息",reedit:"重新编辑",origin_message_has_been_recalled:"原消息已被撤回",forward:"转发",copy:"复制",recall:"撤回",quote:"引用",delete:"删除",max_count_exceed:"超过最大数量限制",read_receipt_detail:"已读详情",read_count:"已读人数",unread_count:"未读人数",loading:"加载中",no_read_members:"暂无已读成员",no_more:"已加载全部",no_unread_members:"暂无未读成员",yesterday:"昨天",copy_success:"已复制",copy_failed:"复制失败",recall_success:"消息已撤回",recall_failed:"撤回失败",recall_time_limit_exceeded:"撤回时间限制已过期",delete_success:"删除成功",delete_failed:"删除失败"},$A={start_call:"{{messageSender}} 发起通话",call_ended:"通话结束",call_duration:"通话时长",switch_to_audio_call:"切换语音通话",switch_to_video_call:"切换视频通话",cancel_call:"取消通话",canceled:"已取消",canceled_by_recipient:"对方已取消",answered:"已接听",decline_call:"拒绝通话",declined:"已拒绝",line_busy:"对方忙线中",missed_due_to_busy:"忙线未接听",declined_by_recipient:"对方已拒绝",no_answer:"无应答",no_answer_from_recipient:"对方无应答",no_answer_timeout:"超时无应答"},CA={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},Hg={"en-US":{MessageList:TA,CallMessage:IA,Emoji:xA},"zh-CN":{MessageList:OA,CallMessage:$A,Emoji:CA}},Vg=Symbol("MessageListContext");function AA(t){const e=hu(Vg,null);if(e===null)throw new Error(`<${t}> must be used within Parent MessageList.`);return e}const RA="menu.itemSelect",DA=["Enter"," "],PA=["ArrowDown","PageUp","Home"],Wg=["ArrowUp","PageDown","End"],NA=[...PA,...Wg];function Kg(t){return t?"open":"closed"}function LA(t){const e=Le();for(const n of t)if(n===e||(n.focus(),Le()!==e))return}function BA(t,e){const{x:n,y:o}=t;let r=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){const a=e[i].x,l=e[i].y,u=e[s].x,c=e[s].y;l>o!=c>o&&n<(u-a)*(o-l)/(c-l)+a&&(r=!r)}return r}function UA(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return BA(n,e)}function na(t){return t.pointerType==="mouse"}const[hr,FA]=Xt("DialogRoot");var jA=G({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=sa(n,"open",e,{defaultValue:n.defaultOpen,passive:n.open===void 0}),r=x(),i=x(),{modal:s}=Ht(n);return FA({open:o,modal:s,openModal:()=>{o.value=!0},onOpenChange:a=>{o.value=a},onOpenToggle:()=>{o.value=!o.value},contentId:"",titleId:"",descriptionId:"",triggerElement:r,contentElement:i}),(a,l)=>J(a.$slots,"default",{open:g(o),close:()=>o.value=!1})}}),qA=jA,zA=G({__name:"DialogContentImpl",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=hr(),{forwardRef:i,currentElement:s}=ke();return r.titleId||(r.titleId=xs(void 0,"reka-dialog-title")),r.descriptionId||(r.descriptionId=xs(void 0,"reka-dialog-description")),tt(()=>{r.contentElement=s,Le()!==document.body&&(r.triggerElement.value=Le())}),(a,l)=>(w(),L(g(Mu),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:l[5]||(l[5]=u=>o("openAutoFocus",u)),onUnmountAutoFocus:l[6]||(l[6]=u=>o("closeAutoFocus",u))},{default:A(()=>[q(g(Su),ye({id:g(r).contentId,ref:g(i),as:a.as,"as-child":a.asChild,"disable-outside-pointer-events":a.disableOutsidePointerEvents,role:"dialog","aria-describedby":g(r).descriptionId,"aria-labelledby":g(r).titleId,"data-state":g(Kg)(g(r).open.value)},a.$attrs,{onDismiss:l[0]||(l[0]=u=>g(r).onOpenChange(!1)),onEscapeKeyDown:l[1]||(l[1]=u=>o("escapeKeyDown",u)),onFocusOutside:l[2]||(l[2]=u=>o("focusOutside",u)),onInteractOutside:l[3]||(l[3]=u=>o("interactOutside",u)),onPointerDownOutside:l[4]||(l[4]=u=>o("pointerDownOutside",u))}),{default:A(()=>[J(a.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),Yg=zA,GA=G({__name:"DialogContentModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=hr(),i=_i(o),{forwardRef:s,currentElement:a}=ke();return ku(a),(l,u)=>(w(),L(Yg,ye({...n,...g(i)},{ref:g(s),"trap-focus":g(r).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=c=>{var d;c.defaultPrevented||(c.preventDefault(),(d=g(r).triggerElement.value)==null||d.focus())}),onPointerDownOutside:u[1]||(u[1]=c=>{const d=c.detail.originalEvent,p=d.button===0&&d.ctrlKey===!0;(d.button===2||p)&&c.preventDefault()}),onFocusOutside:u[2]||(u[2]=c=>{c.preventDefault()})}),{default:A(()=>[J(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),HA=GA,VA=G({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=_i(e);ke();const r=hr(),i=x(!1),s=x(!1);return(a,l)=>(w(),L(Yg,ye({...n,...g(o)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:l[0]||(l[0]=u=>{var c;u.defaultPrevented||(i.value||(c=g(r).triggerElement.value)==null||c.focus(),u.preventDefault()),i.value=!1,s.value=!1}),onInteractOutside:l[1]||(l[1]=u=>{var c;u.defaultPrevented||(i.value=!0,u.detail.originalEvent.type==="pointerdown"&&(s.value=!0));const d=u.target;(c=g(r).triggerElement.value)!=null&&c.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.value&&u.preventDefault()})}),{default:A(()=>[J(a.$slots,"default")]),_:3},16))}}),WA=VA,KA=G({__name:"DialogContent",props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=hr(),i=_i(o),{forwardRef:s}=ke();return(a,l)=>(w(),L(g(aa),{present:a.forceMount||g(r).open.value},{default:A(()=>[g(r).modal.value?(w(),L(HA,ye({key:0,ref:g(s)},{...n,...g(i),...a.$attrs}),{default:A(()=>[J(a.$slots,"default")]),_:3},16)):(w(),L(WA,ye({key:1,ref:g(s)},{...n,...g(i),...a.$attrs}),{default:A(()=>[J(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),YA=KA,JA=G({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=hr();return Eu(!0),ke(),(n,o)=>(w(),L(g(Vt),{as:n.as,"as-child":n.asChild,"data-state":g(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:A(()=>[J(n.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),XA=JA,QA=G({__name:"DialogOverlay",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=hr(),{forwardRef:n}=ke();return(o,r)=>{var i;return(i=g(e))!=null&&i.modal.value?(w(),L(g(aa),{key:0,present:o.forceMount||g(e).open.value},{default:A(()=>[q(XA,ye(o.$attrs,{ref:g(n),as:o.as,"as-child":o.asChild}),{default:A(()=>[J(o.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):ne("v-if",!0)}}}),ZA=QA,eR=G({__name:"DialogPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(w(),L(g(Tu),ln(vo(e)),{default:A(()=>[J(n.$slots,"default")]),_:3},16))}}),tR=eR;const nR=G({__name:"Modal",props:{open:{type:Boolean,default:!1},closeOnOverlay:{type:Boolean,default:!0},contentClass:{default:""}},emits:["onClose"],setup(t,{emit:e}){const n=e,o=i=>{n("onClose",i)},r=i=>{i||o("escape")};return(i,s)=>(w(),L(g(qA),{open:t.open,"onUpdate:open":r},{default:A(()=>[q(g(tR),{to:"body"},{default:A(()=>[q(g(ZA),{class:"modal-overlay",onClick:s[0]||(s[0]=a=>t.closeOnOverlay&&o("overlay"))}),q(g(YA),{class:F(["modal-content",t.contentClass])},{default:A(()=>[J(i.$slots,"default",{},void 0,!0)]),_:3},8,["class"])]),_:3})]),_:3},8,["open"]))}}),Jg=se(nR,[["__scopeId","data-v-1d8533fb"]]),oR=G({__name:"ReadReceiptInfo",props:{messageID:{default:""},open:{type:Boolean,default:!1},readCount:{default:0},unreadCount:{default:0},className:{default:void 0},style:{default:void 0}},emits:["onClose"],setup(t,{emit:e}){const n=t,o=e,{t:r}=Ee(),i=x("read"),s=x(),a=x(),l=x([]),u=x(""),c=x(!1),d=x(!1),p=x(!1),f=x([]),h=x(""),m=x(!1),v=x(!1),y=x(!1),_=P(()=>{if(!n.messageID)throw new Error("ReadReceiptInfo::Message ID is required");return $e.getMessageModel(n.messageID)}),E=async(O="")=>{const B=_.value;if(B){O===""&&(c.value=!1),d.value=!0;try{const $=await ot.getGroupMessageReadMemberList({message:B,filter:0,cursor:O,count:100});if($.code===0&&$.data){const{isCompleted:R,cursor:D,readUserInfoList:C=[]}=$.data;u.value=D,c.value=R,O===""?l.value=C:l.value=[...l.value,...C]}}catch($){console.error("Failed to load read users:",$)}finally{d.value=!1}}},b=async(O="")=>{const B=_.value;if(B){O===""&&(m.value=!1),v.value=!0;try{const $=await ot.getGroupMessageReadMemberList({message:B,filter:1,cursor:O,count:50});if($.code===0&&$.data){const{isCompleted:R,cursor:D,unreadUserInfoList:C=[]}=$.data;h.value=D,m.value=R,O===""?f.value=C:f.value=[...f.value,...C]}}catch($){console.error("Failed to load unread users:",$)}finally{v.value=!1}}},N=()=>{l.value=[],u.value="",c.value=!1,p.value=!1},S=()=>{f.value=[],h.value="",m.value=!1,y.value=!1},M=O=>{i.value=O},T=O=>{const B=O.target,{scrollTop:$,scrollHeight:R,clientHeight:D}=B;R-$-D<50&&(i.value==="read"&&!c.value&&!d.value&&u.value?E(u.value):i.value==="unread"&&!m.value&&!v.value&&h.value&&b(h.value))},I=(O,B)=>{o("onClose",O,B)};return le(()=>n.open,O=>{O&&(N(),S(),E(),b())}),le([()=>n.readCount,()=>n.unreadCount],()=>{n.open&&n.messageID&&(i.value==="read"?E():b())}),le(()=>[l.value.length,d.value],()=>{let O;return l.value.length>0&&!d.value&&(O=setTimeout(()=>{p.value=!0},50)),()=>clearTimeout(O)}),le(()=>[f.value.length,v.value],()=>{let O;return f.value.length>0&&!v.value&&(O=setTimeout(()=>{y.value=!0},50)),()=>clearTimeout(O)}),(O,B)=>(w(),L(g(Jg),{open:t.open,"content-class":"readReceiptInfo",onOnClose:I},{default:A(()=>[q(g(Q),{class:"read-receipt-info__header"},{default:A(()=>[q(g(ar),{class:"read-receipt-info__close-icon",onClick:I}),q(g(Q),{class:"read-receipt-info__title"},{default:A(()=>[me(Z(g(r)("MessageList.read_receipt_detail")),1)]),_:1})]),_:1}),q(g(Q),{class:"read-receipt-info__tabs"},{default:A(()=>[V("button",{class:F(["read-receipt-info__tab-button",{"read-receipt-info__tab-button--active":i.value==="read"}]),onClick:B[0]||(B[0]=$=>M("read"))},Z(g(r)("MessageList.read"))+" ("+Z(t.readCount)+") ",3),V("button",{class:F(["read-receipt-info__tab-button",{"read-receipt-info__tab-button--active":i.value==="unread"}]),onClick:B[1]||(B[1]=$=>M("unread"))},Z(g(r)("MessageList.unread"))+" ("+Z(t.unreadCount)+") ",3)]),_:1}),q(g(Q),{class:"read-receipt-info__content"},{default:A(()=>[i.value==="read"?(w(),L(g(Q),{key:0,ref_key:"readListRef",ref:s,class:"read-receipt-info__user-list",onScroll:T},{default:A(()=>[l.value.length===0?(w(),z(he,{key:0},[d.value?(w(),L(g(Q),{key:0,class:"read-receipt-info__loading"},{default:A(()=>[q(g(Fo),{class:"read-receipt-info__loading-icon"}),q(g(Q),{class:"read-receipt-info__loading-text"},{default:A(()=>[me(Z(g(r)("MessageList.loading")),1)]),_:1})]),_:1})):(w(),L(g(Q),{key:1,class:"read-receipt-info__empty"},{default:A(()=>[me(Z(g(r)("MessageList.no_read_members")),1)]),_:1}))],64)):(w(),z("div",{key:1,class:F(["read-receipt-info__user-list-container",{"read-receipt-info__user-list-container--visible":p.value}])},[(w(!0),z(he,null,ze(l.value,$=>(w(),L(g(Q),{key:$.userID,class:"read-receipt-info__user-item"},{default:A(()=>[q(g(Ko),{src:$.avatar??"",alt:$.nick||$.userID},null,8,["src","alt"]),q(g(Q),{class:"read-receipt-info__user-item-info"},{default:A(()=>[q(g(Q),{class:"read-receipt-info__user-item-name"},{default:A(()=>[me(Z($.nick||$.userID),1)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),d.value?(w(),L(g(Q),{key:0,class:"read-receipt-info__loading"},{default:A(()=>[q(g(Fo),{class:"read-receipt-info__loading-icon"}),q(g(Q),{class:"read-receipt-info__loading-text"},{default:A(()=>[me(Z(g(r)("MessageList.loading")),1)]),_:1})]),_:1})):ne("",!0),c.value?(w(),L(g(Q),{key:1,class:"read-receipt-info__list-end"},{default:A(()=>[me(Z(g(r)("MessageList.no_more")),1)]),_:1})):ne("",!0)],2))]),_:1},512)):ne("",!0),i.value==="unread"?(w(),L(g(Q),{key:1,ref_key:"unreadListRef",ref:a,class:"read-receipt-info__user-list",onScroll:T},{default:A(()=>[f.value.length===0?(w(),z(he,{key:0},[v.value?(w(),L(g(Q),{key:0,class:"read-receipt-info__loading"},{default:A(()=>[q(g(Fo),{class:"read-receipt-info__loading-icon"}),q(g(Q),{class:"read-receipt-info__loading-text"},{default:A(()=>[me(Z(g(r)("MessageList.loading")),1)]),_:1})]),_:1})):(w(),L(g(Q),{key:1,class:"read-receipt-info__empty"},{default:A(()=>[me(Z(g(r)("MessageList.no_unread_members")),1)]),_:1}))],64)):(w(),z("div",{key:1,class:F(["read-receipt-info__user-list-container",{"read-receipt-info__user-list-container--visible":y.value}])},[(w(!0),z(he,null,ze(f.value,$=>(w(),L(g(Q),{key:$.userID,class:"read-receipt-info__user-item"},{default:A(()=>[q(g(Ko),{src:$.avatar??"",alt:$.nick||$.userID},null,8,["src","alt"]),q(g(Q),{class:"read-receipt-info__user-item-info"},{default:A(()=>[q(g(Q),{class:"read-receipt-info__user-item-name"},{default:A(()=>[me(Z($.nick||$.userID),1)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),v.value?(w(),L(g(Q),{key:0,class:"read-receipt-info__loading"},{default:A(()=>[q(g(Fo),{class:"read-receipt-info__loading-icon"}),q(g(Q),{class:"read-receipt-info__loading-text"},{default:A(()=>[me(Z(g(r)("MessageList.loading")),1)]),_:1})]),_:1})):ne("",!0),m.value?(w(),L(g(Q),{key:1,class:"read-receipt-info__list-end"},{default:A(()=>[me(Z(g(r)("MessageList.no_more")),1)]),_:1})):ne("",!0)],2))]),_:1},512)):ne("",!0)]),_:1})]),_:1},8,["open"]))}}),rR=se(oR,[["__scopeId","data-v-ecd91a73"]]),kr=new Map,pu="AUDIO_PLAY_EVENT",iR=t=>new CustomEvent(pu,{detail:{audioId:t}});function sR(t){const{url:e}=t,n=t.audioId||`audio-${e}`,o=x(!1),r=x(0),i=x(void 0),s=x(!0),a=x(null),l=()=>{a.value&&(window.dispatchEvent(iR(n)),a.value.play(),o.value=!0)},u=()=>{a.value&&(a.value.pause(),o.value=!1)},c=()=>{a.value&&(a.value.pause(),a.value.currentTime=0,o.value=!1,r.value=0)},d=m=>{if(!a.value||i.value===void 0)return;const v=Math.max(0,Math.min(1,m));a.value.currentTime=i.value*v,r.value=v},p=()=>{!a.value||!i.value||(r.value=a.value.currentTime/i.value)},f=()=>{o.value=!1,r.value=0},h=m=>{m.detail.audioId!==n&&o.value&&u()};return tt(()=>{window.addEventListener(pu,h);let m=kr.get(n);const v=()=>{m&&(m.duration===1/0?(m.currentTime=1e101,m.ontimeupdate=()=>{m&&(i.value=m.duration,m.ontimeupdate=null,m.currentTime=0)}):i.value=m.duration,s.value=!1)},y=()=>{console.error("Audio load error:",e),s.value=!1};!m||m.src!==e?(s.value=!0,i.value=void 0,m&&(m.pause(),m.src="",m.load(),m.removeEventListener("loadedmetadata",v),m.removeEventListener("error",y),m.removeEventListener("timeupdate",p),m.removeEventListener("ended",f)),m=new Audio(e),m.addEventListener("loadedmetadata",v),m.addEventListener("error",y),m.addEventListener("timeupdate",p),m.addEventListener("ended",f),kr.set(n,m),a.value=m,o.value=!1,r.value=0):(a.value=m,m.removeEventListener("timeupdate",p),m.removeEventListener("ended",f),m.addEventListener("timeupdate",p),m.addEventListener("ended",f),m.duration&&(i.value=m.duration,s.value=!1))}),Lt(()=>{if(window.removeEventListener(pu,h),kr.has(n)){const m=kr.get(n);m.removeEventListener("timeupdate",p),m.removeEventListener("ended",f),m.pause(),m.src="",m.load(),kr.delete(n)}}),{isPlaying:o,progress:r,duration:i,isLoading:s,play:l,pause:u,stop:c,setProgress:d}}const aR={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},lR={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"play-button__play-icon"},uR=G({__name:"PlayButton",props:{isPlaying:{type:Boolean}},emits:["click"],setup(t,{emit:e}){const n=e,o=()=>{n("click")};return(r,i)=>(w(),z("button",{class:F(["play-button",{"play-button--playing":t.isPlaying}]),onClick:o},[t.isPlaying?(w(),z("svg",aR,[...i[0]||(i[0]=[V("rect",{x:"6",y:"4",width:"4",height:"16"},null,-1),V("rect",{x:"14",y:"4",width:"4",height:"16"},null,-1)])])):(w(),z("svg",lR,[...i[1]||(i[1]=[V("polygon",{points:"5 3 19 12 5 21 5 3"},null,-1)])]))],2))}}),cR=se(uR,[["__scopeId","data-v-9309cd38"]]),dR=G({__name:"WaveForm",props:{progress:{},barsCount:{default:30},width:{default:"100%"}},emits:["seek"],setup(t,{emit:e}){const n=t,o=e,r=P(()=>({width:typeof n.width=="number"?`${n.width}px`:n.width})),i=Array.from({length:n.barsCount},()=>Math.random()*16+4),s=P(()=>{const l=n.progress||0;return l===0?Array(n.barsCount).fill(!1):Array.from({length:n.barsCount},(u,c)=>{const d=c/n.barsCount;return l>=d})}),a=l=>{const u=l.currentTarget.getBoundingClientRect(),c=(l.clientX-u.left)/u.width,d=Math.max(0,Math.min(1,c));o("seek",d)};return(l,u)=>(w(),z("div",{class:"wave-form",style:Mt(r.value),onClick:a},[(w(!0),z(he,null,ze(g(i),(c,d)=>(w(),z("div",{key:d,class:F(["wave-form__bar",{"wave-form__bar--active":s.value[d]}]),style:Mt({height:`${c}px`})},null,6))),128))],4))}}),pR=se(dR,[["__scopeId","data-v-93c67ced"]]),fR=G({__name:"AudioMessage",props:{message:{}},setup(t){const e=t,n=P(()=>e.message.getMessageContent()),o=P(()=>{const d=n.value.second;return d<=5?10:d<=10?14:18}),r=P(()=>`audio-${e.message.ID}`),{isPlaying:i,progress:s,play:a,pause:l,setProgress:u}=sR({url:n.value.url,audioId:r.value}),c=d=>{const p=Math.floor(d/60),f=Math.floor(d%60);return`${p.toString().padStart(2,"0")}:${f.toString().padStart(2,"0")}`};return(d,p)=>(w(),L(g(Q),{class:"audio-message"},{default:A(()=>[q(g(Q),{class:"audio-message__content"},{default:A(()=>[q(cR,{"is-playing":g(i),onClick:p[0]||(p[0]=f=>g(i)?g(l)():g(a)())},null,8,["is-playing"]),q(pR,{progress:g(s),"bars-count":o.value,onSeek:g(u)},null,8,["progress","bars-count","onSeek"]),q(g(Q),{class:"audio-message__duration"},{default:A(()=>[me(Z(c(n.value.second)),1)]),_:1})]),_:1})]),_:1}))}}),hR=se(fR,[["__scopeId","data-v-b2418d6b"]]),mR=G({__name:"CallMessage",props:{message:{}},setup(t){const e=t,{t:n}=Ee(),o=Jt(),{activeConversation:r}=Bn(),i=P(()=>Cg(e.message,n)),s=P(()=>$g(e.message)),a=()=>{var l;!r.value||!s.value||e.message.conversationType===Ne.GROUP||gi({type:s.value.data.data.call_type,userIDList:[(l=r.value.userProfile)==null?void 0:l.userID]})};return(l,u)=>e.message.conversationType===g(Ne).C2C?(w(),L(g(Q),{key:0,gap:8,dir:"row",class:F(g(o)["call-message-c2c"]),onClick:a},{default:A(()=>{var c;return[((c=s.value)==null?void 0:c.data.data.call_type)===1?(w(),L(g(Sv),{key:0,class:F(g(o)["call-message-c2c__icon"])},null,8,["class"])):(w(),L(g(Mv),{key:1,class:F(g(o)["call-message-c2c__icon"])},null,8,["class"])),me(" "+Z(i.value),1)]}),_:1},8,["class"])):(w(),L(g(Q),{key:1,class:F(g(o)["call-message-group"])},{default:A(()=>[me(Z(i.value),1)]),_:1},8,["class"]))}}),gR={"call-message-c2c":"_call-message-c2c_u2zzk_1","call-message-c2c__icon":"_call-message-c2c__icon_u2zzk_7","call-message-group":"_call-message-group_u2zzk_11"},vR={$style:gR},yR=se(mR,[["__cssModules",vR]]),bR=["href"],_R=G({__name:"CustomMessage",props:{message:{}},setup(t){const e=t,n=Jt(),o=P(()=>An(e.message)),r=P(()=>{try{const i=e.message.payload,s=JSON.parse((i==null?void 0:i.data)||"{}");if((s==null?void 0:s.businessID)==="text_link"){const{text:a,link:l}=s;return{text:a,link:l}}return null}catch{return null}});return(i,s)=>o.value?(w(),L(g(yR),{key:0,message:e.message,class:F(g(n)["custom-message"])},null,8,["message","class"])):r.value?(w(),L(g(Q),{key:1,class:F(g(n)["custom-message"])},{default:A(()=>[V("div",null,Z(r.value.text),1),V("a",{href:r.value.link},"read more >>>",8,bR)]),_:1},8,["class"])):(w(),z("div",{key:2,class:F(g(n)["custom-message"])}," [custom message] ",2))}}),wR={"custom-message":"_custom-message_a7uj7_1"},ER={$style:wR},kR=se(_R,[["__cssModules",ER]]),SR=["src","alt"],MR=G({__name:"FaceMessage",props:{message:{default:()=>({})}},setup(t){const e={url:"https://web.sdk.qcloud.com/im/assets/face-elem/yz13@2x.png",name:"yz13@2x"};return(n,o)=>(w(),z("div",{class:F(g(pe)("face-message"))},[V("img",{src:e.url,alt:e.name},null,8,SR)],2))}}),TR=se(MR,[["__scopeId","data-v-eb892ba9"]]),IR=G({__name:"FileMessage",props:{message:{default:()=>({})}},setup(t){const{t:e}=Ee(),n=t,o=P(()=>n.message.getMessageContent()),r=async i=>{if(i.metaKey||i.ctrlKey)window.open(o.value.url,"_blank");else try{i.preventDefault();const s=await fetch(o.value.url);if(!s.ok)throw new Error("Download failed");const a=await s.blob(),l=window.URL.createObjectURL(a),u=document.createElement("a");u.href=l,u.download=o.value.name,u.click(),window.URL.revokeObjectURL(l)}catch{Bt.error({message:e("MessageList.download_failed")})}};return(i,s)=>(w(),L(g(Q),{class:F(g(pe)("file-message")),onClick:r},{default:A(()=>[q(g(Q),{class:"file-message__icon"},{default:A(()=>[q(g(tf))]),_:1}),q(g(Q),{class:"file-message__middle"},{default:A(()=>[q(g(Q),{class:"file-message__name"},{default:A(()=>[me(Z(o.value.name),1)]),_:1}),q(g(Q),{class:"file-message__size"},{default:A(()=>[me(Z(o.value.size),1)]),_:1})]),_:1}),q(g(Q),{class:"file-message__download"},{default:A(()=>[q(g(Tv))]),_:1})]),_:1},8,["class"]))}}),xR=se(IR,[["__scopeId","data-v-10a5779a"]]),Vp=G({__name:"GroupTipMessage",props:{message:{}},setup(t){const e=t,{t:n}=Ee(),o=e.message.getMessageContent(),r=P(()=>o.businessID==="group_create"?`${o.showName||""} ${n("MessageList.create_group")}`:An(e.message)&&e.message.conversationType===Ne.GROUP?Cg(e.message,n):U$(e.message).text);return(i,s)=>(w(),z("div",{class:F(g(pe)("group-tip-message"))},Z(r.value),3))}}),OR={class:"image-preview__content"},$R={class:"image-preview__inner"},CR={class:"image-preview__viewport"},AR=["src","alt"],RR={key:1,class:"image-preview__error"},DR=.5,PR=3,NR=G({inheritAttrs:!1,__name:"ImagePreview",props:{open:{type:Boolean},src:{},alt:{}},emits:["close"],setup(t,{emit:e}){const n=t,o=e,r=x(1),i=x({x:0,y:0}),s=x(!1),a=x({x:0,y:0}),l=x(!1);let u=null,c=1;function d(I){return Math.min(PR,Math.max(DR,I))}function p(){r.value=1,i.value={x:0,y:0}}function f(){o("close"),p()}function h(){l.value=!0}function m(I){I.preventDefault();const O=I.deltaY>0?-.2:.2,B=d(r.value+O);r.value=B}function v(){r.value=r.value===1?2:1,r.value===1&&(i.value={x:0,y:0})}function y(I){var O;s.value=!0,a.value={x:I.clientX,y:I.clientY},(O=I.target)==null||O.setPointerCapture(I.pointerId)}function _(I){if(!s.value)return;const O=I.clientX-a.value.x,B=I.clientY-a.value.y;i.value={x:i.value.x+O,y:i.value.y+B},a.value={x:I.clientX,y:I.clientY}}function E(I){var O;s.value=!1,(O=I.target)==null||O.releasePointerCapture(I.pointerId)}function b(I){if(I.length<2)return null;const[O,B]=[I[0],I[1]],$=O.clientX-B.clientX,R=O.clientY-B.clientY;return Math.hypot($,R)}function N(I){I.touches.length===2&&(u=b(I.touches),c=r.value)}function S(I){if(I.touches.length===2&&u){I.preventDefault();const O=b(I.touches);if(!O)return;const B=O/u;r.value=d(c*B)}}function M(){u=null}function T(I){I.key==="Escape"&&f()}return le(()=>n.open,I=>{I||(p(),l.value=!1)}),tt(()=>{window.addEventListener("keydown",T)}),Lt(()=>{window.removeEventListener("keydown",T)}),(I,O)=>(w(),L(fu,{to:"body"},[t.open?(w(),z("div",ye({key:0,class:"image-preview"},I.$attrs),[V("div",{class:"image-preview__mask",onClick:f}),V("button",{class:"image-preview__close",type:"button","aria-label":"Close preview",onClick:f}),V("div",OR,[V("div",$R,[V("div",CR,[V("div",{class:F(g(pe)("image-preview__img-wrap",{"image-preview__img-wrap--error":l.value}))},[l.value?(w(),z("div",RR,[...O[0]||(O[0]=[V("div",{class:"image-preview__error-icon"},null,-1),V("span",{class:"image-preview__error-text"},"Preview failed",-1)])])):(w(),z("img",{key:0,src:t.src,alt:t.alt||"image preview",style:Mt({transform:`translate3d(${i.value.x}px, ${i.value.y}px, 0) scale(${r.value})`}),class:"image-preview__img",draggable:"false",onError:h,onWheel:oo(m,["prevent"]),onDblclick:oo(v,["prevent"]),onPointerdown:y,onPointermove:_,onPointerup:E,onPointercancel:E,onTouchstartPassive:N,onTouchmove:oo(S,["prevent"]),onTouchend:M,onTouchcancel:M},null,44,AR))],2)])])])],16)):ne("",!0)]))}}),LR=se(NR,[["__scopeId","data-v-31cf7b43"]]),BR={key:0,class:"image-placeholder"},UR={key:1,class:"image-error"},FR=["alt"],cs=320,Wp=50,yl=4/3,jR=G({inheritAttrs:!1,__name:"ImageMessage",props:{message:{},isLastMessage:{type:Boolean,default:!1}},setup(t){const e=t,n=P(()=>e.message.getMessageContent()),o=S=>{if(S.startsWith("blob:"))return"loading";const M=new Image;return M.src=S,M.complete&&M.naturalWidth>0?"loaded":"loading"},r=x(o(n.value.url)),i=x(n.value.width&&n.value.height?{width:n.value.width,height:n.value.height,aspectRatio:n.value.width/n.value.height}:null),s=x(null),a=x(null);let l=null;const u=x(!1);let c=null;const d=P(()=>n.value.url.startsWith("blob")),p=S=>new Promise((M,T)=>{const I=new Image;I.onload=()=>{M({width:I.naturalWidth,height:I.naturalHeight})},I.onerror=T,I.src=S}),f=P(()=>{if(!i.value)return{height:cs,width:cs*yl,aspectRatio:yl};const{width:S,height:M,aspectRatio:T}=i.value;let I=S,O=M;return O>cs&&(O=cs,I=O*T),O<Wp&&(O=Wp,I=O*T),{width:I,height:O,aspectRatio:T}}),h=async()=>{if(await Te(),!!s.value){if(r.value==="loaded"){s.value.src=n.value.url;return}l=new IntersectionObserver(S=>{S[0].isIntersecting&&(s.value&&(s.value.src=n.value.url),l&&l.disconnect())},{threshold:.1}),l.observe(s.value)}},m=async()=>{if(d.value&&!i.value)try{const S=await p(n.value.url);S&&(i.value={width:S.width,height:S.height,aspectRatio:S.width/S.height})}catch{i.value={width:400,height:300,aspectRatio:yl}}},v=S=>{const M=S.target;(!i.value||d.value)&&(i.value={width:M.naturalWidth,height:M.naturalHeight,aspectRatio:M.naturalWidth/M.naturalHeight}),r.value="loaded"},y=()=>{r.value="error"};function _(){r.value==="loaded"&&n.value.url&&(u.value=!0)}function E(){u.value=!1}function b(){typeof document>"u"||(c=document.body.style.overflow,document.body.style.overflow="hidden")}function N(){typeof document>"u"||c!==null&&(document.body.style.overflow=c,c=null)}return le(()=>n.value.url,()=>{r.value=o(n.value.url),i.value=n.value.width&&n.value.height?{width:n.value.width,height:n.value.height,aspectRatio:n.value.width/n.value.height}:null,h(),m()}),le(u,S=>{S?b():N()}),tt(()=>{h(),m()}),Lt(()=>{l&&l.disconnect(),N()}),(S,M)=>(w(),z(he,null,[V("div",ye({ref_key:"containerRef",ref:a},S.$attrs,{class:g(pe)("image-message",{"image-message--loading":r.value==="loading","image-message--error":r.value==="error","image-message--loaded":r.value==="loaded"}),style:{width:`${f.value.width}px`,height:`${f.value.height}px`,aspectRatio:`${f.value.aspectRatio}`},role:"button",tabindex:"0",onClick:_}),[r.value==="loading"?(w(),z("div",BR)):ne("",!0),r.value==="error"?(w(),z("div",UR,[...M[0]||(M[0]=[V("div",{class:"image-error__icon"},null,-1),V("span",{class:"image-error__text"},"Load failed",-1)])])):(w(),z("img",{key:2,ref_key:"imageRef",ref:s,class:F(g(pe)("image",{"image--visible":r.value==="loaded"})),alt:n.value.showName||"image message",loading:"lazy",onLoad:v,onError:y},null,42,FR))],16),q(LR,{open:u.value,src:n.value.url,alt:n.value.showName||"image message preview",onClose:E},null,8,["open","src","alt"])],64))}}),qR=se(jR,[["__scopeId","data-v-6babc4a1"]]),zR={};function GR(t,e){return w(),z("div",null," [undefined location Message] ")}const HR=se(zR,[["render",GR]]),VR={};function WR(t,e){return w(),z("div",null,"undefined merger Message")}const KR=se(VR,[["render",WR]]),YR=G({__name:"RecalledMessage",props:{message:{},class:{default:void 0},style:{default:void 0}},setup(t){const e=t,{t:n}=Ee(),{setContent:o,focusEditor:r}=Un(),i=P(()=>e.message.type===ie.TEXT),s=P(()=>e.message.flow==="out"),a=P(()=>e.message.nick||e.message.from||"");function l(){const u=e.message.payload.text;o(u),r()}return(u,c)=>(w(),L(g(Q),{class:F(g(pe)("recalled-message",e.class)),style:Mt(e.style)},{default:A(()=>[s.value?(w(),z(he,{key:0},[me(Z(`${g(n)("MessageList.you")} ${g(n)("MessageList.recalled_a_message")}`)+" ",1),i.value?(w(),L(g(Q),{key:0,role:"button",class:"recalled-message__button",onClick:l},{default:A(()=>[me(Z(g(n)("MessageList.reedit")),1)]),_:1})):ne("",!0)],64)):(w(),z(he,{key:1},[me(Z(`${a.value} ${g(n)("MessageList.recalled_a_message")}`),1)],64))]),_:1},8,["class","style"]))}}),JR=se(YR,[["__scopeId","data-v-63c123ed"]]),XR=(t,e)=>{const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),r=n.top>=o.top&&n.top<=o.bottom,i=n.bottom>=o.top&&n.bottom<=o.bottom,s=n.top<=o.top&&n.bottom>=o.bottom;return r||i||s},Xg=()=>({scrollToBottom:(t={})=>new Promise(e=>{const n=document.querySelector("#messageScrollList");if(!n){e();return}const o={behavior:"instant",block:"end",...t},r=o.behavior==="instant"?"auto":o.behavior||"auto";requestAnimationFrame(()=>{if(n.scrollTo({top:n.scrollHeight,behavior:r}),r==="smooth"){const i=()=>{n.removeEventListener("scrollend",i),setTimeout(()=>{n.scrollTo({top:n.scrollHeight,behavior:"auto"}),e()},100)};"onscrollend"in window?n.addEventListener("scrollend",i):setTimeout(()=>{n.scrollTo({top:n.scrollHeight,behavior:"auto"}),e()},500)}else e()})}),scrollToMessage:(t,e={})=>new Promise((n,o)=>{const r=document.querySelector(`[data-message-id="${t}"]`),i=document.querySelector("#messageScrollList");if(!r||!i){o(new Error("Target message or scrollable container not found"));return}if(e.skipIfVisible&&XR(r,i)){n();return}const s={behavior:"smooth",block:"center",...e},a=s.behavior==="instant"?"auto":s.behavior,l=r.offsetTop;let u=l;s.block==="center"?u=l-(i.clientHeight-r.clientHeight)/2:s.block==="end"&&(u=l+r.clientHeight-i.clientHeight),u=Math.max(0,Math.min(u,i.scrollHeight-i.clientHeight)),requestAnimationFrame(()=>{if(i.scrollTo({top:u,behavior:a}),a==="smooth"){const c=()=>{i.removeEventListener("scrollend",c),n()};"onscrollend"in window?i.addEventListener("scrollend",c):setTimeout(()=>{n()},500)}else n()})})}),QR={key:0,class:"text-message__content__text"},ZR=["src","alt"],eD=G({__name:"TextMessage",props:{message:{default:()=>({})}},setup(t){const e=t,{t:n}=Ee(),{scrollToMessage:o}=Xg(),{highlightMessageIDSet:r,recalledMessageIDSet:i,highlightMessage:s}=ki(),a=P(()=>e.message.getMessageContent()),l=P(()=>{var d,p,f,h;const m=mi((d=e.message)==null?void 0:d.cloudCustomData,{}),v=((p=m==null?void 0:m.messageReply)==null?void 0:p.messageAbstract)||"",y=((f=m==null?void 0:m.messageReply)==null?void 0:f.messageSender)||"",_=((h=m==null?void 0:m.messageReply)==null?void 0:h.messageID)||"";return{content:v,sender:y,messageID:_}}),u=P(()=>i.value.has(l.value.messageID)),c=()=>{if(l.value.messageID){const{messageID:d}=l.value,p=$e.getMessageModel(d);if(u.value||!p||p.isDeleted||p.isRevoked){Bt.error({message:n("MessageList.origin_message_has_been_recalled")});return}r.value.has(d)||s({messageID:d,duration:3e3}),o(d,{block:"center",skipIfVisible:!0,behavior:"instant"}).catch(()=>{})}};return(d,p)=>(w(),L(g(Q),{class:"text-message"},{default:A(()=>[l.value.content?(w(),L(g(Q),{key:0,class:F(g(pe)("text-message__reference",{"text-danger":u.value})),onClick:c},{default:A(()=>[u.value?(w(),z(he,{key:0},[me(Z(g(n)("MessageList.origin_message_has_been_recalled")),1)],64)):(w(),z(he,{key:1},[q(g(Q),{class:"text-message__reference__header"},{default:A(()=>[me(Z(l.value.sender),1)]),_:1}),q(g(Q),{class:"text-message__reference__content"},{default:A(()=>[me(Z(l.value.content),1)]),_:1})],64))]),_:1},8,["class"])):ne("",!0),q(g(Q),{class:"text-message__content"},{default:A(()=>[(w(!0),z(he,null,ze(a.value.text,(f,h)=>(w(),z(he,{key:h},[f.name==="text"?(w(),z("span",QR,Z(f.text),1)):(w(),z("img",{key:1,class:"text-message__content__img",src:f.src,alt:f.emojiKey||""},null,8,ZR))],64))),128))]),_:1})]),_:1}))}}),tD=se(eD,[["__scopeId","data-v-222fe9af"]]),nD={key:0,class:"video-placeholder"},oD=["src","poster"],rD=G({__name:"VideoMessage",props:{message:{default:()=>({})},isLastInChunk:{type:Boolean,default:!1}},setup(t){const e=t,n=(c,d)=>c===200&&d===200,o=P(()=>e.message.getMessageContent()),r=x(null),i=x(!1),s=P(()=>{if(r.value)return r.value;const c=o.value;return n(c.snapshotWidth,c.snapshotHeight)?null:c.snapshotWidth&&c.snapshotHeight?{height:c.snapshotHeight,aspectRatio:c.snapshotWidth/c.snapshotHeight}:null}),a=P(()=>{if(!s.value)return{height:200,aspectRatio:.75};const{aspectRatio:c}=s.value;return c>1?{aspectRatio:c,height:200}:{aspectRatio:c,height:300}}),l=P(()=>e.message.flow==="out"),u=c=>{const d=c.target;r.value={aspectRatio:d.videoWidth/d.videoHeight,height:d.videoHeight},i.value=!0};return le(()=>e.message.ID,()=>{i.value=!1,r.value=null}),(c,d)=>(w(),L(g(Q),{class:F(g(pe)("video-message",{"video-message--last--self":l.value&&t.isLastInChunk,"video-message--last--other":!l.value&&t.isLastInChunk,"video-message--loaded":i.value})),style:Mt({maxHeight:`${a.value.height}px`,aspectRatio:s.value?`${a.value.aspectRatio}`:"auto",width:i.value?void 0:`${a.value.height*a.value.aspectRatio}px`})},{default:A(()=>[i.value?ne("",!0):(w(),z("div",nD)),V("video",{class:"video-message__video",src:o.value.url,poster:o.value.snapshotUrl,controls:"",muted:"",autoplay:!1,onLoadedmetadata:u},null,40,oD)]),_:1},8,["class","style"]))}}),iD=se(rD,[["__scopeId","data-v-a02e7d43"]]),Kp={copy:{key:"copy",label:"copy",visible:t=>t.type===ie.TEXT,icon:Cv},recall:{key:"recall",label:"recall",visible:t=>!An(t)&&t.flow==="out"&&t.status==="success"&&Date.now()-t.time*1e3<120*1e3,icon:$v},quote:{key:"quote",label:"quote",visible:t=>!An(t),icon:Ov},forward:{key:"forward",label:"forward",visible:t=>!An(t),icon:xv},delete:{key:"delete",label:"delete",icon:Iv,visible:!0,style:{color:"var(--text-color-error)"}}},sD=["copy","recall","quote","forward","delete"];function aD(t){const e=Mc(),n={copy:r=>{e.copyTextMessage(r).then(()=>Bt.success({message:qe.t("MessageList.copy_success")})).catch(()=>Bt.error({message:qe.t("MessageList.copy_failed")}))},recall:r=>{e.recallMessage(r).then(()=>Bt.success({message:qe.t("MessageList.recall_success")})).catch(i=>Bt.error({message:i.code===20016?qe.t("MessageList.recall_time_limit_exceeded"):qe.t("MessageList.recall_failed")}))},quote:e.quoteMessage,forward:r=>{e.setForwardMessageIDList([r.ID]),e.setIsForwardMessageSelectionDone(!0)},delete:r=>{e.deleteMessage(r).then(()=>Bt.success({message:qe.t("MessageList.delete_success")})).catch(()=>Bt.error({message:qe.t("MessageList.delete_failed")}))}},o=sD.map(r=>typeof r=="string"?{...Kp[r],onClick:n[r]}:{...Kp[r.key]||{},...r,onClick:r.onClick||n[r.key]});return P(()=>o).value}const lD=["INPUT","TEXTAREA"];function Yp(t,e,n,o={}){if(!e||o.enableIgnoredElement&&lD.includes(e.nodeName))return null;const{arrowKeyOptions:r="both",attributeName:i="[data-reka-collection-item]",itemsArray:s=[],loop:a=!0,dir:l="ltr",preventScroll:u=!0,focus:c=!1}=o,[d,p,f,h,m,v]=[t.key==="ArrowRight",t.key==="ArrowLeft",t.key==="ArrowUp",t.key==="ArrowDown",t.key==="Home",t.key==="End"],y=f||h,_=d||p;if(!m&&!v&&(!y&&!_||r==="vertical"&&_||r==="horizontal"&&y))return null;const E=n?Array.from(n.querySelectorAll(i)):s;if(!E.length)return null;u&&t.preventDefault();let b=null;return _||y?b=Qg(E,e,{goForward:y?h:l==="ltr"?d:p,loop:a}):m?b=E.at(0)||null:v&&(b=E.at(-1)||null),c&&(b==null||b.focus()),b}function Qg(t,e,n,o=t.includes(e)?t.length:t.length+1){if(--o===0)return null;const r=t.indexOf(e);let i;if(r===-1?i=n.goForward?0:t.length-1:i=n.goForward?r+1:r-1,!n.loop&&(i<0||i>=t.length))return null;const s=(i+t.length)%t.length,a=t[s];return a?a.hasAttribute("disabled")&&a.getAttribute("disabled")!=="false"?Qg(t,a,n,o):a:null}function Ic(t){const e=Mf({dir:x("ltr")});return P(()=>{var n;return(t==null?void 0:t.value)||((n=e.dir)==null?void 0:n.value)||"ltr"})}function uD(t){const e=E_("",1e3);return{search:e,handleTypeaheadSearch:(n,o)=>{e.value=e.value+n;{const r=Le(),i=o.map(c=>{var d,p;return{...c,textValue:((d=c.value)==null?void 0:d.textValue)??((p=c.ref.textContent)==null?void 0:p.trim())??""}}),s=i.find(c=>c.ref===r),a=i.map(c=>c.textValue),l=dD(a,e.value,s==null?void 0:s.textValue),u=i.find(c=>c.textValue===l);return u&&u.ref.focus(),u==null?void 0:u.ref}},resetTypeahead:()=>{e.value=""}}}function cD(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function dD(t,e,n){const o=e.length>1&&Array.from(e).every(a=>a===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let i=cD(t,Math.max(r,0));o.length===1&&(i=i.filter(a=>a!==n));const s=i.find(a=>a.toLowerCase().startsWith(o.toLowerCase()));return s!==n?s:void 0}function Jp(){const t=x(),e=P(()=>{var n,o;return["#text","#comment"].includes((n=t.value)==null?void 0:n.$el.nodeName)?(o=t.value)==null?void 0:o.$el.nextElementSibling:ur(t)});return{primitiveElement:t,currentElement:e}}const Xp="data-reka-collection-item";function Zg(t={}){const{key:e="",isProvider:n=!1}=t,o=`${e}CollectionProvider`;let r;if(n){const c=x(new Map);r={collectionRef:x(),itemMap:c},mu(o,r)}else r=hu(o);const i=(c=!1)=>{const d=r.collectionRef.value;if(!d)return[];const p=Array.from(d.querySelectorAll(`[${Xp}]`)),f=Array.from(r.itemMap.value.values()).sort((h,m)=>p.indexOf(h.ref)-p.indexOf(m.ref));return c?f:f.filter(h=>h.ref.dataset.disabled!=="")},s=G({name:"CollectionSlot",inheritAttrs:!1,setup(c,{slots:d,attrs:p}){const{primitiveElement:f,currentElement:h}=Jp();return le(h,()=>{r.collectionRef.value=h.value}),()=>xe(kl,{ref:f,...p},d)}}),a=G({name:"CollectionItem",inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(c,{slots:d,attrs:p}){const{primitiveElement:f,currentElement:h}=Jp();return At(m=>{if(h.value){const v=gu(h.value);r.itemMap.value.set(v,{ref:h.value,value:c.value}),m(()=>r.itemMap.value.delete(v))}}),()=>xe(kl,{...p,[Xp]:"",ref:f},d)}}),l=P(()=>Array.from(r.itemMap.value.values())),u=P(()=>r.itemMap.value.size);return{getItems:i,reactiveItems:l,itemMapSize:u,CollectionSlot:s,CollectionItem:a}}const pD="rovingFocusGroup.onEntryFocus",fD={bubbles:!1,cancelable:!0};function hD(t,e=!1){const n=Le();for(const o of t)if(o===n||(o.focus({preventScroll:e}),Le()!==n))return}const[dN,mD]=Xt("RovingFocusGroup");var gD=G({__name:"RovingFocusGroup",props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["entryFocus","update:currentTabStopId"],setup(t,{expose:e,emit:n}){const o=t,r=n,{loop:i,orientation:s,dir:a}=Ht(o),l=Ic(a),u=sa(o,"currentTabStopId",r,{defaultValue:o.defaultCurrentTabStopId,passive:o.currentTabStopId===void 0}),c=x(!1),d=x(!1),p=x(0),{getItems:f,CollectionSlot:h}=Zg({isProvider:!0});function m(y){const _=!d.value;if(y.currentTarget&&y.target===y.currentTarget&&_&&!c.value){const E=new CustomEvent(pD,fD);if(y.currentTarget.dispatchEvent(E),r("entryFocus",E),!E.defaultPrevented){const b=f().map(I=>I.ref).filter(I=>I.dataset.disabled!==""),N=b.find(I=>I.getAttribute("data-active")===""),S=b.find(I=>I.getAttribute("data-highlighted")===""),M=b.find(I=>I.id===u.value),T=[N,S,M,...b].filter(Boolean);hD(T,o.preventScrollOnEntryFocus)}}d.value=!1}function v(){setTimeout(()=>{d.value=!1},1)}return e({getItems:f}),mD({loop:i,dir:l,orientation:s,currentTabStopId:u,onItemFocus:y=>{u.value=y},onItemShiftTab:()=>{c.value=!0},onFocusableItemAdd:()=>{p.value++},onFocusableItemRemove:()=>{p.value--}}),(y,_)=>(w(),L(g(h),null,{default:A(()=>[q(g(Vt),{tabindex:c.value||p.value===0?-1:0,"data-orientation":g(s),as:y.as,"as-child":y.asChild,dir:g(l),style:{outline:"none"},onMousedown:_[0]||(_[0]=E=>d.value=!0),onMouseup:v,onFocus:m,onBlur:_[1]||(_[1]=E=>c.value=!1)},{default:A(()=>[J(y.$slots,"default")]),_:3},8,["tabindex","data-orientation","as","as-child","dir"])]),_:3}))}}),vD=gD,yD=G({__name:"MenuAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t;return(n,o)=>(w(),L(g(Iu),ln(vo(e)),{default:A(()=>[J(n.$slots,"default")]),_:3},16))}}),bD=yD;function _D(){const t=x(!1);return tt(()=>{Ss("keydown",()=>{t.value=!0},{capture:!0,passive:!0}),Ss(["pointerdown","pointermove"],()=>{t.value=!1},{capture:!0,passive:!0})}),t}const wD=If(_D),[Da,ED]=Xt(["MenuRoot","MenuSub"],"MenuContext"),[xc,kD]=Xt("MenuRoot");var SD=G({__name:"MenuRoot",props:{open:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{modal:r,dir:i}=Ht(n),s=Ic(i),a=sa(n,"open",o),l=x(),u=wD();return ED({open:a,onOpenChange:c=>{a.value=c},content:l,onContentChange:c=>{l.value=c}}),kD({onClose:()=>{a.value=!1},isUsingKeyboardRef:u,dir:s,modal:r}),(c,d)=>(w(),L(g(Pf),null,{default:A(()=>[J(c.$slots,"default")]),_:3}))}}),MD=SD;const[ev,TD]=Xt("MenuContent");var ID=G({__name:"MenuContentImpl",props:sf({loop:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},disableOutsideScroll:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Vf}),emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus","dismiss"],setup(t,{emit:e}){const n=t,o=e,r=Da(),i=xc(),{trapFocus:s,disableOutsidePointerEvents:a,loop:l}=Ht(n);Af(),Eu(a.value);const u=x(""),c=x(0),d=x(0),p=x(null),f=x("right"),h=x(0),m=x(null),v=x(),{forwardRef:y,currentElement:_}=ke(),{handleTypeaheadSearch:E}=uD(),b=x();function N(C){const j=Yp(C,b.value||Le(),_.value,{loop:l.value,arrowKeyOptions:"vertical",dir:i==null?void 0:i.dir.value,focus:!1,attributeName:"[data-reka-collection-item]:not([data-disabled])"});j&&(b.value=j,j.scrollIntoView({block:"nearest"}))}function S(){b.value&&b.value.click()}const M=x(),T=x();le(b,C=>{T.value&&(C===void 0||C!==T.value.trigger.value)&&(T.value.onOpenChange(!1),T.value=void 0)}),le(_,C=>{r.onContentChange(C)}),Lt(()=>{window.clearTimeout(c.value)});function I(C){var j,W;return f.value===((j=p.value)==null?void 0:j.side)&&UA(C,(W=p.value)==null?void 0:W.area)}async function O(C){var j;o("openAutoFocus",C),!C.defaultPrevented&&(C.preventDefault(),(j=_.value)==null||j.focus({preventScroll:!0}))}function B(C){var j;if(C.defaultPrevented)return;const W=C.target,ee=W.closest("[data-reka-menu-content]")===C.currentTarget,oe=["input","textarea"].includes(W.tagName.toLowerCase()),we=C.ctrlKey||C.altKey||C.metaKey,Ke=C.key.length===1,Fe=Yp(C,Le(),_.value,{loop:l.value,arrowKeyOptions:"vertical",dir:i==null?void 0:i.dir.value,focus:!0,attributeName:"[data-reka-collection-item]:not([data-disabled])"});if(Fe)return Fe==null?void 0:Fe.focus();if(C.code==="Space")return;const dt=((j=v.value)==null?void 0:j.getItems())??[];if(ee&&(C.key==="Tab"&&C.preventDefault(),!we&&Ke&&!oe&&E(C.key,dt)),C.target!==_.value||!NA.includes(C.key))return;C.preventDefault();const pt=[...dt.map(nt=>nt.ref)];Wg.includes(C.key)&&pt.reverse(),LA(pt)}function $(C){var j,W;(W=(j=C==null?void 0:C.currentTarget)==null?void 0:j.contains)!=null&&W.call(j,C.target)||(window.clearTimeout(c.value),u.value="")}function R(C){var j;if(!na(C))return;const W=C.target,ee=h.value!==C.clientX;if((j=C==null?void 0:C.currentTarget)!=null&&j.contains(W)&&ee){const oe=C.clientX>h.value?"right":"left";f.value=oe,h.value=C.clientX}}function D(C){na(C)&&M.value&&M.value.focus()}return TD({onItemEnter:C=>!!I(C),onItemLeave:C=>{var j,W;I(C)||(["INPUT","TEXTAREA"].includes(((j=Le())==null?void 0:j.tagName)||"")||(W=_.value)==null||W.focus(),m.value=null)},onTriggerLeave:C=>!!I(C),searchRef:u,highlightedElement:b,onKeydownNavigation:N,onKeydownEnter:S,filterElement:M,onFilterElementChange:C=>{M.value=C},activeSubmenuContext:T,pointerGraceTimerRef:d,onPointerGraceIntentChange:C=>{p.value=C}}),(C,j)=>(w(),L(g(Mu),{"as-child":"",trapped:g(s),onMountAutoFocus:O,onUnmountAutoFocus:j[7]||(j[7]=W=>o("closeAutoFocus",W))},{default:A(()=>[q(g(Su),{"as-child":"","disable-outside-pointer-events":g(a),onEscapeKeyDown:j[2]||(j[2]=W=>o("escapeKeyDown",W)),onPointerDownOutside:j[3]||(j[3]=W=>o("pointerDownOutside",W)),onFocusOutside:j[4]||(j[4]=W=>o("focusOutside",W)),onInteractOutside:j[5]||(j[5]=W=>o("interactOutside",W)),onDismiss:j[6]||(j[6]=W=>o("dismiss"))},{default:A(()=>[q(g(vD),{ref_key:"rovingFocusGroupRef",ref:v,"current-tab-stop-id":m.value,"onUpdate:currentTabStopId":j[0]||(j[0]=W=>m.value=W),"as-child":"",orientation:"vertical",dir:g(i).dir.value,loop:g(l),onEntryFocus:j[1]||(j[1]=W=>{o("entryFocus",W),g(i).isUsingKeyboardRef.value||W.preventDefault()})},{default:A(()=>[q(g(Wf),{ref:g(y),role:"menu",as:C.as,"as-child":C.asChild,"aria-orientation":"vertical","data-reka-menu-content":"","data-state":g(Kg)(g(r).open.value),dir:g(i).dir.value,side:C.side,"side-offset":C.sideOffset,align:C.align,"align-offset":C.alignOffset,"avoid-collisions":C.avoidCollisions,"collision-boundary":C.collisionBoundary,"collision-padding":C.collisionPadding,"arrow-padding":C.arrowPadding,"prioritize-position":C.prioritizePosition,"position-strategy":C.positionStrategy,"update-position-strategy":C.updatePositionStrategy,sticky:C.sticky,"hide-when-detached":C.hideWhenDetached,reference:C.reference,onKeydown:B,onBlur:$,onPointermove:R,onPointerenter:D},{default:A(()=>[J(C.$slots,"default")]),_:3},8,["as","as-child","data-state","dir","side","side-offset","align","align-offset","avoid-collisions","collision-boundary","collision-padding","arrow-padding","prioritize-position","position-strategy","update-position-strategy","sticky","hide-when-detached","reference"])]),_:3},8,["current-tab-stop-id","dir","loop"])]),_:3},8,["disable-outside-pointer-events"])]),_:3},8,["trapped"]))}}),tv=ID,xD=G({inheritAttrs:!1,__name:"MenuItemImpl",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t,n=ev(),{forwardRef:o,currentElement:r}=ke(),{CollectionItem:i}=Zg(),s=x(!1),a=P(()=>s.value||n.highlightedElement.value===r.value);async function l(c){var d;if(!c.defaultPrevented&&na(c)){if(e.disabled)n.onItemLeave(c);else if(!n.onItemEnter(c)){const p=c.currentTarget;n.highlightedElement.value=p,["INPUT","TEXTAREA"].includes(((d=Le())==null?void 0:d.tagName)||"")||p.focus({preventScroll:!0})}}}async function u(c){await Te(),!c.defaultPrevented&&na(c)&&n.onItemLeave(c)}return(c,d)=>(w(),L(g(i),{value:{textValue:c.textValue}},{default:A(()=>[q(g(Vt),ye({ref:g(o),role:"menuitem",tabindex:"-1"},c.$attrs,{as:c.as,"as-child":c.asChild,"aria-disabled":c.disabled||void 0,"data-disabled":c.disabled?"":void 0,"data-highlighted":a.value?"":void 0,onPointermove:l,onPointerleave:u,onFocus:d[0]||(d[0]=async p=>{await Te(),!(p.defaultPrevented||c.disabled)&&(s.value=!0,g(n).highlightedElement.value=p.currentTarget)}),onBlur:d[1]||(d[1]=async p=>{await Te(),!p.defaultPrevented&&(s.value=!1)})}),{default:A(()=>[J(c.$slots,"default")]),_:3},16,["as","as-child","aria-disabled","data-disabled","data-highlighted"])]),_:3},8,["value"]))}}),OD=xD,$D=G({__name:"MenuItem",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{forwardRef:r,currentElement:i}=ke(),s=xc(),a=ev(),l=x(!1);async function u(){const c=i.value;if(!n.disabled&&c){const d=new CustomEvent(RA,{bubbles:!0,cancelable:!0});o("select",d),await Te(),d.defaultPrevented?l.value=!1:s.onClose()}}return(c,d)=>(w(),L(OD,ye(n,{ref:g(r),onClick:u,onPointerdown:d[0]||(d[0]=()=>{l.value=!0}),onPointerup:d[1]||(d[1]=async p=>{var f;await Te(),!p.defaultPrevented&&(l.value||(f=p.currentTarget)==null||f.click())}),onKeydown:d[2]||(d[2]=async p=>{const f=g(a).searchRef.value!=="";c.disabled||f&&p.key===" "||g(DA).includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})}),{default:A(()=>[J(c.$slots,"default")]),_:3},16))}}),CD=$D,AD=G({__name:"MenuRootContentModal",props:{loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=yo(n,o),i=Da(),{forwardRef:s,currentElement:a}=ke();return ku(a),(l,u)=>(w(),L(tv,ye(g(r),{ref:g(s),"trap-focus":g(i).open.value,"disable-outside-pointer-events":g(i).open.value,"disable-outside-scroll":!0,onDismiss:u[0]||(u[0]=c=>g(i).onOpenChange(!1)),onFocusOutside:u[1]||(u[1]=oo(c=>o("focusOutside",c),["prevent"]))}),{default:A(()=>[J(l.$slots,"default")]),_:3},16,["trap-focus","disable-outside-pointer-events"]))}}),RD=AD,DD=G({__name:"MenuRootContentNonModal",props:{loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=yo(t,e),o=Da();return(r,i)=>(w(),L(tv,ye(g(n),{"trap-focus":!1,"disable-outside-pointer-events":!1,"disable-outside-scroll":!1,onDismiss:i[0]||(i[0]=s=>g(o).onOpenChange(!1))}),{default:A(()=>[J(r.$slots,"default")]),_:3},16))}}),PD=DD,ND=G({__name:"MenuContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=yo(t,e),o=Da(),r=xc();return(i,s)=>(w(),L(g(aa),{present:i.forceMount||g(o).open.value},{default:A(()=>[g(r).modal.value?(w(),L(RD,ln(ye({key:0},{...i.$attrs,...g(n)})),{default:A(()=>[J(i.$slots,"default")]),_:3},16)):(w(),L(PD,ln(ye({key:1},{...i.$attrs,...g(n)})),{default:A(()=>[J(i.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),LD=ND,BD=G({__name:"MenuPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(w(),L(g(Tu),ln(vo(e)),{default:A(()=>[J(n.$slots,"default")]),_:3},16))}}),UD=BD;const[nv,FD]=Xt("ContextMenuRoot");var jD=G({inheritAttrs:!1,__name:"ContextMenuRoot",props:{pressOpenDelay:{type:Number,required:!1,default:700},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{dir:r,modal:i,pressOpenDelay:s}=Ht(n);ke();const a=Ic(r),l=x(!1),u=x();return FD({open:l,onOpenChange:c=>{l.value=c},dir:a,modal:i,triggerElement:u,pressOpenDelay:s}),le(l,c=>{o("update:open",c)}),(c,d)=>(w(),L(g(MD),{open:l.value,"onUpdate:open":d[0]||(d[0]=p=>l.value=p),dir:g(a),modal:g(i)},{default:A(()=>[J(c.$slots,"default")]),_:3},8,["open","dir","modal"]))}}),qD=jD,zD=G({__name:"ContextMenuContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},sideFlip:{type:Boolean,required:!1},alignOffset:{type:Number,required:!1,default:0},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1,default:!0},collisionBoundary:{type:null,required:!1,default:()=>[]},collisionPadding:{type:[Number,Object],required:!1,default:0},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1,default:"partial"},hideWhenDetached:{type:Boolean,required:!1,default:!1},positionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","closeAutoFocus"],setup(t,{emit:e}){const n=yo(t,e);ke();const o=nv(),r=x(!1);return(i,s)=>(w(),L(g(LD),ye(g(n),{side:"right","side-offset":2,align:"start","update-position-strategy":"always",style:{"--reka-context-menu-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-context-menu-content-available-width":"var(--reka-popper-available-width)","--reka-context-menu-content-available-height":"var(--reka-popper-available-height)","--reka-context-menu-trigger-width":"var(--reka-popper-anchor-width)","--reka-context-menu-trigger-height":"var(--reka-popper-anchor-height)"},onCloseAutoFocus:s[0]||(s[0]=a=>{!a.defaultPrevented&&r.value&&a.preventDefault(),r.value=!1}),onInteractOutside:s[1]||(s[1]=a=>{a.detail.originalEvent.button===2&&a.target===g(o).triggerElement.value&&a.preventDefault(),!a.defaultPrevented&&!g(o).modal.value&&(r.value=!0)})}),{default:A(()=>[J(i.$slots,"default")]),_:3},16))}}),GD=zD,HD=G({__name:"ContextMenuItem",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=_i(e);return ke(),(r,i)=>(w(),L(g(CD),ln(vo({...n,...g(o)})),{default:A(()=>[J(r.$slots,"default")]),_:3},16))}}),VD=HD,WD=G({__name:"ContextMenuPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(w(),L(g(UD),ln(vo(e)),{default:A(()=>[J(n.$slots,"default")]),_:3},16))}}),KD=WD;function Qp(t){return t.pointerType!=="mouse"}var YD=G({inheritAttrs:!1,__name:"ContextMenuTrigger",props:{disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(t){const e=t,{disabled:n}=Ht(e),{forwardRef:o,currentElement:r}=ke(),i=nv(),s=x({x:0,y:0}),a=P(()=>({getBoundingClientRect:()=>({width:0,height:0,left:s.value.x,right:s.value.x,top:s.value.y,bottom:s.value.y,...s.value})})),l=x(0);function u(){window.clearTimeout(l.value)}function c(h){s.value={x:h.clientX,y:h.clientY},i.onOpenChange(!0)}async function d(h){n.value||(await Te(),h.defaultPrevented||(u(),c(h),h.preventDefault()))}async function p(h){n.value||(await Te(),Qp(h)&&!h.defaultPrevented&&(u(),l.value=window.setTimeout(()=>c(h),i.pressOpenDelay.value)))}async function f(h){n.value||(await Te(),Qp(h)&&!h.defaultPrevented&&u())}return tt(()=>{r.value&&(i.triggerElement.value=r.value)}),(h,m)=>(w(),z(he,null,[q(g(bD),{as:"template",reference:a.value},null,8,["reference"]),q(g(Vt),ye({ref:g(o),as:h.as,"as-child":h.asChild,"data-state":g(i).open.value?"open":"closed","data-disabled":g(n)?"":void 0,style:{WebkitTouchCallout:"none",pointerEvents:"auto"}},h.$attrs,{onContextmenu:d,onPointerdown:p,onPointermove:f,onPointercancel:f,onPointerup:f}),{default:A(()=>[J(h.$slots,"default")]),_:3},16,["as","as-child","data-state","data-disabled"])],64))}}),JD=YD;const XD="_slideIn_twbzd_1",QD="_slideOut_twbzd_1",ZD={"message-action-dropdown":"_message-action-dropdown_twbzd_1",slideIn:XD,slideOut:QD},eP={key:0},tP=G({__name:"MessageActionDropdown",props:{message:{default:()=>({})},messageActionList:{default:void 0}},setup(t){const e=t,{t:n}=Ee(),o=aD(),r=P(()=>(e.messageActionList??o).filter(a=>a.visible===void 0?!0:typeof a.visible=="function"?a.visible(e.message):a.visible)),i=a=>{var l;(l=a.onClick)==null||l.call(a,e.message)},s=document.body;return(a,l)=>r.value.length<=0?J(a.$slots,"default",{key:0},void 0,!0):(w(),L(g(qD),{key:1},{default:A(()=>[q(g(JD),{"as-child":""},{default:A(()=>[J(a.$slots,"default",{},void 0,!0)]),_:3}),q(g(KD),{to:g(s)},{default:A(()=>[q(g(GD),{class:F(g(pe)(g(ZD)["message-action-dropdown"]))},{default:A(()=>[(w(!0),z(he,null,ze(r.value,u=>(w(),L(g(VD),{key:u.key,as:"button",class:F(g(pe)("message-action-dropdown__item",u.className)),style:Mt(u.style),onSelect:c=>i(u)},{default:A(()=>[u.component&&u.visible?(w(),L(lt(u.component),{key:0,message:t.message},null,8,["message"])):u.visible?(w(),z(he,{key:1},[V("span",null,Z(g(n)(`MessageList.${u.label}`,{defaultValue:u.label})),1),u.icon?(w(),z(he,{key:0},[typeof u.icon=="string"?(w(),z("span",eP,Z(u.icon),1)):(w(),L(lt(u.icon),{key:1,class:F(g(pe)("message-action-dropdown__icon"))},null,8,["class"]))],64)):ne("",!0)],64)):ne("",!0)]),_:2},1032,["class","style","onSelect"]))),128))]),_:1},8,["class"])]),_:1},8,["to"])]),_:3}))}}),nP=se(tP,[["__scopeId","data-v-b360635f"]]),oP={key:0,class:"has-risk-content"},rP=G({__name:"MessageBubble",props:{message:{default:()=>({})},alignment:{default:"two-sided"},isLastInChunk:{type:Boolean,default:!0},messageActionList:{default:void 0}},setup(t){const e=[ce.TYPES.MSG_IMAGE,ce.TYPES.MSG_VIDEO],n=t,{highlightMessageIDSet:o}=ki(),r=P(()=>e.includes(n.message.type)),i=P(()=>o.value.has(n.message.ID));return(s,a)=>(w(),z("div",{class:F(["message-bubble",g(pe)({[`bubble-${t.message.flow}`]:t.message.flow&&!0,"all-round-radius":!t.isLastInChunk,"media-bubble":e.includes(t.message.type),"highlight--normal":i.value,"highlight--media":i.value&&r.value})])},[t.message.hasRiskContent?(w(),z("div",oP," hasRiskContent ")):(w(),L(g(nP),{key:1,messageActionList:t.messageActionList,message:t.message},{default:A(()=>[J(s.$slots,"default",{},void 0,!0)]),_:3},8,["messageActionList","message"]))],2))}}),iP=se(rP,[["__scopeId","data-v-1f4671de"]]),sP=G({__name:"MessageStatusIcon",props:{status:{}},setup(t){return(e,n)=>(w(),L(g(Q),null,{default:A(()=>[t.status==="unSend"?(w(),L(g(Fo),{key:0,class:"message-meta__status--unSend",size:14})):t.status==="success"?(w(),L(g(Av),{key:1,size:14})):t.status==="fail"?(w(),L(g(Zp),{key:2,size:14})):ne("",!0)]),_:1}))}}),aP=se(sP,[["__scopeId","data-v-68770f71"]]),lP=G({__name:"MessageMeta",props:{isGroup:{type:Boolean},timestamp:{default:0},flow:{default:"in"},needReadReceipt:{type:Boolean,default:!1},readReceiptInfo:{default:void 0},status:{default:void 0}},emits:["onReadReceiptTextClick"],setup(t,{emit:e}){const n=t,o=e,{t:r}=Ee(),i=Jt(),s=P(()=>Gg(n.timestamp)),a=()=>{o("onReadReceiptTextClick")},l=P(()=>n.flow==="out"&&(!n.needReadReceipt||n.status==="unSend"||n.status==="fail")),u=P(()=>{if(!n.needReadReceipt||n.status!=="success"||!n.readReceiptInfo||n.flow==="in")return"";const{readCount:c,unreadCount:d,isPeerRead:p}=n.readReceiptInfo;return n.isGroup?d===void 0||c===void 0?"":d>0?`${d} ${r("MessageList.unread")} ·`:`${r("MessageList.all_read")} ·`:p?`${r("MessageList.read")} ·`:`${r("MessageList.unread")} ·`});return(c,d)=>(w(),L(g(Q),{class:F(g(i)["message-meta"]),dir:"row",align:"center"},{default:A(()=>[l.value?(w(),z(he,{key:0},[n.status?(w(),L(aP,{key:0,status:n.status},null,8,["status"])):ne("",!0)],64)):u.value?(w(),z(he,{key:1},[u.value&&!n.isGroup?(w(),z("span",{key:0,class:F(g(i)["message-meta__read-status"])},Z(u.value),3)):u.value&&n.isGroup&&n.readReceiptInfo&&n.readReceiptInfo.unreadCount>0?(w(),z("span",{key:1,class:F(g(i)["message-meta__group-unread"]),onClick:a},Z(u.value),3)):u.value&&n.isGroup?(w(),z("span",{key:2,class:F(g(i)["message-meta__group-all-read"])},Z(u.value),3)):ne("",!0)],64)):ne("",!0),s.value?(w(),z("span",{key:2,class:F(g(i)["message-meta__time"])},Z(s.value),3)):ne("",!0)]),_:1},8,["class"]))}}),uP={"message-meta":"_message-meta_rk5t7_1","message-meta__read-status":"_message-meta__read-status_rk5t7_6","message-meta__group-unread":"_message-meta__group-unread_rk5t7_9","message-meta__group-all-read":"_message-meta__group-all-read_rk5t7_18","message-meta__time":"_message-meta__time_rk5t7_21"},cP={$style:uP},dP=se(lP,[["__cssModules",cP]]);function pP({isMessageOwner:t,alignment:e,isAggregated:n}){const o=e==="two-sided"&&t||e==="right",r=pe("message-layout",o?"message-layout--right":"message-layout--left"),i=pe("message-layout__wrapper",o?"message-layout__wrapper--right":"message-layout__wrapper--left",n?"message-layout__wrapper--aggregated":"",e==="two-sided"&&t?"message-layout__wrapper--no-padding":""),s=pe("message-layout__bubble",o?"message-layout__bubble--right":"message-layout__bubble--left",n?"message-layout__bubble--aggregated":""),a=pe("message-layout__avatar"),l=pe("message-layout__meta",o?"message-layout__meta--right":"message-layout__meta--left");return{layoutClasses:r,wrapperClasses:i,bubbleClasses:s,avatarClasses:a,metaClasses:l}}const fP=G({__name:"MessageLayout",props:{message:{default:()=>({})},nick:{default:void 0},isAggregated:{type:Boolean,default:!1},isHiddenMessageAvatar:{type:Boolean,default:!1},isHiddenMessageMeta:{type:Boolean,default:!1},isHiddenMessageNick:{type:Boolean,default:!1},isFirstInChunk:{type:Boolean,default:void 0},isLastInChunk:{type:Boolean,default:void 0},alignment:{default:"two-sided"},messageActionList:{default:void 0},className:{default:""},style:{default:void 0}},setup(t){const e=t,n=x(!1),o=P(()=>!!(e.message.type===ie.CUSTOM&&e.message.getMessageContent().businessID==="group_create"||e.message.type===ie.CUSTOM&&An(e.message)&&e.message.conversationType===Ne.GROUP)),r={[ie.TEXT]:tD,[ie.IMAGE]:qR,[ie.AUDIO]:hR,[ie.VIDEO]:iD,[ie.FILE]:xR,[ie.FACE]:TR,[ie.LOCATION]:HR,[ie.MERGER]:KR,[ie.CUSTOM]:kR,[ie.GRP_TIP]:Vp},i=AA("MessageLayout"),s=P(()=>{const v=i==null?void 0:i.messageRenderers,{type:y}=e.message;return v!=null&&v[y]?v[y]:r[y]}),a=P(()=>e.message.flow==="out"),l=P(()=>pP({isMessageOwner:a.value,alignment:e.alignment,isAggregated:e.isAggregated})),u=P(()=>l.value.layoutClasses),c=P(()=>l.value.wrapperClasses),d=P(()=>l.value.avatarClasses),p=P(()=>l.value.bubbleClasses),f=P(()=>l.value.metaClasses);function h(){n.value=!0}function m(){n.value=!1}return(v,y)=>(w(),z(he,null,[t.message.isRevoked?(w(),L(g(JR),{key:0,class:"message-recalled",message:t.message},null,8,["message"])):t.message.type===g(ie).GRP_TIP||o.value?(w(),L(g(Vp),{key:1,message:t.message},null,8,["message"])):s.value?(w(),L(g(Q),{key:2,"data-message-id":t.message.ID,class:F(u.value),style:Mt(t.style)},{default:A(()=>[t.isHiddenMessageAvatar?ne("",!0):(w(),L(g(Ko),{key:0,class:F(g(pe)(d.value)),src:t.message.avatar},null,8,["class","src"])),q(g(Q),{class:F(g(pe)(c.value))},{default:A(()=>[t.isHiddenMessageNick?ne("",!0):(w(),L(g(Q),{key:0,class:F(g(pe)("message-layout__nick"))},{default:A(()=>[me(Z(e.nick||t.message.nameCard||t.message.nick||t.message.from),1)]),_:1},8,["class"])),q(g(iP),{class:F(p.value),message:t.message,alignment:t.alignment,isLastInChunk:!1,messageActionList:t.messageActionList},{default:A(()=>[(w(),L(lt(s.value),{message:t.message},null,8,["message"]))]),_:1},8,["class","message","alignment","messageActionList"]),t.isHiddenMessageMeta?ne("",!0):(w(),L(g(dP),{key:1,class:F(f.value),status:t.message.status,flow:t.message.flow,timestamp:t.message.time*1e3,"need-read-receipt":t.message.needReadReceipt,"read-receipt-info":t.message.readReceiptInfo,"is-group":t.message.conversationType===g(Ne).GROUP,onOnReadReceiptTextClick:h},null,8,["class","status","flow","timestamp","need-read-receipt","read-receipt-info","is-group"]))]),_:1},8,["class"])]),_:1},8,["data-message-id","class","style"])):ne("",!0),q(g(rR),{open:n.value,messageID:t.message.ID,"read-count":t.message.readReceiptInfo.readCount,"unread-count":t.message.readReceiptInfo.unreadCount,"is-peer-read":t.message.readReceiptInfo.isPeerRead,onOnClose:m},null,8,["open","messageID","read-count","unread-count","is-peer-read"])],64))}}),hP=se(fP,[["__scopeId","data-v-b0da155b"]]),ov=G({__name:"Message",props:{message:{},nick:{default:void 0},alignment:{default:"two-sided"},messageActionList:{default:void 0},isAggregated:{type:Boolean,default:!1},isFirstInChunk:{type:Boolean,default:void 0},isLastInChunk:{type:Boolean,default:void 0},isHiddenMessageAvatar:{type:Boolean,default:!1},isHiddenMessageNick:{type:Boolean,default:!1},isHiddenMessageMeta:{type:Boolean,default:!1}},setup(t){return(e,n)=>(w(),L(g(hP),{nick:t.nick,message:t.message,messageActionList:t.messageActionList,alignment:t.alignment,"is-aggregated":t.isAggregated,"is-first-in-chunk":t.isFirstInChunk,"is-last-in-chunk":t.isLastInChunk,"is-hidden-message-avatar":t.isHiddenMessageAvatar,"is-hidden-message-nick":t.isHiddenMessageNick,"is-hidden-message-meta":t.isHiddenMessageMeta},null,8,["nick","message","messageActionList","alignment","is-aggregated","is-first-in-chunk","is-last-in-chunk","is-hidden-message-avatar","is-hidden-message-nick","is-hidden-message-meta"]))}}),mP=["id"],gP=G({name:"ObserverView",inheritAttrs:!1,__name:"ObserverView",props:{id:{default:void 0},class:{default:void 0},style:{default:void 0},threshold:{default:0},rootMargin:{default:"0px"},root:{default:null},observerOptions:{default:void 0},disabled:{type:Boolean,default:!1},delay:{default:0}},emits:["onShow","onShowOnce","onHide"],setup(t,{emit:e}){const n=t,o=e,r=x(null),i=x(!1);let s=null,a=null;const l=()=>{if(!r.value||n.disabled)return;u();const c=n.observerOptions||{threshold:n.threshold,rootMargin:n.rootMargin,root:n.root?document.querySelector(n.root):null};s=new IntersectionObserver(d=>{d.forEach(p=>{if(p.isIntersecting){const f=()=>{o("onShow"),i.value||(o("onShowOnce"),i.value=!0)};n.delay&&n.delay>0?(a&&clearTimeout(a),a=window.setTimeout(f,n.delay)):f()}else o("onHide")})},c),s.observe(r.value)};function u(){s&&(s.disconnect(),s=null),a&&(clearTimeout(a),a=null)}return le([()=>n.disabled,()=>n.threshold,()=>n.rootMargin,()=>n.root,()=>n.observerOptions],()=>{r.value&&l()}),tt(()=>{l()}),Lt(()=>{u()}),(c,d)=>(w(),z("div",ye({id:t.id,ref_key:"viewRef",ref:r,class:g(pe)("observer-view",n.class),style:t.style},c.$attrs),[J(c.$slots,"default",{},void 0,!0)],16,mP))}}),vP=se(gP,[["__scopeId","data-v-6f27edac"]]);function yP({enabled:t,containerSelector:e,messageSelector:n="[data-message-id]",getMessageIDFromDom:o,shouldSendReadReceipt:r=a=>a.flow==="in",intersectionThreshold:i=.5,delay:s=1e3}){let a=null;const l=new Map,u=new Set,c=wc(()=>{if(l.size===0)return;const v=Array.from(l.values());ot.sendMessageReadReceipt(v).then(()=>{}).catch(y=>{ia(y)}),l.clear()},s,{leading:!1,trailing:!0}),d=v=>{if(u.has(v))return!1;const y=$e.getMessageModel(v);return y&&r(y)?(l.set(v,y),u.add(v),c(),!0):!1},p=()=>{t&&(a=new IntersectionObserver(v=>{v.forEach(y=>{if(y.isIntersecting&&y.intersectionRatio>=i){const _=o(y.target);_&&d(_),a==null||a.unobserve(y.target)}})},{threshold:i,root:document.querySelector(e)}))},f=()=>{a==null||a.disconnect(),c.flush()};le([()=>t,()=>e,()=>i],()=>{f(),p()},{immediate:!0});const h=()=>{if(!a||!t)return;const v=document.querySelector(e);v&&v.querySelectorAll(n).forEach(y=>{const _=o(y);if(!_||u.has(_))return;const E=$e.getMessageModel(_);E&&r(E)&&(a==null||a.observe(y))})},m=()=>{if(!t)return;const v=document.querySelector(e);if(!v)return;const y=v.getBoundingClientRect();v.querySelectorAll(n).forEach(_=>{const E=o(_);if(!E||u.has(E))return;const b=_.getBoundingClientRect();b.top<y.bottom&&b.bottom>y.top&&b.height>0&&d(E)})};return tt(()=>{p()}),Lt(()=>{f()}),{observeMessageList:h,manuallyMarkVisibleMessagesAsRead:m,resetProcessedMessages:()=>{u.clear(),l.clear()}}}const bP={class:"forward-header__title"},_P=G({__name:"MessageForward",setup(t){const{t:e}=Ee(),{forwardMessageIDList:n,forwardConversationIDList:o,isForwardMessageSelectionDone:r,forwardMessage:i}=Mc(),{conversationList:s}=Bn(),a=x(null),l=P(()=>s.value?s.value.map(f=>{const{type:h,remark:m,groupProfile:v,userProfile:y}=f,_={key:f.conversationID,label:"",avatarUrl:f.getAvatar()||""};if(h===ce.TYPES.CONV_C2C){const E=m||(y==null?void 0:y.nick)||(y==null?void 0:y.userID);_.label=E||""}if(h===ce.TYPES.CONV_GROUP){const E=(v==null?void 0:v.name)||(v==null?void 0:v.groupID);_.label=E||""}return _}):[]),u=x(!0);function c(f){u.value=f.length===0,o.value=f.map(h=>h.key)}function d(){var f;if(!r.value)return;const h=(f=a.value)==null?void 0:f.getSelectedItems();h&&h.length>0&&(i({messageIDList:n.value,conversationIDList:h.map(m=>m.key),isMergeForward:!1}),p())}function p(){n.value=[],o.value=[],r.value=!1}return(f,h)=>(w(),L(g(Jg),{open:g(r),"content-class":"forward-container",onOnClose:p},{default:A(()=>[q(g(Q),{class:"forward-header",dir:"row"},{default:A(()=>[q(g(ar),{size:"28",class:"forward-header__close",onClick:p}),V("span",bP,Z(g(e)("MessageList.forward")),1),h[0]||(h[0]=V("div",{class:"forward-header__placeholder"},null,-1))]),_:1}),q(g(bu),{ref_key:"userPickerRef",ref:a,"display-mode":"list","data-source":l.value,"max-count":10,"on-selected-change":c,"on-max-count-exceed":()=>{g(Bt).error({message:g(e)("MessageList.max_count_exceed")})}},null,8,["data-source","on-max-count-exceed"]),q(g(Q),{class:"forward-footer"},{default:A(()=>[q(g(Es),{radius:"rect",color:"blue",type:"primary",disabled:u.value,onClick:d},{default:A(()=>[me(Z(g(e)("MessageList.forward")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["open"]))}}),wP=se(_P,[["__scopeId","data-v-c66c4f35"]]),EP=G({__name:"MessageTimeDivider",props:{previousMessage:{default:void 0},currentMessage:{default:()=>({})}},setup(t){const e=t,n=P(()=>{var r,i;if(!((r=e.currentMessage)!=null&&r.time))return!1;const s=((i=e.previousMessage)==null?void 0:i.time)||0;return e.currentMessage.time-s>300}),o=()=>{if(!n.value)return xe(he,null,[]);const r=e.currentMessage.time;return xe("div",{class:"message-time-divider"},[xe("span",{},Gg(r*1e3))])};return(r,i)=>(w(),L(lt(o())))}}),kP=se(EP,[["__scopeId","data-v-3ccc6b1e"]]),SP=G({__name:"ScrollToBottom",emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(w(),z("button",{class:F(o.$style["scroll-to-bottom__button"]),onClick:r[0]||(r[0]=i=>n("click"))},[q(g(Rv),{customClass:o.$style["scroll-to-bottom__button--icon"],size:18},null,8,["customClass"])],2))}}),MP={"scroll-to-bottom__button":"_scroll-to-bottom__button_1dasy_1","scroll-to-bottom__button--icon":"_scroll-to-bottom__button--icon_1dasy_22"},TP={$style:MP},IP=se(SP,[["__cssModules",TP]]),xP={class:"message-list"},OP={class:"message-chunk"},bl=150,$P=G({__name:"MessageList",props:{alignment:{default:"two-sided"},messageAggregationTime:{default:300},enableReadReceipt:{type:Boolean,default:!1},messageActionList:{default:void 0},filter:{type:Function,default:void 0},Message:{default:void 0},MessageTimeDivider:{default:void 0},conversationID:{default:void 0},messageRenderers:{default:void 0}},setup(t){const e=t,n=of();mu(Vg,{slots:n,get messageRenderers(){return e.messageRenderers}});const o=x(!1),r=x(0),i=x(!1),s=x(null),a=x(!1),l=x(0),{messageList:u,loadMoreOlderMessage:c,activeConversationID:d,isDisableScroll:p,setIsDisableScroll:f,setEnableReadReceipt:h}=ki(),{getGroupMemberList:m}=Ai(),{scrollToBottom:v}=Xg(),{activeConversation:y,setActiveConversation:_}=Bn(),{observeMessageList:E,resetProcessedMessages:b}=yP({enabled:e.enableReadReceipt??!1,containerSelector:"#messageScrollList",getMessageIDFromDom:B=>B.dataset.messageId||""}),N=P(()=>{var B;return((B=y.value)==null?void 0:B.type)===Ne.GROUP}),S=P(()=>e.messageAggregationTime&&e.messageAggregationTime>0),M=P(()=>{if(!u.value)return[];const B=e.filter?u.value.filter(e.filter):u.value.filter(D=>!D.isDeleted);if(!e.messageAggregationTime||e.messageAggregationTime<=0)return B.map(D=>({timestamp:D.time,messages:[D],key:`chunk-${D.ID}`}));const $=[],R=e.messageAggregationTime;return B.forEach((D,C,j)=>{const W=D.time,ee=$.length>0?$[$.length-1]:void 0,oe=C>0?j[C-1]:void 0;!ee||W-ee.timestamp>R||ee.messages[0].from!==D.from||D.isRevoked||oe&&oe.isRevoked||D.status==="fail"||oe&&oe.status==="fail"||D.hasRiskContent||oe&&oe.hasRiskContent||An(D)||oe&&An(oe)||oe&&oe.type===ie.CUSTOM&&oe.getMessageContent().businessID==="group_create"?$.push({timestamp:W,messages:[D],key:`chunk-${D.ID}`}):ee.messages.push(D)}),$}),T=wc(()=>{s.value&&(r.value=s.value.scrollHeight-s.value.scrollTop-s.value.clientHeight,r.value>bl&&(f(!0),a.value=!0),r.value<bl&&(f(!1),a.value=!1))},100),I=async()=>{o.value=!1,f(!1),a.value=!1,b()},O=async()=>{var B;if(!(!o.value||i.value||!((B=u.value)!=null&&B.length))){if(f(!0),i.value=!0,!s.value){i.value=!1;return}if(l.value=s.value.scrollHeight-s.value.scrollTop-s.value.clientHeight,await c(),await Te(),s.value){const $=s.value.scrollHeight-s.value.clientHeight-l.value;s.value.scrollTop=Math.max(0,Math.min(s.value.scrollHeight-s.value.clientHeight,$))}i.value=!1}};return le(d,()=>{I()}),le(u,(B,$)=>{if($===void 0&&B&&!o.value){Te(()=>{v({behavior:"instant"}),o.value=!0,E()}),N.value&&m();return}if(!$||!B||!B.length)return;const R=B[B.length-1],D=$[$.length-1];(R==null?void 0:R.ID)!==(D==null?void 0:D.ID)&&(Te(()=>{E()}),(R.flow==="out"||!p.value&&r.value<bl)&&v({behavior:"smooth"}))},{immediate:!0}),le(()=>e.enableReadReceipt,B=>{h(B)},{immediate:!0}),le(()=>e.conversationID,B=>{B&&_(B)},{immediate:!0}),tt(()=>{s.value&&s.value.addEventListener("scroll",T),I()}),Lt(()=>{s.value&&s.value.removeEventListener("scroll",T)}),(B,$)=>(w(),z("div",xP,[V("div",{id:"messageScrollList",ref_key:"scrollContainer",ref:s,class:"message-list-container"},[q(g(vP),{root:"#messageScrollList",rootMargin:"50px 0px 0px 0px",threshold:.1,onOnShow:O},{default:A(()=>[...$[1]||($[1]=[V("div",{id:"loadMore"},null,-1)])]),_:1}),(w(!0),z(he,null,ze(M.value,(R,D)=>(w(),L(g(Q),{key:R.key,class:F(g(pe)("message-chunk--container"))},{default:A(()=>[(w(),L(lt(e.MessageTimeDivider||g(kP)),{previousMessage:D>0?M.value[D-1].messages[0]:void 0,currentMessage:R.messages[0]},null,8,["previousMessage","currentMessage"])),V("div",OP,[(w(!0),z(he,null,ze(R.messages,(C,j)=>(w(),L(lt(e.Message||g(ov)),{key:C.ID,message:C,alignment:e.alignment,messageActionList:e.messageActionList,isAggregated:!!(S.value&&j!==0),"is-first-in-chunk":j===0,"is-last-in-chunk":j===R.messages.length-1,isHiddenMessageAvatar:!!(t.alignment==="two-sided"?S.value&&j!==0||C.flow==="out":S.value&&j!==0),"is-hidden-message-nick":!!(!N.value||(t.alignment==="two-sided"?S.value&&j!==0||C.flow==="out":S.value&&j!==0)),isHiddenMessageMeta:!!(S.value&&j!==R.messages.length-1)},null,8,["message","alignment","messageActionList","isAggregated","is-first-in-chunk","is-last-in-chunk","isHiddenMessageAvatar","is-hidden-message-nick","isHiddenMessageMeta"]))),128))])]),_:2},1032,["class"]))),128))],512),q(g(wP)),a.value?(w(),L(g(IP),{key:0,class:F(g(pe)("scroll-to-bottom")),onClick:$[0]||($[0]=R=>g(v)({behavior:"smooth"}))},null,8,["class"])):ne("",!0)]))}}),CP=se($P,[["__scopeId","data-v-a1a9c72c"]]);lr("en-US",{translation:{...Hg["en-US"]}});lr("zh-CN",{translation:{...Hg["zh-CN"]}});const pN=ov,fN=CP;By.getInstance().init();export{Bn as A,fN as C,aN as E,ie as G,iN as M,uN as N,lN as O,cN as S,sN as a,Ry as b,pN as g};
|