\");\r\n\r\n const selectedColors = getSelectedColors(colors, values);\r\n\r\n for (const color of selectedColors) {\r\n const itemGuid = guid.newGuid();\r\n const containerId = `color-selector-item-container-${itemGuid}`;\r\n const itemId = `color-selector-item-${itemGuid}`;\r\n\r\n htmlStringBuilder.push(`
`);\r\n htmlStringBuilder.push(`
`);\r\n htmlStringBuilder.push(\"
\");\r\n htmlStringBuilder.push(\"
\");\r\n\r\n // Keep track of the color elements that may have to be outlined\r\n // if they are too hard to see.\r\n selectorsToProcess.push(`#${itemId}`);\r\n }\r\n\r\n htmlStringBuilder.push(\"
\");\r\n\r\n this.processSelectors(selectorsToProcess);\r\n\r\n return htmlStringBuilder.join(\"\\n\");\r\n }\r\n\r\n public override getEditComponent(): Component {\r\n return editComponent;\r\n }\r\n\r\n public override getConfigurationComponent(): Component {\r\n return configurationComponent;\r\n }\r\n\r\n private processSelectors(selectorsToProcess: string[]): void {\r\n const maxAttempts = 5;\r\n let attemptCount = 0;\r\n\r\n function internalProcessSelectors(): void {\r\n if (!selectorsToProcess.length || attemptCount >= maxAttempts) {\r\n return;\r\n }\r\n\r\n nextTick(() => {\r\n attemptCount++;\r\n const failedSelectors: string[] = [];\r\n\r\n while (selectorsToProcess.length) {\r\n // Process the element at the front of the array.\r\n const selector = selectorsToProcess.shift();\r\n\r\n if (!selector) {\r\n // Skip to the next selector if this one is empty.\r\n continue;\r\n }\r\n\r\n const element = document.querySelector(selector);\r\n\r\n if (!element) {\r\n // Add the selector to the end array and skip to the next selector.\r\n failedSelectors.push(selector);\r\n }\r\n else {\r\n setCamouflagedClass(element);\r\n }\r\n }\r\n\r\n // Add the failed selectors back to the array.\r\n selectorsToProcess.push(...failedSelectors);\r\n\r\n if (selectorsToProcess.length) {\r\n internalProcessSelectors();\r\n }\r\n });\r\n }\r\n\r\n // Start processing selectors.\r\n internalProcessSelectors();\r\n }\r\n}\r\n","//