import{makeGlobalSize as t,makeStyleResponsive as s,template as m}from"@gem-sdk/core";import{createAttr as e,createClass as r,createStyle as o,Liquid as a,LiquidUnless as l}from"@gem-sdk/system";import{BreadcrumbItem as i}from"./BreadcrumbItem.liquid.js";import{getAttr as p,getNavAttr as c}from"../common/attrs.js";import{getBreadcrumbClasses as n,getNavClasses as d}from"../common/classes.js";import{getBreadcrumbStyles as f,getSpacingStyles as E}from"../common/styles.js";import{ShopifyTemplate as O}from"../types.js";import{SHOPIFY_TEMPLATE_BREADCRUMB_LENGTH as u,SHOPIFY_TEMPLATE_BREADCRUMB_ITEM_INDEX as T}from"../constants.js";let Breadcrumb=({setting:$={},builderAttrs:j,style:b,styles:g={},className:H,builderProps:M,advanced:C})=>{let I=[O.HOME,O.LANDING,O.PRODUCT,O.COLLECTION,O.ARTICLE],{spacing:L,align:y,background:v}=$??{},A=I.map(t=>i({lengthOfBreadcrumb:t===O.HOME?u.HOME:u.OTHERS_TEMPLATE,breadcrumbItemIndex:t===O.HOME?T.HOME:T.OTHERS_TEMPLATE,templateName:t,setting:$,styles:g})).join(""),B=e({...p({uid:M?.uid??"",builderAttrs:j})}),N=r({...n(H),...C?.cssClass&&{[C.cssClass]:!0}}),R=o({...f(b,{background:v,align:y})}),P=r({...d()}),S=e({...c()}),k=o({...t($?.globalSize).padding,...E(L),...s("jc",y)});return a(m`
    <div ${{...B}}
      style="${R}"
      class="${N}">
      ${l("template == 'cart' or template == 'list-collections' or template == '404'",m`
        ${a(`
          {% assign tpl = template %}
          {% if tpl contains '.' %}
            {% assign tpl = tpl | split: '.' | first %}
          {% endif %}
        `)}
        <nav style="${k}" class="${P}" ${{...S}}>
          ${A}
        </nav>
      `)}
  </div>`)};export{Breadcrumb as default};
