{"version":3,"sources":["webpack:///./LeLab.Web/src/barba/global/preload.js","webpack:///./LeLab.Web/src/barba/transitions/default.js","webpack:///./LeLab.Web/src/barba/global/scroll.js","webpack:///./LeLab.Web/src/barba/global/mutation.js","webpack:///./LeLab.Web/src/barba/global/cdv.js","webpack:///./LeLab.Web/src/barba/barba.entry.js"],"names":["supportPreload","navigator","userAgent","search","cdvQuery","str","match","document","querySelector","getAttribute","parseEntrypoints","json","chunks","entrypoint","entrypointChunks","Object","entries","forEach","chunk","startsWith","endsWith","includes","push","location","host","length","console","info","filter","x","appendLink","href","rel","as","l","createElement","head","appendChild","fetch","then","response","contentType","headers","get","indexOf","supportClipPath","CSS","supports","waitMs","ms","Promise","resolve","reject","setTimeout","scrollY","windowWidth","timeout","updateScrollY","clearTimeout","window","requestAnimationFrame","ws","ww","innerWidth","addEventListener","name","sync","leave","current","container","classList","add","isTriggerBack","scrollTop","Math","round","enter","next","afterEnter","remove","after","scrollRestorationSupport","history","html","pageStateScrollY","savePageStateScrollY","PageState","set","scrollRestoration","onbeforeunload","e","anchor","target","closest","preventDefault","stopPropagation","id","trim","scrollTo","node","scrollToNode","hash","barba","hooks","before","style","scrollBehavior","data","trigger","url","body","parser","DOMParser","nextDocument","beforeLeave","parseNextDocument","appendStyleFrom","appendScriptFrom","afterLeave","documentElement","lang","selectorWhitelist","join","removeFrom","appendFrom","parseFromString","fromNode","child","count","parentNode","removeChild","toNode","querySelectorAll","referenceNode","dataset","insertBefore","s","type","src","getCdvFromString","currentCdv","error","testCdv","warn","force","init","debug","preventRunning","prevent","split","test","requestError","action","tagName","status","barbaPrevent","transitions","transition"],"mappings":"kGAKA,MAEMA,GAA4D,IAA3CC,UAAUC,UAAUC,OAAO,WAO5CC,EAAY,SAASC,GACvB,MAAMC,EAEPC,SAASC,cAAc,2CAA2CC,aAAa,QAF5DH,MAAM,qBACxB,OAAOA,EAAQ,IAAH,OAAOA,EAAM,IAAO,GAFlB,GAsBlB,SAASI,EAAiBC,GACtB,I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,MAAM,qBACxB,OAAOA,EAAQA,EAAM,GAAK,GAG9B,MAAMsI,EAAaD,EAAiBpI,SAASC,cAAc,2CAA2CC,aAAa,SAEnH,IAAIoI,GAAQ,EAEZ,MAAMC,EAAU,UAAiB,KAAEjE,KAC3BgE,GAAUhE,GAASA,EAAKM,MAGxBwD,EAAiB9D,EAAKM,QAAUyD,IAChClH,QAAQqH,KAAK,4DACbzC,IAAM0C,MAAMnE,EAAKgC,IAAI9E,MACrB8G,GAAQ,IAIhBvC,IAAMC,MAAMW,YAAY4B,GACxBxC,IAAMC,MAAMe,WAAWwB,G,6VCpBvBxC,IAAM2C,KAAK,CAGPC,OAAQ3H,SAASC,KAAKJ,SAAS,eAG/B+H,gBAAgB,EAGhBC,QAAS,EAAGrH,WAGR,GAAI,sBAAuB4B,OAAOuB,UAAY,EAC1C,OAAO,EAGX,MAAM2B,EAAM9E,EAAKsH,MAAM,KAAK,GAC5B,QAAI,iBAAiBC,KAAKzC,IAQ9BrD,QAAS,IAGT+F,aAAc,CAAC3C,EAAS4C,EAAQ3C,EAAKrE,KAEV,iBAAZoE,GACJA,EAAQ6C,SACY,MAApB7C,EAAQ6C,SACRjH,EAASkH,QACW,MAApBlH,EAASkH,SAGZ9C,EAAQ0B,QAAQqB,aAAe,SAMvCC,YAAa,CACTC,E,+VADS,IAQFA,EARE,CASL5F,KAAM,c","file":"barba.js","sourcesContent":["// Preload CSS resources from entrypoints.json manifest\r\n// This is not specific to Barba.js, but improve it's performance.\r\n\r\n\r\n// Request budget\r\nconst requestBudget = 50\r\n//Preload support (firefox doesn't support preload)\r\nconst supportPreload = navigator.userAgent.search(\"Firefox\") === -1\r\n\r\n\r\n\r\n/**\r\n * Retreive CDV query\r\n */\r\nconst cdvQuery = (function(str) {\r\n const match = str.match(/[?&](cdv=[0-9]+)/m)\r\n return match ? `?${match[1]}` : \"\"\r\n})(document.querySelector('link[href*=\"?cdv=\"],link[href*=\"&cdv=\"]').getAttribute(\"href\"))\r\n\r\n\r\n\r\n/**\r\n * Fetch the entrypoints.json \r\n */\r\nfetch(`/dist/entrypoints.json${cdvQuery}`).then(response => {\r\n const contentType = response.headers.get(\"content-type\");\r\n if (contentType && contentType.indexOf(\"application/json\") !== -1) {\r\n return response.json().then(parseEntrypoints)\r\n }\r\n})\r\n\r\n\r\n\r\n/**\r\n * Parse entrypoints for chunks to preload (or prefetch)\r\n */\r\nfunction parseEntrypoints(json) {\r\n let chunks = []\r\n\r\n for (const [entrypoint, entrypointChunks] of Object.entries(json)) {\r\n // Skip \"assets\" entry, this is a special case \r\n // which should never be required.\r\n if (entrypoint === \"assets\") {\r\n continue\r\n }\r\n // Each chunk in entrypoint...\r\n entrypointChunks.forEach(chunk => {\r\n // ... if entrypoint is from *.scss, skip *.js chunk\r\n if (entrypoint.startsWith(\"css-\") && chunk.endsWith('.js')) {\r\n return\r\n }\r\n // ... if already loaded, skip\r\n if (document.querySelector(`[data-chunk=\"${chunk}\"]`)) {\r\n return\r\n }\r\n // ... add to chunks listing if not included\r\n if (!chunks.includes(chunk)) {\r\n chunks.push(chunk)\r\n }\r\n })\r\n }\r\n\r\n if (location.host === 'devinci.local.sigmund.ca') {\r\n if (chunks.length > requestBudget) {\r\n console.info(`%c Preloaded ${chunks.length} entrypoints chunks, budget is ${requestBudget}.`, 'color: #e8505b')\r\n } else {\r\n console.info(`%c Preloaded ${chunks.length} entrypoints chunks.`, 'color: #14b1ab')\r\n }\r\n }\r\n \r\n chunks.filter(x => x.endsWith('.css')).forEach(chunk => {\r\n appendLink(`/dist/${chunk}${cdvQuery}`, 'preload', 'style')\r\n })\r\n\r\n chunks.filter(x => x.endsWith('.js')).forEach(chunk => {\r\n appendLink(`/dist/${chunk}${cdvQuery}`, 'prefetch', 'script')\r\n })\r\n}\r\n\r\n\r\n\r\n/**\r\n * Append a link to the head\r\n */\r\nfunction appendLink(href, rel, as) {\r\n let l = document.createElement(\"link\");\r\n l.rel = supportPreload ? rel : \"prefetch\";\r\n l.as = as;\r\n l.href = href;\r\n document.head.appendChild(l);\r\n}\r\n","import { isTriggerBack } from \"barba\"\r\n\r\nimport \"./default.scss\"\r\n\r\nconst duration = 500 // Must be the same as the CSS animation duration\r\nconst classLeave = 'is-leave'\r\nconst classEnter = 'is-enter'\r\nconst classBack = 'is-back'\r\nconst classFoward = 'is-foward'\r\nconst supportClipPath = (function SupportClipPath() {\r\n return CSS.supports(\"(clip-path: circle())\") || CSS.supports(\"(-webkit-clip-path: circle())\")\r\n})()\r\n\r\n\r\n\r\n// Return a promise which resolve after N milisecond\r\nfunction waitMs(ms) {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n resolve()\r\n }, ms);\r\n })\r\n}\r\n\r\n\r\n\r\n// Listen to update page scroll Y information\r\nlet scrollY = 0\r\nlet windowWidth = -1\r\nlet timeout = null\r\n\r\nconst updateScrollY = () => {\r\n clearTimeout(timeout)\r\n timeout = setTimeout(() => {\r\n window.requestAnimationFrame(() => {\r\n const ws = window.scrollY\r\n const ww = window.innerWidth\r\n if (ww !== windowWidth || ws !== scrollY) {\r\n scrollY = window.scrollY\r\n windowWidth = ww\r\n }\r\n })\r\n }, 32)\r\n}\r\n\r\nwindow.addEventListener('scroll', updateScrollY)\r\nwindow.addEventListener('resize', updateScrollY)\r\nupdateScrollY()\r\n\r\n\r\n\r\n// Export transition object, named \"default\"\r\nexport default {\r\n name: 'sweep',\r\n sync: true,\r\n leave({ current }) {\r\n if (!supportClipPath) {\r\n return\r\n }\r\n current.container.classList.add(classLeave)\r\n if (isTriggerBack()) {\r\n current.container.classList.add(classBack)\r\n } else {\r\n current.container.classList.add(classFoward)\r\n }\r\n current.container.scrollTop = Math.round(scrollY)\r\n return waitMs(duration)\r\n },\r\n enter({ next }) {\r\n if (!supportClipPath) {\r\n return\r\n }\r\n next.container.classList.add(classEnter)\r\n return waitMs(duration)\r\n },\r\n afterEnter({ next }) {\r\n next.container.classList.remove(classEnter)\r\n },\r\n after() {\r\n updateScrollY()\r\n }\r\n};","/**\r\n * Global scroll management\r\n */\r\n\r\nimport { barba, PageState } from 'barba'\r\nimport scrollToNode from 'utils/scroll-to-node'\r\n\r\nconst scrollRestorationSupport = 'scrollRestoration' in window.history\r\nconst html = document.querySelector('html')\r\nlet pageStateScrollY = 0\r\nlet timeout = null\r\n\r\n\r\n\r\n/**\r\n * Save scroll Y to page state every 150 ms (has long has executed)\r\n */\r\nconst savePageStateScrollY = function SavePageStateScrollY() {\r\n if (timeout !== null) {\r\n return\r\n }\r\n timeout = setTimeout(() => {\r\n clearTimeout(timeout)\r\n timeout = null\r\n window.requestAnimationFrame(() => {\r\n PageState.set('window-scroll-y', window.scrollY)\r\n })\r\n }, 150)\r\n}\r\n\r\n\r\n\r\n/**\r\n * Retreive scroll Y from page state\r\n */\r\nconst getPageStateScrollY = function GetPageStateScrollY() {\r\n return PageState.get('window-scroll-y')\r\n}\r\n\r\n\r\n\r\n/**\r\n * If browser support scroll restoration\r\n */\r\nif (scrollRestorationSupport) {\r\n\r\n // Scroll restoration to manual\r\n window.history.scrollRestoration = 'manual'\r\n\r\n // Before unload, scroll restoration to auto.\r\n // This allow the browser to have the correct scroll\r\n // position on page refresh.\r\n window.onbeforeunload = (e) => {\r\n window.history.scrollRestoration = 'auto'\r\n }\r\n\r\n // On popstate, get scroll\r\n window.addEventListener('popstate', e => {\r\n pageStateScrollY = getPageStateScrollY()\r\n })\r\n\r\n // On window event, save scroll\r\n window.addEventListener('scroll', savePageStateScrollY)\r\n window.addEventListener('resize', savePageStateScrollY)\r\n}\r\n\r\n\r\n\r\n/**\r\n * Custom anchor behavior\r\n * \r\n * There is conflict if a Barba transition named \"self\" exist.\r\n * If a \"self\" transition exit, an anchor link will\r\n * transition like any other page.\r\n */\r\nhtml.addEventListener('click', e => {\r\n const anchor = e.target.closest('a[href^=\"#\"]')\r\n\r\n if (!anchor) {\r\n return\r\n }\r\n\r\n e.preventDefault()\r\n e.stopPropagation()\r\n\r\n const id = anchor.getAttribute('href').trim()\r\n\r\n if (id === \"#\") {\r\n window.requestAnimationFrame(() => window.scrollTo(0, 0))\r\n return\r\n }\r\n\r\n const node = document.querySelector(id)\r\n\r\n if (node) {\r\n window.requestAnimationFrame(() => scrollToNode(node))\r\n }\r\n})\r\n\r\n\r\n\r\n/**\r\n * If there is an hash on page load, scroll to \r\n */\r\nif (location.hash && location.hash.trim !== \"#\") {\r\n const node = document.querySelector(location.hash)\r\n if (node) {\r\n window.requestAnimationFrame(() => scrollToNode(node))\r\n }\r\n}\r\n\r\n\r\n\r\n/**\r\n * Barba \"before\" transition\r\n */\r\nbarba.hooks.before(() => {\r\n // Disable page smooth scrolling\r\n html.style.scrollBehavior = \"auto\"\r\n})\r\n\r\n\r\n\r\n/**\r\n * Barba \"enter\" transition\r\n * Set the scroll position based on trigger and URL pattern\r\n */\r\nbarba.hooks.enter(data => {\r\n const { trigger, next } = data\r\n\r\n // Popstate navigation\r\n if (typeof trigger === \"string\" && (trigger === \"back\" || trigger === \"forward\" || trigger === \"popstate\")) {\r\n // Browser doesn't support scroll restoration, default behavior\r\n if (!scrollRestorationSupport) {\r\n return\r\n }\r\n // Scroll to page state scroll Y position\r\n if (pageStateScrollY !== null) {\r\n window.scrollTo(0, pageStateScrollY)\r\n return\r\n }\r\n // Default\r\n window.scrollTo(0, 0)\r\n return\r\n }\r\n\r\n // Scroll to hash position\r\n let node = null\r\n if (next.url && next.url.hash) {\r\n node = next.container.querySelector(`#${next.url.hash}`)\r\n }\r\n if (node) {\r\n scrollToNode(node)\r\n return\r\n }\r\n\r\n // Scroll to top\r\n window.scrollTo(0, 0)\r\n\r\n})\r\n\r\n\r\n\r\n/**\r\n * Barba \"afterEnter\" transition\r\n */\r\nbarba.hooks.afterEnter(() => {\r\n // Restore default CSS scroll behavior smooth\r\n html.style.scrollBehavior = \"smooth\"\r\n // Save initial scroll position\r\n !scrollRestorationSupport || savePageStateScrollY()\r\n})","// Mutate the page content and script tag\r\n// with information from the next page.\r\n\r\nimport barba from 'barba'\r\n\r\nconst head = document.querySelector('head')\r\nconst body = document.body\r\nconst parser = new DOMParser()\r\nlet nextDocument = null\r\n\r\n\r\n\r\n/**\r\n * Mutations before leave animation\r\n */\r\nconst beforeLeaveMutation = function BeforeLeaveMutation(data) {\r\n nextDocument = null\r\n nextDocument = parseNextDocument(data)\r\n if (nextDocument) {\r\n appendStyleFrom(nextDocument)\r\n appendScriptFrom(nextDocument)\r\n }\r\n}\r\nbarba.hooks.beforeLeave(beforeLeaveMutation)\r\n\r\n\r\n\r\n/**\r\n * Mutations after leave animation\r\n */\r\nconst afterLeaveMutation = function AfterLeaveMutation(data) {\r\n\r\n // If not already defined, retreive the next document\r\n if (!nextDocument) {\r\n nextDocument = parseNextDocument(data)\r\n appendStyleFrom(nextDocument)\r\n appendScriptFrom(nextDocument)\r\n }\r\n\r\n // Replace \r\n document.documentElement.lang = nextDocument.documentElement.lang\r\n\r\n // Replace \r\n const selectorWhitelist = ['meta'].join(',')\r\n removeFrom(head, selectorWhitelist)\r\n appendFrom(nextDocument.querySelector('head'), head, selectorWhitelist)\r\n\r\n nextDocument = null\r\n}\r\nbarba.hooks.afterLeave(afterLeaveMutation)\r\n\r\n\r\n\r\n/**\r\n * Parse the next page HTML\r\n * If succed, return the document node, else null\r\n */\r\nconst parseNextDocument = function ParseNextDocument(data) {\r\n if (!data.next || !data.next.html) {\r\n return null\r\n }\r\n return parser.parseFromString(data.next.html, \"text/html\")\r\n}\r\n\r\n\r\n\r\n/**\r\n * Remove child node who match the whitelist\r\n */\r\nconst removeFrom = function RemoveFrom(fromNode, selectorWhitelist) {\r\n let child = fromNode.querySelector(selectorWhitelist)\r\n let count = 0\r\n while (child && ++count < 999) {\r\n child.parentNode.removeChild(child)\r\n child = fromNode.querySelector(selectorWhitelist)\r\n }\r\n}\r\n\r\n\r\n\r\n/**\r\n * Append child node from node (fromNode) \r\n * to destination (toNode) who match the whitelist\r\n */\r\nconst appendFrom = function AppendFrom(fromNode, toNode, selectorWhitelist) {\r\n fromNode.querySelectorAll(selectorWhitelist).forEach(node => {\r\n toNode.appendChild(node)\r\n })\r\n}\r\n\r\n\r\n\r\n/**\r\n * Append new style to the \r\n */\r\nconst appendStyleFrom = function AppendStyleFrom(fromNode) {\r\n // All new style will be inserted before \r\n // this node(which are TailwindCSS utilities)\r\n const referenceNode = head.querySelector('link[rel=\"stylesheet\"][data-chunk=\"css-utilities.css\"]') || null\r\n // Selector to match (whitelist) to insert\r\n const selectorWhitelist = 'link[rel=\"stylesheet\"][data-chunk]'\r\n\r\n fromNode.querySelectorAll(selectorWhitelist).forEach(node => {\r\n if (head.querySelector(`link[rel=\"stylesheet\"][data-chunk=\"${node.dataset.chunk}\"]`)) {\r\n return\r\n }\r\n head.insertBefore(node, referenceNode)\r\n })\r\n}\r\n\r\n\r\n\r\n/**\r\n * Append new script to the \r\n */\r\nconst appendScriptFrom = function AppendScriptFrom(fromNode) {\r\n fromNode.querySelectorAll('script[data-chunk]').forEach(node => {\r\n if (document.querySelector(`script[data-chunk=\"${node.dataset.chunk}\"]`)) {\r\n return\r\n }\r\n let s = document.createElement('script')\r\n !node.getAttribute('type') || (s.type = node.getAttribute('type'))\r\n !node.getAttribute('src') || (s.src = node.getAttribute('src'))\r\n !node.dataset.chunk || (s.dataset.chunk = node.dataset.chunk)\r\n body.appendChild(s)\r\n })\r\n}\r\n","// Client Dependency Framework Version\r\n// If there is a new version of CDV (?cdv=*) within \r\n// the next page, force reload.\r\n\r\nimport barba from 'barba'\r\n\r\nfunction getCdvFromString(str) {\r\n const match = str.match(/[?&]cdv=([0-9]+)/m)\r\n return match ? match[1] : \"\"\r\n}\r\n\r\nconst currentCdv = getCdvFromString(document.querySelector('link[href*=\"?cdv=\"],link[href*=\"&cdv=\"]').getAttribute(\"href\"))\r\n\r\nlet error = false\r\n\r\nconst testCdv = function TestCdv({ next }) {\r\n if (error || !next || !next.html) {\r\n return\r\n }\r\n if (getCdvFromString(next.html) !== currentCdv) {\r\n console.warn(\"Client Dependency version has change, force a page load.\")\r\n barba.force(next.url.href)\r\n error = true\r\n }\r\n}\r\n\r\nbarba.hooks.beforeLeave(testCdv)\r\nbarba.hooks.afterLeave(testCdv)","import barba from 'barba'\r\nimport transition from './transitions/default'\r\nimport './global/scroll'\r\nimport './global/mutation'\r\nimport './global/cdv'\r\nimport './global/preload'\r\n\r\nbarba.init({\r\n // Debug mode\r\n // https://barba.js.org/docs/advanced/recipes/#debug\r\n debug: !location.host.endsWith('devinci.com'),\r\n // Prevent click on link during transition\r\n // https://barba.js.org/docs/advanced/strategies/#preventRunning\r\n preventRunning: true,\r\n // Custom prevent test\r\n // https://barba.js.org/docs/advanced/strategies/#Prevent\r\n prevent: ({ href }) => {\r\n // Browser is lacking scrollRestoration, \r\n // navigation won't be optimal, prevent all link\r\n if ('scrollRestoration' in window.history === false) {\r\n return true\r\n }\r\n // Media file test\r\n const url = href.split('?')[0]\r\n if (/\\.[a-z]{2,4}$/i.test(url)) {\r\n return true\r\n }\r\n // Default\r\n return false\r\n },\r\n // Timeout if request take more then 1s\r\n // https://barba.js.org/docs/advanced/recipes/#timeout\r\n timeout: 10000,\r\n // Manage request error\r\n // https://barba.js.org/docs/advanced/recipes/#requestError\r\n requestError: (trigger, action, url, response) => {\r\n // Href of hyperlink is a 404 ...\r\n if (typeof trigger === \"object\"\r\n && trigger.tagName\r\n && trigger.tagName === 'A'\r\n && response.status\r\n && response.status === 404) {\r\n // ... prevent trough data attr (force without transition)\r\n // https://barba.js.org/docs/advanced/strategies/#prevent\r\n trigger.dataset.barbaPrevent = \"self\"\r\n }\r\n },\r\n // Transitions\r\n // https://barba.js.org/docs/getstarted/basic-transition/\r\n // https://barba.js.org/docs/advanced/transitions/\r\n transitions: [\r\n transition,\r\n // The 'self' name has a special meaning, a transition with\r\n // this name will allow barba.go() method to transition to\r\n // the same page. This will also cause anchor (ex. href=\"#anchor\") \r\n // to transition like a page. You will need a custom implementation\r\n // of anchor behavior.\r\n {\r\n ...transition,\r\n name: 'self'\r\n }\r\n ]\r\n})"],"sourceRoot":""}