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1R,yBAAyB,CACpC+R,OAAQC,EAAYC,cACpBpV,KAAM,CACJqV,KAAMC,EAAkBG,QAE1B,GAEJ,CAAE5O,UAAW,CAAC,GAAIyD,WAAY,yBAGhC0C,GAAAxsB,KAAIqzB,IAAAA,IAAgBjkB,QAAQpP,KAC9B,CAAC,SAAA6zB,KAEqB,IAAAhH,EAAAqI,EAChB,OAAJrI,EAAAL,GAAAxsB,KAAIqzB,IAAAA,MAAJxG,EAAqB3d,aACjB,OAAJgmB,EAAA1I,GAAAxsB,KAAIszB,IAAAA,MAAJ4B,EAAoBhmB,YACtB,CAOF+jB,GAAWH,GAAKc,G","sources":["webpack://dh-animasjonsscroll/webpack/runtime/import chunk loading","webpack://dh-animasjonsscroll/../src/tokenizer.js","webpack://dh-animasjonsscroll/../src/utils.js","webpack://dh-animasjonsscroll/../src/simplify-calculation.js","webpack://dh-animasjonsscroll/../src/numeric-values.js","webpack://dh-animasjonsscroll/../src/proxy-cssom.js","webpack://dh-animasjonsscroll/../src/scroll-timeline-base.js","webpack://dh-animasjonsscroll/../src/proxy-animation.js","webpack://dh-animasjonsscroll/../src/index.js","webpack://dh-animasjonsscroll/./node_modules/cuid/index.js","webpack://dh-animasjonsscroll/./node_modules/cuid/lib/fingerprint.browser.js","webpack://dh-animasjonsscroll/./node_modules/cuid/lib/getRandomValue.browser.js","webpack://dh-animasjonsscroll/./node_modules/cuid/lib/pad.js","webpack://dh-animasjonsscroll/./node_modules/debounce/index.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-server-libs/get-element-tag.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-server-libs/src/get-element-tag.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-basis-common/dist/index.esm.js","webpack://dh-animasjonsscroll/webpack/bootstrap","webpack://dh-animasjonsscroll/webpack/runtime/amd options","webpack://dh-animasjonsscroll/webpack/runtime/compat get default export","webpack://dh-animasjonsscroll/webpack/runtime/define property getters","webpack://dh-animasjonsscroll/webpack/runtime/ensure chunk","webpack://dh-animasjonsscroll/webpack/runtime/get javascript chunk filename","webpack://dh-animasjonsscroll/webpack/runtime/get mini-css chunk filename","webpack://dh-animasjonsscroll/webpack/runtime/hasOwnProperty shorthand","webpack://dh-animasjonsscroll/webpack/runtime/make namespace object","webpack://dh-animasjonsscroll/webpack/runtime/publicPath","webpack://dh-animasjonsscroll/./node_modules/@nrk/nrkno-snowplow/node_modules/@nrk/snowplow-web/index.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/nrkno-snowplow/build-npm/nrkno-snowplow.package.mjs","webpack://dh-animasjonsscroll/./node_modules/@nrk/snowplow-web/index.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-snowplow/dist/index.mjs","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-snowplow/dist/shared/dh-snowplow.1ee613bf.mjs","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet2.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/assertClassBrand.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-basis-scrollanimasjon/dist/index.esm.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://dh-animasjonsscroll/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://dh-animasjonsscroll/./node_modules/@nrk/dh-basis-mixins/dist/index.esm.js","webpack://dh-animasjonsscroll/./src/components/animasjonsscroll.module.css?9e8b","webpack://dh-animasjonsscroll/./src/components/animasjonsscroll.js","webpack://dh-animasjonsscroll/./src/components/media/prosentvis-video.js","webpack://dh-animasjonsscroll/./src/components/media/prosentvis-bilde.ts","webpack://dh-animasjonsscroll/./src/components/media/prosentvis-overgang.module.css?94f2","webpack://dh-animasjonsscroll/./src/components/media/overgang/canvas-manager.js","webpack://dh-animasjonsscroll/./src/components/media/prosentvis-overgang.js","webpack://dh-animasjonsscroll/./src/client.js"],"sourcesContent":["// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t792: 0\n};\n\nvar installChunk = (data) => {\n\tvar {ids, modules, runtime} = data;\n\t// add \"modules\" to the modules object,\n\t// then flag all \"ids\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tfor(moduleId in modules) {\n\t\tif(__webpack_require__.o(modules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = modules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\tfor(;i < ids.length; i++) {\n\t\tchunkId = ids[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[ids[i]] = 0;\n\t}\n\n}\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// import() chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[1]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = import(\"./\" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {\n\t\t\t\t\t\tif(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t});\n\t\t\t\t\tvar promise = Promise.race([promise, new Promise((resolve) => (installedChunkData = installedChunks[chunkId] = [resolve]))])\n\t\t\t\t\tpromises.push(installedChunkData[1] = promise);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no external install chunk\n\n// no on chunks loaded","\nexport class Token {}\n\n// The output of tokenization step is a stream of zero or more of the following tokens: , ,\n// , , , , , , ,\n// , , , , , , ,\n// , , <[-token>, <]-token>, <(-token>, <)-token>, <{-token>, and <}-token>.\nexport class IdentToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class FunctionToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class AtKeywordToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class HashToken extends Token {\n type;\n value;\n constructor(value, type = 'unrestricted') {\n super();\n this.value = value;\n this.type = type;\n }\n}\n\nexport class StringToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class BadStringToken extends Token {}\n\nexport class UrlToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class BadUrlToken extends Token {}\n\nexport class DelimToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class NumberToken extends Token {\n value;\n type;\n constructor(value, type = \"integer\") {\n super();\n this.value = value;\n this.type = type;\n }\n}\n\nexport class PercentageToken extends Token {\n value;\n constructor(value) {\n super();\n this.value = value;\n }\n}\n\nexport class DimensionToken extends Token {\n value;\n type;\n unit;\n constructor(value, type, unit) {\n super();\n this.value = value;\n this.type = type;\n this.unit = unit;\n }\n}\n\nexport class WhitespaceToken extends Token {}\n\nexport class CDOToken extends Token {}\n\nexport class CDCToken extends Token {}\n\nexport class ColonToken extends Token {}\n\nexport class SemicolonToken extends Token {}\n\nexport class CommaToken extends Token {}\n\nexport class LeftSquareBracketToken extends Token {}\n\nexport class RightSquareBracketToken extends Token {}\n\nexport class LeftParenthesisToken extends Token {}\n\nexport class RightParenthesisToken extends Token {}\n\nexport class LeftCurlyBracketToken extends Token {}\n\nexport class RightCurlyBracketToken extends Token {}\n\nclass InputStream {\n input\n index = 0;\n constructor(input) {\n this.input = input;\n }\n\n consume() {\n const codePoint = this.input.codePointAt(this.index);\n if (typeof codePoint !== 'undefined') {\n this.index += String.fromCodePoint(codePoint).length;\n }\n return codePoint;\n }\n\n reconsume(codePoint) {\n if (typeof codePoint !== 'undefined') {\n this.index -= String.fromCodePoint(codePoint).length\n }\n }\n\n peek() {\n const codePoints = []\n let position = this.index\n for (let i = 0; i < 3 && position < this.input.length; i++) {\n const nextCodePoint = this.input.codePointAt(position);\n codePoints.push(nextCodePoint);\n position += String.fromCodePoint(nextCodePoint).length;\n }\n return codePoints;\n }\n}\n\nfunction isNewline(codePoint) {\n // U+000A LINE FEED.\n return codePoint === 0x000A;\n}\nfunction isWhitespace(codePoint) {\n // A newline, U+0009 CHARACTER TABULATION, or U+0020 SPACE.\n return isNewline(codePoint) || codePoint === 0x2000 || codePoint === 0x0020;\n}\n\nfunction isDigit(codePoint) {\n // A code point between U+0030 DIGIT ZERO (0) and U+0039 DIGIT NINE (9) inclusive.\n return codePoint >= 0x0030 && codePoint <=0x0039;\n}\n\nfunction isHexDigit(codePoint) {\n // A digit, or a code point between U+0041 LATIN CAPITAL LETTER A (A) and U+0046 LATIN CAPITAL LETTER F (F) inclusive,\n // or a code point between U+0061 LATIN SMALL LETTER A (a) and U+0066 LATIN SMALL LETTER F (f) inclusive.\n return isDigit(codePoint) ||\n (codePoint >= 0x0041 && codePoint <= 0x0046) ||\n (codePoint >= 0x0061 && codePoint <= 0x0066);\n}\n\nfunction isUppercaseLetter(codePoint) {\n // A code point between U+0041 LATIN CAPITAL LETTER A (A) and U+005A LATIN CAPITAL LETTER Z (Z) inclusive.\n return codePoint >= 0x0041 && codePoint <= 0x005A;\n}\n\nfunction isLowercaseLetter(codePoint) {\n // A code point between U+0061 LATIN SMALL LETTER A (a) and U+007A LATIN SMALL LETTER Z (z) inclusive.\n return codePoint >= 0x0061 && codePoint <= 0x007A;\n}\n\nfunction isLetter(codePoint) {\n // An uppercase letter or a lowercase letter.\n return isUppercaseLetter(codePoint) || isLowercaseLetter(codePoint);\n}\n\nfunction nonASCIICodePoint(codePoint) {\n // A code point with a value equal to or greater than U+0080 .\n return codePoint >= 0x0080;\n}\nfunction isIdentStartCodePoint(codePoint) {\n // A letter, a non-ASCII code point, or U+005F LOW LINE (_).\n return isLetter(codePoint) || nonASCIICodePoint(codePoint) || codePoint === 0x005F;\n}\n\nfunction isIdentCodePoint(codePoint) {\n // An ident-start code point, a digit, or U+002D HYPHEN-MINUS (-).\n return isIdentStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === 0x002D;\n}\n\nfunction isNonPrintableCodePoint(codePoint) {\n // A code point between U+0000 NULL and U+0008 BACKSPACE inclusive, or U+000B LINE TABULATION,\n // or a code point between U+000E SHIFT OUT and U+001F INFORMATION SEPARATOR ONE inclusive, or U+007F DELETE.\n return (codePoint >= 0x0000 && codePoint <= 0x0008) || codePoint === 0x000B ||\n (codePoint >= 0x000E && codePoint <= 0x001F) || codePoint === 0x007F;\n}\n\nfunction validEscape(firstCodePoint, secondCodePoint) {\n // If the first code point is not U+005C REVERSE SOLIDUS (\\), return false.\n // Otherwise, if the second code point is a newline, return false.\n // Otherwise, return true.\n return firstCodePoint === 0x005C && !isNewline(secondCodePoint);\n}\n\nfunction startsIdentSequence(firstCodePoint, secondCodePoint, thirdCodePoint) {\n // Look at the first code point:\n if (firstCodePoint === 0x002D) {\n // U+002D HYPHEN-MINUS\n // If the second code point is an ident-start code point or a U+002D HYPHEN-MINUS,\n // or the second and third code points are a valid escape, return true. Otherwise, return false.\n return isIdentStartCodePoint(secondCodePoint) || secondCodePoint === 0x002D ||\n validEscape(secondCodePoint, thirdCodePoint);\n } else if (isIdentStartCodePoint(firstCodePoint)) {\n // ident-start code point\n // Return true.\n return true;\n } else if (firstCodePoint === 0x005C) {\n // U+005C REVERSE SOLIDUS (\\)\n // If the first and second code points are a valid escape, return true. Otherwise, return false.\n return validEscape(firstCodePoint, secondCodePoint);\n } else {\n // anything else\n // Return false.\n return false;\n }\n}\n\nfunction startsNumber(firstCodePoint, secondCodePoint, thirdCodePoint) {\n // https://www.w3.org/TR/css-syntax-3/#check-if-three-code-points-would-start-a-number\n // Look at the first code point:\n\n if (firstCodePoint === 0x002B || firstCodePoint === 0x002D) {\n // U+002B PLUS SIGN (+)\n // U+002D HYPHEN-MINUS (-)\n // If the second code point is a digit, return true.\n // Otherwise, if the second code point is a U+002E FULL STOP (.) and the third code point is a digit, return true.\n //\n // Otherwise, return false.\n return isDigit(secondCodePoint) || (secondCodePoint === 0x002E && isDigit(thirdCodePoint));\n } else if (firstCodePoint === 0x002E) {\n // U+002E FULL STOP (.)\n // If the second code point is a digit, return true. Otherwise, return false.\n return isDigit(secondCodePoint);\n } else {\n // digit\n // Return true.\n // anything else\n // Return false.\n return isDigit(firstCodePoint);\n }\n}\n\n/**\n * Consume an escaped code point\n * https://www.w3.org/TR/css-syntax-3/#consume-an-escaped-code-point\n *\n * @param {InputStream} input\n * @return number\n */\nfunction consumeEscapedCodePoint(input) {\n // Consume the next input code point.\n const codePoint = input.consume();\n if (isHexDigit(codePoint)) {\n let digits = [codePoint];\n // hex digit\n // Consume as many hex digits as possible, but no more than 5. Note that this means 1-6 hex digits have been\n // consumed in total.\n while(isHexDigit(...input.peek()) && digits.length < 5) {\n digits.push(input.consume());\n }\n\n // If the next input code point is whitespace, consume it as well.\n if (isWhitespace(...input.peek())) {\n input.consume();\n }\n\n // Interpret the hex digits as a hexadecimal number. If this number is zero, or is for a surrogate, or is greater\n // than the maximum allowed code point, return U+FFFD REPLACEMENT CHARACTER (�). Otherwise, return the code point\n // with that value.\n const number = parseInt(String.fromCodePoint(...digits), 16);\n if (number === 0 || number > 0x10FFFF) {\n return 0xFFFD;\n } else {\n return number;\n }\n } else if (typeof codePoint === 'undefined') {\n // EOF\n // This is a parse error. Return U+FFFD REPLACEMENT CHARACTER (�).\n return 0xFFFD;\n } else {\n // anything else\n // Return the current input code point.\n return codePoint;\n }\n}\n\n\n/**\n * Consume a string token\n * https://www.w3.org/TR/css-syntax-3/#consume-a-string-token\n *\n * @param {InputStream} input\n * @param {number} endingCodePoint\n */\nfunction consumeStringToken(input, endingCodePoint) {\n const stringToken = new StringToken('');\n\n while (true) {\n // Repeatedly consume the next input code point from the stream:\n const codePoint = input.consume();\n if (codePoint === endingCodePoint) {\n // ending code point\n // Return the .\n return stringToken;\n } else if (typeof codePoint === 'undefined') {\n // EOF\n // This is a parse error. Return the .\n return stringToken\n } else if (codePoint === 0x00A) {\n // newline\n // This is a parse error. Reconsume the current input code point, create a , and return it.\n input.reconsume(codePoint);\n return new BadStringToken();\n } else if (codePoint === 0x005C) {\n // U+005C REVERSE SOLIDUS (\\)\n const nextCodePoint = input.peek()[0];\n if (typeof nextCodePoint === 'undefined') {\n // If the next input code point is EOF, do nothing.\n } else if (isNewline(nextCodePoint)) {\n // Otherwise, if the next input code point is a newline, consume it.\n input.consume();\n } else {\n // Otherwise, (the stream starts with a valid escape) consume an escaped code point and\n // append the returned code point to the ’s value.\n stringToken.value += String.fromCodePoint(consumeEscapedCodePoint(input));\n }\n } else {\n // anything else\n // Append the current input code point to the ’s value.\n stringToken.value += String.fromCodePoint(codePoint);\n }\n }\n}\n\n/**\n * Consume ident sequence\n * https://www.w3.org/TR/css-syntax-3/#consume-name\n *\n * @param {InputStream} input\n */\nfunction consumeIdentSequence(input) {\n // Let result initially be an empty string.\n let result = '';\n\n // Repeatedly consume the next input code point from the stream:\n while (true) {\n const codePoint = input.consume();\n if (isIdentCodePoint(codePoint)) {\n // ident code point\n // Append the code point to result.\n result += String.fromCodePoint(codePoint);\n } else if (validEscape(...input.peek())) {\n // the stream starts with a valid escape\n // Consume an escaped code point. Append the returned code point to result.\n result += String.fromCodePoint(consumeEscapedCodePoint(input));\n } else {\n // anything else\n // Reconsume the current input code point. Return result.\n input.reconsume(codePoint);\n return result;\n }\n }\n}\n\n/**\n * Consume a number\n * https://www.w3.org/TR/css-syntax-3/#consume-a-number\n *\n * @param {InputStream} input\n */\nfunction consumeNumber(input) {\n // Execute the following steps in order:\n //\n // Initially set type to \"integer\". Let repr be the empty string.\n let type = 'integer';\n let repr = '';\n\n // If the next input code point is U+002B PLUS SIGN (+) or U+002D HYPHEN-MINUS (-), consume it and append it to repr.\n if ([0x002B, 0x002D].includes(input.peek()[0])) {\n repr += String.fromCodePoint(input.consume());\n }\n\n // While the next input code point is a digit, consume it and append it to repr.\n while(isDigit(...input.peek())) {\n repr += String.fromCodePoint(input.consume());\n }\n\n // If the next 2 input code points are U+002E FULL STOP (.) followed by a digit, then:\n // Consume them.\n // Append them to repr.\n // Set type to \"number\".\n // While the next input code point is a digit, consume it and append it to repr.\n if (input.peek()[0] === 0x002E && isDigit(input.peek()[1])) {\n repr += String.fromCodePoint(input.consume(), input.consume());\n type = 'number';\n while(isDigit(...input.peek())) {\n repr += String.fromCodePoint(input.consume());\n }\n }\n\n // If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e),\n // optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+),\n // followed by a digit, then:\n // Consume them.\n // Append them to repr.\n // Set type to \"number\".\n // While the next input code point is a digit, consume it and append it to repr.\n if ([0x0045, 0x0065].includes(input.peek()[0])) {\n if ([0x002D, 0x002B].includes(input.peek()[1]) && isDigit(input.peek()[2])) {\n repr += String.fromCodePoint(input.consume(), input.consume(), input.consume());\n type = 'number';\n } else if (isDigit(input.peek()[1])) {\n repr += String.fromCodePoint(input.consume(), input.consume());\n type = 'number';\n }\n }\n\n // Convert repr to a number, and set the value to the returned value.\n const value = parseFloat(repr);\n // Return value and type.\n return { value, type };\n}\n\n/**\n * Consume a numeric token\n * https://www.w3.org/TR/css-syntax-3/#consume-a-numeric-token\n *\n * @param {InputStream} input\n */\nfunction consumeNumericToken(input) {\n // Consume a number and let number be the result.\n let number = consumeNumber(input);\n // If the next 3 input code points would start an ident sequence, then:\n if (startsIdentSequence(...input.peek())) {\n // Create a with the same value and type flag as number, and a unit set initially to the empty string.\n // Consume an ident sequence. Set the ’s unit to the returned value.\n // Return the .\n return new DimensionToken(number.value, number.type, consumeIdentSequence(input));\n } else if (input.peek()[0] === 0x0025) {\n // Otherwise, if the next input code point is U+0025 PERCENTAGE SIGN (%), consume it.\n // Create a with the same value as number, and return it.\n input.consume();\n return new PercentageToken(number.value);\n } else {\n // Otherwise, create a with the same value and type flag as number, and return it.\n return new NumberToken(number.value, number.type);\n }\n}\n\n/**\n * Consume remnants of a bad url\n * https://www.w3.org/TR/css-syntax-3/#consume-the-remnants-of-a-bad-url\n * @param {InputStream} input\n */\nfunction consumeRemnantsOfBadUrl(input) {\n // Repeatedly consume the next input code point from the stream:\n while (true) {\n const codePoint = input.consume();\n if (codePoint === 0x0029 || typeof codePoint === 'undefined') {\n // U+0029 RIGHT PARENTHESIS ())\n // EOF\n // Return.\n return;\n } else if (validEscape(...input.peek())) {\n // the input stream starts with a valid escape\n // Consume an escaped code point. This allows an escaped right parenthesis (\"\\)\") to be encountered without\n // ending the . This is otherwise identical to the \"anything else\" clause.\n consumeEscapedCodePoint(input);\n }\n // anything else\n // Do nothing.\n }\n}\n\n/**\n * Consume URL token\n * https://www.w3.org/TR/css-syntax-3/#consume-a-url-token\n * @param {InputStream} input\n */\nfunction consumeUrlToken(input) {\n // Initially create a with its value set to the empty string.\n const urlToken = new UrlToken('');\n\n // Consume as much whitespace as possible.\n while(isWhitespace(...input.peek())) {\n input.consume();\n }\n\n // Repeatedly consume the next input code point from the stream:\n while (true) {\n const codePoint = input.consume();\n if (codePoint === 0x0029) {\n\n // U+0029 RIGHT PARENTHESIS ())\n // Return the .\n return urlToken;\n } else if (typeof codePoint === 'undefined') {\n // EOF\n // This is a parse error. Return the .\n return urlToken;\n } else if (isWhitespace(codePoint)) {\n // whitespace\n // Consume as much whitespace as possible.\n while(isWhitespace(...input.peek())) {\n input.consume();\n }\n if (input.peek()[0] === 0x0029 || typeof input.peek()[0] === 'undefined') {\n // If the next input code point is U+0029 RIGHT PARENTHESIS ()) or EOF,\n // consume it and return the (if EOF was encountered, this is a parse error);\n input.consume();\n return urlToken;\n } else {\n // otherwise, consume the remnants of a bad url, create a , and return it.\n consumeRemnantsOfBadUrl(input);\n return new BadUrlToken();\n }\n } else if ([0x0022, 0x0027, 0x0028].includes(codePoint) || isNonPrintableCodePoint(codePoint)) {\n // U+0022 QUOTATION MARK (\")\n // U+0027 APOSTROPHE (')\n // U+0028 LEFT PARENTHESIS (()\n // non-printable code point\n // This is a parse error. Consume the remnants of a bad url, create a , and return it.\n consumeRemnantsOfBadUrl(input);\n return new BadUrlToken();\n } else if (codePoint === 0x005C) {\n // U+005C REVERSE SOLIDUS (\\)\n if (validEscape(...input.peek())) {\n // If the stream starts with a valid escape,\n // consume an escaped code point and append the returned code point to the ’s value.\n urlToken.value += consumeEscapedCodePoint(input);\n } else {\n // Otherwise, this is a parse error. Consume the remnants of a bad url, create a , and return it.\n consumeRemnantsOfBadUrl(input);\n return new BadUrlToken();\n }\n } else {\n // anything else\n // Append the current input code point to the ’s value.\n urlToken.value += String.fromCodePoint(codePoint);\n }\n }\n}\n\n/**\n * Consume ident like token\n * https://www.w3.org/TR/css-syntax-3/#consume-an-ident-like-token\n *\n * @param {InputStream} input\n */\nfunction consumeIdentLikeToken(input) {\n // Consume an ident sequence, and let string be the result.\n const str = consumeIdentSequence(input);\n if (str.match(/url/i) && input.peek()[0] === 0x0028) {\n // If string’s value is an ASCII case-insensitive match for \"url\",\n // and the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.\n input.consume();\n // While the next two input code points are whitespace, consume the next input code point.\n while(isWhitespace(input.peek()[0]) && isWhitespace(input.peek()[1])) {\n input.consume();\n }\n\n if ([0x0022, 0x0027].includes(input.peek()[0]) ||\n (isWhitespace(input.peek()[0]) && [0x0022, 0x0027].includes(input.peek()[1]))) {\n // If the next one or two input code points are U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('),\n // or whitespace followed by U+0022 QUOTATION MARK (\") or U+0027 APOSTROPHE ('),\n // then create a with its value set to string and return it.\n return new FunctionToken(str);\n } else {\n // Otherwise, consume a url token, and return it.\n return consumeUrlToken(input);\n }\n } else if (input.peek()[0] === 0x0028) {\n // Otherwise, if the next input code point is U+0028 LEFT PARENTHESIS ((), consume it.\n // Create a with its value set to string and return it.\n input.consume();\n return new FunctionToken(str);\n } else {\n // Otherwise, create an with its value set to string and return it.\n return new IdentToken(str);\n }\n}\n/**\n * Consume a token.\n *\n * https://www.w3.org/TR/css-syntax-3/#consume-a-token\n *\n * @param {InputStream} input\n */\nfunction consumeToken(input) {\n // Consume the next input code point\n const codePoint = input.consume()\n const lookahead = input.peek()\n if (isWhitespace(codePoint)) {\n // whitespace\n // Consume as much whitespace as possible. Return a .\n while(isWhitespace(...input.peek())) {\n input.consume();\n }\n return new WhitespaceToken();\n } else if (codePoint === 0x0022) {\n // U+0022 QUOTATION MARK (\")\n // Consume a string token and return it.\n return consumeStringToken(input, codePoint);\n } else if (codePoint === 0x0023) {\n // U+0023 NUMBER SIGN (#)\n // If the next input code point is an ident code point or the next two input code points are a valid escape, then:\n // Create a .\n // If the next 3 input code points would start an ident sequence, set the ’s type flag to \"id\".\n // Consume an ident sequence, and set the ’s value to the returned string.\n // Return the .\n // Otherwise, return a with its value set to the current input code point.\n if (isIdentCodePoint(lookahead[0]) || validEscape(...lookahead)) {\n const hashToken = new HashToken();\n if (startsIdentSequence(...lookahead)) {\n hashToken.type = 'id';\n }\n hashToken.value = consumeIdentSequence(input);\n return hashToken;\n } else {\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x0027) {\n // U+0027 APOSTROPHE (')\n // Consume a string token and return it.\n return consumeStringToken(input, codePoint);\n } else if (codePoint === 0x0028) {\n // U+0028 LEFT PARENTHESIS (()\n // Return a <(-token>.\n return new LeftParenthesisToken();\n } else if (codePoint === 0x0029) {\n // U+0029 RIGHT PARENTHESIS ())\n // Return a <)-token>.\n return new RightParenthesisToken();\n } else if (codePoint === 0x002B) {\n // U+002B PLUS SIGN (+)\n // If the input stream starts with a number, reconsume the current input code point, consume a numeric token,\n // and return it.\n // Otherwise, return a with its value set to the current input code point.\n if (startsNumber(...lookahead)) {\n input.reconsume(codePoint);\n return consumeNumericToken(input);\n } else {\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x002C) {\n // U+002C COMMA (,)\n // Return a .\n return new CommaToken();\n } else if (codePoint === 0x002D) {\n // U+002D HYPHEN-MINUS (-)\n if (startsNumber(...input.peek())) {\n // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.\n input.reconsume(codePoint);\n return consumeNumericToken(input);\n } else if (input.peek()[0] === 0x002D && input.peek()[1] === 0x003E) {\n // Otherwise, if the next 2 input code points are U+002D HYPHEN-MINUS U+003E GREATER-THAN SIGN (->), consume them and return a .\n input.consume();\n input.consume();\n return new CDCToken();\n } else if (startsIdentSequence(...input.peek())) {\n // Otherwise, if the input stream starts with an ident sequence, reconsume the current input code point, consume an ident-like token, and return it.\n input.reconsume(codePoint);\n return consumeIdentLikeToken(input);\n } else {\n // Otherwise, return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x002E) {\n // U+002E FULL STOP (.)\n if (startsNumber(...input.peek())) {\n // If the input stream starts with a number, reconsume the current input code point, consume a numeric token, and return it.\n input.reconsume(codePoint);\n return consumeNumericToken(input);\n } else {\n // Otherwise, return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x003A) {\n // U+003A COLON (:)\n // Return a .\n return new ColonToken();\n } else if (codePoint === 0x003B) {\n // U+003B SEMICOLON (;)\n // Return a .\n return new SemicolonToken();\n } else if (codePoint === 0x003C) {\n // U+003C LESS-THAN SIGN (<)\n if (lookahead[0] === 0x0021 && lookahead[1] === 0x002D && lookahead[2] === 0x002D) {\n // If the next 3 input code points are U+0021 EXCLAMATION MARK U+002D HYPHEN-MINUS U+002D HYPHEN-MINUS (!--), consume them and return a .\n input.consume();\n input.consume();\n input.consume();\n return new CDOToken();\n } else {\n // Otherwise, return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x0040) {\n // U+0040 COMMERCIAL AT (@)\n if (startsIdentSequence(...lookahead)) {\n // If the next 3 input code points would start an ident sequence, consume an ident sequence,\n // create an with its value set to the returned value, and return it.\n return new AtKeywordToken(consumeIdentSequence(input));\n } else {\n // Otherwise, return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x005B) {\n // U+005B LEFT SQUARE BRACKET ([)\n // Return a <[-token>.\n return new LeftSquareBracketToken();\n } else if (codePoint === 0x005C) {\n // U+005C REVERSE SOLIDUS (\\)\n if (validEscape(...lookahead)) {\n // If the input stream starts with a valid escape, reconsume the current input code point, consume an ident-like token, and return it.\n input.reconsume(codePoint);\n return consumeIdentLikeToken(input);\n } else {\n // Otherwise, this is a parse error. Return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n } else if (codePoint === 0x005D) {\n // U+005D RIGHT SQUARE BRACKET (])\n // Return a <]-token>.\n return new RightSquareBracketToken();\n } else if (codePoint === 0x007B) {\n // U+007B LEFT CURLY BRACKET ({)\n // Return a <{-token>.\n return new LeftCurlyBracketToken();\n } else if (codePoint === 0x007D) {\n // U+007D RIGHT CURLY BRACKET (})\n // Return a <}-token>.\n return new RightCurlyBracketToken();\n } else if (isDigit(codePoint)) {\n // digit\n // Reconsume the current input code point, consume a numeric token, and return it.\n input.reconsume(codePoint);\n return consumeNumericToken(input);\n } else if (isIdentStartCodePoint(codePoint)) {\n // ident-start code point\n // Reconsume the current input code point, consume an ident-like token, and return it.\n input.reconsume(codePoint);\n return consumeIdentLikeToken(input);\n } else if (typeof codePoint === 'undefined') {\n // EOF\n // Return an .\n return undefined;\n } else {\n // anything else\n // Return a with its value set to the current input code point.\n return new DelimToken(String.fromCodePoint(codePoint));\n }\n}\n\n/**\n * Tokenize a string into an array of CSS tokens.\n * @param {string} str\n */\nexport function tokenizeString(str) {\n const input = new InputStream(str);\n // To tokenize a stream of code points into a stream of CSS tokens input, repeatedly consume a token from input\n // until an is reached, pushing each of the returned tokens into a stream.\n const tokens = [];\n while (true) {\n const token = consumeToken(input);\n if (typeof token === 'undefined') {\n return tokens;\n } else {\n tokens.push(token);\n }\n }\n}","const canonicalUnits = new Set([\"px\", \"deg\", \"s\", \"hz\", \"dppx\", \"number\", \"fr\"]);\n\nexport function isCanonical(unit) {\n return canonicalUnits.has(unit.toLowerCase());\n}\n\nexport function normalizeAxis(axis, computedStyle) {\n if (['x','y'].includes(axis)) return axis;\n\n if (!computedStyle) {\n throw new Error('To determine the normalized axis the computedStyle of the source is required.');\n }\n\n const horizontalWritingMode = computedStyle.writingMode == 'horizontal-tb';\n if (axis === \"block\") {\n axis = horizontalWritingMode ? \"y\" : \"x\";\n } else if (axis === \"inline\") {\n axis = horizontalWritingMode ? \"x\" : \"y\";\n } else {\n throw new TypeError(`Invalid axis “${axis}”`);\n }\n\n return axis;\n}\n\n/**\n * Split an input string into a list of individual component value strings,\n * so that each can be handled as a keyword or parsed with `CSSNumericValue.parse()`;\n *\n * Examples:\n * splitIntoComponentValues('cover'); // ['cover']\n * splitIntoComponentValues('auto 0%'); // ['auto', '100%']\n * splitIntoComponentValues('calc(0% + 50px) calc(100% - 50px)'); // ['calc(0% + 50px)', 'calc(100% - 50px)']\n * splitIntoComponentValues('1px 2px').map(val => CSSNumericValue.parse(val)) // [new CSSUnitValue(1, 'px'), new CSSUnitValue(2, 'px')]\n *\n * @param {string} input\n * @return {string[]}\n */\nexport function splitIntoComponentValues(input) {\n const res = [];\n let i = 0;\n\n function consumeComponentValue() {\n let level = 0;\n const startIndex = i;\n while (i < input.length) {\n const nextChar = input.slice(i, i + 1);\n if (/\\s/.test(nextChar) && level === 0) {\n break;\n } else if (nextChar === '(') {\n level += 1;\n } else if (nextChar === ')') {\n level -= 1;\n if (level === 0) {\n // Consume the next character and break\n i++;\n break;\n }\n }\n i++;\n }\n return input.slice(startIndex, i);\n }\n\n function consumeWhitespace() {\n while (/\\s/.test(input.slice(i, i + 1))) {\n i++;\n }\n }\n\n while(i < input.length) {\n const nextChar = input.slice(i, i + 1);\n if (/\\s/.test(nextChar)) {\n consumeWhitespace();\n } else {\n res.push(consumeComponentValue());\n }\n }\n return res;\n}","import {isCanonical} from \"./utils\";\n\n/**\n * @typedef {{percentageReference: CSSUnitValue, fontSize?: CSSUnitValue}} Info\n */\n\n/**\n * Groups a list of objects by a given string keyed property\n *\n * @template T\n * @param {T[]} items\n * @param {string} key string key\n * @return {Map}\n */\nfunction groupBy(items, key) {\n return items.reduce((groups, item) => {\n if (groups.has(item[key])) {\n groups.get(item[key]).push(item);\n } else {\n groups.set(item[key], [item]);\n }\n return groups;\n }, new Map());\n}\n\n/**\n * Partitions a list into a tuple of lists.\n * The first item in the tuple contains a list of items that pass the test provided by the callback function.\n * The second item in the tuple contains the remaining items\n *\n * @template T\n * @param {T[]} items\n * @param {(item:T) => boolean} callbackFn Returns truthy if item should be put in the first list in the tuple, falsy if it should be put in the second list.\n * @return {[T[],T[]]}\n */\nfunction partition(items, callbackFn) {\n const partA = [];\n const partB = [];\n for (const item of items) {\n if (callbackFn(item)) {\n partA.push(item);\n } else {\n partB.push(item);\n }\n }\n return [partA, partB];\n}\n\n/**\n * Partial implementation of `simplify a calculation tree` applied to CSSNumericValue\n * https://www.w3.org/TR/css-values-4/#simplify-a-calculation-tree\n *\n * @param {CSSNumericValue} root\n * @param {Info} info information used to resolve\n * @return {CSSNumericValue}\n */\nexport function simplifyCalculation(root, info = {}) {\n function simplifyNumericArray(values) {\n return Array.from(values).map((value) => simplifyCalculation(value, info));\n }\n\n // To simplify a calculation tree root:\n if (root instanceof CSSUnitValue) {\n // 1. If root is a numeric value:\n\n if (root.unit === \"percent\" && info.percentageReference) {\n // 1. If root is a percentage that will be resolved against another value, and there is enough information\n // available to resolve it, do so, and express the resulting numeric value in the appropriate canonical unit.\n // Return the value.\n const resolvedValue = (root.value / 100) * info.percentageReference.value;\n const resolvedUnit = info.percentageReference.unit;\n return new CSSUnitValue(resolvedValue, resolvedUnit);\n }\n\n // 2. If root is a dimension that is not expressed in its canonical unit, and there is enough information available\n // to convert it to the canonical unit, do so, and return the value.\n\n // Use Typed OM toSum() to convert values in compatible sets to canonical units\n const sum = root.toSum();\n if (sum && sum.values.length === 1) {\n root = sum.values[0];\n }\n // TODO: handle relative lengths\n if (root instanceof CSSUnitValue && root.unit === 'em' && info.fontSize) {\n root = new CSSUnitValue(root.value * info.fontSize.value, info.fontSize.unit);\n }\n // 3. If root is a that can be resolved, return what it resolves to, simplified.\n if (root instanceof CSSKeywordValue) {\n //https://www.w3.org/TR/css-values-4/#calc-constants\n if (root.value === 'e') {\n return new CSSUnitValue(Math.E, 'number');\n } else if (root.value === 'pi') {\n return new CSSUnitValue(Math.PI, 'number');\n }\n }\n // 4. Otherwise, return root.\n return root;\n }\n\n // 2. If root is any other leaf node (not an operator node):\n if (!root.operator) {\n // 1. If there is enough information available to determine its numeric value, return its value, expressed in the value’s canonical unit.\n // 2. Otherwise, return root.\n return root;\n }\n\n // 3. At this point, root is an operator node. Simplify all the calculation children of root.\n switch (root.operator) {\n case \"sum\":\n root = new CSSMathSum(...simplifyNumericArray(root.values));\n break;\n case \"product\":\n root = new CSSMathProduct(...simplifyNumericArray(root.values));\n break;\n case \"negate\":\n root = new CSSMathNegate(simplifyCalculation(root.value, info));\n break;\n case \"clamp\":\n root = new CSSMathClamp(simplifyCalculation(root.lower, info), simplifyCalculation(root.value, info),\n simplifyCalculation(root.upper, info));\n break;\n case \"invert\":\n root = new CSSMathInvert(simplifyCalculation(root.value, info));\n break;\n case \"min\":\n root = new CSSMathMin(...simplifyNumericArray(root.values));\n break;\n case \"max\":\n root = new CSSMathMax(...simplifyNumericArray(root.values));\n break;\n }\n\n // 4. If root is an operator node that’s not one of the calc-operator nodes, and all of its calculation children are\n // numeric values with enough information to compute the operation root represents, return the result of running\n // root’s operation using its children, expressed in the result’s canonical unit.\n if (root instanceof CSSMathMin || root instanceof CSSMathMax) {\n const children = Array.from(root.values);\n if (children.every(\n (child) => child instanceof CSSUnitValue && child.unit !== \"percent\" && isCanonical(child.unit) && child.unit ===\n children[0].unit)) {\n\n const result = Math[root.operator].apply(Math, children.map(({value}) => value));\n return new CSSUnitValue(result, children[0].unit);\n }\n }\n\n // Note: If a percentage is left at this point, it will usually block simplification of the node, since it needs to be\n // resolved against another value using information not currently available. (Otherwise, it would have been converted\n // to a different value in an earlier step.) This includes operations such as \"min\", since percentages might resolve\n // against a negative basis, and thus end up with an opposite comparative relationship than the raw percentage value\n // would seem to indicate.\n //\n // However, \"raw\" percentages—ones which do not resolve against another value, such as in opacity—might not block\n // simplification.\n\n // 5. If root is a Min or Max node, attempt to partially simplify it:\n if (root instanceof CSSMathMin || root instanceof CSSMathMax) {\n const children = Array.from(root.values);\n const [numeric, rest] = partition(children, (child) => child instanceof CSSUnitValue && child.unit !== \"percent\");\n const unitGroups = Array.from(groupBy(numeric, \"unit\").values());\n // 1. For each node child of root’s children:\n //\n // If child is a numeric value with enough information to compare magnitudes with another child of the same\n // unit (see note in previous step), and there are other children of root that are numeric children with the same\n // unit, combine all such children with the appropriate operator per root, and replace child with the result,\n // removing all other child nodes involved.\n const hasComparableChildren = unitGroups.some(group => group.length > 0);\n if (hasComparableChildren) {\n const combinedGroups = unitGroups.map(group => {\n const result = Math[root.operator].apply(Math, group.map(({value}) => value));\n return new CSSUnitValue(result, group[0].unit);\n });\n if (root instanceof CSSMathMin) {\n root = new CSSMathMin(...combinedGroups, ...rest);\n } else {\n root = new CSSMathMax(...combinedGroups, ...rest);\n }\n }\n\n // 2. If root has only one child, return the child.\n //\n // Otherwise, return root.\n if (children.length === 1) {\n return children[0];\n } else {\n return root;\n }\n }\n\n // If root is a Negate node:\n //\n // If root’s child is a numeric value, return an equivalent numeric value, but with the value negated (0 - value).\n // If root’s child is a Negate node, return the child’s child.\n // Return root.\n if (root instanceof CSSMathNegate) {\n if (root.value instanceof CSSUnitValue) {\n return new CSSUnitValue(0 - root.value.value, root.value.unit);\n } else if (root.value instanceof CSSMathNegate) {\n return root.value.value;\n } else {\n return root;\n }\n }\n\n // If root is an Invert node:\n //\n // If root’s child is a number (not a percentage or dimension) return the reciprocal of the child’s value.\n // If root’s child is an Invert node, return the child’s child.\n // Return root.\n if (root instanceof CSSMathInvert) {\n if (root.value instanceof CSSMathInvert) {\n return root.value.value;\n } else {\n return root;\n }\n }\n\n // If root is a Sum node:\n if (root instanceof CSSMathSum) {\n let children = [];\n // For each of root’s children that are Sum nodes, replace them with their children.\n for (const value of root.values) {\n if (value instanceof CSSMathSum) {\n children.push(...value.values);\n } else {\n children.push(value);\n }\n }\n\n // For each set of root’s children that are numeric values with identical units, remove those children and\n // replace them with a single numeric value containing the sum of the removed nodes, and with the same unit.\n //\n // (E.g. combine numbers, combine percentages, combine px values, etc.)\n function sumValuesWithSameUnit(values) {\n const numericValues = values.filter((c) => c instanceof CSSUnitValue);\n const nonNumericValues = values.filter((c) => !(c instanceof CSSUnitValue));\n\n const summedNumericValues = Array.from(groupBy(numericValues, \"unit\").entries())\n .map(([unit, values]) => {\n const sum = values.reduce((a, {value}) => a + value, 0);\n return new CSSUnitValue(sum, unit);\n });\n return [...nonNumericValues, ...summedNumericValues];\n }\n\n children = sumValuesWithSameUnit(children);\n\n // If root has only a single child at this point, return the child. Otherwise, return root.\n // NOTE: Zero-valued terms cannot be simply removed from a Sum; they can only be combined with other values\n // that have identical units. (This is because the mere presence of a unit, even with a zero value,\n // can sometimes imply a change in behavior.)\n if (children.length === 1) {\n return children[0];\n } else {\n return new CSSMathSum(...children);\n }\n }\n\n // If root is a Product node:\n //\n // For each of root’s children that are Product nodes, replace them with their children.\n if (root instanceof CSSMathProduct) {\n let children = [];\n for (const value of root.values) {\n if (value instanceof CSSMathProduct) {\n children.push(...value.values);\n } else {\n children.push(value);\n }\n }\n\n // If root has multiple children that are numbers (not percentages or dimensions), remove them and replace them with\n // a single number containing the product of the removed nodes.\n const [numbers, rest] = partition(children, (child) => child instanceof CSSUnitValue && child.unit === \"number\");\n if (numbers.length > 1) {\n const product = numbers.reduce((a, {value}) => a * value, 1);\n children = [new CSSUnitValue(product, \"number\"), ...rest];\n }\n\n // If root contains only two children, one of which is a number (not a percentage or dimension) and the other of\n // which is a Sum whose children are all numeric values, multiply all of the Sum’s children by the number,\n // then return the Sum.\n if (children.length === 2) {\n let numeric, sum;\n for (const child of children) {\n if (child instanceof CSSUnitValue && child.unit === \"number\") {\n numeric = child;\n } else if (child instanceof CSSMathSum && [...child.values].every((c) => c instanceof CSSUnitValue)) {\n sum = child;\n }\n }\n if (numeric && sum) {\n return new CSSMathSum(\n ...[...sum.values].map((value) => new CSSUnitValue(value.value * numeric.value, value.unit)));\n }\n }\n\n // If root contains only numeric values and/or Invert nodes containing numeric values, and multiplying the types of\n // all the children (noting that the type of an Invert node is the inverse of its child’s type) results in a type\n // that matches any of the types that a math function can resolve to, return the result of multiplying all the values\n // of the children (noting that the value of an Invert node is the reciprocal of its child’s value),\n // expressed in the result’s canonical unit.\n if (children.every((child) => (child instanceof CSSUnitValue && isCanonical(child.unit)) ||\n (child instanceof CSSMathInvert && child.value instanceof CSSUnitValue && isCanonical(child.value.unit)))) {\n // Use CSS Typed OM to multiply types\n const sum = new CSSMathProduct(...children).toSum();\n if (sum && sum.values.length === 1) {\n return sum.values[0];\n }\n }\n\n // Return root.\n return new CSSMathProduct(...children);\n }\n // Return root.\n return root;\n}\n","import {\n CommaToken,\n DelimToken,\n DimensionToken,\n FunctionToken, IdentToken,\n LeftCurlyBracketToken,\n LeftParenthesisToken,\n LeftSquareBracketToken,\n NumberToken,\n PercentageToken, RightCurlyBracketToken,\n RightParenthesisToken, RightSquareBracketToken,\n Token,\n tokenizeString,\n WhitespaceToken\n} from './tokenizer';\nimport {simplifyCalculation} from './simplify-calculation';\n\n/**\n * @typedef {{[string]: integer}} UnitMap\n * @typedef {[number, UnitMap]} SumValueItem\n * @typedef {SumValueItem[]} SumValue\n * @typedef {null} Failure\n * @typedef {{[string]: integer} & {percentHint: string | undefined}} Type\n * @typedef {{type: 'ADDITION'}|{type: 'MULTIPLICATION'}|{type: 'NEGATE'}|{type: 'INVERT'}} ASTNode\n */\n\nconst failure = null;\nconst baseTypes = [\"percent\", \"length\", \"angle\", \"time\", \"frequency\", \"resolution\", \"flex\"];\n\nconst unitGroups = {\n // https://www.w3.org/TR/css-values-4/#font-relative-lengths\n fontRelativeLengths: {\n units: new Set([\"em\", \"rem\", \"ex\", \"rex\", \"cap\", \"rcap\", \"ch\", \"rch\", \"ic\", \"ric\", \"lh\", \"rlh\"])\n },\n // https://www.w3.org/TR/css-values-4/#viewport-relative-lengths\n viewportRelativeLengths: {\n units: new Set(\n [\"vw\", \"lvw\", \"svw\", \"dvw\", \"vh\", \"lvh\", \"svh\", \"dvh\", \"vi\", \"lvi\", \"svi\", \"dvi\", \"vb\", \"lvb\", \"svb\", \"dvb\",\n \"vmin\", \"lvmin\", \"svmin\", \"dvmin\", \"vmax\", \"lvmax\", \"svmax\", \"dvmax\"])\n },\n // https://www.w3.org/TR/css-values-4/#absolute-lengths\n absoluteLengths: {\n units: new Set([\"cm\", \"mm\", \"Q\", \"in\", \"pt\", \"pc\", \"px\"]),\n compatible: true,\n canonicalUnit: \"px\",\n ratios: {\n \"cm\": 96 / 2.54, \"mm\": (96 / 2.54) / 10, \"Q\": (96 / 2.54) / 40, \"in\": 96, \"pc\": 96 / 6, \"pt\": 96 / 72, \"px\": 1\n }\n },\n // https://www.w3.org/TR/css-values-4/#angles\n angle: {\n units: new Set([\"deg\", \"grad\", \"rad\", \"turn\"]),\n compatible: true,\n canonicalUnit: \"deg\",\n ratios: {\n \"deg\": 1, \"grad\": 360 / 400, \"rad\": 180 / Math.PI, \"turn\": 360\n }\n },\n // https://www.w3.org/TR/css-values-4/#time\n time: {\n units: new Set([\"s\", \"ms\"]),\n compatible: true,\n canonicalUnit: \"s\",\n ratios: {\n \"s\": 1, \"ms\": 1 / 1000\n }\n },\n // https://www.w3.org/TR/css-values-4/#frequency\n frequency: {\n units: new Set([\"hz\", \"khz\"]),\n compatible: true,\n canonicalUnit: \"hz\",\n ratios: {\n \"hz\": 1, \"khz\": 1000\n }\n },\n // https://www.w3.org/TR/css-values-4/#resolution\n resolution: {\n units: new Set([\"dpi\", \"dpcm\", \"dppx\"]),\n compatible: true,\n canonicalUnit: \"dppx\",\n ratios: {\n \"dpi\": 1 / 96, \"dpcm\": 2.54 / 96, \"dppx\": 1\n }\n }\n};\n\nconst unitToCompatibleUnitsMap = new Map();\nfor (const group of Object.values(unitGroups)) {\n if (!group.compatible) {\n continue;\n }\n for (const unit of group.units) {\n unitToCompatibleUnitsMap.set(unit, group);\n }\n}\n\nexport function getSetOfCompatibleUnits(unit) {\n return unitToCompatibleUnitsMap.get(unit);\n}\n\n/**\n * Implementation of `product of two unit maps` from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#product-of-two-unit-maps\n *\n * @param {UnitMap} units1 map of units (strings) to powers (integers)\n * @param {UnitMap} units2 map of units (strings) to powers (integers)\n * @return {UnitMap} map of units (strings) to powers (integers)\n */\nfunction productOfTwoUnitMaps(units1, units2) {\n // 1. Let result be a copy of units1.\n const result = {...units1};\n // 2. For each unit → power in units2:\n for (const unit of Object.keys(units2)) {\n if (result[unit]) {\n // 1. If result[unit] exists, increment result[unit] by power.\n result[unit] += units2[unit];\n } else {\n // 2. Otherwise, set result[unit] to power.\n result[unit] = units2[unit];\n }\n }\n // 3. Return result.\n return result;\n}\n\n/**\n * Implementation of `create a type` from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#create-a-type\n *\n * @param {string} unit\n * @return {Type|Failure}\n */\nexport function createAType(unit) {\n if (unit === \"number\") {\n return {};\n } else if (unit === \"percent\") {\n return {\"percent\": 1};\n } else if (unitGroups.absoluteLengths.units.has(unit) || unitGroups.fontRelativeLengths.units.has(unit) ||\n unitGroups.viewportRelativeLengths.units.has(unit)) {\n return {\"length\": 1};\n } else if (unitGroups.angle.units.has(unit)) {\n return {\"angle\": 1};\n } else if (unitGroups.time.units.has(unit)) {\n return {\"time\": 1};\n } else if (unitGroups.frequency.units.has(unit)) {\n return {\"frequency\": 1};\n } else if (unitGroups.resolution.units.has(unit)) {\n return {\"resolution\": 1};\n } else if (unit === \"fr\") {\n return {\"flex\": 1};\n } else {\n return failure;\n }\n}\n\n/**\n * Partial implementation of `create a sum value` from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#create-a-sum-value\n *\n * Supports CSSUnitValue, CSSMathProduct and CSSMathInvert with a CSSUnitValue value.\n * Other types are not supported, and will throw an error.\n *\n * @param {CSSNumericValue} cssNumericValue\n * @return {SumValue} Abstract representation of a CSSNumericValue as a sum of numbers with (possibly complex) units\n */\nexport function createSumValue(cssNumericValue) {\n if (cssNumericValue instanceof CSSUnitValue) {\n let {unit, value} = cssNumericValue;\n // Let unit be the value of this’s unit internal slot, and value be the value of this’s value internal slot.\n // If unit is a member of a set of compatible units, and is not the set’s canonical unit,\n // multiply value by the conversion ratio between unit and the canonical unit, and change unit to the canonical unit.\n const compatibleUnits = getSetOfCompatibleUnits(cssNumericValue.unit);\n if (compatibleUnits && unit !== compatibleUnits.canonicalUnit) {\n value *= compatibleUnits.ratios[unit];\n unit = compatibleUnits.canonicalUnit;\n }\n\n if (unit === \"number\") {\n // If unit is \"number\", return «(value, «[ ]»)».\n return [[value, {}]];\n } else {\n // Otherwise, return «(value, «[unit → 1]»)».\n return [[value, {[unit]: 1}]];\n }\n } else if (cssNumericValue instanceof CSSMathInvert) {\n if (!(cssNumericValue.value instanceof CSSUnitValue)) {\n // Limit implementation to CSSMathInvert of CSSUnitValue\n throw new Error(\"Not implemented\");\n }\n // 1. Let values be the result of creating a sum value from this’s value internal slot.\n const values = createSumValue(cssNumericValue.value);\n // 2. If values is failure, return failure.\n if (values === failure) {\n return failure;\n }\n // 3. If the length of values is more than one, return failure.\n if (values.length > 1) {\n return failure;\n }\n // 4. Invert (find the reciprocal of) the value of the item in values, and negate the value of each entry in its unit map.\n const item = values[0];\n const tempUnionMap = {};\n for (const [unit, power] of Object.entries(item[1])) {\n tempUnionMap[unit] = -1 * power;\n }\n values[0] = [1 / item[0], tempUnionMap];\n\n // 5. Return values.\n return values;\n } else if (cssNumericValue instanceof CSSMathProduct) {\n // 1. Let values initially be the sum value «(1, «[ ]»)». (I.e. what you’d get from 1.)\n\n let values = [[1, {}]];\n\n // 2. For each item in this’s values internal slot:\n for (const item of cssNumericValue.values) {\n // 1. Let new values be the result of creating a sum value from item. Let temp initially be an empty list.\n const newValues = createSumValue(item);\n const temp = [];\n // 2. If new values is failure, return failure.\n if (newValues === failure) {\n return failure;\n }\n // 3. For each item1 in values:\n for (const item1 of values) {\n // 1. For each item2 in new values:\n for (const item2 of newValues) {\n // 1. Let item be a tuple with its value set to the product of the values of item1 and item2, and its unit\n // map set to the product of the unit maps of item1 and item2, with all entries with a zero value removed.\n // 2. Append item to temp.\n temp.push([item1[0] * item2[0], productOfTwoUnitMaps(item1[1], item2[1])]);\n }\n }\n // 4. Set values to temp.\n values = temp;\n }\n // Return values.\n return values;\n } else {\n throw new Error(\"Not implemented\");\n }\n}\n\n\n/**\n * Implementation of `to(unit)` for CSSNumericValue from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#dom-cssnumericvalue-to\n *\n * Converts an existing CSSNumeric value into another with the specified unit, if possible.\n *\n * @param {CSSNumericValue} cssNumericValue value to convert\n * @param {string} unit\n * @return {CSSUnitValue}\n */\nexport function to(cssNumericValue, unit) {\n // Let type be the result of creating a type from unit. If type is failure, throw a SyntaxError.\n const type = createAType(unit);\n if (type === failure) {\n throw new SyntaxError(\"The string did not match the expected pattern.\");\n }\n\n // Let sum be the result of creating a sum value from this.\n const sumValue = createSumValue(cssNumericValue);\n\n // If sum is failure, throw a TypeError.\n if (!sumValue) {\n throw new TypeError();\n }\n\n // If sum has more than one item, throw a TypeError.\n if (sumValue.length > 1) {\n throw new TypeError(\"Sum has more than one item\");\n }\n\n // Otherwise, let item be the result of creating a CSSUnitValue\n // from the sole item in sum, then converting it to unit.\n const item = convertCSSUnitValue(createCSSUnitValue(sumValue[0]), unit);\n\n\n // If item is failure, throw a TypeError.\n if (item === failure) {\n throw new TypeError();\n }\n // Return item.\n return item;\n}\n\n/**\n * Implementation of `create a CSSUnitValue from a sum value item` from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#create-a-cssunitvalue-from-a-sum-value-item\n *\n * @param {SumValueItem} sumValueItem a tuple of a value, and a unit map\n * @return {CSSUnitValue|Failure}\n */\nexport function createCSSUnitValue(sumValueItem) {\n const [value, unitMap] = sumValueItem;\n // When asked to create a CSSUnitValue from a sum value item item, perform the following steps:\n // If item has more than one entry in its unit map, return failure.\n const entries = Object.entries(unitMap);\n if (entries.length > 1) {\n return failure;\n }\n // If item has no entries in its unit map, return a new CSSUnitValue whose unit internal slot is set to \"number\",\n // and whose value internal slot is set to item’s value.\n if (entries.length === 0) {\n return new CSSUnitValue(value, \"number\");\n }\n // Otherwise, item has a single entry in its unit map. If that entry’s value is anything other than 1, return failure.\n const entry = entries[0];\n if (entry[1] !== 1) {\n return failure;\n }\n // Otherwise, return a new CSSUnitValue whose unit internal slot is set to that entry’s key, and whose value internal slot is set to item’s value.\n else {\n return new CSSUnitValue(value, entry[0]);\n }\n}\n\n/**\n * Implementation of `convert a CSSUnitValue` from css-typed-om-1:\n * https://www.w3.org/TR/css-typed-om-1/#convert-a-cssunitvalue\n\n * @param {CSSUnitValue} cssUnitValue\n * @param {string} unit\n * @return {CSSUnitValue|Failure}\n */\nexport function convertCSSUnitValue(cssUnitValue, unit) {\n // Let old unit be the value of this’s unit internal slot, and old value be the value of this’s value internal slot.\n const oldUnit = cssUnitValue.unit;\n const oldValue = cssUnitValue.value;\n // If old unit and unit are not compatible units, return failure.\n const oldCompatibleUnitGroup = getSetOfCompatibleUnits(oldUnit);\n const compatibleUnitGroup = getSetOfCompatibleUnits(unit);\n if (!compatibleUnitGroup || oldCompatibleUnitGroup !== compatibleUnitGroup) {\n return failure;\n }\n // Return a new CSSUnitValue whose unit internal slot is set to unit, and whose value internal slot is set to\n // old value multiplied by the conversation ratio between old unit and unit.\n return new CSSUnitValue(oldValue * compatibleUnitGroup.ratios[oldUnit] / compatibleUnitGroup.ratios[unit], unit);\n}\n\n/**\n * Partial implementation of `toSum(...units)`:\n * https://www.w3.org/TR/css-typed-om-1/#dom-cssnumericvalue-tosum\n *\n * The implementation is restricted to conversion without units.\n * It simplifies a CSSNumericValue into a minimal sum of CSSUnitValues.\n * Will throw an error if called with units.\n *\n * @param {CSSNumericValue} cssNumericValue value to convert to a CSSMathSum\n * @param {string[]} units Not supported in this implementation\n * @return {CSSMathSum}\n */\nexport function toSum(cssNumericValue, ...units) {\n // The toSum(...units) method converts an existing CSSNumericValue this into a CSSMathSum of only CSSUnitValues\n // with the specified units, if possible. (It’s like to(), but allows the result to have multiple units in it.)\n // If called without any units, it just simplifies this into a minimal sum of CSSUnitValues.\n // When called, it must perform the following steps:\n //\n // For each unit in units, if the result of creating a type from unit is failure, throw a SyntaxError.\n //\n if (units && units.length) {\n // Only unitless method calls are implemented in this polyfill\n throw new Error(\"Not implemented\");\n }\n\n // Let sum be the result of creating a sum value from this. If sum is failure, throw a TypeError.\n const sum = createSumValue(cssNumericValue);\n\n // Let values be the result of creating a CSSUnitValue for each item in sum. If any item of values is failure,\n // throw a TypeError.\n const values = sum.map(item => createCSSUnitValue(item));\n if (values.some(value => value === failure)) {\n throw new TypeError(\"Type error\");\n }\n\n // If units is empty, sort values in code point order according to the unit internal slot of its items,\n // then return a new CSSMathSum object whose values internal slot is set to values.\n return new CSSMathSum(...values);\n}\n\n/**\n * Implementation of `invert a type` from css-typed-om-1 Editors Draft:\n * https://drafts.css-houdini.org/css-typed-om/\n *\n * @param {Type} type\n * @return {Type}\n */\nexport function invertType(type) {\n // To invert a type type, perform the following steps:\n // Let result be a new type with an initially empty ordered map and an initially null percent hint\n // For each unit → exponent of type, set result[unit] to (-1 * exponent).\n // Return result.\n const result = {};\n for (const baseType of baseTypes) {\n result[baseType] = -1 * type[baseType];\n }\n return result;\n}\n\n/**\n * Implementation of `multiply two types` from css-typed-om-1 Editor's Draft:\n * https://drafts.css-houdini.org/css-typed-om/#cssnumericvalue-multiply-two-types\n *\n * @param {Type} type1 a map of base types to integers and an associated percent hint\n * @param {Type} type2 a map of base types to integers and an associated percent hint\n * @return {Type|Failure}\n */\nexport function multiplyTypes(type1, type2) {\n if (type1.percentHint && type2.percentHint && type1.percentHint !== type2.percentHint) {\n return failure;\n }\n const finalType = {\n ...type1, percentHint: type1.percentHint ?? type2.percentHint,\n };\n\n for (const baseType of baseTypes) {\n if (!type2[baseType]) {\n continue;\n }\n finalType[baseType] ??= 0;\n finalType[baseType] += type2[baseType];\n }\n return finalType;\n}\n\nclass CSSFunction {\n name;\n values;\n constructor(name, values) {\n this.name = name;\n this.values = values;\n }\n}\n\nclass CSSSimpleBlock {\n value;\n associatedToken;\n constructor(value, associatedToken) {\n this.value = value;\n this.associatedToken = associatedToken;\n }\n}\n\n/**\n * Normalize into a token stream\n * https://www.w3.org/TR/css-syntax-3/#normalize-into-a-token-stream\n */\nfunction normalizeIntoTokenStream(input) {\n // If input is a list of CSS tokens, return input.\n // If input is a list of CSS component values, return input.\n if (Array.isArray(input)) {\n return input;\n }\n // If input is a string, then filter code points from input, tokenize the result, and return the final result.\n if (typeof input === 'string') {\n return tokenizeString(input);\n }\n // Assert: Only the preceding types should be passed as input.\n throw new TypeError(`Invalid input type ${typeof input}`)\n}\n\n/**\n * Consume a function\n * https://www.w3.org/TR/css-syntax-3/#consume-a-function\n * @param {FunctionToken} token\n * @param {Token[]} tokens\n */\nfunction consumeFunction(token, tokens) {\n // Create a function with its name equal to the value of the current input token and with its value initially set to an empty list.\n const func = new CSSFunction(token.value, []);\n\n // Repeatedly consume the next input token and process it as follows:\n while(true) {\n const nextToken = tokens.shift();\n if (nextToken instanceof RightParenthesisToken) {\n // <)-token>\n // Return the function.\n return func;\n } else if (typeof nextToken === 'undefined') {\n // \n // This is a parse error. Return the function.\n return func;\n } else {\n // anything else\n // Reconsume the current input token. Consume a component value and append the returned value to the function’s value.\n tokens.unshift(nextToken);\n func.values.push(consumeComponentValue(tokens));\n }\n }\n}\n\n/**\n * Consume a simple block\n * https://www.w3.org/TR/css-syntax-3/#consume-simple-block\n * @param {Token[]} tokens\n * @param {LeftCurlyBracketToken | LeftParenthesisToken | LeftSquareBracketToken} currentInputToken\n */\nfunction consumeSimpleBlock(tokens, currentInputToken) {\n // The ending token is the mirror variant of the current input token. (E.g. if it was called with <[-token>, the ending token is <]-token>.)\n let endingTokenConstructor ;\n if (currentInputToken instanceof LeftCurlyBracketToken) {\n endingTokenConstructor = RightCurlyBracketToken;\n } else if (currentInputToken instanceof LeftParenthesisToken) {\n endingTokenConstructor = RightParenthesisToken;\n } else if (currentInputToken instanceof LeftSquareBracketToken) {\n endingTokenConstructor = RightSquareBracketToken;\n } else {\n return undefined;\n }\n\n\n // Create a simple block with its associated token set to the current input token and with its value initially set to an empty list.\n const simpleBlock = new CSSSimpleBlock([], currentInputToken);\n\n // Repeatedly consume the next input token and process it as follows:\n while (true) {\n const token = tokens.shift();\n if (token instanceof endingTokenConstructor) {\n // ending token\n // Return the block.\n return simpleBlock;\n } else if (typeof token === 'undefined') {\n // \n // This is a parse error. Return the block.\n return simpleBlock;\n } else {\n // anything else\n // Reconsume the current input token. Consume a component value and append it to the value of the block.\n tokens.unshift(token);\n simpleBlock.value.push(consumeComponentValue(tokens));\n }\n }\n}\n\n/**\n * Consume a component value\n * https://www.w3.org/TR/css-syntax-3/#consume-a-component-value\n * @param {Token[]} tokens\n */\nfunction consumeComponentValue(tokens) {\n const syntaxError = null;\n // Consume the next input token.\n const token = tokens.shift();\n\n if (token instanceof LeftCurlyBracketToken || token instanceof LeftSquareBracketToken || token instanceof LeftParenthesisToken) {\n // If the current input token is a <{-token>, <[-token>, or <(-token>, consume a simple block and return it.\n return consumeSimpleBlock(tokens, token);\n } else if (token instanceof FunctionToken) {\n // Otherwise, if the current input token is a , consume a function and return it.\n return consumeFunction(token, tokens);\n } else {\n // Otherwise, return the current input token.\n return token;\n }\n}\n\n/**\n * Parse a component value\n * https://www.w3.org/TR/css-syntax-3/#parse-component-value\n * @param {string} input\n */\nfunction parseComponentValue(input) {\n const syntaxError = null;\n // To parse a component value from input:\n // 1. Normalize input, and set input to the result.\n const tokens = normalizeIntoTokenStream(input);\n\n // 2. While the next input token from input is a , consume the next input token from input.\n while (tokens[0] instanceof WhitespaceToken) {\n tokens.shift();\n }\n // 3. If the next input token from input is an , return a syntax error.\n if (typeof tokens[0] === 'undefined') {\n return syntaxError;\n }\n // 4. Consume a component value from input and let value be the return value.\n const returnValue = consumeComponentValue(tokens);\n // 5. While the next input token from input is a , consume the next input token.\n while (tokens[0] instanceof WhitespaceToken) {\n tokens.shift();\n }\n // 6. If the next input token from input is an , return value. Otherwise, return a syntax error.\n if (typeof tokens[0] === 'undefined') {\n return returnValue;\n } else {\n return syntaxError;\n }\n}\n\nfunction precedence(token) {\n if (token instanceof LeftParenthesisToken || token instanceof RightParenthesisToken) {\n return 6;\n } else if (token instanceof DelimToken) {\n const value = token.value;\n switch (value) {\n case '*':\n return 4;\n case '/':\n return 4;\n case '+':\n return 2;\n case '-':\n return 2;\n }\n }\n}\n\n\nfunction last(items) {\n return items[items.length - 1];\n}\n\nfunction toNAryAstNode(operatorToken, first, second) {\n // Treat subtraction as instead being addition, with the RHS argument instead wrapped in a special \"negate\" node.\n // Treat division as instead being multiplication, with the RHS argument instead wrapped in a special \"invert\" node.\n\n const type = ['+','-'].includes(operatorToken.value) ? 'ADDITION' : 'MULTIPLICATION';\n const firstValues = first.type === type ? first.values : [first];\n const secondValues = second.type === type ? second.values : [second];\n\n if (operatorToken.value === '-') {\n secondValues[0] = {type: 'NEGATE', value: secondValues[0]};\n } else if (operatorToken.value === '/') {\n secondValues[0] = {type: 'INVERT', value: secondValues[0]};\n }\n return {type, values: [...firstValues, ...secondValues]};\n}\n\n/**\n * Convert expression to AST using the Shunting Yard Algorithm\n * https://en.wikipedia.org/wiki/Shunting_yard_algorithm\n * @param {(Token | CSSFunction)[]} tokens\n * @return {null}\n */\nfunction convertTokensToAST(tokens) {\n const operatorStack = [];\n const tree = [];\n while (tokens.length) {\n const token = tokens.shift();\n if (token instanceof NumberToken || token instanceof DimensionToken || token instanceof PercentageToken ||\n token instanceof CSSFunction || token instanceof CSSSimpleBlock || token instanceof IdentToken) {\n tree.push(token);\n } else if (token instanceof DelimToken && ['*', '/', '+', '-'].includes(token.value)) {\n while (operatorStack.length &&\n !(last(operatorStack) instanceof LeftParenthesisToken) &&\n precedence(last(operatorStack)) > precedence(token)) {\n const o2 = operatorStack.pop();\n const second = tree.pop();\n const first = tree.pop();\n tree.push(toNAryAstNode(o2, first, second));\n }\n operatorStack.push(token);\n } else if (token instanceof LeftParenthesisToken) {\n operatorStack.push(token);\n } else if (token instanceof RightParenthesisToken) {\n if (!operatorStack.length) {\n return null;\n }\n while (!(last(operatorStack) instanceof LeftParenthesisToken) ) {\n const o2 = operatorStack.pop();\n const second = tree.pop();\n const first = tree.pop();\n tree.push(toNAryAstNode(o2, first, second));\n }\n if (!(last(operatorStack) instanceof LeftParenthesisToken)) {\n return null;\n }\n operatorStack.pop();\n } else if (token instanceof WhitespaceToken) {\n // Consume token\n } else {\n return null;\n }\n }\n while(operatorStack.length) {\n if (last(operatorStack) instanceof LeftParenthesisToken) {\n return null;\n }\n const o2 = operatorStack.pop()\n const second = tree.pop();\n const first = tree.pop();\n tree.push(toNAryAstNode(o2, first, second));\n }\n return tree[0];\n}\n\n/**\n * Step 4 of `reify a math expression`\n * https://drafts.css-houdini.org/css-typed-om/#reify-a-math-expression\n *\n * 4. Recursively transform the expression tree into objects, as follows:\n *\n * @param {ASTNode} node\n * @return {CSSMathNegate|CSSMathProduct|CSSMathMin|CSSMathMax|CSSMathSum|CSSNumericValue|CSSUnitValue|CSSMathInvert}\n */\nfunction transformToCSSNumericValue(node) {\n if (node.type === 'ADDITION') {\n // addition node\n // becomes a new CSSMathSum object, with its values internal slot set to its list of arguments\n return new CSSMathSum(...node.values.map(value => transformToCSSNumericValue(value)));\n } else if (node.type === 'MULTIPLICATION') {\n // multiplication node\n // becomes a new CSSMathProduct object, with its values internal slot set to its list of arguments\n return new CSSMathProduct(...node.values.map(value => transformToCSSNumericValue(value)));\n } else if (node.type === 'NEGATE') {\n // negate node\n // becomes a new CSSMathNegate object, with its value internal slot set to its argument\n return new CSSMathNegate(transformToCSSNumericValue(node.value));\n } else if (node.type === 'INVERT') {\n // invert node\n // becomes a new CSSMathInvert object, with its value internal slot set to its argument\n return new CSSMathInvert(transformToCSSNumericValue(node.value));\n } else {\n // leaf node\n // reified as appropriate\n if (node instanceof CSSSimpleBlock) {\n return reifyMathExpression(new CSSFunction('calc', node.value));\n } else if (node instanceof IdentToken) {\n if (node.value === 'e') {\n return new CSSUnitValue(Math.E, 'number');\n } else if (node.value === 'pi') {\n return new CSSUnitValue(Math.PI, 'number');\n } else {\n throw new SyntaxError('Invalid math expression')\n }\n } else {\n return reifyNumericValue(node);\n }\n }\n}\n\n/**\n * Reify a math expression\n * https://drafts.css-houdini.org/css-typed-om/#reify-a-math-expression\n * @param {CSSFunction} num\n */\nfunction reifyMathExpression(num) {\n // TODO: handle `clamp()` and possibly other math functions\n // 1. If num is a min() or max() expression:\n if (num.name === 'min' || num.name === 'max')\n {\n // Let values be the result of reifying the arguments to the expression, treating each argument as if it were the contents of a calc() expression.\n const values = num.values\n .filter(value => !(value instanceof WhitespaceToken || value instanceof CommaToken))\n // TODO: Update when we have clarification on where simplify a calculation should be run:\n // https://github.com/w3c/csswg-drafts/issues/9870\n .map(value => simplifyCalculation(reifyMathExpression(new CSSFunction('calc', value))));\n // Return a new CSSMathMin or CSSMathMax object, respectively, with its values internal slot set to values.\n return num.name === 'min' ? new CSSMathMin(...values) : new CSSMathMax(...values);\n }\n\n // 2. Assert: Otherwise, num is a calc().\n if (num.name !== 'calc') {\n return null;\n }\n\n // 3. Turn num’s argument into an expression tree using standard PEMDAS precedence rules, with the following exceptions/clarification:\n //\n // Treat subtraction as instead being addition, with the RHS argument instead wrapped in a special \"negate\" node.\n // Treat division as instead being multiplication, with the RHS argument instead wrapped in a special \"invert\" node.\n // Addition and multiplication are N-ary; each node can have any number of arguments.\n // If an expression has only a single value in it, and no operation, treat it as an addition node with the single argument.\n const root = convertTokensToAST([...num.values]);\n \n // 4. Recursively transform the expression tree into objects\n const numericValue = transformToCSSNumericValue(root);\n let simplifiedValue;\n try {\n // TODO: Update when we have clarification on where simplify a calculation should be run:\n // https://github.com/w3c/csswg-drafts/issues/9870\n simplifiedValue = simplifyCalculation(numericValue);\n } catch (e) {\n // Use insertRule to trigger native SyntaxError on TypeError\n (new CSSStyleSheet()).insertRule('error', 0);\n }\n if (simplifiedValue instanceof CSSUnitValue) {\n return new CSSMathSum(simplifiedValue);\n } else {\n return simplifiedValue;\n }\n}\n\n/**\n * Reify a numeric value\n * https://drafts.css-houdini.org/css-typed-om/#reify-a-numeric-value\n * @param num\n */\nfunction reifyNumericValue(num) {\n // If an internal representation contains a var() reference, then it is reified by reifying a list of component values,\n // regardless of what property it is for.\n // TODO: handle `var()` function\n\n // If num is a math function, reify a math expression from num and return the result.\n if (num instanceof CSSFunction && ['calc', 'min', 'max', 'clamp'].includes(num.name)) {\n return reifyMathExpression(num);\n }\n // If num is the unitless value 0 and num is a ,\n // return a new CSSUnitValue with its value internal slot set to 0, and its unit internal slot set to \"px\".\n if (num instanceof NumberToken && num.value === 0 && !num.unit) {\n return new CSSUnitValue(0, 'px');\n }\n // Return a new CSSUnitValue with its value internal slot set to the numeric value of num, and its unit internal slot\n // set to \"number\" if num is a , \"percent\" if num is a , and num’s unit if num is a .\n if (num instanceof NumberToken) {\n return new CSSUnitValue(num.value, 'number');\n } else if (num instanceof PercentageToken) {\n return new CSSUnitValue(num.value, 'percent');\n } else if (num instanceof DimensionToken) {\n return new CSSUnitValue(num.value, num.unit);\n }\n}\n\n/**\n * Implementation of the parse(cssText) method.\n * https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumericvalue-parse\n * @param {string} cssText\n * @return {CSSMathMin|CSSMathMax|CSSMathSum|CSSMathProduct|CSSMathNegate|CSSMathInvert|CSSUnitValue}\n */\nexport function parseCSSNumericValue(cssText) {\n // Parse a component value from cssText and let result be the result.\n // If result is a syntax error, throw a SyntaxError and abort this algorithm.\n const result = parseComponentValue(cssText);\n if (result === null) {\n // Use insertRule to trigger native SyntaxError\n (new CSSStyleSheet()).insertRule('error', 0);\n }\n // If result is not a , , , or a math function, throw a SyntaxError and abort this algorithm.\n if (!(result instanceof NumberToken || result instanceof PercentageToken || result instanceof DimensionToken || result instanceof CSSFunction)) {\n // Use insertRule to trigger native SyntaxError\n (new CSSStyleSheet()).insertRule('error', 0);\n }\n // If result is a and creating a type from result’s unit returns failure, throw a SyntaxError and abort this algorithm.\n if (result instanceof DimensionToken) {\n const type = createAType(result.unit);\n if (type === null) {\n // Use insertRule to trigger native SyntaxError\n (new CSSStyleSheet()).insertRule('error', 0);\n }\n }\n // Reify a numeric value result, and return the result.\n return reifyNumericValue(result);\n}","// Copyright 2021 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport {createAType, invertType, multiplyTypes, parseCSSNumericValue, to, toSum} from './numeric-values';\nimport {simplifyCalculation} from './simplify-calculation';\nimport './tokenizer'\n\nexport function installCSSOM() {\n // Object for storing details associated with an object which are to be kept\n // private. This approach allows the constructed objects to more closely\n // resemble their native counterparts when inspected.\n let privateDetails = new WeakMap();\n\n function displayUnit(unit) {\n switch(unit) {\n case 'percent':\n return '%';\n case 'number':\n return '';\n default:\n return unit.toLowerCase();\n }\n }\n\n function toCssUnitValue(v) {\n if (typeof v === 'number')\n return new CSSUnitValue(v, 'number');\n return v;\n }\n\n function toCssNumericArray(values) {\n const result = [];\n for (let i = 0; i < values.length; i++) {\n result[i] = toCssUnitValue(values[i]);\n }\n return result;\n }\n\n class CSSNumericValue {\n static parse(value) {\n if (value instanceof CSSNumericValue) return value;\n\n return simplifyCalculation(parseCSSNumericValue(value), {});\n }\n\n // TODO: Add other methods: add, sub, mul, div, …\n // Spec: https://drafts.css-houdini.org/css-typed-om/#numeric-value\n }\n\n class CSSMathValue extends CSSNumericValue {\n constructor(values, operator, opt_name, opt_delimiter) {\n super();\n privateDetails.set(this, {\n values: toCssNumericArray(values),\n operator: operator,\n name: opt_name || operator,\n delimiter: opt_delimiter || ', '\n });\n }\n\n get operator() {\n return privateDetails.get(this).operator;\n }\n\n get values() {\n return privateDetails.get(this).values;\n }\n\n toString() {\n const details = privateDetails.get(this);\n return `${details.name}(${details.values.join(details.delimiter)})`;\n }\n }\n\n const cssOMTypes = {\n 'CSSNumericValue': CSSNumericValue,\n 'CSSMathValue': CSSMathValue,\n 'CSSUnitValue': class extends CSSNumericValue {\n constructor(value, unit) {\n super();\n privateDetails.set(this, {\n value: value,\n unit: unit\n });\n }\n\n get value() {\n return privateDetails.get(this).value;\n }\n\n set value(value) {\n privateDetails.get(this).value = value;\n }\n\n get unit() {\n return privateDetails.get(this).unit;\n }\n\n to(unit) {\n return to(this, unit)\n }\n\n toSum(...units) {\n return toSum(this, ...units)\n }\n\n type() {\n const details = privateDetails.get(this)\n // The type of a CSSUnitValue is the result of creating a type from its unit internal slot.\n return createAType(details.unit)\n }\n\n toString() {\n const details = privateDetails.get(this);\n return `${details.value}${displayUnit(details.unit)}`;\n }\n },\n\n 'CSSKeywordValue': class {\n constructor(value) {\n this.value = value;\n }\n\n toString() {\n return this.value.toString();\n }\n },\n\n 'CSSMathSum': class extends CSSMathValue {\n constructor(values) {\n super(arguments, 'sum', 'calc', ' + ');\n }\n },\n\n 'CSSMathProduct': class extends CSSMathValue {\n constructor(values) {\n super(arguments, 'product', 'calc', ' * ');\n }\n\n toSum(...units) {\n return toSum(this, ...units)\n }\n\n type() {\n const values = privateDetails.get(this).values;\n // The type is the result of multiplying the types of each of the items in its values internal slot.\n return values.map(v => v.type()).reduce(multiplyTypes)\n }\n },\n\n 'CSSMathNegate': class extends CSSMathValue {\n constructor(values) {\n super([arguments[0]], 'negate', '-');\n }\n\n get value() {\n return privateDetails.get(this).values[0];\n }\n\n type() {\n return this.value.type();\n }\n },\n\n 'CSSMathInvert': class extends CSSMathValue {\n constructor(values) {\n super([1, arguments[0]], 'invert', 'calc', ' / ');\n }\n\n get value() {\n return privateDetails.get(this).values[1];\n }\n\n type() {\n const details = privateDetails.get(this)\n // The type of a CSSUnitValue is the result of creating a type from its unit internal slot.\n return invertType(details.values[1].type())\n }\n },\n\n 'CSSMathMax': class extends CSSMathValue {\n constructor() {\n super(arguments, 'max');\n }\n },\n\n 'CSSMathMin': class extends CSSMathValue {\n constructor() {\n super(arguments, 'min');\n }\n }\n };\n\n if (!window.CSS) {\n if (!Reflect.defineProperty(window, 'CSS', { value: {} }))\n throw Error(`Error installing CSSOM support`);\n }\n\n if (!window.CSSUnitValue) {\n [\n 'number',\n 'percent',\n // Length units\n 'em',\n 'ex',\n 'px',\n 'cm',\n 'mm',\n 'in',\n 'pt',\n 'pc', // Picas\n 'Q', // Quarter millimeter\n 'vw',\n 'vh',\n 'vmin',\n 'vmax',\n 'rems',\n \"ch\",\n // Angle units\n 'deg',\n 'rad',\n 'grad',\n 'turn',\n // Time units\n 'ms',\n 's',\n 'Hz',\n 'kHz',\n // Resolution\n 'dppx',\n 'dpi',\n 'dpcm',\n // Other units\n \"fr\"\n ].forEach((name) => {\n const fn = (value) => {\n return new CSSUnitValue(value, name);\n };\n if (!Reflect.defineProperty(CSS, name, { value: fn }))\n throw Error(`Error installing CSS.${name}`);\n });\n }\n\n for (let [type, value] of Object.entries(cssOMTypes)) {\n if (type in window)\n continue;\n if (!Reflect.defineProperty(window, type, { value }))\n throw Error(`Error installing CSSOM support for ${type}`);\n }\n}\n","// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {installCSSOM} from \"./proxy-cssom.js\";\nimport {simplifyCalculation} from \"./simplify-calculation\";\nimport {normalizeAxis, splitIntoComponentValues} from './utils.js';\n\ninstallCSSOM();\n\nconst DEFAULT_TIMELINE_AXIS = 'block';\n\nlet scrollTimelineOptions = new WeakMap();\nlet sourceDetails = new WeakMap();\n\nexport const ANIMATION_RANGE_NAMES = ['entry', 'exit', 'cover', 'contain', 'entry-crossing', 'exit-crossing'];\n\nfunction scrollEventSource(source) {\n if (source === document.scrollingElement) return document;\n return source;\n}\n\n/**\n * Updates the currentTime for all Web Animation instanced attached to a ScrollTimeline instance\n * @param scrollTimelineInstance {ScrollTimeline}\n */\nfunction updateInternal(scrollTimelineInstance) {\n validateSource(scrollTimelineInstance);\n const details = scrollTimelineOptions.get(scrollTimelineInstance);\n let animations = details.animations;\n if (animations.length === 0) return;\n let timelineTime = scrollTimelineInstance.currentTime;\n for (let i = 0; i < animations.length; i++) {\n animations[i].tickAnimation(timelineTime);\n }\n}\n\n/**\n * Calculates a scroll offset that corrects for writing modes, text direction\n * and a logical axis.\n * @param scrollTimeline {ScrollTimeline}\n * @param axis {String}\n * @returns {Number}\n */\nfunction directionAwareScrollOffset(source, axis) {\n if (!source)\n return null;\n const sourceMeasurements = sourceDetails.get(source).sourceMeasurements;\n const style = getComputedStyle(source);\n // All writing modes are vertical except for horizontal-tb.\n // TODO: sideways-lr should flow bottom to top, but is currently unsupported\n // in Chrome.\n // http://drafts.csswg.org/css-writing-modes-4/#block-flow\n let currentScrollOffset = sourceMeasurements.scrollTop;\n if (normalizeAxis(axis, style) === 'x') {\n // Negative values are reported for scrollLeft when the inline text\n // direction is right to left or for vertical text with a right to left\n // block flow. This is a consequence of shifting the scroll origin due to\n // changes in the overflow direction.\n // http://drafts.csswg.org/cssom-view/#overflow-directions.\n currentScrollOffset = Math.abs(sourceMeasurements.scrollLeft);\n }\n return currentScrollOffset;\n}\n\n/**\n * Determines target effect end based on animation duration, iterations count and start and end delays\n * returned value should always be positive\n * @param options {Animation} animation\n * @returns {number}\n */\nexport function calculateTargetEffectEnd(animation) {\n return animation.effect.getComputedTiming().activeDuration;\n}\n\n/**\n * Calculates scroll offset based on axis and source geometry\n * @param source {DOMElement}\n * @param axis {String}\n * @returns {number}\n */\nexport function calculateMaxScrollOffset(source, axis) {\n const sourceMeasurements = sourceDetails.get(source).sourceMeasurements;\n // Only one horizontal writing mode: horizontal-tb. All other writing modes\n // flow vertically.\n const horizontalWritingMode =\n getComputedStyle(source).writingMode == 'horizontal-tb';\n if (axis === \"block\")\n axis = horizontalWritingMode ? \"y\" : \"x\";\n else if (axis === \"inline\")\n axis = horizontalWritingMode ? \"x\" : \"y\";\n if (axis === \"y\")\n return sourceMeasurements.scrollHeight - sourceMeasurements.clientHeight;\n else if (axis === \"x\")\n return sourceMeasurements.scrollWidth - sourceMeasurements.clientWidth;\n}\n\nfunction resolvePx(cssValue, info) {\n const cssNumericValue = simplifyCalculation(cssValue, info);\n if (cssNumericValue instanceof CSSUnitValue) {\n if (cssNumericValue.unit === 'px') {\n return cssNumericValue.value;\n } else {\n throw TypeError(\"Unhandled unit type \" + cssNumericValue.unit);\n }\n } else {\n throw TypeError('Unsupported value type: ' + typeof (cssValue));\n }\n}\n\n// Detects if the cached source is obsolete, and updates if required\n// to ensure the new source has a scroll listener.\nfunction validateSource(timeline) {\n if (!(timeline instanceof ViewTimeline)) {\n validateAnonymousSource(timeline);\n return;\n }\n\n const node = timeline.subject;\n if (!node) {\n updateSource(timeline, null);\n return;\n }\n\n const display = getComputedStyle(node).display;\n if (display == 'none') {\n updateSource(timeline, null);\n return;\n }\n\n const source = getScrollParent(node);\n updateSource(timeline, source);\n}\n\nfunction validateAnonymousSource(timeline) {\n const details = scrollTimelineOptions.get(timeline);\n if(!details.anonymousSource)\n return;\n\n const source = getAnonymousSourceElement(details.anonymousSource, details.anonymousTarget);\n updateSource(timeline, source);\n}\n\nfunction isValidAxis(axis) {\n return [\"block\", \"inline\", \"x\", \"y\"].includes(axis);\n}\n\n/**\n * Read measurements of source element\n * @param {HTMLElement} source\n * @return {{clientWidth: *, scrollHeight: *, scrollLeft, clientHeight: *, scrollTop, scrollWidth: *}}\n */\nexport function measureSource (source) {\n const style = getComputedStyle(source);\n return {\n scrollLeft: source.scrollLeft,\n scrollTop: source.scrollTop,\n scrollWidth: source.scrollWidth,\n scrollHeight: source.scrollHeight,\n clientWidth: source.clientWidth,\n clientHeight: source.clientHeight,\n writingMode: style.writingMode,\n direction: style.direction,\n scrollPaddingTop: style.scrollPaddingTop,\n scrollPaddingBottom: style.scrollPaddingBottom,\n scrollPaddingLeft: style.scrollPaddingLeft,\n scrollPaddingRight: style.scrollPaddingRight\n };\n}\n\n/**\n * Measure subject element relative to source\n * @param {HTMLElement} source\n * @param {HTMLElement|undefined} subject\n * @param subject\n */\nexport function measureSubject(source, subject) {\n if (!source || !subject) {\n return\n }\n let top = 0;\n let left = 0;\n let node = subject;\n const ancestor = source.offsetParent;\n while (node && node != ancestor) {\n left += node.offsetLeft;\n top += node.offsetTop;\n node = node.offsetParent;\n }\n left -= source.offsetLeft + source.clientLeft;\n top -= source.offsetTop + source.clientTop;\n const style = getComputedStyle(subject);\n return {\n top,\n left,\n offsetWidth: subject.offsetWidth,\n offsetHeight: subject.offsetHeight,\n fontSize: style.fontSize,\n };\n}\n\n/**\n * Update measurements of source, and update timelines\n * @param {HTMLElement} source\n */\nfunction updateMeasurements(source) {\n let details = sourceDetails.get(source);\n details.sourceMeasurements = measureSource(source);\n\n // Update measurements of the subject of connected view timelines\n for (const ref of details.timelineRefs) {\n const timeline = ref.deref();\n if ((timeline instanceof ViewTimeline)) {\n const timelineDetails = scrollTimelineOptions.get(timeline)\n timelineDetails.subjectMeasurements = measureSubject(source, timeline.subject)\n }\n }\n\n if (details.updateScheduled)\n return;\n\n setTimeout(() => {\n // Schedule a task to update timelines after all measurements are completed\n for (const ref of details.timelineRefs) {\n const timeline = ref.deref();\n if (timeline) {\n updateInternal(timeline);\n }\n }\n\n details.updateScheduled = false;\n });\n details.updateScheduled = true;\n}\n\nfunction updateSource(timeline, source) {\n const timelineDetails = scrollTimelineOptions.get(timeline);\n const oldSource = timelineDetails.source;\n if (oldSource == source)\n return;\n\n if (oldSource) {\n const details = sourceDetails.get(oldSource);\n if (details) {\n // Remove timeline reference from old source\n details.timelineRefs.delete(timeline);\n\n // Clean up timeline refs that have been garbage-collected\n const undefinedRefs = Array.from(details.timelineRefs).filter(ref => typeof ref.deref() === 'undefined');\n for (const ref of undefinedRefs) {\n details.timelineRefs.delete(ref);\n }\n\n if (details.timelineRefs.size === 0) {\n // All timelines have been disconnected from the source\n // Clean up\n details.disconnect();\n sourceDetails.delete(oldSource);\n }\n }\n }\n timelineDetails.source = source;\n if (source) {\n let details = sourceDetails.get(source);\n if (!details) {\n // This is the first timeline for this source\n // Store a set of weak refs to connected timelines and current measurements\n details = {\n timelineRefs: new Set(),\n sourceMeasurements: measureSource(source)\n };\n sourceDetails.set(source, details);\n\n // Use resize observer to detect changes to source size\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n updateMeasurements(timelineDetails.source)\n }\n });\n resizeObserver.observe(source);\n for (const child of source.children) {\n resizeObserver.observe(child)\n }\n\n // Use mutation observer to detect updated style attributes on source element\n const mutationObserver = new MutationObserver((records) => {\n for (const record of records) {\n updateMeasurements(record.target);\n }\n });\n mutationObserver.observe(source, {attributes: true, attributeFilter: ['style', 'class']});\n\n const scrollListener = () => {\n // Sample and store scroll pos\n details.sourceMeasurements.scrollLeft = source.scrollLeft;\n details.sourceMeasurements.scrollTop = source.scrollTop;\n\n for (const ref of details.timelineRefs) {\n const timeline = ref.deref();\n if (timeline) {\n updateInternal(timeline);\n }\n }\n };\n scrollEventSource(source).addEventListener(\"scroll\", scrollListener);\n details.disconnect = () => {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n scrollEventSource(source).removeEventListener(\"scroll\", scrollListener);\n };\n }\n\n // Add a weak ref to the timeline so that we can update it when the source changes\n details.timelineRefs.add(new WeakRef(timeline));\n }\n}\n\n/**\n * Removes a Web Animation instance from ScrollTimeline\n * @param scrollTimeline {ScrollTimeline}\n * @param animation {Animation}\n * @param options {Object}\n */\nexport function removeAnimation(scrollTimeline, animation) {\n let animations = scrollTimelineOptions.get(scrollTimeline).animations;\n for (let i = 0; i < animations.length; i++) {\n if (animations[i].animation == animation) {\n animations.splice(i, 1);\n }\n }\n}\n\n/**\n * Attaches a Web Animation instance to ScrollTimeline.\n * @param scrollTimeline {ScrollTimeline}\n * @param animation {Animation}\n * @param tickAnimation {function(number)}\n */\nexport function addAnimation(scrollTimeline, animation, tickAnimation) {\n let animations = scrollTimelineOptions.get(scrollTimeline).animations;\n for (let i = 0; i < animations.length; i++) {\n // @TODO: This early return causes issues when a page with the polyfill\n // is loaded from the BFCache. Ideally, this code gets fixed instead of\n // the workaround which clears the proxyAnimations cache on pagehide.\n // See https://github.com/flackr/scroll-timeline/issues/146#issuecomment-1698159183\n // for details.\n if (animations[i].animation == animation)\n return;\n }\n\n animations.push({\n animation: animation,\n tickAnimation: tickAnimation\n });\n queueMicrotask(() => {\n updateInternal(scrollTimeline);\n });\n}\n\n// TODO: this is a private function used for unit testing add function\nexport function _getStlOptions(scrollTimeline) {\n return scrollTimelineOptions.get(scrollTimeline);\n}\n\nexport class ScrollTimeline {\n constructor(options) {\n scrollTimelineOptions.set(this, {\n source: null,\n axis: DEFAULT_TIMELINE_AXIS,\n anonymousSource: (options ? options.anonymousSource : null),\n anonymousTarget: (options ? options.anonymousTarget : null),\n\n // View timeline\n subject: null,\n inset: null,\n\n // Internal members\n animations: [],\n subjectMeasurements: null\n });\n const source =\n options && options.source !== undefined ? options.source\n : document.scrollingElement;\n updateSource(this, source);\n\n if ((options && options.axis !== undefined) &&\n (options.axis != DEFAULT_TIMELINE_AXIS)) {\n if (!isValidAxis(options.axis)) {\n throw TypeError(\"Invalid axis\");\n }\n\n scrollTimelineOptions.get(this).axis = options.axis;\n }\n\n updateInternal(this);\n }\n\n set source(element) {\n updateSource(this, element);\n updateInternal(this);\n }\n\n get source() {\n return scrollTimelineOptions.get(this).source;\n }\n\n set axis(axis) {\n if (!isValidAxis(axis)) {\n throw TypeError(\"Invalid axis\");\n }\n\n scrollTimelineOptions.get(this).axis = axis;\n updateInternal(this);\n }\n\n get axis() {\n return scrollTimelineOptions.get(this).axis;\n }\n\n get duration() {\n return CSS.percent(100);\n }\n\n get phase() {\n // Per https://drafts.csswg.org/scroll-animations-1/#phase-algorithm\n // Step 1\n const unresolved = null;\n // if source is null\n const container = this.source;\n if (!container) return \"inactive\";\n let scrollerStyle = getComputedStyle(container);\n\n // if source does not currently have a CSS layout box\n if (scrollerStyle.display == \"none\")\n return \"inactive\";\n\n // if source's layout box is not a scroll container\"\n if (container != document.scrollingElement &&\n (scrollerStyle.overflow == 'visible' ||\n scrollerStyle.overflow == \"clip\")) {\n return \"inactive\";\n }\n\n return \"active\"\n }\n\n get currentTime() {\n const unresolved = null;\n const container = this.source;\n if (!container || !container.isConnected) return unresolved;\n if (this.phase == 'inactive')\n return unresolved;\n const scrollerStyle = getComputedStyle(container);\n if (\n scrollerStyle.display === \"inline\" ||\n scrollerStyle.display === \"none\"\n ) {\n return unresolved;\n }\n\n const axis = this.axis;\n const scrollPos = directionAwareScrollOffset(container, axis);\n const maxScrollPos = calculateMaxScrollOffset(container, axis);\n\n return maxScrollPos > 0 ? CSS.percent(100 * scrollPos / maxScrollPos)\n : CSS.percent(100);\n }\n\n get __polyfill() {\n return true;\n }\n}\n\n// Methods for calculation of the containing block.\n// See https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block.\n\nfunction findClosestAncestor(element, matcher) {\n let candidate = element.parentElement;\n while(candidate != null) {\n if (matcher(candidate))\n return candidate;\n candidate = candidate.parentElement;\n }\n}\n\nexport function getAnonymousSourceElement(sourceType, node) {\n switch (sourceType) {\n case 'root':\n return document.scrollingElement;\n case 'nearest':\n return getScrollParent(node);\n case 'self':\n return node;\n default:\n throw new TypeError('Invalid ScrollTimeline Source Type.');\n }\n}\n\nfunction isBlockContainer(element) {\n const style = getComputedStyle(element);\n switch (style.display) {\n case 'block':\n case 'inline-block':\n case 'list-item':\n case 'table':\n case 'table-caption':\n case 'flow-root':\n case 'flex':\n case 'grid':\n return true;\n }\n\n return false;\n}\n\nfunction isFixedElementContainer(element) {\n const style = getComputedStyle(element);\n if (style.transform != 'none' || style.perspective != 'none')\n return true;\n\n if (style.willChange == 'transform' || style.willChange == 'perspective')\n return true;\n\n if (style.filter != 'none' || style.willChange == 'filter')\n return true;\n\n if (style.backdropFilter != 'none')\n return true;\n\n return false;\n}\n\nfunction isAbsoluteElementContainer(element) {\n const style = getComputedStyle(element);\n if (style.position != 'static')\n return true;\n\n return isFixedElementContainer(element);\n}\n\nfunction getContainingBlock(element) {\n switch (getComputedStyle(element).position) {\n case 'static':\n case 'relative':\n case 'sticky':\n return findClosestAncestor(element, isBlockContainer);\n\n case 'absolute':\n return findClosestAncestor(element, isAbsoluteElementContainer);\n\n case 'fixed':\n return findClosestAncestor(element, isFixedElementContainer);\n }\n}\n\nexport function getScrollParent(node) {\n if (!node || !node.isConnected)\n return undefined;\n\n while (node = getContainingBlock(node)) {\n const style = getComputedStyle(node);\n switch(style['overflow-x']) {\n case 'auto':\n case 'scroll':\n case 'hidden':\n // https://drafts.csswg.org/css-overflow-3/#overflow-propagation\n // The UA must apply the overflow from the root element to the viewport;\n // however, if the overflow is visible in both axis, then the overflow\n // of the first visible child body is applied instead.\n if (node == document.body &&\n getComputedStyle(document.scrollingElement).overflow == \"visible\")\n return document.scrollingElement;\n\n return node;\n }\n }\n return document.scrollingElement;\n}\n\n// ---- View timelines -----\n\n// Computes the scroll offsets corresponding to the [0, 100]% range for a\n// specific phase on a view timeline.\n// TODO: Track changes to determine when associated animations require their\n// timing to be renormalized.\nexport function range(timeline, phase) {\n const details = scrollTimelineOptions.get(timeline);\n const subjectMeasurements = details.subjectMeasurements\n const sourceMeasurements = sourceDetails.get(details.source).sourceMeasurements\n\n const unresolved = null;\n if (timeline.phase === 'inactive')\n return unresolved;\n\n if (!(timeline instanceof ViewTimeline))\n return unresolved;\n\n return calculateRange(phase, sourceMeasurements, subjectMeasurements, details.axis, details.inset);\n}\n\nexport function calculateRange(phase, sourceMeasurements, subjectMeasurements, axis, optionsInset) {\n // TODO: handle position sticky\n\n // Determine the view and container size based on the scroll direction.\n // The view position is the scroll position of the logical starting edge\n // of the view.\n const rtl = sourceMeasurements.direction == 'rtl' || sourceMeasurements.writingMode == 'vertical-rl';\n let viewSize = undefined;\n let viewPos = undefined;\n let sizes = {\n fontSize: subjectMeasurements.fontSize\n };\n if (normalizeAxis(axis, sourceMeasurements) === 'x') {\n viewSize = subjectMeasurements.offsetWidth;\n viewPos = subjectMeasurements.left;\n sizes.scrollPadding = [sourceMeasurements.scrollPaddingLeft, sourceMeasurements.scrollPaddingRight];\n if (rtl) {\n viewPos += sourceMeasurements.scrollWidth - sourceMeasurements.clientWidth;\n sizes.scrollPadding = [sourceMeasurements.scrollPaddingRight, sourceMeasurements.scrollPaddingLeft];\n }\n sizes.containerSize = sourceMeasurements.clientWidth;\n } else {\n // TODO: support sideways-lr\n viewSize = subjectMeasurements.offsetHeight;\n viewPos = subjectMeasurements.top;\n sizes.scrollPadding = [sourceMeasurements.scrollPaddingTop, sourceMeasurements.scrollPaddingBottom];\n sizes.containerSize = sourceMeasurements.clientHeight;\n }\n\n const inset = calculateInset(optionsInset, sizes);\n\n // Cover:\n // 0% progress represents the position at which the start border edge of the\n // element’s principal box coincides with the end edge of its view progress\n // visibility range.\n // 100% progress represents the position at which the end border edge of the\n // element’s principal box coincides with the start edge of its view progress\n // visibility range.\n const coverStartOffset = viewPos - sizes.containerSize + inset.end;\n const coverEndOffset = viewPos + viewSize - inset.start;\n\n // Contain:\n // The 0% progress represents the earlier of the following positions:\n // 1. The start border edge of the element’s principal box coincides with\n // the start edge of its view progress visibility range.\n // 2. The end border edge of the element’s principal box coincides with\n // the end edge of its view progress visibility range.\n // The 100% progress represents the greater of the following positions:\n // 1. The start border edge of the element’s principal box coincides with\n // the start edge of its view progress visibility range.\n // 2. The end border edge of the element’s principal box coincides with\n // the end edge of its view progress visibility range.\n const alignStartOffset = coverStartOffset + viewSize;\n const alignEndOffset = coverEndOffset - viewSize;\n const containStartOffset = Math.min(alignStartOffset, alignEndOffset);\n const containEndOffset = Math.max(alignStartOffset, alignEndOffset);\n\n // Entry and Exit bounds align with cover and contains bounds.\n\n let startOffset = undefined;\n let endOffset = undefined;\n // Take inset into account when determining the scrollport size\n const adjustedScrollportSize = sizes.containerSize - inset.start - inset.end;\n const subjectIsLargerThanScrollport = viewSize > adjustedScrollportSize;\n\n switch(phase) {\n case 'cover':\n startOffset = coverStartOffset;\n endOffset = coverEndOffset;\n break;\n\n case 'contain':\n startOffset = containStartOffset;\n endOffset = containEndOffset;\n break;\n\n case 'entry':\n startOffset = coverStartOffset;\n endOffset = containStartOffset;\n break;\n\n case 'exit':\n startOffset = containEndOffset;\n endOffset = coverEndOffset;\n break;\n\n case 'entry-crossing':\n startOffset = coverStartOffset;\n endOffset = subjectIsLargerThanScrollport ? containEndOffset : containStartOffset;\n break;\n\n case 'exit-crossing':\n startOffset = subjectIsLargerThanScrollport ? containStartOffset : containEndOffset;\n endOffset = coverEndOffset;\n break;\n }\n return { start: startOffset, end: endOffset };\n}\n\nfunction parseInset(value) {\n const inset = { start: 0, end: 0 };\n\n if (!value) return inset;\n\n let parts;\n // Parse string parts to\n if (typeof value === 'string') {\n parts = splitIntoComponentValues(value).map(str => {\n if (str === 'auto') {\n return 'auto';\n }\n try {\n return CSSNumericValue.parse(str);\n } catch (e) {\n throw TypeError(`Could not parse inset \"${value}\"`);\n }\n });\n } else if (Array.isArray(value)) {\n parts = value;\n } else {\n parts = [value];\n }\n if (parts.length === 0 || parts.length > 2) {\n throw TypeError('Invalid inset');\n }\n\n // Validate that the parts are 'auto' or \n for (const part of parts) {\n if (part === 'auto') {\n continue;\n }\n const type = part.type();\n if (!(type.length === 1 || type.percent === 1)) {\n throw TypeError('Invalid inset');\n }\n }\n\n return {\n start: parts[0],\n end: parts[1] ?? parts[0]\n };\n}\n\nfunction calculateInset(value, sizes) {\n const inset = { start: 0, end: 0 };\n\n if (!value) return inset;\n\n const [start, end] = [value.start, value.end].map((part, i) => {\n if (part === 'auto') {\n return sizes.scrollPadding[i] === 'auto' ? 0 : parseFloat(sizes.scrollPadding[i]);\n }\n\n return resolvePx(part, {\n percentageReference: CSS.px(sizes.containerSize),\n fontSize: CSS.px(parseFloat(sizes.fontSize))\n })\n });\n\n return { start, end };\n}\n\n// Calculate the fractional offset of a range value relative to the normal range.\nexport function fractionalOffset(timeline, value) {\n if (timeline instanceof ViewTimeline) {\n const { rangeName, offset } = value;\n\n const phaseRange = range(timeline, rangeName);\n const coverRange = range(timeline, 'cover');\n\n return calculateRelativePosition(phaseRange, offset, coverRange, timeline.subject);\n }\n\n if (timeline instanceof ScrollTimeline) {\n const { axis, source } = timeline;\n const { sourceMeasurements } = sourceDetails.get(source);\n\n let sourceScrollDistance = undefined;\n if (normalizeAxis(axis, sourceMeasurements) === 'x') {\n sourceScrollDistance = sourceMeasurements.scrollWidth - sourceMeasurements.clientWidth;\n } else {\n sourceScrollDistance = sourceMeasurements.scrollHeight - sourceMeasurements.clientHeight;\n }\n\n // TODO: pass relative measurements (viewport, font-size, root font-size, etc. ) to resolvePx() to resolve relative units\n const position = resolvePx(value, {percentageReference: CSS.px(sourceScrollDistance)});\n const fractionalOffset = position / sourceScrollDistance;\n\n return fractionalOffset;\n }\n\n unsupportedTimeline(timeline);\n}\n\nexport function calculateRelativePosition(phaseRange, offset, coverRange, subject) {\n if (!phaseRange || !coverRange)\n return 0;\n\n let style = getComputedStyle(subject)\n const info = {\n percentageReference: CSS.px(phaseRange.end - phaseRange.start),\n fontSize: CSS.px(parseFloat(style.fontSize))\n };\n\n const offsetPX = resolvePx(offset, info) + phaseRange.start;\n return (offsetPX - coverRange.start) / (coverRange.end - coverRange.start);\n}\n\n// https://drafts.csswg.org/scroll-animations-1/#view-progress-timelines\nexport class ViewTimeline extends ScrollTimeline {\n // As specced, ViewTimeline has a subject and a source, but\n // ViewTimelineOptions only has source. Furthermore, there is a strict\n // relationship between subject and source (source is nearest scrollable\n // ancestor of subject).\n\n // Proceeding under the assumption that subject will be added to\n // ViewTimelineOptions. Inferring the source from the subject if not\n // explicitly set.\n constructor(options) {\n super(options);\n const details = scrollTimelineOptions.get(this);\n details.subject = options && options.subject ? options.subject : undefined;\n // TODO: Handle insets.\n if (options && options.inset) {\n details.inset = parseInset(options.inset);\n }\n if (details.subject) {\n const resizeObserver = new ResizeObserver(() => {\n updateMeasurements(details.source)\n })\n resizeObserver.observe(details.subject)\n\n const mutationObserver = new MutationObserver(() => {\n updateMeasurements(details.source);\n });\n mutationObserver.observe(details.subject, {attributes: true, attributeFilter: ['class', 'style']});\n }\n validateSource(this);\n details.subjectMeasurements = measureSubject(details.source, details.subject);\n updateInternal(this);\n }\n\n get source() {\n validateSource(this);\n return scrollTimelineOptions.get(this).source;\n }\n\n set source(source) {\n throw new Error(\"Cannot set the source of a view timeline\");\n }\n\n get subject() {\n return scrollTimelineOptions.get(this).subject;\n }\n\n // The axis is called \"axis\" for a view timeline.\n // Internally we still call it axis.\n get axis() {\n return scrollTimelineOptions.get(this).axis;\n }\n\n get currentTime() {\n const unresolved = null;\n const scrollPos = directionAwareScrollOffset(this.source, this.axis);\n if (scrollPos == unresolved)\n return unresolved;\n\n const offsets = range(this, 'cover');\n if (!offsets)\n return unresolved;\n const progress =\n (scrollPos - offsets.start) / (offsets.end - offsets.start);\n\n return CSS.percent(100 * progress);\n }\n\n get startOffset() {\n return CSS.px(range(this,'cover').start);\n }\n\n get endOffset() {\n return CSS.px(range(this,'cover').end);\n }\n\n}\n","import {\n ANIMATION_RANGE_NAMES,\n ScrollTimeline,\n addAnimation,\n removeAnimation,\n fractionalOffset,\n} from \"./scroll-timeline-base\";\nimport {splitIntoComponentValues} from './utils';\nimport {simplifyCalculation} from './simplify-calculation';\n\nconst nativeDocumentGetAnimations = document.getAnimations;\nconst nativeElementGetAnimations = window.Element.prototype.getAnimations;\nconst nativeElementAnimate = window.Element.prototype.animate;\nconst nativeAnimation = window.Animation;\n\nclass PromiseWrapper {\n constructor() {\n this.state = 'pending';\n this.nativeResolve = this.nativeReject = null;\n this.promise = new Promise((resolve, reject) => {\n this.nativeResolve = resolve;\n this.nativeReject = reject;\n });\n }\n resolve(value) {\n this.state = 'resolved';\n this.nativeResolve(value);\n }\n reject(reason) {\n this.state = 'rejected';\n // Do not report unhandled promise rejections.\n this.promise.catch(() => {});\n this.nativeReject(reason);\n }\n}\n\nfunction createReadyPromise(details) {\n details.readyPromise = new PromiseWrapper();\n // Trigger the pending task on the next animation frame.\n requestAnimationFrame(() => {\n const timelineTime = details.timeline?.currentTime ?? null;\n if (timelineTime === null) {\n return\n }\n // Run auto align start time procedure, in case measurements are ready\n autoAlignStartTime(details);\n if (details.pendingTask === 'play' && (details.startTime !== null || details.holdTime !== null)) {\n commitPendingPlay(details);\n } else if (details.pendingTask === 'pause') {\n commitPendingPause(details);\n }\n });\n}\n\nfunction createAbortError() {\n return new DOMException(\"The user aborted a request\", \"AbortError\");\n}\n\n// Converts a time from its internal representation to a percent. For a\n// monotonic timeline, time is reported as a double with implicit units of\n// milliseconds. For progress-based animations, times are reported as\n// percentages.\nfunction toCssNumberish(details, value) {\n if (value === null)\n return value;\n\n if (typeof value !== 'number') {\n throw new DOMException(\n `Unexpected value: ${value}. Cannot convert to CssNumberish`,\n \"InvalidStateError\");\n }\n\n const rangeDuration = details.rangeDuration ?? 100;\n const limit = effectEnd(details);\n const percent = limit ? rangeDuration * value / limit : 0;\n return CSS.percent(percent);\n}\n\n// Covnerts a time to its internal representation. Progress-based animations\n// use times expressed as percentages. Each progress-based animation is backed\n// by a native animation with a document timeline in the polyfill. Thus, we\n// need to convert the timing from percent to milliseconds with implicit units.\nfunction fromCssNumberish(details, value) {\n if (!details.timeline) {\n // Document timeline\n if (value == null || typeof value === 'number')\n return value;\n\n const convertedTime = value.to('ms');\n if (convertedTime)\n return convertedTime.value;\n\n throw new DOMException(\n \"CSSNumericValue must be either a number or a time value for \" +\n \"time based animations.\",\n \"InvalidStateError\");\n } else {\n // Scroll timeline.\n if (value === null)\n return value;\n\n if (value.unit === 'percent') {\n const rangeDuration = details.rangeDuration ?? 100;\n const duration = effectEnd(details);\n return value.value * duration / rangeDuration;\n }\n\n throw new DOMException(\n \"CSSNumericValue must be a percentage for progress based animations.\",\n \"NotSupportedError\");\n }\n}\n\nfunction normalizedTiming(details) {\n // Used normalized timing in the case of a progress-based animation or\n // specified timing with a document timeline. The normalizedTiming property\n // is initialized and cached when fetching the timing information.\n const timing = details.proxy.effect.getTiming();\n return details.normalizedTiming || timing;\n}\n\nfunction commitPendingPlay(details) {\n // https://drafts4.csswg.org/web-animations-2/#playing-an-animation-section\n // Refer to steps listed under \"Schedule a task to run ...\"\n\n const timelineTime = fromCssNumberish(details, details.timeline.currentTime);\n if (details.holdTime != null) {\n // A: If animation’s hold time is resolved,\n // A.1. Apply any pending playback rate on animation.\n // A.2. Let new start time be the result of evaluating:\n // ready time - hold time / playback rate for animation.\n // If the playback rate is zero, let new start time be simply ready\n // time.\n // A.3. Set the start time of animation to new start time.\n // A.4. If animation’s playback rate is not 0, make animation’s hold\n // time unresolved.\n applyPendingPlaybackRate(details);\n if (details.animation.playbackRate == 0) {\n details.startTime = timelineTime;\n } else {\n details.startTime\n = timelineTime -\n details.holdTime / details.animation.playbackRate;\n details.holdTime = null;\n }\n } else if (details.startTime !== null &&\n details.pendingPlaybackRate !== null) {\n // B: If animation’s start time is resolved and animation has a pending\n // playback rate,\n // B.1. Let current time to match be the result of evaluating:\n // (ready time - start time) × playback rate for animation.\n // B.2 Apply any pending playback rate on animation.\n // B.3 If animation’s playback rate is zero, let animation’s hold time\n // be current time to match.\n // B.4 Let new start time be the result of evaluating:\n // ready time - current time to match / playback rate\n // for animation.\n // If the playback rate is zero, let new start time be simply ready\n // time.\n // B.5 Set the start time of animation to new start time.\n const currentTimeToMatch =\n (timelineTime - details.startTime) * details.animation.playbackRate;\n applyPendingPlaybackRate(details);\n const playbackRate = details.animation.playbackRate;\n if (playbackRate == 0) {\n details.holdTime = null;\n details.startTime = timelineTime;\n } else {\n details.startTime = timelineTime - currentTimeToMatch / playbackRate;\n }\n }\n\n // 8.4 Resolve animation’s current ready promise with animation.\n if (details.readyPromise && details.readyPromise.state == 'pending')\n details.readyPromise.resolve(details.proxy);\n\n // 8.5 Run the procedure to update an animation’s finished state for\n // animation with the did seek flag set to false, and the\n // synchronously notify flag set to false.\n updateFinishedState(details, false, false);\n\n // Additional polyfill step to update the native animation's current time.\n syncCurrentTime(details);\n details.pendingTask = null;\n};\n\nfunction commitPendingPause(details) {\n // https://www.w3.org/TR/web-animations-1/#pausing-an-animation-section\n // Refer to steps listed under \"Schedule a task to run ...\"\n\n // 1. Let ready time be the time value of the timeline associated with\n // animation at the moment when the user agent completed processing\n // necessary to suspend playback of animation’s target effect.\n const readyTime = fromCssNumberish(details, details.timeline.currentTime);\n\n // 2. If animation’s start time is resolved and its hold time is not\n // resolved, let animation’s hold time be the result of evaluating\n // (ready time - start time) × playback rate.\n if (details.startTime != null && details.holdTime == null) {\n details.holdTime =\n (readyTime - details.startTime) * details.animation.playbackRate;\n }\n\n // 3. Apply any pending playback rate on animation.\n applyPendingPlaybackRate(details);\n\n // 4. Make animation’s start time unresolved.\n details.startTime = null;\n\n // 5. Resolve animation’s current ready promise with animation.\n details.readyPromise.resolve(details.proxy);\n\n // 6. Run the procedure to update an animation’s finished state for\n // animation with the did seek flag set to false, and the synchronously\n // notify flag set to false.\n updateFinishedState(details, false, false);\n\n // Additional polyfill step to update the native animation's current time.\n syncCurrentTime(details);\n details.pendingTask = null;\n};\n\nfunction commitFinishedNotification(details) {\n if (!details.finishedPromise || details.finishedPromise.state != 'pending')\n return;\n\n if (details.proxy.playState != 'finished')\n return;\n\n details.finishedPromise.resolve(details.proxy);\n\n details.animation.pause();\n\n // Event times are speced as doubles in web-animations-1.\n // Cannot dispatch a proxy to an event since the proxy is not a fully\n // transparent replacement. As a workaround, use a custom event and inject\n // the necessary getters.\n const finishedEvent =\n new CustomEvent('finish',\n { detail: {\n currentTime: details.proxy.currentTime,\n timelineTime: details.proxy.timeline.currentTime\n }});\n Object.defineProperty(finishedEvent, 'currentTime', {\n get: function() { return this.detail.currentTime; }\n });\n Object.defineProperty(finishedEvent, 'timelineTime', {\n get: function() { return this.detail.timelineTime; }\n });\n\n requestAnimationFrame(() => {\n queueMicrotask(() => {\n details.animation.dispatchEvent(finishedEvent);\n });\n });\n}\n\nfunction effectivePlaybackRate(details) {\n if (details.pendingPlaybackRate !== null)\n return details.pendingPlaybackRate;\n return details.animation.playbackRate;\n}\n\nfunction applyPendingPlaybackRate(details) {\n if (details.pendingPlaybackRate !== null) {\n details.animation.playbackRate = details.pendingPlaybackRate;\n details.pendingPlaybackRate = null;\n }\n}\n\n/**\n * Procedure to silently set the current time of an animation to seek time\n * https://drafts.csswg.org/web-animations-2/#silently-set-the-current-time\n * @param details\n * @param {CSSUnitValue} seekTime\n */\nfunction silentlySetTheCurrentTime(details, seekTime) {\n // The procedure to silently set the current time of an animation, animation, to seek time is as follows:\n // 1. If seek time is an unresolved time value, then perform the following steps.\n // 1. If the current time is resolved, then throw a TypeError.\n // 2. Abort these steps.\n if (seekTime == null) {\n if (details.currentTime !== null) {\n throw new TypeError();\n }\n }\n // 2. Let valid seek time be the result of running the validate a CSSNumberish time procedure with seek time as the input.\n // 3. If valid seek time is false, abort this procedure.\n seekTime = fromCssNumberish(details, seekTime);\n\n // 4. Set auto align start time to false.\n details.autoAlignStartTime = false;\n\n // 5. Update either animation’s hold time or start time as follows:\n //\n // 5a If any of the following conditions are true:\n // - animation’s hold time is resolved, or\n // - animation’s start time is unresolved, or\n // - animation has no associated timeline or the associated timeline is inactive, or\n // - animation’s playback rate is 0,\n // 1. Set animation’s hold time to seek time.\n //\n // 5b Otherwise,\n // Set animation’s start time to the result of evaluating timeline time - (seek time / playback rate) where\n // timeline time is the current time value of timeline associated with animation.\n if (details.holdTime !== null || details.startTime === null ||\n details.timeline.phase === 'inactive' || details.animation.playbackRate === 0) {\n details.holdTime = seekTime;\n } else {\n details.startTime =\n fromCssNumberish(details, details.timeline.currentTime) - seekTime / details.animation.playbackRate;\n }\n\n // 6. If animation has no associated timeline or the associated timeline is inactive, make animation’s start time\n // unresolved.\n // This preserves the invariant that when we don’t have an active timeline it is only possible to set either the\n // start time or the animation’s current time.\n if (details.timeline.phase === 'inactive') {\n details.startTime = null;\n }\n\n // 7. Make animation’s previous current time unresolved.\n details.previousCurrentTime = null\n}\n\nfunction calculateCurrentTime(details) {\n if (!details.timeline)\n return null;\n\n const timelineTime = fromCssNumberish(details, details.timeline.currentTime);\n if (timelineTime === null)\n return null;\n\n if (details.startTime === null)\n return null;\n\n let currentTime =\n (timelineTime - details.startTime) * details.animation.playbackRate;\n\n // Handle special case.\n if (currentTime == -0)\n currentTime = 0;\n\n return currentTime;\n}\n\nfunction calculateStartTime(details, currentTime) {\n if (!details.timeline)\n return null;\n\n const timelineTime = fromCssNumberish(details, details.timeline.currentTime);\n if (timelineTime == null)\n return null;\n\n return timelineTime - currentTime / details.animation.playbackRate;\n}\n\nfunction updateFinishedState(details, didSeek, synchronouslyNotify) {\n if (!details.timeline)\n return;\n\n // https://www.w3.org/TR/web-animations-1/#updating-the-finished-state\n // 1. Calculate the unconstrained current time. The dependency on did_seek is\n // required to accommodate timelines that may change direction. Without this\n // distinction, a once-finished animation would remain finished even when its\n // timeline progresses in the opposite direction.\n let unconstrainedCurrentTime =\n didSeek ? fromCssNumberish(details, details.proxy.currentTime)\n : calculateCurrentTime(details);\n\n // 2. Conditionally update the hold time.\n if (unconstrainedCurrentTime && details.startTime != null &&\n !details.proxy.pending) {\n // Can seek outside the bounds of the active effect. Set the hold time to\n // the unconstrained value of the current time in the event that this update\n // is the result of explicitly setting the current time and the new time\n // is out of bounds. An update due to a time tick should not snap the hold\n // value back to the boundary if previously set outside the normal effect\n // boundary. The value of previous current time is used to retain this\n // value.\n const playbackRate = effectivePlaybackRate(details);\n const upperBound = effectEnd(details);\n let boundary = details.previousCurrentTime;\n if (playbackRate > 0 && unconstrainedCurrentTime >= upperBound &&\n details.previousCurrentTime != null) {\n if (boundary === null || boundary < upperBound)\n boundary = upperBound;\n details.holdTime = didSeek ? unconstrainedCurrentTime : boundary;\n } else if (playbackRate < 0 && unconstrainedCurrentTime <= 0) {\n if (boundary == null || boundary > 0)\n boundary = 0;\n details.holdTime = didSeek ? unconstrainedCurrentTime : boundary;\n } else if (playbackRate != 0) {\n // Update start time and reset hold time.\n if (didSeek && details.holdTime !== null)\n details.startTime = calculateStartTime(details, details.holdTime);\n details.holdTime = null;\n }\n }\n\n // Additional step to ensure that the native animation has the same value for\n // current time as the proxy.\n syncCurrentTime(details);\n\n // 3. Set the previous current time.\n details.previousCurrentTime = fromCssNumberish(details,\n details.proxy.currentTime);\n\n // 4. Set the current finished state.\n const playState = details.proxy.playState;\n\n if (playState == 'finished') {\n if (!details.finishedPromise)\n details.finishedPromise = new PromiseWrapper();\n if (details.finishedPromise.state == 'pending') {\n // 5. Setup finished notification.\n if (synchronouslyNotify) {\n commitFinishedNotification(details);\n } else {\n Promise.resolve().then(() => {\n commitFinishedNotification(details);\n });\n }\n }\n } else {\n // 6. If not finished but the current finished promise is already resolved,\n // create a new promise.\n if (details.finishedPromise &&\n details.finishedPromise.state == 'resolved') {\n details.finishedPromise = new PromiseWrapper();\n }\n if (details.animation.playState != 'paused')\n details.animation.pause();\n }\n}\n\nfunction effectEnd(details) {\n // https://www.w3.org/TR/web-animations-1/#end-time\n const timing = normalizedTiming(details);\n const totalDuration =\n timing.delay + timing.endDelay + timing.iterations * timing.duration;\n\n return Math.max(0, totalDuration);\n}\n\nfunction hasActiveTimeline(details) {\n return !details.timeline || details.timeline.phase != 'inactive';\n}\n\nfunction syncCurrentTime(details) {\n if (!details.timeline)\n return;\n\n if (details.startTime !== null) {\n const timelineTime = details.timeline.currentTime;\n if (timelineTime == null)\n return;\n\n const timelineTimeMs = fromCssNumberish(details, timelineTime);\n\n setNativeCurrentTime(details,\n (timelineTimeMs - details.startTime) *\n details.animation.playbackRate);\n } else if (details.holdTime !== null) {\n setNativeCurrentTime(details, details.holdTime);\n }\n}\n\n// Sets the time of the underlying animation, nudging the time slightly if at\n// a scroll-timeline boundary to remain in the active phase.\nfunction setNativeCurrentTime(details, time) {\n const timeline = details.timeline;\n const playbackRate = details.animation.playbackRate;\n const atScrollTimelineBoundary =\n timeline.currentTime &&\n timeline.currentTime.value == (playbackRate < 0 ? 0 : 100);\n const delta =\n atScrollTimelineBoundary ? (playbackRate < 0 ? 0.001 : -0.001) : 0;\n\n details.animation.currentTime = time + delta;\n}\n\nfunction resetPendingTasks(details) {\n // https://www.w3.org/TR/web-animations-1/#reset-an-animations-pending-tasks\n\n // 1. If animation does not have a pending play task or a pending pause task,\n // abort this procedure.\n if (!details.pendingTask)\n return;\n\n // 2. If animation has a pending play task, cancel that task.\n // 3. If animation has a pending pause task, cancel that task.\n details.pendingTask = null;\n\n // 4. Apply any pending playback rate on animation.\n applyPendingPlaybackRate(details);\n\n // 5. Reject animation’s current ready promise with a DOMException named\n // \"AbortError\".\n details.readyPromise.reject(createAbortError());\n\n // 6. Let animation’s current ready promise be the result of creating a new\n // resolved Promise object.\n createReadyPromise(details);\n details.readyPromise.resolve(details.proxy);\n}\n\nfunction playInternal(details, autoRewind) {\n if (!details.timeline)\n return;\n\n // https://drafts.csswg.org/web-animations/#playing-an-animation-section.\n // 1. Let aborted pause be a boolean flag that is true if animation has a\n // pending pause task, and false otherwise.\n const abortedPause =\n details.proxy.playState == 'paused' && details.proxy.pending;\n\n // 2. Let has pending ready promise be a boolean flag that is initially\n // false.\n let hasPendingReadyPromise = false;\n\n // 3. Let has finite timeline be true if animation has an associated\n // timeline that is not monotonically increasing.\n // Note: this value will always true at this point in the polyfill.\n // Following steps are pruned based on the procedure for scroll\n // timelines.\n //\n // 4. Let previous current time be the animation’s current time\n //\n // 5. Let enable seek be true if the auto-rewind flag is true and has finite timeline is false.\n // Otherwise, initialize to false.\n //\n // 6. Perform the steps corresponding to the first matching condition from\n // the following, if any:\n //\n // 6a If animation’s effective playback rate > 0, enable seek is\n // true and either animation’s:\n // previous current time is unresolved, or\n // previous current time < zero, or\n // previous current time >= associated effect end,\n // 6a1. Set the animation’s hold time to zero.\n //\n // 6b If animation’s effective playback rate < 0, enable seek is\n // true and either animation’s:\n // previous current time is unresolved, or\n // previous current time is ≤ zero, or\n // previous current time is > associated effect end,\n // 6b1. If associated effect end is positive infinity,\n // throw an \"InvalidStateError\" DOMException and abort these steps.\n // 6b2. Otherwise,\n // 5b2a Set the animation’s hold time to the animation’s associated effect end.\n //\n // 6c If animation’s effective playback rate = 0 and animation’s current time\n // is unresolved,\n // 6c1. Set the animation’s hold time to zero.\n let previousCurrentTime = fromCssNumberish(details,\n details.proxy.currentTime);\n\n const playbackRate = effectivePlaybackRate(details);\n if (playbackRate == 0 && previousCurrentTime == null) {\n details.holdTime = 0;\n }\n // 7. If has finite timeline and previous current time is unresolved:\n // Set the flag auto align start time to true.\n // NOTE: If play is called for a CSS animation during style update, the animation’s start time cannot be reliably\n // calculated until post layout since the start time is to align with the start or end of the animation range\n // (depending on the playback rate). In this case, the animation is said to have an auto-aligned start time,\n // whereby the start time is automatically adjusted as needed to align the animation’s progress to the\n // animation range.\n if (previousCurrentTime == null) {\n details.autoAlignStartTime = true;\n }\n\n // Not by spec, but required by tests in play-animation.html:\n // - Playing a finished animation restarts the animation aligned at the start\n // - Playing a pause-pending but previously finished animation realigns with the scroll position\n // - Playing a finished animation clears the start time\n if (details.proxy.playState === 'finished' || abortedPause) {\n details.holdTime = null\n details.startTime = null\n details.autoAlignStartTime = true;\n }\n\n // 8. If animation's hold time is resolved, let its start time be\n // unresolved.\n if (details.holdTime) {\n details.startTime = null;\n }\n\n // 9. If animation has a pending play task or a pending pause task,\n // 9.1 Cancel that task.\n // 9.2 Set has pending ready promise to true.\n if (details.pendingTask) {\n details.pendingTask = null;\n hasPendingReadyPromise = true;\n }\n\n // 10. If the following three conditions are all satisfied:\n // animation’s hold time is unresolved, and\n // aborted pause is false, and\n // animation does not have a pending playback rate,\n // abort this procedure.\n // Additonal check for polyfill: Does not have the auto align start time flag set.\n // If we return when this flag is set, a play task will not be scheduled, leaving the animation in the\n // idle state. If the animation is in the idle state, the auto align procedure will bail.\n // TODO: update with results of https://github.com/w3c/csswg-drafts/issues/9871\n if (details.holdTime === null && !details.autoAlignStartTime &&\n !abortedPause && details.pendingPlaybackRate === null)\n return;\n\n // 11. If has pending ready promise is false, let animation’s current ready\n // promise be a new promise in the relevant Realm of animation.\n if (details.readyPromise && !hasPendingReadyPromise)\n details.readyPromise = null;\n\n // Additional polyfill step to ensure that the native animation has the\n // correct value for current time.\n syncCurrentTime(details);\n\n // 12. Schedule a task to run as soon as animation is ready.\n if (!details.readyPromise)\n createReadyPromise(details);\n details.pendingTask = 'play';\n\n // Additional step for the polyfill.\n // This must run after setting up the ready promise, otherwise we will run\n // the procedure for calculating auto aligned start time before play state is running\n addAnimation(details.timeline, details.animation,\n tickAnimation.bind(details.proxy));\n\n // 13. Run the procedure to update an animation’s finished state for animation\n // with the did seek flag set to false, and the synchronously notify flag\n // set to false.\n updateFinishedState(details, /* seek */ false, /* synchronous */ false);\n}\n\nfunction tickAnimation(timelineTime) {\n const details = proxyAnimations.get(this);\n if (!details) return;\n\n if (timelineTime == null) {\n // While the timeline is inactive, it's effect should not be applied.\n // To polyfill this behavior, we cancel the underlying animation.\n if (details.proxy.playState !== 'paused' && details.animation.playState != 'idle')\n details.animation.cancel();\n return;\n }\n\n // When updating timeline current time, the start time of any attached animation is conditionally updated. For each\n // attached animation, run the procedure for calculating an auto-aligned start time.\n autoAlignStartTime(details);\n\n if (details.pendingTask) {\n // Commit pending tasks asynchronously if they are ready after aligning start time\n requestAnimationFrame(() => {\n if (details.pendingTask === 'play' && (details.startTime !== null || details.holdTime !== null)) {\n commitPendingPlay(details);\n } else if (details.pendingTask === 'pause') {\n commitPendingPause(details);\n }\n });\n }\n\n const playState = this.playState;\n if (playState == 'running' || playState == 'finished') {\n const timelineTimeMs = fromCssNumberish(details, timelineTime);\n\n setNativeCurrentTime(\n details,\n (timelineTimeMs - fromCssNumberish(details, this.startTime)) *\n this.playbackRate);\n\n updateFinishedState(details, false, false);\n }\n}\n\nfunction renormalizeTiming(details) {\n // Force renormalization.\n details.specifiedTiming = null;\n}\n\nfunction createProxyEffect(details) {\n const effect = details.animation.effect;\n const nativeUpdateTiming = effect.updateTiming;\n\n // Generic pass-through handler for any method or attribute that is not\n // explicitly overridden.\n const handler = {\n get: function(obj, prop) {\n const result = obj[prop];\n if (typeof result === 'function')\n return result.bind(effect);\n return result;\n },\n\n set: function(obj, prop, value) {\n obj[prop] = value;\n return true;\n }\n };\n // Override getComputedTiming to convert to percentages when using a\n // progress-based timeline.\n const getComputedTimingHandler = {\n apply: function(target) {\n // Ensure that the native animation is using normalized values.\n effect.getTiming();\n\n const timing = target.apply(effect);\n\n if (details.timeline) {\n const rangeDuration = details.duration ?? 100;\n timing.localTime = toCssNumberish(details, timing.localTime);\n timing.endTime = toCssNumberish(details, timing.endTime);\n timing.activeDuration =\n toCssNumberish(details, timing.activeDuration);\n const limit = effectEnd(details);\n const iteration_duration = timing.iterations ?\n (limit - timing.delay - timing.endDelay) / timing.iterations : 0;\n timing.duration = limit ?\n CSS.percent(rangeDuration * iteration_duration / limit) :\n CSS.percent(0);\n\n // Correct for inactive timeline.\n if (details.timeline.currentTime === undefined) {\n timing.localTime = null;\n }\n }\n return timing;\n }\n };\n // Override getTiming to normalize the timing. EffectEnd for the animation\n // align with the range duration.\n const getTimingHandler = {\n apply: function(target, thisArg) {\n // Arbitrary conversion of 100% to ms.\n const INTERNAL_DURATION_MS = 100000;\n\n if (details.specifiedTiming)\n return details.specifiedTiming;\n\n details.specifiedTiming = target.apply(effect);\n let timing = Object.assign({}, details.specifiedTiming);\n\n let totalDuration;\n\n if (timing.duration === Infinity) {\n throw TypeError(\n \"Effect duration cannot be Infinity when used with Scroll \" +\n \"Timelines\");\n }\n\n // Duration 'auto' case.\n if (timing.duration === null || timing.duration === 'auto' || details.autoDurationEffect) {\n if (details.timeline) {\n details.autoDurationEffect = true\n // TODO: start and end delay are specced as doubles and currently\n // ignored for a progress based animation. Support delay and endDelay\n // once CSSNumberish.\n timing.delay = 0;\n timing.endDelay = 0;\n totalDuration = timing.iterations ? INTERNAL_DURATION_MS : 0;\n timing.duration = timing.iterations\n ? (totalDuration - timing.delay - timing.endDelay) /\n timing.iterations\n : 0;\n // When the rangeStart comes after the rangeEnd, we end up in a situation\n // that cannot work. We can tell this by having ended up with a negative\n // duration. In that case, we need to adjust the computed timings. We do\n // this by setting the duration to 0 and then assigning the remainder of\n // the totalDuration to the endDelay\n if (timing.duration < 0) {\n timing.duration = 0;\n timing.endDelay = totalDuration - timing.delay;\n }\n // Set the timing on the native animation to the normalized values\n // while preserving the specified timing.\n nativeUpdateTiming.apply(effect, [timing]);\n }\n }\n details.normalizedTiming = timing;\n return details.specifiedTiming;\n }\n };\n const updateTimingHandler = {\n apply: function(target, thisArg, argumentsList) {\n if (!argumentsList || !argumentsList.length)\n return;\n\n // Additional validation that is specific to scroll timelines.\n if (details.timeline && argumentsList[0]) {\n const options = argumentsList[0];\n const duration = options.duration;\n if (duration === Infinity) {\n throw TypeError(\n \"Effect duration cannot be Infinity when used with Scroll \" +\n \"Timelines\");\n }\n const iterations = options.iterations;\n if (iterations === Infinity) {\n throw TypeError(\n \"Effect iterations cannot be Infinity when used with Scroll \" +\n \"Timelines\");\n }\n\n if (typeof duration !== 'undefined' && duration !== 'auto') {\n details.autoDurationEffect = null\n }\n }\n\n // Apply updates on top of the original specified timing.\n if (details.specifiedTiming) {\n target.apply(effect, [details.specifiedTiming]);\n }\n target.apply(effect, argumentsList);\n renormalizeTiming(details);\n }\n };\n const proxy = new Proxy(effect, handler);\n proxy.getComputedTiming = new Proxy(effect.getComputedTiming,\n getComputedTimingHandler);\n proxy.getTiming = new Proxy(effect.getTiming, getTimingHandler);\n proxy.updateTiming = new Proxy(effect.updateTiming, updateTimingHandler);\n return proxy;\n}\n\n// Computes the start delay as a fraction of the active cover range.\nfunction fractionalStartDelay(details) {\n if (!details.animationRange) return 0;\n const rangeStart = details.animationRange.start === 'normal' ?\n getNormalStartRange(details.timeline) :\n details.animationRange.start;\n return fractionalOffset(details.timeline, rangeStart);\n}\n\n// Computes the ends delay as a fraction of the active cover range.\nfunction fractionalEndDelay(details) {\n if (!details.animationRange) return 0;\n const rangeEnd = details.animationRange.end === 'normal' ?\n getNormalEndRange(details.timeline) :\n details.animationRange.end;\n return 1 - fractionalOffset(details.timeline, rangeEnd);\n}\n\n// Map from an instance of ProxyAnimation to internal details about that animation.\n// See ProxyAnimation constructor for details.\nlet proxyAnimations = new WeakMap();\n\n// Clear cache containing the ProxyAnimation instances when leaving the page.\n// See https://github.com/flackr/scroll-timeline/issues/146#issuecomment-1698159183\n// for details.\nwindow.addEventListener('pagehide', (e) => {\n proxyAnimations = new WeakMap();\n}, false);\n\n// Map from the real underlying native animation to the ProxyAnimation proxy of it.\nlet proxiedAnimations = new WeakMap();\n\n/**\n * Procedure for calculating an auto-aligned start time.\n * https://drafts.csswg.org/web-animations-2/#animation-calculating-an-auto-aligned-start-time\n * @param details\n */\nfunction autoAlignStartTime(details) {\n // When attached to a non-monotonic timeline, the start time of the animation may be layout dependent. In this case,\n // we defer calculation of the start time until the timeline has been updated post layout. When updating timeline\n // current time, the start time of any attached animation is conditionally updated. The procedure for calculating an\n // auto-aligned start time is as follows:\n\n // 1. If the auto-align start time flag is false, abort this procedure.\n if (!details.autoAlignStartTime) {\n return;\n }\n\n // 2. If the timeline is inactive, abort this procedure.\n if (!details.timeline || !details.timeline.currentTime) {\n return;\n }\n\n // 3. If play state is idle, abort this procedure.\n // 4. If play state is paused, and hold time is resolved, abort this procedure.\n if (details.proxy.playState === 'idle' ||\n (details.proxy.playState === 'paused' && details.holdTime !== null)) {\n return;\n }\n\n const previousRangeDuration = details.rangeDuration;\n\n let startOffset, endOffset;\n\n\n // 5. Let start offset be the resolved timeline time corresponding to the start of the animation attachment range.\n // In the case of view timelines, it requires a calculation based on the proportion of the cover range.\n try {\n startOffset = CSS.percent(fractionalStartDelay(details) * 100);\n } catch (e) {\n // TODO: Validate supported values for range start, to avoid exceptions when resolving the values.\n\n // Range start is invalid, falling back to default value\n startOffset = CSS.percent(0);\n details.animationRange.start = 'normal';\n console.warn(\"Exception when calculating start offset\", e);\n }\n\n // 6. Let end offset be the resolved timeline time corresponding to the end of the animation attachment range.\n // In the case of view timelines, it requires a calculation based on the proportion of the cover range.\n try {\n endOffset = CSS.percent((1 - fractionalEndDelay(details)) * 100);\n } catch (e) {\n // TODO: Validate supported values for range end, to avoid exceptions when resolving the values.\n\n // Range start is invalid, falling back to default value\n endOffset = CSS.percent(100);\n details.animationRange.end = 'normal';\n console.warn(\"Exception when calculating end offset\", e);\n }\n\n // Store the range duration, until we can find a spec aligned method to calculate iteration duration\n // TODO: Clarify how range duration should be resolved\n details.rangeDuration = endOffset.value - startOffset.value;\n // 7. Set start time to start offset if effective playback rate ≥ 0, and end offset otherwise.\n const playbackRate = effectivePlaybackRate(details);\n details.startTime = fromCssNumberish(details,playbackRate >= 0 ? startOffset : endOffset);\n\n // 8. Clear hold time.\n details.holdTime = null;\n\n // Additional polyfill step needed to renormalize timing when range has changed\n if (details.rangeDuration !== previousRangeDuration) {\n renormalizeTiming(details);\n }\n}\n\nfunction unsupportedTimeline(timeline) {\n throw new Error('Unsupported timeline class');\n}\n\nfunction getNormalStartRange(timeline) {\n if (timeline instanceof ViewTimeline) {\n return { rangeName: 'cover', offset: CSS.percent(0) };\n }\n\n if (timeline instanceof ScrollTimeline) {\n return CSS.percent(0);\n }\n\n unsupportedTimeline(timeline);\n}\n\nfunction getNormalEndRange(timeline) {\n if (timeline instanceof ViewTimeline) {\n return { rangeName: 'cover', offset: CSS.percent(100) };\n }\n\n if (timeline instanceof ScrollTimeline) {\n return CSS.percent(100);\n }\n\n unsupportedTimeline(timeline);\n}\n\nfunction parseAnimationRange(timeline, value) {\n if (!value)\n return {\n start: 'normal',\n end: 'normal',\n };\n\n const animationRange = {\n start: getNormalStartRange(timeline),\n end: getNormalEndRange(timeline),\n };\n\n if (timeline instanceof ViewTimeline) {\n // Format:\n // \n // --> 0% 100%\n // --> \n // \n // --> cover cover \n // TODO: Support all formatting options once ratified in the spec.\n const parts = splitIntoComponentValues(value);\n const rangeNames = [];\n const offsets = [];\n\n parts.forEach(part => {\n if (ANIMATION_RANGE_NAMES.includes(part)) {\n rangeNames.push(part);\n } else {\n try {\n offsets.push(CSSNumericValue.parse(part));\n } catch (e) {\n throw TypeError(`Could not parse range \"${value}\"`);\n }\n }\n });\n\n if (rangeNames.length > 2 || offsets.length > 2 || offsets.length == 1) {\n throw TypeError(\"Invalid time range or unsupported time range format.\");\n }\n\n if (rangeNames.length) {\n animationRange.start.rangeName = rangeNames[0];\n animationRange.end.rangeName = rangeNames.length > 1 ? rangeNames[1] : rangeNames[0];\n }\n\n if (offsets.length > 1) {\n animationRange.start.offset = offsets[0];\n animationRange.end.offset = offsets[1];\n }\n\n return animationRange;\n }\n\n if (timeline instanceof ScrollTimeline) {\n // @TODO: Play nice with only 1 offset being set\n // @TODO: Play nice with expressions such as `calc(50% + 10px) 100%`\n const parts = value.split(' ');\n if (parts.length != 2) {\n throw TypeError(\"Invalid time range or unsupported time range format.\");\n }\n\n animationRange.start = CSSNumericValue.parse(parts[0]);\n animationRange.end = CSSNumericValue.parse(parts[1]);\n\n return animationRange;\n }\n\n unsupportedTimeline(timeline);\n}\n\nfunction parseTimelineRangePart(timeline, value, position) {\n if (!value || value === 'normal') return 'normal';\n\n if (timeline instanceof ViewTimeline) {\n // Extract parts from the passed in value.\n let rangeName = 'cover'\n let offset = position === 'start' ? CSS.percent(0) : CSS.percent(100)\n\n // Author passed in something like `{ rangeName: 'cover', offset: CSS.percent(100) }`\n if (value instanceof Object) {\n if (value.rangeName !== undefined) {\n rangeName = value.rangeName;\n }\n\n if (value.offset !== undefined) {\n offset = value.offset;\n }\n }\n // Author passed in something like `\"cover 100%\"`\n else {\n const parts = splitIntoComponentValues(value);\n\n if (parts.length === 1) {\n if (ANIMATION_RANGE_NAMES.includes(parts[0])) {\n rangeName = parts[0];\n } else {\n offset = simplifyCalculation(CSSNumericValue.parse(parts[0]), {});\n }\n } else if (parts.length === 2) {\n rangeName = parts[0];\n offset = simplifyCalculation(CSSNumericValue.parse(parts[1]), {});\n }\n }\n\n // Validate rangeName\n if (!ANIMATION_RANGE_NAMES.includes(rangeName)) {\n throw TypeError(\"Invalid range name\");\n }\n\n return { rangeName, offset };\n }\n\n if (timeline instanceof ScrollTimeline) {\n // The value is a standalone offset, so simply parse it.\n return CSSNumericValue.parse(value);\n }\n\n unsupportedTimeline(timeline);\n}\n\n// Create an alternate Animation class which proxies API requests.\n// TODO: Create a full-fledged proxy so missing methods are automatically\n// fetched from Animation.\nexport class ProxyAnimation {\n constructor(effect, timeline, animOptions={}) {\n const isScrollAnimation = timeline instanceof ScrollTimeline;\n const animationTimeline = isScrollAnimation ? undefined : timeline;\n const animation =\n (effect instanceof nativeAnimation) ?\n effect : new nativeAnimation(effect, animationTimeline);\n proxiedAnimations.set(animation, this);\n proxyAnimations.set(this, {\n animation: animation,\n timeline: isScrollAnimation ? timeline : undefined,\n playState: isScrollAnimation ? \"idle\" : null,\n readyPromise: null,\n finishedPromise: null,\n // Start and hold times are directly tracked in the proxy despite being\n // accessible via the animation so that direct manipulation of these\n // properties does not affect the play state of the underlying animation.\n // Note that any changes to these values require an update of current\n // time for the underlying animation to ensure that its hold time is set\n // to the correct position. These values are represented as floating point\n // numbers in milliseconds.\n startTime: null,\n holdTime: null,\n rangeDuration: null,\n previousCurrentTime: null,\n autoAlignStartTime: false,\n // Calls to reverse and updatePlaybackRate set a pending rate that does\n // not immediately take effect. The value of this property is\n // inaccessible via the web animations API and therefore explicitly\n // tracked.\n pendingPlaybackRate: null,\n pendingTask: null,\n // Record the specified timing since it may be different than the timing\n // actually used for the animation. When fetching the timing, this value\n // will be returned, however, the native animation will use normalized\n // values.\n specifiedTiming: null,\n // The normalized timing has the corrected timing with the intrinsic\n // iteration duration resolved.\n normalizedTiming: null,\n // Effect proxy that performs the necessary time conversions when using a\n // progress-based timelines.\n effect: null,\n // The animation attachment range, restricting the animation’s\n // active interval to that range of a timeline\n animationRange: isScrollAnimation ? parseAnimationRange(timeline, animOptions['animation-range']) : null,\n proxy: this\n });\n }\n\n // -----------------------------------------\n // Web animation API\n // -----------------------------------------\n\n get effect() {\n const details = proxyAnimations.get(this);\n if (!details.timeline)\n return details.animation.effect;\n\n // Proxy the effect to support timing conversions for progress based\n // animations.\n if (!details.effect)\n details.effect = createProxyEffect(details);\n\n return details.effect;\n }\n set effect(newEffect) {\n const details = proxyAnimations.get(this);\n details.animation.effect = newEffect;\n // Reset proxy to force re-initialization the next time it is accessed.\n details.effect = null;\n details.autoDurationEffect = null;\n }\n\n get timeline() {\n const details = proxyAnimations.get(this);\n // If we explicitly set a null timeline we will return the underlying\n // animation's timeline.\n return details.timeline || details.animation.timeline;\n }\n set timeline(newTimeline) {\n // https://drafts4.csswg.org/web-animations-2/#setting-the-timeline\n const details = proxyAnimations.get(this);\n\n // 1. Let old timeline be the current timeline of animation, if any.\n // 2. If new timeline is the same object as old timeline, abort this\n // procedure.\n const oldTimeline = this.timeline;\n if (oldTimeline == newTimeline)\n return;\n\n // 3. Let previous play state be animation’s play state.\n const previousPlayState = this.playState;\n\n // 4. Let previous current time be the animation’s current time.\n const previousCurrentTime = this.currentTime;\n\n // 5. Set previous progress based in the first condition that applies:\n // If previous current time is unresolved:\n // Set previous progress to unresolved.\n // If endTime time is zero:\n // Set previous progress to zero.\n // Otherwise\n // Set previous progress = previous current time / endTime time\n let end = effectEnd(details);\n let previousProgress;\n if (previousCurrentTime === null) {\n previousProgress = null\n } else if (end === 0) {\n previousProgress = 0;\n } else {\n previousProgress = fromCssNumberish(details, previousCurrentTime) / end;\n }\n\n // 9. Let from finite timeline be true if old timeline is not null and not\n // monotonically increasing.\n const fromScrollTimeline = (oldTimeline instanceof ScrollTimeline);\n\n // 10. Let to finite timeline be true if timeline is not null and not\n // monotonically increasing.\n const toScrollTimeline = (newTimeline instanceof ScrollTimeline);\n\n // 11. Let the timeline of animation be new timeline.\n // Cannot assume that the native implementation has mutable timeline\n // support. Deferring this step until we know that we are either\n // polyfilling, supporting natively, or throwing an error.\n\n // Additional step required to track whether the animation was pending in\n // order to set up a new ready promise if needed.\n const pending = this.pending;\n\n if (fromScrollTimeline) {\n removeAnimation(details.timeline, details.animation);\n }\n\n // 12. Perform the steps corresponding to the first matching condition from\n // the following, if any:\n\n // If to finite timeline,\n if (toScrollTimeline) {\n // Deferred step 11.\n details.timeline = newTimeline;\n\n // 1. Apply any pending playback rate on animation\n applyPendingPlaybackRate(details);\n\n // 2. Set auto align start time to true.\n details.autoAlignStartTime = true;\n // 3. Set start time to unresolved.\n details.startTime = null;\n // 4. Set hold time to unresolved.\n details.holdTime = null;\n\n // 5. If previous play state is \"finished\" or \"running\"\n if (previousPlayState === 'running' || previousPlayState === 'finished') {\n // 1. Schedule a pending play task\n if (!details.readyPromise || details.readyPromise.state === 'resolved') {\n createReadyPromise(details);\n }\n details.pendingTask = 'play';\n // Additional polyfill step needed to associate the animation with\n // the scroll timeline.\n addAnimation(details.timeline, details.animation,\n tickAnimation.bind(this));\n }\n // 6. If previous play state is \"paused\" and previous progress is resolved:\n if (previousPlayState === 'paused' && previousProgress !== null) {\n // 1. Set hold time to previous progress * endTime time. This step ensures that previous progress is preserved\n // even in the case of a pause-pending animation with a resolved start time.\n details.holdTime = previousProgress * end;\n }\n\n // Additional steps required if the animation is pending as we need to\n // associate the pending promise with proxy animation.\n // Note: if the native promise already has an associated \"then\", we will\n // lose this association.\n if (pending) {\n if (!details.readyPromise ||\n details.readyPromise.state == 'resolved') {\n createReadyPromise(details);\n }\n if (previousPlayState == 'paused')\n details.pendingTask = 'pause';\n else\n details.pendingTask = 'play';\n }\n\n // Note that the following steps should apply when transitioning to\n // a monotonic timeline as well; however, we do not have a direct means\n // of applying the steps to the native animation.\n\n // 15. If the start time of animation is resolved, make animation’s hold\n // time unresolved. This step ensures that the finished play state of\n // animation is not “sticky” but is re-evaluated based on its updated\n // current time.\n if (details.startTime !== null)\n details.holdTime = null;\n\n // 16. Run the procedure to update an animation’s finished state for\n // animation with the did seek flag set to false, and the\n // synchronously notify flag set to false.\n updateFinishedState(details, false, false);\n return;\n }\n\n // To monotonic timeline.\n if (details.animation.timeline == newTimeline) {\n // Deferred step 11 from above. Clearing the proxy's timeline will\n // re-associate the proxy with the native animation.\n removeAnimation(details.timeline, details.animation);\n details.timeline = null;\n\n // If from finite timeline and previous current time is resolved,\n // Run the procedure to set the current time to previous current time.\n if (fromScrollTimeline) {\n if (previousCurrentTime !== null)\n details.animation.currentTime = previousProgress * effectEnd(details);\n\n switch (previousPlayState) {\n case 'paused':\n details.animation.pause();\n break;\n\n case 'running':\n case 'finished':\n details.animation.play();\n }\n }\n } else {\n throw TypeError(\"Unsupported timeline: \" + newTimeline);\n }\n }\n\n get startTime() {\n const details = proxyAnimations.get(this);\n if (details.timeline)\n return toCssNumberish(details, details.startTime);\n\n return details.animation.startTime;\n }\n set startTime(value) {\n // https://drafts.csswg.org/web-animations/#setting-the-start-time-of-an-animation\n const details = proxyAnimations.get(this);\n // 1. Let valid start time be the result of running the validate a CSSNumberish time procedure with new start time\n // as the input.\n // 2. If valid start time is false, abort this procedure.\n value = fromCssNumberish(details, value);\n if (!details.timeline) {\n details.animation.startTime = value;\n return;\n }\n\n // 3. Set auto align start time to false.\n details.autoAlignStartTime = false;\n\n // 4. Let timeline time be the current time value of the timeline that\n // animation is associated with. If there is no timeline associated with\n // animation or the associated timeline is inactive, let the timeline\n // time be unresolved.\n const timelineTime = fromCssNumberish(details,\n details.timeline.currentTime);\n\n // 5. If timeline time is unresolved and new start time is resolved, make\n // animation’s hold time unresolved.\n if (timelineTime == null && details.startTime != null) {\n details.holdTime = null;\n // Clearing the hold time may have altered the value of current time.\n // Ensure that the underlying animations has the correct value.\n syncCurrentTime(details);\n }\n\n // 6. Let previous current time be animation’s current time.\n // Note: This is the current time after applying the changes from the\n // previous step which may cause the current time to become unresolved.\n const previousCurrentTime = fromCssNumberish(details, this.currentTime);\n\n // 7. Apply any pending playback rate on animation.\n applyPendingPlaybackRate(details);\n\n // 8. Set animation’s start time to new start time.\n details.startTime = value;\n\n // 9. Update animation’s hold time based on the first matching condition\n // from the following,\n\n // If new start time is resolved,\n // If animation’s playback rate is not zero,\n // make animation’s hold time unresolved.\n\n // Otherwise (new start time is unresolved),\n // Set animation’s hold time to previous current time even if\n // previous current time is unresolved.\n\n if (details.startTime !== null && details.animation.playbackRate != 0)\n details.holdTime = null;\n else\n details.holdTime = previousCurrentTime;\n\n // 12. If animation has a pending play task or a pending pause task, cancel\n // that task and resolve animation’s current ready promise with\n // animation.\n if (details.pendingTask) {\n details.pendingTask = null;\n details.readyPromise.resolve(this);\n }\n\n // 13. Run the procedure to update an animation’s finished state for animation\n // with the did seek flag set to true, and the synchronously notify flag\n // set to false.\n updateFinishedState(details, true, false);\n\n // Ensure that currentTime is updated for the native animation.\n syncCurrentTime(details);\n }\n\n get currentTime() {\n const details = proxyAnimations.get(this);\n if (!details.timeline)\n return details.animation.currentTime;\n\n if (details.holdTime != null)\n return toCssNumberish(details, details.holdTime);\n\n return toCssNumberish(details, calculateCurrentTime(details));\n }\n set currentTime(value) {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n details.animation.currentTime = value;\n return;\n }\n // https://drafts.csswg.org/web-animations-2/#setting-the-current-time-of-an-animation\n // 1. Run the steps to silently set the current time of animation to seek time.\n silentlySetTheCurrentTime(details, value);\n\n // 2. If animation has a pending pause task, synchronously complete the pause operation by performing the following steps:\n // 1. Set animation’s hold time to seek time.\n // 2. Apply any pending playback rate to animation.\n // 3. Make animation’s start time unresolved.\n // 4. Cancel the pending pause task.\n // 5. Resolve animation’s current ready promise with animation.\n if (details.pendingTask == 'pause') {\n details.holdTime = fromCssNumberish(details, value);\n applyPendingPlaybackRate(details);\n details.startTime = null;\n details.pendingTask = null;\n details.readyPromise.resolve(this);\n }\n\n // 3. Run the procedure to update an animation’s finished state for animation with the did seek flag set to true,\n // and the synchronously notify flag set to false.\n updateFinishedState(details, true, false);\n }\n\n get playbackRate() {\n return proxyAnimations.get(this).animation.playbackRate;\n }\n set playbackRate(value) {\n const details = proxyAnimations.get(this);\n\n if (!details.timeline) {\n details.animation.playbackRate = value;\n return;\n }\n\n // 1. Clear any pending playback rate on animation.\n details.pendingPlaybackRate = null;\n\n // 2. Let previous time be the value of the current time of animation before\n // changing the playback rate.\n const previousCurrentTime = this.currentTime;\n\n // 3. Set the playback rate to new playback rate.\n details.animation.playbackRate = value;\n\n // 4. If previous time is resolved, set the current time of animation to\n // previous time\n if (previousCurrentTime !== null)\n this.currentTime = previousCurrentTime;\n }\n\n get playState() {\n const details = proxyAnimations.get(this);\n if (!details.timeline)\n return details.animation.playState;\n\n const currentTime = fromCssNumberish(details, this.currentTime);\n\n // 1. All of the following conditions are true:\n // * The current time of animation is unresolved, and\n // * the start time of animation is unresolved, and\n // * animation does not have either a pending play task or a pending pause\n // task,\n // then idle.\n if (currentTime === null && details.startTime === null &&\n details.pendingTask == null)\n return 'idle';\n\n // 2. Either of the following conditions are true:\n // * animation has a pending pause task, or\n // * both the start time of animation is unresolved and it does not have a\n // pending play task,\n // then paused.\n if (details.pendingTask == 'pause' ||\n (details.startTime === null && details.pendingTask != 'play'))\n return 'paused';\n\n // 3. For animation, current time is resolved and either of the following\n // conditions are true:\n // * animation’s effective playback rate > 0 and current time >= target\n // effect end; or\n // * animation’s effective playback rate < 0 and current time <= 0,\n // then finished.\n if (currentTime != null) {\n if (details.animation.playbackRate > 0 &&\n currentTime >= effectEnd(details))\n return 'finished';\n if (details.animation.playbackRate < 0 && currentTime <= 0)\n return 'finished';\n }\n\n // 4. Otherwise\n return 'running';\n }\n\n get rangeStart() {\n return proxyAnimations.get(this).animationRange?.start ?? 'normal';\n }\n\n set rangeStart(value) {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n return details.animation.rangeStart = value;\n }\n\n if (details.timeline instanceof ScrollTimeline) {\n const animationRange = details.animationRange;\n animationRange.start = parseTimelineRangePart(details.timeline, value, 'start');\n\n // Additional polyfill step to ensure that the native animation has the\n // correct value for current time.\n autoAlignStartTime(details);\n syncCurrentTime(details);\n }\n }\n\n get rangeEnd() {\n return proxyAnimations.get(this).animationRange?.end ?? 'normal';\n }\n\n set rangeEnd(value) {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n return details.animation.rangeEnd = value;\n }\n\n if (details.timeline instanceof ScrollTimeline) {\n const animationRange = details.animationRange;\n animationRange.end = parseTimelineRangePart(details.timeline, value, 'end');\n\n // Additional polyfill step to ensure that the native animation has the\n // correct value for current time.\n autoAlignStartTime(details);\n syncCurrentTime(details);\n }\n }\n\n get replaceState() {\n // TODO: Fix me. Replace state is not a boolean.\n return proxyAnimations.get(this).animation.pending;\n }\n\n get pending() {\n const details = proxyAnimations.get(this);\n if (details.timeline) {\n return !!details.readyPromise &&\n details.readyPromise.state == 'pending';\n }\n\n return details.animation.pending;\n }\n\n finish() {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n details.animation.finish();\n return;\n }\n\n // 1. If animation’s effective playback rate is zero, or if animation’s\n // effective playback rate > 0 and target effect end is infinity, throw\n // an InvalidStateError and abort these steps.\n const playbackRate = effectivePlaybackRate(details);\n const duration = effectEnd(details);\n if (playbackRate == 0) {\n throw new DOMException(\n \"Cannot finish Animation with a playbackRate of 0.\",\n \"InvalidStateError\");\n }\n if (playbackRate > 0 && duration == Infinity) {\n throw new DOMException(\n \"Cannot finish Animation with an infinite target effect end.\",\n \"InvalidStateError\");\n }\n\n // 2. Apply any pending playback rate to animation.\n applyPendingPlaybackRate(details);\n\n // 3. Set limit as follows:\n // If playback rate > 0,\n // Let limit be target effect end.\n // Otherwise,\n // Let limit be zero.\n const limit = playbackRate < 0 ? 0 : duration;\n\n // 4. Silently set the current time to limit.\n this.currentTime = toCssNumberish(details, limit);\n\n // 5. If animation’s start time is unresolved and animation has an\n // associated active timeline, let the start time be the result of\n // evaluating\n // timeline time - (limit / playback rate)\n // where timeline time is the current time value of the associated\n // timeline.\n const timelineTime = fromCssNumberish(details,\n details.timeline.currentTime);\n\n if (details.startTime === null && timelineTime !== null) {\n details.startTime =\n timelineTime - (limit / details.animation.playbackRate);\n }\n\n // 6. If there is a pending pause task and start time is resolved,\n // 6.1 Let the hold time be unresolved.\n // 6.2 Cancel the pending pause task.\n // 6.3 Resolve the current ready promise of animation with animation.\n if (details.pendingTask == 'pause' && details.startTime !== null) {\n details.holdTime = null;\n details.pendingTask = null;\n details.readyPromise.resolve(this);\n }\n\n // 7. If there is a pending play task and start time is resolved, cancel\n // that task and resolve the current ready promise of animation with\n // animation.\n if (details.pendingTask == 'play' && details.startTime !== null) {\n details.pendingTask = null;\n details.readyPromise.resolve(this);\n }\n\n // 8. Run the procedure to update an animation’s finished state for\n // animation with the did seek flag set to true, and the synchronously\n // notify flag set to true.\n updateFinishedState(details, true, true);\n }\n\n play() {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n details.animation.play();\n return;\n }\n\n playInternal(details, /* autoRewind */ true);\n }\n\n pause() {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n details.animation.pause();\n return;\n }\n\n // https://www.w3.org/TR/web-animations-1/#pausing-an-animation-section\n // and https://drafts.csswg.org/web-animations-2/#pausing-an-animation-section\n\n // 1. If animation has a pending pause task, abort these steps.\n // 2. If the play state of animation is paused, abort these steps.\n if (this.playState == \"paused\")\n return;\n\n // Replaced steps from https://drafts.csswg.org/web-animations-2/#pausing-an-animation-section\n //\n // 3. Let has finite timeline be true if animation has an associated timeline that is not monotonically increasing.\n // Note: always true if we have reached this point in the polyfill.\n // Pruning following steps to be specific to scroll timelines.\n // 4. If the animation’s current time is unresolved and has finite timeline is false, perform the steps according\n // to the first matching condition below:\n //\n // 4a If animation’s playback rate is ≥ 0,\n // Set hold time to zero.\n // 4b Otherwise,\n // 4b1 If associated effect end for animation is positive infinity,\n // throw an \"InvalidStateError\" DOMException and abort these steps.\n // 4b2 Otherwise,\n // Set hold time to animation’s associated effect end.\n // If has finite timeline is true, and the animation’s current time is unresolved\n // Set the auto align start time flag to true.\n if (details.animation.currentTime === null) {\n details.autoAlignStartTime = true;\n }\n\n // 7. Let has pending ready promise be a boolean flag that is initially\n // false.\n // 8. If animation has a pending play task, cancel that task and let has\n // pending ready promise be true.\n // 9. If has pending ready promise is false, set animation’s current ready\n // promise to a new promise in the relevant Realm of animation.\n if (details.pendingTask == 'play')\n details.pendingTask = null;\n else\n details.readyPromise = null;\n\n // 10. Schedule a task to be executed at the first possible moment where all of the following conditions are true:\n //\n // the user agent has performed any processing necessary to suspend the playback of animation’s associated\n // effect, if any.\n // the animation is associated with a timeline that is not inactive.\n // the animation has a resolved hold time or start time.\n if (!details.readyPromise)\n createReadyPromise(details);\n details.pendingTask ='pause';\n\n // Additional step for the polyfill.\n // This must run after setting up the ready promise, otherwise we will run\n // the procedure for calculating auto aligned start time before play state is running\n addAnimation(details.timeline, details.animation, tickAnimation.bind(details.proxy));\n }\n\n reverse() {\n const details = proxyAnimations.get(this);\n const playbackRate = effectivePlaybackRate(details);\n const previousCurrentTime = fromCssNumberish(details, this.currentTime);\n const inifiniteDuration = effectEnd(details) == Infinity;\n\n // Let the native implementation handle throwing the exception in cases\n // where reversal is not possible. Error cases will not change the state\n // of the native animation.\n const reversable =\n (playbackRate != 0) &&\n (playbackRate < 0 || previousCurrentTime > 0 || !inifiniteDuration);\n if (!details.timeline || !reversable) {\n if (reversable)\n details.pendingPlaybackRate = -effectivePlaybackRate(details);\n details.animation.reverse();\n return;\n }\n\n if (details.timeline.phase == 'inactive') {\n throw new DOMException(\n \"Cannot reverse an animation with no active timeline\",\n \"InvalidStateError\");\n }\n\n this.updatePlaybackRate(-playbackRate);\n playInternal(details, /* autoRewind */ true);\n }\n\n updatePlaybackRate(rate) {\n const details = proxyAnimations.get(this);\n details.pendingPlaybackRate = rate;\n if (!details.timeline) {\n details.animation.updatePlaybackRate(rate);\n return;\n }\n\n // https://drafts.csswg.org/web-animations/#setting-the-playback-rate-of-an-animation\n\n // 1. Let previous play state be animation’s play state.\n // 2. Let animation’s pending playback rate be new playback rate.\n // Step 2 already performed as we need to record it even when using a\n // monotonic timeline.\n const previousPlayState = this.playState;\n\n // 3. Perform the steps corresponding to the first matching condition from\n // below:\n //\n // 3a If animation has a pending play task or a pending pause task,\n // Abort these steps.\n if (details.readyPromise && details.readyPromise.state == 'pending')\n return;\n\n switch(previousPlayState) {\n // 3b If previous play state is idle or paused,\n // Apply any pending playback rate on animation.\n case 'idle':\n case 'paused':\n applyPendingPlaybackRate(details);\n break;\n\n // 3c If previous play state is finished,\n // 3c.1 Let the unconstrained current time be the result of calculating\n // the current time of animation substituting an unresolved time\n // value for the hold time.\n // 3c.2 Let animation’s start time be the result of evaluating the\n // following expression:\n // timeline time - (unconstrained current time / pending playback rate)\n // Where timeline time is the current time value of the timeline\n // associated with animation.\n // 3c.3 If pending playback rate is zero, let animation’s start time be\n // timeline time.\n // 3c.4 Apply any pending playback rate on animation.\n // 3c.5 Run the procedure to update an animation’s finished state for\n // animation with the did seek flag set to false, and the\n // synchronously notify flag set to false.\n\n case 'finished':\n const timelineTime = fromCssNumberish(details,\n details.timeline.currentTime);\n const unconstrainedCurrentTime = timelineTime !== null ?\n (timelineTime - details.startTime) * details.animation.playbackRate\n : null;\n if (rate == 0) {\n details.startTime = timelineTime;\n } else {\n details.startTime =\n timelineTime != null && unconstrainedCurrentTime != null ?\n (timelineTime - unconstrainedCurrentTime) / rate : null;\n }\n applyPendingPlaybackRate(details);\n updateFinishedState(details, false, false);\n syncCurrentTime(details);\n break;\n\n // 3d Otherwise,\n // Run the procedure to play an animation for animation with the\n // auto-rewind flag set to false.\n default:\n playInternal(details, false);\n }\n }\n\n persist() {\n proxyAnimations.get(this).animation.persist();\n }\n\n get id() {\n return proxyAnimations.get(this).animation.id;\n }\n \n set id(value) {\n proxyAnimations.get(this).animation.id = value;\n }\n\n cancel() {\n const details = proxyAnimations.get(this);\n if (!details.timeline) {\n details.animation.cancel();\n return;\n }\n\n // https://www.w3.org/TR/web-animations-1/#canceling-an-animation-section\n // 1. If animation’s play state is not idle, perform the following steps:\n // 1.1 Run the procedure to reset an animation’s pending tasks on\n // animation.\n // 1.2 Reject the current finished promise with a DOMException named\n // \"AbortError\"\n // 1.3 Let current finished promise be a new (pending) Promise object.\n // 1.4+ Deferred to native implementation.\n // TODO: polyfill since timelineTime will be incorrect for the\n // cancel event. Also, should avoid sending a cancel event if\n // the native animation is canceled due to the scroll timeline\n // becoming inactive. This can likely be done by associating\n // the cancel event with the proxy and not the underlying\n // animation.\n if (this.playState != 'idle') {\n resetPendingTasks(details);\n if (details.finishedPromise &&\n details.finishedPromise.state == 'pending') {\n details.finishedPromise.reject(createAbortError());\n }\n details.finishedPromise = new PromiseWrapper();\n details.animation.cancel();\n }\n\n // 2. Make animation’s hold time unresolved.\n // 3. Make animation’s start time unresolved.\n details.startTime = null;\n details.holdTime = null;\n\n // Extra step in the polyfill the ensure the animation stops ticking.\n removeAnimation(details.timeline, details.animation);\n }\n\n get onfinish() {\n return proxyAnimations.get(this).animation.onfinish;\n }\n set onfinish(value) {\n proxyAnimations.get(this).animation.onfinish = value;\n }\n get oncancel() {\n return proxyAnimations.get(this).animation.oncancel;\n }\n set oncancel(value) {\n proxyAnimations.get(this).animation.oncancel = value;\n }\n get onremove() {\n return proxyAnimations.get(this).animation.onremove;\n }\n set onremove(value) {\n proxyAnimations.get(this).animation.onremove = value;\n }\n\n get finished() {\n const details = proxyAnimations.get(this);\n if (!details.timeline)\n return details.animation.finished;\n\n if (!details.finishedPromise) {\n details.finishedPromise = new PromiseWrapper();\n }\n return details.finishedPromise.promise;\n }\n\n get ready() {\n const details = proxyAnimations.get(this);\n if (!details.timeline)\n return details.animation.ready;\n\n if (!details.readyPromise) {\n details.readyPromise = new PromiseWrapper();\n details.readyPromise.resolve(this);\n }\n return details.readyPromise.promise;\n }\n\n // --------------------------------------------------\n // Event target API\n // --------------------------------------------------\n\n addEventListener(type, callback, options) {\n proxyAnimations.get(this).animation.addEventListener(type, callback,\n options);\n }\n\n removeEventListener(type, callback, options) {\n proxyAnimations.get(this).animation.removeEventListener(type, callback,\n options);\n }\n\n dispatchEvent(event) {\n proxyAnimations.get(this).animation.dispatchEvent(event);\n }\n};\n\nexport function animate(keyframes, options) {\n const timeline = options.timeline;\n\n if (timeline instanceof ScrollTimeline)\n delete options.timeline;\n\n const animation = nativeElementAnimate.apply(this, [keyframes, options]);\n const proxyAnimation = new ProxyAnimation(animation, timeline);\n\n if (timeline instanceof ScrollTimeline) {\n animation.pause();\n\n const details = proxyAnimations.get(proxyAnimation);\n details.animationRange = {\n start: parseTimelineRangePart(timeline, options.rangeStart, 'start'),\n end: parseTimelineRangePart(timeline, options.rangeEnd, 'end'),\n };\n\n proxyAnimation.play();\n }\n\n return proxyAnimation;\n}\n\nfunction replaceProxiedAnimations(animationsList) {\n for (let i = 0; i < animationsList.length; ++i) {\n let proxyAnimation = proxiedAnimations.get(animationsList[i]);\n if (proxyAnimation) {\n animationsList[i] = proxyAnimation;\n }\n }\n return animationsList;\n}\n\nexport function elementGetAnimations(options) {\n let animations = nativeElementGetAnimations.apply(this, [options]);\n return replaceProxiedAnimations(animations);\n}\n\nexport function documentGetAnimations(options) {\n let animations = nativeDocumentGetAnimations.apply(this, [options]);\n return replaceProxiedAnimations(animations);\n}\n","// Copyright 2019 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n ScrollTimeline,\n ViewTimeline,\n} from \"./scroll-timeline-base\";\nimport {\n animate,\n elementGetAnimations,\n documentGetAnimations,\n ProxyAnimation\n} from \"./proxy-animation.js\";\n\nfunction initPolyfill() {\n // Don't load if browser claims support\n if (CSS.supports(\"animation-timeline: --works\")) {\n return true;\n }\n\n if (\n !Reflect.defineProperty(window, 'ScrollTimeline', { value: ScrollTimeline })\n ) {\n throw Error(\n 'Error installing ScrollTimeline polyfill: could not attach ScrollTimeline to window'\n );\n }\n if (\n !Reflect.defineProperty(window, 'ViewTimeline', { value: ViewTimeline })\n ) {\n throw Error(\n 'Error installing ViewTimeline polyfill: could not attach ViewTimeline to window'\n );\n }\n\n if (\n !Reflect.defineProperty(Element.prototype, 'animate', { value: animate })\n ) {\n throw Error(\n \"Error installing ScrollTimeline polyfill: could not attach WAAPI's animate to DOM Element\"\n );\n }\n if (!Reflect.defineProperty(window, 'Animation', { value: ProxyAnimation })) {\n throw Error('Error installing Animation constructor.');\n }\n if (!Reflect.defineProperty(Element.prototype, \"getAnimations\", { value: elementGetAnimations })) {\n throw Error(\n \"Error installing ScrollTimeline polyfill: could not attach WAAPI's getAnimations to DOM Element\"\n );\n }\n if (!Reflect.defineProperty(document, \"getAnimations\", { value: documentGetAnimations })) {\n throw Error(\n \"Error installing ScrollTimeline polyfill: could not attach WAAPI's getAnimations to document\"\n );\n }\n}\n\ninitPolyfill();\n","/**\n * cuid.js\n * Collision-resistant UID generator for browsers and node.\n * Sequential for fast db lookups and recency sorting.\n * Safe for element IDs and server-side lookups.\n *\n * Extracted from CLCTR\n *\n * Copyright (c) Eric Elliott 2012\n * MIT License\n */\n\nvar fingerprint = require('./lib/fingerprint.js');\nvar pad = require('./lib/pad.js');\nvar getRandomValue = require('./lib/getRandomValue.js');\n\nvar c = 0,\n blockSize = 4,\n base = 36,\n discreteValues = Math.pow(base, blockSize);\n\nfunction randomBlock () {\n return pad((getRandomValue() *\n discreteValues << 0)\n .toString(base), blockSize);\n}\n\nfunction safeCounter () {\n c = c < discreteValues ? c : 0;\n c++; // this is not subliminal\n return c - 1;\n}\n\nfunction cuid () {\n // Starting with a lowercase letter makes\n // it HTML element ID friendly.\n var letter = 'c', // hard-coded allows for sequential access\n\n // timestamp\n // warning: this exposes the exact date and time\n // that the uid was created.\n timestamp = (new Date().getTime()).toString(base),\n\n // Prevent same-machine collisions.\n counter = pad(safeCounter().toString(base), blockSize),\n\n // A few chars to generate distinct ids for different\n // clients (so different computers are far less\n // likely to generate the same id)\n print = fingerprint(),\n\n // Grab some more chars from Math.random()\n random = randomBlock() + randomBlock();\n\n return letter + timestamp + counter + print + random;\n}\n\ncuid.slug = function slug () {\n var date = new Date().getTime().toString(36),\n counter = safeCounter().toString(36).slice(-4),\n print = fingerprint().slice(0, 1) +\n fingerprint().slice(-1),\n random = randomBlock().slice(-2);\n\n return date.slice(-2) +\n counter + print + random;\n};\n\ncuid.isCuid = function isCuid (stringToCheck) {\n if (typeof stringToCheck !== 'string') return false;\n if (stringToCheck.startsWith('c')) return true;\n return false;\n};\n\ncuid.isSlug = function isSlug (stringToCheck) {\n if (typeof stringToCheck !== 'string') return false;\n var stringLength = stringToCheck.length;\n if (stringLength >= 7 && stringLength <= 10) return true;\n return false;\n};\n\ncuid.fingerprint = fingerprint;\n\nmodule.exports = cuid;\n","var pad = require('./pad.js');\n\nvar env = typeof window === 'object' ? window : self;\nvar globalCount = Object.keys(env).length;\nvar mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;\nvar clientId = pad((mimeTypesLength +\n navigator.userAgent.length).toString(36) +\n globalCount.toString(36), 4);\n\nmodule.exports = function fingerprint () {\n return clientId;\n};\n","\nvar getRandomValue;\n\nvar crypto = typeof window !== 'undefined' &&\n (window.crypto || window.msCrypto) ||\n typeof self !== 'undefined' &&\n self.crypto;\n\nif (crypto) {\n var lim = Math.pow(2, 32) - 1;\n getRandomValue = function () {\n return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0] / lim);\n };\n} else {\n getRandomValue = Math.random;\n}\n\nmodule.exports = getRandomValue;\n","module.exports = function pad (num, size) {\n var s = '000000000' + num;\n return s.substr(s.length - size);\n};\n","/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n","module.exports = require('./src/get-element-tag')\n","/**\n * Creates a valid custom element name that is versioned (major)\n */\nfunction getElementTag(name, version) {\n const formattedVersion = version ? `-v${version.split('.')[0]}` : ''\n return name + formattedVersion\n}\n\nmodule.exports.getElementTag = getElementTag\n","import _defineProperty from '@babel/runtime/helpers/defineProperty';\n\n/* eslint-disable compat/compat */\nfunction getDefaultRoot() {\n /*\n Use document if supported\n IntersectionObserver will otherwise default to top level document,\n and IntersectionObserver will not work as expected in an iframe.\n https://github.com/w3c/IntersectionObserver/issues/372\n */\n\n /*\n Safari does not throw error on root: document, but does not trigger events as expected\n returning null for now until better feature detection is possible\n */\n return null;\n\n /*\n try {\n // eslint-disable-next-line no-new\n new IntersectionObserver(() => {}, { root: document })\n return document\n } catch (e) {\n return null\n }\n */\n}\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nvar defaultConfig = {\n rootMargin: '0px 0px 0px 0px',\n threshold: [0, 0.5, 1],\n root: getDefaultRoot()\n};\nclass ElementIntersectionObserver {\n constructor(elements, onChange, config) {\n _defineProperty(this, \"intersections\", void 0);\n _defineProperty(this, \"elements\", void 0);\n this.elements = elements.slice(0);\n this.intersections = elements.map(target => ({\n target,\n isIntersecting: false,\n ratio: null\n }));\n this.intersectionObserver = new IntersectionObserver(entries => {\n var intersections = this.intersections.slice(0);\n entries.forEach(entry => {\n var idx = elements.indexOf(entry.target);\n intersections.splice(idx, 1, {\n target: entry.target,\n isIntersecting: entry.isIntersecting,\n ratio: entry.intersectionRatio\n });\n });\n this.intersections = intersections;\n onChange(this.intersections);\n }, _objectSpread(_objectSpread({}, defaultConfig), config));\n elements.forEach(elm => this.intersectionObserver.observe(elm));\n }\n disconnect() {\n // Unregister trigger elements\n this.elements.forEach(elm => this.intersectionObserver.unobserve(elm));\n\n // Disconnect intersection observer\n this.intersectionObserver.disconnect();\n }\n}\n\nfunction toggleAttribute(el, name, boolValue) {\n if (!el) {\n return;\n }\n var nextValue;\n if (typeof boolValue !== 'undefined') {\n nextValue = !!boolValue;\n } else {\n nextValue = el.hasAttribute(name);\n }\n if (nextValue) {\n el.setAttribute(name, '');\n } else {\n el.removeAttribute(name);\n }\n}\nfunction setAttribute(el, name, nextValue) {\n if (!el) {\n return;\n }\n if (nextValue) {\n el.setAttribute(name, nextValue);\n } else {\n el.removeAttribute(name);\n }\n}\nvar closest = (() => {\n var proto = typeof window === 'undefined' ? {} : window.Element.prototype;\n var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;\n if (proto.closest) {\n return (el, css) => el.closest(css);\n } else {\n return (el, css) => {\n for (; el; el = el.parentElement) if (match.call(el, css)) return el;\n return null;\n };\n }\n})();\nfunction addStyle(nodeName, css) {\n var key = \"style-\".concat(nodeName.toLowerCase());\n var min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1');\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', \"\"));\n}\nfunction toArray(nodeList) {\n return [].slice.call(nodeList);\n}\nfunction dispatchEvent(element, name) {\n var detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var ignore = \"prevent_recursive_dispatch_maximum_callstack\".concat(name);\n var event;\n if (element[ignore]) return true;\n // We are already processing this event, so skip sending a new one\n else element[ignore] = true; // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(name, true, true, detail);\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n var result = element.dispatchEvent(event);\n element[ignore] = null; // Remove name from dispatching ignore\n\n return result; // Follow W3C standard for return value\n}\n\nfunction easeOutQuint(t) {\n return 1 + --t * t * t * t * t;\n}\nclass VerticalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n this.container = container;\n }\n cancel() {\n this._cancelled = true;\n }\n to(top) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollTop;\n var distance = top - from;\n var startTime = null;\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n if (!startTime) {\n startTime = currentTime - 1;\n }\n var timeElapsed = currentTime - startTime;\n if (timeElapsed < duration) {\n this.container.scrollTop = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollTop = top;\n callback && callback();\n }\n };\n\n // eslint-disable-next-line compat/compat\n window.requestAnimationFrame(loop);\n }\n}\nclass HorizontalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n this.container = container;\n }\n cancel() {\n this._cancelled = true;\n }\n to(left) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollLeft;\n var distance = left - from;\n var startTime = null;\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n if (!startTime) {\n startTime = currentTime - 1;\n }\n var timeElapsed = currentTime - startTime;\n if (timeElapsed < duration) {\n this.container.scrollLeft = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollLeft = left;\n callback && callback();\n }\n };\n\n // eslint-disable-next-line compat/compat\n window.requestAnimationFrame(loop);\n }\n}\n\nfunction testReducedMotion() {\n if (typeof window !== 'undefined') {\n return !!window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches;\n }\n return false;\n}\n\nvar MAX_SAFE_INTEGER = 9007199254740991;\nfunction withinRange(current) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MAX_SAFE_INTEGER;\n return current >= start && current <= stop;\n}\nfunction withinStops(currentTime, stops, targetStop) {\n var nrOfStops = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var uniqueStops = stops.filter(unique);\n var targetTime = stops[targetStop];\n var prevTime = uniqueStops[uniqueStops.indexOf(targetTime) - nrOfStops];\n var nextTime = uniqueStops[uniqueStops.indexOf(targetTime) + nrOfStops];\n return withinRange(currentTime, prevTime, nextTime);\n}\nfunction unique(value, index, self) {\n return self.indexOf(value) === index;\n}\n\n/*\n * 'loading=\"lazy\"' is defined in terms of IntersectionObserver and the initial root.\n * As a result images with 'loading=\"lazy\"' inside a scroll container will not load\n * until they at least have one pixel visible in the viewport.\n *\n * This will hopefully fixed in a future version of the spec:\n * https://github.com/w3c/IntersectionObserver/issues/431\n *\n * scroll-container-lazy-load observes images and a scroll container.\n * Once images are close to intersecting it will change 'loading=\"lazy\"' to 'loading=\"eager\"'.\n * */\nfunction loadImage(image) {\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n}\nfunction connectScrollContainerLazyLoad(container, images) {\n var containerIntersecting = false;\n var deferredImages = [];\n\n // eslint-disable-next-line compat/compat\n var containerObserver = new IntersectionObserver(entries => {\n containerIntersecting = entries === null || entries === void 0 ? void 0 : entries[0].isIntersecting;\n if (containerIntersecting) {\n deferredImages.forEach(image => loadImage(image));\n deferredImages = [];\n }\n }, {\n root: getDefaultRoot(),\n threshold: [0.0]\n });\n containerObserver.observe(container);\n\n // eslint-disable-next-line compat/compat\n var imageObserver = new IntersectionObserver(entries => {\n for (var entry of entries) {\n if (entry.isIntersecting) {\n var image = entry.target;\n imageObserver.unobserve(image);\n if (containerIntersecting) {\n loadImage(image);\n } else {\n /* Defer loading of if the container is not intersecting the viewport */\n deferredImages.push(image);\n }\n }\n }\n }, {\n root: container,\n rootMargin: '300px',\n threshold: 0.0\n });\n for (var image of images) {\n imageObserver.observe(image);\n }\n return () => {\n containerObserver.disconnect();\n imageObserver.disconnect();\n };\n}\n\nfunction debounce(fn, delay) {\n var timeout;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n };\n}\n\nexport { ElementIntersectionObserver, HorizontalScroll, VerticalScroll, addStyle, closest, connectScrollContainerLazyLoad, debounce, dispatchEvent, setAttribute, testReducedMotion, toArray, toggleAttribute, withinRange, withinStops };\n//# sourceMappingURL=index.esm.js.map\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","__webpack_require__.amdO = {};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + ({\"45\":\"dh-prosentvis-lottie\",\"251\":\"dh-prosentvis-gltf\"}[chunkId] || chunkId) + \"-chunk-\" + {\"45\":\"39c81c994912e5d82d5e\",\"251\":\"8802feed49ef736c3c75\",\"630\":\"1e6b9fcd51097803cd14\",\"834\":\"8c1a7f44efff218cc50f\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"https://static.nrk.no/dh/module/animasjonsscroll/static/\";","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n\n// src/nrk-types.ts\nvar ClickEventKind = /* @__PURE__ */ ((ClickEventKind2) => {\n ClickEventKind2[\"Content\"] = \"content\";\n ClickEventKind2[\"Other\"] = \"other\";\n return ClickEventKind2;\n})(ClickEventKind || {});\nvar ImpressionEventKind = /* @__PURE__ */ ((ImpressionEventKind2) => {\n ImpressionEventKind2[\"Impression\"] = \"impression\";\n return ImpressionEventKind2;\n})(ImpressionEventKind || {});\nvar PlaybackEventKind = /* @__PURE__ */ ((PlaybackEventKind2) => {\n PlaybackEventKind2[\"Complete\"] = \"complete\";\n PlaybackEventKind2[\"Exit\"] = \"exit\";\n PlaybackEventKind2[\"Progress\"] = \"progress\";\n PlaybackEventKind2[\"Start\"] = \"start\";\n return PlaybackEventKind2;\n})(PlaybackEventKind || {});\nvar SearchSource = /* @__PURE__ */ ((SearchSource2) => {\n SearchSource2[\"PopularSearch\"] = \"popular-search\";\n SearchSource2[\"PreviousResult\"] = \"previous-result\";\n SearchSource2[\"Search\"] = \"search\";\n return SearchSource2;\n})(SearchSource || {});\nvar ViewportEventKind = /* @__PURE__ */ ((ViewportEventKind2) => {\n ViewportEventKind2[\"Entry\"] = \"entry\";\n ViewportEventKind2[\"Exit\"] = \"exit\";\n return ViewportEventKind2;\n})(ViewportEventKind || {});\nvar EventSchema = /* @__PURE__ */ ((EventSchema3) => {\n EventSchema3[\"BackstageEvent\"] = \"iglu:no.nrk.innlogging/backstage-event/jsonschema/1-0-0\";\n EventSchema3[\"ClickEvent\"] = \"iglu:no.nrk/click-event/jsonschema/1-0-0\";\n EventSchema3[\"FrontstageServerEvent\"] = \"iglu:no.nrk.innlogging/frontstage-server-event/jsonschema/1-0-0\";\n EventSchema3[\"ImpressionEvent\"] = \"iglu:no.nrk/impression-event/jsonschema/1-0-0\";\n EventSchema3[\"LoginRegisterFlowEvent\"] = \"iglu:no.nrk.innlogging/login-register-flow-event/jsonschema/1-0-0\";\n EventSchema3[\"PlaybackEvent\"] = \"iglu:no.nrk/playback-event/jsonschema/1-0-0\";\n EventSchema3[\"ProfilePageEvent\"] = \"iglu:no.nrk.innlogging/profile-page-event/jsonschema/1-0-0\";\n EventSchema3[\"RadioEvent\"] = \"iglu:no.nrk.radio/radio-event/jsonschema/1-0-0\";\n EventSchema3[\"SearchEvent\"] = \"iglu:no.nrk/search-event/jsonschema/1-0-0\";\n EventSchema3[\"StepEvent\"] = \"iglu:no.nrk.dh/step-event/jsonschema/1-0-0\";\n EventSchema3[\"TimeSpentEvent\"] = \"iglu:no.nrk/time-spent-event/jsonschema/1-0-0\";\n EventSchema3[\"ViewportEvent\"] = \"iglu:no.nrk.dh/viewport-event/jsonschema/1-0-0\";\n return EventSchema3;\n})(EventSchema || {});\nvar EntitySchema = /* @__PURE__ */ ((EntitySchema2) => {\n EntitySchema2[\"ClientID\"] = \"iglu:no.nrk.innlogging/client-id/jsonschema/1-0-0\";\n EntitySchema2[\"Content\"] = \"iglu:no.nrk/content/jsonschema/1-0-1\";\n EntitySchema2[\"Experiment\"] = \"iglu:no.nrk/experiment/jsonschema/1-0-0\";\n EntitySchema2[\"Link\"] = \"iglu:no.nrk/link/jsonschema/2-0-0\";\n EntitySchema2[\"NrkSession\"] = \"iglu:no.nrk/nrk-session/jsonschema/1-0-0\";\n EntitySchema2[\"NrkUser\"] = \"iglu:no.nrk/nrk-user/jsonschema/1-0-0\";\n EntitySchema2[\"Plug\"] = \"iglu:no.nrk/plug/jsonschema/3-0-0\";\n EntitySchema2[\"PreviousWebPage\"] = \"iglu:no.nrk/previous-web-page/jsonschema/1-0-0\";\n EntitySchema2[\"RegistrationContext\"] = \"iglu:no.nrk.innlogging/registration-context/jsonschema/1-0-0\";\n EntitySchema2[\"SearchResult\"] = \"iglu:no.nrk/search-result/jsonschema/1-0-1\";\n EntitySchema2[\"Service\"] = \"iglu:no.nrk/service/jsonschema/2-0-0\";\n EntitySchema2[\"Application\"] = \"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\";\n return EntitySchema2;\n})(EntitySchema || {});\n\n// src/nrk-base-tracker.ts\nimport cuid from \"cuid\";\nvar NrkBaseTracker = class {\n constructor(snowplow, config) {\n this.sharedEntities = {};\n var _a, _b, _c;\n this.snowplow = snowplow;\n this.trackerId = (_a = config.trackerId) != null ? _a : cuid.slug();\n this.setSharedEntity(\"iglu:no.nrk/service/jsonschema/2-0-0\" /* Service */, { id: config.serviceId, environment: (_b = config.environment) != null ? _b : null });\n if (config.appVersion && config.appBuild) {\n this.setSharedEntity(\"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\" /* Application */, { build: config.appBuild, version: config.appVersion });\n }\n snowplow.newTracker(this.trackerId, config.collectorUrl, {\n postPath: \"/nrk/wd6\",\n appId: config.appId,\n plugins: config.plugins,\n platform: (_c = config.platform) != null ? _c : \"web\",\n contexts: {\n webPage: config.disableWebContext !== true\n },\n stateStorageStrategy: config.disableLocalStorage ? \"cookie\" : void 0\n });\n }\n /**\n * Track page view.\n */\n trackPageView(contentEntity) {\n if (contentEntity) {\n this.snowplow.trackPageView(\n {\n context: entitiesToContexts(__spreadProps(__spreadValues({}, this.sharedEntities), {\n [\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */]: contentEntity\n }))\n },\n [this.trackerId]\n );\n } else {\n this.snowplow.trackPageView({ context: entitiesToContexts(this.sharedEntities) }, [this.trackerId]);\n }\n }\n /**\n * Generic track event for custom schemas, typed up to only support NRK\n * events and entities. All shared entities are included, and can be\n * overridden by specified entities.\n */\n trackSchemaEvent(schema, data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackSelfDescribingEvent(\n {\n event: { schema, data: __spreadValues({}, data) },\n context\n },\n [this.trackerId]\n );\n }\n /**\n * Send a standard structured event.\n */\n trackEvent(data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackStructEvent(__spreadProps(__spreadValues({}, data), { context }), [this.trackerId]);\n }\n /**\n * Set the logged in user.\n */\n setUser(userId) {\n this.snowplow.setUserId(userId, [this.trackerId]);\n this.setSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */, { id: userId });\n }\n /**\n * Clear the user when logged out.\n */\n clearUser() {\n this.snowplow.setUserId(null, [this.trackerId]);\n this.removeSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */);\n }\n /**\n * Add a plugin to the tracker.\n */\n addPlugin(configuration) {\n this.snowplow.addPlugin(configuration, [this.trackerId]);\n }\n /**\n * Set data for a shared entity for all events of this tracker.\n *\n * The `snowplow.addGlobalContexts()` method could potentially be used, but\n * `removeGlobalContexts()` requires the data as argument as well (awkward),\n * and there's no `getGlobalContexts()` to help with that.\n */\n setSharedEntity(schema, data) {\n this.sharedEntities[schema] = data;\n }\n /**\n * Returns any shared entities for an entity schema.\n */\n getSharedEntity(schema) {\n return this.sharedEntities[schema];\n }\n /**\n * Remove all shared entities for an entity schema.\n */\n removeSharedEntity(schema) {\n if (schema in this.sharedEntities) {\n delete this.sharedEntities[schema];\n }\n }\n};\nfunction entitiesToContexts(entities) {\n const contexts = [];\n Object.entries(entities).forEach(([schema, data]) => {\n const dataList = Array.isArray(data) ? data : [data];\n for (const entityData of dataList) {\n contexts.push({ schema, data: __spreadValues({}, entityData) });\n }\n });\n return contexts;\n}\n\n// src/nrk-player-tracker.ts\nvar NrkPlayerTracker = class extends NrkBaseTracker {\n /**\n * Tell the tracker what the current media is.\n */\n setMedia(mediaId, details) {\n const content = { id: mediaId };\n if (details == null ? void 0 : details.source) {\n content.source = details == null ? void 0 : details.source;\n }\n if (details == null ? void 0 : details.kind) {\n content.kind = details == null ? void 0 : details.kind;\n }\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, content);\n if (details == null ? void 0 : details.channelId) {\n this.channelId = details.channelId;\n }\n if (details && \"autoplay\" in details && details.autoplay !== void 0) {\n this.autoplay = details.autoplay;\n }\n }\n /**\n * Set autoplay for the current media.\n */\n setMediaAutoplay(autoplay) {\n this.autoplay = autoplay;\n }\n /**\n * Tell the tracker that media is unknown (like for gaps in the EPG).\n */\n setUnknownMedia(channelId) {\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, { id: \"unknown\", kind: \"unknown\" });\n this.channelId = channelId;\n }\n /**\n * Send a playback event of kind 'start'.\n *\n * Should be called when time starts running:\n * - After changing media.\n * - After user pauses playback.\n * - At replay.\n */\n sendStartEvent(startTime, live) {\n if (this.getSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */) === void 0) {\n throw new Error(\"Must use setMedia() first!\");\n }\n const start = Math.max(0, Math.floor(startTime));\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind: \"start\" /* Start */,\n startTime: start,\n endTime: start,\n autoplay: this.autoplay,\n live,\n channelId: this.channelId\n });\n }\n /**\n * Send a playback event of kind 'progress'.\n *\n * Should be called when time stops for any reason other than complete or\n * exit.\n */\n sendProgressEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"progress\" /* Progress */, startTime, endTime, live);\n }\n /**\n * Send a playback event of kind 'complete'.\n *\n * Should be called when:\n * - Playback reaches the end (100%) of the media (for ODM it stops, for\n * channels it continues to play the next program in the EPG).\n * - When a skip-to-next media function is invoked when binging.\n */\n sendCompleteEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"complete\" /* Complete */, startTime, endTime != null ? endTime : startTime, live);\n }\n /**\n * Send a playback event of kind 'exit'.\n *\n * Should be called when leaving the media before a 'complete'-event is sent,\n * including when seeking away from a program in the EPG to another.\n */\n sendExitEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"exit\" /* Exit */, startTime, endTime != null ? endTime : startTime, live);\n }\n sendPlaybackEvent(kind, startTime, endTime, live) {\n const start = Math.max(0, Math.floor(startTime));\n const end = Math.max(0, Math.floor(endTime));\n if (start === end && kind === \"progress\" /* Progress */) {\n return;\n }\n if (start > end) {\n throw new Error(`Start time can't be after end time (${start} vs ${end}). Event was ${kind}`);\n }\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind,\n startTime: start,\n endTime: end,\n live,\n channelId: this.channelId\n });\n }\n};\n\n// src/service-id.ts\nvar ServiceID = /* @__PURE__ */ ((ServiceID2) => {\n ServiceID2[\"Embed\"] = \"embed\";\n ServiceID2[\"Nrkbeta\"] = \"nrkbeta\";\n ServiceID2[\"Nrkinnlogging\"] = \"nrkinnlogging\";\n ServiceID2[\"Nrkno\"] = \"nrkno\";\n ServiceID2[\"Nrkp3\"] = \"nrkp3\";\n ServiceID2[\"Nrkradio\"] = \"nrkradio\";\n ServiceID2[\"Nrksuper\"] = \"nrksuper\";\n ServiceID2[\"Nrktv\"] = \"nrktv\";\n ServiceID2[\"Yr\"] = \"yr\";\n return ServiceID2;\n})(ServiceID || {});\n\n// src/snowplow-global.ts\nvar SnowplowGlobal = class {\n constructor() {\n this.snowplow = window.snowplow;\n if (this.snowplow === void 0) {\n throw new Error(\"There is no global Snowplow function.\");\n }\n }\n /**\n * Check if the global API is available (provided by the \"Snowplow tag\"). No\n * distinction is made between sp.js and sp.lite.js.\n */\n static isAvailable() {\n return window.snowplow !== void 0;\n }\n /**\n * Modify newTracker() to support adding plugins via the tracker\n * configuration. See \"Creating your own plugins\" in the JavaScript tracker\n * Snowplow docs.\n *\n * Note: The tracker configuration hasn't been thoroughly checked for\n * inconsistencies between the global API and @snowplow/browser-tracker.\n * There might be issues.\n */\n newTracker(trackerId, collectorUrl, configuration) {\n this.snowplow(\"newTracker\", trackerId, collectorUrl, configuration);\n if ((configuration == null ? void 0 : configuration.plugins) !== void 0) {\n configuration.plugins.forEach((plugin) => {\n this.addPlugin({ plugin }, [trackerId]);\n });\n }\n }\n setUserId(...args) {\n this.proxy(\"setUserId\", args, 2);\n }\n trackPageView(...args) {\n this.proxy(\"trackPageView\", args, 2);\n }\n trackSelfDescribingEvent(...args) {\n this.proxy(\"trackSelfDescribingEvent\", args, 2);\n }\n trackStructEvent(...args) {\n this.proxy(\"trackStructEvent\", args, 2);\n }\n preservePageViewId(...args) {\n this.proxy(\"preservePageViewId\", args, 1);\n }\n addPlugin(config, trackers) {\n const args = [{ Plugin: () => config.plugin }, \"Plugin\", trackers];\n this.proxy(\"addPlugin\", args, args.length);\n }\n /**\n * Make a call to the global Snowplow API, with the specified method and\n * arguments. It only supports methods which have a `trackers` argument as\n * the last (optional) argument.\n *\n * The `trackers` argument of the Snowplow methods is optional and not always\n * in the same position. The `maxArgs` argument specifies the maximum number\n * of arguments the method supports and so in which position the `trackers`\n * argument is, when present. This is necessary in order to transform the use\n * of `trackers` between the Snowplow API and the global API. So if\n * `Args['length']` is `1 | 2`, then `maxArgs` should be 2.\n */\n proxy(method, args, maxArgs) {\n const trackerIds = args.length === maxArgs ? args.pop() : void 0;\n if (trackerIds && trackerIds.length > 0) {\n trackerIds.forEach((trackerId) => {\n this.snowplow(`${method}:${trackerId}`, ...args);\n });\n } else {\n this.snowplow(method, ...args);\n }\n }\n};\nexport {\n ClickEventKind,\n EntitySchema,\n EventSchema,\n ImpressionEventKind,\n NrkBaseTracker,\n NrkPlayerTracker,\n PlaybackEventKind,\n SearchSource,\n ServiceID,\n SnowplowGlobal,\n ViewportEventKind,\n entitiesToContexts\n};\n","import { EntitySchema, EventSchema } from '@nrk/snowplow-web';\n\n/**\n * Root path to snowplow bundle on static.nrk.no.\n */\nvar staticSnowplowRoot = \"https://static.nrk.no/nrkno-snowplow\";\n/**\n * The current major version\n */\nvar staticSnowplowMajorVersion = \"1\";\n\n//@ts-expect-error post-fix version to allow multiple versions to co-exists at the same time\nvar globalKey = \"nrknoOnTrackerReady-\" + staticSnowplowMajorVersion;\n\n/**\n * Modified version of @nrk/snowplow-web. Does not allow array or undefined\n */\n\n/**\n * Typecheck and generate `{schema, data}`\n */\nfunction getTyped(schema, data) {\n return {\n schema,\n data\n };\n}\n\n/**\n * No-op type check\n */\nfunction isTypedContext(_schema, _data) {}\n/**\n * No-op type check\n */\nfunction isTypedEvent(_schema, _data) {}\n/**\n * No-op type check\n */\nfunction isTyped(_schema, _data) {}\n\n/**\n * No-op type check\n */\nfunction isTypedArray(_schema, _data) {}\n\n/**\n * Typechecks a context and return the Snowplow type\n */\nfunction asSnowplowContext(data) {\n return data;\n}\nfunction asSnowplowEntity(data) {\n return data;\n}\n\nvar typeUtil = /*#__PURE__*/Object.freeze({\n __proto__: null,\n EntitySchema: EntitySchema,\n EventSchema: EventSchema,\n asSnowplowContext: asSnowplowContext,\n asSnowplowEntity: asSnowplowEntity,\n getTyped: getTyped,\n isTyped: isTyped,\n isTypedArray: isTypedArray,\n isTypedContext: isTypedContext,\n isTypedEvent: isTypedEvent\n});\n\n/// \n/**\n * Takes a callback that will be called with the bundled JS when ready.\n *\n * This function will load the major version (defined above in JS file) from `static.nrk.no`\n * @note the callback will never be called if a network error occurs.\n */\nfunction getBundle(callback) {\n // Add callback queue placeholder if needed\n if (globalThis[globalKey] === undefined) {\n //@ts-expect-error `q` is next line\n globalThis[globalKey] = function (cb) {\n globalThis[globalKey].q.push(cb);\n };\n globalThis[globalKey].q = [];\n }\n {\n // load script if needed\n loadOnce(staticSnowplowRoot + \"/major/\" + staticSnowplowMajorVersion + \"/nrkno-snowplow-entry.js\");\n }\n\n // add callback\n globalThis[globalKey](callback);\n}\n/**\n * loadOnce loads the given script IFF it is not already present in the DOM.\n * @param {string} src URL for script\n * @returns {undefined}\n */\nfunction loadOnce(src) {\n var hasScript = document.querySelector(\"script[src=\\\"\" + src + \"\\\"]\");\n if (hasScript) {\n return;\n }\n var script = document.createElement('script');\n script.async = true;\n script.src = src;\n document.head.appendChild(script);\n}\n\nexport { typeUtil as TypeUtils, getBundle };\n","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n\n// src/nrk-types.ts\nvar ClickEventKind = /* @__PURE__ */ ((ClickEventKind2) => {\n ClickEventKind2[\"Content\"] = \"content\";\n ClickEventKind2[\"Other\"] = \"other\";\n return ClickEventKind2;\n})(ClickEventKind || {});\nvar ImpressionEventKind = /* @__PURE__ */ ((ImpressionEventKind2) => {\n ImpressionEventKind2[\"Impression\"] = \"impression\";\n return ImpressionEventKind2;\n})(ImpressionEventKind || {});\nvar PlaybackEventKind = /* @__PURE__ */ ((PlaybackEventKind2) => {\n PlaybackEventKind2[\"Complete\"] = \"complete\";\n PlaybackEventKind2[\"Exit\"] = \"exit\";\n PlaybackEventKind2[\"Progress\"] = \"progress\";\n PlaybackEventKind2[\"Start\"] = \"start\";\n return PlaybackEventKind2;\n})(PlaybackEventKind || {});\nvar SearchSource = /* @__PURE__ */ ((SearchSource2) => {\n SearchSource2[\"PopularSearch\"] = \"popular-search\";\n SearchSource2[\"PreviousResult\"] = \"previous-result\";\n SearchSource2[\"Search\"] = \"search\";\n return SearchSource2;\n})(SearchSource || {});\nvar ViewportEventKind = /* @__PURE__ */ ((ViewportEventKind2) => {\n ViewportEventKind2[\"Entry\"] = \"entry\";\n ViewportEventKind2[\"Exit\"] = \"exit\";\n return ViewportEventKind2;\n})(ViewportEventKind || {});\nvar EventSchema = /* @__PURE__ */ ((EventSchema3) => {\n EventSchema3[\"BackstageEvent\"] = \"iglu:no.nrk.innlogging/backstage-event/jsonschema/1-0-0\";\n EventSchema3[\"ClickEvent\"] = \"iglu:no.nrk/click-event/jsonschema/1-0-0\";\n EventSchema3[\"FrontstageServerEvent\"] = \"iglu:no.nrk.innlogging/frontstage-server-event/jsonschema/1-0-0\";\n EventSchema3[\"ImpressionEvent\"] = \"iglu:no.nrk/impression-event/jsonschema/1-0-0\";\n EventSchema3[\"LoginRegisterFlowEvent\"] = \"iglu:no.nrk.innlogging/login-register-flow-event/jsonschema/1-0-0\";\n EventSchema3[\"PlaybackEvent\"] = \"iglu:no.nrk/playback-event/jsonschema/1-0-0\";\n EventSchema3[\"ProfilePageEvent\"] = \"iglu:no.nrk.innlogging/profile-page-event/jsonschema/1-0-0\";\n EventSchema3[\"RadioEvent\"] = \"iglu:no.nrk.radio/radio-event/jsonschema/1-0-0\";\n EventSchema3[\"SearchEvent\"] = \"iglu:no.nrk/search-event/jsonschema/1-0-0\";\n EventSchema3[\"StepEvent\"] = \"iglu:no.nrk.dh/step-event/jsonschema/1-0-0\";\n EventSchema3[\"TimeSpentEvent\"] = \"iglu:no.nrk/time-spent-event/jsonschema/1-0-0\";\n EventSchema3[\"ViewportEvent\"] = \"iglu:no.nrk.dh/viewport-event/jsonschema/1-0-0\";\n return EventSchema3;\n})(EventSchema || {});\nvar EntitySchema = /* @__PURE__ */ ((EntitySchema2) => {\n EntitySchema2[\"ClientID\"] = \"iglu:no.nrk.innlogging/client-id/jsonschema/1-0-0\";\n EntitySchema2[\"Content\"] = \"iglu:no.nrk/content/jsonschema/1-0-1\";\n EntitySchema2[\"Experiment\"] = \"iglu:no.nrk/experiment/jsonschema/1-0-0\";\n EntitySchema2[\"Link\"] = \"iglu:no.nrk/link/jsonschema/2-0-0\";\n EntitySchema2[\"NrkSession\"] = \"iglu:no.nrk/nrk-session/jsonschema/1-0-0\";\n EntitySchema2[\"NrkUser\"] = \"iglu:no.nrk/nrk-user/jsonschema/1-0-0\";\n EntitySchema2[\"Plug\"] = \"iglu:no.nrk/plug/jsonschema/3-0-0\";\n EntitySchema2[\"PreviousWebPage\"] = \"iglu:no.nrk/previous-web-page/jsonschema/1-0-0\";\n EntitySchema2[\"RegistrationContext\"] = \"iglu:no.nrk.innlogging/registration-context/jsonschema/1-0-0\";\n EntitySchema2[\"SearchResult\"] = \"iglu:no.nrk/search-result/jsonschema/1-0-1\";\n EntitySchema2[\"Service\"] = \"iglu:no.nrk/service/jsonschema/2-0-0\";\n EntitySchema2[\"Application\"] = \"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\";\n return EntitySchema2;\n})(EntitySchema || {});\n\n// src/nrk-base-tracker.ts\nimport cuid from \"cuid\";\nvar NrkBaseTracker = class {\n constructor(snowplow, config) {\n this.sharedEntities = {};\n var _a, _b, _c;\n this.snowplow = snowplow;\n this.trackerId = (_a = config.trackerId) != null ? _a : cuid.slug();\n this.setSharedEntity(\"iglu:no.nrk/service/jsonschema/2-0-0\" /* Service */, { id: config.serviceId, environment: (_b = config.environment) != null ? _b : null });\n if (config.appVersion && config.appBuild) {\n this.setSharedEntity(\"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\" /* Application */, { build: config.appBuild, version: config.appVersion });\n }\n snowplow.newTracker(this.trackerId, config.collectorUrl, {\n postPath: \"/nrk/wd6\",\n appId: config.appId,\n plugins: config.plugins,\n platform: (_c = config.platform) != null ? _c : \"web\",\n contexts: {\n webPage: config.disableWebContext !== true\n },\n stateStorageStrategy: config.disableLocalStorage ? \"cookie\" : void 0\n });\n }\n /**\n * Track page view.\n */\n trackPageView(contentEntity) {\n if (contentEntity) {\n this.snowplow.trackPageView(\n {\n context: entitiesToContexts(__spreadProps(__spreadValues({}, this.sharedEntities), {\n [\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */]: contentEntity\n }))\n },\n [this.trackerId]\n );\n } else {\n this.snowplow.trackPageView({ context: entitiesToContexts(this.sharedEntities) }, [this.trackerId]);\n }\n }\n /**\n * Generic track event for custom schemas, typed up to only support NRK\n * events and entities. All shared entities are included, and can be\n * overridden by specified entities.\n */\n trackSchemaEvent(schema, data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackSelfDescribingEvent(\n {\n event: { schema, data: __spreadValues({}, data) },\n context\n },\n [this.trackerId]\n );\n }\n /**\n * Send a standard structured event.\n */\n trackEvent(data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackStructEvent(__spreadProps(__spreadValues({}, data), { context }), [this.trackerId]);\n }\n /**\n * Set the logged in user.\n */\n setUser(userId) {\n this.snowplow.setUserId(userId, [this.trackerId]);\n this.setSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */, { id: userId });\n }\n /**\n * Clear the user when logged out.\n */\n clearUser() {\n this.snowplow.setUserId(null, [this.trackerId]);\n this.removeSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */);\n }\n /**\n * Add a plugin to the tracker.\n */\n addPlugin(configuration) {\n this.snowplow.addPlugin(configuration, [this.trackerId]);\n }\n /**\n * Set data for a shared entity for all events of this tracker.\n *\n * The `snowplow.addGlobalContexts()` method could potentially be used, but\n * `removeGlobalContexts()` requires the data as argument as well (awkward),\n * and there's no `getGlobalContexts()` to help with that.\n */\n setSharedEntity(schema, data) {\n this.sharedEntities[schema] = data;\n }\n /**\n * Returns any shared entities for an entity schema.\n */\n getSharedEntity(schema) {\n return this.sharedEntities[schema];\n }\n /**\n * Remove all shared entities for an entity schema.\n */\n removeSharedEntity(schema) {\n if (schema in this.sharedEntities) {\n delete this.sharedEntities[schema];\n }\n }\n};\nfunction entitiesToContexts(entities) {\n const contexts = [];\n Object.entries(entities).forEach(([schema, data]) => {\n const dataList = Array.isArray(data) ? data : [data];\n for (const entityData of dataList) {\n contexts.push({ schema, data: __spreadValues({}, entityData) });\n }\n });\n return contexts;\n}\n\n// src/nrk-player-tracker.ts\nvar NrkPlayerTracker = class extends NrkBaseTracker {\n /**\n * Tell the tracker what the current media is.\n */\n setMedia(mediaId, details) {\n const content = { id: mediaId };\n if (details == null ? void 0 : details.source) {\n content.source = details == null ? void 0 : details.source;\n }\n if (details == null ? void 0 : details.kind) {\n content.kind = details == null ? void 0 : details.kind;\n }\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, content);\n if (details == null ? void 0 : details.channelId) {\n this.channelId = details.channelId;\n }\n if (details && \"autoplay\" in details && details.autoplay !== void 0) {\n this.autoplay = details.autoplay;\n }\n }\n /**\n * Set autoplay for the current media.\n */\n setMediaAutoplay(autoplay) {\n this.autoplay = autoplay;\n }\n /**\n * Tell the tracker that media is unknown (like for gaps in the EPG).\n */\n setUnknownMedia(channelId) {\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, { id: \"unknown\", kind: \"unknown\" });\n this.channelId = channelId;\n }\n /**\n * Send a playback event of kind 'start'.\n *\n * Should be called when time starts running:\n * - After changing media.\n * - After user pauses playback.\n * - At replay.\n */\n sendStartEvent(startTime, live) {\n if (this.getSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */) === void 0) {\n throw new Error(\"Must use setMedia() first!\");\n }\n const start = Math.max(0, Math.floor(startTime));\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind: \"start\" /* Start */,\n startTime: start,\n endTime: start,\n autoplay: this.autoplay,\n live,\n channelId: this.channelId\n });\n }\n /**\n * Send a playback event of kind 'progress'.\n *\n * Should be called when time stops for any reason other than complete or\n * exit.\n */\n sendProgressEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"progress\" /* Progress */, startTime, endTime, live);\n }\n /**\n * Send a playback event of kind 'complete'.\n *\n * Should be called when:\n * - Playback reaches the end (100%) of the media (for ODM it stops, for\n * channels it continues to play the next program in the EPG).\n * - When a skip-to-next media function is invoked when binging.\n */\n sendCompleteEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"complete\" /* Complete */, startTime, endTime != null ? endTime : startTime, live);\n }\n /**\n * Send a playback event of kind 'exit'.\n *\n * Should be called when leaving the media before a 'complete'-event is sent,\n * including when seeking away from a program in the EPG to another.\n */\n sendExitEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"exit\" /* Exit */, startTime, endTime != null ? endTime : startTime, live);\n }\n sendPlaybackEvent(kind, startTime, endTime, live) {\n const start = Math.max(0, Math.floor(startTime));\n const end = Math.max(0, Math.floor(endTime));\n if (start === end && kind === \"progress\" /* Progress */) {\n return;\n }\n if (start > end) {\n throw new Error(`Start time can't be after end time (${start} vs ${end}). Event was ${kind}`);\n }\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind,\n startTime: start,\n endTime: end,\n live,\n channelId: this.channelId\n });\n }\n};\n\n// src/service-id.ts\nvar ServiceID = /* @__PURE__ */ ((ServiceID2) => {\n ServiceID2[\"Embed\"] = \"embed\";\n ServiceID2[\"Nrkbeta\"] = \"nrkbeta\";\n ServiceID2[\"Nrkinnlogging\"] = \"nrkinnlogging\";\n ServiceID2[\"Nrkno\"] = \"nrkno\";\n ServiceID2[\"Nrkp3\"] = \"nrkp3\";\n ServiceID2[\"Nrkradio\"] = \"nrkradio\";\n ServiceID2[\"Nrksuper\"] = \"nrksuper\";\n ServiceID2[\"Nrktv\"] = \"nrktv\";\n ServiceID2[\"Yr\"] = \"yr\";\n return ServiceID2;\n})(ServiceID || {});\n\n// src/snowplow-global.ts\nvar SnowplowGlobal = class {\n constructor() {\n this.snowplow = window.snowplow;\n if (this.snowplow === void 0) {\n throw new Error(\"There is no global Snowplow function.\");\n }\n }\n /**\n * Check if the global API is available (provided by the \"Snowplow tag\"). No\n * distinction is made between sp.js and sp.lite.js.\n */\n static isAvailable() {\n return window.snowplow !== void 0;\n }\n /**\n * Modify newTracker() to support adding plugins via the tracker\n * configuration. See \"Creating your own plugins\" in the JavaScript tracker\n * Snowplow docs.\n *\n * Note: The tracker configuration hasn't been thoroughly checked for\n * inconsistencies between the global API and @snowplow/browser-tracker.\n * There might be issues.\n */\n newTracker(trackerId, collectorUrl, configuration) {\n this.snowplow(\"newTracker\", trackerId, collectorUrl, configuration);\n if ((configuration == null ? void 0 : configuration.plugins) !== void 0) {\n configuration.plugins.forEach((plugin) => {\n this.addPlugin({ plugin }, [trackerId]);\n });\n }\n }\n setUserId(...args) {\n this.proxy(\"setUserId\", args, 2);\n }\n trackPageView(...args) {\n this.proxy(\"trackPageView\", args, 2);\n }\n trackSelfDescribingEvent(...args) {\n this.proxy(\"trackSelfDescribingEvent\", args, 2);\n }\n trackStructEvent(...args) {\n this.proxy(\"trackStructEvent\", args, 2);\n }\n preservePageViewId(...args) {\n this.proxy(\"preservePageViewId\", args, 1);\n }\n addPlugin(config, trackers) {\n const args = [{ Plugin: () => config.plugin }, \"Plugin\", trackers];\n this.proxy(\"addPlugin\", args, args.length);\n }\n /**\n * Make a call to the global Snowplow API, with the specified method and\n * arguments. It only supports methods which have a `trackers` argument as\n * the last (optional) argument.\n *\n * The `trackers` argument of the Snowplow methods is optional and not always\n * in the same position. The `maxArgs` argument specifies the maximum number\n * of arguments the method supports and so in which position the `trackers`\n * argument is, when present. This is necessary in order to transform the use\n * of `trackers` between the Snowplow API and the global API. So if\n * `Args['length']` is `1 | 2`, then `maxArgs` should be 2.\n */\n proxy(method, args, maxArgs) {\n const trackerIds = args.length === maxArgs ? args.pop() : void 0;\n if (trackerIds && trackerIds.length > 0) {\n trackerIds.forEach((trackerId) => {\n this.snowplow(`${method}:${trackerId}`, ...args);\n });\n } else {\n this.snowplow(method, ...args);\n }\n }\n};\nexport {\n ClickEventKind,\n EntitySchema,\n EventSchema,\n ImpressionEventKind,\n NrkBaseTracker,\n NrkPlayerTracker,\n PlaybackEventKind,\n SearchSource,\n ServiceID,\n SnowplowGlobal,\n ViewportEventKind,\n entitiesToContexts\n};\n","import { getBundle } from '@nrk/nrkno-snowplow';\nimport { EntitySchema } from '@nrk/snowplow-web';\nimport { g as getHost } from './shared/dh-snowplow.1ee613bf.mjs';\n\nconst APP_ID = \"no.nrk.dh\";\nfunction resolveOrTimeout(promise, wait) {\n return Promise.race([\n promise.then(() => true),\n new Promise((resolve) => {\n setTimeout(() => {\n resolve(false);\n }, wait);\n })\n ]);\n}\nfunction createTracker(trackerId, { environment, contentContext }) {\n let trackerReady = false;\n let bundle;\n const host = getHost(environment);\n const eventQueue = [];\n const contexts = [\"service\", \"user\"];\n const trackOrQueue = (callback) => {\n if (trackerReady) {\n callback(bundle);\n } else {\n eventQueue.push(callback);\n }\n };\n const trackStructuredEvent = (event) => trackOrQueue(({ NrknoUtils, Snowplow }) => {\n Snowplow.trackStructEvent(\n {\n ...event,\n context: NrknoUtils.context.collect(contexts)\n },\n [trackerId]\n );\n });\n const trackSelfDescribingEvent = (event) => trackOrQueue(\n ({ NrknoUtils, Snowplow }) => Snowplow.trackSelfDescribingEvent(\n {\n event,\n context: NrknoUtils.context.collect(contexts)\n },\n [trackerId]\n )\n );\n getBundle((nrknoBundle) => {\n bundle = nrknoBundle;\n const { NrknoUtils } = nrknoBundle;\n NrknoUtils.newTracker(trackerId, APP_ID, host);\n if (contentContext) {\n const contentContextId = `${trackerId}-${contentContext.id}`;\n contexts.push(contentContextId);\n NrknoUtils.context.set(contentContextId, EntitySchema.Content, {\n source: contentContext.source,\n id: contentContext.id\n });\n }\n resolveOrTimeout(NrknoUtils.trackers.whenReady(\"main-tracker\"), 1e3).then((isResolved) => {\n trackerReady = true;\n if (isResolved === false) {\n console.warn(\"nrkno tracker not available\");\n }\n while (eventQueue.length) {\n const fn = eventQueue.pop();\n fn(bundle);\n }\n return;\n }).catch(console.error);\n });\n return {\n trackSelfDescribingEvent,\n trackStructuredEvent\n };\n}\n\nexport { createTracker, getHost };\n","function getHost(environment = \"development\") {\n if (environment === \"production\") {\n return \"https://data.nrk.no\";\n }\n return \"https://no-nrk-prod1.mini.snplow.net\";\n}\n\nexport { getHost as g };\n","import assertClassBrand from \"./assertClassBrand.js\";\nexport default function _classPrivateFieldGet2(s, a) {\n return s.get(assertClassBrand(s, a));\n}","export default function _assertClassBrand(e, t, n) {\n if (\"function\" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;\n throw new TypeError(\"Private element is not present on this object\");\n}","import classApplyDescriptorGet from \"./classApplyDescriptorGet.js\";\nimport classPrivateFieldGet2 from \"./classPrivateFieldGet2.js\";\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classPrivateFieldGet2(privateMap, receiver);\n return classApplyDescriptorGet(receiver, descriptor);\n}","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classPrivateFieldGet2 from \"./classPrivateFieldGet2.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classPrivateFieldGet2(privateMap, receiver);\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}","import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';\nimport _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';\nimport { testReducedMotion } from '@nrk/dh-basis-common';\n\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\n\n/*\n * Mixin for custom elements\n *\n * Keeps track of multiple scroll timelines and calls updatedCallback whenever\n * progress in a scroll timeline has changed.\n *\n * Inspired by https://drafts.csswg.org/scroll-animations-1/\n */\nfunction ScrollanimasjonMixin(Base) {\n var _isWatching, _observer, _animation, _progress, _timeline, _createIntersectionObserver, _disconnectIntersectionObserver, _handleVisibilityChange, _startWatching, _stopWatching;\n return _isWatching = /*#__PURE__*/new WeakMap(), _observer = /*#__PURE__*/new WeakMap(), _animation = /*#__PURE__*/new WeakMap(), _progress = /*#__PURE__*/new WeakMap(), _timeline = /*#__PURE__*/new WeakMap(), _createIntersectionObserver = /*#__PURE__*/new WeakSet(), _disconnectIntersectionObserver = /*#__PURE__*/new WeakSet(), _handleVisibilityChange = /*#__PURE__*/new WeakMap(), _startWatching = /*#__PURE__*/new WeakSet(), _stopWatching = /*#__PURE__*/new WeakSet(), class extends Base {\n constructor() {\n super(...arguments);\n _classPrivateMethodInitSpec(this, _stopWatching);\n _classPrivateMethodInitSpec(this, _startWatching);\n _classPrivateMethodInitSpec(this, _disconnectIntersectionObserver);\n _classPrivateMethodInitSpec(this, _createIntersectionObserver);\n _classPrivateFieldInitSpec(this, _isWatching, {\n writable: true,\n value: false\n });\n _classPrivateFieldInitSpec(this, _observer, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _animation, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _progress, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _timeline, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _handleVisibilityChange, {\n writable: true,\n value: _ref => {\n var [containerIntersection] = _ref;\n if (containerIntersection.isIntersecting) {\n _classPrivateMethodGet(this, _startWatching, _startWatching2).call(this);\n } else {\n _classPrivateMethodGet(this, _stopWatching, _stopWatching2).call(this);\n }\n }\n });\n }\n connectedCallback() {\n var _super$connectedCallb;\n (_super$connectedCallb = super.connectedCallback) === null || _super$connectedCallb === void 0 || _super$connectedCallb.call(this);\n var userPrefersReducedMotion = testReducedMotion();\n if (this.reduceMotion.type === 'auto' && userPrefersReducedMotion) {\n this.progressUpdatedCallback(this.reduceMotion.defaultValue);\n return;\n }\n _classPrivateFieldSet(this, _timeline, new ViewTimeline({\n subject: this,\n axis: this.axis,\n inset: this.inset\n }));\n _classPrivateFieldSet(this, _animation, this.animate({}, {\n timeline: _classPrivateFieldGet(this, _timeline),\n rangeStart: this.rangeStart,\n rangeEnd: this.rangeEnd\n }));\n _classPrivateMethodGet(this, _createIntersectionObserver, _createIntersectionObserver2).call(this);\n }\n disconnectedCallback() {\n var _super$disconnectedCa;\n (_super$disconnectedCa = super.disconnectedCallback) === null || _super$disconnectedCa === void 0 || _super$disconnectedCa.call(this);\n _classPrivateMethodGet(this, _disconnectIntersectionObserver, _disconnectIntersectionObserver2).call(this);\n _classPrivateMethodGet(this, _stopWatching, _stopWatching2).call(this);\n }\n /* Override this method to perform updates */\n progressUpdatedCallback(progress) {\n console.log(progress.toFixed(3));\n }\n get axis() {\n var _this$getAttribute;\n return (_this$getAttribute = this.getAttribute('axis')) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : 'block';\n }\n get inset() {\n var _this$getAttribute2;\n return (_this$getAttribute2 = this.getAttribute('inset')) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : '0px 0px';\n }\n get rangeStart() {\n var _this$getAttribute3;\n return (_this$getAttribute3 = this.getAttribute('range-start')) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : 'contain';\n }\n get rangeEnd() {\n var _this$getAttribute4;\n return (_this$getAttribute4 = this.getAttribute('range-end')) !== null && _this$getAttribute4 !== void 0 ? _this$getAttribute4 : 'contain';\n }\n get reduceMotion() {\n var attributeValue = this.getAttribute('reduce-motion') || 'auto 1';\n if (attributeValue === 'never') {\n return {\n type: 'never'\n };\n } else if (attributeValue.startsWith('auto')) {\n var [type, value = '1'] = attributeValue.trim().split(' ');\n try {\n var defaultValue = parseFloat(value);\n return {\n type,\n defaultValue: Math.min(Math.max(defaultValue, 0), 1)\n };\n } catch (_unused) {\n console.warn(\"reduceMotion must be either: \\\"none\\\" or \\\"auto N\\\" with N = number [0..1] number input is \".concat(value));\n return {\n type: 'auto',\n defaultValue: 1\n };\n }\n } else {\n console.warn(\"reduceMotion must be either: \\\"none\\\" or \\\"auto N\\\" with N = number [0..1] type input is(\".concat(attributeValue, \")\"));\n return {\n type: 'auto',\n defaultValue: 1\n };\n }\n }\n get timeline() {\n return _classPrivateFieldGet(this, _timeline);\n }\n };\n function _createIntersectionObserver2() {\n // eslint-disable-next-line compat/compat\n _classPrivateFieldSet(this, _observer, new IntersectionObserver(_classPrivateFieldGet(this, _handleVisibilityChange), {\n /*\n Use document as root, so that intersections are tracked against iframe scrolling viewport if embedded (polopoly-preview).\n (No root would use the viewport, even when embedded in iframe)\n https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-root\n */\n root: document,\n threshold: [0]\n }));\n _classPrivateFieldGet(this, _observer).observe(this);\n }\n function _disconnectIntersectionObserver2() {\n if (_classPrivateFieldGet(this, _observer)) {\n _classPrivateFieldGet(this, _observer).disconnect();\n }\n }\n function _startWatching2() {\n if (_classPrivateFieldGet(this, _isWatching)) {\n return;\n }\n var loop = () => {\n if (_classPrivateFieldGet(this, _isWatching)) {\n requestAnimationFrame(loop);\n } else {\n return;\n }\n var progress;\n var currentTime = _classPrivateFieldGet(this, _animation).currentTime;\n if (currentTime.unit === 'percent') {\n // https://github.com/w3c/csswg-drafts/issues/8799\n var rangeProgress = _classPrivateFieldGet(this, _animation).currentTime.value / _classPrivateFieldGet(this, _animation).effect.getComputedTiming().endTime.value;\n progress = Math.max(0, Math.min(rangeProgress, 1));\n }\n if (_classPrivateFieldGet(this, _progress) !== progress) {\n this.progressUpdatedCallback(progress);\n _classPrivateFieldSet(this, _progress, progress);\n }\n };\n _classPrivateFieldSet(this, _isWatching, true);\n // eslint-disable-next-line compat/compat\n requestAnimationFrame(loop);\n }\n function _stopWatching2() {\n _classPrivateFieldSet(this, _isWatching, false);\n }\n}\n\nclass Scrollprogress extends ScrollanimasjonMixin(HTMLElement) {\n progressUpdatedCallback(progress) {\n var _this$targetElement;\n (_this$targetElement = this.targetElement) === null || _this$targetElement === void 0 || _this$targetElement.setAttribute('data-progress', progress.toFixed(4));\n }\n get targetElement() {\n return this.querySelector('[data-progress]');\n }\n}\n\nexport { ScrollanimasjonMixin, Scrollprogress };\n//# sourceMappingURL=index.esm.js.map\n","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : String(i);\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';\nimport _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';\nimport _defineProperty from '@babel/runtime/helpers/defineProperty';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nvar dedupeId = 0;\n\n/**\n * @template {HTMLElement} BaseClass\n * @param {(base: BaseClass) => BaseClass} mixin\n */\nfunction dedupeMixin(mixin) {\n var mixinId = dedupeId++;\n return base => {\n var _base$_appliedMixins, _base$_appliedMixins2;\n if ((_base$_appliedMixins = base._appliedMixins) !== null && _base$_appliedMixins !== void 0 && _base$_appliedMixins[mixinId]) {\n return base;\n }\n var extended = mixin(base);\n extended._appliedMixins = _objectSpread({}, (_base$_appliedMixins2 = base._appliedMixins) !== null && _base$_appliedMixins2 !== void 0 ? _base$_appliedMixins2 : {});\n extended._appliedMixins[mixinId] = true;\n return extended;\n };\n}\n\nfunction _classPrivateMethodInitSpec$1(obj, privateSet) { _checkPrivateRedeclaration$1(obj, privateSet); privateSet.add(obj); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration$1(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration$1(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet$1(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nvar VIEWPORT_POSITION_ATTR = 'viewport-position';\nvar VIEWPORT_POSITIONS = {\n aboveViewport: 'ABOVE-VIEWPORT',\n inViewport: 'IN-VIEWPORT',\n belowViewport: 'BELOW-VIEWPORT'\n};\n\n/**\n * Check if element represents the browser viewport\n *\n * @param viewportContainer Element to check\n * @returns {boolean} True if element represents the browser viewport and not a scroll container\n */\nfunction isViewport(viewportContainer) {\n return (\n // eslint-disable-next-line compat/compat\n viewportContainer === document.scrollingElement || viewportContainer === document.documentElement\n );\n}\n\n/**\n * Custom Element mixin.\n *\n * Updates the `viewport-position` attribute according to whether the element is in the viewport or not.\n * Possible values for the attribute is `IN-VIEWPORT`, `ABOVE-VIEWPORT` and `BELOW-VIEWPORT`\n *\n * @template {HTMLElement} BaseClass\n * @param {BaseClass} Base\n */\nfunction _ViewportPositionMixin(Base) {\n var _observer, _createIntersectionObserver, _disconnectIntersectionObserver, _handleIntersectionChange;\n return _observer = /*#__PURE__*/new WeakMap(), _createIntersectionObserver = /*#__PURE__*/new WeakSet(), _disconnectIntersectionObserver = /*#__PURE__*/new WeakSet(), _handleIntersectionChange = /*#__PURE__*/new WeakMap(), class extends Base {\n constructor() {\n super(...arguments);\n _classPrivateMethodInitSpec$1(this, _disconnectIntersectionObserver);\n _classPrivateMethodInitSpec$1(this, _createIntersectionObserver);\n _classPrivateFieldInitSpec(this, _observer, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldInitSpec(this, _handleIntersectionChange, {\n writable: true,\n value: _ref => {\n var [intersection] = _ref;\n if (intersection.isIntersecting) {\n if (this.viewportPosition !== VIEWPORT_POSITIONS.inViewport) {\n this.viewportPosition = VIEWPORT_POSITIONS.inViewport;\n }\n } else {\n if (!this.viewportPosition || this.viewportPosition === VIEWPORT_POSITIONS.inViewport) {\n var {\n top,\n bottom\n } = this.getBoundingClientRect();\n\n // The latest chrome reports bcr.bottom to be 0.5\n // Instead of checking that the bottom is outside the viewport\n // we check that the top of the element is above the viewport,\n // and that the bottom of the element is above the bottom of the viewport\n var isAbove = top <= 0 && bottom <= window.innerHeight;\n this.viewportPosition = isAbove ? VIEWPORT_POSITIONS.aboveViewport : VIEWPORT_POSITIONS.belowViewport;\n }\n }\n }\n });\n }\n static get observedAttributes() {\n var _super$observedAttrib;\n return [...((_super$observedAttrib = super.observedAttributes) !== null && _super$observedAttrib !== void 0 ? _super$observedAttrib : []), VIEWPORT_POSITION_ATTR];\n }\n connectedCallback() {\n var _super$connectedCallb;\n (_super$connectedCallb = super.connectedCallback) === null || _super$connectedCallb === void 0 ? void 0 : _super$connectedCallb.call(this);\n _classPrivateMethodGet$1(this, _createIntersectionObserver, _createIntersectionObserver2).call(this);\n }\n disconnectedCallback() {\n var _super$disconnectedCa;\n (_super$disconnectedCa = super.disconnectedCallback) === null || _super$disconnectedCa === void 0 ? void 0 : _super$disconnectedCa.call(this);\n _classPrivateMethodGet$1(this, _disconnectIntersectionObserver, _disconnectIntersectionObserver2).call(this);\n }\n /**\n * Get the viewport or the scroll container element that is used as a replacement for the viewport.\n *\n * @returns {Element|HTMLElement} viewportContainer\n */\n get viewportContainer() {\n var _document$scrollingEl;\n /*\n * Using root/document.scrollingElement to represent the viewport,\n * as this presents a unified API for scrolling for both the viewport and scrolling elements.\n * (scrollTop, scrollLeft, scrollTo)\n *\n * Some API's such as IntersectionObserver use different values for the viewport\n * (such as null and document), so take care.\n */\n\n // eslint-disable-next-line compat/compat\n return (_document$scrollingEl = document.scrollingElement) !== null && _document$scrollingEl !== void 0 ? _document$scrollingEl : document.documentElement;\n }\n\n /**\n * Get the intersection root\n * @returns {null|Element|HTMLElement|Document}\n */\n get viewportIntersectionRoot() {\n var viewportContainer = this.viewportContainer;\n if (isViewport(viewportContainer)) {\n var _navigator, _navigator$userAgent, _navigator$userAgent$;\n var isIFrame = window.location !== window.parent.location;\n var isChrome = (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$userAgent = _navigator.userAgent) === null || _navigator$userAgent === void 0 ? void 0 : (_navigator$userAgent$ = _navigator$userAgent.includes) === null || _navigator$userAgent$ === void 0 ? void 0 : _navigator$userAgent$.call(_navigator$userAgent, 'Chrome');\n // Chrome has a bug when using document in as IntersectionObserver root: https://bugs.chromium.org/p/chromium/issues/detail?id=1420155\n if (isIFrame && !isChrome) {\n /* Use document as intersection root in iframes */\n return document;\n } else {\n return null;\n }\n } else {\n return viewportContainer;\n }\n }\n\n /**\n * Position of this element relative to the viewport.\n *\n * @type {'ABOVE-VIEWPORT' | 'IN-VIEWPORT' | 'BELOW-VIEWPORT' }\n */\n set viewportPosition(value) {\n var currentValue = this.getAttribute(VIEWPORT_POSITION_ATTR);\n if (value !== currentValue) {\n this.setAttribute(VIEWPORT_POSITION_ATTR, value);\n }\n }\n\n /**\n * Position of this element relative to the viewport.\n *\n * @type {'ABOVE-VIEWPORT' | 'IN-VIEWPORT' | 'BELOW-VIEWPORT' }\n */\n get viewportPosition() {\n return this.getAttribute(VIEWPORT_POSITION_ATTR);\n }\n };\n function _createIntersectionObserver2() {\n // eslint-disable-next-line compat/compat\n _classPrivateFieldSet(this, _observer, new IntersectionObserver(_classPrivateFieldGet(this, _handleIntersectionChange), {\n threshold: [0],\n // Intersection observer uses null or document for regular viewport\n root: this.viewportIntersectionRoot,\n // Scroll snapping elements trigger intersection when they are perfectly aligned with the screen,\n // both above and below the viewport. Using -1px as root margin to prevent intersection.\n rootMargin: '-1px 0px -1px 0px'\n }));\n _classPrivateFieldGet(this, _observer).observe(this);\n }\n function _disconnectIntersectionObserver2() {\n var _classPrivateFieldGet2, _classPrivateFieldGet3;\n (_classPrivateFieldGet2 = _classPrivateFieldGet(this, _observer)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.unobserve(this);\n (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _observer)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.disconnect();\n }\n}\n\n/**\n * @template {HTMLElement} BaseClass\n * @param {BaseClass} Base */\nvar ViewportPositionMixin = dedupeMixin(_ViewportPositionMixin);\n\nfunction _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError(\"attempted to get private field on non-instance\"); } return fn; }\nfunction _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classCheckPrivateStaticFieldDescriptor(descriptor, action) { if (descriptor === undefined) { throw new TypeError(\"attempted to \" + action + \" private static field before its declaration\"); } }\nfunction _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError(\"Private static access of wrong provenance\"); } }\nfunction _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError(\"attempted to set read only private field\"); } descriptor.value = value; } }\n\n/**\n * @typedef BoundAttributeConfig\n * @property {string} attribute – name of attribute to bind, or name of source and target attributes separated with a semicolon\n * @property {string | function } targets – selector string or function that takes element as argument and returns list of target elements\n */\n\n/**\n * Custom element mixin that creates a one way binding between an attribute on\n * the custom element and a given attribute on it's children.\n *\n * @template {HTMLElement} BaseClass\n * @param {BaseClass} Base\n */\nfunction _AttributeBindingMixin(Base) {\n var _class, _getTargetElements, _boundAttributes;\n return _getTargetElements = /*#__PURE__*/new WeakSet(), (_class = class AttributeBindingMixinDef extends Base {\n constructor() {\n super(...arguments);\n _classPrivateMethodInitSpec(this, _getTargetElements);\n }\n /**\n * Configure the bound attributes.\n *\n * @returns {BoundAttributeConfig[]}\n */\n static get boundAttributes() {\n return [];\n }\n static get observedAttributes() {\n var _super$observedAttrib;\n var boundAttributes = {};\n\n // Parse and store configuration for faster lookup\n for (var {\n attribute,\n targets\n } of this.boundAttributes) {\n if (typeof attribute !== 'string') {\n throw Error('Bound attribute configuration must have `attribute` property of string type');\n }\n var [sourceAttribute, targetAttribute = sourceAttribute] = attribute.split(':');\n boundAttributes[sourceAttribute] = {\n sourceAttributeName: sourceAttribute,\n targetAttributeName: targetAttribute,\n targets\n };\n }\n _classStaticPrivateFieldSpecSet(AttributeBindingMixinDef, _class, _boundAttributes, boundAttributes);\n\n // Observe bound attributes\n return [...((_super$observedAttrib = super.observedAttributes) !== null && _super$observedAttrib !== void 0 ? _super$observedAttrib : []), ...Object.keys(boundAttributes)];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n var _super$attributeChang;\n (_super$attributeChang = super.attributeChangedCallback) === null || _super$attributeChang === void 0 ? void 0 : _super$attributeChang.call(this, name, oldValue, newValue);\n if (newValue === oldValue) {\n return;\n }\n var boundAttributes = _classStaticPrivateFieldSpecGet(AttributeBindingMixinDef, _class, _boundAttributes);\n if (name in boundAttributes) {\n var configuration = boundAttributes[name];\n var targets = configuration.targets;\n var targetElements = _classPrivateMethodGet(this, _getTargetElements, _getTargetElements2).call(this, targets);\n for (var element of targetElements) {\n if (newValue !== null) {\n element.setAttribute(configuration.targetAttributeName, newValue);\n } else {\n element.removeAttribute(configuration.targetAttributeName);\n }\n }\n }\n }\n }, _boundAttributes = {\n writable: true,\n value: void 0\n }, _class);\n function _getTargetElements2(targets) {\n if (typeof targets === 'function') {\n return targets(this);\n } else if (typeof targets === 'string') {\n return Array.from(this.querySelectorAll(targets));\n } else {\n throw new Error(\"Unsupported targets type: \".concat(typeof targets));\n }\n }\n}\n\n/**\n * @template {HTMLElement} BaseClass\n * @param {BaseClass} Base\n */\nvar AttributeBindingMixin = dedupeMixin(_AttributeBindingMixin);\n\nexport { AttributeBindingMixin, VIEWPORT_POSITIONS, VIEWPORT_POSITION_ATTR, ViewportPositionMixin };\n//# sourceMappingURL=index.esm.js.map\n","// extracted by mini-css-extract-plugin\nexport default {\"animasjonsscroll\":\"dhans__animasjonsscroll--eJ4sF\",\"vertical\":\"dhans__vertical--ag8pn\",\"horizontal\":\"dhans__horizontal--HcKWL\",\"figure\":\"dhans__figure--VR4sS\"};","import { Scrollprogress } from '@nrk/dh-basis-scrollanimasjon'\nimport { ViewportPositionMixin } from '@nrk/dh-basis-mixins'\nimport styles from './animasjonsscroll.module.css'\nimport './animasjonsscroll.template-adjustments.module.css'\n\nexport default class Animasjonsscroll extends ViewportPositionMixin(Scrollprogress) {\n connectedCallback() {\n super.connectedCallback()\n this._class = styles.animasjonsscroll\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n }\n\n get defaultProgress() {\n if (this.reduceMotion?.type === 'auto') {\n return this.reduceMotion.defaultValue\n } else {\n return 1\n }\n }\n}\n","/* eslint-disable promise/catch-or-return, promise/always-return */\nimport { testReducedMotion, toArray } from '@nrk/dh-basis-common'\n\nconst isVisible = (child) => child.offsetWidth > 0 || child.offsetHeight > 0\n\nexport default class ProsentvisVideo extends HTMLElement {\n #intersectionObserver\n\n static get observedAttributes() {\n return ['data-progress']\n }\n\n connectedCallback() {\n this._reducedMotion = testReducedMotion()\n\n /* Preload video when close to viewport */\n this.#intersectionObserver = new IntersectionObserver(\n (intersectionEntries) => {\n if (intersectionEntries?.[0]?.isIntersecting) {\n const videos = this.querySelectorAll('video')\n for (const video of videos) {\n if (window.getComputedStyle(video).display !== 'none') {\n video.setAttribute('preload', 'auto')\n }\n }\n\n this.#intersectionObserver.disconnect()\n this.#intersectionObserver = null\n }\n },\n {\n threshold: 0,\n rootMargin: '3000px',\n },\n )\n this.#intersectionObserver.observe(this)\n }\n\n disconnectedCallback() {\n this.#intersectionObserver?.disconnect()\n }\n\n attributeChangedCallback(name, prevValue, newValue) {\n const valueChanged = prevValue !== newValue\n if (!valueChanged) {\n return\n }\n\n if (name === 'data-progress') {\n this.#progressChanged()\n }\n }\n\n async #progressChanged() {\n const seekEnabled = await this.#checkSeek()\n if (!seekEnabled) {\n return\n }\n const videoElement = this.videoElement\n\n if (!videoElement || !videoElement.duration || this._reducedMotion) {\n return\n }\n\n videoElement.currentTime = this.progress * videoElement.duration\n }\n\n async #checkSeek() {\n const videoElement = this.videoElement\n if (videoElement.hasAttribute('data-seek-enabled')) {\n return videoElement.getAttribute('data-seek-enabled') === 'true'\n }\n\n try {\n await (videoElement.play() || Promise.resolve(true))\n videoElement.pause()\n videoElement.setAttribute('data-seek-enabled', 'true')\n return true\n } catch {\n videoElement.setAttribute('data-seek-enabled', 'false')\n return false\n }\n }\n\n get videoElement() {\n return toArray(this.children)\n .filter((child) => child.nodeName === 'VIDEO')\n .find(isVisible)\n }\n\n get progress() {\n return parseFloat(this.getAttribute('data-progress') || '0.0')\n }\n\n set progress(val) {\n this.setAttribute('data-progress', val.toFixed(4))\n }\n}\n","/* eslint-disable no-redeclare */\nimport { toArray, closest } from '@nrk/dh-basis-common'\nimport type {\n LayerAnimation,\n Easing,\n PropertyValues,\n PropertyType,\n AnimationProperty,\n} from '../../types/prosentvis-bilde.d.ts'\nimport './prosentvis-bilde.module.css'\n\nconst SYNTHETIC_DURATION = 10_000\n\nexport default class ProsentvisBilde extends HTMLElement {\n connectedCallback() {\n this.#updateSizes()\n\n const animasjonsscroll = this.closest('dh-animasjonsscroll')\n if (animasjonsscroll) {\n this.#animateLayers(\n // @ts-ignore\n animasjonsscroll.timeline,\n // @ts-ignore\n animasjonsscroll.rangeStart,\n // @ts-ignore\n animasjonsscroll.rangeEnd,\n // @ts-ignore\n animasjonsscroll.defaultProgress,\n )\n }\n }\n\n #isFullWidth() {\n return (\n closest(this, 'article')?.classList?.contains('article-feature') &&\n closest(this, '.remoterenderedcontent-reference')?.classList.contains('fc')\n )\n }\n\n #updateSizes() {\n if (this.#isFullWidth()) {\n this.layers.forEach((elm) => elm.setAttribute('sizes', '100vw'))\n }\n }\n\n #animateLayers(timeline, rangeStart, rangeEnd, defaultProgress) {\n if (!('Animation' in window)) {\n return\n }\n // Currently we need to set up one animation per property per layer.\n // In the future is should be possible to combine these keyframe effects into one grouped effect.\n // And use only one animation to drive that effect.\n //\n // TODO: Switch to GroupEffect once supported (for easier debugging)\n for (const layer of this.layers) {\n const layerAnim = JSON.parse(layer.getAttribute('data-layer-animation'))\n const keyframeEffects = toKeyframeEffects(layerAnim, layer)\n\n // TODO: Switch to GroupEffect once supported (for easier debugging)\n /*layer.animate(keyframes, {\n timeline,\n rangeStart,\n rangeEnd,\n fill: 'both',\n composite: i === 0 ? 'replace' : 'accumulate',\n })*/\n for (const keyframeEffect of keyframeEffects) {\n if (timeline) {\n // eslint-disable-next-line compat/compat\n const animation = new Animation(keyframeEffect, timeline)\n // @ts-ignore\n animation.rangeStart = rangeStart\n // @ts-ignore\n animation.rangeEnd = rangeEnd\n animation.play()\n } else {\n // When user prefers reduced motion no timeline is available.\n // Set the progress to default progress\n // eslint-disable-next-line compat/compat\n const animation = new Animation(keyframeEffect)\n animation.currentTime = defaultProgress * SYNTHETIC_DURATION\n }\n }\n }\n }\n\n get layers() {\n return toArray(this.querySelectorAll('[data-layer-animation]'))\n }\n\n get progress() {\n return parseFloat(this.getAttribute('data-progress') || '0.0')\n }\n\n set progress(val) {\n this.setAttribute('data-progress', val.toFixed(4))\n }\n}\n\nfunction toKeyframe(\n type: T,\n value: PropertyValues[T],\n offset: number,\n easing: string,\n): Keyframe {\n const keyframe = { offset, easing }\n switch (type) {\n case 'rotate':\n return { ...keyframe, rotate: `${value}deg` }\n case 'scale':\n return { ...keyframe, scale: `${value}` }\n case 'translateX':\n return { ...keyframe, translate: `${value}% 0%`, composite: 'add' }\n case 'translateY':\n return { ...keyframe, translate: `0% ${value}%`, composite: 'add' }\n case 'translate':\n return {\n ...keyframe,\n translate: `${(value as PropertyValues['translate']).x}% ${(value as PropertyValues['translate']).y}%`,\n composite: 'add',\n }\n case 'opacity':\n return { ...keyframe, opacity: value as number }\n }\n}\n\nfunction toEasingString(easing: Easing): string {\n switch (easing.type) {\n case 'ease':\n case 'ease-in':\n case 'ease-out':\n case 'ease-in-out':\n case 'linear':\n return easing.type\n case 'steps':\n return `steps(${easing.n}, ${easing.jumpterm})`\n case 'cubic-bezier':\n return `cubic-bezier(${easing.x1}, ${easing.y1}, ${easing.x2}, ${easing.y2})`\n default:\n return 'none'\n }\n}\n\nfunction toKeyframeEffects(animation: LayerAnimation, target: Element): KeyframeEffect[] {\n return animation.map((property: AnimationProperty) => {\n // TODO: Switch to one KeyframeEffect per property once GroupEffect is supported\n\n const keyframes = property.keyframes.map((keyframe) => {\n return toKeyframe(\n property.type,\n keyframe.value,\n keyframe.percent / 100,\n toEasingString(keyframe.easing),\n )\n })\n // eslint-disable-next-line compat/compat\n return new KeyframeEffect(target, keyframes, { fill: 'both', duration: SYNTHETIC_DURATION })\n })\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"prosentvis-overgang\":\"dhans__prosentvis-overgang--Dk35C\",\"prosentvisOvergang\":\"dhans__prosentvis-overgang--Dk35C\",\"mask\":\"dhans__mask--jYOQw\",\"image\":\"dhans__image--idkYb\",\"fade-in\":\"dhans__fade-in--CVGrO\",\"fadeIn\":\"dhans__fade-in--CVGrO\",\"background\":\"dhans__background--tnUZo\"};","const MAX_CANVAS_AREA = 1000000\n\nexport class CanvasManager {\n constructor(canvas) {\n this._canvas = canvas\n }\n\n async updateImages(image, mask) {\n this._image = image\n this._mask = mask\n this._updateCanvasWidth()\n }\n\n updateDpr(canvasWidth, canvasHeight, dpr) {\n const canvas = this._canvas\n\n /* Limit canvas area to MAX_CANVAS_AREA to improve performance */\n let effectiveDpr = dpr\n const potentialArea = dpr * dpr * canvasWidth * canvasHeight\n if (potentialArea > MAX_CANVAS_AREA) {\n effectiveDpr = Math.sqrt(MAX_CANVAS_AREA / (canvasWidth * canvasHeight))\n }\n\n canvas.width = canvasWidth * effectiveDpr\n canvas.height = canvasHeight * effectiveDpr\n }\n\n _updateCanvasWidth() {\n const canvas = this._canvas\n this._context = canvas.getContext('2d', {\n willReadFrequently: true,\n })\n\n /* Save image as ImageData */\n this._context.clearRect(0, 0, canvas.width, canvas.height)\n this._context.drawImage(this._image, 0, 0, canvas.width, canvas.height)\n this._imageData = this._context.getImageData(0, 0, canvas.width, canvas.height)\n\n /* Save mask as ImageData */\n this._context.clearRect(0, 0, canvas.width, canvas.height)\n this._context.drawImage(this._mask, 0, 0, canvas.width, canvas.height)\n this._maskData = this._context.getImageData(0, 0, canvas.width, canvas.height)\n\n /* Save create image data as ImageData */\n this._context.clearRect(0, 0, canvas.width, canvas.height)\n this._drawData = this._context.getImageData(0, 0, canvas.width, canvas.height)\n\n this._ready = true\n }\n\n updateMask(progress, range) {\n if (!this._ready) {\n return\n }\n // Distance to move black and white point during scroll\n const distance = 255 + range\n const blackPoint = 255 - distance * progress\n\n const data = this._drawData.data\n const imageData = this._imageData.data\n const maskData = this._maskData.data\n for (let i = 0; i < data.length; i += 4) {\n const greyValue = 0.2126 * maskData[i] + 0.7152 * maskData[i + 1] + 0.0722 * maskData[i + 2]\n const leveledValue = ((greyValue - blackPoint) * 255.0) / range\n const a = clamp(leveledValue / 255.0, 0, 1)\n\n data[i] = imageData[i]\n data[i + 1] = imageData[i + 1]\n data[i + 2] = imageData[i + 2]\n data[i + 3] = imageData[i + 3] * a\n }\n this._context.putImageData(this._drawData, 0, 0)\n }\n}\n\nfunction clamp(value, min, max) {\n return Math.max(Math.min(value, max), min)\n}\n","import styles from './prosentvis-overgang.module.css'\nimport { debounce } from 'debounce'\n\n// eslint-disable-next-line import/default\nimport { CanvasManager } from './overgang/canvas-manager.js'\n\nexport default class ProsentvisOvergang extends HTMLElement {\n static get observedAttributes() {\n return ['data-progress']\n }\n\n connectedCallback() {\n this.appendChild(document.createElement('canvas'))\n /*\n Disabling workers as webpack 5 does not support inline workers:\n https://github.com/webpack/webpack/discussions/14066\n */\n /*\n if ('OffscreenCanvas' in window) {\n this._worker = new Worker(\n new URL('./overgang/prosentvis-overgang.worker.js', import.meta.url)\n )\n const offscreen = this.canvas.transferControlToOffscreen()\n this._worker.postMessage({ canvas: offscreen }, [offscreen])\n }\n */\n\n this._debouncedUpdateCanvasWidth = debounce(this._updateCanvasWidth, 300)\n this._manager = new CanvasManager(this.canvas)\n\n window.addEventListener('resize', this._debouncedUpdateCanvasWidth)\n this._debouncedUpdateCanvasWidth()\n\n setTimeout(() => {\n this.querySelectorAll('img').forEach((img) => {\n img.addEventListener('load', this._debouncedUpdateCanvasWidth)\n })\n })\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this._debouncedUpdateCanvasWidth)\n }\n\n attributeChangedCallback(name, prevValue, newValue) {\n const valueChanged = prevValue !== newValue\n if (!valueChanged) {\n return\n }\n\n if (name === 'data-progress') {\n this._prosentChanged()\n }\n }\n\n _prosentChanged() {\n this._updateMask()\n }\n\n _updateCanvasWidth = async () => {\n const canvas = this.canvas\n const images = this.images\n if (\n images.length < 2 ||\n images.some((image) => !image.complete) ||\n canvas.offsetWidth === this._currentCanvasWidth ||\n this.image.clientHeight === 0 ||\n this.mask.clientHeight === 0 ||\n this.image.naturalHeight === 0 ||\n this.mask.naturalHeight === 0\n ) {\n return\n }\n this._currentCanvasWidth = canvas.offsetWidth\n /* We're loaded */\n const dpr = Math.min(window.devicePixelRatio, 2)\n if (this._worker) {\n const image = await createImageBitmap(this.image)\n const mask = await createImageBitmap(this.mask)\n this._worker.postMessage(\n {\n image,\n mask,\n canvasWidth: canvas.offsetWidth,\n canvasHeight: canvas.offsetHeight,\n dpr,\n },\n [image, mask],\n )\n } else {\n this._manager.updateDpr(canvas.offsetWidth, canvas.offsetHeight, dpr)\n this._manager.updateImages(this.image, this.mask)\n }\n this._ready = true\n this._updateMask()\n }\n\n _updateMask = () => {\n if (!this._ready) {\n return\n }\n\n if (this._worker) {\n this._worker.postMessage({ progress: this.progress, range: this.range })\n if (this.canvas.style.visibility !== 'visible') {\n /* Hide image and show canvas */\n this.canvas.style.visibility = 'visible'\n this.image.style.visibility = 'hidden'\n }\n } else {\n if (this._animationFrame) {\n return // Already painting\n }\n this._animationFrame = requestAnimationFrame(() => {\n const progress = this.progress\n const range = this.range\n this._manager.updateMask(progress, range)\n\n delete this._animationFrame\n if (this.canvas.style.visibility !== 'visible') {\n /* Hide image and show canvas */\n this.canvas.style.visibility = 'visible'\n this.image.style.visibility = 'hidden'\n }\n })\n }\n }\n\n get image() {\n return this.querySelector(`.${styles.image}`)\n }\n\n get mask() {\n return this.querySelector(`.${styles.mask}`)\n }\n\n get images() {\n /* eslint-disable compat/compat */\n return Array.from(this.querySelectorAll('img'))\n }\n\n get canvas() {\n return this.querySelector('canvas')\n }\n\n get progress() {\n return parseFloat(this.getAttribute('data-progress') || '0.0')\n }\n\n /* Range between black and white point */\n get range() {\n return parseFloat(this.getAttribute('range') || '1.0')\n }\n\n set progress(val) {\n this.setAttribute('data-progress', val.toFixed(4))\n }\n}\n","/* eslint-disable promise/catch-or-return, promise/always-return */\nimport { getElementTag } from '@nrk/dh-server-libs/get-element-tag.js'\nimport { createTracker } from '@nrk/dh-snowplow'\nimport { EventSchema, ViewportEventKind } from '@nrk/snowplow-web'\nimport Animasjonsscroll from './components/animasjonsscroll.js'\nimport ProsentvisVideo from './components/media/prosentvis-video.js'\nimport ProsentvisBilde from './components/media/prosentvis-bilde.ts'\nimport ProsentvisOvergang from './components/media/prosentvis-overgang.js'\nimport './lib/scroll-timeline.js'\n\nimport './components/animasjonsscroll.module.css'\nimport './client.css'\n\nconst tag = getElementTag(__APP_NAME__, __APP_VERSION__)\n\nfunction safeDefine(elementName, constructor) {\n if (typeof customElements.get(elementName) === 'undefined') {\n customElements.define(elementName, constructor)\n }\n}\n\nexport class AppElement extends HTMLElement {\n name = tag\n #entryObserver\n #exitObserver\n #tracker\n\n connectedCallback() {\n this.#defineCustomElements()\n this.#createTracker()\n this.#startViewportLogger()\n }\n\n disconnectedCallback() {\n this.#stopViewportLogger()\n }\n\n async #defineCustomElements() {\n safeDefine('dh-animasjonsscroll', Animasjonsscroll)\n safeDefine('dh-prosentvis-video', ProsentvisVideo)\n safeDefine('dh-prosentvis-bilde', ProsentvisBilde)\n safeDefine('dh-prosentvis-overgang', ProsentvisOvergang)\n\n if (this.features.lottie && typeof customElements.get('dh-prosentvis-lottie') === 'undefined') {\n const prosentvisLottie = (\n await import(\n './components/media/prosentvis-lottie.js' /* webpackChunkName: \"dh-prosentvis-lottie\" */\n )\n ).default\n safeDefine('dh-prosentvis-lottie', prosentvisLottie)\n }\n\n if (this.features.gltf && typeof customElements.get('dh-prosentvis-gltf') === 'undefined') {\n const prosentvisGLTF = (\n await import(\n './components/media/prosentvis-gltf.js' /* webpackChunkName: \"dh-prosentvis-gltf\" */\n )\n ).default\n safeDefine('dh-prosentvis-gltf', prosentvisGLTF)\n }\n }\n\n #createTracker() {\n if (process.env.DEV) {\n import('@nrk/dh-snowplow/mock').then(({ mock }) => mock()).catch(console.error)\n }\n\n this.tracker = createTracker('dh-animasjonsscroll', {\n environment: process.env.ENVIRONMENT,\n contentContext: {\n source: 'pp',\n id: this.dataset.selfId,\n },\n })\n }\n\n #startViewportLogger() {\n this.#entryObserver = new IntersectionObserver((entries) => {\n if (!entries[0]?.isIntersecting) {\n return\n }\n this.#entryObserver.disconnect()\n this.#exitObserver.observe(this)\n this.tracker.trackSelfDescribingEvent({\n schema: EventSchema.ViewportEvent,\n data: {\n kind: ViewportEventKind.Entry,\n },\n })\n }, {})\n\n this.#exitObserver = new IntersectionObserver(\n (entries) => {\n if (!entries[0]?.isIntersecting) {\n return\n }\n this.#exitObserver.disconnect()\n this.tracker.trackSelfDescribingEvent({\n schema: EventSchema.ViewportEvent,\n data: {\n kind: ViewportEventKind.Exit,\n },\n })\n },\n { threshold: [1], rootMargin: '3000px 0px -100% 0px' },\n )\n\n this.#entryObserver.observe(this)\n }\n\n #stopViewportLogger() {\n this.#entryObserver?.disconnect()\n this.#exitObserver?.disconnect()\n }\n\n get features() {\n return JSON.parse(this.getAttribute('features') || '{}')\n }\n}\n\nsafeDefine(tag, AppElement)\n"],"names":["installedChunks","installChunk","e","t","constructor","__publicField","this","value","n","i","r","type","o","a","s","l","u","c","f","m","unit","p","d","h","S","g","v","y","T","w","C","b","x","k","input","consume","codePointAt","index","String","fromCodePoint","length","reconsume","peek","push","P","M","E","R","V","U","_","A","I","N","F","parseInt","j","z","L","includes","parseFloat","O","D","match","W","H","Set","q","has","toLowerCase","$","Error","writingMode","TypeError","B","slice","test","Q","reduce","get","set","Map","G","K","Array","from","map","CSSUnitValue","percentageReference","toSum","values","fontSize","CSSKeywordValue","Math","PI","operator","CSSMathSum","CSSMathProduct","CSSMathNegate","CSSMathClamp","lower","upper","CSSMathInvert","CSSMathMin","CSSMathMax","every","apply","some","filter","entries","J","X","Y","fontRelativeLengths","units","viewportRelativeLengths","absoluteLengths","compatible","canonicalUnit","ratios","cm","mm","in","pc","pt","px","angle","deg","grad","rad","turn","time","ms","frequency","hz","khz","resolution","dpi","dpcm","dppx","Z","bt","Object","ee","te","keys","ne","percent","flex","ie","oe","ae","se","_e$percentHint","percentHint","CSSFunction","name","CSSSimpleBlock","associatedToken","ue","shift","unshift","ce","fe","me","pe","de","SyntaxError","he","pop","CSSStyleSheet","insertRule","Se","isArray","le","WeakMap","CSSNumericValue2","parse","CSSMathValue","delimiter","toString","join","CSSNumericValue","to","re","arguments","super","window","CSS","Reflect","defineProperty","forEach","ge","ve","ye","Te","we","document","scrollingElement","Ce","ke","animations","currentTime","tickAnimation","be","sourceMeasurements","getComputedStyle","scrollTop","abs","scrollLeft","xe","De","anonymousSource","ze","anonymousTarget","Ve","subject","display","Pe","Me","scrollWidth","scrollHeight","clientWidth","clientHeight","direction","scrollPaddingTop","scrollPaddingBottom","scrollPaddingLeft","scrollPaddingRight","Ee","offsetParent","offsetLeft","offsetTop","clientLeft","clientTop","top","left","offsetWidth","offsetHeight","Re","timelineRefs","deref","subjectMeasurements","updateScheduled","setTimeout","source","delete","size","disconnect","ResizeObserver","observe","children","MutationObserver","target","attributes","attributeFilter","scrollListener","addEventListener","removeEventListener","add","WeakRef","Ue","animation","splice","_e","queueMicrotask","ScrollTimeline","axis","inset","duration","phase","overflow","isConnected","__polyfill","Ae","parentElement","Ie","Ne","transform","perspective","willChange","backdropFilter","Fe","position","je","body","Le","scrollPadding","containerSize","start","end","min","max","Oe","rangeName","offset","unsupportedTimeline","_t$","startOffset","endOffset","We","getAnimations","He","Element","prototype","qe","animate","$e","Animation","Be","state","nativeResolve","nativeReject","promise","Promise","resolve","reject","catch","Qe","readyPromise","requestAnimationFrame","_ref","timeline","mt","pendingTask","startTime","holdTime","Ye","Xe","Ge","DOMException","Ke","_e$rangeDuration","rangeDuration","rt","Je","_e$rangeDuration2","tt","playbackRate","pendingPlaybackRate","proxy","it","ot","Ze","finishedPromise","playState","pause","CustomEvent","detail","timelineTime","dispatchEvent","et","nt","pending","previousCurrentTime","then","effect","getTiming","normalizedTiming","delay","endDelay","iterations","at","st","autoAlignStartTime","lt","bind","ct","cancel","ut","specifiedTiming","ft","animationRange","dt","console","warn","ht","ViewTimeline","St","split","gt","vt","updateTiming","_e$duration","localTime","endTime","activeDuration","assign","autoDurationEffect","Proxy","getComputedTiming","play","rangeStart","_ref2","rangeEnd","_ref3","replaceState","finish","reverse","updatePlaybackRate","persist","id","onfinish","oncancel","onremove","finished","ready","yt","Tt","wt","Ct","supports","fingerprint","pad","getRandomValue","blockSize","base","discreteValues","pow","randomBlock","safeCounter","cuid","Date","getTime","slug","date","counter","print","random","isCuid","stringToCheck","startsWith","isSlug","stringLength","module","exports","env","self","globalCount","clientId","navigator","mimeTypes","userAgent","crypto","msCrypto","lim","getRandomValues","Uint32Array","num","substr","debounce","func","wait","immediate","timeout","args","context","timestamp","result","later","last","now","debounced","callNow","clear","clearTimeout","flush","getElementTag","version","proto","closest","matches","msMatchesSelector","webkitMatchesSelector","el","css","call","toArray","nodeList","element","event","undefined","ignore","concat","bubbles","cancelable","createEvent","initCustomEvent","testReducedMotion","matchMedia","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","amdO","getter","__esModule","definition","key","enumerable","chunkId","all","promises","miniCssF","obj","prop","hasOwnProperty","Symbol","toStringTag","data","ids","modules","runtime","installedChunkData","import","race","defineProperties","getOwnPropertyDescriptors","getOwnPropertySymbols","propertyIsEnumerable","staticSnowplowRoot","staticSnowplowMajorVersion","globalKey","getBundle","callback","globalThis","cb","src","querySelector","script","createElement","async","head","appendChild","loadOnce","ViewportEventKind2","EventSchema3","EntitySchema2","APP_ID","createTracker","trackerId","environment","contentContext","bundle","trackerReady","host","getHost","eventQueue","contexts","trackOrQueue","nrknoBundle","NrknoUtils","newTracker","contentContextId","Content","trackers","whenReady","isResolved","fn","error","trackSelfDescribingEvent","Snowplow","collect","trackStructuredEvent","trackStructEvent","_classPrivateFieldGet2","_classPrivateFieldGet","receiver","privateMap","descriptor","_classPrivateFieldSet","writable","_classPrivateMethodInitSpec","privateSet","_checkPrivateRedeclaration","_classPrivateFieldInitSpec","privateCollection","_classPrivateMethodGet","Scrollprogress","Base","_isWatching","_observer","_animation","_progress","_timeline","_createIntersectionObserver","_disconnectIntersectionObserver","_handleVisibilityChange","_startWatching","_stopWatching","WeakSet","containerIntersection","isIntersecting","_startWatching2","_stopWatching2","connectedCallback","_super$connectedCallb","userPrefersReducedMotion","reduceMotion","progressUpdatedCallback","defaultValue","_createIntersectionObserver2","disconnectedCallback","_super$disconnectedCa","_disconnectIntersectionObserver2","progress","log","toFixed","_this$getAttribute","getAttribute","_this$getAttribute2","_this$getAttribute3","_this$getAttribute4","attributeValue","trim","_unused","IntersectionObserver","root","threshold","loop","rangeProgress","ScrollanimasjonMixin","HTMLElement","_this$targetElement","targetElement","setAttribute","_typeof","iterator","toPropertyKey","toPrimitive","Number","_defineProperty","configurable","ownKeys","object","enumerableOnly","symbols","sym","getOwnPropertyDescriptor","dedupeId","dedupeMixin","mixin","mixinId","_base$_appliedMixins","_base$_appliedMixins2","_appliedMixins","extended","_objectSpread","_classPrivateMethodInitSpec$1","_checkPrivateRedeclaration$1","_classPrivateMethodGet$1","VIEWPORT_POSITION_ATTR","VIEWPORT_POSITIONS","ViewportPositionMixin","_handleIntersectionChange","intersection","viewportPosition","bottom","getBoundingClientRect","isAbove","innerHeight","observedAttributes","_super$observedAttrib","viewportContainer","_document$scrollingEl","documentElement","viewportIntersectionRoot","isViewport","_navigator","_navigator$userAgent","_navigator$userAgent$","isIFrame","location","parent","isChrome","rootMargin","_classPrivateFieldGet3","unobserve","_classStaticPrivateFieldSpecSet","classConstructor","_classCheckPrivateStaticAccess","_classCheckPrivateStaticFieldDescriptor","action","_class","_getTargetElements","_boundAttributes","AttributeBindingMixinDef","boundAttributes","attribute","targets","sourceAttribute","targetAttribute","sourceAttributeName","targetAttributeName","attributeChangedCallback","oldValue","newValue","_super$attributeChang","configuration","targetElements","_getTargetElements2","removeAttribute","querySelectorAll","Animasjonsscroll","styles","defaultProgress","_this$reduceMotion","isVisible","child","_intersectionObserver","_classPrivateFieldLooseKey","_progressChanged","_checkSeek","ProsentvisVideo","_checkSeek2","_progressChanged2","_reducedMotion","_classPrivateFieldLooseBase","intersectionEntries","_intersectionEntries$","videos","video","_classPrivateFieldLoo","prevValue","videoElement","nodeName","find","val","hasAttribute","SYNTHETIC_DURATION","_isFullWidth","_updateSizes","_animateLayers","ProsentvisBilde","_animateLayers2","_updateSizes2","_isFullWidth2","animasjonsscroll","layers","_closest","_closest2","classList","contains","elm","layer","keyframeEffects","toKeyframeEffects","JSON","keyframeEffect","property","keyframes","keyframe","easing","rotate","scale","translate","composite","opacity","toKeyframe","jumpterm","x1","y1","x2","y2","toEasingString","KeyframeEffect","fill","MAX_CANVAS_AREA","CanvasManager","canvas","_canvas","updateImages","image","mask","_image","_mask","_updateCanvasWidth","updateDpr","canvasWidth","canvasHeight","dpr","effectiveDpr","sqrt","width","height","_context","getContext","willReadFrequently","clearRect","drawImage","_imageData","getImageData","_maskData","_drawData","_ready","updateMask","range","blackPoint","imageData","maskData","greyValue","putImageData","ProsentvisOvergang","images","complete","_currentCanvasWidth","naturalHeight","devicePixelRatio","_worker","createImageBitmap","postMessage","_manager","_updateMask","style","visibility","_animationFrame","_debouncedUpdateCanvasWidth","img","_prosentChanged","tag","__APP_NAME__","__APP_VERSION__","safeDefine","elementName","customElements","define","_entryObserver","_exitObserver","_tracker","_defineCustomElements","_createTracker","_startViewportLogger","_stopViewportLogger","AppElement","_stopViewportLogger2","_startViewportLogger2","_createTracker2","_defineCustomElements2","features","lottie","default","gltf","tracker","process","dataset","selfId","_entries$","schema","EventSchema","ViewportEvent","kind","ViewportEventKind","Entry","_entries$2","Exit","_classPrivateFieldLoo2"],"sourceRoot":""}