/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./LinkPopover.css');const e=require("vue"),t=require("./icons.js");;/* empty css                  */const o=require("../../../_virtual/_plugin-vue_export-helper.js"),r=["disabled"],n=["innerHTML"],l={class:"popover-menu absolute right-0 top-full z-[1000] mt-1"},u={class:"flex gap-2"},i={__name:"LinkPopover",props:{editor:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},setup(o){const i=o,a=e.ref(null),d=e.ref(null),s=e.ref(!1),c=e.ref(""),v=e.computed(()=>i.editor?.isActive("link")),p=()=>{if(s.value)s.value=!1;else{const t=i.editor?.getAttributes("link");c.value=t?.href||"",s.value=!0,e.nextTick(()=>{d.value?.focus()})}},f=()=>{c.value?i.editor?.chain().focus().setLink({href:c.value}).run():i.editor?.chain().focus().unsetLink().run(),s.value=!1},b=()=>{i.editor?.chain().focus().unsetLink().run(),s.value=!1},k=e=>{a.value&&!a.value.contains(e.target)&&(s.value=!1)};return e.onMounted(()=>{document.addEventListener("click",k)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",k)}),(i,k)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"popoverRef",ref:a,class:"relative"},[e.createElementVNode("button",{class:e.normalizeClass([{"is-active":v.value,"is-disabled":o.disabled}]),disabled:o.disabled,title:"Link",onClick:p},[e.createElementVNode("span",{innerHTML:e.unref(t.linkIcon)},null,8,n)],10,r),e.withDirectives(e.createElementVNode("div",l,[e.createElementVNode("div",u,[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:d,"onUpdate:modelValue":k[0]||(k[0]=e=>c.value=e),type:"text",class:"flex-1 border border-gray-300 rounded p-1.5 outline-none focus:border-blue-500",placeholder:"Enter URL",onKeydown:e.withKeys(f,["enter"])},null,544),[[e.vModelText,c.value]]),e.createElementVNode("button",{class:"cursor-pointer rounded border-none bg-blue-500 p-1.5 px-3 hover:bg-blue-400",onClick:f}," OK "),v.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cursor-pointer rounded border-none bg-red-500 p-1.5 px-3 hover:bg-red-400",onClick:b}," Remove ")):e.createCommentVNode("",!0)])],512),[[e.vShow,s.value]])],512))}},a=o.default(i,[["__scopeId","data-v-37d2f9ee"]]);exports.default=a;