@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
113 lines (93 loc) • 3.58 kB
JavaScript
import { __exports as documentMatchers } from '../../../../_virtual/document-matchers.js';
var hasRequiredDocumentMatchers;
function requireDocumentMatchers () {
if (hasRequiredDocumentMatchers) return documentMatchers;
hasRequiredDocumentMatchers = 1;
documentMatchers.paragraph = paragraph;
documentMatchers.run = run;
documentMatchers.table = table;
documentMatchers.bold = new Matcher("bold");
documentMatchers.italic = new Matcher("italic");
documentMatchers.underline = new Matcher("underline");
documentMatchers.strikethrough = new Matcher("strikethrough");
documentMatchers.allCaps = new Matcher("allCaps");
documentMatchers.smallCaps = new Matcher("smallCaps");
documentMatchers.highlight = highlight;
documentMatchers.commentReference = new Matcher("commentReference");
documentMatchers.lineBreak = new BreakMatcher({breakType: "line"});
documentMatchers.pageBreak = new BreakMatcher({breakType: "page"});
documentMatchers.columnBreak = new BreakMatcher({breakType: "column"});
documentMatchers.equalTo = equalTo;
documentMatchers.startsWith = startsWith;
function paragraph(options) {
return new Matcher("paragraph", options);
}
function run(options) {
return new Matcher("run", options);
}
function table(options) {
return new Matcher("table", options);
}
function highlight(options) {
return new HighlightMatcher(options);
}
function Matcher(elementType, options) {
options = options || {};
this._elementType = elementType;
this._styleId = options.styleId;
this._styleName = options.styleName;
if (options.list) {
this._listIndex = options.list.levelIndex;
this._listIsOrdered = options.list.isOrdered;
}
}
Matcher.prototype.matches = function(element) {
return element.type === this._elementType &&
(this._styleId === undefined || element.styleId === this._styleId) &&
(this._styleName === undefined || (element.styleName && this._styleName.operator(this._styleName.operand, element.styleName))) &&
(this._listIndex === undefined || isList(element, this._listIndex, this._listIsOrdered)) &&
(this._breakType === undefined || this._breakType === element.breakType);
};
function HighlightMatcher(options) {
options = options || {};
this._color = options.color;
}
HighlightMatcher.prototype.matches = function(element) {
return element.type === "highlight" &&
(this._color === undefined || element.color === this._color);
};
function BreakMatcher(options) {
options = options || {};
this._breakType = options.breakType;
}
BreakMatcher.prototype.matches = function(element) {
return element.type === "break" &&
(this._breakType === undefined || element.breakType === this._breakType);
};
function isList(element, levelIndex, isOrdered) {
return element.numbering &&
element.numbering.level == levelIndex &&
element.numbering.isOrdered == isOrdered;
}
function equalTo(value) {
return {
operator: operatorEqualTo,
operand: value
};
}
function startsWith(value) {
return {
operator: operatorStartsWith,
operand: value
};
}
function operatorEqualTo(first, second) {
return first.toUpperCase() === second.toUpperCase();
}
function operatorStartsWith(first, second) {
return second.toUpperCase().indexOf(first.toUpperCase()) === 0;
}
return documentMatchers;
}
export { requireDocumentMatchers as __require };
//# sourceMappingURL=document-matchers.js.map