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CA,SAAuBD,IACrBF,EAAiBE,EAAW,IAG9BxC,OAAO0C,iBAAiB,WAAWC,IAE7BA,EAAMnF,QAAUwC,QAIhB2C,EAAMC,KAAKjD,MAA2B,qCAAnBgD,EAAMC,KAAKjD,MAChC2C,GAAiB,UACnB,IACC,GAaHtC,OAAO6C,cAAgB,KACrBN,EAAW,CACTO,UAAU,IAEL,mBAGF,CACLP,aACAxH,WAAYsH,EAEhB,CAGkBU,GAChB,OAAO,QAAkBb,EAAec,SAAU,CAChDlG,MAAOjC,EAEHoI,eACF,OAAOb,EAAMa,QACf,GAGJ,CACO,SAASC,IACd,MAAMrI,GAAU,QAAWqH,GAE3B,IAAKrH,EACH,MAAM,IAAIsI,MAAM,mCAGlB,OAAOtI,CACT,C,wBChEO,SAASuI,EAAYC,GAC1B,MAAOC,EAAc3E,GAAM0E,EAAOtF,MAAM,MAExC,IAAKuF,IAAiB3E,EACpB,MAAM,IAAIwE,MAAM,4BAGlB,MAAO,CAACG,EAAc3E,EACxB,C,uDCRO,SAAS4E,IAGhB,C","sources":["webpack:///../node_modules/@locator/runtime/dist/functions/bannerClasses.js","webpack:///../node_modules/@locator/runtime/dist/functions/linkTemplateUrl.js","webpack:///../node_modules/@locator/runtime/dist/functions/buildLink.js","webpack:///../node_modules/@locator/runtime/dist/functions/evalTemplate.js","webpack:///../node_modules/@locator/runtime/dist/functions/transformPath.js","webpack:///../node_modules/@locator/runtime/dist/functions/cropPath.js","webpack:///../node_modules/@locator/runtime/dist/functions/deduplicateLabels.js","webpack:///../node_modules/@locator/runtime/dist/functions/getReferenceId.js","webpack:///../node_modules/@locator/runtime/dist/functions/getUsableName.js","webpack:///../node_modules/@locator/runtime/dist/functions/goTo.js","webpack:///../node_modules/@locator/runtime/dist/functions/isCombinationModifiersPressed.js","webpack:///../node_modules/@locator/runtime/dist/functions/isExtension.js","webpack:///../node_modules/@locator/runtime/dist/functions/isLocatorsOwnElement.js","webpack:///../node_modules/@locator/runtime/dist/functions/mergeRects.js","webpack:///../node_modules/@locator/runtime/dist/functions/nonNullable.js","webpack:///../node_modules/@locator/runtime/dist/functions/optionsStore.js","webpack:///../node_modules/@locator/runtime/dist/functions/parseDataId.js","webpack:///../node_modules/@locator/runtime/dist/functions/trackClickStats.js"],"sourcesContent":["export function bannerClasses() {\n return \"fixed left-3 bottom-3 bg-white shadow-lg rounded-lg py-3 px-3 border-2 border-red-500 transition-all pointer-events-auto\";\n}","export const getLinkTypeOrTemplate = (targets, options, localLinkTypeOrTemplate) => localLinkTypeOrTemplate || options.getOptions().templateOrTemplateId || document.documentElement.dataset.locatorTarget || Object.entries(targets)[0][0];\nexport function linkTemplateUrl(targets, options, localLinkTypeOrTemplate) {\n const templateOrType = getLinkTypeOrTemplate(targets, options, localLinkTypeOrTemplate);\n const target = targets[templateOrType];\n\n if (target) {\n return target.url;\n }\n\n return templateOrType;\n}","import { linkTemplateUrl } from \"./linkTemplateUrl\";\nimport { evalTemplate } from \"./evalTemplate\";\nimport { transformPath } from \"./transformPath\";\nlet internalProjectPath = null;\nexport function setInternalProjectPath(projectPath) {\n internalProjectPath = projectPath;\n}\nexport function getSavedProjectPath(options) {\n return options.getOptions().projectPath || internalProjectPath;\n}\nexport function buildLink(linkProps, targets, options, localLinkTypeOrTemplate) {\n const params = {\n filePath: linkProps.filePath,\n projectPath: getSavedProjectPath(options) || linkProps.projectPath,\n line: String(linkProps.line),\n column: String(linkProps.column)\n };\n const template = linkTemplateUrl(targets, options, localLinkTypeOrTemplate);\n const replacePathObj = options.getOptions().replacePath;\n let evaluated = evalTemplate(template, params);\n\n if (replacePathObj) {\n evaluated = transformPath(evaluated, replacePathObj.from, replacePathObj.to);\n }\n\n return evaluated;\n}\nexport function buildLinkFromSource(source, targets, options) {\n return buildLink({\n filePath: source.fileName,\n projectPath: source.projectPath || \"\",\n line: source.lineNumber,\n column: source.columnNumber || 0\n }, targets, options);\n}","export function evalTemplate(str, params) {\n let newStr = str;\n Object.entries(params).forEach(([key, value]) => {\n newStr = newStr.replace(\"${\" + key + \"}\", value);\n });\n return newStr;\n}","export function transformPath(path, from, to) {\n try {\n return path.replace(new RegExp(`${from}`), to);\n } catch (e) {\n return path;\n }\n}","export default function cropPath(fullPath) {\n const array = fullPath.split(\"/\");\n const newPath = array.slice(Math.max(array.length - 3, 0), array.length).join(\"/\");\n\n if (newPath !== fullPath) {\n return `.../${newPath}`;\n } else {\n return newPath;\n }\n}","import nonNullable from \"./nonNullable\";\nexport function deduplicateLabels(labels) {\n const labelsIds = {};\n return labels.map(label => {\n const id = JSON.stringify(label);\n\n if (labelsIds[id]) {\n return null;\n }\n\n labelsIds[id] = true;\n return label;\n }).filter(nonNullable);\n}","const map = new WeakMap();\nlet lastId = 0;\nexport function getReferenceId(ref) {\n if (!map.has(ref)) {\n lastId++;\n map.set(ref, lastId);\n }\n\n return map.get(ref);\n}","// function printDebugOwnerTree(fiber: Fiber): string | null {\n// let current: Fiber | null = fiber || null;\n// let results = [];\n// while (current) {\n// results.push(getUsableName(current));\n// current = current._debugOwner || null;\n// }\n// console.log('DEBUG OWNER: ', results);\n// return null;\n// }\n// function printReturnTree(fiber: Fiber): string | null {\n// let current: Fiber | null = fiber || null;\n// let results = [];\n// while (current) {\n// results.push(getUsableName(current));\n// current = current.return || null;\n// }\n// console.log('RETURN: ', results);\n// return null;\n// }\nexport function getUsableName(fiber) {\n if (!fiber) {\n return \"Not found\";\n }\n\n if (typeof fiber.elementType === \"string\") {\n return fiber.elementType;\n }\n\n if (!fiber.elementType) {\n return \"Anonymous\";\n }\n\n if (fiber.elementType.name) {\n return fiber.elementType.name;\n } // Not sure about this\n\n\n if (fiber.elementType.displayName) {\n return fiber.elementType.displayName;\n } // Used in rect.memo\n\n\n if (fiber.elementType.type?.name) {\n return fiber.elementType.type.name;\n }\n\n if (fiber.elementType._payload?._result?.name) {\n return fiber.elementType._payload._result.name;\n }\n\n return \"Anonymous\";\n}","import { buildLinkFromSource, buildLink } from \"./buildLink\";\nimport { HREF_TARGET } from \"../consts\";\nexport function goTo(link, options) {\n window.open(link, options.getOptions().hrefTarget);\n}\nexport function goToLinkProps(linkProps, targets, options) {\n const link = buildLink(linkProps, targets, options);\n window.open(link, options.getOptions().hrefTarget || HREF_TARGET);\n}\nexport function goToSource(source, targets, options) {\n return goTo(buildLinkFromSource(source, targets, options), options);\n}","export function getMouseModifiers() {\n const mouseModifiers = document.documentElement.dataset.locatorMouseModifiers || \"alt\";\n const mouseModifiersArray = mouseModifiers.split(\"+\");\n const modifiers = {};\n mouseModifiersArray.forEach(modifier => {\n modifiers[modifier] = true;\n }, {});\n return modifiers;\n}\nexport function isCombinationModifiersPressed(e) {\n const modifiers = getMouseModifiers();\n return e.altKey == !!modifiers.alt && e.ctrlKey == !!modifiers.ctrl && e.metaKey == !!modifiers.meta && e.shiftKey == !!modifiers.shift;\n}","export function isExtension() {\n return typeof document !== \"undefined\" ? !!document.querySelector(\".locatorjs-extension-script\") : false;\n}","export function isLocatorsOwnElement(element) {\n return element.className == \"locatorjs-label\" || element.id == \"locatorjs-labels-section\" || element.id == \"locatorjs-layer\" || element.id == \"locatorjs-wrapper\" || element.matches(\"#locatorjs-wrapper *\");\n}","export function mergeRects(a, b) {\n const x = Math.min(a.x, b.x);\n const y = Math.min(a.y, b.y);\n return {\n x,\n y,\n width: Math.max(a.x + a.width, b.x + b.width) - x,\n height: Math.max(a.y + a.height, b.y + b.height) - y\n };\n}","export default function nonNullable(value) {\n return value !== null && value !== undefined;\n}","import { createComponent as _$createComponent } from \"solid-js/web\";\nimport { createContext, createSignal, useContext } from \"solid-js\";\nimport { getStoredOptions, listenOnOptionsChanges, setStoredOptions } from \"@locator/shared\";\nexport function initOptions() {\n const [signalOptions, setSignalOptions] = createSignal(getStoredOptions()); // This listens on localStorage changes, but the changes go only from scripts other than the current one and current one's content scripts\n\n listenOnOptionsChanges(newOptions => {\n setSignalOptions(newOptions);\n }); // This listens only on changes from the contents script for this current page\n\n window.addEventListener(\"message\", event => {\n // We only accept messages from ourselves\n if (event.source != window) {\n return;\n }\n\n if (event.data.type && event.data.type == \"LOCATOR_EXTENSION_UPDATED_OPTIONS\") {\n setSignalOptions(getStoredOptions());\n }\n }, false);\n\n function setOptions(newOptions) {\n const savedOptions = getStoredOptions();\n const optionsToSave = { ...savedOptions,\n ...newOptions\n };\n setStoredOptions(optionsToSave);\n setSignalOptions(optionsToSave);\n } // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n\n\n window.enableLocator = () => {\n setOptions({\n disabled: false\n });\n return \"Locator enabled\";\n };\n\n return {\n setOptions,\n getOptions: signalOptions\n };\n}\nconst OptionsContext = createContext();\nexport function OptionsProvider(props) {\n const options = initOptions();\n return _$createComponent(OptionsContext.Provider, {\n value: options,\n\n get children() {\n return props.children;\n }\n\n });\n}\nexport function useOptions() {\n const options = useContext(OptionsContext);\n\n if (!options) {\n throw new Error(\"Options context is not provided\");\n }\n\n return options;\n}","export function parseDataId(dataId) {\n const [fileFullPath, id] = dataId.split(\"::\");\n\n if (!fileFullPath || !id) {\n throw new Error(\"locatorjsId is malformed\");\n }\n\n return [fileFullPath, id];\n}","export function trackClickStats() {// NOTE: we don't need tracking now\n // const current = Number(document.head.dataset.locatorClickCount) || 0;\n // document.head.dataset.locatorClickCount = String(current + 1);\n}"],"names":["bannerClasses","getLinkTypeOrTemplate","targets","options","localLinkTypeOrTemplate","getOptions","templateOrTemplateId","document","documentElement","dataset","locatorTarget","Object","entries","internalProjectPath","setInternalProjectPath","projectPath","getSavedProjectPath","buildLink","linkProps","params","filePath","line","String","column","template","templateOrType","target","url","linkTemplateUrl","replacePathObj","replacePath","evaluated","str","newStr","forEach","key","value","replace","evalTemplate","path","from","to","RegExp","e","transformPath","buildLinkFromSource","source","fileName","lineNumber","columnNumber","cropPath","fullPath","array","split","newPath","slice","Math","max","length","join","deduplicateLabels","labels","labelsIds","map","label","id","JSON","stringify","filter","WeakMap","lastId","getReferenceId","ref","has","set","get","getUsableName","fiber","elementType","name","displayName","type","_payload","_result","goTo","link","window","open","hrefTarget","goToLinkProps","goToSource","getMouseModifiers","mouseModifiersArray","locatorMouseModifiers","modifiers","modifier","isCombinationModifiersPressed","altKey","alt","ctrlKey","ctrl","metaKey","meta","shiftKey","shift","isExtension","querySelector","isLocatorsOwnElement","element","className","matches","mergeRects","a","b","x","min","y","width","height","nonNullable","OptionsContext","OptionsProvider","props","signalOptions","setSignalOptions","setOptions","newOptions","optionsToSave","addEventListener","event","data","enableLocator","disabled","initOptions","Provider","children","useOptions","Error","parseDataId","dataId","fileFullPath","trackClickStats"],"sourceRoot":""}