const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BiuPm6db.js","./Bxv1kRJt.js","./entry.Bel8Jjdw.css"])))=>i.map(i=>d[i]);
import{d as U,r as L,W as D,X as B,h as v,Y as w,H as N,i as E,o as r,b as S,e as M,ao as I,_ as z,s as V,ag as j,bg as A,bz as P,u as n,f as k,t as b,c as _,w as $,a9 as H,ad as T,y as K,ah as W,ai as X,ap as Y}from"./Bxv1kRJt.js";import{g as q,_ as F,o as G,M as J,b as Q,a as Z}from"./BHSDjEX4.js";import{_ as ee}from"./DoAmtlYH.js";import"./Dqibp0CK.js";import"./o_ViDd08.js";import"./DafvsEAY.js";import"./DRpV4Qhx.js";import"./D6NrV7C8.js";import"./BkY4Kcec.js";import"./oNASYLMO.js";const oe=U({__name:"MonacoDiffEditor.client",props:{lang:{default:()=>"plaintext"},options:{default:()=>({})},originalModelUri:{},modelUri:{},original:{default:()=>""},modelValue:{default:()=>""}},emits:["update:modelValue","load"],setup(f,{expose:m,emit:h}){const e=f,y=h,u=L(!0),d=D(),s=B();let l,a,t;const c=D(),p={automaticLayout:!0};return v(()=>[e.original,e.modelValue],()=>{(a.getValue()!==e.original||t.getValue()!==e.modelValue)&&(a.setValue(e.original),t.setValue(e.modelValue))}),v(()=>e.lang,()=>{const i=a?.getValue()||e.original,o=t?.getValue()||e.modelValue;a&&a.dispose(),t&&t.dispose(),a=s.editor.createModel(i,e.lang,e.originalModelUri),t=s.editor.createModel(o,e.lang,e.modelUri),l.setModel({original:a,modified:t})}),v(()=>e.options,()=>{l?.updateOptions(w(e.options,p))}),m({$editor:c}),v(d,(i,o)=>{!d.value||o||(l=s.editor.createDiffEditor(d.value,w(e.options,p)),c.value=l,a=s.editor.createModel(e.original,e.lang,e.originalModelUri),t=s.editor.createModel(e.modelValue,e.lang,e.modelUri),l.setModel({original:a,modified:t}),l.onDidUpdateDiff(()=>{y("update:modelValue",l.getModel().modified.getValue())}),u.value=!1,y("load",l))}),N(()=>{l?.dispose(),a?.dispose(),t?.dispose()}),(i,o)=>(r(),E("div",{ref_key:"editorElement",ref:d},[u.value?S(i.$slots,"default",{key:0}):M("",!0)],512))}}),te=I(oe),ae=W(()=>X(()=>import("./BiuPm6db.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(f=>f.default||f)),ie={key:0,flex:"~ col gap6",class:"file-container-loading","h-full":"","items-center":"","justify-center":""},le={op50:"","text-lg":""},ne={key:1},de={"items-center":"",flex:"","bg-active":"","justify-between":""},se={key:1,"h-full":""},re=U({__name:"EditorDiff",props:{change:{},readOnly:{type:Boolean}},emits:["update:modelValue","focus","blur"],setup(f){const m=f,{editItem:h}=z(),{content:e,isLoading:y}=h(m.change.key),u=V(()=>j(m.change.key));A(async()=>{});const d=V(()=>m.change.original||""),s=L(),l=V(()=>s.value?.$editor),a=L(),t=V(()=>a.value?.$editor),c=P({storageKey:"unpress-color-mode"}),p=q(c,u.value);return v(c,i=>{s.value?.$editor._themeService.setTheme(`vs-${i}`),a.value?.$editor._themeService.setTheme(`vs-${i}`)}),(i,o)=>{const x=F,O=Z,R=ee,C=ae;return n(y)||n(e)===null||n(e)===void 0?(r(),E("div",ie,[o[4]||(o[4]=k("div",{op50:"","i-carbon-circle-dash":"",h10:"",w10:"","animate-spin":""},null,-1)),k("div",le,b(i.$t("loading")),1)])):(r(),E("div",ne,[t.value?(r(),_(O,{key:0,editor:t.value.getModifiedEditor()},{default:$(()=>[H(x,{editor:t.value.getModifiedEditor()},null,8,["editor"])]),_:1},8,["editor"])):M("",!0),k("div",de,[i.change?.action==="DELETE"?(r(),_(R,{key:0,icon:"i-carbon-warning-filled",n:"red","w-full":"","rounded-none":""},{default:$(()=>[T(b(i.$t("file-deleted")),1)]),_:1})):M("",!0)]),["text","data"].includes(i.change.type)?(r(),E("div",se,[i.change?.action==="DELETE"?(r(),_(n(J),{key:0,ref_key:"editorRef",ref:s,options:{...n(p),readOnly:!0},lang:u.value,"model-value":d.value,"h-full":"","w-full":"","of-auto":"",onLoad:o[0]||(o[0]=g=>n(G)(l.value,u.value))},null,8,["options","lang","model-value"])):(r(),_(n(te),{key:1,ref_key:"diffEditorRef",ref:a,modelValue:n(e),"onUpdate:modelValue":o[1]||(o[1]=g=>K(e)?e.value=g:null),options:n(p),original:d.value,lang:u.value,"h-full":"","w-full":"","of-auto":"",onLoad:o[2]||(o[2]=g=>n(Q)(t.value,u.value))},{default:$(()=>o[5]||(o[5]=[T(" Loading... ")])),_:1},8,["modelValue","options","original","lang"]))])):i.change.type==="image"?(r(),_(C,{key:2,modelValue:d.value,"onUpdate:modelValue":o[3]||(o[3]=g=>d.value=g)},null,8,["modelValue"])):M("",!0)]))}}}),Ee=Y(re,[["__scopeId","data-v-66a7aa32"]]);export{Ee as default};
