{"version":3,"file":"index.js","names":["htmlStartTagReg","htmlTagWithNameReg","htmlTagReg","htmlImgTagReg","htmlVideoTagReg","HtmlDiff","config","leastCommonLength","Infinity","matchedBlockList","newTokens","oldTokens","operationList","sideBySideContents","unifiedContent","constructor","oldHtml","newHtml","classNames","createBlock","createInline","deleteBlock","deleteInline","greedyBoundary","greedyMatch","minMatchedSize","tokenizeByCharacter","trim","equalSequence","content","replace","match","name","tagNameLength","length","slice","tokenizeFn","tokenizeByWord","getMatchedBlockList","getOperationList","computeBestMatchedBlock","oldStart","oldEnd","newStart","newEnd","bestMatchedBlock","i","len","Math","min","ret","slideBestMatchedBlock","size","j","computeMatchedBlockList","matchBlock","push","dressUpBlockTag","type","token","dressUpDiffContent","tokens","tokensLength","result","textStartIndex","isMatchElement","includes","isMatchExplicitlyDisabled","isHtmlTag","dressUpText","newToken","dressupMatchEnabledHtmlTag","dressUpInlineTag","tagName","groups","matchType","text","join","n1","n2","start","end","e1","e2","commonLength","floor","unshift","walkIndexOld","walkIndexNew","matchedBlock","isOldStartIndexMatched","isNewStartIndexMatched","operationBase","Object","assign","maxIndexOld","maxIndexNew","tailOperationBase","isOldFinished","isNewFinished","addA","addB","maxSize","continuousSize","html","currentPos","tagRegex","exec","beforeTag","substring","index","char","remaining","getSideBySideContents","undefined","forEach","operation","deletedTokens","equalTokens","equalString","startTagMatch","console","error","String","getUnifiedContent","olds","news","createdTokens","createIndex","deleteIndex","deletedToken","matchTagResultD","some","item","splice","isTagInNewFind","tempCreateIndex","createdToken","matchTagResultC","isEnd"],"sources":["../../../../src/elements/HTMLDiff/diff/index.ts"],"sourcesContent":["// Taken and modified from https://github.com/Arman19941113/html-diff/blob/master/packages/html-diff/src/index.ts\n\ninterface MatchedBlock {\n newEnd: number\n newStart: number\n oldEnd: number\n oldStart: number\n size: number\n}\n\ninterface Operation {\n /**\n * Index of entry in tokenized token list\n */\n newEnd: number\n newStart: number\n oldEnd: number\n oldStart: number\n type: 'create' | 'delete' | 'equal' | 'replace'\n}\n\ntype BaseOpType = 'create' | 'delete'\n\ninterface HtmlDiffConfig {\n classNames: {\n createBlock: string\n createInline: string\n deleteBlock: string\n deleteInline: string\n }\n greedyBoundary: number\n greedyMatch: boolean\n minMatchedSize: number\n}\n\nexport interface HtmlDiffOptions {\n /**\n * The classNames for wrapper DOM.\n * Use this to configure your own styles without importing the built-in CSS file\n */\n classNames?: Partial<{\n createBlock?: string\n createInline?: string\n deleteBlock?: string\n deleteInline?: string\n }>\n /**\n * @defaultValue 1000\n */\n greedyBoundary?: number\n /**\n * When greedyMatch is enabled, if the length of the sub-tokens exceeds greedyBoundary,\n * we will use the matched sub-tokens that are sufficiently good, even if they are not optimal, to enhance performance.\n * @defaultValue true\n */\n greedyMatch?: boolean\n /**\n * Determine the minimum threshold for calculating common sub-tokens.\n * You may adjust it to a value larger than 2, but not lower, due to the potential inclusion of HTML tags in the count.\n * @defaultValue 2\n */\n minMatchedSize?: number\n /**\n * Whether to tokenize by character or by word.\n * @defaultValue false\n */\n tokenizeByCharacter?: boolean\n}\n\n// eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation\nconst htmlStartTagReg = /^<(?[^\\s/>]+)[^>]*>$/\n// eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation\nconst htmlTagWithNameReg = /^<(?\\/)?(?[^\\s>]+)[^>]*>$/\n\nconst htmlTagReg = /^<[^>]+>/\nconst htmlImgTagReg = /^
]*>$/\nconst htmlVideoTagReg = /^