import{bT as X,p as Y,bU as C,N as z,O as F,Q as J,R as Z,r as w,bV as p,U as ee,c as i,w as x,e as te,h as n,bW as ne,bX as _,g as ae,f as oe,bY as ie,q as le,av as k,L as ue}from"./index-BT5eY4j5.js";import{b as ce,a as y,Q as S}from"./QItem-9vG9WSh3.js";import{Q as de}from"./QSlideTransition-CiZznvmX.js";const u=X({}),re=Object.keys(C),fe=Y({name:"QExpansionItem",props:{...C,...z,...F,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:[...J,"click","afterShow","afterHide"],setup(e,{slots:g,emit:v}){const{proxy:{$q:d}}=ae(),f=Z(e,d),a=w(e.modelValue!==null?e.modelValue:e.defaultOpened),b=w(null),h=p(),{show:Q,hide:I,toggle:m}=ee({showing:a});let l,c;const A=i(()=>`q-expansion-item q-item-type q-expansion-item--${a.value===!0?"expanded":"collapsed"} q-expansion-item--${e.popup===!0?"popup":"standard"}`),O=i(()=>e.contentInsetLevel===void 0?null:{["padding"+(d.lang.rtl===!0?"Right":"Left")]:e.contentInsetLevel*56+"px"}),r=i(()=>e.disable!==!0&&(e.href!==void 0||e.to!==void 0&&e.to!==null&&e.to!=="")),B=i(()=>{const t={};return re.forEach(o=>{t[o]=e[o]}),t}),P=i(()=>r.value===!0||e.expandIconToggle!==!0),j=i(()=>e.expandedIcon!==void 0&&a.value===!0?e.expandedIcon:e.expandIcon||d.iconSet.expansionItem[e.denseToggle===!0?"denseIcon":"icon"]),E=i(()=>e.disable!==!0&&(r.value===!0||e.expandIconToggle===!0)),H=i(()=>({expanded:a.value===!0,detailsId:h.value,toggle:m,show:Q,hide:I})),T=i(()=>{const t=e.toggleAriaLabel!==void 0?e.toggleAriaLabel:d.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}});x(()=>e.group,t=>{c!==void 0&&c(),t!==void 0&&L()});function N(t){r.value!==!0&&m(t),v("click",t)}function R(t){t.keyCode===13&&q(t,!0)}function q(t,o){o!==!0&&b.value!==null&&b.value.focus(),m(t),ue(t)}function D(){v("afterShow")}function U(){v("afterHide")}function L(){l===void 0&&(l=ne()),a.value===!0&&(u[e.group]=l);const t=x(a,s=>{s===!0?u[e.group]=l:u[e.group]===l&&delete u[e.group]}),o=x(()=>u[e.group],(s,W)=>{W===l&&s!==void 0&&s!==l&&I()});c=()=>{t(),o(),u[e.group]===l&&delete u[e.group],c=void 0}}function $(){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(k,{class:"q-expansion-item__toggle-icon"+(e.expandedIcon===void 0&&a.value===!0?" q-expansion-item__toggle-icon--rotated":""),name:j.value})];return E.value===!0&&(Object.assign(t,{tabindex:0,...T.value,onClick:q,onKeyup:R}),o.unshift(n("div",{ref:b,class:"q-expansion-item__toggle-focus q-icon q-focus-helper q-focus-helper--rounded",tabindex:-1}))),n(S,t,()=>o)}function G(){let t;return g.header!==void 0?t=[].concat(g.header(H.value)):(t=[n(S,()=>[n(y,{lines:e.labelLines},()=>e.label||""),e.caption?n(y,{lines:e.captionLines,caption:!0},()=>e.caption):null])],e.icon&&t[e.switchToggleSide===!0?"push":"unshift"](n(S,{side:e.switchToggleSide===!0,avatar:e.switchToggleSide!==!0},()=>n(k,{name:e.icon})))),e.disable!==!0&&e.hideExpandIcon!==!0&&t[e.switchToggleSide===!0?"unshift":"push"]($()),t}function K(){const t={ref:"item",style:e.headerStyle,class:e.headerClass,dark:f.value,disable:e.disable,dense:e.dense,insetLevel:e.headerInsetLevel};return P.value===!0&&(t.clickable=!0,t.onClick=N,Object.assign(t,r.value===!0?B.value:T.value)),n(ce,t,G)}function M(){return oe(n("div",{key:"e-content",class:"q-expansion-item__content relative-position",style:O.value,id:h.value},le(g.default)),[[ie,a.value]])}function V(){const t=[K(),n(de,{duration:e.duration,onShow:D,onHide:U},M)];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&&L(),te(()=>{c!==void 0&&c()}),()=>n("div",{class:A.value},[n("div",{class:"q-expansion-item__container relative-position"},V())])}});export{fe as Q};
