import{J,d6 as Z,cn as z,bm as W,co as X,aa as C,K as Y,bn as p,r as L,aZ as ee,cs as te,c as i,ac as m,d3 as ne,ah as ae,O as n,n as _,g as oe,j as ie,ak as le,aE as ue,k as w,h as x,m as y,aG as ce}from"./index-CS0Lg7FU.js";import{Q as de}from"./QSlideTransition-DQjAxkfH.js";const u=Z({}),se=Object.keys(C),ve=J({name:"QExpansionItem",props:{...C,...X,...W,icon:String,label:String,labelLines:[Number,String],caption:String,captionLines:[Number,String],dense:Boolean,toggleAriaLabel:String,expandIcon:String,expandedIcon:String,expandIconClass:[Array,String,Object],duration:{},headerInsetLevel:Number,contentInsetLevel:Number,expandSeparator:Boolean,defaultOpened:Boolean,hideExpandIcon:Boolean,expandIconToggle:Boolean,switchToggleSide:Boolean,denseToggle:Boolean,group:String,popup:Boolean,headerStyle:[Array,String,Object],headerClass:[Array,String,Object]},emits:[...z,"click","afterShow","afterHide"],setup(e,{slots:g,emit:v}){const{proxy:{$q:c}}=Y(),f=p(e,c),a=L(e.modelValue!==null?e.modelValue:e.defaultOpened),S=L(null),h=ee(),{show:A,hide:I,toggle:b}=te({showing:a});let l,d;const O=i(()=>`q-expansion-item q-item-type q-expansion-item--${a.value===!0?"expanded":"collapsed"} q-expansion-item--${e.popup===!0?"popup":"standard"}`),Q=i(()=>e.contentInsetLevel===void 0?null:{["padding"+(c.lang.rtl===!0?"Right":"Left")]:e.contentInsetLevel*56+"px"}),s=i(()=>e.disable!==!0&&(e.href!==void 0||e.to!==void 0&&e.to!==null&&e.to!=="")),B=i(()=>{const t={};return se.forEach(o=>{t[o]=e[o]}),t}),j=i(()=>s.value===!0||e.expandIconToggle!==!0),E=i(()=>e.expandedIcon!==void 0&&a.value===!0?e.expandedIcon:e.expandIcon||c.iconSet.expansionItem[e.denseToggle===!0?"denseIcon":"icon"]),P=i(()=>e.disable!==!0&&(s.value===!0||e.expandIconToggle===!0)),H=i(()=>({expanded:a.value===!0,detailsId:h.value,toggle:b,show:A,hide:I})),T=i(()=>{const t=e.toggleAriaLabel!==void 0?e.toggleAriaLabel:c.lang.label[a.value===!0?"collapse":"expand"](e.label);return{role:"button","aria-expanded":a.value===!0?"true":"false","aria-controls":h.value,"aria-label":t}});m(()=>e.group,t=>{d?.(),t!==void 0&&q()});function N(t){s.value!==!0&&b(t),v("click",t)}function R(t){t.keyCode===13&&k(t,!0)}function k(t,o){o!==!0&&t.qAvoidFocus!==!0&&S.value?.focus(),b(t),ce(t)}function D(){v("afterShow")}function G(){v("afterHide")}function q(){l===void 0&&(l=ne()),a.value===!0&&(u[e.group]=l);const t=m(a,r=>{r===!0?u[e.group]=l:u[e.group]===l&&delete u[e.group]}),o=m(()=>u[e.group],(r,F)=>{F===l&&r!==void 0&&r!==l&&I()});d=()=>{t(),o(),u[e.group]===l&&delete u[e.group],d=void 0}}function K(){const t={class:[`q-focusable relative-position cursor-pointer${e.denseToggle===!0&&e.switchToggleSide===!0?" items-end":""}`,e.expandIconClass],side:e.switchToggleSide!==!0,avatar:e.switchToggleSide},o=[n(y,{class:"q-expansion-item__toggle-icon"+(e.expandedIcon===void 0&&a.value===!0?" q-expansion-item__toggle-icon--rotated":""),name:E.value})];return P.value===!0&&(Object.assign(t,{tabindex:0,...T.value,onClick:k,onKeyup:R}),o.unshift(n("div",{ref:S,class:"q-expansion-item__toggle-focus q-icon q-focus-helper q-focus-helper--rounded",tabindex:-1}))),n(x,t,()=>o)}function $(){let t;return g.header!==void 0?t=[].concat(g.header(H.value)):(t=[n(x,()=>[n(w,{lines:e.labelLines},()=>e.label||""),e.caption?n(w,{lines:e.captionLines,caption:!0},()=>e.caption):null])],e.icon&&t[e.switchToggleSide===!0?"push":"unshift"](n(x,{side:e.switchToggleSide===!0,avatar:e.switchToggleSide!==!0},()=>n(y,{name:e.icon})))),e.disable!==!0&&e.hideExpandIcon!==!0&&t[e.switchToggleSide===!0?"unshift":"push"](K()),t}function M(){const t={ref:"item",style:e.headerStyle,class:e.headerClass,dark:f.value,disable:e.disable,dense:e.dense,insetLevel:e.headerInsetLevel};return j.value===!0&&(t.clickable=!0,t.onClick=N,Object.assign(t,s.value===!0?B.value:T.value)),n(oe,t,$)}function U(){return ie(n("div",{key:"e-content",class:"q-expansion-item__content relative-position",style:Q.value,id:h.value},ue(g.default)),[[le,a.value]])}function V(){const t=[M(),n(de,{duration:e.duration,onShow:D,onHide:G},U)];return e.expandSeparator===!0&&t.push(n(_,{class:"q-expansion-item__border q-expansion-item__border--top absolute-top",dark:f.value}),n(_,{class:"q-expansion-item__border q-expansion-item__border--bottom absolute-bottom",dark:f.value})),t}return e.group!==void 0&&q(),ae(()=>{d?.()}),()=>n("div",{class:O.value},[n("div",{class:"q-expansion-item__container relative-position"},V())])}});export{ve as Q};
