@json-to-office/jto 0.5.2 → 0.5.3

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 (25) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/client/assets/{HomePage-BHudJJXa.js → HomePage-DJlT2M9Q.js} +3 -3
  3. package/dist/client/assets/{HomePage-BHudJJXa.js.map → HomePage-DJlT2M9Q.js.map} +1 -1
  4. package/dist/client/assets/{JsonEditorPage-BzytFOIB.js → JsonEditorPage-CUlhCM3Z.js} +3 -3
  5. package/dist/client/assets/{JsonEditorPage-BzytFOIB.js.map → JsonEditorPage-CUlhCM3Z.js.map} +1 -1
  6. package/dist/client/assets/{MonacoPluginProvider-C6nS0IdH.js → MonacoPluginProvider-BT8Rmjt0.js} +3 -3
  7. package/dist/client/assets/{MonacoPluginProvider-C6nS0IdH.js.map → MonacoPluginProvider-BT8Rmjt0.js.map} +1 -1
  8. package/dist/client/assets/{button-jugmEECt.js → button-DMYqGwZJ.js} +2 -2
  9. package/dist/client/assets/{button-jugmEECt.js.map → button-DMYqGwZJ.js.map} +1 -1
  10. package/dist/client/assets/editor-Cjfikke2.js +9 -0
  11. package/dist/client/assets/editor-Cjfikke2.js.map +1 -0
  12. package/dist/client/assets/{editor-monaco-json-xaZYbzKd.js → editor-monaco-json-CmHmtw8m.js} +3 -3
  13. package/dist/client/assets/editor-monaco-json-CmHmtw8m.js.map +1 -0
  14. package/dist/client/assets/{index--FzAuFyi.js → index-CyWrP8_G.js} +3 -3
  15. package/dist/client/assets/index-CyWrP8_G.js.map +1 -0
  16. package/dist/client/assets/preview-CqOfvXmU.js +3 -0
  17. package/dist/client/assets/preview-CqOfvXmU.js.map +1 -0
  18. package/dist/client/index.html +1 -1
  19. package/package.json +3 -3
  20. package/dist/client/assets/editor-BYU3Fxpi.js +0 -9
  21. package/dist/client/assets/editor-BYU3Fxpi.js.map +0 -1
  22. package/dist/client/assets/editor-monaco-json-xaZYbzKd.js.map +0 -1
  23. package/dist/client/assets/index--FzAuFyi.js.map +0 -1
  24. package/dist/client/assets/preview-BZSur397.js +0 -3
  25. package/dist/client/assets/preview-BZSur397.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-BYU3Fxpi.js","sources":["../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/utils/validators.js","../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/utils/definedErrors.js","../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/utils/deepClone.js","../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/utils/enums.js","../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/constrainedModel.js","../../../../../node_modules/.pnpm/constrained-editor-plugin@1.4.0/node_modules/constrained-editor-plugin/dist/esm/constrainedEditor.js","../../../src/client/components/json-editor/editor-monaco-theme.tsx","../../../src/client/components/playground/editor-tabs-content.tsx","../../../src/client/utils/retry.ts","../../../src/client/components/playground/editor.tsx"],"sourcesContent":["const validators = {\n initWith: function (monaco) {\n const dummyDiv = document.createElement('div');\n const dummyEditorInstance = monaco.editor.create(dummyDiv);\n const editorInstanceConstructorName = dummyEditorInstance.constructor.name;\n const editorModelConstructorName = dummyEditorInstance.getModel().constructor.name;\n const instanceCheck = function (valueToValidate) {\n return valueToValidate.constructor.name === editorInstanceConstructorName;\n }\n const modelCheck = function (valueToValidate) {\n return valueToValidate.constructor.name === editorModelConstructorName;\n }\n const rangesCheck = function (ranges) {\n if (Array.isArray(ranges)) {\n return ranges.every(function (rangeObj) {\n if (typeof rangeObj === 'object' && rangeObj.constructor.name === 'Object') {\n if (!rangeObj.hasOwnProperty('range')) return false;\n if (!Array.isArray(rangeObj.range)) return false;\n if (rangeObj.range.length !== 4) return false;\n if (!(rangeObj.range.every(num => num > 0 && parseInt(num) === num))) return false;\n if (rangeObj.hasOwnProperty('allowMultiline')) {\n if (typeof rangeObj.allowMultiline !== 'boolean') return false;\n }\n if (rangeObj.hasOwnProperty('label')) {\n if (typeof rangeObj.label !== 'string') return false;\n }\n if (rangeObj.hasOwnProperty('validate')) {\n if (typeof rangeObj.validate !== 'function') return false;\n }\n return true;\n }\n return false;\n });\n }\n return false;\n }\n return {\n isInstanceValid: instanceCheck,\n isModelValid: modelCheck,\n isRangesValid: rangesCheck\n }\n }\n}\nexport default validators;","export const TypeMustBe = function (type, key, additional) {\n return 'The value for the ' + key + ' should be of type ' + (Array.isArray(type) ? type.join(' | ') : type) + '. ' + (additional || '')\n}\nconst definedErrors = {\n TypeMustBe : TypeMustBe\n};\nexport default definedErrors;","export const deepClone = (function () {\n const byPassPrimitives = function (value, callback) {\n if (typeof value !== 'object' || value === null) {\n return this.freeze ? Object.freeze(value) : value;\n }\n if (value instanceof Date) {\n return this.freeze ? Object.freeze(new Date(value)) : new Date(value);\n }\n return callback.call(this, value);\n }\n const cloneArray = function (array, callback) {\n const keys = Object.keys(array);\n const arrayClone = new Array(keys.length)\n for (let i = 0; i < keys.length; i++) {\n arrayClone[keys[i]] = byPassPrimitives.call(this, array[keys[i]], callback);\n }\n return arrayClone;\n }\n const cloner = function (object) {\n return byPassPrimitives.call(this, object, function (object) {\n if (Array.isArray(object)) {\n return cloneArray.call(this, object, cloner)\n }\n const clone = {};\n for (let key in object) {\n if (!this.withProto && Object.hasOwnProperty.call(object, key) === false) {\n continue;\n }\n clone[key] = byPassPrimitives.call(this, object[key], cloner);\n }\n return clone;\n })\n }\n const config = (function () {\n const constructOptionForCode = function (value) {\n const options = [\n 'withProto',\n 'freeze'\n ]\n this[value] = options.reduce(function (acc, option) {\n if (acc[option] = (value >= this[option])) {\n value -= this[option]\n }\n return acc;\n }.bind(this), {})\n }\n const codes = Object.create(Object.defineProperties({}, {\n withProto: { value: 1 },\n freeze: { value: 2 }\n }));\n for (let i = 0; i <= 3; i++) {\n constructOptionForCode.call(codes, i);\n }\n return codes;\n }());\n const methods = {\n withProto: cloner.bind(config[1]),\n andFreeze: cloner.bind(config[2]),\n withProtoAndFreeze: cloner.bind(config[3])\n }\n const API = cloner.bind(config[0]);\n for (let methodName in methods) {\n Object.defineProperty(API, methodName, {\n enumerable: false,\n writable: false,\n configurable: false,\n value: methods[methodName]\n })\n }\n return API;\n}());\n\nexport default deepClone;","export const enums = {\n SINGLE_LINE_HIGHLIGHT_CLASS: 'editableArea--single-line',\n MULTI_LINE_HIGHLIGHT_CLASS: 'editableArea--multi-line'\n}\nexport default enums;","import deepClone from './utils/deepClone.js';\nimport enums from './utils/enums.js';\nexport const constrainedModel = function (model, ranges, monaco) {\n const rangeConstructor = monaco.Range;\n const sortRangesInAscendingOrder = function (rangeObject1, rangeObject2) {\n const rangeA = rangeObject1.range;\n const rangeB = rangeObject2.range;\n if (\n rangeA[0] < rangeB[0] ||\n (rangeA[0] === rangeB[0] && rangeA[3] < rangeB[1])\n ) {\n return -1;\n }\n }\n const normalizeRange = function (range, content) {\n const lines = content.split('\\n');\n const noOfLines = lines.length;\n const normalizedRange = [];\n range.forEach(function (value, index) {\n if (value === 0) {\n throw new Error('Range values cannot be zero');//No I18n\n }\n switch (index) {\n case 0: {\n if (value < 0) {\n throw new Error('Start Line of Range cannot be negative');//No I18n\n } else if (value > noOfLines) {\n throw new Error('Provided Start Line(' + value + ') is out of bounds. Max Lines in content is ' + noOfLines);//No I18n\n }\n normalizedRange[index] = value;\n }\n break;\n case 1: {\n let actualStartCol = value;\n const startLineNo = normalizedRange[0];\n const maxCols = lines[startLineNo - 1].length\n if (actualStartCol < 0) {\n actualStartCol = maxCols - Math.abs(actualStartCol);\n if (actualStartCol < 0) {\n throw new Error('Provided Start Column(' + value + ') is out of bounds. Max Column in line ' + startLineNo + ' is ' + maxCols);//No I18n\n }\n } else if (actualStartCol > (maxCols + 1)) {\n throw new Error('Provided Start Column(' + value + ') is out of bounds. Max Column in line ' + startLineNo + ' is ' + maxCols);//No I18n\n }\n normalizedRange[index] = actualStartCol;\n }\n break;\n case 2: {\n let actualEndLine = value;\n if (actualEndLine < 0) {\n actualEndLine = noOfLines - Math.abs(value);\n if (actualEndLine < 0) {\n throw new Error('Provided End Line(' + value + ') is out of bounds. Max Lines in content is ' + noOfLines);//No I18n\n }\n if (actualEndLine < normalizedRange[0]) {\n console.warn('Provided End Line(' + value + ') is less than the start Line, the Restriction may not behave as expected');//No I18n\n }\n } else if (value > noOfLines) {\n throw new Error('Provided End Line(' + value + ') is out of bounds. Max Lines in content is ' + noOfLines);//No I18n\n }\n normalizedRange[index] = actualEndLine;\n }\n break;\n case 3: {\n let actualEndCol = value;\n const endLineNo = normalizedRange[2];\n const maxCols = lines[endLineNo - 1].length\n if (actualEndCol < 0) {\n actualEndCol = maxCols - Math.abs(actualEndCol);\n if (actualEndCol < 0) {\n throw new Error('Provided End Column(' + value + ') is out of bounds. Max Column in line ' + endLineNo + ' is ' + maxCols);//No I18n\n }\n } else if (actualEndCol > (maxCols + 1)) {\n throw new Error('Provided Start Column(' + value + ') is out of bounds. Max Column in line ' + endLineNo + ' is ' + maxCols);//No I18n\n }\n normalizedRange[index] = actualEndCol;\n }\n break;\n }\n })\n return normalizedRange;\n }\n let restrictions = deepClone(ranges).sort(sortRangesInAscendingOrder);\n const prepareRestrictions = function (restrictions) {\n const content = model.getValue();\n restrictions.forEach(function (restriction, index) {\n const range = normalizeRange(restriction.range, content);\n const startLine = range[0];\n const startCol = range[1];\n const endLine = range[2];\n const endCol = range[3];\n restriction._originalRange = range.slice();\n restriction.range = new rangeConstructor(startLine, startCol, endLine, endCol);\n restriction.index = index;\n if (!restriction.allowMultiline) {\n restriction.allowMultiline = rangeConstructor.spansMultipleLines(restriction.range)\n }\n if (!restriction.label) {\n restriction.label = `[${startLine},${startCol} -> ${endLine}${endCol}]`;\n }\n });\n }\n const getCurrentEditableRanges = function () {\n return restrictions.reduce(function (acc, restriction) {\n acc[restriction.label] = {\n allowMultiline: restriction.allowMultiline || false,\n index: restriction.index,\n range: Object.assign({}, restriction.range),\n originalRange: restriction._originalRange.slice()\n };\n return acc;\n }, {});\n }\n const getValueInEditableRanges = function () {\n return restrictions.reduce(function (acc, restriction) {\n acc[restriction.label] = model.getValueInRange(restriction.range);\n return acc;\n }, {});\n }\n const updateValueInEditableRanges = function (object, forceMoveMarkers) {\n if (typeof object === 'object' && !Array.isArray(object)) {\n forceMoveMarkers = typeof forceMoveMarkers === 'boolean' ? forceMoveMarkers : false;\n const restrictionsMap = restrictions.reduce(function (acc, restriction) {\n if (restriction.label) {\n acc[restriction.label] = restriction;\n }\n return acc;\n }, {});\n for (let label in object) {\n const restriction = restrictionsMap[label];\n if (restriction) {\n const value = object[label];\n if (doesChangeHasMultilineConflict(restriction, value)) {\n throw new Error('Multiline change is not allowed for ' + label);\n }\n const newRange = deepClone(restriction.range);\n newRange.endLine = newRange.startLine + value.split('\\n').length - 1;\n newRange.endColumn = value.split('\\n').pop().length;\n if (isChangeInvalidAsPerUser(restriction, value, newRange)) {\n throw new Error('Change is invalidated by validate function of ' + label);\n }\n model.applyEdits([{\n forceMoveMarkers: !!forceMoveMarkers,\n range: restriction.range,\n text: value\n }]);\n } else {\n console.error('No restriction found for ' + label);\n }\n }\n } else {\n throw new Error('Value must be an object');//No I18n\n }\n }\n const disposeRestrictions = function () {\n model._restrictionChangeListener.dispose();\n window.removeEventListener(\"error\", handleUnhandledPromiseRejection);\n delete model.editInRestrictedArea;\n delete model.disposeRestrictions;\n delete model.getValueInEditableRanges;\n delete model.updateValueInEditableRanges;\n delete model.updateRestrictions;\n delete model.getCurrentEditableRanges;\n delete model.toggleHighlightOfEditableAreas;\n delete model._hasHighlight;\n delete model._isRestrictedModel;\n delete model._isCursorAtCheckPoint;\n delete model._currentCursorPositions;\n delete model._editableRangeChangeListener;\n delete model._restrictionChangeListener;\n delete model._oldDecorations;\n delete model._oldDecorationsSource;\n return model;\n }\n const isCursorAtCheckPoint = function (positions) {\n positions.some(function (position) {\n const posLineNumber = position.lineNumber;\n const posCol = position.column;\n const length = restrictions.length;\n for (let i = 0; i < length; i++) {\n const range = restrictions[i].range;\n if (\n (range.startLineNumber === posLineNumber && range.startColumn === posCol) ||\n (range.endLineNumber === posLineNumber && range.endColumn === posCol)\n ) {\n model.pushStackElement();\n return true;\n }\n }\n });\n };\n const addEditableRangeListener = function (callback) {\n if (typeof callback === 'function') {\n model._editableRangeChangeListener.push(callback);\n }\n };\n const triggerChangeListenersWith = function (currentChanges, allChanges) {\n const currentRanges = getCurrentEditableRanges();\n model._editableRangeChangeListener.forEach(function (callback) {\n callback.call(model, currentChanges, allChanges, currentRanges);\n });\n };\n const doUndo = function () {\n return Promise.resolve().then(function () {\n model.editInRestrictedArea = true;\n model.undo();\n model.editInRestrictedArea = false;\n if (model._hasHighlight && model._oldDecorationsSource) {\n // id present in the decorations info will be omitted by monaco\n // So we don't need to remove the old decorations id\n model.deltaDecorations(model._oldDecorations, model._oldDecorationsSource);\n model._oldDecorationsSource.forEach(function (object) {\n object.range = model.getDecorationRange(object.id);\n });\n }\n });\n };\n const updateRange = function (restriction, range, finalLine, finalColumn, changes, changeIndex) {\n let oldRangeEndLineNumber = range.endLineNumber;\n let oldRangeEndColumn = range.endColumn;\n restriction.prevRange = range;\n restriction.range = range.setEndPosition(finalLine, finalColumn);\n const length = restrictions.length;\n let changesLength = changes.length;\n const diffInCol = finalColumn - oldRangeEndColumn;\n const diffInRow = finalLine - oldRangeEndLineNumber;\n\n const cursorPositions = model._currentCursorPositions || [];\n const noOfCursorPositions = cursorPositions.length;\n // if (noOfCursorPositions > 0) {\n if (changesLength !== noOfCursorPositions) {\n changes = changes.filter(function (change) {\n const range = change.range;\n for (let i = 0; i < noOfCursorPositions; i++) {\n const cursorPosition = cursorPositions[i];\n if (\n (range.startLineNumber === cursorPosition.startLineNumber) &&\n (range.endLineNumber === cursorPosition.endLineNumber) &&\n (range.startColumn === cursorPosition.startColumn) &&\n (range.endColumn === cursorPosition.endColumn)\n ) {\n return true;\n }\n }\n return false;\n });\n changesLength = changes.length;\n }\n if (diffInRow !== 0) {\n for (let i = restriction.index + 1; i < length; i++) {\n const nextRestriction = restrictions[i];\n const nextRange = nextRestriction.range;\n if (oldRangeEndLineNumber === nextRange.startLineNumber) {\n nextRange.startColumn += diffInCol;\n }\n if (oldRangeEndLineNumber === nextRange.endLineNumber) {\n nextRange.endColumn += diffInCol;\n }\n nextRange.startLineNumber += diffInRow;\n nextRange.endLineNumber += diffInRow;\n nextRestriction.range = nextRange;\n }\n for (let i = changeIndex + 1; i < changesLength; i++) {\n const nextChange = changes[i];\n const rangeInChange = nextChange.range;\n const rangeAsString = rangeInChange.toString();\n const rangeMapValue = rangeMap[rangeAsString];\n delete rangeMap[rangeAsString];\n if (oldRangeEndLineNumber === rangeInChange.startLineNumber) {\n rangeInChange.startColumn += diffInCol;\n }\n if (oldRangeEndLineNumber === rangeInChange.endLineNumber) {\n rangeInChange.endColumn += diffInCol;\n }\n rangeInChange.startLineNumber += diffInRow;\n rangeInChange.endLineNumber += diffInRow;\n nextChange.range = rangeInChange;\n rangeMap[rangeInChange.toString()] = rangeMapValue;\n }\n } else {\n // Only Column might have changed\n for (let i = restriction.index + 1; i < length; i++) {\n const nextRestriction = restrictions[i];\n const nextRange = nextRestriction.range;\n if (nextRange.startLineNumber > oldRangeEndLineNumber) {\n break;\n } else {\n nextRange.startColumn += diffInCol;\n nextRange.endColumn += diffInCol;\n nextRestriction.range = nextRange;\n }\n }\n for (let i = changeIndex + 1; i < changesLength; i++) {\n // rangeMap\n const nextChange = changes[i];\n const rangeInChange = nextChange.range;\n const rangeAsString = rangeInChange.toString();\n const rangeMapValue = rangeMap[rangeAsString];\n delete rangeMap[rangeAsString];\n if (rangeInChange.startLineNumber > oldRangeEndLineNumber) {\n rangeMap[rangeInChange.toString()] = rangeMapValue;\n break;\n } else {\n rangeInChange.startColumn += diffInCol;\n rangeInChange.endColumn += diffInCol;\n nextChange.range = rangeInChange;\n rangeMap[rangeInChange.toString()] = rangeMapValue;\n }\n }\n }\n // }\n };\n const getInfoFrom = function (change, editableRange) {\n const info = {};\n const range = change.range;\n // Get State\n if (change.text === '') {\n info.isDeletion = true;\n } else if (\n (range.startLineNumber === range.endLineNumber) &&\n (range.startColumn === range.endColumn)\n ) {\n info.isAddition = true;\n } else {\n info.isReplacement = true;\n }\n // Get Position Of Range\n info.startLineOfRange = range.startLineNumber === editableRange.startLineNumber;\n info.startColumnOfRange = range.startColumn === editableRange.startColumn;\n\n info.endLineOfRange = range.endLineNumber === editableRange.endLineNumber;\n info.endColumnOfRange = range.endColumn === editableRange.endColumn;\n\n info.middleLineOfRange = !info.startLineOfRange && !info.endLineOfRange;\n\n // Editable Range Span\n if (editableRange.startLineNumber === editableRange.endLineNumber) {\n info.rangeIsSingleLine = true;\n } else {\n info.rangeIsMultiLine = true;\n }\n return info;\n };\n const updateRestrictions = function (ranges) {\n restrictions = deepClone(ranges).sort(sortRangesInAscendingOrder);\n prepareRestrictions(restrictions);\n };\n const toggleHighlightOfEditableAreas = function (cssClasses) {\n if (!model._hasHighlight) {\n const cssClassForSingleLine = cssClasses.cssClassForSingleLine ||enums.SINGLE_LINE_HIGHLIGHT_CLASS\n const cssClassForMultiLine = cssClasses.cssClassForMultiLine ||enums.MULTI_LINE_HIGHLIGHT_CLASS\n const decorations = restrictions.map(function (restriction) {\n const decoration = {\n range: restriction.range,\n options: {\n className: restriction.allowMultiline ?\n cssClassForMultiLine :\n cssClassForSingleLine\n }\n }\n if (restriction.label) {\n decoration.hoverMessage = restriction.label;\n }\n return decoration;\n });\n model._oldDecorations = model.deltaDecorations([], decorations);\n model._oldDecorationsSource = decorations.map(function (decoration, index) {\n return Object.assign({}, decoration, { id: model._oldDecorations[index] });\n });\n model._hasHighlight = true;\n } else {\n model.deltaDecorations(model._oldDecorations, []);\n delete model._oldDecorations;\n delete model._oldDecorationsSource;\n model._hasHighlight = false;\n }\n }\n const handleUnhandledPromiseRejection = function () {\n console.debug('handler for unhandled promise rejection');\n };\n const setAllRangesToPrev = function (rangeMap) {\n for (let key in rangeMap) {\n const restriction = rangeMap[key];\n restriction.range = restriction.prevRange;\n }\n };\n const doesChangeHasMultilineConflict = function (restriction, text) {\n return !restriction.allowMultiline && text.includes('\\n');\n };\n const isChangeInvalidAsPerUser = function (restriction, value, range) {\n return restriction.validate && !restriction.validate(value, range, restriction.lastInfo);\n }\n\n const manipulatorApi = {\n _isRestrictedModel: true,\n _isRestrictedValueValid: true,\n _editableRangeChangeListener: [],\n _isCursorAtCheckPoint: isCursorAtCheckPoint,\n _currentCursorPositions: []\n }\n\n prepareRestrictions(restrictions);\n model._hasHighlight = false;\n manipulatorApi._restrictionChangeListener = model.onDidChangeContent(function (contentChangedEvent) {\n const isUndoing = contentChangedEvent.isUndoing;\n model._isRestrictedValueValid = true;\n if (!(isUndoing && model.editInRestrictedArea)) {\n const changes = contentChangedEvent.changes.sort(sortRangesInAscendingOrder);\n const rangeMap = {};\n const length = restrictions.length;\n const isAllChangesValid = changes.every(function (change) {\n const editedRange = change.range;\n const rangeAsString = editedRange.toString();\n rangeMap[rangeAsString] = null;\n for (let i = 0; i < length; i++) {\n const restriction = restrictions[i];\n const range = restriction.range;\n if (range.containsRange(editedRange)) {\n if (doesChangeHasMultilineConflict(restriction, change.text)) {\n return false;\n }\n rangeMap[rangeAsString] = restriction;\n return true;\n }\n }\n return false;\n })\n if (isAllChangesValid) {\n changes.forEach(function (change, changeIndex) {\n const changedRange = change.range;\n const restriction = rangeMap[changedRange.toString()];\n const editableRange = restriction.range;\n const text = change.text || '';\n /**\n * Things to check before implementing the change\n * - A | D | R => Addition | Deletion | Replacement\n * - MC | SC => MultiLineChange | SingleLineChange\n * - SOR | MOR | EOR => Change Occured in - Start Of Range | Middle Of Range | End Of Range\n * - SSL | SML => Editable Range - Spans Single Line | Spans Multiple Line\n */\n const noOfLinesAdded = (text.match(/\\n/g) || []).length;\n const noOfColsAddedAtLastLine = text.split(/\\n/g).pop().length;\n\n const lineDiffInRange = changedRange.endLineNumber - changedRange.startLineNumber;\n const colDiffInRange = changedRange.endColumn - changedRange.startColumn;\n\n let finalLine = editableRange.endLineNumber;\n let finalColumn = editableRange.endColumn;\n\n let columnsCarriedToEnd = 0;\n if (\n (editableRange.endLineNumber === changedRange.startLineNumber) ||\n (editableRange.endLineNumber === changedRange.endLineNumber)\n ) {\n columnsCarriedToEnd += (editableRange.endColumn - changedRange.startColumn) + 1;\n }\n\n const info = getInfoFrom(change, editableRange);\n restriction.lastInfo = info;\n if (info.isAddition || info.isReplacement) {\n if (info.rangeIsSingleLine) {\n /**\n * Only Column Change has occurred , so regardless of the position of the change\n * Addition of noOfCols is enough\n */\n if (noOfLinesAdded === 0) {\n finalColumn += noOfColsAddedAtLastLine;\n } else {\n finalLine += noOfLinesAdded;\n if (info.startColumnOfRange) {\n finalColumn += noOfColsAddedAtLastLine\n } else if (info.endColumnOfRange) {\n finalColumn = (noOfColsAddedAtLastLine + 1)\n } else {\n finalColumn = (noOfColsAddedAtLastLine + columnsCarriedToEnd)\n }\n }\n }\n if (info.rangeIsMultiLine) {\n // Handling for Start Of Range is not required\n finalLine += noOfLinesAdded;\n if (info.endLineOfRange) {\n if (noOfLinesAdded === 0) {\n finalColumn += noOfColsAddedAtLastLine;\n } else {\n finalColumn = (columnsCarriedToEnd + noOfColsAddedAtLastLine);\n }\n }\n }\n }\n if (info.isDeletion || info.isReplacement) {\n if (info.rangeIsSingleLine) {\n finalColumn -= colDiffInRange;\n }\n if (info.rangeIsMultiLine) {\n if (info.endLineOfRange) {\n finalLine -= lineDiffInRange;\n finalColumn -= colDiffInRange;\n } else {\n finalLine -= lineDiffInRange;\n }\n }\n }\n updateRange(restriction, editableRange, finalLine, finalColumn, changes, changeIndex);\n });\n const values = model.getValueInEditableRanges();\n const currentlyEditedRanges = {};\n for (let key in rangeMap) {\n const restriction = rangeMap[key];\n const range = restriction.range;\n const rangeString = restriction.label || range.toString();\n const value = values[rangeString];\n if (isChangeInvalidAsPerUser(restriction, value, range)) {\n setAllRangesToPrev(rangeMap);\n doUndo();\n return; // Breaks the loop and prevents the triggerChangeListener\n }\n currentlyEditedRanges[rangeString] = value;\n }\n if (model._hasHighlight) {\n model._oldDecorationsSource.forEach(function (object) {\n object.range = model.getDecorationRange(object.id);\n });\n }\n triggerChangeListenersWith(currentlyEditedRanges, values);\n } else {\n doUndo();\n }\n } else if (model.editInRestrictedArea) {\n model._isRestrictedValueValid = false;\n }\n });\n window.onerror = handleUnhandledPromiseRejection;\n const exposedApi = {\n editInRestrictedArea: false,\n getCurrentEditableRanges: getCurrentEditableRanges,\n getValueInEditableRanges: getValueInEditableRanges,\n disposeRestrictions: disposeRestrictions,\n onDidChangeContentInEditableRange: addEditableRangeListener,\n updateRestrictions: updateRestrictions,\n updateValueInEditableRanges: updateValueInEditableRanges,\n toggleHighlightOfEditableAreas: toggleHighlightOfEditableAreas\n }\n for (let funcName in manipulatorApi) {\n Object.defineProperty(model, funcName, {\n enumerable: false,\n configurable: true,\n writable: true,\n value: manipulatorApi[funcName]\n })\n }\n for (let apiName in exposedApi) {\n Object.defineProperty(model, apiName, {\n enumerable: false,\n configurable: true,\n writable: true,\n value: exposedApi[apiName]\n })\n }\n return model;\n}\nexport default constrainedModel;","import validators from './utils/validators.js';\nimport { TypeMustBe } from './utils/definedErrors.js';\nimport constrainedModel from './constrainedModel.js';\n\nexport function constrainedEditor(monaco) {\n /**\n * Injected Dependencies\n */\n if (monaco === undefined) {\n throw new Error([\n \"Please pass the monaco global variable into function as\",\n \"(eg:)constrainedEditor({ range : monaco.range });\",\n ].join('\\n'));\n }\n /**\n *\n * @param {Object} editorInstance This should be the monaco editor instance.\n * @description This is the listener function to check whether the cursor is at checkpoints\n * (i.e) the point where editable and non editable portions meet\n */\n const listenerFn = function (editorInstance) {\n const model = editorInstance.getModel();\n if (model._isCursorAtCheckPoint) {\n const selections = editorInstance.getSelections();\n const positions = selections.map(function (selection) {\n return {\n lineNumber: selection.positionLineNumber,\n column: selection.positionColumn\n }\n });\n model._isCursorAtCheckPoint(positions);\n model._currentCursorPositions = selections;\n }\n }\n const _uriRestrictionMap = {};\n const { isInstanceValid, isModelValid, isRangesValid } = validators.initWith(monaco);\n /**\n *\n * @param {Object} editorInstance This should be the monaco editor instance\n * @returns {Boolean}\n */\n const initInEditorInstance = function (editorInstance) {\n if (isInstanceValid(editorInstance)) {\n let domNode = editorInstance.getDomNode();\n manipulator._listener = listenerFn.bind(API, editorInstance);\n manipulator._editorInstance = editorInstance;\n manipulator._editorInstance._isInDevMode = false;\n domNode.addEventListener('keydown', manipulator._listener, true);\n manipulator._onChangeModelDisposable = editorInstance.onDidChangeModel(function () {\n // domNode - refers old dom node\n domNode && domNode.removeEventListener('keydown', manipulator._listener, true)\n const newDomNode = editorInstance.getDomNode(); // Gets Current dom node\n newDomNode && newDomNode.addEventListener('keydown', manipulator._listener, true);\n domNode = newDomNode;\n })\n return true;\n } else {\n throw new Error(\n TypeMustBe(\n 'ICodeEditor',\n 'editorInstance',\n 'This type interface can be found in monaco editor documentation'\n )\n )\n }\n }\n /**\n *\n * @param {Object} model This should be the monaco editor model instance. Refer https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.itextmodel.html\n * @param {*} ranges This should be the array of range objects. Refer constrained editor plugin documentation\n * @returns model\n */\n const addRestrictionsTo = function (model, ranges) {\n if (isModelValid(model)) {\n if (isRangesValid(ranges)) {\n const modelToConstrain = constrainedModel(model, ranges, monaco, manipulator._editorInstance);\n _uriRestrictionMap[modelToConstrain.uri.toString()] = modelToConstrain;\n return modelToConstrain;\n } else {\n throw new Error(\n TypeMustBe(\n 'Array<RangeRestrictionObject>',\n 'ranges',\n 'Please refer constrained editor documentation for proper structure'\n )\n )\n }\n } else {\n throw new Error(\n TypeMustBe(\n 'ICodeEditor',\n 'editorInstance',\n 'This type interface can be found in monaco editor documentation'\n )\n )\n }\n }\n /**\n *\n * @param {Object} model This should be the monaco editor model instance. Refer https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.itextmodel.html\n * @returns {Boolean} True if the restrictions are removed\n */\n const removeRestrictionsIn = function (model) {\n if (isModelValid(model)) {\n const uri = model.uri.toString();\n const restrictedModel = _uriRestrictionMap[uri];\n if (restrictedModel) {\n return restrictedModel.disposeRestrictions();\n } else {\n console.warn('Current Model is not a restricted Model');\n return false;\n }\n } else {\n throw new Error(\n TypeMustBe(\n 'ICodeEditor',\n 'editorInstance',\n 'This type interface can be found in monaco editor documentation'\n )\n )\n }\n }\n /**\n *\n * @returns {Boolean} True if the constrainer is disposed\n */\n const disposeConstrainer = function () {\n if (manipulator._editorInstance) {\n const instance = manipulator._editorInstance;\n const domNode = instance.getDomNode();\n domNode && domNode.removeEventListener('keydown', manipulator._listener);\n manipulator._onChangeModelDisposable && manipulator._onChangeModelDisposable.dispose();\n delete manipulator._listener;\n delete manipulator._editorInstance._isInDevMode;\n delete manipulator._editorInstance._devModeAction;\n delete manipulator._editorInstance;\n delete manipulator._onChangeModelDisposable;\n for (let key in _uriRestrictionMap) {\n delete _uriRestrictionMap[key];\n }\n return true;\n }\n return false;\n }\n /**\n * @description This function used to make the developer to find the ranges of selected portions\n */\n const toggleDevMode = function () {\n if (manipulator._editorInstance._isInDevMode) {\n manipulator._editorInstance._isInDevMode = false;\n manipulator._editorInstance._devModeAction.dispose();\n delete manipulator._editorInstance._devModeAction;\n } else {\n manipulator._editorInstance._isInDevMode = true;\n manipulator._editorInstance._devModeAction = manipulator._editorInstance.addAction({\n id: 'showRange',\n label: 'Show Range in console',\n contextMenuGroupId: 'navigation',\n contextMenuOrder: 1.5,\n run: function (editor) {\n const selections = editor.getSelections();\n const ranges = selections.reduce(function (acc, { startLineNumber, endLineNumber, startColumn, endColumn }) {\n acc.push('range : ' + JSON.stringify([\n startLineNumber,\n startColumn,\n endLineNumber,\n endColumn\n ]));\n return acc;\n }, []).join('\\n');\n console.log(`Selected Ranges : \\n` + JSON.stringify(ranges, null, 2));\n }\n });\n }\n }\n\n /**\n * Main Function starts here\n */\n // @internal\n const manipulator = {\n /**\n * These variables should not be modified by external code\n * This has to be used for debugging and testing\n */\n _listener: null,\n _editorInstance: null,\n _uriRestrictionMap: _uriRestrictionMap,\n _injectedResources: monaco\n }\n const API = Object.create(manipulator);\n const exposedMethods = {\n /**\n * These functions are exposed to the user\n * These functions should be protected from editing\n */\n initializeIn: initInEditorInstance,\n addRestrictionsTo: addRestrictionsTo,\n removeRestrictionsIn: removeRestrictionsIn,\n disposeConstrainer: disposeConstrainer,\n toggleDevMode: toggleDevMode\n }\n for (let methodName in exposedMethods) {\n Object.defineProperty(API, methodName, {\n enumerable: false,\n writable: false,\n configurable: false,\n value: exposedMethods[methodName]\n })\n }\n return Object.freeze(API);\n}\n\nexport default constrainedEditor;\n","import React, { useCallback, useEffect, useRef } from 'react';\nimport { useTheme } from '../theme-provider';\nimport { constrainedEditor } from 'constrained-editor-plugin';\nimport MonacoEditor, { Monaco, DiffEditor } from '@monaco-editor/react';\nimport type { editor as MonacoEditorType } from 'monaco-editor';\nimport type { TextFile } from '../../lib/types';\nimport { validateThemeJson } from '../../lib/theme-validation';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { Button } from '../ui/button';\nimport { useEditorRefsStore } from '../../store/editor-refs-store';\nimport {\n getSelectionContext,\n createContextSnippet,\n} from '../../lib/monaco-selection-utils';\n\n/**\n * EditorMonacoTheme component for editing JSON theme files with schema validation\n */\nfunction EditorMonacoTheme({\n document,\n readOnly = false,\n onChange,\n}: {\n document: TextFile;\n readOnly?: boolean;\n onChange?: (value: string) => void;\n}) {\n const editorRef = useRef<MonacoEditorType.IStandaloneCodeEditor | null>(null);\n const monacoRef = useRef<Monaco | null>(null);\n const modelRef = useRef<MonacoEditorType.ITextModel | null>(null);\n const { theme } = useTheme();\n const [isReady, setIsReady] = React.useState(false);\n const pendingDiff = useDocumentsStore((s) => s.pendingDiffs[document.name]);\n const clearPendingDiff = useDocumentsStore((s) => s.clearPendingDiff);\n const saveDocument = useDocumentsStore((s) => s.saveDocument);\n const { registerEditor, unregisterEditor, setActiveEditor } =\n useEditorRefsStore();\n\n // Get resolved theme - convert 'system' to actual theme\n const resolvedTheme =\n theme === 'system'\n ? window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light'\n : theme;\n\n // Initialize Monaco editor\n const handleEditorWillMount = useCallback((monaco: Monaco) => {\n console.log('Monaco theme editor will mount');\n monacoRef.current = monaco;\n\n // Ensure global schemas (report + theme) are configured.\n // Don't call setDiagnosticsOptions here — it would clobber the global\n // config. The theme schema is already registered by configureMonacoInstance\n // and matched via defaultPath → fileMatch.\n\n setIsReady(true);\n }, []);\n\n // Handle editor mount\n const handleEditorMount = useCallback(\n (editor: MonacoEditorType.IStandaloneCodeEditor, monaco: Monaco) => {\n editorRef.current = editor;\n modelRef.current = editor.getModel();\n\n // Register editor in the refs store\n registerEditor(document.name, editor, monaco);\n setActiveEditor(document.name);\n\n // Enable constrained editing\n const constrainedInstance = constrainedEditor(monaco);\n const model = editor.getModel();\n if (model) {\n constrainedInstance.initializeIn(editor);\n }\n\n // Configure editor options\n editor.updateOptions({\n formatOnType: true,\n formatOnPaste: true,\n automaticLayout: true,\n minimap: { enabled: false },\n scrollBeyondLastLine: true,\n wordWrap: 'on',\n folding: true,\n foldingStrategy: 'indentation',\n suggest: {\n showColors: true,\n showConstants: true,\n showEnums: true,\n showFields: true,\n showFunctions: true,\n showKeywords: true,\n showModules: true,\n showProperties: true,\n showSnippets: true,\n showStructs: true,\n showTypeParameters: true,\n showUnits: true,\n showValues: true,\n showVariables: true,\n },\n });\n\n // Add keyboard shortcuts\n // Cmd+K => send selection to AI assistant\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, () => {\n const selection = getSelectionContext(editor, monaco);\n if (selection) {\n const snippet = createContextSnippet(selection);\n window.dispatchEvent(\n new CustomEvent('monaco-selection-to-ai', {\n detail: {\n documentName: document.name,\n selection,\n snippet,\n isTheme: true,\n },\n })\n );\n }\n });\n\n // Cmd+S => save command\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {\n // Save command - parent component handles this\n console.log('Save command triggered in theme editor');\n });\n\n // Add context menu action for AI assistant\n editor.addAction({\n id: 'send-theme-to-ai-assistant',\n label: 'Send to AI Assistant (⌘K)',\n contextMenuGroupId: 'navigation',\n contextMenuOrder: 1.5,\n keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK],\n run: function () {\n // Use the editor reference from closure instead of the parameter\n const selection = getSelectionContext(editor, monaco);\n if (selection) {\n const snippet = createContextSnippet(selection);\n // Dispatch event for the chat panel to capture\n window.dispatchEvent(\n new CustomEvent('monaco-selection-to-ai', {\n detail: {\n documentName: document.name,\n selection,\n snippet,\n isTheme: true,\n },\n })\n );\n }\n },\n });\n\n // Format document on mount\n setTimeout(() => {\n editor.getAction('editor.action.formatDocument')?.run();\n }, 100);\n\n console.log('Monaco theme editor mounted');\n },\n [document.name, registerEditor, setActiveEditor]\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n unregisterEditor(document.name);\n };\n }, [document.name, unregisterEditor]);\n\n // Handle content changes\n const handleChange = useCallback(\n (\n value: string | undefined,\n _event: MonacoEditorType.IModelContentChangedEvent\n ) => {\n if (value !== undefined && onChange) {\n onChange(value);\n }\n },\n [onChange]\n );\n\n // Validate theme content\n useEffect(() => {\n if (\n !editorRef.current ||\n !monacoRef.current ||\n !modelRef.current ||\n !isReady\n ) {\n return;\n }\n\n const monaco = monacoRef.current;\n const model = modelRef.current;\n\n // Clear existing markers\n monaco.editor.setModelMarkers(model, 'theme-validation', []);\n\n // Validate theme JSON\n const validationResult = validateThemeJson(document.text);\n if (!validationResult.valid && validationResult.errors) {\n const markers = validationResult.errors.map((error) => ({\n severity: monaco.MarkerSeverity.Error,\n startLineNumber: error.line || 1,\n startColumn: error.column || 1,\n endLineNumber: error.line || 1,\n endColumn: error.column || 1000,\n message: error.message,\n source: 'theme-validation',\n }));\n\n monaco.editor.setModelMarkers(model, 'theme-validation', markers);\n }\n }, [document.text, isReady]);\n\n // Update theme\n useEffect(() => {\n if (editorRef.current) {\n const newTheme = resolvedTheme === 'dark' ? 'vs-dark' : 'vs';\n editorRef.current.updateOptions({ theme: newTheme });\n }\n }, [resolvedTheme]);\n\n return (\n <div className=\"relative h-full\">\n {pendingDiff ? (\n <>\n <div className=\"flex items-center justify-between px-2 py-1 border-b bg-muted/40 text-xs\">\n <div>\n Review changes for{' '}\n <span className=\"font-medium\">{document.name}</span>\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => clearPendingDiff(document.name)}\n >\n Discard\n </Button>\n <Button\n size=\"sm\"\n onClick={() => {\n saveDocument(document.name, pendingDiff.modified);\n clearPendingDiff(document.name, true);\n }}\n >\n Apply Changes\n </Button>\n </div>\n </div>\n <DiffEditor\n height=\"calc(100% - 32px)\"\n original={pendingDiff.original}\n modified={pendingDiff.modified}\n language=\"json\"\n theme={resolvedTheme === 'dark' ? 'vs-dark' : 'vs'}\n options={{\n readOnly: true,\n renderSideBySide: true,\n originalEditable: false,\n automaticLayout: true,\n minimap: { enabled: false },\n }}\n beforeMount={handleEditorWillMount}\n />\n </>\n ) : (\n <MonacoEditor\n height=\"100%\"\n language=\"json\"\n defaultPath={document.name}\n value={document.text}\n theme={resolvedTheme === 'dark' ? 'vs-dark' : 'vs'}\n onChange={handleChange}\n beforeMount={handleEditorWillMount}\n onMount={handleEditorMount}\n options={{\n readOnly,\n lineNumbers: 'on',\n glyphMargin: true,\n folding: true,\n lineDecorationsWidth: 5,\n lineNumbersMinChars: 3,\n renderValidationDecorations: 'on',\n quickSuggestions: {\n other: true,\n comments: false,\n strings: true,\n },\n acceptSuggestionOnCommitCharacter: true,\n acceptSuggestionOnEnter: 'on',\n accessibilitySupport: 'auto',\n autoIndent: 'advanced',\n formatOnType: true,\n formatOnPaste: true,\n automaticLayout: true,\n minimap: { enabled: false },\n scrollBeyondLastLine: true,\n wordWrap: 'on',\n }}\n />\n )}\n </div>\n );\n}\n\nexport const EditorMonacoThemeMemoized = React.memo(EditorMonacoTheme);\n","import React from 'react';\nimport { EditorMonacoJsonMemoized } from '../json-editor/editor-monaco-json';\nimport { EditorMonacoThemeMemoized } from '../json-editor/editor-monaco-theme';\nimport { TabsContent } from '../ui/tabs';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useThemesStore } from '../../store/themes-store-provider';\nimport type { TextFile } from '../../lib/types';\nimport type { DocumentType } from '../../store/documents-store';\nimport debounce from 'lodash.debounce';\n\nfunction TabContent({\n name,\n text,\n buildError: _buildError,\n saveDocumentDebounceWait,\n documentType,\n}: {\n name: string;\n text: string;\n buildError?: string;\n saveDocumentDebounceWait: number;\n documentType: DocumentType;\n}) {\n const { saveDocument } = useDocumentsStore((state) => state);\n const { updateTheme } = useThemesStore((state) => state);\n\n // Create a debounced version of updateTheme\n const debouncedUpdateTheme = React.useMemo(\n () => debounce(updateTheme, saveDocumentDebounceWait),\n [updateTheme, saveDocumentDebounceWait]\n );\n\n // Flush pending theme updates on unmount so the themes store is always\n // up-to-date when the user switches away from a theme tab.\n React.useEffect(() => {\n return () => {\n debouncedUpdateTheme.flush();\n };\n }, [debouncedUpdateTheme]);\n\n const handleChange = React.useCallback(\n (value: string) => {\n saveDocument(name, value);\n\n // If this is a theme document, update the themes store with debouncing\n if (documentType === 'application/json+theme') {\n console.log(\n 'TabContent: Theme document change detected, debouncing update',\n {\n documentName: name,\n debounceWait: saveDocumentDebounceWait,\n }\n );\n debouncedUpdateTheme(name, value);\n }\n },\n [\n name,\n saveDocument,\n debouncedUpdateTheme,\n documentType,\n saveDocumentDebounceWait,\n ]\n );\n\n // Create a fake document object for the theme editor\n const document: TextFile = React.useMemo(\n () => ({\n name,\n type: 'application/json',\n text,\n mtime: new Date(),\n ctime: new Date(),\n atime: new Date(),\n }),\n [name, text]\n );\n\n return (\n <TabsContent\n value={name}\n className=\"mt-0 h-full p-0\"\n tabIndex={-1} // to prevent focus on Tab trigger (fix for accessibility size issue)\n >\n {documentType === 'application/json+theme' ? (\n <EditorMonacoThemeMemoized\n document={document}\n onChange={handleChange}\n />\n ) : (\n <EditorMonacoJsonMemoized\n name={name}\n value={text}\n saveDocumentDebounceWait={saveDocumentDebounceWait}\n />\n )}\n </TabsContent>\n );\n}\n\nconst TabContentMemoized = React.memo(TabContent);\n\nfunction EditorTabsContent({\n openTabs,\n documents,\n buildErrors,\n saveDocumentDebounceWait,\n}: {\n openTabs: string[];\n documents: TextFile[];\n buildErrors: Record<string, string>;\n saveDocumentDebounceWait: number;\n}) {\n const { documentTypes } = useDocumentsStore((state) => state);\n\n return openTabs\n .map((name) => documents.find((d) => d.name === name))\n .filter((doc): doc is TextFile => doc !== undefined)\n .map((doc) => {\n const documentType = documentTypes[doc.name] || 'application/json+report';\n\n return (\n <TabContentMemoized\n key={doc.name}\n name={doc.name}\n text={doc.text}\n buildError={buildErrors[doc.name]}\n saveDocumentDebounceWait={saveDocumentDebounceWait}\n documentType={documentType}\n />\n );\n });\n}\n\nexport const EditorTabsContentMemoized = React.memo(EditorTabsContent);\n","export interface RetryOptions {\n maxRetries?: number;\n initialDelay?: number;\n maxDelay?: number;\n backoffFactor?: number;\n onRetry?: (error: Error, attempt: number) => void;\n shouldRetry?: (error: Error) => boolean;\n signal?: AbortSignal;\n}\n\nexport class RetryError extends Error {\n constructor(\n message: string,\n public readonly lastError: Error,\n public readonly attempts: number\n ) {\n super(message);\n this.name = 'RetryError';\n }\n}\n\n/**\n * Retry a function with exponential backoff\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n options: RetryOptions = {}\n): Promise<T> {\n const {\n maxRetries = 3,\n initialDelay = 1000,\n maxDelay = 30000,\n backoffFactor = 2,\n onRetry,\n shouldRetry = () => true,\n signal,\n } = options;\n\n let lastError: Error;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n // Check if operation was cancelled\n if (signal?.aborted) {\n throw new Error('Operation cancelled');\n }\n\n return await fn();\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n // Don't retry if it's the last attempt\n if (attempt === maxRetries) {\n break;\n }\n\n // Check if we should retry this error\n if (!shouldRetry(lastError)) {\n throw lastError;\n }\n\n // Calculate delay with exponential backoff\n const delay = Math.min(\n initialDelay * Math.pow(backoffFactor, attempt),\n maxDelay\n );\n\n // Add some jitter to prevent thundering herd\n const jitteredDelay = delay * (0.5 + Math.random() * 0.5);\n\n // Call retry callback if provided\n if (onRetry) {\n onRetry(lastError, attempt + 1);\n }\n\n // Wait before retrying\n await new Promise((resolve) => {\n const timeoutId = setTimeout(resolve, jitteredDelay);\n\n // Clean up timeout if cancelled\n if (signal) {\n signal.addEventListener(\n 'abort',\n () => {\n clearTimeout(timeoutId);\n resolve(undefined);\n },\n { once: true }\n );\n }\n });\n }\n }\n\n throw new RetryError(\n `Failed after ${maxRetries + 1} attempts`,\n lastError!,\n maxRetries + 1\n );\n}\n\n/**\n * Retry decorator for class methods\n */\nexport function Retryable(options: RetryOptions = {}) {\n return function (\n _target: any,\n _propertyKey: string,\n descriptor: PropertyDescriptor\n ) {\n const originalMethod = descriptor.value;\n\n descriptor.value = async function (...args: any[]) {\n return retry(() => originalMethod.apply(this, args), options);\n };\n\n return descriptor;\n };\n}\n\n/**\n * Common retry strategies\n */\nexport const RetryStrategies = {\n // Retry on network errors\n networkErrors: (error: Error) => {\n const networkErrorPatterns = [\n 'NetworkError',\n 'Failed to fetch',\n 'ERR_NETWORK',\n 'ECONNREFUSED',\n 'ETIMEDOUT',\n 'ENOTFOUND',\n 'fetch failed',\n ];\n\n return networkErrorPatterns.some(\n (pattern) =>\n error.message.includes(pattern) || error.name.includes(pattern)\n );\n },\n\n // Retry on specific HTTP status codes\n httpStatusCodes: (statusCodes: number[]) => (error: any) => {\n if (error.response?.status) {\n return statusCodes.includes(error.response.status);\n }\n return false;\n },\n\n // Retry on temporary errors\n temporaryErrors: (error: Error) => {\n const temporaryPatterns = [\n 'EBUSY',\n 'EAGAIN',\n 'temporarily unavailable',\n 'too many requests',\n 'rate limit',\n ];\n\n return temporaryPatterns.some((pattern) =>\n error.message.toLowerCase().includes(pattern.toLowerCase())\n );\n },\n\n // Combine multiple strategies\n combine:\n (...strategies: ((error: Error) => boolean)[]) =>\n (error: Error) => {\n return strategies.some((strategy) => strategy(error));\n },\n};\n","import {\n useEffect,\n useCallback,\n useRef,\n useMemo,\n memo,\n useContext,\n} from 'react';\nimport { EditorTabsContentMemoized } from './editor-tabs-content';\nimport { Tabs } from '../ui/tabs';\nimport {\n useDocumentsStore,\n DocumentsStoreContext,\n} from '../../store/documents-store-provider';\nimport {\n useOutputStore,\n OutputStoreContext,\n} from '../../store/output-store-provider';\nimport { useSettingsStore } from '../../store/settings-store-provider';\nimport { useEditorRefsStore } from '../../store/editor-refs-store';\nimport {\n useThemesStore,\n ThemesStoreContext,\n} from '../../store/themes-store-provider';\nimport { usePresentationGenerator } from '../../hooks/usePresentationGenerator';\nimport { retry, RetryStrategies } from '../../utils/retry';\nimport { themeChangeEmitter } from '../../utils/theme-change-emitter';\nimport { useShallow } from 'zustand/react/shallow';\n\ninterface BuildRequest {\n id: string;\n docName: string;\n doc: any;\n signal: AbortSignal;\n timestamp: number;\n}\n\nfunction EditorComponent() {\n const setOutput = useOutputStore((state) => state.setOutput);\n const outputStore = useContext(OutputStoreContext)!;\n const documentsStore = useContext(DocumentsStoreContext)!;\n const themesStore = useContext(ThemesStoreContext)!;\n const saveDocumentDebounceWait = useSettingsStore(\n (state) => state.saveDocumentDebounceWait\n );\n const autoReload = useSettingsStore((state) => state.autoReload);\n const renderingLibrary = useSettingsStore((state) => state.renderingLibrary);\n const {\n openTabs,\n activeTab,\n setActiveTab,\n documents,\n buildErrors,\n setBuildError,\n documentTypes,\n } = useDocumentsStore(\n useShallow((state) => ({\n openTabs: state.openTabs,\n activeTab: state.activeTab,\n setActiveTab: state.setActiveTab,\n documents: state.documents,\n buildErrors: state.buildErrors,\n setBuildError: state.setBuildError,\n documentTypes: state.documentTypes,\n }))\n );\n const { customThemes, getAllThemeNames, getTheme } = useThemesStore(\n useShallow((state) => ({\n customThemes: state.customThemes,\n getAllThemeNames: state.getAllThemeNames,\n getTheme: state.getTheme,\n }))\n );\n const { generatePresentation, cancelGeneration } = usePresentationGenerator();\n\n // Refs to track ongoing operations and prevent race conditions\n const buildAbortControllersRef = useRef<Map<string, AbortController>>(\n new Map()\n );\n const buildTimeoutsRef = useRef<Map<string, NodeJS.Timeout>>(new Map());\n const lastBuildRequestIdRef = useRef<string>('');\n const documentVersionsRef = useRef<Map<string, number>>(new Map());\n\n // Get or create a document version number\n const getDocumentVersion = useCallback((docName: string) => {\n const currentVersion = documentVersionsRef.current.get(docName) || 0;\n const newVersion = currentVersion + 1;\n documentVersionsRef.current.set(docName, newVersion);\n return newVersion;\n }, []);\n\n // Build document with specific theme data (bypasses memoization)\n const buildDocumentWithThemes = useCallback(\n async (doc: any, themesData: { [key: string]: any }) => {\n if (!doc || !generatePresentation) {\n return;\n }\n\n // Cancel any existing build operation for this document\n const existingController = buildAbortControllersRef.current.get(doc.name);\n if (existingController) {\n existingController.abort();\n buildAbortControllersRef.current.delete(doc.name);\n }\n\n const abortController = new AbortController();\n const signal = abortController.signal;\n buildAbortControllersRef.current.set(doc.name, abortController);\n\n // Create build request\n const requestId = `${doc.name}-theme-${Date.now()}-${Math.random()}`;\n const version = getDocumentVersion(doc.name);\n lastBuildRequestIdRef.current = requestId;\n\n console.log('Editor: Starting theme-triggered build with fresh data', {\n docName: doc.name,\n requestId,\n freshThemeCount: Object.keys(themesData).length,\n version,\n });\n\n const buildRequest: BuildRequest = {\n id: requestId,\n docName: doc.name,\n doc,\n signal,\n timestamp: Date.now(),\n };\n\n // Process immediately (bypass queue for theme changes)\n await processBuildRequestWithThemesRef.current(\n buildRequest,\n version,\n themesData\n );\n },\n [generatePresentation, setOutput, getDocumentVersion]\n );\n\n // Process build request with specific theme data\n const processBuildRequestWithThemes = useCallback(\n async (\n request: BuildRequest,\n _version: number,\n themesData: { [key: string]: any }\n ) => {\n const { doc, signal, id } = request;\n\n setOutput({\n globalError: undefined,\n isGenerating: true,\n generationProgress: {\n stage: 'parsing',\n message: 'Rebuilding with updated theme...',\n },\n });\n\n const onProgress = (\n stage: 'parsing' | 'building' | 'rendering' | 'finalizing',\n message?: string\n ) => {\n if (signal.aborted || lastBuildRequestIdRef.current !== id) return;\n\n setOutput({\n isGenerating: true,\n generationProgress: { stage, message },\n });\n };\n\n try {\n console.log('Editor: Generating document with fresh themes', {\n docName: doc.name,\n themeNames: Object.keys(themesData),\n requestId: id,\n });\n\n const result = await generatePresentation(\n doc.name,\n doc.text,\n themesData,\n onProgress,\n { bypassCache: true }\n );\n\n if (signal.aborted || lastBuildRequestIdRef.current !== id) {\n console.log('Theme build cancelled for:', doc.name);\n setOutput({ isGenerating: false, generationProgress: undefined });\n return;\n }\n\n if (\n result &&\n typeof result === 'object' &&\n 'name' in result &&\n 'text' in result &&\n 'blob' in result\n ) {\n console.log('Editor: Theme-triggered build completed', {\n docName: result.name,\n blobSize: (result.blob as Blob)?.size,\n timestamp: Date.now(),\n requestId: id,\n });\n\n setOutput({\n name: result.name as string,\n text: result.text as string,\n blob: result.blob as Blob,\n globalError: undefined,\n isGenerating: false,\n isPreviewStale: false,\n generationProgress: undefined,\n lastBuiltSequence: outputStore.getState().editSequence,\n cacheStatus: (result as any).cacheStatus as\n | 'HIT'\n | 'MISS'\n | 'UNKNOWN'\n | undefined,\n cacheHitRate: (result as any).cacheHitRate as string | undefined,\n warnings: (result as any).warnings as any,\n });\n setBuildError(result.name as string, undefined);\n }\n } catch (error) {\n if (signal.aborted || lastBuildRequestIdRef.current !== id) {\n console.log('Theme build cancelled with error for:', doc.name);\n setOutput({ isGenerating: false, generationProgress: undefined });\n return;\n }\n\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n console.error('Theme build error:', errorMessage);\n\n setOutput({\n globalError: `Theme rebuild failed: ${errorMessage}`,\n isGenerating: false,\n generationProgress: undefined,\n });\n setBuildError(doc.name, errorMessage);\n } finally {\n buildAbortControllersRef.current.delete(doc.name);\n }\n },\n [generatePresentation, setOutput, setBuildError, outputStore]\n );\n const processBuildRequestWithThemesRef = useRef(\n processBuildRequestWithThemes\n );\n useEffect(() => {\n processBuildRequestWithThemesRef.current = processBuildRequestWithThemes;\n });\n\n // Prepare valid custom themes with deep comparison\n const customThemesContentHash = useMemo(() => {\n // Create a content hash of all themes to detect deep changes\n const themeData = Object.entries(customThemes).map(([key, theme]) => {\n // Handle lastModified that might be a string (from localStorage) or Date\n let lastModifiedTime = 0;\n if (theme.lastModified) {\n if (theme.lastModified instanceof Date) {\n lastModifiedTime = theme.lastModified.getTime();\n } else if (typeof theme.lastModified === 'string') {\n lastModifiedTime = new Date(theme.lastModified).getTime();\n }\n }\n\n return {\n key,\n name: theme.name,\n content: theme.content,\n valid: theme.valid,\n lastModified: lastModifiedTime,\n };\n });\n return JSON.stringify(themeData);\n }, [customThemes]);\n\n const validCustomThemes = useMemo(() => {\n const themes: { [key: string]: any } = {};\n Object.values(customThemes).forEach((theme) => {\n if (theme.valid && theme.parsed) {\n themes[theme.name] = theme.parsed;\n }\n });\n return themes;\n }, [customThemesContentHash]);\n\n // Helper function to get fresh theme data (bypasses memo)\n const getFreshThemeData = useCallback(() => {\n const freshThemes: { [key: string]: any } = {};\n const { customThemes } = themesStore.getState();\n Object.values(customThemes).forEach((theme) => {\n if (theme.valid && theme.parsed) {\n freshThemes[theme.name] = theme.parsed;\n }\n });\n return freshThemes;\n }, [themesStore]);\n\n // Helper function to build a document with proper cancellation and retry\n const buildDocument = useCallback(\n async (\n doc: any,\n signal?: AbortSignal,\n options?: { bypassCache?: boolean }\n ) => {\n if (!doc || !generatePresentation) {\n return;\n }\n\n // Cancel any existing build operation for this document\n const existingController = buildAbortControllersRef.current.get(doc.name);\n if (existingController) {\n existingController.abort();\n buildAbortControllersRef.current.delete(doc.name);\n }\n\n // Create new abort controller if not provided\n const abortController = signal ? null : new AbortController();\n const finalSignal = signal || abortController!.signal;\n if (abortController) {\n buildAbortControllersRef.current.set(doc.name, abortController);\n }\n\n // Create build request\n const requestId = `${doc.name}-${Date.now()}-${Math.random()}`;\n const version = getDocumentVersion(doc.name);\n lastBuildRequestIdRef.current = requestId;\n\n const buildRequest: BuildRequest = {\n id: requestId,\n docName: doc.name,\n doc,\n signal: finalSignal,\n timestamp: Date.now(),\n };\n\n await processBuildRequestRef.current(buildRequest, version, options);\n },\n [generatePresentation, setOutput, getDocumentVersion]\n );\n\n // Process a build request from the queue\n const processBuildRequest = useCallback(\n async (\n request: BuildRequest,\n version: number,\n options?: { bypassCache?: boolean }\n ) => {\n const { doc, signal, id } = request;\n\n // Check if this is still the latest request\n if (lastBuildRequestIdRef.current !== id) {\n console.log('Skipping outdated build request for:', doc.name);\n setOutput({ isGenerating: false, generationProgress: undefined });\n return;\n }\n\n setOutput({\n globalError: undefined,\n isGenerating: true,\n generationProgress: {\n stage: 'parsing',\n message: 'Validating JSON structure...',\n },\n });\n\n const onProgress = (\n stage: 'parsing' | 'building' | 'rendering' | 'finalizing',\n message?: string\n ) => {\n if (signal.aborted || lastBuildRequestIdRef.current !== id) return;\n\n // Check document version to ensure we're still building the latest\n const currentVersion = documentVersionsRef.current.get(doc.name) || 0;\n if (currentVersion !== version) {\n console.log('Document version changed, aborting build');\n signal.dispatchEvent(new Event('abort'));\n return;\n }\n\n setOutput({\n isGenerating: true,\n generationProgress: { stage, message },\n });\n };\n\n try {\n // Always get fresh theme data to ensure latest changes are applied\n const freshThemeData = getFreshThemeData();\n\n console.log('Editor: Using themes for document build', {\n docName: doc.name,\n freshThemeCount: Object.keys(freshThemeData).length,\n freshThemeNames: Object.keys(freshThemeData),\n memoizedCount: Object.keys(validCustomThemes).length,\n requestId: id,\n });\n\n // Retry logic for temporary failures\n const result = await retry(\n async () => {\n if (signal.aborted) throw new Error('Build cancelled');\n return await generatePresentation(\n doc.name,\n doc.text,\n freshThemeData,\n onProgress,\n options\n );\n },\n {\n maxRetries: 2,\n initialDelay: 500,\n shouldRetry: (error) => {\n // Don't retry on cancellation or syntax errors\n if (\n error.message.includes('cancelled') ||\n error.message.includes('JSON') ||\n error.message.includes('parse') ||\n error.message.includes('syntax')\n ) {\n return false;\n }\n // Retry on worker errors\n return RetryStrategies.combine(\n RetryStrategies.temporaryErrors,\n (e) =>\n e.message.includes('Worker') || e.message.includes('Proxy')\n )(error);\n },\n onRetry: (error, attempt) => {\n console.log(\n `Retrying presentation generation (attempt ${attempt}):`,\n error.message\n );\n setOutput({\n isGenerating: true,\n generationProgress: {\n stage: 'parsing',\n message: `Retrying generation (attempt ${attempt})...`,\n },\n });\n },\n signal,\n }\n );\n\n if (signal.aborted || lastBuildRequestIdRef.current !== id) {\n console.log('Build cancelled for:', doc.name);\n setOutput({ isGenerating: false, generationProgress: undefined });\n return;\n }\n\n if (\n result &&\n typeof result === 'object' &&\n 'name' in result &&\n 'text' in result &&\n 'blob' in result\n ) {\n console.log('Editor: Build completed', {\n docName: result.name,\n blobSize: (result.blob as Blob)?.size,\n timestamp: Date.now(),\n requestId: id,\n version,\n });\n\n setOutput({\n name: result.name as string,\n text: result.text as string,\n blob: result.blob as Blob,\n globalError: undefined,\n isGenerating: false,\n isPreviewStale: false,\n generationProgress: undefined,\n lastBuiltSequence: outputStore.getState().editSequence,\n cacheStatus: (result as any).cacheStatus as\n | 'HIT'\n | 'MISS'\n | 'UNKNOWN'\n | undefined,\n cacheHitRate: (result as any).cacheHitRate as string | undefined,\n warnings: (result as any).warnings as any,\n });\n setBuildError(result.name as string, undefined);\n }\n } catch (error) {\n if (signal.aborted || lastBuildRequestIdRef.current !== id) {\n console.log('Build cancelled with error for:', doc.name);\n setOutput({ isGenerating: false, generationProgress: undefined });\n return;\n }\n\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n setOutput({\n globalError: errorMessage,\n isGenerating: false,\n generationProgress: undefined,\n });\n\n setBuildError(doc.name, errorMessage);\n } finally {\n buildAbortControllersRef.current.delete(doc.name);\n }\n },\n [\n generatePresentation,\n getFreshThemeData,\n setOutput,\n setBuildError,\n outputStore,\n ]\n );\n const processBuildRequestRef = useRef(processBuildRequest);\n useEffect(() => {\n processBuildRequestRef.current = processBuildRequest;\n });\n\n // Track the last viewed document for theme updates\n const lastViewedDocumentRef = useRef<string | null>(null);\n\n // re-build on active tab change or any document change\n useEffect(() => {\n console.log('Editor: Document rebuild effect triggered', {\n activeTab,\n });\n\n const activeFile = documents.find((doc) => doc.name === activeTab);\n const docType = documentTypes[activeTab] || 'application/json+report';\n\n // Track last viewed document\n if (docType === 'application/json+report' && activeFile) {\n lastViewedDocumentRef.current = activeTab;\n }\n\n // Clear any pending build timeout for this document\n const existingTimeout = buildTimeoutsRef.current.get(activeTab);\n if (existingTimeout) {\n clearTimeout(existingTimeout);\n buildTimeoutsRef.current.delete(activeTab);\n }\n\n if (activeFile && docType === 'application/json+report') {\n // Skip auto-build when auto-generation is disabled;\n // also don't clobber an in-progress build (e.g. triggered by Run button)\n if (!autoReload || renderingLibrary !== 'docxjs') {\n if (!outputStore.getState().isGenerating) {\n setOutput({ isPreviewStale: true });\n }\n } else {\n // Use adaptive debounce based on document size\n const docSize = activeFile.text.length;\n const debounceTime = docSize > 10000 ? 300 : docSize > 5000 ? 200 : 100;\n\n // Cancel any builds for other documents\n buildAbortControllersRef.current.forEach((controller, docName) => {\n if (docName !== activeTab) {\n controller.abort();\n buildAbortControllersRef.current.delete(docName);\n }\n });\n\n // Debounce the build to avoid rapid rebuilds\n // Only fire when the JSON is syntactically valid to avoid\n // sending incomplete/invalid payloads during mid-edit typing.\n const timeout = setTimeout(() => {\n buildTimeoutsRef.current.delete(activeTab);\n\n // Re-read from store to avoid stale-closure issues\n const latestFile = documentsStore\n .getState()\n .documents.find((d) => d.name === activeTab);\n if (!latestFile) return;\n\n try {\n JSON.parse(latestFile.text);\n } catch {\n // JSON not valid yet — mark stale, don't fire build\n setOutput({ isPreviewStale: true });\n return;\n }\n\n // Skip if Monaco reports schema validation errors (e.g. unknown component names)\n if (outputStore.getState().hasValidationErrors) {\n setOutput({ isPreviewStale: true });\n return;\n }\n\n console.log('Editor: Triggering document build after debounce', {\n docName: latestFile.name,\n debounceTime,\n });\n\n // Force new version when themes change to ensure rebuild\n getDocumentVersion(latestFile.name);\n buildDocument(latestFile);\n }, debounceTime);\n\n buildTimeoutsRef.current.set(activeTab, timeout);\n }\n } else if (activeFile && docType === 'application/json+theme') {\n // Theme tab active — no document preview to build.\n // Don't clear blob: preserve the last document preview in the background.\n cancelGeneration();\n }\n\n // Cleanup function to cancel pending operations\n return () => {\n const timeout = buildTimeoutsRef.current.get(activeTab);\n if (timeout) {\n clearTimeout(timeout);\n buildTimeoutsRef.current.delete(activeTab);\n }\n };\n }, [\n documents,\n activeTab,\n setOutput,\n documentTypes,\n buildDocument,\n cancelGeneration,\n autoReload,\n renderingLibrary,\n ]);\n\n // Track which documents use which themes (only parse the active doc to avoid O(n) JSON.parse)\n const documentThemeDependencies = useMemo(() => {\n const deps = new Map<string, string>();\n const activeDoc = documents.find((d) => d.name === activeTab);\n if (\n activeDoc &&\n documentTypes[activeDoc.name] === 'application/json+report'\n ) {\n try {\n const parsed = JSON.parse(activeDoc.text);\n const themeName = parsed.props?.theme;\n if (typeof themeName === 'string') {\n const themeExists = Object.values(customThemes).some(\n (t) => t.name === themeName && t.valid\n );\n if (themeExists) {\n deps.set(activeDoc.name, themeName);\n }\n }\n } catch {\n // Ignore parse errors\n }\n }\n return deps;\n }, [activeTab, documents, documentTypes, customThemes]);\n\n // Listen for theme change events and force immediate rebuild\n useEffect(() => {\n console.log('Editor: Setting up theme change listener', {\n documentCount: documents.length,\n dependencyCount: documentThemeDependencies.size,\n dependencies: Array.from(documentThemeDependencies.entries()),\n customThemes: Object.entries(customThemes).map(([key, theme]) => ({\n key,\n name: theme.name,\n valid: theme.valid,\n })),\n });\n\n const unsubscribe = themeChangeEmitter.onThemeChange((event) => {\n console.log('Editor: Theme change detected', {\n event,\n dependencies: Array.from(documentThemeDependencies.entries()),\n activeTab,\n customThemes: Object.entries(customThemes).map(([key, theme]) => ({\n key,\n name: theme.name,\n valid: theme.valid,\n })),\n });\n\n // Find all documents that use this theme\n const documentsUsingTheme: any[] = [];\n\n documentThemeDependencies.forEach((themeName, docName) => {\n if (themeName === event.themeName) {\n const doc = documents.find((d) => d.name === docName);\n if (doc) {\n documentsUsingTheme.push(doc);\n }\n }\n });\n\n console.log('Editor: Documents using changed theme', {\n themeName: event.themeName,\n documentCount: documentsUsingTheme.length,\n documentNames: documentsUsingTheme.map((d) => d.name),\n });\n\n if (documentsUsingTheme.length === 0) {\n console.log('Editor: No documents use this theme, skipping rebuild');\n return;\n }\n\n // Force immediate rebuild to ensure fresh theme data is used\n // Use longer delay to ensure theme store has updated\n // Add extra delay to account for debouncing in theme updates\n const THEME_UPDATE_DELAY = 600;\n\n // Only rebuild the currently active document\n const activeDocument = documentsUsingTheme.find(\n (doc) => doc.name === activeTab\n );\n\n if (!activeDocument) {\n // Active tab is a theme or unrelated doc — mark stale if a dependent doc exists\n if (documentsUsingTheme.length > 0) {\n setOutput({ isPreviewStale: true });\n }\n return;\n }\n\n // Skip auto-build when auto-generation is disabled\n if (!autoReload || renderingLibrary !== 'docxjs') {\n if (!outputStore.getState().isGenerating) {\n setOutput({ isPreviewStale: true });\n }\n return;\n }\n\n console.log('Editor: Rebuilding only active document', {\n activeDocName: activeDocument.name,\n themeName: event.themeName,\n totalDocumentsUsingTheme: documentsUsingTheme.length,\n });\n\n // Clear any existing rebuild timeouts for the active document\n ['theme-event', 'backup', activeDocument.name].forEach((prefix) => {\n const timeoutKey = `${prefix}-${activeDocument.name}`;\n const existingTimeout = buildTimeoutsRef.current.get(timeoutKey);\n if (existingTimeout) {\n clearTimeout(existingTimeout);\n buildTimeoutsRef.current.delete(timeoutKey);\n }\n });\n\n // Cancel any ongoing builds for the active document\n const existingController = buildAbortControllersRef.current.get(\n activeDocument.name\n );\n if (existingController) {\n existingController.abort();\n buildAbortControllersRef.current.delete(activeDocument.name);\n }\n\n const themeTimeoutKey = `theme-event-${activeDocument.name}`;\n const timeout = setTimeout(() => {\n buildTimeoutsRef.current.delete(themeTimeoutKey);\n console.log(\n 'Editor: Force rebuilding active document due to theme change',\n {\n docName: activeDocument.name,\n themeName: event.themeName,\n timestamp: Date.now(),\n }\n );\n\n // Get fresh theme data directly from store to bypass stale memoization\n const freshThemes: { [key: string]: any } = {};\n const allThemeNames = getAllThemeNames();\n allThemeNames.forEach((name) => {\n const themeData = getTheme(name);\n if (themeData) {\n freshThemes[name] = themeData;\n }\n });\n\n console.log('Editor: Using fresh theme data for rebuild', {\n freshThemeCount: Object.keys(freshThemes).length,\n freshThemeNames: Object.keys(freshThemes),\n memoizedCount: Object.keys(validCustomThemes).length,\n });\n\n // Force a new document version and rebuild with fresh themes\n getDocumentVersion(activeDocument.name);\n buildDocumentWithThemes(activeDocument, freshThemes);\n }, THEME_UPDATE_DELAY);\n\n buildTimeoutsRef.current.set(themeTimeoutKey, timeout);\n });\n\n return unsubscribe;\n }, [\n documentThemeDependencies,\n documents,\n buildDocument,\n getDocumentVersion,\n activeTab,\n getAllThemeNames,\n getTheme,\n buildDocumentWithThemes,\n validCustomThemes,\n autoReload,\n renderingLibrary,\n setOutput,\n ]);\n\n // Flush debounces and immediately build — triggered by Run button via custom event\n // Debounced at 150ms to coalesce rapid clicks\n const flushBuildTimerRef = useRef<NodeJS.Timeout | null>(null);\n // Stable refs so the event handler never goes stale and doesn't need\n // reactive deps that would cause cleanup to cancel the pending timeout\n const buildDocumentRef = useRef(buildDocument);\n useEffect(() => {\n buildDocumentRef.current = buildDocument;\n });\n const getDocumentVersionRef = useRef(getDocumentVersion);\n useEffect(() => {\n getDocumentVersionRef.current = getDocumentVersion;\n });\n\n useEffect(() => {\n const handler = () => {\n // Mark generating early so the rebuild effect (triggered by saveDocument\n // below) doesn't clobber this build with isPreviewStale\n setOutput({ isGenerating: true });\n\n // 1. Flush Monaco debounce: read live text, save to store immediately\n let themeDirty = false;\n const editorRef = useEditorRefsStore.getState().getActiveEditor();\n if (editorRef) {\n // Don't flush if a pending diff is active — editor may be disposed\n const hasPendingDiff =\n documentsStore.getState().pendingDiffs[editorRef.documentName];\n if (!hasPendingDiff) {\n const liveText = editorRef.editor.getValue();\n documentsStore\n .getState()\n .saveDocument(editorRef.documentName, liveText);\n }\n }\n\n // Flush all open theme editors whose live text differs from the\n // themes store so the build always uses up-to-date theme data.\n const { documents: allDocs, documentTypes: allDtypes } =\n documentsStore.getState();\n for (const doc of allDocs) {\n if (allDtypes[doc.name] === 'application/json+theme') {\n const ref = useEditorRefsStore.getState().getEditor(doc.name);\n if (ref) {\n const liveText = ref.editor.getValue();\n const existing = themesStore.getState().customThemes[doc.name];\n if (!existing || existing.content !== liveText) {\n themesStore.getState().updateTheme(doc.name, liveText);\n themeDirty = true;\n }\n }\n }\n }\n\n // 2. Cancel any pending build timeout for active doc\n const currentTab = documentsStore.getState().activeTab;\n const timeout = buildTimeoutsRef.current.get(currentTab);\n if (timeout) {\n clearTimeout(timeout);\n buildTimeoutsRef.current.delete(currentTab);\n }\n\n // 3. Debounce the actual build to coalesce rapid Run clicks\n if (flushBuildTimerRef.current) {\n clearTimeout(flushBuildTimerRef.current);\n }\n flushBuildTimerRef.current = setTimeout(() => {\n flushBuildTimerRef.current = null;\n const {\n documents: docs,\n activeTab: tab,\n documentTypes: dtypes,\n } = documentsStore.getState();\n\n // Determine target: if active tab is a theme, build the last-viewed document instead\n let targetName = tab;\n const tabType = dtypes[tab] || 'application/json+report';\n if (tabType === 'application/json+theme') {\n if (lastViewedDocumentRef.current) {\n targetName = lastViewedDocumentRef.current;\n } else {\n // No document was viewed yet — nothing to build\n setOutput({ isGenerating: false });\n return;\n }\n }\n\n const freshDoc = docs.find((d) => d.name === targetName);\n if (freshDoc) {\n // If a pending diff exists (AI suggestion), preview the modified version\n const pending = documentsStore.getState().pendingDiffs[targetName];\n const ref = useEditorRefsStore.getState().getEditor(targetName);\n const doc = pending\n ? { ...freshDoc, text: pending.modified }\n : ref\n ? { ...freshDoc, text: ref.editor.getValue() }\n : freshDoc;\n getDocumentVersionRef.current(doc.name);\n // Bypass cache only when a theme was updated during this flush\n buildDocumentRef.current(\n doc,\n undefined,\n themeDirty ? { bypassCache: true } : undefined\n );\n } else {\n setOutput({ isGenerating: false });\n }\n }, 150);\n };\n\n window.addEventListener('preview:flushAndBuild', handler);\n return () => {\n window.removeEventListener('preview:flushAndBuild', handler);\n if (flushBuildTimerRef.current) {\n clearTimeout(flushBuildTimerRef.current);\n }\n };\n }, [setOutput, documentsStore, themesStore]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n // Cancel all pending builds\n buildAbortControllersRef.current.forEach((controller) =>\n controller.abort()\n );\n buildAbortControllersRef.current.clear();\n\n // Clear all timeouts\n buildTimeoutsRef.current.forEach((timeout) => clearTimeout(timeout));\n buildTimeoutsRef.current.clear();\n\n // Cancel any ongoing generation\n cancelGeneration();\n };\n }, [cancelGeneration]);\n\n if (!openTabs.length) {\n return (\n <div className=\"flex flex-col text-muted-foreground h-full items-center justify-center\">\n {!documents?.length ? 'Create a new document...' : 'Open a document...'}\n </div>\n );\n }\n\n return (\n <Tabs value={activeTab} onValueChange={setActiveTab} className=\"h-full\">\n {/* Tabs header removed to gain vertical space */}\n <EditorTabsContentMemoized\n openTabs={openTabs}\n documents={documents}\n buildErrors={buildErrors}\n saveDocumentDebounceWait={saveDocumentDebounceWait}\n />\n </Tabs>\n );\n}\n\n// Export memoized version of Editor component\nexport const Editor = memo(EditorComponent);\n"],"names":["validators","monaco","dummyDiv","dummyEditorInstance","editorInstanceConstructorName","editorModelConstructorName","valueToValidate","ranges","rangeObj","num","TypeMustBe","type","key","additional","deepClone","byPassPrimitives","value","callback","cloneArray","array","keys","arrayClone","i","cloner","object","clone","config","constructOptionForCode","options","acc","option","codes","methods","API","methodName","enums","constrainedModel","model","rangeConstructor","sortRangesInAscendingOrder","rangeObject1","rangeObject2","rangeA","rangeB","normalizeRange","range","content","lines","noOfLines","normalizedRange","index","actualStartCol","startLineNo","maxCols","actualEndLine","actualEndCol","endLineNo","restrictions","prepareRestrictions","restriction","startLine","startCol","endLine","endCol","getCurrentEditableRanges","getValueInEditableRanges","updateValueInEditableRanges","forceMoveMarkers","restrictionsMap","label","doesChangeHasMultilineConflict","newRange","isChangeInvalidAsPerUser","disposeRestrictions","handleUnhandledPromiseRejection","isCursorAtCheckPoint","positions","position","posLineNumber","posCol","length","addEditableRangeListener","triggerChangeListenersWith","currentChanges","allChanges","currentRanges","doUndo","updateRange","finalLine","finalColumn","changes","changeIndex","oldRangeEndLineNumber","oldRangeEndColumn","changesLength","diffInCol","diffInRow","cursorPositions","noOfCursorPositions","change","cursorPosition","nextRestriction","nextRange","nextChange","rangeInChange","rangeAsString","rangeMapValue","getInfoFrom","editableRange","info","updateRestrictions","toggleHighlightOfEditableAreas","cssClasses","cssClassForSingleLine","cssClassForMultiLine","decorations","decoration","setAllRangesToPrev","rangeMap","text","manipulatorApi","contentChangedEvent","isUndoing","editedRange","changedRange","noOfLinesAdded","noOfColsAddedAtLastLine","lineDiffInRange","colDiffInRange","columnsCarriedToEnd","values","currentlyEditedRanges","rangeString","exposedApi","funcName","apiName","constrainedEditor","listenerFn","editorInstance","selections","selection","_uriRestrictionMap","isInstanceValid","isModelValid","isRangesValid","initInEditorInstance","domNode","manipulator","newDomNode","addRestrictionsTo","modelToConstrain","removeRestrictionsIn","uri","restrictedModel","disposeConstrainer","toggleDevMode","editor","startLineNumber","endLineNumber","startColumn","endColumn","exposedMethods","EditorMonacoTheme","document","readOnly","onChange","editorRef","useRef","monacoRef","modelRef","theme","useTheme","isReady","setIsReady","React","pendingDiff","useDocumentsStore","s","clearPendingDiff","saveDocument","registerEditor","unregisterEditor","setActiveEditor","useEditorRefsStore","resolvedTheme","handleEditorWillMount","useCallback","handleEditorMount","constrainedInstance","getSelectionContext","snippet","createContextSnippet","_a","useEffect","handleChange","_event","validationResult","validateThemeJson","markers","error","newTheme","jsx","jsxs","Fragment","Button","DiffEditor","MonacoEditor","EditorMonacoThemeMemoized","TabContent","name","_buildError","saveDocumentDebounceWait","documentType","state","updateTheme","useThemesStore","debouncedUpdateTheme","debounce","TabsContent","EditorMonacoJsonMemoized","TabContentMemoized","EditorTabsContent","openTabs","documents","buildErrors","documentTypes","d","doc","EditorTabsContentMemoized","RetryError","message","lastError","attempts","retry","fn","maxRetries","initialDelay","maxDelay","backoffFactor","onRetry","shouldRetry","signal","attempt","jitteredDelay","resolve","timeoutId","RetryStrategies","pattern","statusCodes","strategies","strategy","EditorComponent","setOutput","useOutputStore","outputStore","useContext","OutputStoreContext","documentsStore","DocumentsStoreContext","themesStore","ThemesStoreContext","useSettingsStore","autoReload","renderingLibrary","activeTab","setActiveTab","setBuildError","useShallow","customThemes","getAllThemeNames","getTheme","generatePresentation","cancelGeneration","usePresentationGenerator","buildAbortControllersRef","buildTimeoutsRef","lastBuildRequestIdRef","documentVersionsRef","getDocumentVersion","docName","newVersion","buildDocumentWithThemes","themesData","existingController","abortController","requestId","version","buildRequest","processBuildRequestWithThemesRef","processBuildRequestWithThemes","request","_version","id","onProgress","stage","result","errorMessage","customThemesContentHash","useMemo","themeData","lastModifiedTime","validCustomThemes","themes","getFreshThemeData","freshThemes","buildDocument","finalSignal","processBuildRequestRef","processBuildRequest","freshThemeData","e","lastViewedDocumentRef","activeFile","docType","existingTimeout","docSize","debounceTime","controller","timeout","latestFile","documentThemeDependencies","deps","activeDoc","themeName","t","themeChangeEmitter","event","documentsUsingTheme","THEME_UPDATE_DELAY","activeDocument","prefix","timeoutKey","themeTimeoutKey","flushBuildTimerRef","buildDocumentRef","getDocumentVersionRef","handler","themeDirty","liveText","allDocs","allDtypes","ref","existing","currentTab","docs","tab","dtypes","targetName","freshDoc","pending","Tabs","Editor","memo"],"mappings":"ymBAAA,MAAMA,GAAa,CACjB,SAAU,SAAUC,EAAQ,CAC1B,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AI,IAAI,EAEtC2G,EAAiB,QACf3G,GACA,OACA8G,EAAa,CAAE,YAAa,IAAS,MAAA,CAEzC,MACErF,EAAU,CAAE,aAAc,GAAO,CAErC,EAAG,GAAG,CACR,EAEA,cAAO,iBAAiB,wBAAyBoF,CAAO,EACjD,IAAM,CACX,OAAO,oBAAoB,wBAAyBA,CAAO,EACvDH,EAAmB,SACrB,aAAaA,EAAmB,OAAO,CAE3C,CACF,EAAG,CAACjF,EAAWK,EAAgBE,CAAW,CAAC,EAG3ClE,EAAAA,UAAU,IACD,IAAM,CAEXiF,EAAyB,QAAQ,QAAS2C,GACxCA,EAAW,MAAA,CAAM,EAEnB3C,EAAyB,QAAQ,MAAA,EAGjCC,EAAiB,QAAQ,QAAS2C,GAAY,aAAaA,CAAO,CAAC,EACnE3C,EAAiB,QAAQ,MAAA,EAGzBH,EAAA,CACF,EACC,CAACA,CAAgB,CAAC,EAEhBlD,EAAS,aASXgI,GAAA,CAAK,MAAOtF,EAAW,cAAeC,EAAc,UAAU,SAE7D,SAAAhE,EAAAA,IAAC2B,GAAA,CACC,SAAAN,EACA,UAAAC,EACA,YAAAC,EACA,yBAAAb,CAAA,CAAA,EAEJ,EAfEV,MAAC,OAAI,UAAU,yEACZ,SAACsB,GAAA,MAAAA,EAAW,OAAsC,qBAA7B,0BAA6B,CACrD,CAeN,CAGO,MAAMgI,GAASC,EAAAA,KAAKrG,EAAe","x_google_ignoreList":[0,1,2,3,4,5]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-monaco-json-xaZYbzKd.js","sources":["../../../../../node_modules/.pnpm/lodash.debounce@4.0.8/node_modules/lodash.debounce/index.js","../../../src/client/store/editor-refs-store.ts","../../../src/client/lib/monaco-selection-utils.ts","../../../src/client/components/json-editor/validation-panel.tsx","../../../src/client/components/json-editor/editor-monaco-json.tsx"],"sourcesContent":["/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n","/**\n * Editor References Store\n * Manages references to Monaco editor instances for selection context\n */\n\nimport { create } from 'zustand';\nimport type { editor as MonacoEditorType } from 'monaco-editor';\nimport type { Monaco } from '@monaco-editor/react';\n\nexport interface EditorReference {\n editor: MonacoEditorType.IStandaloneCodeEditor;\n monaco: Monaco;\n documentName: string;\n}\n\ninterface EditorRefsState {\n editors: Map<string, EditorReference>;\n activeEditorName: string | null;\n}\n\ninterface EditorRefsActions {\n registerEditor: (\n documentName: string,\n editor: MonacoEditorType.IStandaloneCodeEditor,\n monaco: Monaco\n ) => void;\n unregisterEditor: (documentName: string) => void;\n setActiveEditor: (documentName: string | null) => void;\n getActiveEditor: () => EditorReference | null;\n getEditor: (documentName: string) => EditorReference | null;\n}\n\nexport type EditorRefsStore = EditorRefsState & EditorRefsActions;\n\nexport const useEditorRefsStore = create<EditorRefsStore>((set, get) => ({\n editors: new Map(),\n activeEditorName: null,\n\n registerEditor: (documentName, editor, monaco) => {\n set((state) => {\n const newEditors = new Map(state.editors);\n newEditors.set(documentName, { editor, monaco, documentName });\n return { editors: newEditors };\n });\n },\n\n unregisterEditor: (documentName) => {\n set((state) => {\n const newEditors = new Map(state.editors);\n newEditors.delete(documentName);\n return {\n editors: newEditors,\n activeEditorName:\n state.activeEditorName === documentName\n ? null\n : state.activeEditorName,\n };\n });\n },\n\n setActiveEditor: (documentName) => {\n set({ activeEditorName: documentName });\n },\n\n getActiveEditor: () => {\n const state = get();\n if (!state.activeEditorName) return null;\n return state.editors.get(state.activeEditorName) || null;\n },\n\n getEditor: (documentName) => {\n return get().editors.get(documentName) || null;\n },\n}));\n","/**\n * Monaco Editor Selection Utilities\n * Provides functionality to extract selected text and JSON paths from Monaco editor instances\n */\n\nimport type { editor as MonacoEditorType } from 'monaco-editor';\nimport type { Monaco } from '@monaco-editor/react';\n\nexport interface SelectionContext {\n selectedText: string;\n jsonPath?: string;\n propertyKey?: string;\n fullDocument?: any;\n isValidJson: boolean;\n startLine: number;\n endLine: number;\n}\n\n/**\n * Get the current selection context from a Monaco editor instance\n */\nexport function getSelectionContext(\n editor: MonacoEditorType.IStandaloneCodeEditor,\n monaco: Monaco\n): SelectionContext | null {\n if (!editor || !monaco) {\n return null;\n }\n\n const model = editor.getModel();\n if (!model) {\n return null;\n }\n\n const selection = editor.getSelection();\n if (!selection) {\n return null;\n }\n\n // Get selected text\n const selectedText = model.getValueInRange(selection);\n\n // If no text is selected, get the word at cursor position\n const finalText = selectedText || getWordAtCursor(editor, monaco);\n\n if (!finalText) {\n return null;\n }\n\n // Get the full document text\n const fullDocumentText = model.getValue();\n let fullDocument: any = null;\n let isValidJson = false;\n\n try {\n fullDocument = JSON.parse(fullDocumentText);\n isValidJson = true;\n } catch {\n // Document is not valid JSON\n }\n\n // Try to determine the JSON path\n const jsonPath = isValidJson\n ? getJsonPathAtPosition(\n fullDocumentText,\n selection.startLineNumber,\n selection.startColumn\n )\n : undefined;\n\n // Extract property key if we're selecting a property value\n const propertyKey = extractPropertyKey(\n fullDocumentText,\n selection.startLineNumber,\n selection.startColumn\n );\n\n return {\n selectedText: finalText,\n jsonPath,\n propertyKey,\n fullDocument,\n isValidJson,\n startLine: selection.startLineNumber,\n endLine: selection.endLineNumber,\n };\n}\n\n/**\n * Get the word at the current cursor position\n */\nfunction getWordAtCursor(\n editor: MonacoEditorType.IStandaloneCodeEditor,\n _monaco: Monaco\n): string {\n const model = editor.getModel();\n const position = editor.getPosition();\n\n if (!model || !position) {\n return '';\n }\n\n const word = model.getWordAtPosition(position);\n if (word) {\n return model.getValueInRange({\n startLineNumber: position.lineNumber,\n startColumn: word.startColumn,\n endLineNumber: position.lineNumber,\n endColumn: word.endColumn,\n });\n }\n\n return '';\n}\n\n/**\n * Determine the JSON path at a specific position in the document\n */\nfunction getJsonPathAtPosition(\n documentText: string,\n lineNumber: number,\n column: number\n): string | undefined {\n try {\n // Split document into lines\n const lines = documentText.split('\\n');\n\n // Build a path by analyzing the nesting level\n const path: string[] = [];\n let depth = 0;\n let inArray = false;\n let arrayIndex = 0;\n\n for (let i = 0; i < Math.min(lineNumber, lines.length); i++) {\n const line = lines[i];\n\n // Count braces and brackets to track nesting\n for (let j = 0; j < line.length; j++) {\n const char = line[j];\n\n if (i === lineNumber - 1 && j >= column) {\n // We've reached the target position\n break;\n }\n\n if (char === '{') {\n depth++;\n } else if (char === '}') {\n depth--;\n if (path.length > depth) {\n path.pop();\n }\n } else if (char === '[') {\n inArray = true;\n arrayIndex = 0;\n } else if (char === ']') {\n inArray = false;\n if (path[path.length - 1]?.match(/\\[\\d+\\]$/)) {\n path.pop();\n }\n } else if (char === ',' && inArray) {\n arrayIndex++;\n }\n }\n\n // Try to extract property names from the line\n const propertyMatch = line.match(/^\\s*\"([^\"]+)\"\\s*:/);\n if (propertyMatch) {\n // Adjust path length to current depth\n while (path.length >= depth) {\n path.pop();\n }\n\n if (inArray) {\n path.push(`${propertyMatch[1]}[${arrayIndex}]`);\n } else {\n path.push(propertyMatch[1]);\n }\n }\n }\n\n return path.length > 0 ? path.join('.') : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Extract the property key at a specific position\n */\nfunction extractPropertyKey(\n documentText: string,\n lineNumber: number,\n _column: number\n): string | undefined {\n try {\n const lines = documentText.split('\\n');\n if (lineNumber > lines.length) {\n return undefined;\n }\n\n const line = lines[lineNumber - 1];\n\n // Look for a property key on the same line\n const propertyMatch = line.match(/^\\s*\"([^\"]+)\"\\s*:/);\n if (propertyMatch) {\n return propertyMatch[1];\n }\n\n // Look backwards for the nearest property key\n for (let i = lineNumber - 2; i >= 0; i--) {\n const prevLine = lines[i];\n const prevMatch = prevLine.match(/^\\s*\"([^\"]+)\"\\s*:/);\n if (prevMatch) {\n // Check if this property's value extends to our line\n // This is a simplified check - more complex logic might be needed\n return prevMatch[1];\n }\n\n // Stop if we hit a closing brace (end of object)\n if (prevLine.includes('}')) {\n break;\n }\n }\n\n return undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Format a selection context for display\n */\nexport function formatSelectionContext(context: SelectionContext): string {\n const parts: string[] = [];\n\n if (context.jsonPath) {\n parts.push(`Path: ${context.jsonPath}`);\n }\n\n if (context.propertyKey) {\n parts.push(`Property: ${context.propertyKey}`);\n }\n\n parts.push(`Lines: ${context.startLine}-${context.endLine}`);\n\n return parts.join(' | ');\n}\n\n/**\n * Extract a JSON subtree from a path\n */\nexport function extractJsonSubtree(obj: any, path: string): any {\n if (!obj || !path) {\n return undefined;\n }\n\n const parts = path.split('.');\n let current = obj;\n\n for (const part of parts) {\n if (!current) {\n return undefined;\n }\n\n // Handle array notation like \"items[0]\"\n const arrayMatch = part.match(/^([^[]+)\\[(\\d+)\\]$/);\n if (arrayMatch) {\n const [, key, index] = arrayMatch;\n current = current[key];\n if (Array.isArray(current)) {\n current = current[parseInt(index, 10)];\n } else {\n return undefined;\n }\n } else {\n current = current[part];\n }\n }\n\n return current;\n}\n\n/**\n * Create a context snippet for AI\n */\nexport function createContextSnippet(context: SelectionContext): string {\n const lines: string[] = [];\n\n if (context.jsonPath) {\n lines.push(`JSON Path: ${context.jsonPath}`);\n }\n\n if (context.selectedText.length > 500) {\n lines.push(\n `Selected Text (truncated): ${context.selectedText.substring(0, 500)}...`\n );\n } else {\n lines.push(`Selected Text: ${context.selectedText}`);\n }\n\n if (context.isValidJson && context.fullDocument && context.jsonPath) {\n const subtree = extractJsonSubtree(context.fullDocument, context.jsonPath);\n if (subtree !== undefined) {\n const subtreeStr = JSON.stringify(subtree, null, 2);\n if (subtreeStr.length > 500) {\n lines.push(\n `Context Value (truncated): ${subtreeStr.substring(0, 500)}...`\n );\n } else {\n lines.push(`Context Value: ${subtreeStr}`);\n }\n }\n }\n\n return lines.join('\\n');\n}\n","import React, { useState, useEffect } from 'react';\nimport {\n AlertCircle,\n ChevronDown,\n ChevronUp,\n X,\n AlertTriangle,\n Copy,\n Check,\n} from 'lucide-react';\nimport { cn } from '../../lib/utils';\nimport type { JsonEditorError } from '../../lib/json-types';\n\ninterface ValidationPanelProps {\n errors: JsonEditorError[];\n onErrorClick?: (error: JsonEditorError) => void;\n onClose?: () => void;\n className?: string;\n isMinimized?: boolean;\n onToggleMinimize?: () => void;\n}\n\nexport function ValidationPanel({\n errors,\n onErrorClick,\n onClose,\n className,\n isMinimized = false,\n onToggleMinimize,\n}: ValidationPanelProps) {\n const [isExpanded, setIsExpanded] = useState(!isMinimized);\n\n useEffect(() => {\n setIsExpanded(!isMinimized);\n }, [isMinimized]);\n\n const hasErrors = errors.length > 0;\n const errorCount = errors.length;\n\n if (!hasErrors) return null;\n\n const toggleExpanded = () => {\n const newExpanded = !isExpanded;\n setIsExpanded(newExpanded);\n onToggleMinimize?.();\n };\n\n return (\n <div\n className={cn(\n 'absolute bottom-0 left-0 right-0 z-50 bg-background border-t shadow-lg transition-all duration-200',\n isExpanded ? 'h-48' : 'h-10',\n className\n )}\n >\n {/* Header Bar */}\n <div\n className={cn(\n 'flex items-center justify-between px-3 py-2 cursor-pointer',\n 'bg-destructive/10 border-b border-destructive/20',\n 'hover:bg-destructive/15 transition-colors'\n )}\n onClick={toggleExpanded}\n >\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"w-4 h-4 text-destructive\" />\n <span className=\"text-sm font-medium text-destructive\">\n {errorCount} Validation Error{errorCount !== 1 ? 's' : ''}\n </span>\n </div>\n <div className=\"flex items-center gap-1\">\n <CopyErrorsButton errors={errors} />\n <button\n onClick={(e) => {\n e.stopPropagation();\n toggleExpanded();\n }}\n className=\"p-1 hover:bg-destructive/20 rounded transition-colors\"\n aria-label={isExpanded ? 'Minimize' : 'Expand'}\n >\n {isExpanded ? (\n <ChevronDown className=\"w-4 h-4\" />\n ) : (\n <ChevronUp className=\"w-4 h-4\" />\n )}\n </button>\n {onClose && (\n <button\n onClick={(e) => {\n e.stopPropagation();\n onClose();\n }}\n className=\"p-1 hover:bg-destructive/20 rounded transition-colors\"\n aria-label=\"Close validation panel\"\n >\n <X className=\"w-4 h-4\" />\n </button>\n )}\n </div>\n </div>\n\n {/* Error List */}\n {isExpanded && (\n <div className=\"overflow-y-auto h-[calc(100%-2.5rem)]\">\n <div className=\"divide-y divide-border/50\">\n {errors.map((error, index) => (\n <ErrorItem\n key={`${error.path}-${index}`}\n error={error}\n onClick={() => onErrorClick?.(error)}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n}\n\nfunction CopyErrorsButton({ errors }: { errors: JsonEditorError[] }) {\n const [copied, setCopied] = useState(false);\n\n const handleCopy = (e: React.MouseEvent) => {\n e.stopPropagation();\n const text = errors\n .map((err) => {\n const loc =\n err.startLineNumber && err.startColumn\n ? `Line ${err.startLineNumber}:${err.startColumn}`\n : 'Unknown location';\n return `${loc} — ${err.message}`;\n })\n .join('\\n');\n navigator.clipboard.writeText(text).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n });\n };\n\n return (\n <button\n onClick={handleCopy}\n className={cn(\n 'flex items-center gap-1 px-1.5 py-1 rounded transition-all duration-200 cursor-pointer',\n copied\n ? 'bg-green-500/15 text-green-500'\n : 'hover:bg-destructive/20'\n )}\n aria-label=\"Copy all errors\"\n >\n {copied ? (\n <>\n <Check className=\"w-3.5 h-3.5\" />\n <span className=\"text-xs font-medium\">Copied</span>\n </>\n ) : (\n <Copy className=\"w-4 h-4\" />\n )}\n </button>\n );\n}\n\ninterface ErrorItemProps {\n error: JsonEditorError;\n onClick?: () => void;\n}\n\nfunction ErrorItem({ error, onClick }: ErrorItemProps) {\n const getSeverityIcon = (severity: string) => {\n switch (severity) {\n case 'error':\n return (\n <AlertCircle className=\"w-4 h-4 text-destructive flex-shrink-0\" />\n );\n case 'warning':\n return (\n <AlertTriangle className=\"w-4 h-4 text-yellow-500 flex-shrink-0\" />\n );\n default:\n return <AlertCircle className=\"w-4 h-4 text-blue-500 flex-shrink-0\" />;\n }\n };\n\n const formatPath = (path: string) => {\n if (!path) return 'Document root';\n // Remove leading slash and format nicely\n return path.replace(/^\\//, '').replace(/\\//g, ' → ');\n };\n\n return (\n <div\n className={cn(\n 'px-3 py-2 hover:bg-muted/50 cursor-pointer transition-colors',\n 'group'\n )}\n onClick={onClick}\n >\n <div className=\"flex items-start gap-2\">\n {getSeverityIcon(error.severity)}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <span className=\"text-xs font-mono text-muted-foreground\">\n {error.startLineNumber && error.startColumn\n ? `Line ${error.startLineNumber}:${error.startColumn}`\n : 'Unknown location'}\n </span>\n {error.path && (\n <>\n <span className=\"text-xs text-muted-foreground\">•</span>\n <span className=\"text-xs text-muted-foreground truncate\">\n {formatPath(error.path)}\n </span>\n </>\n )}\n </div>\n <p className=\"text-sm text-foreground\">{error.message}</p>\n {error.code && error.code !== 'validation_error' && (\n <span className=\"text-xs text-muted-foreground font-mono mt-1 inline-block\">\n Code: {error.code}\n </span>\n )}\n </div>\n </div>\n </div>\n );\n}\n\n// Status bar component for minimal error display\nexport function ValidationStatusBar({\n errors,\n onClick,\n className,\n}: {\n errors: JsonEditorError[];\n onClick?: () => void;\n className?: string;\n}) {\n if (errors.length !== 0) {\n return (\n <div\n className={cn(\n 'flex items-center gap-2 px-2 py-1 text-xs cursor-pointer',\n 'bg-destructive/10 text-destructive hover:bg-destructive/15 transition-colors',\n className\n )}\n onClick={onClick}\n >\n <AlertCircle className=\"w-3 h-3\" />\n <span>\n {errors.length} error{errors.length !== 1 ? 's' : ''}\n </span>\n </div>\n );\n }\n}\n","import React, { useRef, useEffect, useState, useCallback } from 'react';\nimport { useTheme } from '../theme-provider';\nimport Editor, { Monaco, DiffEditor } from '@monaco-editor/react';\nimport debounce from 'lodash.debounce';\nimport type { editor } from 'monaco-editor';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useOutputStore } from '../../store/output-store-provider';\nimport { Button } from '../ui/button';\nimport { type JsonEditorError } from '../../lib/json-types';\n// configureMonacoInstance is called at startup (main.tsx) and by useMonacoPlugins\nimport { useEditorRefsStore } from '../../store/editor-refs-store';\nimport {\n getSelectionContext,\n createContextSnippet,\n} from '../../lib/monaco-selection-utils';\nimport { ValidationPanel, ValidationStatusBar } from './validation-panel';\n\ninterface EditorMonacoJsonProps {\n name: string;\n defaultValue?: string;\n value?: string; // when provided, the editor becomes controlled\n saveDocumentDebounceWait: number;\n}\n\nfunction EditorMonacoJson({\n name,\n defaultValue,\n value,\n saveDocumentDebounceWait,\n}: EditorMonacoJsonProps) {\n console.debug(`Render EditorMonacoJson (name: ${name})`);\n\n const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);\n const monacoRef = useRef<Monaco | null>(null);\n const { resolvedTheme } = useTheme();\n const saveDocument = useDocumentsStore((state) => state.saveDocument);\n const bumpEditSequence = useOutputStore((state) => state.bumpEditSequence);\n const setOutput = useOutputStore((state) => state.setOutput);\n const closeDocument = useDocumentsStore((state) => state.closeDocument);\n const pendingDiff = useDocumentsStore((state) => state.pendingDiffs[name]);\n const clearPendingDiff = useDocumentsStore((state) => state.clearPendingDiff);\n const [validationErrors, setValidationErrors] = useState<JsonEditorError[]>(\n []\n );\n const [showValidationPanel, setShowValidationPanel] = useState(true);\n const [isValidationPanelMinimized, setIsValidationPanelMinimized] =\n useState(false);\n const decorationIdsRef = useRef<string[]>([]);\n const { registerEditor, unregisterEditor, setActiveEditor } =\n useEditorRefsStore();\n\n const debouncedSaveDocumentRef = useRef(\n debounce(saveDocument, saveDocumentDebounceWait)\n );\n\n // Setup Monaco editor for JSON with schema validation\n // Note: schema configuration is handled by configureMonaco() at startup\n // and updateMonacoWithPlugins() via useMonacoPlugins hook.\n // Calling configureMonacoInstance here would overwrite plugin-aware schemas.\n const handleEditorWillMount = useCallback((_monaco: Monaco) => {\n console.debug('Setting up Monaco for JSON editor');\n }, []);\n\n function handleEditorDidMount(\n editor: editor.IStandaloneCodeEditor,\n monaco: Monaco\n ) {\n console.debug(`EditorDidMount: (name: ${name})`);\n editorRef.current = editor;\n monacoRef.current = monaco;\n\n // Register editor in the refs store\n registerEditor(name, editor, monaco);\n setActiveEditor(name);\n\n // Ensure the model's language is set to JSON for schema validation\n const model = editor.getModel();\n if (model) {\n monaco.editor.setModelLanguage(model, 'json');\n console.debug('Model language set to JSON for:', model.uri.toString());\n }\n\n // Add context menu action for AI assistant\n editor.addAction({\n id: 'send-to-ai-assistant',\n label: 'Send to AI Assistant (⌘K)',\n contextMenuGroupId: 'navigation',\n contextMenuOrder: 1.5,\n keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK],\n run: function () {\n // Use the editor reference from closure instead of the parameter\n const selection = getSelectionContext(editor, monaco);\n if (selection) {\n const snippet = createContextSnippet(selection);\n // Dispatch event for the chat panel to capture\n window.dispatchEvent(\n new CustomEvent('monaco-selection-to-ai', {\n detail: {\n documentName: name,\n selection,\n snippet,\n },\n })\n );\n }\n },\n });\n\n // Set up keyboard shortcuts\n // Cmd+K => send selection to AI assistant\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyK, () => {\n const selection = getSelectionContext(editor, monaco);\n if (selection) {\n const snippet = createContextSnippet(selection);\n window.dispatchEvent(\n new CustomEvent('monaco-selection-to-ai', {\n detail: {\n documentName: name,\n selection,\n snippet,\n },\n })\n );\n }\n });\n\n // Cmd+S => save command\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {\n const currentValue = editor.getValue();\n if (currentValue) saveDocument(name, currentValue);\n });\n\n // Cmd+W => close command\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyW, () => {\n const currentValue = editor.getValue();\n if (currentValue) saveDocument(name, currentValue);\n closeDocument(name);\n });\n\n // Format document shortcut (Shift+Alt+F)\n editor.addCommand(\n monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF,\n () => {\n editor.getAction('editor.action.formatDocument')?.run();\n }\n );\n\n // Initial validation will be handled by Monaco's onValidate\n }\n\n function handleEditorValidation(markers: editor.IMarker[]) {\n // Convert Monaco's native JSON validation markers to our error format\n console.debug('Monaco validation markers:', markers);\n\n const errors: JsonEditorError[] = markers.map((marker) => ({\n path: '', // Monaco doesn't provide JSON path, but we don't need it for display\n message: marker.message,\n code:\n typeof marker.code === 'string'\n ? marker.code\n : marker.code?.value || 'validation_error',\n startLineNumber: marker.startLineNumber,\n startColumn: marker.startColumn,\n endLineNumber: marker.endLineNumber,\n endColumn: marker.endColumn,\n severity:\n marker.severity === monacoRef.current?.MarkerSeverity.Error\n ? 'error'\n : marker.severity === monacoRef.current?.MarkerSeverity.Warning\n ? 'warning'\n : 'info',\n }));\n\n setValidationErrors(errors);\n setOutput({\n hasValidationErrors: errors.some((e) => e.severity === 'error'),\n });\n\n // Decorations are now handled by Monaco's native validation\n decorationIdsRef.current = [];\n\n // Show validation panel if there are errors\n if (errors.length > 0 && !showValidationPanel) {\n setShowValidationPanel(true);\n setIsValidationPanelMinimized(false);\n }\n }\n\n // Flush debounced saveDocument on unmount and unregister editor\n useEffect(() => {\n const debouncedSaveDocument = debouncedSaveDocumentRef?.current;\n return () => {\n debouncedSaveDocument?.flush();\n // Decorations cleanup handled by Monaco\n unregisterEditor(name);\n console.debug(`EditorWillUnMount: (name: ${name})`);\n };\n }, [name, unregisterEditor]);\n\n // Handle error click - navigate to error in editor\n const handleErrorClick = useCallback((error: JsonEditorError) => {\n if (editorRef.current && error.startLineNumber && error.startColumn) {\n // Navigate to error position\n editorRef.current.setPosition({\n lineNumber: error.startLineNumber,\n column: error.startColumn,\n });\n editorRef.current.revealLineInCenter(error.startLineNumber);\n editorRef.current.focus();\n }\n }, []);\n\n return (\n <div className=\"relative h-full\">\n {pendingDiff ? (\n <>\n <div className=\"flex items-center justify-between px-2 py-1 border-b bg-muted/40 text-xs\">\n <div>\n Review changes for <span className=\"font-medium\">{name}</span>\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => clearPendingDiff(name)}\n >\n Discard\n </Button>\n <Button\n size=\"sm\"\n onClick={() => {\n saveDocument(name, pendingDiff.modified);\n clearPendingDiff(name, true);\n }}\n >\n Apply Changes\n </Button>\n </div>\n </div>\n <DiffEditor\n height=\"calc(100% - 32px)\"\n original={pendingDiff.original}\n modified={pendingDiff.modified}\n language=\"json\"\n theme={`vs-${resolvedTheme}`}\n options={{\n readOnly: true,\n renderSideBySide: true,\n originalEditable: false,\n automaticLayout: true,\n minimap: { enabled: false },\n }}\n beforeMount={handleEditorWillMount}\n />\n </>\n ) : (\n <Editor\n height=\"100%\"\n defaultLanguage=\"json\"\n theme={`vs-${resolvedTheme}`}\n defaultPath={name.endsWith('.json') ? name : `${name}.json`}\n value={value ?? defaultValue}\n beforeMount={handleEditorWillMount}\n onMount={handleEditorDidMount}\n onValidate={handleEditorValidation}\n onChange={(value) => {\n if (value) {\n bumpEditSequence();\n debouncedSaveDocumentRef.current(name, value);\n }\n }}\n options={{\n minimap: { enabled: true },\n scrollBeyondLastLine: true,\n wordWrap: 'on',\n automaticLayout: true,\n formatOnPaste: true,\n formatOnType: true,\n tabSize: 2,\n insertSpaces: true,\n detectIndentation: false,\n folding: true,\n foldingStrategy: 'indentation',\n showFoldingControls: 'always',\n bracketPairColorization: { enabled: true },\n guides: {\n bracketPairs: true,\n indentation: true,\n },\n // Enhanced suggest options for better autocomplete\n suggest: {\n showProperties: true,\n showMethods: true,\n showFunctions: true,\n showConstructors: true,\n showDeprecated: true,\n showFields: true,\n showVariables: true,\n showClasses: true,\n showStructs: true,\n showInterfaces: true,\n showModules: true,\n showTypeParameters: true,\n showValues: true,\n showConstants: true,\n showEnums: true,\n showEnumMembers: true,\n showKeywords: true,\n showWords: false,\n showColors: true,\n showFiles: false,\n showReferences: true,\n showFolders: false,\n showOperators: true,\n showUnits: true,\n showSnippets: true,\n snippetsPreventQuickSuggestions: false,\n insertMode: 'insert', // Changed from 'replace' to 'insert' for better UX\n filterGraceful: true, // Allow fuzzy matching\n localityBonus: true, // Prioritize nearby suggestions\n shareSuggestSelections: true, // Share suggestions across files\n showIcons: true, // Show icons in suggestions\n },\n // Quick suggestions appear faster\n quickSuggestions: {\n strings: true,\n comments: false,\n other: true,\n },\n quickSuggestionsDelay: 10, // Faster suggestions\n suggestSelection: 'first',\n suggestOnTriggerCharacters: true,\n acceptSuggestionOnEnter: 'on',\n acceptSuggestionOnCommitCharacter: true,\n wordBasedSuggestions: 'off', // Disable word-based to rely on schema\n // IntelliSense features\n parameterHints: {\n enabled: true,\n cycle: true,\n },\n hover: {\n enabled: true,\n delay: 300,\n sticky: true,\n },\n // Better completion behavior\n tabCompletion: 'on',\n snippetSuggestions: 'inline',\n inlineSuggest: {\n enabled: true,\n },\n }}\n />\n )}\n\n {/* Validation Status Bar */}\n <div className=\"absolute top-0 right-0\">\n <ValidationStatusBar\n errors={validationErrors}\n onClick={() => {\n setShowValidationPanel(true);\n setIsValidationPanelMinimized(false);\n }}\n />\n </div>\n\n {/* Enhanced Validation Panel */}\n {showValidationPanel && validationErrors.length > 0 && (\n <ValidationPanel\n errors={validationErrors}\n isMinimized={isValidationPanelMinimized}\n onToggleMinimize={() =>\n setIsValidationPanelMinimized(!isValidationPanelMinimized)\n }\n onErrorClick={handleErrorClick}\n onClose={() => setShowValidationPanel(false)}\n className=\"z-40\"\n />\n )}\n </div>\n );\n}\n\nexport const EditorMonacoJsonMemoized = React.memo(\n EditorMonacoJson,\n (prev, next) => {\n return (\n prev.name === next.name &&\n prev.value === next.value &&\n prev.saveDocumentDebounceWait === next.saveDocumentDebounceWait\n );\n }\n);\n"],"names":["FUNC_ERROR_TEXT","NAN","symbolTag","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","global","freeSelf","root","objectProto","objectToString","nativeMax","nativeMin","now","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","toNumber","isObject","invokeFunc","time","args","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","value","type","isObjectLike","isSymbol","other","isBinary","lodash_debounce","useEditorRefsStore","create","set","get","documentName","editor","monaco","state","newEditors","getSelectionContext","model","selection","finalText","getWordAtCursor","fullDocumentText","fullDocument","isValidJson","jsonPath","getJsonPathAtPosition","propertyKey","extractPropertyKey","_monaco","position","word","documentText","lineNumber","column","lines","path","depth","inArray","arrayIndex","i","line","j","char","_a","propertyMatch","_column","prevLine","prevMatch","extractJsonSubtree","obj","parts","current","part","arrayMatch","key","index","createContextSnippet","context","subtree","subtreeStr","ValidationPanel","errors","onErrorClick","onClose","className","isMinimized","onToggleMinimize","isExpanded","setIsExpanded","useState","useEffect","hasErrors","errorCount","toggleExpanded","jsxs","cn","jsx","AlertCircle","CopyErrorsButton","e","ChevronDown","ChevronUp","X","error","ErrorItem","copied","setCopied","handleCopy","text","err","Fragment","Check","Copy","onClick","getSeverityIcon","severity","AlertTriangle","formatPath","ValidationStatusBar","EditorMonacoJson","name","defaultValue","saveDocumentDebounceWait","editorRef","useRef","monacoRef","resolvedTheme","useTheme","saveDocument","useDocumentsStore","bumpEditSequence","useOutputStore","setOutput","closeDocument","pendingDiff","clearPendingDiff","validationErrors","setValidationErrors","showValidationPanel","setShowValidationPanel","isValidationPanelMinimized","setIsValidationPanelMinimized","decorationIdsRef","registerEditor","unregisterEditor","setActiveEditor","debouncedSaveDocumentRef","handleEditorWillMount","useCallback","handleEditorDidMount","snippet","currentValue","handleEditorValidation","markers","marker","_b","_c","debouncedSaveDocument","handleErrorClick","Button","DiffEditor","Editor","EditorMonacoJsonMemoized","React","prev","next"],"mappings":"sdAUA,IAAIA,EAAkB,sBAGlBC,EAAM,IAGNC,EAAY,kBAGZC,EAAS,aAGTC,EAAa,qBAGbC,EAAa,aAGbC,EAAY,cAGZC,EAAe,SAGfC,EAAa,OAAOC,GAAU,UAAYA,GAAUA,EAAO,SAAW,QAAUA,EAGhFC,EAAW,OAAO,MAAQ,UAAY,MAAQ,KAAK,SAAW,QAAU,KAGxEC,EAAOH,GAAcE,GAAY,SAAS,aAAa,EAAC,EAGxDE,EAAc,OAAO,UAOrBC,EAAiBD,EAAY,SAG7BE,EAAY,KAAK,IACjBC,EAAY,KAAK,IAkBjBC,EAAM,UAAW,CACnB,OAAOL,EAAK,KAAK,IAAG,CACtB,EAwDA,SAASM,EAASC,EAAMC,EAAMC,EAAS,CACrC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAAiB,EACjBC,EAAU,GACVC,EAAS,GACTC,EAAW,GAEf,GAAI,OAAOZ,GAAQ,WACjB,MAAM,IAAI,UAAUlB,CAAe,EAErCmB,EAAOY,EAASZ,CAAI,GAAK,EACrBa,EAASZ,CAAO,IAClBQ,EAAU,CAAC,CAACR,EAAQ,QACpBS,EAAS,YAAaT,EACtBG,EAAUM,EAASf,EAAUiB,EAASX,EAAQ,OA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