/* empty css                   */import{Transition as e,createBlock as t,createCommentVNode as n,createElementBlock as r,createElementVNode as i,createTextVNode as a,createVNode as o,inject as s,normalizeStyle as c,onUnmounted as l,openBlock as u,ref as d,renderSlot as f,resolveComponent as p,toDisplayString as m,unref as h,vShow as g,watch as _,withCtx as v,withDirectives as y}from"/vue.js";var b={key:0,class:`nc-modal`},x={key:0,class:`nc-modal-header`},S={class:`content`},C={class:`actions`},w=Object.assign({name:`nc-modal`},{__name:`nc-modal`,props:{show:{type:Boolean,default:!1},closeOnClick:{type:[Boolean,String],default:!1},header:{type:String,default:void 0},content:{type:String,default:void 0},cancelText:{type:String,default:void 0},okText:{type:String,default:void 0}},emits:[`modal-cancel`,`modal-ok`],setup(w,{emit:T}){let E=s(`state`),D=E.rec;E.hdr;let O=T,k=w,A=d({}),j=d(null),M=!1,N=!1,P=0,F=0,I=0,L=0,R=0,z=0;function B(e){e.target.tagName!==`IMG`&&(e.target.tagName!==`DIV`||e.target.children.length===0||Array.from(e.target.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent.trim().length>0))||(I=e.clientX,L=e.clientY,P=e.clientX-R,F=e.clientY-z,document.addEventListener(`mousemove`,V),document.addEventListener(`mouseup`,H))}function V(e){let t=e.clientX-I,n=e.clientY-L;!M&&(Math.abs(t)>5||Math.abs(n)>5)&&(M=!0),M&&(R=e.clientX-P,z=e.clientY-F,A.value={transform:`translate(${R}px, ${z}px)`})}function H(){N=M,M=!1,document.removeEventListener(`mousemove`,V),document.removeEventListener(`mouseup`,H)}function U(e){if(N){N=!1;return}k.closeOnClick===`outside`&&e.composedPath().includes(j.value)||(e.preventDefault(),e.stopPropagation(),J())}_(()=>k.show,e=>{e===!0?(A.value={},R=0,z=0,k.closeOnClick===`outside`?document.addEventListener(`click`,U):k.closeOnClick===!0&&document.documentElement.addEventListener(`click`,U,{once:!0})):k.closeOnClick===`outside`&&document.removeEventListener(`click`,U)}),l(()=>{k.closeOnClick===`outside`&&document.removeEventListener(`click`,U)});let W=null;function G(e,t,n,r){if(r){var i;W=(i=E.grid)==null||(i=i[e])==null||(i=i.data)==null?void 0:i[t-1]}else W=null}function K(e,t,n){G(e,t,n,!0),J()}function q(){O(`modal-cancel`,W)}function J(){O(`modal-ok`,W)}return(s,l)=>{let d=p(`nc-label`),_=p(`nc-row`),T=p(`nc-radio`),E=p(`nc-label-dropdown`),O=p(`nc-label-input`),M=p(`nc-grid`),N=p(`nc-button`);return u(),t(e,{name:`nc-fade`},{default:v(()=>[w.show===!0?(u(),r(`div`,b,[i(`div`,{class:`nc-modal-float ui modal visible transition active front`,ref_key:`modalRef`,ref:j,style:c(h(A)),onMousedown:B},[i(`i`,{class:`close icon nc-modal-close`,style:{cursor:`pointer`},onClick:q}),w.header?(u(),r(`div`,x,m(w.header),1)):n(``,!0),i(`div`,S,[h(D).apply?(u(),t(_,{key:0},{default:v(()=>[o(_,null,{default:v(()=>[o(d,{hdr:`hdr.apply.action`},{default:v(()=>[...l[2]||(l[2]=[a(`Action`,-1)])]),_:1})]),_:1}),o(_,{class:`nc-margin-top nc-space-between`,width:`40em`},{default:v(()=>[o(T,{model:`rec.apply.action`,value:`add`,hdr:`hdr.apply.add`},{default:v(()=>[...l[3]||(l[3]=[a(`Add`,-1)])]),_:1}),o(T,{model:`rec.apply.action`,value:`remove`,hdr:`hdr.apply.remove`},{default:v(()=>[...l[4]||(l[4]=[a(`Remove`,-1)])]),_:1}),o(T,{model:`rec.apply.action`,value:`modify`,hdr:`hdr.apply.modify`},{default:v(()=>[...l[5]||(l[5]=[a(`Modify`,-1)])]),_:1})]),_:1}),o(_,{class:`nc-margin-top`},{default:v(()=>[o(E,{model:`rec.apply.field`,hdr:`hdr.apply.field`},{default:v(()=>[...l[6]||(l[6]=[a(`Field`,-1)])]),_:1})]),_:1}),h(D).apply.action===`modify`?(u(),t(_,{key:0,class:`nc-margin-top`},{default:v(()=>[o(O,{model:`rec.apply.old_value`,hdr:`hdr.apply.old_value`},{default:v(()=>[...l[7]||(l[7]=[a(`Old value`,-1)])]),_:1})]),_:1})):n(``,!0),o(_,{class:`nc-margin-top`},{default:v(()=>[o(O,{model:`rec.apply.new_value`,hdr:`hdr.apply.new_value`},{default:v(()=>[...l[8]||(l[8]=[a(`New value`,-1)])]),_:1})]),_:1})]),_:1})):n(``,!0),h(D).link_grid?(u(),t(_,{key:1},{default:v(()=>[o(_,null,{default:v(()=>[o(d,{hdr:`hdr.link_grid.header`},{default:v(()=>[...l[9]||(l[9]=[a(`Header`,-1)])]),_:1})]),_:1}),o(_,null,{default:v(()=>[o(M,{id:`link_grid`,model:`grid.link_grid`,height:`60vh`,onGridRowClicked:G,onGridRowDoubleClicked:K})]),_:1})]),_:1})):(u(),t(_,{key:2,class:`nc-message-content`},{default:v(()=>[f(s.$slots,`default`)]),_:3}))]),y(i(`div`,C,[w.cancelText?(u(),t(N,{key:0,class:`deny nc-modal-button`,onClick:l[0]||(l[0]=e=>q())},{default:v(()=>[a(m(w.cancelText),1)]),_:1})):n(``,!0),w.okText?(u(),t(N,{key:1,class:`approve nc-modal-button`,disabled:h(D).apply&&h(D).apply.new_value===``||h(D).apply&&h(D).apply.action===`modify`&&h(D).apply.old_value===``,onClick:l[1]||(l[1]=e=>J())},{default:v(()=>[a(m(w.okText),1)]),_:1},8,[`disabled`])):n(``,!0)],512),[[g,k.closeOnClick!==!0&&w.cancelText&&w.okText]])],36)])):n(``,!0)]),_:3})}}});export{w as default};