import{r as t,f as o,h as s,H as i,d as n}from"./p-23450e8b.js";import{c as e,h as a}from"./p-b2d007f6.js";import{g as r}from"./p-1e77b5bd.js";const l=":host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;flex-wrap:wrap;align-items:center}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator ion-icon{color:var(--ion-color-contrast)}:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator{background:rgba(var(--ion-color-contrast-rgb), 0.11)}:host(.in-toolbar){-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px;padding-top:0;padding-bottom:0;justify-content:center}";const d=":host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;flex-wrap:wrap;align-items:center}:host(.in-toolbar-color),:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator ion-icon{color:var(--ion-color-contrast)}:host(.in-toolbar-color) .breadcrumbs-collapsed-indicator{background:rgba(var(--ion-color-contrast-rgb), 0.11)}:host(.in-toolbar){-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0}";const c=class{constructor(s){t(this,s);this.ionCollapsedClick=o(this,"ionCollapsedClick",7);this.breadcrumbsInit=()=>{this.setBreadcrumbSeparator();this.setMaxItems()};this.resetActiveBreadcrumb=()=>{const t=this.getBreadcrumbs();const o=t.find((t=>t.active));if(o&&this.activeChanged){o.active=false}};this.setMaxItems=()=>{const{itemsAfterCollapse:t,itemsBeforeCollapse:o,maxItems:s}=this;const i=this.getBreadcrumbs();for(const t of i){t.showCollapsedIndicator=false;t.collapsed=false}const n=s!==undefined&&i.length>s&&o+t<=s;if(n){i.forEach(((s,n)=>{if(n===o){s.showCollapsedIndicator=true}if(n>=o&&n<i.length-t){s.collapsed=true}}))}};this.setBreadcrumbSeparator=()=>{const{itemsAfterCollapse:t,itemsBeforeCollapse:o,maxItems:s}=this;const i=this.getBreadcrumbs();const n=i.find((t=>t.active));for(const e of i){const a=s!==undefined&&t===0?e===i[o]:e===i[i.length-1];e.last=a;const r=e.separator!==undefined?e.separator:a?undefined:true;e.separator=r;if(!n&&a){e.active=true;this.activeChanged=true}}};this.getBreadcrumbs=()=>Array.from(this.el.querySelectorAll("ion-breadcrumb"));this.slotChanged=()=>{this.resetActiveBreadcrumb();this.breadcrumbsInit()};this.collapsed=undefined;this.activeChanged=undefined;this.color=undefined;this.maxItems=undefined;this.itemsBeforeCollapse=1;this.itemsAfterCollapse=1}onCollapsedClick(t){const o=this.getBreadcrumbs();const s=o.filter((t=>t.collapsed));this.ionCollapsedClick.emit(Object.assign(Object.assign({},t.detail),{collapsedBreadcrumbs:s}))}maxItemsChanged(){this.resetActiveBreadcrumb();this.breadcrumbsInit()}componentWillLoad(){this.breadcrumbsInit()}render(){const{color:t,collapsed:o}=this;const n=r(this);return s(i,{class:e(t,{[n]:true,"in-toolbar":a("ion-toolbar",this.el),"in-toolbar-color":a("ion-toolbar[color]",this.el),"breadcrumbs-collapsed":o})},s("slot",{onSlotchange:this.slotChanged}))}get el(){return n(this)}static get watchers(){return{maxItems:["maxItemsChanged"],itemsBeforeCollapse:["maxItemsChanged"],itemsAfterCollapse:["maxItemsChanged"]}}};c.style={ios:l,md:d};export{c as ion_breadcrumbs};
//# sourceMappingURL=p-986e3a20.entry.js.map