1import{r as d,o as $,c as n,j as t,l as v,t as c,n as f,I as h,N as x,O as p,s as y,e as j,b as r}from"./vendor-kx6-G2cR.js";import{b as w,h as D}from"./index-DjS2G2iZ.js";const V={class:"max-w-2xl"},M={key:0,class:"text-center py-12 text-neutral-400"},S={key:1,class:"bg-white rounded-xl border border-neutral-200 p-6"},z={class:"flex items-center justify-between mb-5"},B={class:"text-base font-semibold text-neutral-700"},L={class:"flex items-center gap-3"},N={key:0,class:"flex items-center gap-2"},I={class:"mb-4"},R={key:0,class:"mb-2"},O=["src"],P={key:1},W={class:"mb-4"},E={class:"mb-4"},H={class:"flex items-center gap-2"},q={class:"mb-4"},G={class:"mb-5"},J={key:0,class:"mb-5"},K={class:"w-full max-w-[384px] h-[400px] rounded-2xl overflow-hidden relative"},Q=["src"],X={class:"relative z-10 p-5 flex flex-col justify-between h-full"},Y={class:"flex justify-between gap-2"},Z={class:"flex justify-end"},ee=["disabled"],ae={__name:"PatentAdPage",setup(te){const g=d(!0),m=d(!1),u=d(!1),i=d(""),b=d(!1),l=d({text:"",textColor:"#FFFFFF",buttonText:"",linkUrl:"",isActive:!0,imageFile:null});function F(s){if(!s)return"";if(/^https?:\/\//i.test(s))return s;const e=D.replace(/\/$/,""),a=String(s).startsWith("/")?s:`/${s}`;return`${e}${a}`}async function C(){g.value=!0;try{const{data:s}=await w.get("/api/patent-ad");s&&(u.value=!0,l.value.text=s.text||"",l.value.textColor=s.textColor||"#FFFFFF",l.value.buttonText=s.buttonText||"",l.value.linkUrl=s.linkUrl||"",l.value.isActive=s.isActive??!0,i.value=F(s.imageUrl))}catch{}finally{g.value=!1}}function U(s){var a;const e=(a=s.target.files)==null?void 0:a[0];e&&k(e)}function A(s){var a,o;b.value=!1;const e=(o=(a=s.dataTransfer)==null?void 0:a.files)==null?void 0:o[0];e&&e.type.startsWith("image/")&&k(e)}function k(s){l.value.imageFile=s;const e=new FileReader;e.onload=a=>{i.value=a.target.result},e.readAsDataURL(s)}async function _(){var s,e,a;if(!i.value&&!l.value.imageFile){(s=window.$toast)==null||s.call(window,{message:"ë°°ê²½ ì´ë¯¸ì§ë¥¼ ì
ë¡ëí´ì£¼ì¸ì.",type:"error"});return}m.value=!0;try{const o=new FormData;o.append("text",l.value.text||""),o.append("textColor",l.value.textColor||"#FFFFFF"),o.append("buttonText",l.value.buttonText||""),o.append("linkUrl",l.value.linkUrl||""),o.append("isActive",String(l.value.isActive)),l.value.imageFile instanceof File&&o.append("image",l.value.imageFile),await w.post("/api/patent-ad",o,{headers:{"Content-Type":"multipart/form-data"}}),u.value=!0,l.value.imageFile=null,(e=window.$toast)==null||e.call(window,{message:"ê´ê³ ê° ì ì¥ëììµëë¤.",type:"success"})}catch{(a=window.$toast)==null||a.call(window,{message:"ì ì¥ì ì¤í¨íìµëë¤.",type:"error"})}finally{m.value=!1}}async function T(){var s,e;try{await w.delete("/api/patent-ad"),u.value=!1,l.value={text:"",textColor:"#FFFFFF",buttonText:"",linkUrl:"",isActive:!0,imageFile:null},i.value="",(s=window.$toast)==null||s.call(window,{message:"ê´ê³ ê° ìì ëììµëë¤.",type:"success"})}catch{(e=window.$toast)==null||e.call(window,{message:"ìì ì ì¤í¨íìµëë¤.",type:"error"})}}return $(C),(s,e)=>(r(),n("div",null,[e[18]||(e[18]=t("div",{class:"flex items-center justify-between mb-6"},[t("h2",{class:"text-xl font-bold text-neutral-800"},"í¹íìë£ ê´ê³ ê´ë¦¬")],-1)),t("div",V,[g.value?(r(),n("div",M,"ë¶ë¬ì¤ë ì¤...")):(r(),n("div",S,[t("div",z,[t("h3",B,c(u.value?"ê´ê³ ìì ":"ê´ê³ ë±ë¡"),1),t("div",L,[u.value?(r(),n("div",N,[t("button",{onClick:e[0]||(e[0]=a=>l.value.isActive=!l.value.isActive),class:"relative"},[t("div",{class:f(["w-12 h-6 rounded-full transition-colors duration-200",l.value.isActive?"bg-main-500":"bg-neutral-300"])},[t("div",{class:f(["absolute top-0.5 w-5 h-5 rounded-full bg-white shadow transition-transform duration-200",l.value.isActive?"translate-x-6":"translate-x-0.5"])},null,2)],2)]),t("span",{class:f(["text-xs",l.value.isActive?"text-main-600 font-medium":"text-neutral-400"])},c(l.value.isActive?"íì±":"ë¹íì±"),3)])):v("",!0),u.value?(r(),n("button",{key:1,onClick:T,class:"px-3 py-1.5 text-xs bg-red-50 text-red-600 hover:bg-red-100 rounded-lg transition-colors"},"ìì ")):v("",!0)])]),t("div",I,[e[10]||(e[10]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"ë°°ê²½ ì´ë¯¸ì§ *",-1)),t("div",{class:f(["relative border-2 border-dashed border-neutral-300 rounded-lg p-4 text-center hover:border-main-400 transition-colors cursor-pointer",{"border-main-400 bg-main-50":b.value}]),onClick:e[1]||(e[1]=a=>s.$refs.fileInput.click()),onDragover:e[2]||(e[2]=h(a=>b.value=!0,["prevent"])),onDragleave:e[3]||(e[3]=a=>b.value=!1),onDrop:h(A,["prevent"])},[t("input",{ref:"fileInput",type:"file",accept:"image/*",class:"hidden",onChange:U},null,544),i.value?(r(),n("div",R,[t("img",{src:i.value,alt:"미리보기",class:"max-h-48 mx-auto rounded-lg object-contain"},null,8,O)])):(r(),n("div",P,e[9]||(e[9]=[t("svg",{class:"w-10 h-10 mx-auto text-neutral-400 mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1),t("p",{class:"text-xs text-neutral-500"},"í´ë¦ ëë ëëê·¸íì¬ ë°°ê²½ ì´ë¯¸ì§ ì
ë¡ë",-1),t("p",{class:"text-[10px] text-neutral-400 mt-1"}
1,"ì¹´ë ë¹ì¨ ê¶ì¥ (ì½ 384x400)",-1)])))],34)]),t("div",W,[e[11]||(e[11]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"ê´ê³ 문구",-1)),x(t("textarea",{"onUpdate:modelValue":e[4]||(e[4]=a=>l.value.text=a),rows:"3",placeholder:"ê´ê³ 문구를 ì
ë ¥íì¸ì",class:"w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-main-400 text-sm resize-none"},null,512),[[p,l.value.text]])]),t("div",E,[e[12]||(e[12]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"ê¸ì ìì",-1)),t("div",H,[x(t("input",{"onUpdate:modelValue":e[5]||(e[5]=a=>l.value.textColor=a),type:"color",class:"w-8 h-8 rounded border border-neutral-300 cursor-pointer p-0"},null,512),[[p,l.value.textColor]]),x(t("input",{"onUpdate:modelValue":e[6]||(e[6]=a=>l.value.textColor=a),type:"text",class:"w-28 px-2 py-1.5 border border-neutral-300 rounded-lg text-xs font-mono"},null,512),[[p,l.value.textColor]])])]),t("div",q,[e[13]||(e[13]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"ë²í¼ 문구",-1)),x(t("input",{"onUpdate:modelValue":e[7]||(e[7]=a=>l.value.buttonText=a),type:"text",placeholder:"ì: ìì¸í 보기",class:"w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-main-400 text-sm"},null,512),[[p,l.value.buttonText]])]),t("div",G,[e[14]||(e[14]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"ì°ê²° ë§í¬",-1)),x(t("input",{"onUpdate:modelValue":e[8]||(e[8]=a=>l.value.linkUrl=a),type:"text",placeholder:"ì: https://example.com",class:"w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-main-400 text-sm"},null,512),[[p,l.value.linkUrl]])]),i.value||l.value.text?(r(),n("div",J,[e[17]||(e[17]=t("label",{class:"block text-sm font-medium text-neutral-600 mb-1"},"미리보기",-1)),t("div",K,[i.value?(r(),n("img",{key:0,src:i.value,class:"w-full h-full object-cover absolute inset-0"},null,8,Q)):v("",!0),e[16]||(e[16]=t("div",{class:"absolute inset-0 bg-black/20"},null,-1)),t("div",X,[t("div",Y,[t("span",{class:"text-sm bg-black/40 px-2 py-1 rounded-full",style:y({color:l.value.textColor})},"AD",4)]),t("div",null,[t("p",{class:"text-lg leading-relaxed mb-4 whitespace-pre-line",style:y({color:l.value.textColor})},c(l.value.text),5),l.value.buttonText?(r(),n("a",{key:0,class:"inline-flex items-center gap-1 px-3 py-2 text-sm rounded-lg bg-black/60 hover:bg-black/80 transition-colors",style:y({color:l.value.textColor})},[j(c(l.value.buttonText)+" ",1),e[15]||(e[15]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 18l6-6-6-6"})],-1))],4)):v("",!0)])])])])):v("",!0),t("div",Z,[t("button",{onClick:_,disabled:m.value,class:"px-6 py-2.5 text-sm text-white bg-main-600 hover:bg-main-700 rounded-lg transition-colors disabled:opacity-50"},c(m.value?"ì ì¥ ì¤...":"ì ì¥"),9,ee)])]))])]))}};export{ae as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.