"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.snipScriptAndStyleTagContent = snipScriptAndStyleTagContent; var snippedTagContentAttribute = '✂prettier:content✂'; var scriptRegex = /|'"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>([^]*?)<\/script>/g; var styleRegex = /|'"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>([^]*?)<\/style>/g; var langTsRegex = /\slang=["']?ts["']?/; var stringToBase64 = typeof Buffer !== 'undefined' ? function (str) { return Buffer.from(str).toString('base64'); } : function (str) { return btoa(new TextEncoder() .encode(str) .reduce(function (acc, byte) { return acc + String.fromCharCode(byte); }, '')); }; function snipScriptAndStyleTagContent(source) { var scriptMatchSpans = getMatchIndexes('script'); var styleMatchSpans = getMatchIndexes('style'); var isTypescript = false; var text = snipTagContent(snipTagContent(source, 'script', '{}', styleMatchSpans), 'style', '', scriptMatchSpans); return { text: text, isTypescript: isTypescript }; function getMatchIndexes(tagName) { var regex = getRegexp(tagName); var indexes = []; var match = null; while ((match = regex.exec(source)) != null) { if (source.slice(match.index, match.index + 4) !== '