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,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAEpC,IAAK,EAAS,IAAM,EAAS,GAAG,KAAK,MAAM,YAAc,EAAW,MAAM,GAAG,KAAK,MAAM,UACvF,OAAI,EAAa,UAAY,EAAa,kBAAoB,EAAa,yBAA2B,EAAa,aAC3G,EAAiB,GAAc,KAAK,GAAqB,KAAK,EAAK,WAAW,KAAK,IAEpF,EAAe,GAAqB,KAAK,GAAqB,KAAK,EAAK,WAAW,KAAK,IAKjG,OAAO,EAAW,MACnB,GAEF,GACD,CACD,EAEA,OAAO,QAAQ,QAAU","file":"/npm/less-openui5@0.11.6/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/less-openui5@0.11.6/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nconst path = require(\"path\");\nconst css = require(\"@adobe/css-tools\");\n\n\nconst diff = require(\"./diff\");\nconst scope = require(\"./scope\");\n\nconst fileUtilsFactory = require(\"./fileUtils\");\n\nconst Compiler = require(\"./Compiler\");\n\nconst themingParametersDataUri = require(\"./themingParameters/dataUri\");\n\n// Workaround for a performance issue in the \"css\" parser module when used in combination\n// with the \"colors\" module that enhances the String prototype.\n// See: https://github.com/reworkcss/css/issues/88\n//\n// This function removes all properties added by \"colors\" and returns a function\n// that restores them  afterwards.\n// To be used before/after calling \"css.parse\"\nfunction cleanupStringPrototype() {\n\tconst customGetters = {}; const customProps = {}; const s = \"\"; let key;\n\n\tfor (key in s) {\n\t\tif (!Object.prototype.hasOwnProperty.call(s, key)) {\n\t\t\tconst getter = String.prototype.__lookupGetter__(key);\n\t\t\tif (typeof getter === \"function\") {\n\t\t\t\tcustomGetters[key] = getter;\n\t\t\t} else {\n\t\t\t\tcustomProps[key] = String.prototype[key];\n\t\t\t}\n\t\t\tif (typeof Reflect !== \"undefined\") {\n\t\t\t\tReflect.deleteProperty(String.prototype, key);\n\t\t\t} else {\n\t\t\t\tdelete String.prototype[key];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn function restore() {\n\t\tfor (key in customGetters) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(customGetters, key)) {\n\t\t\t\tString.prototype.__defineGetter__(key, customGetters[key]);\n\t\t\t}\n\t\t}\n\t\tfor (key in customProps) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(customProps, key)) {\n\t\t\t\t// eslint-disable-next-line no-extend-native\n\t\t\t\tString.prototype[key] = customProps[key];\n\t\t\t}\n\t\t}\n\t};\n}\n\nfunction dotThemingFileToPath(s) {\n\tif (s.indexOf(\".\") > -1) {\n\t\ts = \"../\" + s.replace(/\\./g, \"/\");\n\t}\n\n\treturn s;\n}\n\nconst Builder = function(options) {\n\tthis.themeCacheMapping = {};\n\tthis.customFs = options ? options.fs : null;\n\tthis.fileUtils = fileUtilsFactory(this.customFs);\n};\n\nBuilder.prototype.getThemeCache = function(rootPath) {\n\treturn this.themeCacheMapping[rootPath];\n};\n\nBuilder.prototype.setThemeCache = function(rootPath, cache) {\n\treturn this.themeCacheMapping[rootPath] = cache;\n};\n\nBuilder.prototype.clearCache = function() {\n\tthis.themeCacheMapping = {};\n};\n\nBuilder.prototype.cacheTheme = function(result) {\n\tconst that = this;\n\n\t// Theme can only be cached if list of imports is available\n\tif (result.imports.length === 0) {\n\t\treturn Promise.resolve(result);\n\t}\n\n\t// Rootpath of theme is always the first entry\n\tconst rootpath = result.imports[0];\n\n\treturn that.fileUtils.statFiles(result.imports).then(function(stats) {\n\t\tthat.setThemeCache(rootpath, {\n\t\t\tresult: result,\n\t\t\tstats: stats\n\t\t});\n\n\t\treturn result;\n\t});\n};\n\n/**\n * Runs a theme build\n * @param {object} options\n * @param {object} options.compiler compiler object as passed to less\n * @param {boolean} options.cssVariables whether or not to enable css variables output\n * @param {string} options.lessInput less string input\n * @param {string} options.lessInputPath less file input\n * @returns {{css: string, cssRtl: string, variables: {}, imports: [], cssSkeleton: string, cssSkeletonRtl: string, cssVariables: string, cssVariablesSource: string }}\n */\nBuilder.prototype.build = function(options) {\n\tconst that = this;\n\n\t// Assign default options\n\toptions = Object.assign({\n\t\tlessInput: null,\n\t\tlessInputPath: null,\n\t\trtl: true,\n\t\trootPaths: [],\n\t\tparser: {},\n\t\tcompiler: {},\n\t\tlibrary: {},\n\t\tscope: {}\n\t}, options);\n\n\tif (options.compiler.sourceMap) {\n\t\treturn Promise.reject(new Error(\"compiler.sourceMap option is not supported!\"));\n\t}\n\tif (options.compiler.cleancss) {\n\t\treturn Promise.reject(new Error(\"compiler.cleancss option is not supported! Please use 'clean-css' directly.\"));\n\t}\n\n\t// Set default of \"relativeUrls\" parser option to \"true\" (less default is \"false\")\n\tif (!Object.prototype.hasOwnProperty.call(options.parser, \"relativeUrls\")) {\n\t\toptions.parser.relativeUrls = true;\n\t}\n\n\tconst compiler = new Compiler({\n\t\toptions,\n\t\tfileUtils: this.fileUtils,\n\t\tcustomFs: this.customFs\n\t});\n\n\tfunction addInlineParameters(result) {\n\t\treturn themingParametersDataUri.addInlineParameters({result, options});\n\t}\n\n\tfunction getScopeVariables(options) {\n\t\tconst sScopeName = options.scopeName;\n\t\tconst oVariablesBase = options.baseVariables;\n\t\tconst oVariablesEmbedded = options.embeddedVariables;\n\t\tconst oVariablesDiff = {};\n\n\t\tfor (const sKey in oVariablesEmbedded) {\n\t\t\tif (sKey in oVariablesBase) {\n\t\t\t\tif (oVariablesBase[sKey] != oVariablesEmbedded[sKey]) {\n\t\t\t\t\toVariablesDiff[sKey] = oVariablesEmbedded[sKey];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Merge variables\n\t\tconst oVariables = {};\n\t\toVariables[\"default\"] = oVariablesBase;\n\t\toVariables[\"scopes\"] = {};\n\t\toVariables[\"scopes\"][sScopeName] = oVariablesDiff;\n\n\t\treturn oVariables;\n\t}\n\n\tfunction compileWithScope(scopeOptions) {\n\t\t// 1. Compile base + embedded files (both default + RTL variants)\n\t\treturn Promise.all([\n\t\t\tthat.fileUtils.readFile(scopeOptions.embeddedCompareFilePath, options.rootPaths).then(function(config) {\n\t\t\t\tif (!config) {\n\t\t\t\t\tthrow new Error(\"Could not find embeddedCompareFile at path '\" + scopeOptions.embeddedCompareFilePath + \"'\");\n\t\t\t\t}\n\t\t\t\treturn compiler.compile(config);\n\t\t\t}),\n\t\t\tthat.fileUtils.readFile(scopeOptions.embeddedFilePath, options.rootPaths).then(function(config) {\n\t\t\t\tif (!config) {\n\t\t\t\t\tthrow new Error(\"Could not find embeddedFile at path '\" + scopeOptions.embeddedFilePath + \"'\");\n\t\t\t\t}\n\t\t\t\treturn compiler.compile(config);\n\t\t\t})\n\t\t]).then(function(results) {\n\t\t\treturn {\n\t\t\t\tembeddedCompare: results[0],\n\t\t\t\tembedded: results[1]\n\t\t\t};\n\t\t}).then(function(results) {\n\t\t\tconst sScopeName = scopeOptions.selector;\n\n\t\t\tfunction applyScope(embeddedCompareCss, embeddedCss, bRtl) {\n\t\t\t\tconst restoreStringPrototype = cleanupStringPrototype();\n\n\t\t\t\t// Create diff object between embeddedCompare and embedded\n\t\t\t\tconst oBase = css.parse(embeddedCompareCss);\n\t\t\t\tconst oEmbedded = css.parse(embeddedCss);\n\n\t\t\t\trestoreStringPrototype();\n\n\t\t\t\tconst oDiff = diff(oBase, oEmbedded);\n\n\t\t\t\t// Create scope\n\t\t\t\tconst sScopeSelector = \".\" + sScopeName;\n\t\t\t\tconst oScope = scope(oDiff.diff, sScopeSelector);\n\n\t\t\t\tlet oCssScopeRoot;\n\n\t\t\t\tif (oDiff.stack) {\n\t\t\t\t\toCssScopeRoot = scope.scopeCssRoot(oDiff.stack.stylesheet.rules, sScopeName);\n\n\t\t\t\t\tif (oCssScopeRoot) {\n\t\t\t\t\t\toScope.stylesheet.rules.unshift(oCssScopeRoot);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Append scope + stack to embeddedCompareFile (actually target file, which is currently always the same i.e. \"library.css\")\n\t\t\t\t// The stack gets appended to the embeddedFile only\n\t\t\t\tlet sAppend = css.stringify(oScope, {\n\t\t\t\t\tcompress: options.compiler && options.compiler.compress === true\n\t\t\t\t});\n\n\t\t\t\tif (scopeOptions.baseFilePath !== options.lessInputPath && oDiff.stack && oDiff.stack.stylesheet.rules.length > 0) {\n\t\t\t\t\tsAppend += \"\\n\" + css.stringify(oDiff.stack, {\n\t\t\t\t\t\tcompress: options.compiler && options.compiler.compress === true\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn sAppend + \"\\n\";\n\t\t\t}\n\n\t\t\tresults.embeddedCompare.css += applyScope(results.embeddedCompare.css, results.embedded.css);\n\t\t\tif (options.rtl) {\n\t\t\t\tresults.embeddedCompare.cssRtl += applyScope(results.embeddedCompare.cssRtl, results.embedded.cssRtl, true);\n\t\t\t}\n\n\t\t\tif (options.cssVariables) {\n\t\t\t\tresults.embeddedCompare.cssVariables += applyScope(results.embeddedCompare.cssVariables, results.embedded.cssVariables);\n\t\t\t\tresults.embeddedCompare.cssSkeleton += applyScope(results.embeddedCompare.cssSkeleton, results.embedded.cssSkeleton);\n\t\t\t\tif (options.rtl) {\n\t\t\t\t\tresults.embeddedCompare.cssSkeletonRtl += applyScope(results.embeddedCompare.cssSkeletonRtl, results.embedded.cssSkeletonRtl, true);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Create diff between embeddedCompare and embeded variables\n\t\t\tresults.embeddedCompare.variables = getScopeVariables({\n\t\t\t\tbaseVariables: results.embeddedCompare.variables,\n\t\t\t\tembeddedVariables: results.embedded.variables,\n\t\t\t\tscopeName: sScopeName\n\t\t\t});\n\t\t\tresults.embeddedCompare.allVariables = getScopeVariables({\n\t\t\t\tbaseVariables: results.embeddedCompare.allVariables,\n\t\t\t\tembeddedVariables: results.embedded.allVariables,\n\t\t\t\tscopeName: sScopeName\n\t\t\t});\n\n\t\t\tconst concatImports = function(aImportsBase, aImportsEmbedded) {\n\t\t\t\tconst aConcats = aImportsBase.concat(aImportsEmbedded);\n\n\t\t\t\treturn aConcats.filter(function(sImport, sIndex) {\n\t\t\t\t\treturn aConcats.indexOf(sImport) == sIndex;\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (scopeOptions.baseFilePath !== options.lessInputPath) {\n\t\t\t\tresults.embeddedCompare.imports = concatImports(results.embedded.imports, results.embeddedCompare.imports);\n\t\t\t} else {\n\t\t\t\tresults.embeddedCompare.imports = concatImports(results.embeddedCompare.imports, results.embedded.imports);\n\t\t\t}\n\n\t\t\t// 6. Resolve promise with complete result object (css, cssRtl, variables, imports)\n\t\t\treturn results.embeddedCompare;\n\t\t});\n\t}\n\n\n\tfunction readDotTheming(dotThemingInputPath) {\n\t\treturn that.fileUtils.readFile(dotThemingInputPath, options.rootPaths).then(function(result) {\n\t\t\tlet dotTheming;\n\t\t\tlet dotThemingFilePath;\n\n\t\t\tif (result) {\n\t\t\t\tdotTheming = JSON.parse(result.content);\n\t\t\t\tdotThemingFilePath = result.path;\n\t\t\t}\n\n\t\t\tif (dotTheming && dotTheming.mCssScopes) {\n\t\t\t\t// Currently only the \"library\" target is supported\n\t\t\t\tconst cssScope = dotTheming.mCssScopes[\"library\"];\n\n\t\t\t\tif (cssScope) {\n\t\t\t\t\tconst aScopes = cssScope.aScopes;\n\t\t\t\t\tconst oScopeConfig = aScopes[0]; // Currenlty only one scope is supported\n\n\t\t\t\t\tconst sBaseFile = dotThemingFileToPath(cssScope.sBaseFile);\n\t\t\t\t\tconst sEmbeddedCompareFile = dotThemingFileToPath(oScopeConfig.sEmbeddedCompareFile);\n\t\t\t\t\tconst sEmbeddedFile = dotThemingFileToPath(oScopeConfig.sEmbeddedFile);\n\n\t\t\t\t\t// Currently, only support the use case when \"sBaseFile\" equals \"sEmbeddedCompareFile\"\n\t\t\t\t\tif (sBaseFile !== sEmbeddedCompareFile) {\n\t\t\t\t\t\tthrow new Error(\"Unsupported content in \\\"\" + dotThemingInputPath + \"\\\": \" +\n\t\t\t\t\t\t\t\"\\\"sBaseFile\\\" (\\\"\" + cssScope.sBaseFile + \"\\\") must be identical with \" +\n\t\t\t\t\t\t\t\"\\\"sEmbeddedCompareFile\\\" (\\\"\" + oScopeConfig.sEmbeddedCompareFile + \"\\\")\");\n\t\t\t\t\t}\n\n\t\t\t\t\tconst baseFilePath = path.posix.join(themeDir, sBaseFile) + \".source.less\";\n\t\t\t\t\tconst embeddedCompareFilePath = path.posix.join(themeDir, sEmbeddedCompareFile) + \".source.less\";\n\t\t\t\t\tconst embeddedFilePath = path.posix.join(themeDir, sEmbeddedFile) + \".source.less\";\n\n\t\t\t\t\t// 1. Compile base + embedded files (both default + RTL variants)\n\t\t\t\t\treturn compileWithScope({\n\t\t\t\t\t\tselector: oScopeConfig.sSelector,\n\t\t\t\t\t\tembeddedFilePath: embeddedFilePath,\n\t\t\t\t\t\tembeddedCompareFilePath: embeddedCompareFilePath,\n\t\t\t\t\t\tbaseFilePath: baseFilePath\n\t\t\t\t\t}).then(function(embeddedCompare) {\n\t\t\t\t\t\tembeddedCompare.imports.push(dotThemingFilePath);\n\t\t\t\t\t\treturn embeddedCompare;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// No css diffing and scoping\n\t\t\treturn that.fileUtils.readFile(options.lessInputPath, options.rootPaths).then((config) => {\n\t\t\t\treturn compiler.compile(config);\n\t\t\t});\n\t\t});\n\t}\n\n\tif (options.lessInput && options.lessInputPath) {\n\t\treturn Promise.reject(new Error(\"Please only provide either `lessInput` or `lessInputPath` but not both.\"));\n\t}\n\n\tif (!options.lessInput && !options.lessInputPath) {\n\t\treturn Promise.reject(new Error(\"Missing required option. Please provide either `lessInput` or `lessInputPath`.\"));\n\t}\n\n\tif (options.lessInput) {\n\t\treturn compiler.compile({\n\t\t\tcontent: options.lessInput\n\t\t}).then(addInlineParameters).then(that.cacheTheme.bind(that));\n\t} else {\n\t\t// TODO: refactor\n\t\t// eslint-disable-next-line no-var\n\t\tvar themeDir = path.posix.dirname(options.lessInputPath);\n\n\t\t// Always use the sap/ui/core library to lookup .theming files\n\t\tlet coreThemeDir;\n\n\t\tif (options.library && typeof options.library.name === \"string\") {\n\t\t\tconst libraryNamespace = options.library.name.replace(/\\./g, \"/\");\n\t\t\tcoreThemeDir = themeDir.replace(libraryNamespace, \"sap/ui/core\");\n\t\t} else {\n\t\t\tcoreThemeDir = themeDir.replace(/^.*\\/themes\\//, \"/sap/ui/core/themes/\");\n\t\t}\n\n\t\tconst dotThemingInputPath = path.posix.join(coreThemeDir, \".theming\");\n\n\t\treturn that.fileUtils.findFile(options.lessInputPath, options.rootPaths).then(function(fileInfo) {\n\t\t\tif (!fileInfo) {\n\t\t\t\tthrow new Error(\"`lessInputPath` \" + options.lessInputPath + \" could not be found.\");\n\t\t\t}\n\n\t\t\t// check theme has been already cached\n\t\t\tlet themeCache;\n\t\t\tif (fileInfo.path) {\n\t\t\t\tthemeCache = that.getThemeCache(fileInfo.path);\n\t\t\t}\n\n\t\t\tconst scopeOptions = options.scope;\n\n\t\t\t// Compile theme if not cached or RTL is requested and missing in cache\n\t\t\tif (!themeCache || (options.rtl && !themeCache.result.cssRtl)) {\n\t\t\t\tif (scopeOptions.selector && scopeOptions.embeddedFilePath && scopeOptions.embeddedCompareFilePath && scopeOptions.baseFilePath) {\n\t\t\t\t\treturn compileWithScope(scopeOptions).then(addInlineParameters).then(that.cacheTheme.bind(that));\n\t\t\t\t}\n\t\t\t\treturn readDotTheming(dotThemingInputPath).then(addInlineParameters).then(that.cacheTheme.bind(that));\n\t\t\t} else {\n\t\t\t\treturn that.fileUtils.statFiles(themeCache.result.imports).then(function(newStats) {\n\t\t\t\t\tfor (let i = 0; i < newStats.length; i++) {\n\t\t\t\t\t\t// check if .theming and less files have changed since last less compilation\n\t\t\t\t\t\tif (!newStats[i] || newStats[i].stat.mtime.getTime() !== themeCache.stats[i].stat.mtime.getTime()) {\n\t\t\t\t\t\t\tif (scopeOptions.selector && scopeOptions.embeddedFilePath && scopeOptions.embeddedCompareFilePath && scopeOptions.baseFilePath) {\n\t\t\t\t\t\t\t\treturn compileWithScope(scopeOptions).then(addInlineParameters).then(that.cacheTheme.bind(that));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn readDotTheming(dotThemingInputPath).then(addInlineParameters).then(that.cacheTheme.bind(that));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// serve from cache\n\t\t\t\t\treturn themeCache.result;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nmodule.exports.Builder = Builder;\n"]}