var fe=Object.defineProperty;var ee=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var te=(d,c,i)=>c in d?fe(d,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):d[c]=i,se=(d,c)=>{for(var i in c||(c={}))he.call(c,i)&&te(d,i,c[i]);if(ee)for(var i of ee(c))ve.call(c,i)&&te(d,i,c[i]);return d};var ne=(d,c,i)=>new Promise((f,D)=>{var C=m=>{try{k(i.next(m))}catch(x){D(x)}},A=m=>{try{k(i.throw(m))}catch(x){D(x)}},k=m=>m.done?f(m.value):Promise.resolve(m.value).then(C,A);k((i=i.apply(d,c)).next())});import{cs as Ce,b4 as ye,ct as le,cu as _e,b3 as ge,cr as xe,ai as ae,a3 as be,cv as ke,aj as Le,cw as oe,co as we,bb as Ee,d as De,r as q,u as Ae,A as Me,bg as ie,o as p,X as h,b as _,w as F,a as n,a0 as J,Y as ue,ab as v,bA as b,c as Q,t as W,Q as U,e as r,U as Se,R as ce,S as T,k as Fe,cx as Te,b9 as Be,n as B,f as Ne,l as Ve,B as Re,p as je,m as ze,_ as $e}from"./index.6c36cb53.js";import{M as Oe}from"./index.a696a3d7.js";import Ue from"./index.1a43d021.js";import{c as Ie}from"./math.58b544d2.js";import{V as Ke}from"./VTable.c59a0e01.js";const pe=Ce(),{add:He,remove:re,putCurrent:de,toggle:Pe,setValue:w,setIndex:E,getIndex:me,stringifyJSON:qe,create:Et,initLayerList:Je,setLayerList:Qe}=pe,{index:u,list:g,currentLayer:We,rootId:X}=ye(pe),Xe=({onAddLayer:d})=>{const c=le("Shift"),i=le("Control"),f=()=>Array.isArray(u.value)&&u.value.length>1,D=(t,s,...e)=>{const[a,o,Z]=e;if(c.value||i.value)return t.preventDefault();if(!s.isSelect)return w(a,o,Z);if(f())return t.stopPropagation(),w(a,o),!1;w(a,o,Z)};let C;const A=(t,s)=>{if(s&&s.target&&V(s.target),c.value){typeof C=="undefined"&&(C=u.value);const e=Math.max(C,t);E(Ie(e===t?C:t,e));return}if(i.value){let e=[];if(Array.isArray(u.value)){const a=u.value.indexOf(t);a>=0&&u.value.length>1?(e=[...u.value],e.splice(a,1)):e=[...u.value,t]}else e=[u.value,t];E(e);return}E(t),C=t,x()},k=(t,s)=>{(!f()||!g.value[t].isSelect)&&A(t,s)};let m;const x=()=>{Array.isArray(u.value)?m=u.value[u.value.length-1]:m=u.value},N=()=>{d&&d(He()),c&&(C=g.value.length-1)};let L;const V=t=>{if(t)if(t.tagName==="INPUT")L=t;else{let e=t==null?void 0:t.getElementsByTagName("input")[0];e?L=e:V(t.parentNode)}},R=t=>{const s=me();if(Array.isArray(s)&&s.length>1)return;const e=Array.isArray(s)?s[0]:s;We.value!==g.value[e]&&g.value[e].id!==X.value&&t&&setTimeout(()=>{t.focus(),t.select()})},K=(t,s)=>{L=t.target,u.value===s&&R(L)},H=()=>{m&&E(m),m=void 0},Y=()=>{E(g.value.map((t,s)=>s))},G=()=>{E([]),x()},j=()=>{const t=Array.isArray(u.value)?u.value:[u.value];let s=[];x(),Pe("isSelect",g.value.map((e,a)=>(t.includes(a)||s.push(a),a))),u.value=s},M=_e({hasIcon:!0,iconType:"svg-icon",menuList:[{label:"\u7F6E\u4E3A\u5F53\u524D",fn:()=>de(),disabled:f},{label:"\u65B0\u5EFA\u56FE\u5C42",fn:()=>N()},{label:"\u5220\u9664",fn:()=>re(),disabled:()=>{var s;if(f())return!1;let t=me(u.value);return t=typeof t=="number"?t:t[0],((s=g.value[t])==null?void 0:s.id)===X.value},icon:oe("youjianshanchu")},{label:"\u91CD\u547D\u540D",tips:"F2",fn:()=>R(L),disabled:f,icon:oe("youjianzhongmingming")},{line:!0},{label:"\u5168\u90E8\u9009\u62E9",fn:()=>Y()},{label:"\u5168\u90E8\u6E05\u9664",fn:()=>G()},{label:"\u53CD\u8F6C\u9009\u62E9",fn:()=>j()}]}),{createColor:z}=ge(),$=t=>{we("Mx_Color",{call:(s,e)=>{w("color",z(se({},Ee(s,e))),u)},color:t})};xe();const P=t=>{w("lineType",t,u)};let S=!1;const O=t=>{t=typeof t=="boolean"?t:S,w("visible",t,g.value.map((s,e)=>e)),S=!t,y[3].name=S?"\u5F00\u542F\u6240\u6709\u56FE\u5C42":"\u5173\u95ED\u6240\u6709\u56FE\u5C42"};ae.addCommand("_OpenAllLayer",()=>{O(!0),l()}),ae.addCommand("_SelOffLayer",()=>ne(void 0,null,function*(){(yield be.userSelect("\u9009\u62E9\u9700\u8981\u5173\u95ED\u56FE\u5C42\u7684\u5B9E\u4F53")).forEach(s=>{if(s.type===ke.kMxCAD){const e=s.getMcDbEntity();if(!e)return;e.layer;const a=g.value.findIndex(({name:o})=>o===e.layer);a>=0&&w("visible",!1,a)}}),l()}));const y=Le([{name:"\u65B0\u589E\u56FE\u5C42",fun:()=>{N()}},{name:"\u5220\u9664\u56FE\u5C42",fun:()=>re()},{name:"\u7F6E\u4E3A\u5F53\u524D",fun:()=>de()},{name:"\u5173\u95ED\u6240\u6709\u56FE\u5C42",fun:()=>O()}]),l=()=>{Qe(qe())};return{onClickLayer:A,onClickStopTD:D,onClickLayerName:K,resumeIndex:H,reverseSelection:j,selectColor:$,selectLineType:P,setIndex:E,onRightClickLayer:k,initLayerList:Je,setLayerList:l,list:g,bodyRightClickMenuOptions:M,isShiftKeyMultipleChoice:c,isCtrlKeyMultipleChoice:i,btnList:y,rootId:X}},I=d=>(je("data-v-74b9c53c"),d=d(),ze(),d),Ye={class:"d-flex align-center my-2"},Ge=I(()=>n("thead",{class:"w-100",style:{"z-index":"1"}},[n("tr",{class:"w-100"},[n("th",{class:"w-20"},[n("div",{style:{width:"10px"},class:"d-inline-block"}),B(),n("span",null," \u56FE\u5C42\u540D\u79F0")]),n("th",{class:""},"\u53EF\u89C1"),n("th",{class:""},"\u51BB\u7ED3"),n("th",{class:""},"\u9501\u5B9A"),n("th",{class:""},"\u6253\u5370"),n("th",{class:"w-20"},"\u989C\u8272"),n("th",{class:"w-20"},"\u7EBF\u6027")])],-1)),Ze={class:"w-100",ref:"tbody"},et=["id","onClick","onContextmenu"],tt={class:"text-no-wrap"},st={style:{width:"18px"},class:"d-inline-block"},nt={class:"d-inline-block"},lt=["disabled","onClick","onUpdate:modelValue"],at=["onClick"],ot=["onClick"],it=["onClick"],ut=["onClick"],ct=["onClick"],rt=["onClick"],dt={class:"w-100 my-3",cellpadding:"20"},mt={class:"w-100"},pt={class:"w-100"},ft=I(()=>n("th",{class:"w-20"},null,-1)),ht={class:"w-auto px-6"},vt=I(()=>n("th",{class:"w-50"},null,-1)),Ct={class:"d-flex justify-end w-auto"},yt=I(()=>n("div",{class:"mt-1"},null,-1)),_t=De({__name:"index",setup(d){const c=q(),{onClickLayer:i,onClickStopTD:f,onClickLayerName:D,resumeIndex:C,reverseSelection:A,selectColor:k,selectLineType:m,setIndex:x,onRightClickLayer:N,initLayerList:L,setLayerList:V,list:R,bodyRightClickMenuOptions:K,btnList:H,isShiftKeyMultipleChoice:Y,isCtrlKeyMultipleChoice:G,rootId:j}=Xe({onAddLayer(){var t;const l=((t=c.value)==null?void 0:t.$el).getElementsByClassName("v-table__wrapper")[0];Re(()=>{l.scrollTo({top:l.scrollHeight-l.clientHeight,behavior:"smooth"})})}}),{isShow:M,showDialog:z}=Ae(!1,"MxLayerManager");Me(M,y=>{y&&L()});const $=q([]),P=y=>{const{map:l}=y($.value,(t,s)=>s);l.length>0&&x(l)},S=q(),O=y=>{var l;(l=S.value)==null||l.showDialog(!0,y)};return(y,l)=>{const t=ie("box-selection"),s=ie("right-click-menu");return p(),h(J,null,[_(Oe,{maxWidth:"800",ref:"layerDialog",modelValue:r(M),"onUpdate:modelValue":l[4]||(l[4]=e=>Ve(M)?M.value=e:null),title:"\u56FE\u5C42\u7279\u6027\u7BA1\u7406\u5668"},{actions:F(()=>[yt]),default:F(()=>[n("div",Ye,[(p(!0),h(J,null,ue(r(H),(e,a)=>v((p(),Q(U,{onClick:e.fun,ripple:!1,class:"mx-2 px-2 bg-undertint-bg",variant:"text",key:e.name+a,textContent:W(e.name)},null,8,["onClick","textContent"])),[[b,void 0,void 0,{center:!0}]])),128))]),v((p(),Q(r(Ke),{class:"w-100 layer-table",height:"300",ref_key:"boxRef",ref:c,onClick:l[0]||(l[0]=e=>r(C)())},{default:F(()=>[Ge,v((p(),h("tbody",Ze,[(p(!0),h(J,null,ue(r(R),(e,a)=>(p(),h("tr",{class:Se(["text-center layer-info",e.isSelect?"active":""]),ref_for:!0,ref_key:"refItems",ref:$,key:e.id,id:e.id.toString(),onClick:ce(o=>r(i)(a),["prevent"]),onContextmenu:ce(o=>r(N)(a,o),["prevent"])},[v((p(),h("td",tt,[n("div",st,[e.status?(p(),Q(T,{key:0,icon:"class:iconfont gou",size:"x-small",color:"#16FD21"})):Fe("",!0)]),n("label",nt,[v(n("input",{disabled:e.id===r(j),class:"text-truncate text-center",type:"text",onClick:o=>r(D)(o,a),"onUpdate:modelValue":o=>e.name=o},null,8,lt),[[Te,e.name]])])])),[[b]]),v((p(),h("td",{class:"text-orange",onClick:o=>r(f)(o,e,"visible",!e.visible,a)},[_(T,{icon:e.visible?"yanjing1":"yanjing"},null,8,["icon"])],8,at)),[[b,void 0,void 0,{prevent:!0}]]),v((p(),h("td",{class:"text-orange",onClick:o=>r(f)(o,e,"freeze",!e.freeze,a)},[_(T,{icon:e.freeze?"ziyuan":"taiyang"},null,8,["icon"])],8,ot)),[[b]]),v((p(),h("td",{class:"text-orange",onClick:o=>r(f)(o,e,"lock",!e.lock,a)},[_(T,{icon:e.lock?"suo":"jiesuo1"},null,8,["icon"])],8,it)),[[b]]),v((p(),h("td",{onClick:o=>r(f)(o,e,"print",!e.print,a)},[_(T,{icon:e.print?"dayin":"budayinbiaoqian",size:"x-small"},null,8,["icon"])],8,ut)),[[b]]),v((p(),h("td",{class:"d-flex align-center justify-center",onClick:o=>r(k)(e.color)},[n("div",{class:"colorBox mr-2",style:Be({background:`${e.color.color}`})},null,4),n("span",null,W(e.color.name),1)],8,ct)),[[b]]),v((p(),h("td",{class:"w-20 text-truncate",onClick:o=>O(e.lineType)},[B(W(e.lineType.name),1)],8,rt)),[[b]])],42,et))),128))])),[[t,P]])]),_:1})),[[s,r(K)]]),_(Ne,{color:"#576375",class:"border-opacity-75"}),n("table",dt,[n("thead",mt,[n("tr",pt,[ft,n("th",ht,[_(U,{class:"bg-undertint-bg","min-width":"76",onClick:l[1]||(l[1]=e=>r(A)())},{default:F(()=>[B("\u53CD\u9009")]),_:1})]),vt,n("th",Ct,[_(U,{class:"bg-light-blue-darken-1","min-width":"76",onClick:l[2]||(l[2]=e=>(r(V)(),r(z)(!1)))},{default:F(()=>[B("\u786E\u5B9A")]),_:1}),_(U,{class:"ml-10 mr-6 bg-undertint-bg","min-width":"76",onClick:l[3]||(l[3]=e=>r(z)())},{default:F(()=>[B("\u5173\u95ED")]),_:1})])])])])]),_:1},8,["modelValue"]),_(Ue,{ref_key:"linearManager",ref:S,onChange:r(m)},null,8,["onChange"])],64)}}});const Dt=$e(_t,[["__scopeId","data-v-74b9c53c"]]);export{Dt as default};