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AAe,gCAGP,GAAG,OAAQ,IAAK,EAAY,EAAY,GAAI,SAAU,EAAiB,KAAM,GAAc,GACvG,GAEN","file":"/gh/flowtricks/scripts@1.0.4/variables-color-scroll.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /gh/flowtricks/scripts@1.0.4/variables-color-scroll.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 * Variables Color Scroll 1.0.2\n * Copyright 2023 Timothy Ricks\n * Released under the MIT License\n * Released on: December 16, 2023\n */\n\nwindow.addEventListener(\"DOMContentLoaded\", (event) => {\n  // attribute value checker\n  function attr(defaultVal, attrVal) {\n    const defaultValType = typeof defaultVal;\n    if (typeof attrVal !== \"string\" || attrVal.trim() === \"\") return defaultVal;\n    if (attrVal === \"true\" && defaultValType === \"boolean\") return true;\n    if (attrVal === \"false\" && defaultValType === \"boolean\") return false;\n    if (isNaN(attrVal) && defaultValType === \"string\") return attrVal;\n    if (!isNaN(attrVal) && defaultValType === \"number\") return +attrVal;\n    return defaultVal;\n  }\n  const colorThemes = [];\n  const htmlStyles = getComputedStyle(document.documentElement);\n  const targetStylesheet = document.querySelector(\"#color-themes\");\n  const regex = /--([^:\\s]+):\\s*var\\(--([^)]+)\\);/g;\n\n  if (targetStylesheet) {\n    const rules = targetStylesheet.sheet.cssRules || targetStylesheet.sheet.rules;\n    for (const rule of rules) {\n      const styleObject = {};\n      let match;\n      while ((match = regex.exec(rule.cssText)) !== null) {\n        const key = \"--\" + match[1];\n        const value = htmlStyles.getPropertyValue(\"--\" + match[2]);\n        styleObject[key] = value;\n      }\n      colorThemes.push(styleObject);\n    }\n\n    const durationSetting = attr(0.4, targetStylesheet.getAttribute(\"speed\")),\n      easeSetting = attr(\"power1.out\", targetStylesheet.getAttribute(\"ease\")),\n      offsetSetting = attr(50, targetStylesheet.getAttribute(\"percent-from-top\")),\n      breakpointSetting = attr(0, targetStylesheet.getAttribute(\"min-width\"));\n    gsap.registerPlugin(ScrollTrigger);\n\n    const triggerElements = document.querySelectorAll(\"[animate-body-to]\");\n    triggerElements.forEach((element, index) => {\n      const modeIndex = +element.getAttribute(\"animate-body-to\");\n      let endSetting = `clamp(bottom ${offsetSetting}%)`;\n      if (index === triggerElements.length - 1) endSetting = `bottom ${offsetSetting}%`;\n      gsap.matchMedia().add(`(min-width: ${breakpointSetting}px)`, () => {\n        const colorScroll = gsap.timeline({\n          scrollTrigger: {\n            trigger: element,\n            start: `clamp(top ${offsetSetting}%)`,\n            end: endSetting,\n            toggleActions: \"play complete none reverse\"\n          }\n        });\n        colorScroll.to(\"body\", { ...colorThemes[modeIndex - 1], duration: durationSetting, ease: easeSetting });\n      });\n    });\n  }\n});\n"]}