\n';
};
_proto.tablerow = function tablerow(content) {
return '
\n' + content + '
\n';
};
_proto.tablecell = function tablecell(content, flags) {
var type = flags.header ? 'th' : 'td';
var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
return tag + content + '' + type + '>\n';
} // span level renderer
;
_proto.strong = function strong(text) {
return '' + text + '';
};
_proto.em = function em(text) {
return '' + text + '';
};
_proto.codespan = function codespan(text) {
return '' + text + '';
};
_proto.br = function br() {
return this.options.xhtml ? ' ' : ' ';
};
_proto.del = function del(text) {
return '' + text + '';
};
_proto.link = function link(href, title, text) {
href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
if (href === null) {
return text;
}
var out = '' + text + '';
return out;
};
_proto.image = function image(href, title, text) {
href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);
if (href === null) {
return text;
}
var out = '' : '>';
return out;
};
_proto.text = function text(_text) {
return _text;
};
return Renderer;
}();
/**
* TextRenderer
* returns only the textual part of the token
*/
var TextRenderer_1 = /*#__PURE__*/function () {
function TextRenderer() {}
var _proto = TextRenderer.prototype;
// no need for block level renderers
_proto.strong = function strong(text) {
return text;
};
_proto.em = function em(text) {
return text;
};
_proto.codespan = function codespan(text) {
return text;
};
_proto.del = function del(text) {
return text;
};
_proto.html = function html(text) {
return text;
};
_proto.text = function text(_text) {
return _text;
};
_proto.link = function link(href, title, text) {
return '' + text;
};
_proto.image = function image(href, title, text) {
return '' + text;
};
_proto.br = function br() {
return '';
};
return TextRenderer;
}();
/**
* Slugger generates header id
*/
var Slugger_1 = /*#__PURE__*/function () {
function Slugger() {
this.seen = {};
}
/**
* Convert string to unique id
*/
var _proto = Slugger.prototype;
_proto.slug = function slug(value) {
var slug = value.toLowerCase().trim() // remove html tags
.replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
if (this.seen.hasOwnProperty(slug)) {
var originalSlug = slug;
do {
this.seen[originalSlug]++;
slug = originalSlug + '-' + this.seen[originalSlug];
} while (this.seen.hasOwnProperty(slug));
}
this.seen[slug] = 0;
return slug;
};
return Slugger;
}();
var defaults$4 = defaults.defaults;
var unescape$1 = helpers.unescape;
/**
* Parsing & Compiling
*/
var Parser_1 = /*#__PURE__*/function () {
function Parser(options) {
this.options = options || defaults$4;
this.options.renderer = this.options.renderer || new Renderer_1();
this.renderer = this.options.renderer;
this.renderer.options = this.options;
this.textRenderer = new TextRenderer_1();
this.slugger = new Slugger_1();
}
/**
* Static Parse Method
*/
Parser.parse = function parse(tokens, options) {
var parser = new Parser(options);
return parser.parse(tokens);
}
/**
* Parse Loop
*/
;
var _proto = Parser.prototype;
_proto.parse = function parse(tokens, top) {
if (top === void 0) {
top = true;
}
var out = '',
i,
j,
k,
l2,
l3,
row,
cell,
header,
body,
token,
ordered,
start,
loose,
itemBody,
item,
checked,
task,
checkbox;
var l = tokens.length;
for (i = 0; i < l; i++) {
token = tokens[i];
switch (token.type) {
case 'space':
{
continue;
}
case 'hr':
{
out += this.renderer.hr();
continue;
}
case 'heading':
{
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape$1(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
continue;
}
case 'code':
{
out += this.renderer.code(token.text, token.lang, token.escaped);
continue;
}
case 'table':
{
header = ''; // header
cell = '';
l2 = token.header.length;
for (j = 0; j < l2; j++) {
cell += this.renderer.tablecell(this.parseInline(token.tokens.header[j]), {
header: true,
align: token.align[j]
});
}
header += this.renderer.tablerow(cell);
body = '';
l2 = token.cells.length;
for (j = 0; j < l2; j++) {
row = token.tokens.cells[j];
cell = '';
l3 = row.length;
for (k = 0; k < l3; k++) {
cell += this.renderer.tablecell(this.parseInline(row[k]), {
header: false,
align: token.align[k]
});
}
body += this.renderer.tablerow(cell);
}
out += this.renderer.table(header, body);
continue;
}
case 'blockquote':
{
body = this.parse(token.tokens);
out += this.renderer.blockquote(body);
continue;
}
case 'list':
{
ordered = token.ordered;
start = token.start;
loose = token.loose;
l2 = token.items.length;
body = '';
for (j = 0; j < l2; j++) {
item = token.items[j];
checked = item.checked;
task = item.task;
itemBody = '';
if (item.task) {
checkbox = this.renderer.checkbox(checked);
if (loose) {
if (item.tokens.length > 0 && item.tokens[0].type === 'text') {
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
}
} else {
item.tokens.unshift({
type: 'text',
text: checkbox
});
}
} else {
itemBody += checkbox;
}
}
itemBody += this.parse(item.tokens, loose);
body += this.renderer.listitem(itemBody, task, checked);
}
out += this.renderer.list(body, ordered, start);
continue;
}
case 'html':
{
// TODO parse inline content if parameter markdown=1
out += this.renderer.html(token.text);
continue;
}
case 'paragraph':
{
out += this.renderer.paragraph(this.parseInline(token.tokens));
continue;
}
case 'text':
{
body = token.tokens ? this.parseInline(token.tokens) : token.text;
while (i + 1 < l && tokens[i + 1].type === 'text') {
token = tokens[++i];
body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
}
out += top ? this.renderer.paragraph(body) : body;
continue;
}
default:
{
var errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
}
}
}
return out;
}
/**
* Parse Inline Tokens
*/
;
_proto.parseInline = function parseInline(tokens, renderer) {
renderer = renderer || this.renderer;
var out = '',
i,
token;
var l = tokens.length;
for (i = 0; i < l; i++) {
token = tokens[i];
switch (token.type) {
case 'escape':
{
out += renderer.text(token.text);
break;
}
case 'html':
{
out += renderer.html(token.text);
break;
}
case 'link':
{
out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
break;
}
case 'image':
{
out += renderer.image(token.href, token.title, token.text);
break;
}
case 'strong':
{
out += renderer.strong(this.parseInline(token.tokens, renderer));
break;
}
case 'em':
{
out += renderer.em(this.parseInline(token.tokens, renderer));
break;
}
case 'codespan':
{
out += renderer.codespan(token.text);
break;
}
case 'br':
{
out += renderer.br();
break;
}
case 'del':
{
out += renderer.del(this.parseInline(token.tokens, renderer));
break;
}
case 'text':
{
out += renderer.text(token.text);
break;
}
default:
{
var errMsg = 'Token with "' + token.type + '" type was not found.';
if (this.options.silent) {
console.error(errMsg);
return;
} else {
throw new Error(errMsg);
}
}
}
}
return out;
};
return Parser;
}();
var merge$2 = helpers.merge,
checkSanitizeDeprecation$1 = helpers.checkSanitizeDeprecation,
escape$2 = helpers.escape;
var getDefaults = defaults.getDefaults,
changeDefaults = defaults.changeDefaults,
defaults$5 = defaults.defaults;
/**
* Marked
*/
function marked(src, opt, callback) {
// throw error in case of non string input
if (typeof src === 'undefined' || src === null) {
throw new Error('marked(): input parameter is undefined or null');
}
if (typeof src !== 'string') {
throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
}
if (typeof opt === 'function') {
callback = opt;
opt = null;
}
opt = merge$2({}, marked.defaults, opt || {});
checkSanitizeDeprecation$1(opt);
if (callback) {
var highlight = opt.highlight;
var tokens;
try {
tokens = Lexer_1.lex(src, opt);
} catch (e) {
return callback(e);
}
var done = function done(err) {
var out;
if (!err) {
try {
out = Parser_1.parse(tokens, opt);
} catch (e) {
err = e;
}
}
opt.highlight = highlight;
return err ? callback(err) : callback(null, out);
};
if (!highlight || highlight.length < 3) {
return done();
}
delete opt.highlight;
if (!tokens.length) return done();
var pending = 0;
marked.walkTokens(tokens, function (token) {
if (token.type === 'code') {
pending++;
setTimeout(function () {
highlight(token.text, token.lang, function (err, code) {
if (err) {
return done(err);
}
if (code != null && code !== token.text) {
token.text = code;
token.escaped = true;
}
pending--;
if (pending === 0) {
done();
}
});
}, 0);
}
});
if (pending === 0) {
done();
}
return;
}
try {
var _tokens = Lexer_1.lex(src, opt);
if (opt.walkTokens) {
marked.walkTokens(_tokens, opt.walkTokens);
}
return Parser_1.parse(_tokens, opt);
} catch (e) {
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
if (opt.silent) {
return '
An error occurred:
' + escape$2(e.message + '', true) + '
';
}
throw e;
}
}
/**
* Options
*/
marked.options = marked.setOptions = function (opt) {
merge$2(marked.defaults, opt);
changeDefaults(marked.defaults);
return marked;
};
marked.getDefaults = getDefaults;
marked.defaults = defaults$5;
/**
* Use Extension
*/
marked.use = function (extension) {
var opts = merge$2({}, extension);
if (extension.renderer) {
(function () {
var renderer = marked.defaults.renderer || new Renderer_1();
var _loop = function _loop(prop) {
var prevRenderer = renderer[prop];
renderer[prop] = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var ret = extension.renderer[prop].apply(renderer, args);
if (ret === false) {
ret = prevRenderer.apply(renderer, args);
}
return ret;
};
};
for (var prop in extension.renderer) {
_loop(prop);
}
opts.renderer = renderer;
})();
}
if (extension.tokenizer) {
(function () {
var tokenizer = marked.defaults.tokenizer || new Tokenizer_1();
var _loop2 = function _loop2(prop) {
var prevTokenizer = tokenizer[prop];
tokenizer[prop] = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var ret = extension.tokenizer[prop].apply(tokenizer, args);
if (ret === false) {
ret = prevTokenizer.apply(tokenizer, args);
}
return ret;
};
};
for (var prop in extension.tokenizer) {
_loop2(prop);
}
opts.tokenizer = tokenizer;
})();
}
if (extension.walkTokens) {
var walkTokens = marked.defaults.walkTokens;
opts.walkTokens = function (token) {
extension.walkTokens(token);
if (walkTokens) {
walkTokens(token);
}
};
}
marked.setOptions(opts);
};
/**
* Run callback for every token
*/
marked.walkTokens = function (tokens, callback) {
for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
var token = _step.value;
callback(token);
switch (token.type) {
case 'table':
{
for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) {
var cell = _step2.value;
marked.walkTokens(cell, callback);
}
for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) {
var row = _step3.value;
for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
var _cell = _step4.value;
marked.walkTokens(_cell, callback);
}
}
break;
}
case 'list':
{
marked.walkTokens(token.items, callback);
break;
}
default:
{
if (token.tokens) {
marked.walkTokens(token.tokens, callback);
}
}
}
}
};
/**
* Expose
*/
marked.Parser = Parser_1;
marked.parser = Parser_1.parse;
marked.Renderer = Renderer_1;
marked.TextRenderer = TextRenderer_1;
marked.Lexer = Lexer_1;
marked.lexer = Lexer_1.lex;
marked.Tokenizer = Tokenizer_1;
marked.Slugger = Slugger_1;
marked.parse = marked;
var marked_1 = marked;
return marked_1;
})));
/***/ }),
/***/ "EjUQ":
/*!**********************************************************!*\
!*** ./src/pages/Messages/Private/index.tsx + 1 modules ***!
\**********************************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Messages/Private/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/NoData/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Messages/component/LeftNav.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/messages.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/pagination/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/skeleton/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/skeleton/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/moment/moment.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/style/index.js
var style = __webpack_require__("DjyN");
// EXTERNAL MODULE: ./node_modules/antd/es/pagination/index.js + 2 modules
var pagination = __webpack_require__("NUBc");
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/style/index.js
var skeleton_style = __webpack_require__("cWXX");
// EXTERNAL MODULE: ./node_modules/antd/es/skeleton/index.js + 8 modules
var skeleton = __webpack_require__("/ezw");
// EXTERNAL MODULE: ./node_modules/antd/es/divider/style/index.js
var divider_style = __webpack_require__("/zsF");
// EXTERNAL MODULE: ./node_modules/antd/es/divider/index.js
var divider = __webpack_require__("PArb");
// EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js
var row_style = __webpack_require__("14J3");
// EXTERNAL MODULE: ./node_modules/antd/es/row/index.js
var row = __webpack_require__("BMrR");
// EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js
var col_style = __webpack_require__("jCWc");
// EXTERNAL MODULE: ./node_modules/antd/es/col/index.js
var col = __webpack_require__("kPKH");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
var objectSpread2 = __webpack_require__("k1fw");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
var slicedToArray = __webpack_require__("tJVT");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
var objectWithoutProperties = __webpack_require__("PpiC");
// EXTERNAL MODULE: ./node_modules/antd/es/layout/style/index.js
var layout_style = __webpack_require__("B9cy");
// EXTERNAL MODULE: ./node_modules/antd/es/layout/index.js
var layout = __webpack_require__("Ol7k");
// EXTERNAL MODULE: ./node_modules/antd/es/menu/style/index.js
var menu_style = __webpack_require__("lUTK");
// EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 3 modules
var menu = __webpack_require__("BvKs");
// EXTERNAL MODULE: external "window.React"
var external_window_React_ = __webpack_require__("cDcd");
var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_);
// EXTERNAL MODULE: ./src/.umi-production/core/umiExports.ts + 17 modules
var umiExports = __webpack_require__("9kvl");
// EXTERNAL MODULE: ./node_modules/moment/moment.js
var moment = __webpack_require__("wd/R");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__("m3rI");
// EXTERNAL MODULE: ./src/components/NoData/index.tsx
var NoData = __webpack_require__("BdwD");
// EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js
var modal_style = __webpack_require__("2qtc");
// EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules
var modal = __webpack_require__("kLXV");
// EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js
var input_style = __webpack_require__("5NDa");
// EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 3 modules
var input = __webpack_require__("5rEg");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__("jrin");
// EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js
var message_style = __webpack_require__("miYZ");
// EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules
var message = __webpack_require__("tsqr");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("9og8");
// EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js
var form_style = __webpack_require__("y8nQ");
// EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 11 modules
var es_form = __webpack_require__("Vl3Y");
// EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js
var regenerator = __webpack_require__("WmNS");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
// EXTERNAL MODULE: ./src/service/messages.ts
var service_messages = __webpack_require__("5WQS");
// EXTERNAL MODULE: ./node_modules/react-router/esm/react-router.js
var react_router = __webpack_require__("Ty5D");
// EXTERNAL MODULE: ./src/pages/Messages/Private/index.less?modules
var Privatemodules = __webpack_require__("NDqe");
var Privatemodules_default = /*#__PURE__*/__webpack_require__.n(Privatemodules);
// CONCATENATED MODULE: ./src/pages/Messages/Private/components/WriteMessage.tsx
var WriteMessage_PublishShixun = function PublishShixun(_ref) {
var _data$users;
var messages = _ref.messages,
loading = _ref.loading,
user = _ref.user,
dispatch = _ref.dispatch;
var params = Object(react_router["i" /* useParams */])();
var location = Object(react_router["h" /* useLocation */])();
var actionTabs = messages.actionTabs;
var _Form$useForm = es_form["a" /* default */].useForm(),
_Form$useForm2 = Object(slicedToArray["a" /* default */])(_Form$useForm, 1),
form = _Form$useForm2[0];
var recentContacts = messages.recentContacts;
var _useState = Object(external_window_React_["useState"])(''),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
keyword = _useState2[0],
setKeyword = _useState2[1];
var _useState3 = Object(external_window_React_["useState"])([]),
_useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2),
data = _useState4[0],
setData = _useState4[1];
var _useState5 = Object(external_window_React_["useState"])(false),
_useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2),
showSearch = _useState6[0],
setShowSearch = _useState6[1];
var _useState7 = Object(external_window_React_["useState"])(),
_useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2),
selectUser = _useState8[0],
setSelectUser = _useState8[1];
Object(external_window_React_["useEffect"])(function () {
if (messages.actionTabs.key === '写私信') getData();
}, [messages.actionTabs.key]);
var getData = /*#__PURE__*/function () {
var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() {
var _user$userInfo;
var res;
return regenerator_default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return dispatch({
type: 'messages/getRecentContacts',
payload: {
id: user === null || user === void 0 ? void 0 : (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.user_id,
keyword: keyword
}
});
case 2:
res = _context.sent;
setData(Object(objectSpread2["a" /* default */])({}, res));
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
var getData2 = /*#__PURE__*/function () {
var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
var res;
return regenerator_default.a.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(keyword !== '')) {
_context2.next = 5;
break;
}
_context2.next = 3;
return dispatch({
type: 'messages/getUsersForPrivateMessages',
payload: {
keyword: keyword
}
});
case 3:
res = _context2.sent;
setData(Object(objectSpread2["a" /* default */])({}, res));
case 5:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function getData2() {
return _ref3.apply(this, arguments);
};
}();
Object(external_window_React_["useEffect"])(function () {
getData2();
}, [keyword]);
return /*#__PURE__*/external_window_React_default.a.createElement(modal["a" /* default */], {
centered: true,
title: "\u5199\u79C1\u4FE1",
visible: messages.actionTabs.key === '写私信' ? true : false,
okText: "\u786E\u5B9A",
cancelText: "\u53D6\u6D88",
bodyStyle: {
height: 320
},
onOk: /*#__PURE__*/Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
var _user$userInfo2;
var formValue, fetchUrl, res, _user$userInfo3, _res$private_message;
return regenerator_default.a.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return form.validateFields();
case 2:
formValue = form.getFieldValue();
fetchUrl = "/api/course_modules/".concat(params.categoryId, "/add_second_category.json");
_context3.next = 6;
return Object(service_messages["g" /* postPrivateMessages */])({
content: formValue.content,
target_id: selectUser,
userId: user === null || user === void 0 ? void 0 : (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.user_id
});
case 6:
res = _context3.sent;
if (res.status === 0) {
message["b" /* default */].success('添加成功');
dispatch({
type: 'messages/setActionTabs',
payload: {}
});
umiExports["d" /* history */].push("/messages/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo3 = user.userInfo) === null || _user$userInfo3 === void 0 ? void 0 : _user$userInfo3.login, "/message_detail?target_ids=").concat(res === null || res === void 0 ? void 0 : (_res$private_message = res.private_message) === null || _res$private_message === void 0 ? void 0 : _res$private_message.receiver_id));
}
case 8:
case "end":
return _context3.stop();
}
}
}, _callee3);
})),
onCancel: function onCancel() {
dispatch({
type: 'messages/setActionTabs',
payload: {}
});
}
}, /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], {
form: form,
initialValues: Object(defineProperty["a" /* default */])({}, 'name', "")
}, /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, {
name: "users",
rules: [{
required: true,
message: "请选择发送对象"
}]
}, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */].Search, {
onFocus: function onFocus() {
return setShowSearch(true);
},
onSearch: function onSearch(value) {
setKeyword(value);
},
placeholder: "\u53D1\u9001\u7ED9..."
})), showSearch && /*#__PURE__*/external_window_React_default.a.createElement(skeleton["a" /* default */], {
loading: loading['messages/getUsersForPrivateMessages']
}, /*#__PURE__*/external_window_React_default.a.createElement("aside", {
className: Privatemodules_default.a.searchWrp,
style: {
maxHeight: 260,
overflow: "auto"
}
}, /*#__PURE__*/external_window_React_default.a.createElement("p", {
className: "c-light-black mt10"
}, keyword === '' ? '最近联系人' : "搜索结果"), data === null || data === void 0 ? void 0 : (_data$users = data.users) === null || _data$users === void 0 ? void 0 : _data$users.map(function (item, index) {
return /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], {
key: index,
align: "middle",
className: "mt15 current",
onClick: function onClick() {
setSelectUser(item.id);
form.setFieldsValue({
users: item.name
});
setShowSearch(false);
}
}, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: "58px"
}, /*#__PURE__*/external_window_React_default.a.createElement("img", {
style: {
width: 48,
borderRadius: 48
},
src: env["a" /* default */].IMG_SERVER + '/images/' + (item === null || item === void 0 ? void 0 : item.image_url),
alt: ""
})), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, item.name));
}))), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, {
rules: [{
required: true,
message: "请输入发送内容"
}],
className: showSearch && 'hide',
name: "content"
}, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */].TextArea, {
rows: 10,
maxLength: 200
}))));
};
/* harmony default export */ var WriteMessage = (Object(umiExports["a" /* connect */])(function (_ref6) {
var messages = _ref6.messages,
loading = _ref6.loading,
user = _ref6.user;
return {
messages: messages,
user: user,
loading: loading.effects
};
})(WriteMessage_PublishShixun));
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules
var RenderHtml = __webpack_require__("9Bee");
// EXTERNAL MODULE: ./src/pages/Messages/component/LeftNav.tsx
var LeftNav = __webpack_require__("30zm");
// CONCATENATED MODULE: ./src/pages/Messages/Private/index.tsx
var SubMenu = menu["a" /* default */].SubMenu;
var Sider = layout["a" /* default */].Sider,
Content = layout["a" /* default */].Content;
var Private_ShixunsListPage = function ShixunsListPage(_ref) {
var _privateMessage$priva, _privateMessage$priva2;
var messages = _ref.messages,
globalSetting = _ref.globalSetting,
loading = _ref.loading,
user = _ref.user,
dispatch = _ref.dispatch,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["messages", "globalSetting", "loading", "user", "dispatch"]);
var params = props.match.params;
var userInfo = user.userInfo;
var tidingsList = messages.tidingsList,
privateMessage = messages.privateMessage;
var _useState = Object(external_window_React_["useState"])({
per_page: 10,
page: 1
}),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
bodyParams = _useState2[0],
setBodyParams = _useState2[1];
Object(external_window_React_["useEffect"])(function () {
bodyParams.page = 1;
getData();
}, [params.userId]);
var getData = function getData() {
dispatch({
type: 'messages/getPrivateMessages',
payload: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, bodyParams), params)
});
};
var toDetail = function toDetail(item) {
var _user$userInfo, _item$target;
props.history.push("/messages/".concat(user === null || user === void 0 ? void 0 : (_user$userInfo = user.userInfo) === null || _user$userInfo === void 0 ? void 0 : _user$userInfo.login, "/message_detail?target_ids=").concat(item === null || item === void 0 ? void 0 : (_item$target = item.target) === null || _item$target === void 0 ? void 0 : _item$target.id));
};
var toUser = function toUser(item) {
var _item$target2;
props.history.push("/users/".concat(item === null || item === void 0 ? void 0 : (_item$target2 = item.target) === null || _item$target2 === void 0 ? void 0 : _item$target2.login));
};
return /*#__PURE__*/external_window_React_default.a.createElement("section", {
className: Privatemodules_default.a.bg
}, /*#__PURE__*/external_window_React_default.a.createElement("section", {
className: "edu-container mt20"
}, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], {
gutter: [20, 20]
}, /*#__PURE__*/external_window_React_default.a.createElement(LeftNav["a" /* default */], null), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: "1"
}, /*#__PURE__*/external_window_React_default.a.createElement("aside", {
className: "bg-white"
}, /*#__PURE__*/external_window_React_default.a.createElement("aside", {
className: "pt30 pl30 pr30 font16"
}, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: "1"
}, "\u5168\u90E8\u79C1\u4FE1"), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement("span", {
className: "c-blue current",
onClick: function onClick() {
var _user$userInfo2;
dispatch({
type: 'messages/setActionTabs',
payload: {
key: "写私信",
bodyParams: Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, bodyParams), {}, {
user_id: user === null || user === void 0 ? void 0 : (_user$userInfo2 = user.userInfo) === null || _user$userInfo2 === void 0 ? void 0 : _user$userInfo2.user_id
})
}
});
}
}, "\u5199\u79C1\u4FE1")))), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null), /*#__PURE__*/external_window_React_default.a.createElement("aside", {
className: Privatemodules_default.a.list
}, /*#__PURE__*/external_window_React_default.a.createElement(skeleton["a" /* default */], {
active: true,
avatar: {
size: 40
},
paragraph: {
rows: 5
},
loading: loading['messages/getPrivateMessages']
}, !(privateMessage !== null && privateMessage !== void 0 && (_privateMessage$priva = privateMessage.private_messages) !== null && _privateMessage$priva !== void 0 && _privateMessage$priva.length) && /*#__PURE__*/external_window_React_default.a.createElement(NoData["a" /* default */], null), privateMessage === null || privateMessage === void 0 ? void 0 : (_privateMessage$priva2 = privateMessage.private_messages) === null || _privateMessage$priva2 === void 0 ? void 0 : _privateMessage$priva2.map(function (item, index) {
var _item$target3, _item$target4;
return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: "58px",
onClick: function onClick() {
return toUser(item);
}
}, /*#__PURE__*/external_window_React_default.a.createElement("img", {
src: env["a" /* default */].IMG_SERVER + '/images/' + (item === null || item === void 0 ? void 0 : (_item$target3 = item.target) === null || _item$target3 === void 0 ? void 0 : _item$target3.image_url),
alt: ""
})), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: 1
}, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
span: 24
}, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
flex: "1"
}, /*#__PURE__*/external_window_React_default.a.createElement("span", {
onClick: function onClick() {
return toUser(item);
}
}, item === null || item === void 0 ? void 0 : (_item$target4 = item.target) === null || _item$target4 === void 0 ? void 0 : _item$target4.name), /*#__PURE__*/external_window_React_default.a.createElement("span", {
className: "ml15"
}, "\u4E0E\u4F60\u7684\u79C1\u4FE1"), /*#__PURE__*/external_window_React_default.a.createElement("span", {
className: "c-light-black mr15"
}, "[", item === null || item === void 0 ? void 0 : item.message_count, "\u6761]"), /*#__PURE__*/external_window_React_default.a.createElement("span", {
className: "ml15 c-light-black"
}, moment_default()(item.send_time).fromNow())), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, (item === null || item === void 0 ? void 0 : item.unread) && /*#__PURE__*/external_window_React_default.a.createElement("span", {
className: Privatemodules_default.a.newlight
})))), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], {
span: 24,
onClick: function onClick() {
return toDetail(item);
}
}, /*#__PURE__*/external_window_React_default.a.createElement("div", {
className: "mt15"
}, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], {
value: item.content || ''
})))))));
})))), /*#__PURE__*/external_window_React_default.a.createElement("aside", {
className: "tc mt20"
}, !loading['messages/getTidings'] && /*#__PURE__*/external_window_React_default.a.createElement(pagination["a" /* default */], {
hideOnSinglePage: true,
showSizeChanger: false,
onChange: function onChange(page) {
bodyParams.page = page;
setBodyParams(Object(objectSpread2["a" /* default */])({}, bodyParams));
getData();
},
current: bodyParams.page || 1,
total: privateMessage === null || privateMessage === void 0 ? void 0 : privateMessage.count
}))))), /*#__PURE__*/external_window_React_default.a.createElement(WriteMessage, null));
};
/* harmony default export */ var Private = __webpack_exports__["default"] = (Object(umiExports["a" /* connect */])(function (_ref2) {
var messages = _ref2.messages,
loading = _ref2.loading,
user = _ref2.user,
globalSetting = _ref2.globalSetting;
return {
messages: messages,
globalSetting: globalSetting,
user: user,
loading: loading.effects
};
})(Private_ShixunsListPage));
/***/ }),
/***/ "FOrL":
/*!********************************************!*\
!*** ./src/assets/images/icons/nodata.png ***!
\********************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "static/nodata.a6b3f948.png";
/***/ }),
/***/ "LdHM":
/*!********************************************************!*\
!*** ./node_modules/rc-select/es/index.js + 6 modules ***!
\********************************************************/
/*! exports provided: Option, OptGroup, default */
/*! exports used: OptGroup, Option, default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ es_Option; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_OptGroup; });
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__("1OyB");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__("vuIU");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__("Ji7U");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
var createSuper = __webpack_require__("LK+K");
// EXTERNAL MODULE: external "window.React"
var external_window_React_ = __webpack_require__("cDcd");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__("rePB");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__("Ff2n");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
var slicedToArray = __webpack_require__("ODXe");
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
var KeyCode = __webpack_require__("4IlW");
// EXTERNAL MODULE: ./node_modules/rc-util/es/pickAttrs.js
var pickAttrs = __webpack_require__("bX4T");
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js
var useMemo = __webpack_require__("YrtM");
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: ./node_modules/rc-virtual-list/es/index.js + 19 modules
var es = __webpack_require__("+nKL");
// EXTERNAL MODULE: ./node_modules/rc-select/es/TransBtn.js
var TransBtn = __webpack_require__("8OUc");
// CONCATENATED MODULE: ./node_modules/rc-select/es/OptionList.js
/**
* Using virtual list of option display.
* Will fallback to dom if use customize render.
*/
var OptionList_OptionList = function OptionList(_ref, ref) {
var prefixCls = _ref.prefixCls,
id = _ref.id,
flattenOptions = _ref.flattenOptions,
childrenAsData = _ref.childrenAsData,
values = _ref.values,
searchValue = _ref.searchValue,
multiple = _ref.multiple,
defaultActiveFirstOption = _ref.defaultActiveFirstOption,
height = _ref.height,
itemHeight = _ref.itemHeight,
notFoundContent = _ref.notFoundContent,
open = _ref.open,
menuItemSelectedIcon = _ref.menuItemSelectedIcon,
virtual = _ref.virtual,
onSelect = _ref.onSelect,
onToggleOpen = _ref.onToggleOpen,
onActiveValue = _ref.onActiveValue,
onScroll = _ref.onScroll,
onMouseEnter = _ref.onMouseEnter;
var itemPrefixCls = "".concat(prefixCls, "-item");
var memoFlattenOptions = Object(useMemo["a" /* default */])(function () {
return flattenOptions;
}, [open, flattenOptions], function (prev, next) {
return next[0] && prev[1] !== next[1];
}); // =========================== List ===========================
var listRef = external_window_React_["useRef"](null);
var onListMouseDown = function onListMouseDown(event) {
event.preventDefault();
};
var scrollIntoView = function scrollIntoView(index) {
if (listRef.current) {
listRef.current.scrollTo({
index: index
});
}
}; // ========================== Active ==========================
var getEnabledActiveIndex = function getEnabledActiveIndex(index) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var len = memoFlattenOptions.length;
for (var i = 0; i < len; i += 1) {
var current = (index + i * offset + len) % len;
var _memoFlattenOptions$c = memoFlattenOptions[current],
group = _memoFlattenOptions$c.group,
data = _memoFlattenOptions$c.data;
if (!group && !data.disabled) {
return current;
}
}
return -1;
};
var _React$useState = external_window_React_["useState"](function () {
return getEnabledActiveIndex(0);
}),
_React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2),
activeIndex = _React$useState2[0],
setActiveIndex = _React$useState2[1];
var setActive = function setActive(index) {
setActiveIndex(index); // Trigger active event
var flattenItem = memoFlattenOptions[index];
if (!flattenItem) {
onActiveValue(null, -1);
return;
}
onActiveValue(flattenItem.data.value, index);
}; // Auto active first item when list length or searchValue changed
external_window_React_["useEffect"](function () {
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
}, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode
external_window_React_["useEffect"](function () {
/**
* React will skip `onChange` when component update.
* `setActive` function will call root accessibility state update which makes re-render.
* So we need to delay to let Input component trigger onChange first.
*/
var timeoutId = setTimeout(function () {
if (!multiple && open && values.size === 1) {
var value = Array.from(values)[0];
var index = memoFlattenOptions.findIndex(function (_ref2) {
var data = _ref2.data;
return data.value === value;
});
setActive(index);
scrollIntoView(index);
}
});
return function () {
return clearTimeout(timeoutId);
};
}, [open]); // ========================== Values ==========================
var onSelectValue = function onSelectValue(value) {
if (value !== undefined) {
onSelect(value, {
selected: !values.has(value)
});
} // Single mode should always close by select
if (!multiple) {
onToggleOpen(false);
}
}; // ========================= Keyboard =========================
external_window_React_["useImperativeHandle"](ref, function () {
return {
onKeyDown: function onKeyDown(event) {
var which = event.which;
switch (which) {
// >>> Arrow keys
case KeyCode["a" /* default */].UP:
case KeyCode["a" /* default */].DOWN:
{
var offset = 0;
if (which === KeyCode["a" /* default */].UP) {
offset = -1;
} else if (which === KeyCode["a" /* default */].DOWN) {
offset = 1;
}
if (offset !== 0) {
var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
scrollIntoView(nextActiveIndex);
setActive(nextActiveIndex);
}
break;
}
// >>> Select
case KeyCode["a" /* default */].ENTER:
{
// value
var item = memoFlattenOptions[activeIndex];
if (item && !item.data.disabled) {
onSelectValue(item.data.value);
} else {
onSelectValue(undefined);
}
if (open) {
event.preventDefault();
}
break;
}
// >>> Close
case KeyCode["a" /* default */].ESC:
{
onToggleOpen(false);
}
}
},
onKeyUp: function onKeyUp() {},
scrollTo: function scrollTo(index) {
scrollIntoView(index);
}
};
}); // ========================== Render ==========================
if (memoFlattenOptions.length === 0) {
return external_window_React_["createElement"]("div", {
role: "listbox",
id: "".concat(id, "_list"),
className: "".concat(itemPrefixCls, "-empty"),
onMouseDown: onListMouseDown
}, notFoundContent);
}
function renderItem(index) {
var item = memoFlattenOptions[index];
if (!item) return null;
var itemData = item.data || {};
var value = itemData.value,
label = itemData.label,
children = itemData.children;
var attrs = Object(pickAttrs["a" /* default */])(itemData, true);
var mergedLabel = childrenAsData ? children : label;
return item ? external_window_React_["createElement"]("div", Object.assign({
"aria-label": typeof mergedLabel === 'string' ? mergedLabel : null
}, attrs, {
key: index,
role: "option",
id: "".concat(id, "_list_").concat(index),
"aria-selected": values.has(value)
}), value) : null;
}
return external_window_React_["createElement"](external_window_React_["Fragment"], null, external_window_React_["createElement"]("div", {
role: "listbox",
id: "".concat(id, "_list"),
style: {
height: 0,
width: 0,
overflow: 'hidden'
}
}, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), external_window_React_["createElement"](es["a" /* default */], {
itemKey: "key",
ref: listRef,
data: memoFlattenOptions,
height: height,
itemHeight: itemHeight,
fullHeight: false,
onMouseDown: onListMouseDown,
onScroll: onScroll,
virtual: virtual,
onMouseEnter: onMouseEnter
}, function (_ref3, itemIndex) {
var _classNames;
var group = _ref3.group,
groupOption = _ref3.groupOption,
data = _ref3.data;
var label = data.label,
key = data.key; // Group
if (group) {
return external_window_React_["createElement"]("div", {
className: classnames_default()(itemPrefixCls, "".concat(itemPrefixCls, "-group"))
}, label !== undefined ? label : key);
}
var disabled = data.disabled,
value = data.value,
title = data.title,
children = data.children,
style = data.style,
className = data.className,
otherProps = Object(objectWithoutProperties["a" /* default */])(data, ["disabled", "value", "title", "children", "style", "className"]); // Option
var selected = values.has(value);
var optionPrefixCls = "".concat(itemPrefixCls, "-option");
var optionClassName = classnames_default()(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
var mergedLabel = childrenAsData ? children : label;
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;
return external_window_React_["createElement"]("div", Object.assign({}, otherProps, {
"aria-selected": selected,
className: optionClassName,
title: title,
onMouseMove: function onMouseMove() {
if (activeIndex === itemIndex || disabled) {
return;
}
setActive(itemIndex);
},
onClick: function onClick() {
if (!disabled) {
onSelectValue(value);
}
},
style: style
}), external_window_React_["createElement"]("div", {
className: "".concat(optionPrefixCls, "-content")
}, mergedLabel || value), external_window_React_["isValidElement"](menuItemSelectedIcon) || selected, iconVisible && external_window_React_["createElement"](TransBtn["a" /* default */], {
className: "".concat(itemPrefixCls, "-option-state"),
customizeIcon: menuItemSelectedIcon,
customizeIconProps: {
isSelected: selected
}
}, selected ? '✓' : null));
}));
};
var RefOptionList = external_window_React_["forwardRef"](OptionList_OptionList);
RefOptionList.displayName = 'OptionList';
/* harmony default export */ var es_OptionList = (RefOptionList);
// CONCATENATED MODULE: ./node_modules/rc-select/es/Option.js
/** This is a placeholder, not real render in dom */
var Option = function Option() {
return null;
};
Option.isSelectOption = true;
/* harmony default export */ var es_Option = (Option);
// CONCATENATED MODULE: ./node_modules/rc-select/es/OptGroup.js
/** This is a placeholder, not real render in dom */
var OptGroup = function OptGroup() {
return null;
};
OptGroup.isSelectOptGroup = true;
/* harmony default export */ var es_OptGroup = (OptGroup);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
var objectSpread2 = __webpack_require__("VTBJ");
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
var toArray = __webpack_require__("Zm9Q");
// CONCATENATED MODULE: ./node_modules/rc-select/es/utils/legacyUtil.js
function convertNodeToOption(node) {
var key = node.key,
_node$props = node.props,
children = _node$props.children,
value = _node$props.value,
restProps = Object(objectWithoutProperties["a" /* default */])(_node$props, ["children", "value"]);
return Object(objectSpread2["a" /* default */])({
key: key,
value: value !== undefined ? value : key,
children: children
}, restProps);
}
function convertChildrenToData(nodes) {
var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return Object(toArray["a" /* default */])(nodes).map(function (node, index) {
if (!external_window_React_["isValidElement"](node) || !node.type) {
return null;
}
var isSelectOptGroup = node.type.isSelectOptGroup,
key = node.key,
_node$props2 = node.props,
children = _node$props2.children,
restProps = Object(objectWithoutProperties["a" /* default */])(_node$props2, ["children"]);
if (optionOnly || !isSelectOptGroup) {
return convertNodeToOption(node);
}
return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({
key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"),
label: key
}, restProps), {}, {
options: convertChildrenToData(children)
});
}).filter(function (data) {
return data;
});
}
// EXTERNAL MODULE: ./node_modules/rc-select/es/utils/valueUtil.js
var valueUtil = __webpack_require__("2Qr1");
// EXTERNAL MODULE: ./node_modules/rc-select/es/generate.js + 11 modules
var generate = __webpack_require__("qNPg");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
var esm_typeof = __webpack_require__("U8pU");
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
var warning = __webpack_require__("Kwbf");
// EXTERNAL MODULE: ./node_modules/rc-select/es/utils/commonUtil.js
var commonUtil = __webpack_require__("WKfj");
// CONCATENATED MODULE: ./node_modules/rc-select/es/utils/warningPropsUtil.js
function warningProps(props) {
var mode = props.mode,
options = props.options,
children = props.children,
backfill = props.backfill,
allowClear = props.allowClear,
placeholder = props.placeholder,
getInputElement = props.getInputElement,
showSearch = props.showSearch,
onSearch = props.onSearch,
defaultOpen = props.defaultOpen,
autoFocus = props.autoFocus,
labelInValue = props.labelInValue,
value = props.value,
inputValue = props.inputValue,
optionLabelProp = props.optionLabelProp;
var multiple = mode === 'multiple' || mode === 'tags';
var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';
var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled
Object(warning["a" /* default */])(mode !== 'tags' || mergedOptions.every(function (opt) {
return !opt.disabled;
}), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type
if (mode === 'tags' || mode === 'combobox') {
var hasNumberValue = mergedOptions.some(function (item) {
if (item.options) {
return item.options.some(function (opt) {
return typeof ('value' in opt ? opt.value : opt.key) === 'number';
});
}
return typeof ('value' in item ? item.value : item.key) === 'number';
});
Object(warning["a" /* default */])(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');
} // `combobox` should not use `optionLabelProp`
Object(warning["a" /* default */])(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`
Object(warning["a" /* default */])(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`
Object(warning["a" /* default */])(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`
Object(warning["b" /* noteOnce */])(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`
if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {
Object(warning["a" /* default */])(false, '`onSearch` should work with `showSearch` instead of use alone.');
}
Object(warning["b" /* noteOnce */])(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');
if (value !== undefined && value !== null) {
var values = Object(commonUtil["d" /* toArray */])(value);
Object(warning["a" /* default */])(!labelInValue || values.every(function (val) {
return Object(esm_typeof["a" /* default */])(val) === 'object' && ('key' in val || 'value' in val);
}), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');
Object(warning["a" /* default */])(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');
} // Syntactic sugar should use correct children type
if (children) {
var invalidateChildType = null;
Object(toArray["a" /* default */])(children).some(function (node) {
if (!external_window_React_["isValidElement"](node) || !node.type) {
return false;
}
var type = node.type;
if (type.isSelectOption) {
return false;
}
if (type.isSelectOptGroup) {
var allChildrenValid = Object(toArray["a" /* default */])(node.props.children).every(function (subNode) {
if (!external_window_React_["isValidElement"](subNode) || !node.type || subNode.type.isSelectOption) {
return true;
}
invalidateChildType = subNode.type;
return false;
});
if (allChildrenValid) {
return false;
}
return true;
}
invalidateChildType = type;
return true;
});
if (invalidateChildType) {
Object(warning["a" /* default */])(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`."));
}
Object(warning["a" /* default */])(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');
}
}
/* harmony default export */ var warningPropsUtil = (warningProps);
// CONCATENATED MODULE: ./node_modules/rc-select/es/Select.js
/**
* To match accessibility requirement, we always provide an input in the component.
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
* For focused select, we set `aria-live="polite"` to update the accessibility content.
*
* ref:
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
*
* New api:
* - listHeight
* - listItemHeight
* - component
*
* Remove deprecated api:
* - multiple
* - tags
* - combobox
* - firstActiveValue
* - dropdownMenuStyle
* - openClassName (Not list in api)
*
* Update:
* - `backfill` only support `combobox` mode
* - `combobox` mode not support `labelInValue` since it's meaningless
* - `getInputElement` only support `combobox` mode
* - `onChange` return OptionData instead of ReactNode
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
* - `combobox` mode not support `optionLabelProp`
*/
var RefSelect = Object(generate["a" /* default */])({
prefixCls: 'rc-select',
components: {
optionList: es_OptionList
},
convertChildrenToData: convertChildrenToData,
flattenOptions: valueUtil["d" /* flattenOptions */],
getLabeledValue: valueUtil["e" /* getLabeledValue */],
filterOptions: valueUtil["b" /* filterOptions */],
isValueDisabled: valueUtil["g" /* isValueDisabled */],
findValueOption: valueUtil["c" /* findValueOption */],
warningProps: warningPropsUtil,
fillOptionsWithMissingValue: valueUtil["a" /* fillOptionsWithMissingValue */]
});
/**
* Typescript not support generic with function component,
* we have to wrap an class component to handle this.
*/
var Select_Select = /*#__PURE__*/function (_React$Component) {
Object(inherits["a" /* default */])(Select, _React$Component);
var _super = Object(createSuper["a" /* default */])(Select);
function Select() {
var _this;
Object(classCallCheck["a" /* default */])(this, Select);
_this = _super.apply(this, arguments);
_this.selectRef = external_window_React_["createRef"]();
_this.focus = function () {
_this.selectRef.current.focus();
};
_this.blur = function () {
_this.selectRef.current.blur();
};
return _this;
}
Object(createClass["a" /* default */])(Select, [{
key: "render",
value: function render() {
return external_window_React_["createElement"](RefSelect, Object.assign({
ref: this.selectRef
}, this.props));
}
}]);
return Select;
}(external_window_React_["Component"]);
Select_Select.Option = es_Option;
Select_Select.OptGroup = es_OptGroup;
/* harmony default export */ var es_Select = (Select_Select);
// CONCATENATED MODULE: ./node_modules/rc-select/es/index.js
/* harmony default export */ var rc_select_es = __webpack_exports__["c"] = (es_Select);
/***/ }),
/***/ "NDqe":
/*!*******************************************************!*\
!*** ./src/pages/Messages/Private/index.less?modules ***!
\*******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
module.exports = {"flex_box_center":"flex_box_center___3oYZ2","flex_space_between":"flex_space_between___1FifH","flex_box_vertical_center":"flex_box_vertical_center___2iDXN","flex_box_center_end":"flex_box_center_end___2rJ_G","flex_box_column":"flex_box_column___3ucki","tabs":"tabs___3aVAD","active":"active___1eCl8","list":"list___2weuP","tags":"tags___10O8v","searchWrp":"searchWrp___xsrqM","newlight":"newlight___1S7Yv"};
/***/ }),
/***/ "SJMd":
/*!****************************************************!*\
!*** ./node_modules/code-prettify/src/prettify.js ***!
\****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports) {
/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview
* some functions for browser-side pretty printing of code contained in html.
*
*
* For a fairly comprehensive set of languages see the
* README
* file that came with this source. At a minimum, the lexer should work on a
* number of languages including C and friends, Java, Python, Bash, SQL, HTML,
* XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk
* and a subset of Perl, but, because of commenting conventions, doesn't work on
* Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class.
*
* Usage:
*
include this source file in an html page via
* {@code }
*
define style rules. See the example page for examples.
*
mark the {@code
} and {@code } tags in your source with
* {@code class=prettyprint.}
* You can also use the (html deprecated) {@code } tag, but the pretty
* printer needs to do more substantial DOM manipulations to support that, so
* some css styles may not be preserved.
*
* That's it. I wanted to keep the API as simple as possible, so there's no
* need to specify which language the code is in, but if you wish, you can add
* another class to the {@code
} or {@code } element to specify the
* language, as in {@code
}. Any class that
* starts with "lang-" followed by a file extension, specifies the file type.
* See the "lang-*.js" files in this directory for code that implements
* per-language file handlers.
*
* Change log:
* cbeust, 2006/08/22
*
* Java annotations (start with "@") are now captured as literals ("lit")
*
* @requires console
*/
// JSLint declarations
/*global console, document, navigator, setTimeout, window, define */
/**
* @typedef {!Array.}
* Alternating indices and the decorations that should be inserted there.
* The indices are monotonically increasing.
*/
var DecorationsT;
/**
* @typedef {!{
* sourceNode: !Element,
* pre: !(number|boolean),
* langExtension: ?string,
* numberLines: ?(number|boolean),
* sourceCode: ?string,
* spans: ?(Array.),
* basePos: ?number,
* decorations: ?DecorationsT
* }}
*
*
sourceNode
the element containing the source
*
sourceCode
source as plain text
*
pre
truthy if white-space in text nodes
* should be considered significant.
*
spans
alternating span start indices into source
* and the text node or element (e.g. {@code }) corresponding to that
* span.
*
decorations
an array of style classes preceded
* by the position at which they start in job.sourceCode in order
*
basePos
integer position of this.sourceCode in the larger chunk of
* source.
*
alternating span start indices into source
* and the text node or element (e.g. {@code }) corresponding to that
* span.
*
*/
var SourceSpansT;
/** @define {boolean} */
var IN_GLOBAL_SCOPE = false;
var HACK_TO_FIX_JS_INCLUDE_PL;
/**
* {@type !{
* 'createSimpleLexer': function (Array, Array): (function (JobT)),
* 'registerLangHandler': function (function (JobT), Array.),
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_VALUE': string,
* 'PR_COMMENT': string,
* 'PR_DECLARATION': string,
* 'PR_KEYWORD': string,
* 'PR_LITERAL': string,
* 'PR_NOCODE': string,
* 'PR_PLAIN': string,
* 'PR_PUNCTUATION': string,
* 'PR_SOURCE': string,
* 'PR_STRING': string,
* 'PR_TAG': string,
* 'PR_TYPE': string,
* 'prettyPrintOne': function (string, string, number|boolean),
* 'prettyPrint': function (?function, ?(HTMLElement|HTMLDocument))
* }}
* @const
*/
var PR;
/**
* Split {@code prettyPrint} into multiple timeouts so as not to interfere with
* UI events.
* If set to {@code false}, {@code prettyPrint()} is synchronous.
*/
window['PR_SHOULD_USE_CONTINUATION'] = true;
/**
* Pretty print a chunk of code.
* @param {string} sourceCodeHtml The HTML to pretty print.
* @param {string} opt_langExtension The language name to use.
* Typically, a filename extension like 'cpp' or 'java'.
* @param {number|boolean} opt_numberLines True to number lines,
* or the 1-indexed number of the first line in sourceCodeHtml.
* @return {string} code as html, but prettier
*/
var prettyPrintOne;
/**
* Find all the {@code
} and {@code } tags in the DOM with
* {@code class=prettyprint} and prettify them.
*
* @param {Function} opt_whenDone called when prettifying is done.
* @param {HTMLElement|HTMLDocument} opt_root an element or document
* containing all the elements to pretty print.
* Defaults to {@code document.body}.
*/
var prettyPrint;
(function () {
var win = window;
// Keyword lists for various languages.
// We use things that coerce to strings to make them compact when minified
// and to defeat aggressive optimizers that fold large string constants.
var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
"double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed," +
"sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
"new,operator,private,protected,public,this,throw,true,try,typeof"];
var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignas,alignof,align_union,asm,axiom,bool," +
"concept,concept_map,const_cast,constexpr,decltype,delegate," +
"dynamic_cast,explicit,export,friend,generic,late_check," +
"mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert," +
"static_cast,template,typeid,typename,using,virtual,where"];
var JAVA_KEYWORDS = [COMMON_KEYWORDS,
"abstract,assert,boolean,byte,extends,finally,final,implements,import," +
"instanceof,interface,null,native,package,strictfp,super,synchronized," +
"throws,transient"];
var CSHARP_KEYWORDS = [COMMON_KEYWORDS,
"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending," +
"dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface," +
"internal,into,is,join,let,lock,null,object,out,override,orderby,params," +
"partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong," +
"unchecked,unsafe,ushort,value,var,virtual,where,yield"];
var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
"for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
"throw,true,try,unless,until,when,while,yes";
var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
"abstract,async,await,constructor,debugger,enum,eval,export,function," +
"get,implements,instanceof,interface,let,null,set,undefined,var,with," +
"yield,Infinity,NaN"];
var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
"goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
"sub,undef,unless,until,use,wantarray,while,BEGIN,END";
var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
"elif,except,exec,finally,from,global,import,in,is,lambda," +
"nonlocal,not,or,pass,print,raise,try,with,yield," +
"False,True,None"];
var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
"rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
"BEGIN,END"];
var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
"function,in,local,set,then,until"];
var ALL_KEYWORDS = [
CPP_KEYWORDS, CSHARP_KEYWORDS, JAVA_KEYWORDS, JSCRIPT_KEYWORDS,
PERL_KEYWORDS, PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
var C_TYPES = /^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
// token style names. correspond to css classes
/**
* token style for a string literal
* @const
*/
var PR_STRING = 'str';
/**
* token style for a keyword
* @const
*/
var PR_KEYWORD = 'kwd';
/**
* token style for a comment
* @const
*/
var PR_COMMENT = 'com';
/**
* token style for a type
* @const
*/
var PR_TYPE = 'typ';
/**
* token style for a literal value. e.g. 1, null, true.
* @const
*/
var PR_LITERAL = 'lit';
/**
* token style for a punctuation string.
* @const
*/
var PR_PUNCTUATION = 'pun';
/**
* token style for plain text.
* @const
*/
var PR_PLAIN = 'pln';
/**
* token style for an sgml tag.
* @const
*/
var PR_TAG = 'tag';
/**
* token style for a markup declaration such as a DOCTYPE.
* @const
*/
var PR_DECLARATION = 'dec';
/**
* token style for embedded source.
* @const
*/
var PR_SOURCE = 'src';
/**
* token style for an sgml attribute name.
* @const
*/
var PR_ATTRIB_NAME = 'atn';
/**
* token style for an sgml attribute value.
* @const
*/
var PR_ATTRIB_VALUE = 'atv';
/**
* A class that indicates a section of markup that is not code, e.g. to allow
* embedding of line numbers within code listings.
* @const
*/
var PR_NOCODE = 'nocode';
/**
* A set of tokens that can precede a regular expression literal in
* javascript
* http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
* has the full list, but I've removed ones that might be problematic when
* seen in languages that don't support regular expression literals.
*
*
Specifically, I've removed any keywords that can't precede a regexp
* literal in a syntactically legal javascript program, and I've removed the
* "in" keyword since it's not a keyword in many languages, and might be used
* as a count of inches.
*
*
The link above does not accurately describe EcmaScript rules since
* it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
* very well in practice.
*
* @private
* @const
*/
var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
// CAVEAT: this does not properly handle the case where a regular
// expression immediately follows another since a regular expression may
// have flags for case-sensitivity and the like. Having regexp tokens
// adjacent is not valid in any language I'm aware of, so I'm punting.
// TODO: maybe style special characters inside a regexp as punctuation.
/**
* Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
* matches the union of the sets of strings matched by the input RegExp.
* Since it matches globally, if the input strings have a start-of-input
* anchor (/^.../), it is ignored for the purposes of unioning.
* @param {Array.} regexs non multiline, non-global regexs.
* @return {RegExp} a global regex.
*/
function combinePrefixPatterns(regexs) {
var capturedGroupIndex = 0;
var needToFoldCase = false;
var ignoreCase = false;
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.ignoreCase) {
ignoreCase = true;
} else if (/[a-z]/i.test(regex.source.replace(
/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
needToFoldCase = true;
ignoreCase = false;
break;
}
}
var escapeCharToCodeUnit = {
'b': 8,
't': 9,
'n': 0xa,
'v': 0xb,
'f': 0xc,
'r': 0xd
};
function decodeEscape(charsetPart) {
var cc0 = charsetPart.charCodeAt(0);
if (cc0 !== 92 /* \\ */) {
return cc0;
}
var c1 = charsetPart.charAt(1);
cc0 = escapeCharToCodeUnit[c1];
if (cc0) {
return cc0;
} else if ('0' <= c1 && c1 <= '7') {
return parseInt(charsetPart.substring(1), 8);
} else if (c1 === 'u' || c1 === 'x') {
return parseInt(charsetPart.substring(2), 16);
} else {
return charsetPart.charCodeAt(1);
}
}
function encodeEscape(charCode) {
if (charCode < 0x20) {
return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
}
var ch = String.fromCharCode(charCode);
return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
? "\\" + ch : ch;
}
function caseFoldCharset(charSet) {
var charsetParts = charSet.substring(1, charSet.length - 1).match(
new RegExp(
'\\\\u[0-9A-Fa-f]{4}'
+ '|\\\\x[0-9A-Fa-f]{2}'
+ '|\\\\[0-3][0-7]{0,2}'
+ '|\\\\[0-7]{1,2}'
+ '|\\\\[\\s\\S]'
+ '|-'
+ '|[^-\\\\]',
'g'));
var ranges = [];
var inverse = charsetParts[0] === '^';
var out = ['['];
if (inverse) { out.push('^'); }
for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
var p = charsetParts[i];
if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
out.push(p);
} else {
var start = decodeEscape(p);
var end;
if (i + 2 < n && '-' === charsetParts[i + 1]) {
end = decodeEscape(charsetParts[i + 2]);
i += 2;
} else {
end = start;
}
ranges.push([start, end]);
// If the range might intersect letters, then expand it.
// This case handling is too simplistic.
// It does not deal with non-latin case folding.
// It works for latin source code identifiers though.
if (!(end < 65 || start > 122)) {
if (!(end < 65 || start > 90)) {
ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
}
if (!(end < 97 || start > 122)) {
ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
}
}
}
}
// [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
// -> [[1, 12], [14, 14], [16, 17]]
ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
var consolidatedRanges = [];
var lastRange = [];
for (var i = 0; i < ranges.length; ++i) {
var range = ranges[i];
if (range[0] <= lastRange[1] + 1) {
lastRange[1] = Math.max(lastRange[1], range[1]);
} else {
consolidatedRanges.push(lastRange = range);
}
}
for (var i = 0; i < consolidatedRanges.length; ++i) {
var range = consolidatedRanges[i];
out.push(encodeEscape(range[0]));
if (range[1] > range[0]) {
if (range[1] + 1 > range[0]) { out.push('-'); }
out.push(encodeEscape(range[1]));
}
}
out.push(']');
return out.join('');
}
function allowAnywhereFoldCaseAndRenumberGroups(regex) {
// Split into character sets, escape sequences, punctuation strings
// like ('(', '(?:', ')', '^'), and runs of characters that do not
// include any of the above.
var parts = regex.source.match(
new RegExp(
'(?:'
+ '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
+ '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
+ '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
+ '|\\\\[0-9]+' // a back-reference or octal escape
+ '|\\\\[^ux0-9]' // other escape sequence
+ '|\\(\\?[:!=]' // start of a non-capturing group
+ '|[\\(\\)\\^]' // start/end of a group, or line start
+ '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
+ ')',
'g'));
var n = parts.length;
// Maps captured group numbers to the number they will occupy in
// the output or to -1 if that has not been determined, or to
// undefined if they need not be capturing in the output.
var capturedGroups = [];
// Walk over and identify back references to build the capturedGroups
// mapping.
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
// groups are 1-indexed, so max group index is count of '('
++groupIndex;
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue) {
if (decimalValue <= groupIndex) {
capturedGroups[decimalValue] = -1;
} else {
// Replace with an unambiguous escape sequence so that
// an octal escape sequence does not turn into a backreference
// to a capturing group from an earlier regex.
parts[i] = encodeEscape(decimalValue);
}
}
}
}
// Renumber groups and reduce capturing groups to non-capturing groups
// where possible.
for (var i = 1; i < capturedGroups.length; ++i) {
if (-1 === capturedGroups[i]) {
capturedGroups[i] = ++capturedGroupIndex;
}
}
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
++groupIndex;
if (!capturedGroups[groupIndex]) {
parts[i] = '(?:';
}
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue && decimalValue <= groupIndex) {
parts[i] = '\\' + capturedGroups[decimalValue];
}
}
}
// Remove any prefix anchors so that the output will match anywhere.
// ^^ really does mean an anchored match though.
for (var i = 0; i < n; ++i) {
if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
}
// Expand letters to groups to handle mixing of case-sensitive and
// case-insensitive patterns if necessary.
if (regex.ignoreCase && needToFoldCase) {
for (var i = 0; i < n; ++i) {
var p = parts[i];
var ch0 = p.charAt(0);
if (p.length >= 2 && ch0 === '[') {
parts[i] = caseFoldCharset(p);
} else if (ch0 !== '\\') {
// TODO: handle letters in numeric escapes.
parts[i] = p.replace(
/[a-zA-Z]/g,
function (ch) {
var cc = ch.charCodeAt(0);
return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
});
}
}
}
return parts.join('');
}
var rewritten = [];
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.global || regex.multiline) { throw new Error('' + regex); }
rewritten.push(
'(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
}
return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
}
/**
* Split markup into a string of source code and an array mapping ranges in
* that string to the text nodes in which they appear.
*
*
* where #1 is a reference to the {@code "print "} text node above, and so
* on for the other text nodes.
*
*
*
* The {@code} spans array is an array of pairs. Even elements are the start
* indices of substrings, and odd elements are the text nodes (or BR elements)
* that contain the text for those substrings.
* Substrings continue until the next index or the end of the source.
*
*
* @param {Node} node an HTML DOM subtree containing source-code.
* @param {boolean|number} isPreformatted truthy if white-space in
* text nodes should be considered significant.
* @return {SourceSpansT} source code and the nodes in which they occur.
*/
function extractSourceSpans(node, isPreformatted) {
var nocode = /(?:^|\s)nocode(?:\s|$)/;
var chunks = [];
var length = 0;
var spans = [];
var k = 0;
function walk(node) {
var type = node.nodeType;
if (type == 1) { // Element
if (nocode.test(node.className)) { return; }
for (var child = node.firstChild; child; child = child.nextSibling) {
walk(child);
}
var nodeName = node.nodeName.toLowerCase();
if ('br' === nodeName || 'li' === nodeName) {
chunks[k] = '\n';
spans[k << 1] = length++;
spans[(k++ << 1) | 1] = node;
}
} else if (type == 3 || type == 4) { // Text
var text = node.nodeValue;
if (text.length) {
if (!isPreformatted) {
text = text.replace(/[ \t\r\n]+/g, ' ');
} else {
text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
}
// TODO: handle tabs here?
chunks[k] = text;
spans[k << 1] = length;
length += text.length;
spans[(k++ << 1) | 1] = node;
}
}
}
walk(node);
return {
sourceCode: chunks.join('').replace(/\n$/, ''),
spans: spans
};
}
/**
* Apply the given language handler to sourceCode and add the resulting
* decorations to out.
* @param {!Element} sourceNode
* @param {number} basePos the index of sourceCode within the chunk of source
* whose decorations are already present on out.
* @param {string} sourceCode
* @param {function(JobT)} langHandler
* @param {DecorationsT} out
*/
function appendDecorations(
sourceNode, basePos, sourceCode, langHandler, out) {
if (!sourceCode) { return; }
/** @type {JobT} */
var job = {
sourceNode: sourceNode,
pre: 1,
langExtension: null,
numberLines: null,
sourceCode: sourceCode,
spans: null,
basePos: basePos,
decorations: null
};
langHandler(job);
out.push.apply(out, job.decorations);
}
var notWs = /\S/;
/**
* Given an element, if it contains only one child element and any text nodes
* it contains contain only space characters, return the sole child element.
* Otherwise returns undefined.
*
* This is meant to return the CODE element in {@code
} when
* there is a single child element that contains all the non-space textual
* content, but not to return anything where there are multiple child elements
* as in {@code
......
} or when there
* is textual content.
*/
function childContentWrapper(element) {
var wrapper = undefined;
for (var c = element.firstChild; c; c = c.nextSibling) {
var type = c.nodeType;
wrapper = (type === 1) // Element Node
? (wrapper ? element : c)
: (type === 3) // Text Node
? (notWs.test(c.nodeValue) ? element : wrapper)
: wrapper;
}
return wrapper === element ? undefined : wrapper;
}
/** Given triples of [style, pattern, context] returns a lexing function,
* The lexing function interprets the patterns to find token boundaries and
* returns a decoration list of the form
* [index_0, style_0, index_1, style_1, ..., index_n, style_n]
* where index_n is an index into the sourceCode, and style_n is a style
* constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
* all characters in sourceCode[index_n-1:index_n].
*
* The stylePatterns is a list whose elements have the form
* [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
*
* Style is a style constant like PR_PLAIN, or can be a string of the
* form 'lang-FOO', where FOO is a language extension describing the
* language of the portion of the token in $1 after pattern executes.
* E.g., if style is 'lang-lisp', and group 1 contains the text
* '(hello (world))', then that portion of the token will be passed to the
* registered lisp handler for formatting.
* The text before and after group 1 will be restyled using this decorator
* so decorators should take care that this doesn't result in infinite
* recursion. For example, the HTML lexer rule for SCRIPT elements looks
* something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
* '