{"version":3,"file":"base_controller-BoJV6Y0I.js","sources":["../../../app/javascript/controllers/compose/models/piece.js","../../../app/javascript/controllers/compose/models/cursor.js","../../../app/javascript/controllers/compose/models/liquid/parser.js","../../../app/javascript/controllers/compose/models/liquid/token.js","../../../app/javascript/controllers/compose/models/liquid/tag.js","../../../app/javascript/controllers/compose/models/liquid/stack.js","../../../app/javascript/controllers/compose/base_controller.js"],"sourcesContent":["import { Character } from './character'\n\nclass Piece {\n static wrap(piece) {\n return new Piece(piece)\n }\n\n constructor(piece) {\n this.piece = piece\n this.string = piece?.string\n this.character = Character.fromPiece(piece)\n }\n\n valueOf() {\n return this.string\n }\n\n get id() {\n return this.piece?.id\n }\n\n get isLineFeed() {\n return this.character.isLineFeed\n }\n\n get isWhitespace() {\n return this.character.isWhitespace\n }\n\n get endsWithWhitespace() {\n return this.string && new Character(this.string.charAt(this.string.length - 1)).isWhitespace\n }\n\n get endsWithLineFeed() {\n return this.string && new Character(this.string.charAt(this.string.length - 1)).isLineFeed\n }\n\n get isWord() {\n return this.string.trim().length > 0\n }\n\n get isShortlink() {\n return this.piece && !!this.piece.attachment\n }\n\n get isAnchor() {\n return this.piece.attributes.has('href')\n }\n\n get isTag() {\n if(this.#isPastedFromClipboard) {\n return this.piece.attributes.get('background') === 'rgb(231, 229, 234)'\n }\n\n return this.piece.attributes.has('background') && this.piece.attributes.has('padding') && this.piece.attributes.has('rounded')\n }\n\n get isAlphanumeric() {\n return this.character.isAlphanumeric\n }\n\n get #isPastedFromClipboard() {\n // When a tag is copied without the braces, it will only have the background attribute\n return this.piece.attributes.has('background') && !this.piece.attributes.has('padding') && !this.piece.attributes.has('rounded')\n }\n}\n\nexport { Piece }\n","import { Piece } from './piece';\nimport { Character } from './character';\n\nclass Cursor {\n constructor(inputController) {\n this.inputController = inputController;\n }\n\n ensureCaretVisibility() {\n const document = this.editor.getDocument()\n const documentString = document.toString()\n\n if(documentString.length <= 1) {\n this.editor.setSelectedRange([0, 0])\n this.editor.insertHTML('‌')\n }\n }\n\n moveToLeft() {\n setTimeout(() => {\n const [start, _] = this.editor.getSelectedRange()\n this.moveTo(start - 1, false)\n })\n }\n\n moveToRight() {\n setTimeout(() => {\n const [_, end] = this.editor.getSelectedRange()\n this.moveTo(end + 1, false)\n })\n }\n\n moveTo(range, timeout = true) {\n if(timeout) {\n return setTimeout(() => {\n this.editor.setSelectedRange(range)\n })\n }\n\n this.editor.setSelectedRange(range)\n }\n\n moveToEnd() {\n this.editor.setSelectedRange(this.trixDocument.toString().length - 1)\n }\n\n pieceAtCaret(position = this.editor.getSelectedRange()[0]) {\n return new Piece(this.editor.getDocument().getPieceAtPosition(position))\n }\n\n pieceAtCaretIsShortLink(position = this.editor.getSelectedRange()[0]) {\n return this.pieceAtCaret(position).isShortlink\n }\n\n pieceAtCaretIsTag(position = this.editor.getSelectedRange()[0]) {\n const pieceBeforeCursor = this.pieceBeforeCaret(position)\n const pieceAtCursor = this.pieceAtCaret(position)\n\n const userIsWritingInsideATag = pieceBeforeCursor.piece === pieceAtCursor.piece\n\n return pieceAtCursor.isTag && !userIsWritingInsideATag\n }\n pieceBeforeCaret(position = this.editor.getSelectedRange()[0]) {\n return new Piece(this.editor.getDocument().getPieceAtPosition(position - 1))\n }\n\n pieceBeforeCaretIsShortLink(position = this.editor.getSelectedRange()[0]) {\n return this.pieceBeforeCaret(position).isShortlink\n }\n\n pieceBeforeCaretIsTag(position = this.editor.getSelectedRange()[0]) {\n const pieceBeforeCursor = this.pieceBeforeCaret(position)\n const pieceAtCursor = this.pieceAtCaret(position)\n\n const userIsWritingInsideATag = pieceBeforeCursor.piece === pieceAtCursor.piece\n\n return pieceBeforeCursor.isTag && !userIsWritingInsideATag\n }\n\n pieceAfterCaret(position = this.editor.getSelectedRange()[0]) {\n return new Piece(this.editor.getDocument().getPieceAtPosition(position + 1))\n }\n\n characterAtCaret(position = this.editor.getSelectedRange()[0]) {\n return new Character(this.editor.getDocument().getCharacterAtPosition(position))\n }\n\n characterBeforeCaret(position = this.editor.getSelectedRange()[0]) {\n return new Character(this.editor.getDocument().getCharacterAtPosition(position - 1))\n }\n\n characterAfterCaret(position = this.editor.getSelectedRange()[0]) {\n return new Character(this.editor.getDocument().getCharacterAtPosition(position + 1))\n }\n\n stringAtRange(range = this.inputController.trixPosition) {\n return this.trixDocument.getStringAtRange(range).toString()\n }\n\n get editor() {\n return this.inputController.editor\n }\n\n get trixDocument() {\n return this.editor.getDocument()\n }\n}\n\nexport { Cursor }\n","import { Piece } from '../piece'\n\nimport { Character } from '../character'\nimport { Token, Stack, Contact, Coupon } from './index'\n\nclass Parser {\n constructor(compose) {\n this.compose = compose\n\n this.contactWhitelistedTags = this.compose.allowedProfileTagsValue\n this.couponWhitelistedTags = this.compose.allowedCouponTagsValue\n }\n\n get tokens() {\n const tokens = []\n const document = this.compose.trixDocument\n\n Contact.whitelistedTags = this.contactWhitelistedTags.map(tag => tag.toLowerCase())\n Coupon.whitelistedTags = this.couponWhitelistedTags\n\n document.getPieces().forEach((piece, pieceIndex) => {\n if (piece.attachment) return\n\n if (Piece.wrap(piece).isTag) {\n return tokens.push(this.tokenFromPiece(piece, pieceIndex))\n }\n\n const content = piece.string\n const stack = new Stack()\n\n content.split('').forEach((character, index) => {\n const token = new Character(character)\n\n if(token.isAstrix) {\n stack.push({token, index})\n\n const [firstToken, lastToken] = stack.borderlineObjects\n\n if(firstToken?.token.isAstrix && lastToken?.token.isAstrix) {\n console.log('should mark as bold')\n }\n } else if (token.isOpeningBrace) {\n if (stack.head?.token?.isOpeningBrace) {\n stack.clear()\n }\n\n stack.push({token, index})\n } else if (token.isClosingBrace && stack.head?.token?.isOpeningBrace) {\n const lastToken = tokens[tokens.length - 1]\n const newLastToken = stack\n .push({token, index})\n .tokenize(this.compose.contentLengthBeforePiece(pieceIndex))\n\n tokens.push(newLastToken)\n\n if(lastToken?.end === newLastToken.start) {\n newLastToken.addWhitespace = true\n }\n\n stack.clear()\n } else {\n const [firstToken, lastToken] = stack.borderlineObjects\n\n if (firstToken?.token.isOpeningBrace && !lastToken?.token?.isClosingBrace) {\n stack.push({token, index})\n }\n\n if(firstToken?.token?.isAstrix && !lastToken?.token.isAstrix) {\n stack.push({token, index})\n }\n }\n })\n })\n\n return tokens\n }\n\n // private\n\n tokenFromPiece(piece, pieceIndex) {\n const startsAt = this.compose.contentLengthBeforePiece(pieceIndex)\n\n return new Token(piece.string, {\n start: startsAt,\n end: startsAt + piece.string.length,\n isValidTagName: Contact.isValidTag(piece.string) || Coupon.isValidTag(piece.string),\n piece: Piece.wrap(piece),\n })\n }\n}\n\nexport { Parser }\n","class Token {\n constructor(token, { start, end, isValidTagName }) {\n this.word = token\n this.start = start\n this.end = end\n this.isValidTagName = isValidTagName\n this.addWhitespace = false\n }\n\n get range() {\n return [this.start, this.end]\n }\n\n get invalid() {\n return !this.isValidTagName\n }\n\n get valid() {\n return this.isValidTagName\n }\n\n get shouldAddWhitespaceBefore() {\n return this.addWhitespace\n }\n}\n\nexport { Token }\n","class Tag {\n static whitelistedTags = []\n\n static isTag(word) {\n return word.startsWith(\"{\") && word.endsWith(\"}\")\n }\n}\n\nclass Coupon extends Tag {\n static isValidTag(word) {\n return [\"{coupon}\", \"{couponLink}\", \"{couponDescription}\"].includes(word)\n }\n}\n\nclass Contact extends Tag {\n static isValidTag(token) {\n const word = token.toLowerCase()\n\n if (this.whitelistedTags.includes(word)) return true\n if(!word.startsWith(\"{\") || !word.endsWith(\"}\")) return false\n\n // Remove Braces from the word\n let strippedWord = word.substring(1, word.length - 1)\n\n return (\n strippedWord.split(\"|\").length === 2 && // only a single pipe is present\n strippedWord.split(\"|\")[1].trim().length > 0 // default value is provided\n )\n }\n}\n\nexport { Contact, Coupon }\n","import { Token } from './token'\nimport { Contact, Coupon } from './tag'\n\nclass Stack {\n constructor() {\n this.stack = []\n }\n\n push(item) {\n this.stack.push(item)\n return this\n }\n\n map(callback) {\n return this.stack.map(callback)\n }\n\n tokenize(stackStartsAt) {\n const word = this.join('')\n const start = stackStartsAt + this.head.index\n const end = start + this.size\n const isValidTagName = Contact.isValidTag(word) || Coupon.isValidTag(word)\n\n return new Token(word, {\n start,\n end,\n isValidTagName,\n }\n )\n }\n\n join(separator) {\n return this.stack.map(({token}) => token.key).join(separator)\n }\n\n clear() {\n this.stack = []\n }\n\n get borderlineObjects() {\n return [this.head, this.tail]\n }\n\n get head() {\n return this.stack[0]\n }\n\n // private\n\n get tail() {\n if(this.size === 1) return null\n return this.stack[this.stack.length - 1]\n }\n\n get size() {\n return this.stack.length\n }\n}\n\nexport { Stack }\n","import ApplicationController from '../application_controller'\nimport {\n Cursor,\n Parser\n} from \"./models\"\n\nexport default class extends ApplicationController {\n static values = {\n autoFocus: { type: Boolean, default: true },\n disabled: { type: Boolean, default: false }\n }\n\n static targets = [\n 'input',\n 'trix',\n 'reset'\n ]\n\n initialize() {\n super.initialize()\n\n this.respondToTrixEvent = this.respondToTrixEvent.bind(this)\n this.onTrixSelectionChange = this.onTrixSelectionChange.bind(this)\n\n this.cursor = new Cursor(this)\n this.parser = new Parser(this)\n }\n\n connect() {\n super.connect()\n this.registerTrixEventListeners()\n }\n\n disconnect() {\n this.unregisterTrixEventListeners()\n super.disconnect()\n }\n\n onTrixInitialize() {\n this.initialized = true\n this.disabled = this.trixTarget.hasAttribute('disabled')\n\n this.disableDefaultTrixToolbar()\n }\n\n onTrixSelectionChange() {\n this.oldPosition = this.trixPosition\n this.trixPosition = this.editor.getSelectedRange()\n }\n\n disableDefaultTrixToolbar() {\n this.element.querySelector('trix-toolbar').remove()\n }\n\n ensureWhitespaceBeforeCursor() {\n const characterAtCursor = this.cursor.characterAtCaret()\n const [_, end] = this.editor.getSelectedRange()\n\n if (characterAtCursor.isWhitespace) {\n this.editor.setSelectedRange(end + 1)\n } else {\n this.editor.setSelectedRange(end)\n\n this.insertWhitespace()\n this.cursor.moveToRight()\n }\n }\n\n ensureWhitespaceAfterCursor() {\n const [start, _] = this.editor.getSelectedRange()\n\n this.editor.setSelectedRange(start)\n\n this.insertWhitespace()\n this.cursor.moveToLeft()\n }\n\n contentLengthBeforePiece(index) {\n return this.trixDocument\n .getPieces()\n .filter((piece, position) => position < index)\n .map(piece => piece.attachment ? 1 : piece.string.length)\n .reduce((a, b) => a + b, 0)\n }\n\n resetContent() {\n this.editor.setSelectedRange([0, this.editor.getDocument().toString().length])\n this.editor.deleteInDirection('backward')\n }\n\n deleteStartingZeroWidthNonJoinerSpace() {\n this.editor.setSelectedRange([0, 0])\n this.editor.deleteInDirection(\"forward\")\n\n this.nextTick(() => {\n const [start, end] = this.editor.getSelectedRange()\n this.editor.setSelectedRange([start + 1, end + 1])\n })\n }\n\n enable() {\n if(!this.initialized) return\n\n this.inputContainerTarget.removeAttribute('disabled')\n this.trixTarget.editor.element.setAttribute('contentEditable', true)\n\n this.trixTarget.setAttribute('placeholder', this.translations.compose.placeholder.active)\n\n this.nextTick(() => this.cursor.ensureCaretVisibility())\n this.disabledValue = false\n }\n\n disable() {\n if(!this.initialized) return\n\n this.inputContainerTarget.setAttribute('disabled', true)\n\n this.trixTarget.editor.element.setAttribute('contentEditable', false)\n\n this.trixTarget.value = ''\n this.trixTarget.setAttribute('placeholder', this.translations.compose.placeholder.disabled)\n\n this.disabledValue = true\n }\n\n get isEnabled() {\n return this.disabledValue === false\n }\n\n get isDisabled() {\n return !this.isEnabled\n }\n\n // private\n\n insertWhitespace() {\n this.editor.recordUndoEntry('insert whitespace')\n this.editor.insertString(' ')\n }\n\n registerTrixEventListeners() {\n this.methods = {\n 'trix-change': 'onTrixContentChange',\n 'trix-initialize': 'onTrixInitialize',\n 'keydown': 'onTrixKeydown',\n 'keyup': 'onTrixKeyup',\n 'blur': 'onTrixBlur',\n 'focus': 'onTrixFocus',\n 'trix-selection-change': 'onTrixSelectionChange',\n 'trix-paste': 'onTrixPaste',\n 'trix-before-paste': 'onTrixBeforePaste',\n 'click': 'onTrixClick',\n }\n\n Object.entries(this.methods)\n .filter(this.respondToTrixEvent)\n .forEach(([eventName, methodName]) => {\n this.trixTarget.addEventListener(eventName, this[methodName].bind(this))\n })\n }\n\n unregisterTrixEventListeners() {\n Object.entries(this.methods)\n .filter(this.respondToTrixEvent)\n .forEach(([eventName, methodName]) => {\n this.trixTarget.removeEventListener(eventName, this[methodName].bind(this))\n })\n }\n\n respondToTrixEvent([_, methodName]) {\n return this[methodName]\n }\n\n restoreSelectionTo([start, end]) {\n this.restoringSelection = true\n this.nextTick(() => this.restoringSelection = false)\n\n this.editor.setSelectedRange([start, end])\n }\n\n get noSelection() {\n const [start, end] = this.editor.getSelectedRange()\n return start === end\n }\n\n get editor() {\n return this.trixTarget.editor\n }\n\n get trixDocument() {\n return this.editor.getDocument()\n }\n\n get documentStringWithoutZeroWidthNonJoinerAndLineFeed() {\n return this.trixDocument.toString().replace(/\\u200C/g, '').replace(/\\n/g, '')\n }\n\n get documentStartsWithZeroWidthNonJoinerSpace() {\n const documentString = this.trixDocument.toString()\n return (documentString.length > 2 && documentString.charCodeAt(0) === 8204)\n }\n\n get currentRange() {\n return this.editor.getSelectedRange()\n }\n\n get inTemplateCreationMode() {\n return this.mode === 'template'\n }\n\n get mode() {\n return this.element.dataset.mode\n }\n}\n"],"names":["_Piece","piece","__privateAdd","_Piece_instances","Character","_a","__privateGet","isPastedFromClipboard_get","Piece","Cursor","inputController","start","_","end","range","timeout","position","pieceBeforeCursor","pieceAtCursor","userIsWritingInsideATag","Parser","compose","tokens","document","Contact","tag","Coupon","pieceIndex","content","stack","Stack","character","index","token","firstToken","lastToken","_b","_d","_c","newLastToken","_e","_f","startsAt","Token","isValidTagName","Tag","word","__publicField","strippedWord","item","callback","stackStartsAt","separator","ComposeController","ApplicationController","characterAtCursor","a","b","eventName","methodName","documentString"],"mappings":"wgBAEA,MAAMA,EAAN,MAAMA,CAAM,CAKV,YAAYC,EAAO,CALrBC,EAAA,KAAAC,GAMI,KAAK,MAAQF,EACb,KAAK,OAASA,GAAA,YAAAA,EAAO,OACrB,KAAK,UAAYG,EAAU,UAAUH,CAAK,CAC9C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