UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

445 lines (377 loc) 15.1 kB
import { __module as XMLDocumentCB$1 } from '../../../_virtual/XMLDocumentCB2.js'; import { __require as requireUtility } from './Utility.js'; import { __require as requireXMLElement } from './XMLElement.js'; import { __require as requireXMLCData } from './XMLCData.js'; import { __require as requireXMLComment } from './XMLComment.js'; import { __require as requireXMLRaw } from './XMLRaw.js'; import { __require as requireXMLText } from './XMLText.js'; import { __require as requireXMLProcessingInstruction } from './XMLProcessingInstruction.js'; import { __require as requireXMLDeclaration } from './XMLDeclaration.js'; import { __require as requireXMLDocType } from './XMLDocType.js'; import { __require as requireXMLDTDAttList } from './XMLDTDAttList.js'; import { __require as requireXMLDTDEntity } from './XMLDTDEntity.js'; import { __require as requireXMLDTDElement } from './XMLDTDElement.js'; import { __require as requireXMLDTDNotation } from './XMLDTDNotation.js'; import { __require as requireXMLAttribute } from './XMLAttribute.js'; import { __require as requireXMLStringifier } from './XMLStringifier.js'; import { __require as requireXMLStringWriter } from './XMLStringWriter.js'; var XMLDocumentCB = XMLDocumentCB$1.exports; var hasRequiredXMLDocumentCB; function requireXMLDocumentCB () { if (hasRequiredXMLDocumentCB) return XMLDocumentCB$1.exports; hasRequiredXMLDocumentCB = 1; // Generated by CoffeeScript 1.12.7 (function() { var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, hasProp = {}.hasOwnProperty; ref = /*@__PURE__*/ requireUtility(), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue; XMLElement = /*@__PURE__*/ requireXMLElement(); XMLCData = /*@__PURE__*/ requireXMLCData(); XMLComment = /*@__PURE__*/ requireXMLComment(); XMLRaw = /*@__PURE__*/ requireXMLRaw(); XMLText = /*@__PURE__*/ requireXMLText(); XMLProcessingInstruction = /*@__PURE__*/ requireXMLProcessingInstruction(); XMLDeclaration = /*@__PURE__*/ requireXMLDeclaration(); XMLDocType = /*@__PURE__*/ requireXMLDocType(); XMLDTDAttList = /*@__PURE__*/ requireXMLDTDAttList(); XMLDTDEntity = /*@__PURE__*/ requireXMLDTDEntity(); XMLDTDElement = /*@__PURE__*/ requireXMLDTDElement(); XMLDTDNotation = /*@__PURE__*/ requireXMLDTDNotation(); XMLAttribute = /*@__PURE__*/ requireXMLAttribute(); XMLStringifier = /*@__PURE__*/ requireXMLStringifier(); XMLStringWriter = /*@__PURE__*/ requireXMLStringWriter(); XMLDocumentCB$1.exports = (function() { function XMLDocumentCB(options, onData, onEnd) { var writerOptions; this.name = "?xml"; options || (options = {}); if (!options.writer) { options.writer = new XMLStringWriter(options); } else if (isPlainObject(options.writer)) { writerOptions = options.writer; options.writer = new XMLStringWriter(writerOptions); } this.options = options; this.writer = options.writer; this.stringify = new XMLStringifier(options); this.onDataCallback = onData || function() {}; this.onEndCallback = onEnd || function() {}; this.currentNode = null; this.currentLevel = -1; this.openTags = {}; this.documentStarted = false; this.documentCompleted = false; this.root = null; } XMLDocumentCB.prototype.node = function(name, attributes, text) { var ref1, ref2; if (name == null) { throw new Error("Missing node name."); } if (this.root && this.currentLevel === -1) { throw new Error("Document can only have one root node. " + this.debugInfo(name)); } this.openCurrent(); name = getValue(name); if (attributes === null && (text == null)) { ref1 = [{}, null], attributes = ref1[0], text = ref1[1]; } if (attributes == null) { attributes = {}; } attributes = getValue(attributes); if (!isObject(attributes)) { ref2 = [attributes, text], text = ref2[0], attributes = ref2[1]; } this.currentNode = new XMLElement(this, name, attributes); this.currentNode.children = false; this.currentLevel++; this.openTags[this.currentLevel] = this.currentNode; if (text != null) { this.text(text); } return this; }; XMLDocumentCB.prototype.element = function(name, attributes, text) { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.dtdElement.apply(this, arguments); } else { return this.node(name, attributes, text); } }; XMLDocumentCB.prototype.attribute = function(name, value) { var attName, attValue; if (!this.currentNode || this.currentNode.children) { throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name)); } if (name != null) { name = getValue(name); } if (isObject(name)) { for (attName in name) { if (!hasProp.call(name, attName)) continue; attValue = name[attName]; this.attribute(attName, attValue); } } else { if (isFunction(value)) { value = value.apply(); } if (!this.options.skipNullAttributes || (value != null)) { this.currentNode.attributes[name] = new XMLAttribute(this, name, value); } } return this; }; XMLDocumentCB.prototype.text = function(value) { var node; this.openCurrent(); node = new XMLText(this, value); this.onData(this.writer.text(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.cdata = function(value) { var node; this.openCurrent(); node = new XMLCData(this, value); this.onData(this.writer.cdata(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.comment = function(value) { var node; this.openCurrent(); node = new XMLComment(this, value); this.onData(this.writer.comment(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.raw = function(value) { var node; this.openCurrent(); node = new XMLRaw(this, value); this.onData(this.writer.raw(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.instruction = function(target, value) { var i, insTarget, insValue, len, node; this.openCurrent(); if (target != null) { target = getValue(target); } if (value != null) { value = getValue(value); } if (Array.isArray(target)) { for (i = 0, len = target.length; i < len; i++) { insTarget = target[i]; this.instruction(insTarget); } } else if (isObject(target)) { for (insTarget in target) { if (!hasProp.call(target, insTarget)) continue; insValue = target[insTarget]; this.instruction(insTarget, insValue); } } else { if (isFunction(value)) { value = value.apply(); } node = new XMLProcessingInstruction(this, target, value); this.onData(this.writer.processingInstruction(node, this.currentLevel + 1), this.currentLevel + 1); } return this; }; XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) { var node; this.openCurrent(); if (this.documentStarted) { throw new Error("declaration() must be the first node."); } node = new XMLDeclaration(this, version, encoding, standalone); this.onData(this.writer.declaration(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) { this.openCurrent(); if (root == null) { throw new Error("Missing root node name."); } if (this.root) { throw new Error("dtd() must come before the root node."); } this.currentNode = new XMLDocType(this, pubID, sysID); this.currentNode.rootNodeName = root; this.currentNode.children = false; this.currentLevel++; this.openTags[this.currentLevel] = this.currentNode; return this; }; XMLDocumentCB.prototype.dtdElement = function(name, value) { var node; this.openCurrent(); node = new XMLDTDElement(this, name, value); this.onData(this.writer.dtdElement(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) { var node; this.openCurrent(); node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue); this.onData(this.writer.dtdAttList(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.entity = function(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, false, name, value); this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.pEntity = function(name, value) { var node; this.openCurrent(); node = new XMLDTDEntity(this, true, name, value); this.onData(this.writer.dtdEntity(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.notation = function(name, value) { var node; this.openCurrent(); node = new XMLDTDNotation(this, name, value); this.onData(this.writer.dtdNotation(node, this.currentLevel + 1), this.currentLevel + 1); return this; }; XMLDocumentCB.prototype.up = function() { if (this.currentLevel < 0) { throw new Error("The document node has no parent."); } if (this.currentNode) { if (this.currentNode.children) { this.closeNode(this.currentNode); } else { this.openNode(this.currentNode); } this.currentNode = null; } else { this.closeNode(this.openTags[this.currentLevel]); } delete this.openTags[this.currentLevel]; this.currentLevel--; return this; }; XMLDocumentCB.prototype.end = function() { while (this.currentLevel >= 0) { this.up(); } return this.onEnd(); }; XMLDocumentCB.prototype.openCurrent = function() { if (this.currentNode) { this.currentNode.children = true; return this.openNode(this.currentNode); } }; XMLDocumentCB.prototype.openNode = function(node) { if (!node.isOpen) { if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) { this.root = node; } this.onData(this.writer.openNode(node, this.currentLevel), this.currentLevel); return node.isOpen = true; } }; XMLDocumentCB.prototype.closeNode = function(node) { if (!node.isClosed) { this.onData(this.writer.closeNode(node, this.currentLevel), this.currentLevel); return node.isClosed = true; } }; XMLDocumentCB.prototype.onData = function(chunk, level) { this.documentStarted = true; return this.onDataCallback(chunk, level + 1); }; XMLDocumentCB.prototype.onEnd = function() { this.documentCompleted = true; return this.onEndCallback(); }; XMLDocumentCB.prototype.debugInfo = function(name) { if (name == null) { return ""; } else { return "node: <" + name + ">"; } }; XMLDocumentCB.prototype.ele = function() { return this.element.apply(this, arguments); }; XMLDocumentCB.prototype.nod = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLDocumentCB.prototype.txt = function(value) { return this.text(value); }; XMLDocumentCB.prototype.dat = function(value) { return this.cdata(value); }; XMLDocumentCB.prototype.com = function(value) { return this.comment(value); }; XMLDocumentCB.prototype.ins = function(target, value) { return this.instruction(target, value); }; XMLDocumentCB.prototype.dec = function(version, encoding, standalone) { return this.declaration(version, encoding, standalone); }; XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) { return this.doctype(root, pubID, sysID); }; XMLDocumentCB.prototype.e = function(name, attributes, text) { return this.element(name, attributes, text); }; XMLDocumentCB.prototype.n = function(name, attributes, text) { return this.node(name, attributes, text); }; XMLDocumentCB.prototype.t = function(value) { return this.text(value); }; XMLDocumentCB.prototype.d = function(value) { return this.cdata(value); }; XMLDocumentCB.prototype.c = function(value) { return this.comment(value); }; XMLDocumentCB.prototype.r = function(value) { return this.raw(value); }; XMLDocumentCB.prototype.i = function(target, value) { return this.instruction(target, value); }; XMLDocumentCB.prototype.att = function() { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.attList.apply(this, arguments); } else { return this.attribute.apply(this, arguments); } }; XMLDocumentCB.prototype.a = function() { if (this.currentNode && this.currentNode instanceof XMLDocType) { return this.attList.apply(this, arguments); } else { return this.attribute.apply(this, arguments); } }; XMLDocumentCB.prototype.ent = function(name, value) { return this.entity(name, value); }; XMLDocumentCB.prototype.pent = function(name, value) { return this.pEntity(name, value); }; XMLDocumentCB.prototype.not = function(name, value) { return this.notation(name, value); }; return XMLDocumentCB; })(); }).call(XMLDocumentCB); return XMLDocumentCB$1.exports; } export { requireXMLDocumentCB as __require }; //# sourceMappingURL=XMLDocumentCB.js.map