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,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;aAC3C;iBAAM;gBACL,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;aACtC;SACF,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,EAAC,QAAQ,uDACP,4DAAK,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,YAAY,gBAAa,IAAI,CAAC,KAAK,IACxD,6DAAM,YAAY,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,GAAS,CACtD,EACN,4DAAK,IAAI,EAAC,WAAW,EAAC,MAAM,uBAAa,MAAM,IAC7C,6DAAM,IAAI,EAAC,WAAW,IACpB,gEAAS,IAAI,EAAC,eAAe,GAAW,CACnC,CACH,CACG,EACX;KACH;;;;;;;","names":[],"sources":["src/components/ui/breadcrumbs/sc-breadcrumbs.css?tag=sc-breadcrumbs&encapsulation=shadow","src/components/ui/breadcrumbs/sc-breadcrumbs.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n","import { Component, h, Fragment, Prop, Element } from '@stencil/core';\n\n/**\n * @part base - The elements base wrapper.\n * @part separator - The separator.\n */\n@Component({\n tag: 'sc-breadcrumbs',\n styleUrl: 'sc-breadcrumbs.css',\n shadow: true,\n})\nexport class ScBreadcrumbs {\n @Element() el: HTMLElement;\n /**\n * The label to use for the breadcrumb control. This will not be shown, but it will be announced by screen readers and\n * other assistive devices.\n */\n @Prop() label = 'Breadcrumb';\n\n // Generates a clone of the separator element to use for each breadcrumb item\n private getSeparator() {\n const slotted = this.el.shadowRoot.querySelector('slot[name=separator]') as HTMLSlotElement;\n const separator = slotted.assignedElements({ flatten: true })[0] as HTMLElement;\n\n // Clone it, remove ids, and slot it\n const clone = separator.cloneNode(true) as HTMLElement;\n\n [clone, ...clone.querySelectorAll('[id]')].forEach(el => el.removeAttribute('id'));\n clone.slot = 'separator';\n\n return clone;\n }\n\n handleSlotChange() {\n const slotted = this.el.shadowRoot.querySelector('.breadcrumb slot') as HTMLSlotElement;\n const items = slotted.assignedElements().filter(node => {\n return node.nodeName === 'CE-BREADCRUMB';\n }) as HTMLScBreadcrumbElement[];\n\n items.forEach((item, index) => {\n // Append separators to each item if they don't already have one\n const separator = item.querySelector('[slot=\"separator\"]');\n if (separator === null) {\n item.append(this.getSeparator());\n }\n\n // The last breadcrumb item is the \"current page\"\n if (index === items.length - 1) {\n item.setAttribute('aria-current', 'page');\n } else {\n item.removeAttribute('aria-current');\n }\n });\n }\n\n render() {\n return (\n <Fragment>\n <nav part=\"base\" class=\"breadcrumb\" aria-label={this.label}>\n <slot onSlotchange={() => this.handleSlotChange()}></slot>\n </nav>\n <div part=\"separator\" hidden aria-hidden=\"true\">\n <slot name=\"separator\">\n <sc-icon name=\"chevron-right\"></sc-icon>\n </slot>\n </div>\n </Fragment>\n );\n }\n}\n"],"version":3}