import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{ot as t,ut as n}from"./element-plus-vendor-BF9PNysW.js";import{A as r,D as i,G as a,I as o,J as s,N as c,O as l,P as u,Pt as d,Tt as f,Xt as p,Z as m,et as h,ht as g,nt as _,qt as v,v as y,x as b,y as x}from"./vue-vendor-DMUmTARL.js";import{Er as S,Jn as C,Kr as w,rr as T}from"./icons-vendor-Db5MGAkr.js";import{t as E}from"./_plugin-vue_export-helper-CWyGVBf-.js";import{t as D}from"./sortable.esm-DjWnYUq1.js";import{t as O}from"./AutoIcon-SKvBA9uC.js";var k={class:`zf-sso-config-list`},A={class:`sso-config-list__header`},j={class:`min-w-0`},M={class:`sso-config-list__desc`},N=[`data-id`,`onClick`,`onKeydown`],P=[`onKeydown`],F={class:`sso-config-list__icon`},I={class:`sso-config-list__content`},L={class:`sso-config-list__name`},R={class:`sso-config-list__provider`},z={class:`sso-config-list__side`},B=[`onClick`],V=o({__name:`SsoConfigList`,props:{items:{},selectedId:{}},emits:[`update:selectedId`,`create`,`remove`,`reorder`],setup(e,{emit:o}){let E=o,V=e,H=f(),U=null,W=(e,t)=>{U?.option(`disabled`,!0),E(`reorder`,e,()=>U?.option(`disabled`,!1),()=>{t(),U?.option(`disabled`,!1)})},G=(e,t)=>{let n=e+t;if(n<0||n>=V.items.length)return;let r=[...V.items],[i]=r.splice(e,1);r.splice(n,0,i),W(r,()=>void 0)},K=()=>{!H.value||U||(U=D.create(H.value,{animation:150,handle:`.sso-config-list__drag-handle`,draggable:`.sso-config-list__item`,touchStartThreshold:5,fallbackTolerance:5,onEnd:({oldIndex:e,newIndex:t})=>{if(e==null||t==null||e===t)return;let n=[...V.items],[r]=n.splice(e,1);n.splice(t,0,r),W(n,()=>{U?.sort(V.items.map(e=>String(e.id)))})}}))};m(()=>a(K)),s(()=>U?.destroy());let q=e=>{E(`update:selectedId`,e.id)},J=e=>{e!==null&&E(`remove`,e)},Y=e=>e.identityConfigConfirmed===!1?`sso-config-list__status--pending`:e.enabled===!1?`sso-config-list__status--inactive`:`sso-config-list__status--active`,X=e=>e.identityConfigConfirmed===!1?`待确认`:e.enabled===!1?`已停用`:`已启用`;return(a,o)=>{let s=t,f=O,m=n;return h(),r(`aside`,k,[i(`div`,A,[i(`div`,j,[o[2]||=i(`h3`,{class:`sso-config-list__title`},`登录方式`,-1),i(`p`,M,`已配置 `+p(e.items.length)+` 种`,1)]),u(s,{type:`primary`,icon:d(T),class:`sso-config-list__add`,onClick:o[0]||=e=>E(`create`)},{default:g(()=>[...o[3]||=[c(` 新增登录方式 `,-1)]]),_:1},8,[`icon`])]),i(`div`,{ref_key:`listRef`,ref:H,class:`sso-config-list__items`},[(h(!0),r(b,null,_(e.items,(t,n)=>(h(),r(`div`,{key:String(t.id??t.provider),"data-id":String(t.id),role:`button`,tabindex:`0`,class:v([`sso-config-list__item group`,{"sso-config-list__item--active":t.id===e.selectedId}]),onClick:e=>q(t),onKeydown:y(e=>q(t),[`enter`])},[i(`button`,{type:`button`,class:`sso-config-list__drag-handle`,"aria-label":`拖拽调整登录方式顺序`,title:`拖拽调整顺序`,onClick:o[1]||=x(()=>{},[`stop`]),onKeydown:[y(x(e=>G(n,-1),[`stop`,`prevent`]),[`up`]),y(x(e=>G(n,1),[`stop`,`prevent`]),[`down`])]},[u(d(C),{class:`h-5 w-5`})],40,P),i(`div`,F,[t.icon?(h(),l(f,{key:0,icon:String(t.icon),"click-preview":!1,class:`h-10 w-10`},null,8,[`icon`])):(h(),l(d(S),{key:1,class:`h-7 w-7 text-placeholder`}))]),i(`div`,I,[i(`div`,L,p(t.name||`未命名登录方式`),1),i(`div`,R,p(t.provider||`-`),1)]),i(`div`,z,[i(`div`,{class:v([`sso-config-list__status`,Y(t)])},[o[4]||=i(`span`,{class:`sso-config-list__status-dot`},null,-1),c(` `+p(X(t)),1)],2),u(m,{content:`删除`},{default:g(()=>[i(`button`,{type:`button`,class:`sso-config-list__delete`,onClick:x(e=>J(t.id),[`stop`])},[u(d(w),{class:`h-4 w-4`})],8,B)]),_:2},1024)])],42,N))),128))],512)])}}}),H=e({default:()=>U}),U=E(V,[[`__scopeId`,`data-v-65794f2f`]]);export{H as n,U as t};