{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/0VHhkaJbC5BhxCVD0ec8/72JUGnWhLxvdlNpBDAZ4/Navigation_Color.js"],
  "sourcesContent": ["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useState, useEffect } from \"react\";\nimport { useViewportScroll, useTransform, useMotionValue } from \"framer-motion\"; // The following overrides are for creating scroll effects on web pages\n// Trigger a state change when each layer with a <section> tag reaches the top of the page\n// You can apply a <section> tag to a layer through the 'Accessibility' property controls\nexport function withSectionTriggeredStates(Component) {\n  const outputRange = [\"First\", \"Second\"] // list of variants to animate between\n  ;\n  return props => {\n    const {\n      scrollY\n    } = useViewportScroll();\n    const [state, setState] = useState(outputRange[0]);\n    useEffect(() => {\n      const scrollYRange = getSectionPositions();\n      scrollY.onChange(latest => {\n        const output = getCorrespondingItem(latest, scrollYRange, outputRange);\n        setState(output);\n      });\n    }, []);\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      variant: state\n    });\n  };\n} // Custom hooks\nfunction useSteppedTransform(value, inputRange, outputRange) {\n  return useTransform(value, value => getCorrespondingItem(value, inputRange, outputRange));\n}\nfunction useScrollTriggeredState(inputRange, outputRange) {\n  const {\n    scrollY\n  } = useViewportScroll();\n  const [state, setState] = useState(outputRange[0]);\n  useEffect(() => scrollY.onChange(latest => setState(getCorrespondingItem(latest, inputRange, outputRange))), []);\n  return state;\n}\nfunction useSectionTrigger(handleSectionChange) {\n  const scrollOutput = useMotionValue(0);\n  const {\n    scrollY\n  } = useViewportScroll();\n  useEffect(() => {\n    const scrollYRange = getSectionPositions();\n    scrollY.onChange(latest => {\n      const index = getMatchingIndex(latest, scrollYRange);\n      if (scrollOutput.get() !== index) {\n        scrollOutput.set(index);\n      }\n    });\n  }, []);\n  useEffect(() => scrollOutput.onChange(handleSectionChange), []);\n} // Functions\nfunction getMatchingIndex(value, array) {\n  let found = array.findIndex(el => el > value);\n  switch (found) {\n    case 0:\n      return 0;\n      break;\n    case -1:\n      return array.length - 1;\n      break;\n    default:\n      return found - 1;\n  }\n}\nfunction getCorrespondingItem(value, inputRange, outputRange) {\n  const inputIndex = getMatchingIndex(value, inputRange);\n  const outputIndex = inputIndex > outputRange.length - 1 ? outputRange.length - 1 : inputIndex;\n  return outputRange[outputIndex];\n}\nfunction getSectionPositions() {\n  const elements = Array.from(document.querySelectorAll(\"section\"));\n  const positions = elements.map(element => {\n    return element.getBoundingClientRect().top + window.scrollY;\n  }).sort((a, b) => a - b);\n  if (positions[0] === 0) {\n    return positions;\n  } else {\n    return [0, ...positions];\n  }\n}\nfunction getScrollTargets() {\n  const elements = Array.from(document.querySelectorAll('[id]:not([id=\"\"])'));\n  const targets = elements.map(element => {\n    return {\n      y: element.getBoundingClientRect().top + window.scrollY,\n      target: `#${element.id}`\n    };\n  }).sort((a, b) => a.y - b.y);\n  const inputs = targets.map(target => target.y);\n  const outputs = targets.map(target => target.target);\n  if (inputs[0] === 0) {\n    outputs[0] = \"#\";\n    return {\n      scrollYRange: inputs,\n      outputRange: outputs\n    };\n  } else {\n    return {\n      scrollYRange: [0, ...inputs],\n      outputRange: [\"#\", ...outputs]\n    };\n  }\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"withSectionTriggeredStates\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withSectionTriggeredStates\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./Navigation_Color.map"],
  "mappings": "yIAKO,SAASA,EAA2BC,EAAW,CACpD,IAAMC,EAAc,CAAC,QAAS,QAAQ,EAEtC,OAAOC,GAAS,CACd,GAAM,CACJ,QAAAC,CACF,EAAIC,EAAkB,EAChB,CAACC,EAAOC,CAAQ,EAAIC,EAASN,EAAY,CAAC,CAAC,EACjD,OAAAO,EAAU,IAAM,CACd,IAAMC,EAAeC,EAAoB,EACzCP,EAAQ,SAASQ,GAAU,CACzB,IAAMC,EAASC,EAAqBF,EAAQF,EAAcR,CAAW,EACrEK,EAASM,CAAM,CACjB,CAAC,CACH,EAAG,CAAC,CAAC,EACeE,EAAKd,EAAW,CAClC,GAAGE,EACH,QAASG,CACX,CAAC,CACH,CACF,CA4BA,SAASU,EAAiBC,EAAOC,EAAO,CACtC,IAAIC,EAAQD,EAAM,UAAUE,GAAMA,EAAKH,CAAK,EAC5C,OAAQE,EAAO,CACb,IAAK,GACH,MAAO,GAET,IAAK,GACH,OAAOD,EAAM,OAAS,EAExB,QACE,OAAOC,EAAQ,CACnB,CACF,CACA,SAASE,EAAqBJ,EAAOK,EAAYC,EAAa,CAC5D,IAAMC,EAAaR,EAAiBC,EAAOK,CAAU,EAC/CG,EAAcD,EAAaD,EAAY,OAAS,EAAIA,EAAY,OAAS,EAAIC,EACnF,OAAOD,EAAYE,CAAW,CAChC,CACA,SAASC,GAAsB,CAE7B,IAAMC,EADW,MAAM,KAAK,SAAS,iBAAiB,SAAS,CAAC,EACrC,IAAIC,GACtBA,EAAQ,sBAAsB,EAAE,IAAMC,EAAO,OACrD,EAAE,KAAK,CAACC,EAAGC,IAAMD,EAAIC,CAAC,EACvB,OAAIJ,EAAU,CAAC,IAAM,EACZA,EAEA,CAAC,EAAG,GAAGA,CAAS,CAE3B",
  "names": ["withSectionTriggeredStates", "Component", "outputRange", "props", "scrollY", "useViewportScroll", "state", "setState", "ye", "ue", "scrollYRange", "getSectionPositions", "latest", "output", "getCorrespondingItem", "p", "getMatchingIndex", "value", "array", "found", "el", "getCorrespondingItem", "inputRange", "outputRange", "inputIndex", "outputIndex", "getSectionPositions", "positions", "element", "window", "a", "b"]
}
