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ACpB,QAAQP,EAAGO,QAAQ,IAAK,OAE3B,IAEH1C,SAAS2C,iBAAiBF,EAAeG,KAAK,OAAOd,SAASK,IAC5DT,EAAYmB,QAAQV,EAAG,IAIJ,IAAIR,sBA1CO,CAACC,EAASC,KAEpCD,EAAQ,GAAGkB,mBAAmBC,EAAI,EACpC/C,SAASgD,KAAKvC,UAAU6B,IAAI,YAE5BtC,SAASgD,KAAKvC,UAAU8B,OAAO,WACjC,IAqCaM,QAAQ7C,SAASO,cAAc,4BAA4B,IAmD5ET,GA1BA,WACE,IAAImD,EAAkB,CACpB,0BACA,aACA,qBACA,sBACA,wBACA,qBACA,qBACA,cACAL,KAAK,KACP5C,SAAS2C,iBAAiBM,GAAiBnB,SAASK,IAClDA,EAAG1B,UAAU6B,IAAI,UAAU,GAE/B,G","sources":["webpack://sphinx_book_theme/./src/sphinx_book_theme/assets/scripts/index.js"],"sourcesContent":["// Import CSS variables\n// ref: https://css-tricks.com/getting-javascript-to-talk-to-css-and-sass/\nimport \"../styles/index.scss\";\n\n/**\n * A helper function to load scripts when the DOM is loaded.\n * This waits for everything to be on the page first before running, since\n * some functionality doesn't behave properly until everything is ready.\n */\nvar sbRunWhenDOMLoaded = (cb) => {\n if (document.readyState != \"loading\") {\n cb();\n } else if (document.addEventListener) {\n document.addEventListener(\"DOMContentLoaded\", cb);\n } else {\n document.attachEvent(\"onreadystatechange\", function () {\n if (document.readyState == \"complete\") cb();\n });\n }\n};\n\n/**\n * Toggle full-screen with button\n *\n * There are some browser-specific hacks in here:\n * - Safari requires a `webkit` prefix, so this uses conditionals to check for that\n * ref: https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API\n */\nvar toggleFullScreen = () => {\n var isInFullScreen =\n (document.fullscreenElement && document.fullscreenElement !== null) ||\n (document.webkitFullscreenElement &&\n document.webkitFullscreenElement !== null);\n let docElm = document.documentElement;\n if (!isInFullScreen) {\n console.log(\"[SBT]: Entering full screen\");\n if (docElm.requestFullscreen) {\n docElm.requestFullscreen();\n } else if (docElm.webkitRequestFullscreen) {\n docElm.webkitRequestFullscreen();\n }\n } else {\n console.log(\"[SBT]: Exiting full screen\");\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n }\n }\n};\n\n/**\n * Manage scrolling behavior. This is primarily two things:\n *\n * 1. Hide the Table of Contents any time sidebar content is on the screen.\n *\n * This will be triggered any time a sidebar item enters or exits the screen.\n * It adds/removes items from an array if they have entered the screen, and\n * removes them when they exit the screen. It hides the TOC if anything is\n * on-screen.\n *\n * ref: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API\n *\n * 2. Add a `scrolled` class to to trigger CSS changes.\n */\nvar initTocHide = () => {\n var onScreenItems = [];\n let hideTocCallback = (entries, observer) => {\n // Check whether any sidebar item is displayed\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n // If an element just came on screen, add it our list\n onScreenItems.push(entry.target);\n } else {\n // Otherwise, if it's in our list then remove it\n for (let ii = 0; ii < onScreenItems.length; ii++) {\n if (onScreenItems[ii] === entry.target) {\n onScreenItems.splice(ii, 1);\n break;\n }\n }\n }\n });\n\n // Hide the TOC if any margin content is displayed on the screen\n if (onScreenItems.length > 0) {\n document.querySelector(\"div.bd-sidebar-secondary\").classList.add(\"hide\");\n } else {\n document\n .querySelector(\"div.bd-sidebar-secondary\")\n .classList.remove(\"hide\");\n }\n };\n let manageScrolledClassOnBody = (entries, observer) => {\n // The pixel is at the top, so if we're < 0 that it means we've scrolled\n if (entries[0].boundingClientRect.y < 0) {\n document.body.classList.add(\"scrolled\");\n } else {\n document.body.classList.remove(\"scrolled\");\n }\n };\n\n // Set up the intersection observer to watch all margin content\n let options = {\n // Trigger callback when the top of a margin item is 1/3 up the screen\n rootMargin: \"0px 0px -33% 0px\",\n };\n let tocObserver = new IntersectionObserver(hideTocCallback, options);\n // TODO: deprecate popout after v0.5.0\n const selectorClasses = [\n \"marginnote\",\n \"sidenote\",\n \"margin\",\n \"margin-caption\",\n \"full-width\",\n \"sidebar\",\n \"popout\",\n ];\n let marginSelector = [];\n selectorClasses.forEach((ii) => {\n // Use three permutations of each class name because `tag_` and `_` used to be supported\n marginSelector.push(\n ...[\n `.${ii}`,\n `.tag_${ii}`,\n `.${ii.replace(\"-\", \"_\")}`,\n `.tag_${ii.replace(\"-\", \"_\")}`,\n ],\n );\n });\n document.querySelectorAll(marginSelector.join(\", \")).forEach((ii) => {\n tocObserver.observe(ii);\n });\n\n // Set up the observer to check if we've scrolled from top of page\n let scrollObserver = new IntersectionObserver(manageScrolledClassOnBody);\n scrollObserver.observe(document.querySelector(\".sbt-scroll-pixel-helper\"));\n};\n\n/**\n * Activate Thebe with a custom button click.\n */\nvar initThebeSBT = () => {\n var title = document.querySelector(\"section h1\");\n var sibling = title.nextElementSibling;\n // If the next element after the title isn't a thebe button, add one now.\n // That way it is initiatlized when thebe is first-clicked and isn't re-added after.\n if (!sibling.classList.contains(\"thebe-launch-button\")) {\n title.insertAdjacentHTML(\n \"afterend\",\n \"\",\n );\n }\n // This function is provided by sphinx-thebe\n initThebe();\n};\n\n/**\n * Add no print class to certain DOM elements\n */\n\nfunction addNoPrint() {\n var noPrintSelector = [\n \".bd-header-announcement\",\n \".bd-header\",\n \".bd-header-article\",\n \".bd-sidebar-primary\",\n \".bd-sidebar-secondary\",\n \".bd-footer-article\",\n \".bd-footer-content\",\n \".bd-footer\",\n ].join(\",\");\n document.querySelectorAll(noPrintSelector).forEach((ii) => {\n ii.classList.add(\"noprint\");\n });\n}\n\n/**\n * Set up callback functions for UI click actions\n */\nwindow.initThebeSBT = initThebeSBT;\nwindow.toggleFullScreen = toggleFullScreen;\n\n/**\n * Set up functions to load when the DOM is ready\n */\nsbRunWhenDOMLoaded(initTocHide);\nsbRunWhenDOMLoaded(addNoPrint);\n"],"names":["sbRunWhenDOMLoaded","cb","document","readyState","addEventListener","attachEvent","window","initThebeSBT","title","querySelector","nextElementSibling","classList","contains","insertAdjacentHTML","initThebe","toggleFullScreen","isInFullScreen","fullscreenElement","webkitFullscreenElement","docElm","documentElement","console","log","exitFullscreen","webkitExitFullscreen","requestFullscreen","webkitRequestFullscreen","onScreenItems","tocObserver","IntersectionObserver","entries","observer","forEach","entry","isIntersecting","push","target","ii","length","splice","add","remove","rootMargin","marginSelector","replace","querySelectorAll","join","observe","boundingClientRect","y","body","noPrintSelector"],"sourceRoot":""}