{"version":3,"sources":["jsdelivr-header.js","/gh/studioreveuse/sqsProductAccordion@2.2.1/javascript.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACFA,SAAS,iBAAiB,mBAAoB,KAC5C,MAAM,EAAY,SAAS,cAAc,iFACzC,IAAK,EAAW,OAGhB,MAAM,EAAU,CACd,sCACA,sCACA,sCACA,yCAGI,EAAwB,SAAS,iBAAiB,2BACxD,IAAI,EAAuB,KAO3B,GANA,EAAsB,QAAQ,IACxB,EAAQ,cAAc,EAAQ,KAAK,SACrC,EAAuB,MAItB,EAAsB,OAE3B,MAAM,EAAY,EAAqB,cAAc,wBACrD,IAAK,EAAW,OAIhB,GAA0B,YAFA,OAAO,0BAA4B,SAEzB,CAClC,MAAM,EAAW,EAAqB,cAAc,qBAChD,GAAY,EAAS,wBAAwB,GAAa,KAAK,4BACjE,EAAS,sBAAsB,cAAe,GAE9C,EAAU,sBAAsB,cAAe,EAEnD,MACE,EAAU,sBAAsB,WAAY,GAI9C,MAAM,EAAQ,SAAS,cAAc,SACrC,EAAM,YAAc,qFACpB,SAAS,KAAK,YAAY,GAG1B,MAAM,EAAwB,SAAS,cAAc,+CACrD,GAAI,EAAuB,CACzB,MAAM,EAAgB,EAAsB,iBAAiB,0BAE7D,GADiB,EAAc,OAAS,GAAK,IAAI,GAAe,MAAM,GAAmC,IAA1B,EAAM,SAAS,QAChF,CACZ,MAAM,EAAc,EAAsB,QAAQ,iBAC9C,GACF,EAAY,UAAU,IAAI,iCAE9B,CACF,CAEA,QAAQ,IAAI","file":"/gh/studioreveuse/sqsProductAccordion@2.2.1/javascript.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /gh/studioreveuse/sqsProductAccordion@2.2.1/javascript.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*==========\n  Squarespace Product V2.2.1 - Product Accordion Plugin\n  Copyright Studio Rêveuse\n========== */\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n  const accordion = document.querySelector(\".ProductItem-additional .accordion-block, #accordion-section .accordion-block\");\n  if (!accordion) return;\n\n  // Layout selectors\n  const layouts = [\n    '[data-product-detail-layout=\"wrap\"]',\n    '[data-product-detail-layout=\"full\"]',\n    '[data-product-detail-layout=\"half\"]',\n    '[data-product-detail-layout=\"simple\"]'\n  ];\n\n  const productDetailSections = document.querySelectorAll(\".product-detail-section\");\n  let productDetailSection = null;\n  productDetailSections.forEach(section => {\n    if (section.querySelector(layouts.join(\", \"))) {\n      productDetailSection = section;\n    }\n  });\n\n  if (!productDetailSection) return;\n\n  const addToCart = productDetailSection.querySelector(\".product-add-to-cart\");\n  if (!addToCart) return;\n\n  const accordionPosition = window.productAccordionPosition || \"after\";\n\n  if (accordionPosition === \"before\") {\n    const variants = productDetailSection.querySelector(\".product-variants\");\n    if (variants && variants.compareDocumentPosition(addToCart) & Node.DOCUMENT_POSITION_FOLLOWING) {\n      variants.insertAdjacentElement(\"beforebegin\", accordion);\n    } else {\n      addToCart.insertAdjacentElement(\"beforebegin\", accordion);\n    }\n  } else {\n    addToCart.insertAdjacentElement(\"afterend\", accordion);\n  }\n\n  // Inject style into head\n  const style = document.createElement(\"style\");\n  style.textContent = `body:not(.sqs-edit-mode-active) .page-section--additional-empty { display: none; }`;\n  document.head.appendChild(style);\n\n  // Add class to parent section if ProductItem-additional is empty\n  const productItemAdditional = document.querySelector(\".ProductItem-additional, #accordion-section\");\n  if (productItemAdditional) {\n    const contentBlocks = productItemAdditional.querySelectorAll(\".sqs-col-12, .fe-block\");\n    const allEmpty = contentBlocks.length > 0 && [...contentBlocks].every(block => block.children.length === 0);\n    if (allEmpty) {\n      const pageSection = productItemAdditional.closest(\".page-section\");\n      if (pageSection) {\n        pageSection.classList.add(\"page-section--additional-empty\");\n      }\n    }\n  }\n\n  console.log('[Product Accordion] Plugin Installed. Copyright Studio Reveuse https://studioreveuse.com.au');\n});\n"]}