502 lines
47 KiB
JavaScript
502 lines
47 KiB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory();
|
|
else if(typeof define === 'function' && define.amd)
|
|
define([], factory);
|
|
else if(typeof exports === 'object')
|
|
exports["demo"] = factory();
|
|
else
|
|
root["demo"] = factory();
|
|
})(this, function() {
|
|
return /******/ (function(modules) { // webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId]) {
|
|
/******/ return installedModules[moduleId].exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ i: moduleId,
|
|
/******/ l: false,
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.l = true;
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/******/
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
/******/
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
/******/
|
|
/******/ // define getter function for harmony exports
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
/******/ }
|
|
/******/ };
|
|
/******/
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/
|
|
/******/ // create a fake namespace object
|
|
/******/ // mode & 1: value is a module id, require it
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
/******/ // mode & 4: return value when already ns object
|
|
/******/ // mode & 8|1: behave like require
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
/******/ if(mode & 8) return value;
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
/******/ var ns = Object.create(null);
|
|
/******/ __webpack_require__.r(ns);
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
/******/ return ns;
|
|
/******/ };
|
|
/******/
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = function(module) {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ function getDefault() { return module['default']; } :
|
|
/******/ function getModuleExports() { return module; };
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
/******/
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "";
|
|
/******/
|
|
/******/
|
|
/******/ // Load entry module and return exports
|
|
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.tsx");
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ({
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/constants.js":
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/constants.js ***!
|
|
\*********************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.NODE_TYPE = void 0;
|
|
var NODE_TYPE;
|
|
(function (NODE_TYPE) {
|
|
NODE_TYPE["ELEMENT"] = "element";
|
|
NODE_TYPE["TEXT"] = "text";
|
|
NODE_TYPE["COMPONENT"] = "component";
|
|
NODE_TYPE["FRAGMENT"] = "fragment";
|
|
})(NODE_TYPE = exports.NODE_TYPE || (exports.NODE_TYPE = {}));
|
|
;
|
|
//# sourceMappingURL=constants.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/jsx.js":
|
|
/*!***************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/jsx.js ***!
|
|
\***************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Fragment = exports.jsx = void 0;
|
|
const ElementNode_1 = __webpack_require__(/*! ./node/ElementNode */ "./node_modules/async-jsx-html/nodejs/node/ElementNode.js");
|
|
const ComponentNode_1 = __webpack_require__(/*! ./node/ComponentNode */ "./node_modules/async-jsx-html/nodejs/node/ComponentNode.js");
|
|
exports.jsx = (element, props, ...children) => {
|
|
const nodeProps = props || {};
|
|
if (typeof element === 'string') {
|
|
return new ElementNode_1.ElementNode(element, nodeProps, children);
|
|
}
|
|
if (typeof element === 'function') {
|
|
return new ComponentNode_1.ComponentNode(element, nodeProps, children);
|
|
}
|
|
throw new TypeError(`Expected jsx element to be a string or a function`);
|
|
};
|
|
exports.Fragment = (props, children) => {
|
|
return children;
|
|
};
|
|
//# sourceMappingURL=jsx.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/mod.js":
|
|
/*!***************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/mod.js ***!
|
|
\***************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.React = exports.Fragment = exports.jsx = void 0;
|
|
const jsx_1 = __webpack_require__(/*! ./jsx */ "./node_modules/async-jsx-html/nodejs/jsx.js");
|
|
Object.defineProperty(exports, "jsx", { enumerable: true, get: function () { return jsx_1.jsx; } });
|
|
Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return jsx_1.Fragment; } });
|
|
var ElementNode_1 = __webpack_require__(/*! ./node/ElementNode */ "./node_modules/async-jsx-html/nodejs/node/ElementNode.js");
|
|
Object.defineProperty(exports, "ElementNode", { enumerable: true, get: function () { return ElementNode_1.ElementNode; } });
|
|
var ComponentNode_1 = __webpack_require__(/*! ./node/ComponentNode */ "./node_modules/async-jsx-html/nodejs/node/ComponentNode.js");
|
|
Object.defineProperty(exports, "ComponentNode", { enumerable: true, get: function () { return ComponentNode_1.ComponentNode; } });
|
|
exports.React = {
|
|
Fragment: jsx_1.Fragment,
|
|
createElement(element, props, ...children) {
|
|
return jsx_1.jsx(element, props, ...children);
|
|
}
|
|
};
|
|
//# sourceMappingURL=mod.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/ComponentNode.js":
|
|
/*!******************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/ComponentNode.js ***!
|
|
\******************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ComponentNode = void 0;
|
|
const constants_1 = __webpack_require__(/*! ../constants */ "./node_modules/async-jsx-html/nodejs/constants.js");
|
|
const FragmentNode_1 = __webpack_require__(/*! ./FragmentNode */ "./node_modules/async-jsx-html/nodejs/node/FragmentNode.js");
|
|
const Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/async-jsx-html/nodejs/node/Node.js");
|
|
const normalizeChildren_1 = __webpack_require__(/*! ./utils/normalizeChildren */ "./node_modules/async-jsx-html/nodejs/node/utils/normalizeChildren.js");
|
|
class ComponentNode extends Node_1.Node {
|
|
constructor(component, props, children) {
|
|
super(children);
|
|
this.component = component;
|
|
this.props = props;
|
|
this.type = constants_1.NODE_TYPE.COMPONENT;
|
|
}
|
|
render() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return [].concat(yield this.renderComponent()).join('');
|
|
});
|
|
}
|
|
renderComponent() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const child = yield this.component(this.props, this.children);
|
|
const children = normalizeChildren_1.normalizeChildren(Array.isArray(child) ? child : [child]);
|
|
if (children.length === 1) {
|
|
return children[0].render();
|
|
}
|
|
else if (children.length > 1) {
|
|
return new FragmentNode_1.FragmentNode(children).render();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
exports.ComponentNode = ComponentNode;
|
|
//# sourceMappingURL=ComponentNode.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/ElementNode.js":
|
|
/*!****************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/ElementNode.js ***!
|
|
\****************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ElementNode = void 0;
|
|
const constants_1 = __webpack_require__(/*! ../constants */ "./node_modules/async-jsx-html/nodejs/constants.js");
|
|
const Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/async-jsx-html/nodejs/node/Node.js");
|
|
const htmlEncode_1 = __webpack_require__(/*! ./utils/htmlEncode */ "./node_modules/async-jsx-html/nodejs/node/utils/htmlEncode.js");
|
|
const ELEMENT_PROP = {
|
|
INNER_HTML: 'innerHTML'
|
|
};
|
|
class ElementNode extends Node_1.Node {
|
|
constructor(name, props, children) {
|
|
super(children);
|
|
this.name = name;
|
|
this.props = props;
|
|
this.type = constants_1.NODE_TYPE.ELEMENT;
|
|
}
|
|
render() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const renderedProps = this.propsToHTML();
|
|
const renderedChildren = typeof this.props[ELEMENT_PROP.INNER_HTML] === 'string' ? this.props[ELEMENT_PROP.INNER_HTML] : (yield this.renderChildren()).join('');
|
|
return renderedChildren ? `<${this.name}${renderedProps}>${renderedChildren}</${this.name}>` : `<${this.name}${renderedProps} />`;
|
|
});
|
|
}
|
|
getValidProps() {
|
|
const props = this.props;
|
|
return Object.keys(this.props).filter(key => {
|
|
if (key === ELEMENT_PROP.INNER_HTML) {
|
|
return false;
|
|
}
|
|
const val = props[key];
|
|
return typeof val === 'string' || typeof val === 'number' || val === true;
|
|
});
|
|
}
|
|
propsToHTML() {
|
|
const keys = this.getValidProps();
|
|
if (!keys.length) {
|
|
return '';
|
|
}
|
|
const props = this.props;
|
|
const pairs = keys.map(key => {
|
|
if (!/^[a-zA-Z0-9-:\._]+$/.test(key)) {
|
|
throw new Error(`Invalid attribute name format ${key}`);
|
|
}
|
|
const val = props[key];
|
|
return val === true || val === '' ? key : `${key}="${htmlEncode_1.doubleQuoteEncode(val.toString())}"`;
|
|
});
|
|
return ` ${pairs.join(' ')}`;
|
|
}
|
|
}
|
|
exports.ElementNode = ElementNode;
|
|
//# sourceMappingURL=ElementNode.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/FragmentNode.js":
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/FragmentNode.js ***!
|
|
\*****************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.FragmentNode = void 0;
|
|
const constants_1 = __webpack_require__(/*! ../constants */ "./node_modules/async-jsx-html/nodejs/constants.js");
|
|
const Node_1 = __webpack_require__(/*! ./Node */ "./node_modules/async-jsx-html/nodejs/node/Node.js");
|
|
class FragmentNode extends Node_1.Node {
|
|
constructor(children) {
|
|
super(children);
|
|
this.type = constants_1.NODE_TYPE.FRAGMENT;
|
|
}
|
|
render() {
|
|
return this.renderChildren();
|
|
}
|
|
}
|
|
exports.FragmentNode = FragmentNode;
|
|
//# sourceMappingURL=FragmentNode.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/Node.js":
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/Node.js ***!
|
|
\*********************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Node = void 0;
|
|
const normalizeChildren_1 = __webpack_require__(/*! ./utils/normalizeChildren */ "./node_modules/async-jsx-html/nodejs/node/utils/normalizeChildren.js");
|
|
class Node {
|
|
constructor(children) {
|
|
this.children = children;
|
|
}
|
|
renderChildren() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
const result = [];
|
|
const children = normalizeChildren_1.normalizeChildren(this.children);
|
|
for (const child of children) {
|
|
const renderedChild = yield child.render();
|
|
if (renderedChild) {
|
|
if (Array.isArray(renderedChild)) {
|
|
renderedChild.forEach(subchild => subchild && result.push(subchild));
|
|
}
|
|
else {
|
|
result.push(renderedChild);
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
});
|
|
}
|
|
}
|
|
exports.Node = Node;
|
|
//# sourceMappingURL=Node.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/TextNode.js":
|
|
/*!*************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/TextNode.js ***!
|
|
\*************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.TextNode = void 0;
|
|
const constants_1 = __webpack_require__(/*! ../constants */ "./node_modules/async-jsx-html/nodejs/constants.js");
|
|
const htmlEncode_1 = __webpack_require__(/*! ./utils/htmlEncode */ "./node_modules/async-jsx-html/nodejs/node/utils/htmlEncode.js");
|
|
class TextNode {
|
|
constructor(text) {
|
|
this.text = text;
|
|
this.type = constants_1.NODE_TYPE.TEXT;
|
|
}
|
|
render() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
return htmlEncode_1.htmlEncode(this.text);
|
|
});
|
|
}
|
|
}
|
|
exports.TextNode = TextNode;
|
|
//# sourceMappingURL=TextNode.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/utils/htmlEncode.js":
|
|
/*!*********************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/utils/htmlEncode.js ***!
|
|
\*********************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.htmlEncode = exports.doubleQuoteEncode = void 0;
|
|
function doubleQuoteEncode(text) {
|
|
return text.replace(/"/g, '"');
|
|
}
|
|
exports.doubleQuoteEncode = doubleQuoteEncode;
|
|
function htmlEncode(text) {
|
|
return doubleQuoteEncode(text.replace(/&/g, '&').replace(/\//g, '/').replace(/</g, '<').replace(/>/g, '>').replace(/'/g, '''));
|
|
}
|
|
exports.htmlEncode = htmlEncode;
|
|
//# sourceMappingURL=htmlEncode.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./node_modules/async-jsx-html/nodejs/node/utils/normalizeChildren.js":
|
|
/*!****************************************************************************!*\
|
|
!*** ./node_modules/async-jsx-html/nodejs/node/utils/normalizeChildren.js ***!
|
|
\****************************************************************************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.normalizeChildren = void 0;
|
|
const TextNode_1 = __webpack_require__(/*! ../TextNode */ "./node_modules/async-jsx-html/nodejs/node/TextNode.js");
|
|
const constants_1 = __webpack_require__(/*! ../../constants */ "./node_modules/async-jsx-html/nodejs/constants.js");
|
|
function normalizeChildren(children) {
|
|
const result = [];
|
|
for (const child of children) {
|
|
if (child && typeof child !== 'boolean') {
|
|
if (typeof child === 'string' || typeof child === 'number') {
|
|
result.push(new TextNode_1.TextNode(`${child}`));
|
|
}
|
|
else if (Array.isArray(child)) {
|
|
normalizeChildren(child).forEach(result.push);
|
|
}
|
|
else if (child.type === constants_1.NODE_TYPE.ELEMENT || child.type === constants_1.NODE_TYPE.TEXT || child.type === constants_1.NODE_TYPE.COMPONENT) {
|
|
result.push(child);
|
|
}
|
|
else {
|
|
throw new TypeError(`Unrecognized node type: ${typeof child}`);
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
exports.normalizeChildren = normalizeChildren;
|
|
//# sourceMappingURL=normalizeChildren.js.map
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/index.tsx":
|
|
/*!***********************!*\
|
|
!*** ./src/index.tsx ***!
|
|
\***********************/
|
|
/*! no static exports found */
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.Test = void 0;
|
|
var async_jsx_html_1 = __webpack_require__(/*! async-jsx-html */ "./node_modules/async-jsx-html/nodejs/mod.js");
|
|
function Test() {
|
|
return async_jsx_html_1.jsx("div", null, "Hello World");
|
|
}
|
|
exports.Test = Test;
|
|
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
});
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJ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