@symbo.ls/connect 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/build.js +205 -0
  2. package/dist/assets/1024x1024.png +0 -0
  3. package/dist/assets/128x128.png +0 -0
  4. package/dist/assets/144x144.png +0 -0
  5. package/dist/assets/192x192.png +0 -0
  6. package/dist/assets/48x48.png +0 -0
  7. package/dist/assets/512x512.png +0 -0
  8. package/dist/assets/72x72.png +0 -0
  9. package/dist/assets/96x96.png +0 -0
  10. package/dist/assets/active_cursor.png +0 -0
  11. package/dist/assets/favicon.svg +6 -0
  12. package/dist/assets/old/144x144.png +0 -0
  13. package/dist/assets/old/192x192.png +0 -0
  14. package/dist/assets/old/48x48.png +0 -0
  15. package/dist/assets/old/48x48_faint.png +0 -0
  16. package/dist/assets/old/512x512.png +0 -0
  17. package/dist/assets/old/72x72.png +0 -0
  18. package/dist/assets/old/96x96.png +0 -0
  19. package/dist/auth.js +373 -0
  20. package/dist/content.css +46 -0
  21. package/dist/content.js +1171 -0
  22. package/dist/content.js.map +7 -0
  23. package/dist/devtools.html +7 -0
  24. package/dist/devtools.js +5 -0
  25. package/dist/manifest.json +87 -0
  26. package/dist/page-agent.js +727 -0
  27. package/dist/panel.css +2239 -0
  28. package/dist/panel.html +235 -0
  29. package/dist/panel.js +4973 -0
  30. package/dist/picker.html +111 -0
  31. package/dist/picker.js +300 -0
  32. package/dist/service_worker.js +219 -0
  33. package/dist/service_worker.js.map +7 -0
  34. package/dist/settings.css +128 -0
  35. package/dist/settings.html +26 -0
  36. package/dist/settings_ui.js +57 -0
  37. package/dist/settings_ui.js.map +7 -0
  38. package/package.json +20 -0
  39. package/src/content.js +104 -0
  40. package/src/grabber/clean.js +605 -0
  41. package/src/grabber/computed.js +78 -0
  42. package/src/grabber/parse.js +268 -0
  43. package/src/grabber/stylesheets.js +117 -0
  44. package/src/grabber/utils.js +238 -0
  45. package/src/service_worker.js +246 -0
  46. package/src/settings/settings_ui.js +52 -0
  47. package/src/settings/settings_utils.js +70 -0
  48. package/static/assets/1024x1024.png +0 -0
  49. package/static/assets/128x128.png +0 -0
  50. package/static/assets/144x144.png +0 -0
  51. package/static/assets/192x192.png +0 -0
  52. package/static/assets/48x48.png +0 -0
  53. package/static/assets/512x512.png +0 -0
  54. package/static/assets/72x72.png +0 -0
  55. package/static/assets/96x96.png +0 -0
  56. package/static/assets/active_cursor.png +0 -0
  57. package/static/assets/favicon.svg +6 -0
  58. package/static/assets/old/144x144.png +0 -0
  59. package/static/assets/old/192x192.png +0 -0
  60. package/static/assets/old/48x48.png +0 -0
  61. package/static/assets/old/48x48_faint.png +0 -0
  62. package/static/assets/old/512x512.png +0 -0
  63. package/static/assets/old/72x72.png +0 -0
  64. package/static/assets/old/96x96.png +0 -0
  65. package/static/auth.js +373 -0
  66. package/static/content.css +46 -0
  67. package/static/devtools.html +7 -0
  68. package/static/devtools.js +5 -0
  69. package/static/manifest.json +56 -0
  70. package/static/page-agent.js +727 -0
  71. package/static/panel.css +2239 -0
  72. package/static/panel.html +235 -0
  73. package/static/panel.js +4973 -0
  74. package/static/picker.html +111 -0
  75. package/static/picker.js +300 -0
  76. package/static/settings.css +128 -0
  77. package/static/settings.html +26 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../node_modules/@domql/utils/globals.js", "../node_modules/@domql/utils/node.js", "../node_modules/@domql/utils/types.js", "../node_modules/@domql/utils/array.js", "../node_modules/@domql/utils/object.js", "../node_modules/@domql/utils/cookie.js", "../src/grabber/utils.js", "../src/grabber/clean.js", "../src/grabber/computed.js", "../src/settings/settings_utils.js", "../src/grabber/stylesheets.js", "../src/grabber/parse.js", "../src/content.js"],
4
+ "sourcesContent": ["'use strict'\n\nconst global = globalThis\nconst self = globalThis\nconst window = globalThis\nconst document = (this || window).document // eslint-disable-line\n\nexport { global, self, window, document }\n", "'use strict'\n\nimport { window } from './globals.js'\n\nexport const isNode = obj => {\n return (\n (typeof Node === 'object'\n ? obj instanceof window.Node\n : obj &&\n typeof obj === 'object' &&\n typeof obj.nodeType === 'number' &&\n typeof obj.nodeName === 'string') || false\n )\n}\n\n// Returns true if it is a DOM element\nexport const isHtmlElement = obj => {\n return (\n (typeof HTMLElement === 'object'\n ? obj instanceof window.HTMLElement // DOM2\n : obj &&\n typeof obj === 'object' &&\n obj !== null &&\n obj.nodeType === 1 &&\n typeof obj.nodeName === 'string') || false\n )\n}\n\nexport const isDOMNode = obj => {\n return (\n typeof window !== 'undefined' &&\n (obj instanceof window.Node ||\n obj instanceof window.Window ||\n obj === window ||\n obj === document)\n )\n}\n", "'use strict'\n\nimport { isHtmlElement, isNode } from './node.js'\n\nexport const isObject = arg => {\n if (arg === null) return false\n return typeof arg === 'object' && arg.constructor === Object\n}\n\nexport const isString = arg => typeof arg === 'string'\n\nexport const isNumber = arg => typeof arg === 'number'\n\nexport const isFunction = arg => typeof arg === 'function'\n\nexport const isBoolean = arg => arg === true || arg === false\n\nexport const isNull = arg => arg === null\n\nexport const isArray = arg => Array.isArray(arg)\n\nexport const isDate = d => d instanceof Date\n\nexport const isObjectLike = arg => {\n if (arg === null) return false\n // if (isArray(arg)) return false\n return typeof arg === 'object'\n}\n\nexport const isDefined = arg => {\n return (\n isObject(arg) ||\n isObjectLike(arg) ||\n isString(arg) ||\n isNumber(arg) ||\n isFunction(arg) ||\n isArray(arg) ||\n isObjectLike(arg) ||\n isBoolean(arg) ||\n isDate(arg) ||\n isNull(arg)\n )\n}\n\nexport const isUndefined = arg => {\n return arg === undefined\n}\n\nexport const TYPES = {\n boolean: isBoolean,\n array: isArray,\n object: isObject,\n string: isString,\n date: isDate,\n number: isNumber,\n null: isNull,\n function: isFunction,\n objectLike: isObjectLike,\n node: isNode,\n htmlElement: isHtmlElement,\n defined: isDefined\n}\n\nexport const is = arg => {\n return (...args) => {\n return args.map(val => TYPES[val](arg)).filter(v => v).length > 0\n }\n}\n\nexport const isNot = arg => {\n return (...args) => {\n return args.map(val => TYPES[val](arg)).filter(v => v).length === 0\n }\n}\n", "'use strict'\n\nimport { deepClone, deepMerge } from './object.js'\nimport { isArray, isNumber, isString } from './types.js'\n\nexport const arrayContainsOtherArray = (arr1, arr2) => {\n return arr2.every(val => arr1.includes(val))\n}\n\nexport const getFrequencyInArray = (arr, value) => {\n return arr.reduce((count, currentValue) => {\n return currentValue === value ? count + 1 : count\n }, 0)\n}\n\nexport const removeFromArray = (arr, index) => {\n if (isString(index)) index = parseInt(index)\n if (isNumber(index)) {\n if (index < 0 || index >= arr.length || isNaN(index)) {\n throw new Error('Invalid index')\n }\n arr.splice(index, 1)\n } else if (isArray(index)) {\n index.forEach(idx => removeFromArray(arr, idx))\n } else {\n throw new Error('Invalid index')\n }\n return arr\n}\n\nexport const swapItemsInArray = (arr, i, j) => {\n ;[arr[i], arr[j]] = [arr[j], arr[i]]\n}\n\nexport const joinArrays = (...arrays) => {\n return [].concat(...arrays)\n}\n\n/**\n * Merges array extendtypes\n */\nexport const mergeArray = (arr, exclude = []) => {\n return arr.reduce(\n (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),\n {}\n )\n}\n\n/**\n * Merges array extends\n */\nexport const mergeAndCloneIfArray = obj => {\n return isArray(obj) ? mergeArray(obj) : deepClone(obj)\n}\n\nexport const cutArrayBeforeValue = (arr, value) => {\n const index = arr.indexOf(value)\n if (index !== -1) {\n return arr.slice(0, index)\n }\n return arr\n}\n\nexport const cutArrayAfterValue = (arr, value) => {\n if (!isArray(arr)) return\n const index = arr.indexOf(value)\n if (index !== -1) {\n return arr.slice(index + 1)\n }\n return arr\n}\n\nexport const removeValueFromArray = (arr, value) => {\n const index = arr.indexOf(value)\n if (index > -1) {\n const newArray = [...arr]\n newArray.splice(index, 1)\n return newArray\n }\n return arr\n}\n\nexport const removeValueFromArrayAll = (arr, value) => {\n return arr.filter(item => item !== value)\n}\n\nexport const addItemAfterEveryElement = (array, item) => {\n // Create a new array to hold the result\n const result = []\n\n // Loop through the input array\n for (let i = 0; i < array.length; i++) {\n // Add the current element to the result array\n result.push(array[i])\n\n // If it's not the last element, add the item\n if (i < array.length - 1) {\n result.push(item)\n }\n }\n\n return result\n}\n\nexport const reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {\n const newArray = [...array] // Create a copy of the original array\n const indexToMove = newArray.indexOf(valueToMove) // Find the index of the value to move\n const indexToInsertBefore = newArray.indexOf(insertBeforeValue) // Find the index to insert before\n if (indexToMove !== -1 && indexToInsertBefore !== -1) {\n const removedItem = newArray.splice(indexToMove, 1)[0] // Remove the item to move\n const insertIndex =\n indexToInsertBefore < indexToMove\n ? indexToInsertBefore\n : indexToInsertBefore + 1 // Adjust insert index\n newArray.splice(insertIndex, 0, removedItem) // Insert the removed item before the specified value\n }\n return newArray\n}\n\nexport const arraysEqual = (arr1, arr2) => {\n if (arr1.length !== arr2.length) {\n return false\n }\n\n for (let i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) {\n return false\n }\n }\n\n return true\n}\n\n// Using filter and includes\nexport const filterArrays = (sourceArr, excludeArr) => {\n return sourceArr.filter(item => !excludeArr.includes(item))\n}\n\n// Using Set for better performance with large arrays\nexport const filterArraysFast = (sourceArr, excludeArr) => {\n const excludeSet = new Set(excludeArr)\n return sourceArr.filter(item => !excludeSet.has(item))\n}\n\nexport const checkIfStringIsInArray = (string, arr) => {\n if (!string) return\n return arr.filter(v => string.includes(v)).length\n}\n", "'use strict'\n\nimport { window } from './globals.js'\nimport {\n isFunction,\n isObjectLike,\n isObject,\n isArray,\n isString,\n is,\n isUndefined,\n isDate,\n isNull\n} from './types.js'\nimport { mergeAndCloneIfArray, mergeArray } from './array.js'\nimport { stringIncludesAny } from './string.js'\nimport { isDOMNode } from './node.js'\nimport { isNotProduction } from './env.js'\n\n/**\n * Executes a function with the specified context and parameters.\n * Handles both synchronous and asynchronous functions.\n *\n * - When called in an async context (with await), it fully resolves promises\n * - When called in a sync context, it returns sync results directly and handles promises appropriately\n *\n * @param {Function|any} param - The function to execute or value to return\n * @param {Object} element - The element to use as 'this' context\n * @param {Object} state - The state to pass to the function\n * @param {Object} context - The context to pass to the function\n * @returns {any|Promise} - The result or a Promise to the result\n */\nexport function exec(param, element, state, context, opts = {}) {\n if (!element) element = this\n if (isFunction(param)) {\n try {\n // Call the function with the specified context and parameters\n const result = param.call(\n element,\n element,\n state || element.state,\n context || element.context\n )\n\n // Handle promises\n if (result && typeof result.then === 'function') {\n // This magic allows the function to be awaited if called with await\n // but still work reasonably when called without await\n return result\n }\n return result\n } catch (e) {\n element.log(param)\n element.warn('Error executing function', e, opts)\n }\n }\n return param\n}\n\nexport const map = (obj, extention, element) => {\n for (const e in extention) {\n obj[e] = exec(extention[e], element)\n }\n}\n\nexport const merge = (element, obj, excludeFrom = []) => {\n for (const e in obj) {\n const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e)\n if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith('__'))\n continue\n const elementProp = element[e]\n const objProp = obj[e]\n if (elementProp === undefined) {\n element[e] = objProp\n }\n }\n return element\n}\n\nexport const deepMerge = (\n element,\n extend,\n excludeFrom = [],\n level = Infinity\n) => {\n for (const e in extend) {\n const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e)\n if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith('__'))\n continue\n const elementProp = element[e]\n const extendProp = extend[e]\n if (isObjectLike(elementProp) && isObjectLike(extendProp)) {\n // shallow merge when deepness level is reached\n if (level > 0) {\n deepMerge(elementProp, extendProp, excludeFrom, level - 1)\n } else {\n for (const k in extendProp) {\n if (excludeFrom.includes(k) || elementProp[k] !== undefined) continue\n elementProp[k] = extendProp[k]\n }\n }\n } else if (elementProp === undefined) {\n element[e] = extendProp\n }\n }\n return element\n}\n\nexport const clone = (obj, excludeFrom = []) => {\n const o = {}\n for (const prop in obj) {\n const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, prop)\n if (!hasOwnProperty || excludeFrom.includes(prop) || prop.startsWith('__'))\n continue\n o[prop] = obj[prop]\n }\n return o\n}\n\n// Merge array, but exclude keys listed in 'excl'z\nexport const mergeArrayExclude = (arr, exclude = []) => {\n return arr.reduce(\n (acc, curr) => deepMerge(acc, deepClone(curr, { exclude })),\n {}\n )\n}\n/**\n * Enhanced deep clone function that combines features from multiple implementations\n * @param {any} obj - Object to clone\n * @param {Object} options - Configuration options\n * @param {string[]} options.exclude - Properties to exclude from cloning\n * @param {boolean} options.cleanUndefined - Remove undefined values\n * @param {boolean} options.cleanNull - Remove null values\n * @param {Window} options.window - Window object for cross-frame cloning\n * @param {WeakMap} options.visited - WeakMap for tracking circular references\n * @param {boolean} options.handleExtend - Whether to handle 'extend' arrays specially\n * @returns {any} Cloned object\n */\nexport const deepClone = (obj, options = {}) => {\n const {\n exclude = [],\n cleanUndefined = false,\n cleanNull = false,\n window: targetWindow,\n visited = new WeakMap(),\n handleExtend = false\n } = options\n\n const contentWindow = targetWindow || window || globalThis\n\n // Handle non-object types and special cases\n if (!isObjectLike(obj) || isDOMNode(obj)) {\n return obj\n }\n\n // Handle circular references\n if (visited.has(obj)) {\n return visited.get(obj)\n }\n\n // Create appropriate container based on type and window context\n const clone = contentWindow\n ? isArray(obj)\n ? new contentWindow.Array()\n : new contentWindow.Object()\n : isArray(obj)\n ? []\n : {}\n\n // Store the clone to handle circular references\n visited.set(obj, clone)\n\n // Clone properties\n for (const key in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue\n\n // Skip excluded properties\n if (exclude.includes(key) || key.startsWith('__') || key === '__proto__')\n continue\n\n let value = obj[key]\n\n // Skip based on cleanup options\n if ((cleanUndefined && isUndefined(value)) || (cleanNull && isNull(value)))\n continue\n\n // Handle special cases\n if (isDOMNode(value)) {\n clone[key] = value\n continue\n }\n\n // Handle 'extend' array if enabled\n if (handleExtend && key === 'extend' && isArray(value)) {\n clone[key] = mergeArray(value, exclude)\n continue\n }\n\n // Handle functions in cross-frame scenario\n if (isFunction(value) && options.window) {\n clone[key] = contentWindow.eval('(' + value.toString() + ')')\n continue\n }\n\n // Handle special cases\n if (value?.__ref && value?.node) {\n value = value.parseDeep()\n }\n\n if (value?.__element) {\n value = value.parse()\n }\n\n // Recursively clone objects\n if (isObjectLike(value)) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue\n\n clone[key] = deepClone(value, {\n ...options,\n visited\n })\n } else {\n clone[key] = value\n }\n }\n\n return clone\n}\n\n/**\n * Stringify object\n */\nexport const deepStringifyFunctions = (obj, stringified = {}) => {\n if (!obj) return\n if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {\n ;(obj.__element || obj.parent?.__element).warn(\n 'Trying to clone element or state at',\n obj\n )\n obj = obj.parse?.()\n }\n\n for (const prop in obj) {\n const objProp = obj[prop]\n if (isFunction(objProp)) {\n stringified[prop] = objProp.toString()\n } else if (isObject(objProp)) {\n stringified[prop] = {}\n deepStringifyFunctions(objProp, stringified[prop])\n } else if (isArray(objProp)) {\n stringified[prop] = []\n objProp.forEach((v, i) => {\n if (isObject(v)) {\n stringified[prop][i] = {}\n deepStringifyFunctions(v, stringified[prop][i])\n } else if (isFunction(v)) {\n stringified[prop][i] = v.toString()\n } else {\n stringified[prop][i] = v\n }\n })\n } else {\n stringified[prop] = objProp\n }\n }\n\n return stringified\n}\n\nconst MAX_DEPTH = 100 // Adjust this value as needed\nexport const deepStringifyFunctionsWithMaxDepth = (\n obj,\n stringified = {},\n depth = 0,\n path = ''\n) => {\n if (depth > MAX_DEPTH) {\n console.warn(\n `Maximum depth exceeded at path: ${path}. Possible circular reference.`\n )\n return '[MAX_DEPTH_EXCEEDED]'\n }\n\n for (const prop in obj) {\n const currentPath = path ? `${path}.${prop}` : prop\n const objProp = obj[prop]\n\n if (isFunction(objProp)) {\n stringified[prop] = objProp.toString()\n } else if (isObject(objProp)) {\n stringified[prop] = {}\n deepStringifyFunctionsWithMaxDepth(\n objProp,\n stringified[prop],\n depth + 1,\n currentPath\n )\n } else if (isArray(objProp)) {\n stringified[prop] = []\n objProp.forEach((v, i) => {\n const itemPath = `${currentPath}[${i}]`\n if (isObject(v)) {\n stringified[prop][i] = {}\n deepStringifyFunctionsWithMaxDepth(\n v,\n stringified[prop][i],\n depth + 1,\n itemPath\n )\n } else if (isFunction(v)) {\n stringified[prop][i] = v.toString()\n } else {\n stringified[prop][i] = v\n }\n })\n } else {\n stringified[prop] = objProp\n }\n }\n return stringified\n}\n\nexport const objectToString = (obj = {}, indent = 0) => {\n // Handle null or primitive case\n if (obj === null || typeof obj !== 'object') {\n return String(obj)\n }\n\n const spaces = ' '.repeat(indent)\n\n // Handle array case\n if (Array.isArray(obj)) {\n if (obj.length === 0) return '[]'\n\n let str = '[\\n'\n for (const element of obj) {\n if (isObjectLike(element)) {\n str += `${spaces} ${objectToString(element, indent + 1)},\\n`\n } else if (isString(element)) {\n str += `${spaces} '${element}',\\n`\n } else {\n str += `${spaces} ${element},\\n`\n }\n }\n str += `${spaces}]`\n return str\n }\n\n // Handle empty object case\n if (Object.keys(obj).length === 0) {\n return '{}'\n }\n\n let str = '{\\n'\n\n for (const [key, value] of Object.entries(obj)) {\n const keyNotAllowdChars = stringIncludesAny(key, [\n '&',\n '*',\n '-',\n ':',\n '%',\n '{',\n '}',\n '>',\n '<',\n '@',\n '.',\n '/',\n '!',\n ' '\n ])\n const stringedKey = keyNotAllowdChars ? `'${key}'` : key\n str += `${spaces} ${stringedKey}: `\n\n if (isArray(value)) {\n str += '[\\n'\n for (const element of value) {\n if (isObjectLike(element) && element !== null) {\n str += `${spaces} ${objectToString(element, indent + 2)},\\n`\n } else if (isString(element)) {\n str += `${spaces} '${element}',\\n`\n } else {\n str += `${spaces} ${element},\\n`\n }\n }\n str += `${spaces} ]`\n } else if (isObjectLike(value)) {\n str += objectToString(value, indent + 1)\n } else if (isString(value)) {\n str += stringIncludesAny(value, ['\\n', \"'\"])\n ? `\\`${value}\\``\n : `'${value}'`\n } else {\n str += value\n }\n\n str += ',\\n'\n }\n\n str += `${spaces}}`\n return str\n}\n\n/**\n * Stringify object\n */\nexport const detachFunctionsFromObject = (obj, detached = {}) => {\n for (const prop in obj) {\n const objProp = obj[prop]\n if (isFunction(objProp)) continue\n else if (isObject(objProp)) {\n detached[prop] = {}\n deepStringifyFunctions(objProp, detached[prop])\n } else if (isArray(objProp)) {\n detached[prop] = []\n objProp.forEach((v, i) => {\n if (isFunction(v)) return\n if (isObject(v)) {\n detached[prop][i] = {}\n detachFunctionsFromObject(v, detached[prop][i])\n } else {\n detached[prop][i] = v\n }\n })\n } else {\n detached[prop] = objProp\n }\n }\n return detached\n}\n\nexport const hasFunction = (str) => {\n if (!str) return false\n\n const trimmed = str.trim().replace(/\\n\\s*/g, ' ').trim()\n\n if (trimmed === '') return false\n if (trimmed === '{}') return false\n if (trimmed === '[]') return false\n\n const patterns = [\n /^\\(\\s*\\{[^}]*\\}\\s*\\)\\s*=>/,\n /^(\\([^)]*\\)|[^=]*)\\s*=>/,\n /^function[\\s(]/,\n /^async\\s+/,\n /^\\(\\s*function/,\n /^[a-zA-Z_$][a-zA-Z0-9_$]*\\s*=>/\n ]\n\n const isClass = str.startsWith('class')\n const isFunction = patterns.some((pattern) => pattern.test(trimmed))\n const isObjectLiteral = trimmed.startsWith('{') && !trimmed.includes('=>')\n const isArrayLiteral = trimmed.startsWith('[')\n const isJSONLike = /^[\"[{]/.test(trimmed) && !trimmed.includes('=>')\n\n return (\n (isFunction || isClass) &&\n !isObjectLiteral &&\n !isArrayLiteral &&\n !isJSONLike\n )\n}\n\nexport const deepDestringifyFunctions = (obj, destringified = {}) => {\n for (const prop in obj) {\n const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, prop)\n if (!hasOwnProperty) continue\n\n const objProp = obj[prop]\n\n if (isString(objProp)) {\n if (hasFunction(objProp)) {\n try {\n const evalProp = window.eval(`(${objProp})`)\n destringified[prop] = evalProp\n } catch (e) {\n if (e) destringified[prop] = objProp\n }\n } else {\n destringified[prop] = objProp\n }\n } else if (isArray(objProp)) {\n destringified[prop] = []\n objProp.forEach((arrProp) => {\n if (isString(arrProp)) {\n if (hasFunction(arrProp)) {\n try {\n const evalProp = window.eval(`(${arrProp})`)\n destringified[prop].push(evalProp)\n } catch (e) {\n if (e) destringified[prop].push(arrProp)\n }\n } else {\n destringified[prop].push(arrProp)\n }\n } else if (isObject(arrProp)) {\n destringified[prop].push(deepDestringifyFunctions(arrProp))\n } else {\n destringified[prop].push(arrProp)\n }\n })\n } else if (isObject(objProp)) {\n destringified[prop] = deepDestringifyFunctions(\n objProp,\n destringified[prop]\n )\n } else {\n destringified[prop] = objProp\n }\n }\n return destringified\n}\n\nexport const evalStringToObject = (str, opts = { verbose: true }) => {\n try {\n return str ? (opts.window || window).eval('(' + str + ')') : {} // eslint-disable-line\n } catch (e) {\n if (opts.verbose) console.warn(e)\n if (opts.onError) return opts.onError(e)\n }\n}\n\nexport const diffObjects = (original, objToDiff, cache, opts) => {\n let hasDiff = false\n\n // Use union of keys maintaining original order where possible\n const originalKeys = Object.keys(original)\n const diffKeys = Object.keys(objToDiff)\n const allKeys = [...new Set([...originalKeys, ...diffKeys])]\n\n // Check if key order has changed\n const originalKeyOrder = originalKeys.join(',')\n const diffKeyOrder = diffKeys\n .filter((k) => originalKeys.includes(k))\n .join(',')\n if (originalKeyOrder !== diffKeyOrder) {\n hasDiff = true\n }\n\n for (const key of allKeys) {\n if (key === 'ref') continue\n\n const originalProp = original[key]\n const objToDiffProp = objToDiff[key]\n\n // Handle deleted keys (missing in objToDiff)\n if (!(key in objToDiff)) {\n cache[key] = undefined\n hasDiff = true\n continue\n }\n\n if (isObject(originalProp) && isObject(objToDiffProp)) {\n const nestedDiff = diff(originalProp, objToDiffProp, {}, opts)\n if (nestedDiff && Object.keys(nestedDiff).length > 0) {\n cache[key] = nestedDiff\n hasDiff = true\n }\n } else if (isArray(originalProp) && isArray(objToDiffProp)) {\n const nestedDiff = diffArrays(originalProp, objToDiffProp, [], opts)\n if (nestedDiff && nestedDiff.length > 0) {\n cache[key] = nestedDiff\n hasDiff = true\n }\n } else if (objToDiffProp !== originalProp) {\n cache[key] = objToDiffProp\n hasDiff = true\n }\n }\n\n return hasDiff ? cache : undefined\n}\n\nconst diffArrays = (original, objToDiff, cache, opts) => {\n // Different lengths means arrays are different\n if (original.length !== objToDiff.length) {\n return objToDiff\n }\n\n let hasDiff = false\n\n // First check if any elements have changed position\n // by doing a shallow comparison of elements\n const originalStringified = original.map((item) => JSON.stringify(item))\n const diffStringified = objToDiff.map((item) => JSON.stringify(item))\n\n if (originalStringified.join(',') !== diffStringified.join(',')) {\n hasDiff = true\n }\n\n // Then do deep comparison of each element\n for (let i = 0; i < original.length; i++) {\n const diffObj = diff(original[i], objToDiff[i], {}, opts)\n if (\n diffObj &&\n (isObject(diffObj) ? Object.keys(diffObj).length > 0 : true)\n ) {\n cache[i] = diffObj\n hasDiff = true\n }\n }\n\n return hasDiff ? objToDiff : undefined\n}\n\nexport const diff = (original, objToDiff, cache = {}, opts = {}) => {\n if (opts.cloneInstances) {\n original = deepClone(original)\n objToDiff = deepClone(objToDiff)\n }\n\n original = deepStringifyFunctions(original)\n objToDiff = deepStringifyFunctions(objToDiff)\n\n if (isArray(original) && isArray(objToDiff)) {\n const result = diffArrays(original, objToDiff, [], opts)\n return result === undefined ? {} : result\n }\n\n if (isObject(original) && isObject(objToDiff)) {\n const result = diffObjects(original, objToDiff, {}, opts)\n return result === undefined ? {} : result\n }\n\n // fallback for primitives or differing types\n if (original !== objToDiff) {\n return objToDiff\n }\n\n return {}\n}\n\nexport const hasOwnProperty = (o, ...args) =>\n Object.prototype.hasOwnProperty.call(o, ...args)\n\nexport const isEmpty = (o) => Object.keys(o).length === 0\n\nexport const isEmptyObject = (o) => isObject(o) && isEmpty(o)\n\nexport const makeObjectWithoutPrototype = () => Object.create(null)\n\n// by mattphillips\n// https://github.com/mattphillips/deep-object-diff/blob/main/src/diff.js\nexport const deepDiff = (lhs, rhs) => {\n if (lhs === rhs) return {}\n\n if (!isObjectLike(lhs) || !isObjectLike(rhs)) return rhs\n\n const deletedValues = Object.keys(lhs).reduce((acc, key) => {\n if (!hasOwnProperty(rhs, key)) {\n acc[key] = undefined\n }\n\n return acc\n }, makeObjectWithoutPrototype())\n\n if (isDate(lhs) || isDate(rhs)) {\n if (lhs.valueOf() === rhs.valueOf()) return {}\n return rhs\n }\n\n return Object.keys(rhs).reduce((acc, key) => {\n if (!hasOwnProperty(lhs, key)) {\n acc[key] = rhs[key]\n return acc\n }\n\n const difference = diff(lhs[key], rhs[key])\n\n if (\n isEmptyObject(difference) &&\n !isDate(difference) &&\n (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))\n ) {\n return acc\n }\n\n acc[key] = difference\n return acc\n }, deletedValues)\n}\n\n/**\n * Overwrites object properties with another\n */\nexport const overwrite = (element, params, opts = {}) => {\n const { __ref: ref } = element\n const excl = opts.exclude || []\n const allowUnderscore = opts.preventUnderscore\n const preventCaching = opts.preventCaching\n\n for (const e in params) {\n if (excl.includes(e) || (!allowUnderscore && e.startsWith('__'))) continue\n\n const elementProp = element[e]\n const paramsProp = params[e]\n\n if (paramsProp !== undefined) {\n element[e] = paramsProp\n if (ref && !preventCaching) {\n ref.__cache[e] = elementProp\n }\n if (isObject(opts.diff)) {\n diff[e] = elementProp\n }\n }\n }\n\n return element\n}\n\nexport const overwriteShallow = (obj, params, excludeFrom = []) => {\n for (const e in params) {\n if (excludeFrom.includes(e) || e.startsWith('__')) continue\n obj[e] = params[e]\n }\n return obj\n}\n\n/**\n * Overwrites DEEPLY object properties with another\n */\nexport const overwriteDeep = (\n obj,\n params,\n opts = {},\n visited = new WeakMap()\n) => {\n const excl = opts.exclude || []\n const forcedExclude = opts.preventForce ? [] : ['node', 'window']\n\n if (\n !isObjectLike(obj) ||\n !isObjectLike(params) ||\n isDOMNode(obj) ||\n isDOMNode(params)\n ) {\n return params\n }\n\n if (visited.has(obj)) return visited.get(obj)\n visited.set(obj, obj)\n\n for (const e in params) {\n if (!Object.hasOwnProperty.call(params, e)) continue\n if (excl.includes(e) || (forcedExclude && e.startsWith('__'))) continue\n\n const objProp = obj[e]\n const paramsProp = params[e]\n\n if (isDOMNode(paramsProp)) {\n obj[e] = paramsProp\n } else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {\n obj[e] = overwriteDeep(objProp, paramsProp, opts, visited)\n } else if (paramsProp !== undefined) {\n obj[e] = paramsProp\n }\n }\n\n return obj\n}\n\n/**\n * Overwrites object properties with another\n */\nexport const mergeIfExisted = (a, b) => {\n if (isObjectLike(a) && isObjectLike(b)) return deepMerge(a, b)\n return a || b\n}\n\n/**\n * Overwrites object properties with another\n */\nexport const flattenRecursive = (param, prop, stack = []) => {\n const objectized = mergeAndCloneIfArray(param)\n stack.push(objectized)\n\n const extendOfExtend = objectized[prop]\n if (extendOfExtend) flattenRecursive(extendOfExtend, prop, stack)\n\n delete objectized[prop]\n\n return stack\n}\n\n/**\n * Recursively compares two values to determine if they are deeply equal.\n *\n * This function checks for deep equality between two values, including\n * objects, arrays, and nested structures. It handles circular references to\n * prevent infinite loops.\n *\n * @param {*} param - The first value to compare.\n * @param {*} element - The second value to compare.\n * @param {Set} [visited] - (Optional) A set to track visited objects during recursion\n * to handle circular references. You can omit this parameter when calling\n * the function; it is used internally for tracking visited objects.\n *\n * @returns {boolean} Returns `true` if the values are deeply equal, `false` otherwise.\n *\n * @example\n * // Comparing primitive values\n * isEqualDeep(42, 42); // true\n * isEqualDeep('hello', 'hello'); // true\n * isEqualDeep(true, true); // true\n * isEqualDeep(42, '42'); // false\n *\n * // Comparing simple objects\n * const obj1 = { a: 1, b: { c: 2 } };\n * const obj2 = { a: 1, b: { c: 2 } };\n * isEqualDeep(obj1, obj2); // true\n *\n * // Handling circular references\n * const circularObj = { prop: null };\n * circularObj.prop = circularObj;\n * const anotherObj = { prop: null };\n * anotherObj.prop = anotherObj;\n * isEqualDeep(circularObj, anotherObj); // true\n */\nexport const isEqualDeep = (param, element, visited = new Set()) => {\n // Check if both values are non-null objects\n if (\n typeof param !== 'object' ||\n typeof element !== 'object' ||\n param === null ||\n element === null\n ) {\n return param === element // Compare non-object values directly\n }\n\n // Check for circular references\n if (visited.has(param) || visited.has(element)) {\n return true // Assume equality to break the circular reference\n }\n\n visited.add(param)\n visited.add(element)\n\n const keysParam = Object.keys(param)\n const keysElement = Object.keys(element)\n\n // Check if both objects have the same number of properties\n if (keysParam.length !== keysElement.length) {\n return false\n }\n\n // Check if all properties in param also exist in element\n for (const key of keysParam) {\n if (!keysElement.includes(key)) {\n return false\n }\n\n const paramProp = param[key]\n const elementProp = element[key]\n\n // Recursively check property values\n if (!isEqualDeep(paramProp, elementProp, visited)) {\n return false\n }\n }\n\n return true\n}\n\nexport const deepContains = (obj1, obj2, ignoredKeys = ['node', '__ref']) => {\n if (obj1 === obj2) return true\n if (!isObjectLike(obj1) || !isObjectLike(obj2)) return false\n if (isDOMNode(obj1) || isDOMNode(obj2)) return obj1 === obj2\n\n const stack = [[obj1, obj2]]\n const visited = new WeakSet()\n\n while (stack.length > 0) {\n const [current1, current2] = stack.pop()\n\n if (visited.has(current1)) continue\n visited.add(current1)\n\n const keys1 = Object.keys(current1).filter(\n (key) => !ignoredKeys.includes(key)\n )\n const keys2 = Object.keys(current2).filter(\n (key) => !ignoredKeys.includes(key)\n )\n\n if (keys1.length !== keys2.length) return false\n\n for (const key of keys1) {\n if (!Object.prototype.hasOwnProperty.call(current2, key)) return false\n\n const value1 = current1[key]\n const value2 = current2[key]\n\n if (isDOMNode(value1) || isDOMNode(value2)) {\n if (value1 !== value2) return false\n } else if (isObjectLike(value1) && isObjectLike(value2)) {\n if (value1 !== value2) {\n stack.push([value1, value2])\n }\n } else if (value1 !== value2) {\n return false\n }\n }\n }\n\n return true\n}\n\nexport const removeFromObject = (obj, props) => {\n if (props === undefined || props === null) return obj\n if (is(props)('string', 'number')) {\n delete obj[props]\n } else if (isArray(props)) {\n props.forEach((prop) => delete obj[prop])\n } else {\n throw new Error(\n 'Invalid input: props must be a string or an array of strings'\n )\n }\n return obj\n}\n\nexport const createObjectWithoutPrototype = (obj) => {\n if (obj === null || typeof obj !== 'object') {\n return obj // Return the value if obj is not an object\n }\n\n const newObj = Object.create(null) // Create an object without prototype\n\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n newObj[key] = createObjectWithoutPrototype(obj[key]) // Recursively copy each property\n }\n }\n\n return newObj\n}\n\nexport const createNestedObject = (arr, lastValue) => {\n const nestedObject = {}\n\n if (arr.length === 0) {\n return lastValue\n }\n\n arr.reduce((obj, value, index) => {\n if (!obj[value]) {\n obj[value] = {}\n }\n if (index === arr.length - 1 && lastValue !== undefined) {\n obj[value] = lastValue\n }\n return obj[value]\n }, nestedObject)\n\n return nestedObject\n}\n\nexport const removeNestedKeyByPath = (obj, path) => {\n if (!Array.isArray(path)) {\n throw new Error('Path must be an array.')\n }\n\n let current = obj\n\n for (let i = 0; i < path.length - 1; i++) {\n if (current[path[i]] === undefined) {\n return // Path does not exist, so nothing to remove.\n }\n current = current[path[i]]\n }\n\n const lastKey = path[path.length - 1]\n if (current && Object.hasOwnProperty.call(current, lastKey)) {\n delete current[lastKey]\n }\n}\n\nexport const setInObjectByPath = (obj, path, value) => {\n if (!Array.isArray(path)) {\n throw new Error('Path must be an array.')\n }\n\n let current = obj\n\n for (let i = 0; i < path.length - 1; i++) {\n // If the current path segment doesn't exist or isn't an object, create it\n if (!current[path[i]] || typeof current[path[i]] !== 'object') {\n current[path[i]] = {}\n }\n current = current[path[i]]\n }\n\n const lastKey = path[path.length - 1]\n current[lastKey] = value\n\n return obj\n}\n\nexport const getInObjectByPath = (obj, path) => {\n if (!Array.isArray(path)) {\n throw new Error('Path must be an array.')\n }\n\n let current = obj\n\n for (let i = 0; i < path.length; i++) {\n if (current === undefined || current === null) {\n return undefined\n }\n current = current[path[i]]\n }\n\n return current\n}\n\nexport const detectInfiniteLoop = (arr) => {\n const maxRepeats = 3 // Maximum allowed repetitions\n let pattern = []\n let repeatCount = 0\n\n for (let i = 0; i < arr.length; i++) {\n if (pattern.length < 2) {\n // Build the initial pattern with two consecutive elements\n pattern.push(arr[i])\n } else {\n // Check if the current element follows the repeating pattern\n if (arr[i] === pattern[i % 2]) {\n repeatCount++\n } else {\n // If there's a mismatch, reset the pattern and repeat counter\n pattern = [arr[i - 1], arr[i]]\n repeatCount = 1 // Reset to 1 because we start a new potential pattern\n }\n\n // If the pattern repeats more than `maxRepeats`, throw a warning\n if (repeatCount >= maxRepeats * 2) {\n if (isNotProduction()) {\n console.warn(\n 'Warning: Potential infinite loop detected due to repeated sequence:',\n pattern\n )\n }\n return true\n }\n }\n }\n}\n\nexport const isCyclic = (obj) => {\n const seenObjects = []\n\n function detect(obj) {\n if (obj && typeof obj === 'object') {\n if (seenObjects.indexOf(obj) !== -1) {\n return true\n }\n seenObjects.push(obj)\n for (const key in obj) {\n if (Object.hasOwnProperty.call(obj, key) && detect(obj[key])) {\n console.log(obj, 'cycle at ' + key)\n return true\n }\n }\n }\n return false\n }\n\n return detect(obj)\n}\n\nexport const excludeKeysFromObject = (obj, excludedKeys) => {\n const result = { ...obj }\n excludedKeys.forEach((key) => delete result[key])\n return result\n}\n", "'use strict'\n\nimport { isUndefined } from './types.js'\nimport { document } from './globals.js'\n\nexport const isMobile = (() =>\n typeof navigator === 'undefined' ? false : /Mobi/.test(navigator.userAgent))()\n\nexport const setCookie = (cname, cvalue, exdays = 365) => {\n if (isUndefined(document) || isUndefined(document.cookie)) return\n const d = new Date()\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)\n const expires = `expires=${d.toUTCString()}`\n document.cookie = `${cname}=${cvalue};${expires};path=/`\n}\n\nexport const getCookie = cname => {\n if (isUndefined(document) || isUndefined(document.cookie)) return\n const name = `${cname}=`\n const decodedCookie = decodeURIComponent(document.cookie)\n const ca = decodedCookie.split(';')\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i]\n while (c.charAt(0) === ' ') c = c.substring(1)\n if (c.indexOf(name) === 0) return c.substring(name.length, c.length)\n }\n return ''\n}\n\nexport const removeCookie = cname => {\n if (isUndefined(document) || isUndefined(document.cookie)) return\n document.cookie = cname + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'\n}\n\n/**\n * Load item from the localStorage\n *\n * @param key -- string to identify the storage item\n */\nexport function getLocalStorage (key) {\n let savedJSON\n\n if (window.localStorage) {\n try {\n savedJSON = JSON.parse(window.localStorage.getItem(key))\n } catch (e) {\n console.error(e)\n }\n }\n\n if (typeof savedJSON !== 'undefined') {\n return savedJSON\n }\n}\n/**\n * Save the data to window.localStorage\n *\n * @param key - local storage key to save the data under\n * @param data - the data to save\n */\nexport function setLocalStorage (key, data) {\n if (data && window.localStorage) {\n if (typeof data === 'object') {\n window.localStorage.setItem(key, JSON.stringify(data))\n } else {\n window.localStorage.setItem(key, data)\n }\n }\n}\n", "/** Helper function to check if all values in an array are equal\n * @param {Array} arr\n * @returns {boolean}\n */\nexport const allEqual = (arr) => arr.every((v) => v === arr[0])\n\n// Capitalize function for the border properties\nexport const capitalize = (string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\n// Convert kebab-case to camelCase\nexport const toCamelCase = (str) =>\n str.replace(/[_\\- ]+(?<first>[a-z])/giu, (_, char, offSet) =>\n offSet > 0 ? char.toUpperCase() : char\n )\n\n/**\n * Convert all keys in a style object to camelCase, separating out CSS variables\n * @param {Record<string, string>} styles\n * @returns {Record<string, string>}\n */\nexport function extractCssVars(styles) {\n const cssVariables = {}\n\n for (const key in styles) {\n if (Object.hasOwn(styles, key) && key.includes('--')) {\n cssVariables[key] = styles[key]\n }\n }\n\n return cssVariables\n}\n\n/**\n * Convert all keys in a style object to camelCase except CSS variables\n * @param {Record<string, string>} styles\n * @returns {Record<string, string>}\n */\nexport function convertKeysToCamelCase(styles) {\n const camelCased = {}\n\n for (const key in styles) {\n if (Object.hasOwn(styles, key) && !key.includes('--')) {\n camelCased[toCamelCase(key)] = styles[key]\n }\n }\n\n return camelCased\n}\n\nfunction findVarPattern(input) {\n // Regex to capture variable names with letters, numbers, and hyphens\n const regex = /var\\(--(?<varName>[a-zA-Z0-9-]+)(?:,\\s*[a-zA-Z0-9%-]+)?\\)/gu\n const matches = []\n let match = regex.exec(input)\n\n // Find all matches in the input string\n while (match !== null) {\n const varName = `--${match.groups.varName}`\n matches.push(varName)\n\n match = regex.exec(input)\n }\n\n // Remove duplicates and return the result\n return [...new Set(matches)]\n}\n\n/**\n * @param {Record<string, string>} css\n * @param {CSSStyleDeclaration} globalStyles\n * @returns {Record<string, string>} extracted root variables\n */\nexport const extractRootVars = (css, globalStyles) => {\n const variables = extractCssVars(css)\n let rootVars = Object.values(css).reduce((acc, value) => {\n const vars = {}\n\n if (value.includes('var(')) {\n const varNames = findVarPattern(value)\n varNames.forEach((v) => {\n let val = variables[v]\n if (val || val === '') {\n vars[v] = val || ' '\n } else {\n val = globalStyles.getPropertyValue(v)\n if (val || val === '') {\n vars[v] = val || ' '\n }\n }\n })\n }\n\n return { ...acc, ...vars }\n }, {})\n\n // Check for nested root variables\n if (Object.keys(rootVars).length) {\n let checkingNested = true\n let nested = {}\n while (checkingNested) {\n const parsed = Object.values({\n ...rootVars,\n ...variables,\n ...nested\n }).reduce(\n /* eslint-disable-next-line no-loop-func -- checking the contents of rootVars and nested is safe */\n (acc, value) => {\n const vars = {}\n if (value.includes('var(')) {\n const varNames = findVarPattern(value)\n varNames.forEach((v) => {\n if (v in rootVars || v in nested) {\n return // Skip if already in rootVars or nested to prevent infinite loop\n }\n let val = variables[v]\n if (val || val === '') {\n vars[v] = val || ' '\n } else {\n val = globalStyles.getPropertyValue(v)\n if (val || val === '') {\n vars[v] = val || ' '\n }\n }\n })\n }\n\n return { ...acc, ...vars }\n },\n {}\n )\n\n // If no new variables found stop checking, otherwise merge them into nested\n if (Object.keys(parsed).length) {\n nested = { ...nested, ...parsed }\n } else {\n checkingNested = false\n }\n }\n\n rootVars = { ...rootVars, ...nested }\n }\n\n return rootVars\n}\n\n// Helper function to deep compare objects, with support for circular references\nfunction isEqual(objA, objB, visited = new WeakSet()) {\n if (objA === objB) {\n return true\n } // Check for reference equality\n if (objA == null || objB == null) {\n return false\n } // Handle null or undefined\n\n if (typeof objA !== 'object' || typeof objB !== 'object') {\n return false // Both must be objects\n }\n\n // Handle circular references\n if (visited.has(objA) || visited.has(objB)) {\n return false\n }\n visited.add(objA)\n visited.add(objB)\n\n const keysA = Object.keys(objA)\n const keysB = Object.keys(objB)\n\n if (keysA.length !== keysB.length) {\n return false\n } // Different number of keys\n\n for (const key of keysA) {\n if (!keysB.includes(key) || !isEqual(objA[key], objB[key], visited)) {\n return false // Keys don't match or values are different\n }\n }\n\n return true // Objects are equal\n}\n\n// Function to find shared properties\nexport function cleanSharedProperties(children) {\n // Extract props from children\n const props = children.map((child) => child.props)\n const shared = {}\n\n // Get keys from the first style object\n const keys = Object.keys(props[0])\n\n for (const key of keys) {\n // Check if all style objects have the same value for this key\n const values = props.map((style) => style[key])\n\n if (values.every((value) => isEqual(value, values[0]))) {\n const [val] = values\n shared[key] = val // Add to shared properties\n }\n }\n\n return shared // Return the shared properties object\n}\n\n/**\n * Converts an array of children objects into a single object with unique keys.\n * @param {Array<any>} children\n * @returns {Record<string, any>} reformatted children object\n */\nexport function reformatChildren(children) {\n const childrenObj = {}\n\n const keyCounts = {}\n\n children.forEach((child) => {\n let key = child.extend ?? 'Child' // Default key if `extend` is missing\n\n // Check for multiple `extends` in the array\n if (Array.isArray(key)) {\n key = child.extend.shift()\n if (!child.extend.length) {\n delete child.extend\n }\n }\n\n // Increment the key count to handle duplicates\n if (!(key in keyCounts)) {\n keyCounts[key] = 0\n }\n keyCounts[key]++\n\n const newKey = keyCounts[key] > 1 ? `${key}_${keyCounts[key]}` : key\n\n childrenObj[newKey] = { ...child }\n })\n\n return childrenObj\n}\n", "import { deepClone } from '@domql/utils'\nimport { allEqual } from './utils'\n\n/**\n * Utility function to consolidate CSS values\n * @param {string[]} values\n * @returns string\n */\nfunction consolidateValues(values) {\n const uniqueValues = new Set(values)\n\n if (uniqueValues.size === 1) {\n return values[0] // All values are the same\n }\n\n if (uniqueValues.size === 2) {\n const [vertical, horizontal] = values\n if (vertical === horizontal) {\n return `${vertical}`\n }\n } else if (uniqueValues.size === 4) {\n const [topLeft, topRight, bottomRight, bottomLeft] = values\n if (topLeft === topRight && bottomLeft === bottomRight) {\n return `${topLeft} ${bottomLeft}`\n }\n }\n\n return values.join(' ')\n}\n\nfunction consolidateTextDecoration(style) {\n const updatedStyle = deepClone(style)\n\n const decorationProps = [\n 'textDecorationThickness',\n 'textDecorationStyle',\n 'textDecorationColor'\n ]\n\n const thickness =\n style.textDecorationThickness && style.textDecorationThickness !== 'initial'\n ? style.textDecorationThickness\n : ''\n const styleProp =\n style.textDecorationStyle && style.textDecorationStyle !== 'initial'\n ? style.textDecorationStyle\n : ''\n const color =\n style.textDecorationColor && style.textDecorationColor !== 'initial'\n ? style.textDecorationColor\n : ''\n\n // Build the consolidated textDecoration shorthand\n const consolidatedTextDecoration = [thickness, styleProp, color]\n .filter(Boolean)\n .join(' ')\n .trim()\n\n // Set the textDecoration shorthand if there's any valid value\n if (consolidatedTextDecoration) {\n updatedStyle.textDecoration = consolidatedTextDecoration\n }\n\n // Remove individual textDecoration properties from the style\n decorationProps.forEach((prop) => delete updatedStyle[prop])\n\n return updatedStyle\n}\n\nfunction consolidateBorderRadius(style) {\n const radiusProps = [\n 'borderBottomLeftRadius',\n 'borderBottomRightRadius',\n 'borderEndEndRadius',\n 'borderEndStartRadius',\n 'borderStartEndRadius',\n 'borderStartStartRadius',\n 'borderTopLeftRadius',\n 'borderTopRightRadius'\n ]\n\n const sides = ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft']\n const radii = []\n\n // Collect valid border radius values from each side\n sides.forEach((side) => {\n const radius = style[`border${side}Radius`]\n if (radius && radius !== 'initial') {\n radii.push(radius)\n } else {\n radii.push('0') // If undefined or initial, add 0\n }\n })\n\n // Consolidate border radius values\n const consolidatedRadius = consolidateValues(radii).trim()\n\n const updated = { ...style }\n // Set the consolidated border radius if there's a valid value\n if (consolidatedRadius && consolidatedRadius !== '0') {\n updated.borderRadius = consolidatedRadius\n }\n\n // Remove individual radius properties from the style object\n radiusProps.forEach((prop) => delete updated[prop])\n\n return updated\n}\n\nfunction consolidateAndUpdateBorderProperties(style) {\n const updatedStyle = deepClone(style)\n const result = {}\n const sides = ['Top', 'Right', 'Bottom', 'Left']\n const properties = ['Width', 'Style', 'Color']\n\n // Extract border properties\n const borderProps = {}\n sides.forEach((side) => {\n properties.forEach((prop) => {\n const key = `border${side}${prop}`\n if (updatedStyle[key] && updatedStyle[key] !== 'initial') {\n borderProps[key] = updatedStyle[key]\n }\n })\n })\n\n // Check if all sides are equal\n const allSidesEqual = properties.every((prop) =>\n allEqual(sides.map((side) => borderProps[`border${side}${prop}`]))\n )\n\n if (allSidesEqual) {\n // All sides are equal, use shorthand\n const width = borderProps.borderTopWidth\n const borderStyle = borderProps.borderTopStyle\n const color = borderProps.borderTopColor\n\n if (width && borderStyle && color) {\n result.border = `${width} ${borderStyle} ${color}`\n } else {\n if (width) {\n result.borderWidth = width\n }\n if (borderStyle) {\n result.borderStyle = borderStyle\n }\n if (color) {\n result.borderColor = color\n }\n }\n } else {\n // Check if logical properties can be used\n const logicalSides = ['BlockStart', 'BlockEnd', 'InlineStart', 'InlineEnd']\n const logicalEqual = properties.every((prop) =>\n allEqual(logicalSides.map((side) => borderProps[`border${side}${prop}`]))\n )\n\n if (logicalEqual) {\n // Use logical shorthands\n const blockWidth = borderProps.borderBlockStartWidth\n const blockStyle = borderProps.borderBlockStartStyle\n const blockColor = borderProps.borderBlockStartColor\n const inlineWidth = borderProps.borderInlineStartWidth\n const inlineStyle = borderProps.borderInlineStartStyle\n const inlineColor = borderProps.borderInlineStartColor\n\n if (\n blockWidth === inlineWidth &&\n blockStyle === inlineStyle &&\n blockColor === inlineColor\n ) {\n result.border = `${blockWidth} ${blockStyle} ${blockColor}`\n } else {\n if (blockWidth) {\n result.borderBlockWidth = blockWidth\n }\n if (blockStyle) {\n result.borderBlockStyle = blockStyle\n }\n if (blockColor) {\n result.borderBlockColor = blockColor\n }\n if (inlineWidth && inlineWidth !== blockWidth) {\n result.borderInlineWidth = inlineWidth\n }\n if (inlineStyle && inlineStyle !== blockStyle) {\n result.borderInlineStyle = inlineStyle\n }\n if (inlineColor && inlineColor !== blockColor) {\n result.borderInlineColor = inlineColor\n }\n }\n } else {\n // Use individual logical properties\n logicalSides.forEach((side) => {\n const width = borderProps[`border${side}Width`]\n const borderStyle = borderProps[`border${side}Style`]\n const color = borderProps[`border${side}Color`]\n if (width && borderStyle && color) {\n result[`border${side}`] = `${width} ${borderStyle} ${color}`\n } else {\n if (width) {\n result[`border${side}Width`] = width\n }\n if (borderStyle) {\n result[`border${side}Style`] = borderStyle\n }\n if (color) {\n result[`border${side}Color`] = color\n }\n }\n })\n }\n }\n\n // Add any border image properties\n ;[\n 'borderImageSource',\n 'borderImageSlice',\n 'borderImageWidth',\n 'borderImageOutset',\n 'borderImageRepeat'\n ].forEach((prop) => {\n if (updatedStyle[prop] && updatedStyle[prop] !== 'initial') {\n result[prop] = updatedStyle[prop]\n }\n delete updatedStyle[prop]\n })\n\n // Clean up old border properties\n sides.forEach((side) => {\n properties.forEach((prop) => {\n delete updatedStyle[`border${side}${prop}`]\n })\n })\n ;[\n 'border',\n 'borderWidth',\n 'borderStyle',\n 'borderColor',\n 'borderBlock',\n 'borderInline'\n ].forEach((prop) => {\n delete updatedStyle[prop]\n })\n\n // Add consolidated properties back to style\n return { ...updatedStyle, ...result }\n}\n\nfunction consolidateSpacing(style, property = 'padding') {\n const updatedStyle = deepClone(style)\n const propertyMap = {\n top:\n style[`${property}Top`] ||\n style[`${property}BlockStart`] ||\n style[`${property}Block`],\n right:\n style[`${property}Right`] ||\n style[`${property}InlineEnd`] ||\n style[`${property}Inline`],\n bottom:\n style[`${property}Bottom`] ||\n style[`${property}BlockEnd`] ||\n style[`${property}Block`],\n left:\n style[`${property}Left`] ||\n style[`${property}InlineStart`] ||\n style[`${property}Inline`]\n }\n\n const consolidatedValues = ['top', 'right', 'bottom', 'left'].map(\n (side) => propertyMap[side] || '0'\n )\n\n // Check if any value was actually applied\n if (consolidatedValues.every((value) => value === '0')) {\n return updatedStyle // Return unchanged style if no values were applied\n }\n\n // Simplify the values if possible\n const [top, right, bottom, left] = consolidatedValues\n let result = consolidatedValues.join(' ') // All four sides are different or have placeholders\n\n if (right === left) {\n if (top === bottom) {\n if (top === right) {\n // All sides are the same\n result = top\n } else {\n // Vertical and horizontal values are different\n result = `${top} ${right}`\n }\n } else {\n // Top, horizontal, and bottom values\n result = `${top} ${right} ${bottom}`\n }\n }\n\n // Remove related properties from style\n ;[\n `${property}Top`,\n `${property}Right`,\n `${property}Bottom`,\n `${property}Left`,\n `${property}BlockStart`,\n `${property}BlockEnd`,\n `${property}InlineStart`,\n `${property}InlineEnd`,\n `${property}Block`,\n `${property}Inline`,\n property\n ].forEach((prop) => {\n delete updatedStyle[prop]\n })\n\n updatedStyle[property] = result\n\n return updatedStyle\n}\n\nexport function splitPropsFromStyles(style) {\n const updatedStyle = deepClone(style)\n const props = {}\n\n const stylesWithProps = [\n 'alignContent',\n 'alignItems',\n 'alignSelf',\n 'animation',\n 'animationDelay',\n 'animationDirection',\n 'animationDuration',\n 'animationFillMode',\n 'animationIterationCount',\n 'animationName',\n 'animationPlayState',\n 'animationTimingFunction',\n 'appearance',\n 'aspectRatio',\n 'background',\n 'backgroundColor',\n 'backgroundPosition',\n 'backgroundRepeat',\n 'backgroundSize',\n 'backfaceVisibility',\n 'backdropFilter',\n 'blockSize',\n 'border',\n 'borderBottom',\n 'borderColor',\n 'borderLeft',\n 'borderRadius',\n 'borderRight',\n 'borderStyle',\n 'borderTop',\n 'borderWidth',\n 'bottom',\n 'boxShadow',\n 'boxSize',\n 'boxSizing',\n 'caretColor',\n 'columns',\n 'columnCount',\n 'columnFill',\n 'columnGap',\n 'columnRule',\n 'columnRule',\n 'columnSpan',\n 'columnWidth',\n 'color',\n 'content',\n 'cursor',\n 'depth',\n 'direction',\n 'direction',\n 'display',\n 'filter',\n 'flex',\n 'flexAlign',\n 'flexDirection',\n 'flexFlow',\n 'flexWrap',\n 'float',\n 'gap',\n 'gridArea',\n 'gridColumn',\n 'gridColumnStart',\n 'gridRow',\n 'gridRowStart',\n 'height',\n 'heightRange',\n 'horizontalInset',\n 'inlineSize',\n 'inset',\n 'justifyContent',\n 'justifyItems',\n 'left',\n 'maxBlockSize',\n 'maxHeight',\n 'maxInlineSize',\n 'maxSize',\n 'maxWidth',\n 'mixBlendMode',\n 'minBlockSize',\n 'minHeight',\n 'minInlineSize',\n 'minSize',\n 'minWidth',\n 'margin',\n 'marginBlock',\n 'marginBlockEnd',\n 'marginBlockStart',\n 'marginInline',\n 'marginInlineEnd',\n 'marginInlineStart',\n 'objectFit',\n 'opacity',\n 'order',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'outline',\n 'outlineOffset',\n 'overscrollBehavior',\n 'padding',\n 'paddingBlock',\n 'paddingBlockEnd',\n 'paddingBlockStart',\n 'paddingInline',\n 'paddingInlineEnd',\n 'paddingInlineStart',\n 'perspective',\n 'perspectiveOrigin',\n 'pointerEvents',\n 'position',\n 'right',\n 'resize',\n 'round',\n 'rowGap',\n 'scrollPadding',\n 'shape',\n 'shapeDirection',\n 'shapeDirectionColor',\n 'shadow',\n 'size',\n 'textShadow',\n 'textStroke',\n 'theme',\n 'top',\n 'transform',\n 'transformOrigin',\n 'transition',\n 'transitionDelay',\n 'transitionDuration',\n 'transitionProperty',\n 'transitionTimingFunction',\n 'userSelect',\n 'verticalAlign',\n 'verticalInset',\n 'visibility',\n 'width',\n 'widthRange',\n 'willChange',\n 'zIndex',\n 'zoom'\n ]\n\n stylesWithProps.forEach((key) => {\n if (key in updatedStyle) {\n props[key] = updatedStyle[key]\n delete updatedStyle[key]\n }\n })\n\n return { props, style: updatedStyle }\n}\n\nexport function consolidateStyles(style) {\n let updatedStyle = deepClone(style)\n\n // Consolidate outline properties\n if (style.outlineWidth || style.outlineStyle || style.outlineColor) {\n updatedStyle.outline = `${style.outlineWidth || 'initial'} ${\n style.outlineStyle || 'initial'\n } ${style.outlineColor || 'initial'}`\n\n delete updatedStyle.outlineWidth\n delete updatedStyle.outlineStyle\n delete updatedStyle.outlineColor\n }\n\n // Consolidate padding\n const insetProps = [\n 'insetInlineStart',\n 'insetBlockEnd',\n 'insetInlineEnd',\n 'insetBlockStart'\n ]\n const insetValues = insetProps.map((prop) => style[prop] || '0')\n if (insetValues.some((val) => val !== '0')) {\n updatedStyle.inset = consolidateValues(insetValues)\n insetProps.forEach((prop) => delete updatedStyle[prop])\n }\n\n // Consolidate transition properties\n if (\n style.transition &&\n style.transitionProperty &&\n style.transitionDuration\n ) {\n updatedStyle.transition = `${style.transition} ${style.transitionProperty} ${style.transitionDuration}`\n\n delete updatedStyle.transitionProperty\n delete updatedStyle.transitionDuration\n }\n\n const sizeProps = ['inlineSize', 'blockSize']\n const sizeValues = sizeProps.map((prop) => style[prop] || '0')\n if (sizeValues.some((val) => val !== '0')) {\n updatedStyle.size = consolidateValues(sizeValues)\n sizeProps.forEach((prop) => delete updatedStyle[prop])\n }\n\n let gapValues = []\n if (style.gap) {\n gapValues = [...gapValues, ...style.gap.split(' ')]\n delete updatedStyle.gap\n }\n const gapProps = ['rowGap', 'columnGap']\n gapValues = [...gapValues, ...gapProps.map((prop) => style[prop] || '0')]\n if (gapValues.some((val) => val !== '0')) {\n updatedStyle.gap = consolidateValues(gapValues)\n gapProps.forEach((prop) => delete updatedStyle[prop])\n }\n\n if (style.webkitTextStroke) {\n updatedStyle.textStroke = style.webkitTextStroke\n delete updatedStyle.webkitTextStroke\n }\n\n updatedStyle = consolidateBorderRadius(updatedStyle)\n updatedStyle = consolidateAndUpdateBorderProperties(updatedStyle)\n updatedStyle = consolidateSpacing(updatedStyle, 'padding')\n updatedStyle = consolidateSpacing(updatedStyle, 'margin')\n updatedStyle = consolidateSpacing(updatedStyle, 'borderWidth')\n updatedStyle = consolidateTextDecoration(updatedStyle)\n\n if (style.minWidth && style.maxWidth) {\n updatedStyle.widthRange = `${style.minWidth} ${style.maxWidth}`\n\n delete updatedStyle.minWidth\n delete updatedStyle.maxWidth\n }\n\n if (style.minHeight && style.maxHeight) {\n style.heightRange = `${style.minHeight} ${style.maxHeight}`\n\n delete updatedStyle.minHeight\n delete updatedStyle.maxHeight\n }\n\n // Return the new cleaned style object\n return updatedStyle\n}\n\nexport function consolidateFlexCSS(props) {\n const updatedProps = deepClone(props)\n\n // Consolidate alignItems and justifyContent\n if (props.alignItems || props.justifyContent) {\n updatedProps.align = `${props.alignItems || ''} ${\n props.justifyContent || ''\n }`.trim()\n delete updatedProps.alignItems\n delete updatedProps.justifyContent\n }\n\n // Consolidate flexDirection and flexWrap\n if (props.flexDirection || props.flexWrap) {\n updatedProps.flow = `${props.flexDirection || 'row'} ${\n props.flexWrap || ''\n }`.trim()\n delete updatedProps.flexDirection\n delete updatedProps.flexWrap\n }\n\n return updatedProps\n}\n\nexport function consolidateGridCSS(props) {\n const updatedProps = deepClone(props)\n\n if (props.gridTemplateColumns) {\n updatedProps.columns = props.gridTemplateColumns\n delete updatedProps.gridTemplateColumns\n }\n\n if (props.gridTemplateRows) {\n updatedProps.rows = props.gridTemplateRows\n delete updatedProps.gridTemplateRows\n }\n\n return updatedProps\n}\n", "export function getComputedStyles(node) {\n const computedStyle = window.getComputedStyle(node)\n const style = {}\n\n for (let i = 0; i < computedStyle.length; i++) {\n const property = computedStyle[i]\n const value = computedStyle.getPropertyValue(property)\n style[property] = value\n }\n\n return style\n}\n\nexport function getStyleDefaultsFromEmptyNode(tag) {\n const node = document.createElement(tag)\n document.body.appendChild(node)\n const computed = getComputedStyles(node)\n document.body.removeChild(node)\n return computed\n}\n\nexport function getAppliedComputedStyles(node, defaults) {\n const css = getComputedStyles(node)\n const styles = {}\n\n Object.keys(css).forEach((prop) => {\n const value = css[prop]\n\n const ignoreAllVals = [\n 'width',\n 'height',\n 'inline-size',\n 'block-size',\n 'transform-origin',\n 'perspective-origin'\n ]\n const ignoreAutoVals = [\n 'margin',\n 'margin-top',\n 'margin-bottom',\n 'margin-left',\n 'margin-right',\n 'padding',\n 'padding-top',\n 'padding-bottom',\n 'padding-left',\n 'padding-right',\n 'top',\n 'bottom',\n 'left',\n 'right',\n 'min-width',\n 'min-height',\n 'min-block-size',\n 'min-inline-size'\n ]\n\n /**\n * @type {Array<[string, () => boolean]>}\n */\n const skipDefault = [['flex-direction', (s) => s.display === 'flex']]\n\n const defaultIsValid =\n skipDefault.some(([p, con]) => prop === p && con(css)) ||\n value !== defaults[prop]\n\n if (\n !ignoreAllVals.includes(prop) &&\n value &&\n defaultIsValid &&\n !(ignoreAutoVals.includes(prop) && value === 'auto')\n ) {\n styles[prop] = value\n }\n })\n\n return styles\n}\n", "/**\n * @typedef {Object} Settings\n * @property {boolean} useComputed\n * @property {boolean} useStylesheets\n */\n\nconst storageKey = 'settings'\n\n/**\n * @typedef {Object} SettingDefinition\n * @property {string} type\n * @property {String} name\n * @property {string} [key]\n * @property {any} [default]\n * @property {value} [any]\n */\n\n/**\n * @type {SettingDefinition[]}\n */\nexport const settingsDefinitions = [\n {\n key: 'useStylesheets',\n name: 'Use Stylesheets',\n type: 'checkbox',\n default: true\n },\n {\n key: 'useComputed',\n name: 'Use Computed',\n type: 'checkbox',\n default: false\n }\n]\n\n/**\n * @returns {Promise<Settings>}\n */\nexport const getSettings = async () =>\n (await chrome.storage.local.get(storageKey)).settings\n\n/**\n * @param {Partial<Settings>} updates\n */\nexport async function updateSettings(updates) {\n const cur = await getSettings()\n chrome.storage.local\n .set({ [storageKey]: { ...cur, ...updates } })\n .catch((reason) => console.error(`failed to update settings : ${reason}`))\n}\n\nexport async function initSettings() {\n const curSettings = (await getSettings()) ?? {}\n\n // construct default settings from definitions\n const defaultSettings = {}\n settingsDefinitions.forEach(({ key, default: defValue }) => {\n defaultSettings[key] = defValue\n })\n\n // override defaults with any existing settings\n Object.keys(curSettings).forEach((key) => {\n // only include settings within the current defined set\n if (key in defaultSettings) {\n defaultSettings[key] = curSettings[key]\n }\n })\n\n updateSettings(defaultSettings)\n}\n", "const getRelevantRules = (node, rules) => {\n let relevantRules = []\n\n for (const rule of rules) {\n const { selectorText, conditionText, media, cssRules } = rule\n\n if (selectorText && node.matches(selectorText)) {\n relevantRules.push(rule)\n } else if ((conditionText || (media && media.length > 0)) && cssRules) {\n relevantRules = [\n ...relevantRules,\n ...getRelevantRules(node, rule.cssRules)\n ]\n }\n }\n\n return relevantRules\n}\n\nconst extractStylesFromRule = (rule, defaults = {}) => {\n const { style } = rule\n const results = {}\n\n // Loop through each property and add it to the styles object\n for (let k = 0; k < style.length; k++) {\n const prop = style[k]\n const value = style.getPropertyValue(prop)\n const defaultValue = defaults[prop]\n\n if (value && value !== defaultValue) {\n results[prop] = value\n }\n }\n\n return results\n}\n\nconst processMediaQueries = (rule, parentRule) => {\n const { conditionText } = parentRule\n let key = `@media ${conditionText}`\n if (\n ['(prefers-color-scheme: dark)', '(prefers-color-scheme: light)'].includes(\n conditionText\n )\n ) {\n key = conditionText.includes('dark') ? '@dark' : '@light'\n }\n\n return { [key]: { ...extractStylesFromRule(rule) } }\n}\n\nconst getAppliedStylesheets = (node) => {\n let styles = {}\n let conditionalStyles = {}\n\n // Loop through all stylesheets\n for (const styleSheet of document.styleSheets) {\n let baseRules = null\n // Try to access the cssRules of the stylesheet (some stylesheets may be cross-origin and not accessible)\n try {\n baseRules = styleSheet.cssRules\n } catch (error) {\n // Unable to access stylesheet (possibly cross-origin), skip it\n console.log('Could not access stylesheet rules:', { styleSheet, error })\n }\n\n if (baseRules !== null) {\n // filter rules down to relevant ones with selectors\n const rules = getRelevantRules(node, baseRules)\n\n // Loop through all rules within the stylesheet\n for (const rule of rules) {\n const { parentRule } = rule\n\n // Rule is enclosed within a media query\n if (parentRule && parentRule.conditionText) {\n conditionalStyles = {\n ...conditionalStyles,\n ...processMediaQueries(rule, parentRule)\n }\n } else if (rule.selectorText.includes(':hover')) {\n // Hover styles should be extracted separately as they do not\n // follow the same patterns as other conditional styles\n const hoverKey = ':hover'\n conditionalStyles[hoverKey] = {\n ...conditionalStyles[hoverKey],\n ...extractStylesFromRule(rule)\n }\n } else {\n styles = { ...styles, ...extractStylesFromRule(rule) }\n }\n }\n }\n }\n\n return [styles, conditionalStyles]\n}\n\nconst getInlineStyles = (node, defaults) => {\n const styles = {}\n for (let i = 0; i < node.style.length; i++) {\n const prop = node.style[i]\n const val = node.style.getPropertyValue(prop)\n\n if (val && val !== defaults[prop]) {\n styles[prop] = val\n }\n }\n\n return styles\n}\n\nexport function getAllAppliedSheetStyles(node, defaults) {\n const inlineStyles = getInlineStyles(node, defaults)\n const [stylesheetStyles, conditionalStyles] = getAppliedStylesheets(node)\n return [{ ...stylesheetStyles, ...inlineStyles }, conditionalStyles]\n}\n", "import {\n consolidateStyles,\n consolidateFlexCSS,\n consolidateGridCSS,\n splitPropsFromStyles\n} from './clean'\nimport {\n getAppliedComputedStyles,\n getStyleDefaultsFromEmptyNode\n} from './computed'\nimport { getSettings } from '../settings/settings_utils'\nimport { getAllAppliedSheetStyles } from './stylesheets'\nimport {\n capitalize,\n cleanSharedProperties,\n convertKeysToCamelCase,\n extractRootVars,\n reformatChildren\n} from './utils'\n\nexport function getNodeText(node) {\n if (node.nodeType === window.Node.TEXT_NODE) {\n return window.Node.TEXT_NODE // This node itself is text\n }\n\n let val = ''\n for (const child of node.childNodes) {\n if (\n child.nodeType === window.Node.TEXT_NODE &&\n child.textContent.trim() !== ''\n ) {\n val += child.textContent.trim()\n }\n }\n\n if (val.trim() !== '') {\n return val\n }\n}\n\nexport function parseNodeAttributes(node) {\n const attributes = {}\n\n if (node && node.attributes) {\n for (const { name, value } of node.attributes) {\n if (name !== 'class' && name !== 'style') {\n attributes[name] = value\n }\n }\n }\n\n return Object.keys(attributes).length ? attributes : null\n}\n\nexport function extendsFromTag(props) {\n const extend = []\n\n const tag = (props.tag ?? 'div').toLowerCase()\n\n if (tag === 'a') {\n extend.push('Link')\n }\n\n const validTags = [\n 'input',\n 'button',\n 'img',\n 'span',\n 'strong',\n 'section',\n 'picture',\n 'form',\n 'dialog',\n 'p',\n 'hr',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'footer',\n 'progress',\n 'select',\n 'textarea',\n 'aside',\n 'pre',\n 'code',\n 'svg',\n 'label',\n 'hgroup'\n ]\n\n if (validTags.includes(tag)) {\n extend.push(capitalize(tag))\n }\n\n return extend\n}\n\n/**\n * @param {HTMLElement} node\n * @param {CSSStyleDeclaration} rootStyles\n * @returns\n */\nexport async function parseElement(node, rootStyles) {\n const tag = node.tagName.toLowerCase()\n const defaults = getStyleDefaultsFromEmptyNode(tag)\n\n const settings = await getSettings()\n\n const [sheets, conditionalSheets] =\n settings.useStylesheets ?? true\n ? getAllAppliedSheetStyles(node, defaults)\n : {}\n const computed = settings.useComputed\n ? getAppliedComputedStyles(node, defaults)\n : {}\n\n const rawStyles = {\n ...sheets,\n ...computed\n }\n\n let rootVars = extractRootVars(rawStyles, rootStyles)\n\n const camelCased = convertKeysToCamelCase(rawStyles)\n\n // Process all conditional styles updating both variables as well as resulting props/styles\n const camelCasedConditionals = {}\n Object.entries(conditionalSheets).forEach(([query, cSheet]) => {\n rootVars = { ...extractRootVars(cSheet, rootStyles), ...rootVars }\n\n const { props, style } = splitPropsFromStyles(\n convertKeysToCamelCase(cSheet)\n )\n camelCasedConditionals[query] = {}\n if (Object.keys(props).length) {\n camelCasedConditionals[query] = props\n }\n\n if (Object.keys(style).length) {\n camelCasedConditionals[query].style = style\n }\n })\n\n let props = { ...rootVars }\n if (tag !== 'div') {\n props.tag = tag\n }\n\n const { props: styleProps, style } = splitPropsFromStyles(\n consolidateStyles(camelCased)\n )\n props = { ...props, ...styleProps }\n\n const text = getNodeText(node)\n\n let children = []\n const childPromises = []\n\n if (node.children.length > 0) {\n const ignore = ['STYLE', 'SCRIPT']\n\n for (const childNode of node.children) {\n if (!ignore.includes(childNode.tagName)) {\n if (childNode.tagName === 'svg') {\n const html = childNode.innerHTML\n const attr = parseNodeAttributes(childNode)\n\n children.push({\n extend: ['Svg'],\n attr,\n props: { html }\n })\n } else {\n childPromises.push(parseElement(childNode, rootStyles))\n }\n }\n }\n }\n\n const results = await Promise.all(childPromises)\n children = [...children, ...results]\n\n // check all children for shared props and hoist them to childProps\n let childProps = null\n if (children.length > 1) {\n childProps = cleanSharedProperties(children)\n // remove shared props from each child\n Object.keys(childProps).forEach((key) => {\n children.forEach((child) => delete child.props[key])\n })\n }\n\n const attr = parseNodeAttributes(node)\n // process attributes of specific tags to props\n const copyAttrFromThese = ['a', 'img', 'input', 'button', 'iframe']\n if (attr && copyAttrFromThese.includes(tag)) {\n Object.keys(attr).forEach((prop) => {\n props[prop] = attr[prop]\n delete attr[prop]\n })\n }\n\n // fix relative src for images\n if (tag === 'img' && props.src && props.src.startsWith('/')) {\n props.src = window.location.origin + props.src\n }\n\n if (tag === 'a' && props.href && props.href.startsWith('/')) {\n props.href = window.location.origin + props.href\n }\n\n const extend = extendsFromTag(props)\n if (extend.length === 1) {\n delete props.tag\n }\n\n if (props.display === 'flex') {\n props = consolidateFlexCSS(props)\n delete props.display\n extend.push('Flex')\n }\n\n if (props.display === 'grid') {\n props = consolidateGridCSS(props)\n delete props.display\n extend.push('Grid')\n }\n\n let element = {\n props: { ...props }\n }\n\n if (Object.keys(style).length) {\n element.props.style = style\n }\n\n if (Object.keys(camelCasedConditionals).length) {\n element.props = { ...element.props, ...camelCasedConditionals }\n }\n\n if (text) {\n element.props.text = text\n }\n\n if (attr && Object.keys(attr).length) {\n element.props.attr = attr\n }\n\n if (extend.length) {\n element.extend = extend\n }\n\n if (children.length) {\n if (childProps && Object.keys(childProps).length) {\n element.props.childProps = childProps\n }\n\n element = { ...element, ...reformatChildren(children) }\n } else if (childProps) {\n console.warn('childProps without children')\n }\n\n return element\n}\n", "import { parseElement } from './grabber/parse'\n\n// ============================================================\n// DOMQL Inspector: inject page-agent for DevTools panel access\n// ============================================================\nfunction injectPageAgent () {\n const script = document.createElement('script')\n script.src = chrome.runtime.getURL('page-agent.js')\n script.onload = () => script.remove()\n ;(document.head || document.documentElement).appendChild(script)\n}\n\ninjectPageAgent()\n\n// ============================================================\n// Symbols Grabber: click-to-capture element mode\n// ============================================================\nasync function addToLibrary (node) {\n const rootStyles = window.getComputedStyle(document.documentElement)\n const obj = await parseElement(node, rootStyles)\n\n const store = { domqlStr: JSON.stringify(obj) }\n console.log('%c[Symbols] saving domql', 'color: green', store)\n\n chrome.storage.local.set(store)\n chrome.runtime.sendMessage({ type: 'open_platform' })\n\n return obj\n}\n\nconst focusNodeClass = 'symbols-grabber-hovered'\nlet isListenerActive = false\nlet focusedNode = null\n\ndocument.body.addEventListener(\n 'mouseover',\n (event) => {\n const { target } = event\n if (target && isListenerActive) {\n if (focusedNode && focusedNode !== target) {\n focusedNode.classList.remove(focusNodeClass)\n }\n focusedNode = target\n focusedNode.classList.add(focusNodeClass)\n }\n },\n true\n)\n\nchrome.runtime.onMessage.addListener((msg, sender, respond) => {\n if (sender.id === chrome.runtime.id) {\n const { type, state } = msg\n\n if (type === 'toggle' && typeof state === 'number') {\n console.log(\n `%c[Symbols] grabber ${state ? 'enabled' : 'disabled'}`,\n `color: ${state ? 'green' : 'red'}`\n )\n\n isListenerActive = Boolean(state)\n document.body.classList.toggle('symbols-grabber-active', isListenerActive)\n\n if (!state) {\n document.querySelectorAll(`.${focusNodeClass}`).forEach((el) => {\n el.classList.remove(focusNodeClass)\n })\n focusedNode = null\n }\n\n document.body.addEventListener(\n 'click',\n (event) => {\n const { target } = event\n if (target && isListenerActive) {\n event.preventDefault()\n event.stopImmediatePropagation()\n\n if (target.classList.contains(focusNodeClass)) {\n target.classList.remove(focusNodeClass)\n }\n\n addToLibrary(target).then(\n (domql) => {\n target.classList.add(focusNodeClass)\n respond({ success: true, domql })\n },\n (error) => {\n console.error('[Symbols] error adding to library', error)\n respond({ success: false, error: error.message || error })\n }\n )\n\n isListenerActive = false\n }\n },\n { capture: true, once: true }\n )\n }\n }\n\n return true\n})\n\nconsole.log('[Symbols] Content script loaded (inspector + grabber)')\n"],
5
+ "mappings": ";AAIA,IAAMA,UAAS;AACf,IAAMC,YAAoBD,QAAQ;;;ACuB3B,IAAM,YAAY,SAAO;AAC9B,SACE,OAAOE,YAAW,gBACjB,eAAeA,QAAO,QACrB,eAAeA,QAAO,UACtB,QAAQA,WACR,QAAQ;AAEd;;;ACvBO,IAAM,aAAa,SAAO,OAAO,QAAQ;AAIzC,IAAM,SAAS,SAAO,QAAQ;AAE9B,IAAM,UAAU,SAAO,MAAM,QAAQ,GAAG;AAIxC,IAAM,eAAe,SAAO;AACjC,MAAI,QAAQ,KAAM,QAAO;AAEzB,SAAO,OAAO,QAAQ;AACxB;AAiBO,IAAM,cAAc,SAAO;AAChC,SAAO,QAAQ;AACjB;;;ACLO,IAAM,aAAa,CAAC,KAAK,UAAU,CAAC,MAAM;AAC/C,SAAO,IAAI;AAAA,IACT,CAAC,GAAG,MAAM,UAAU,GAAG,UAAU,GAAG,EAAE,QAAQ,CAAC,GAAG,OAAO;AAAA,IACzD,CAAC;AAAA,EACH;AACF;;;ACiCO,IAAM,YAAY,CACvB,SACA,QACA,cAAc,CAAC,GACf,QAAQ,aACL;AACH,aAAW,KAAK,QAAQ;AACtB,UAAM,iBAAiB,OAAO,UAAU,eAAe,KAAK,QAAQ,CAAC;AACrE,QAAI,CAAC,kBAAkB,YAAY,SAAS,CAAC,KAAK,EAAE,WAAW,IAAI;AACjE;AACF,UAAM,cAAc,QAAQ,CAAC;AAC7B,UAAM,aAAa,OAAO,CAAC;AAC3B,QAAI,aAAa,WAAW,KAAK,aAAa,UAAU,GAAG;AAEzD,UAAI,QAAQ,GAAG;AACb,kBAAU,aAAa,YAAY,aAAa,QAAQ,CAAC;AAAA,MAC3D,OAAO;AACL,mBAAW,KAAK,YAAY;AAC1B,cAAI,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A,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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9B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT,CAAC;AAED,QAAQ,IAAI,uDAAuD;",
6
+ "names": ["window", "document", "window", "window", "props", "style", "attr"]
7
+ }
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head><meta charset="UTF-8"></head>
4
+ <body>
5
+ <script src="devtools.js"></script>
6
+ </body>
7
+ </html>
@@ -0,0 +1,5 @@
1
+ chrome.devtools.panels.create('Symbols', null, 'panel.html', panel => {
2
+ panel.onShown.addListener(win => {
3
+ win.panelShown()
4
+ })
5
+ })
@@ -0,0 +1,87 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "name": "Symbols Connect",
4
+ "version": "3.2.6",
5
+ "description": "symbols.app connect — DOMQL Inspector and element grabber for the Symbols design system",
6
+ "permissions": [
7
+ "scripting",
8
+ "tabs",
9
+ "activeTab",
10
+ "storage",
11
+ "declarativeNetRequest"
12
+ ],
13
+ "host_permissions": [
14
+ "<all_urls>"
15
+ ],
16
+ "icons": {
17
+ "48": "assets/48x48.png",
18
+ "144": "assets/144x144.png"
19
+ },
20
+ "action": {
21
+ "default_icon": {
22
+ "48": "assets/48x48.png",
23
+ "72": "assets/72x72.png",
24
+ "144": "assets/144x144.png"
25
+ },
26
+ "default_title": "Symbols Connect"
27
+ },
28
+ "background": {
29
+ "service_worker": "service_worker.js"
30
+ },
31
+ "devtools_page": "devtools.html",
32
+ "options_page": "settings.html",
33
+ "commands": {
34
+ "toggleGrabber": {
35
+ "suggested_key": {
36
+ "default": "Ctrl+E",
37
+ "mac": "Command+E"
38
+ },
39
+ "description": "Toggle grabber mode"
40
+ }
41
+ },
42
+ "content_scripts": [
43
+ {
44
+ "matches": [
45
+ "https://*/*",
46
+ "http://*/*"
47
+ ],
48
+ "exclude_globs": [
49
+ "https://symbols.app/*",
50
+ "https://platform.symbo.ls/*"
51
+ ],
52
+ "js": [
53
+ "content.js"
54
+ ],
55
+ "run_at": "document_end",
56
+ "all_frames": true
57
+ },
58
+ {
59
+ "matches": [
60
+ "https://*/*",
61
+ "http://*/*"
62
+ ],
63
+ "css": [
64
+ "content.css"
65
+ ],
66
+ "run_at": "document_end",
67
+ "all_frames": true
68
+ }
69
+ ],
70
+ "web_accessible_resources": [
71
+ {
72
+ "resources": [
73
+ "page-agent.js",
74
+ "picker.html"
75
+ ],
76
+ "matches": [
77
+ "<all_urls>"
78
+ ]
79
+ }
80
+ ],
81
+ "externally_connectable": {
82
+ "matches": [
83
+ "https://symbols.app/*",
84
+ "https://platform.symbo.ls/*"
85
+ ]
86
+ }
87
+ }