funda-ui
Version:
React components using pure Bootstrap 5+ which does not contain any external style and script libraries.
1,176 lines (1,109 loc) • 115 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["RPB"] = factory(require("react"));
else
root["RPB"] = factory(root["React"]);
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 188:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_993__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_993__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_993__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_993__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_993__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_993__.d(__webpack_exports__, {
/* harmony export */"clsWrite": function clsWrite() {
return (/* binding */_clsWrite
);
},
/* harmony export */"combinedCls": function combinedCls() {
return (/* binding */_combinedCls
);
}
/* harmony export */
});
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
/**
* Output of class name
* @param {*} s - Any
* @param {String} defaultCls - Default string
* @param {?*} targetCls - Any
* @returns {*}
*/
function _clsWrite(s, defaultCls) {
var targetCls = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
return s || s === '' ? typeof targetCls === 'undefined' ? s : targetCls : defaultCls;
}
/**
* Combined classnames
* @param {*} args
* @returns {String|undefined}
*/
/* Usage:
console.log(combinedCls('a-1', 'a-2', 'a-3', {
'p-1': null,
'p-2': undefined,
'p-3': true,
'p-4': false,
'p-5': 'kkk',
'p-6': 0,
'p-7': 1,
'p-8': '',
undefined
})); // a-1 a-2 a-3 p-3 p-5 p-7
*/
function _combinedCls() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args) {
var classes = [];
for (var i = 0; i < args.length; i++) {
var className = args[i];
if (!className) {
continue;
}
var type = _typeof(className);
if (type === 'string' || type === 'number') {
classes.push(className);
} else if (type === 'object') {
var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return value ? key : null;
});
classes = _classes.length ? classes.concat(_classes.filter(function (c) {
return !!c;
})) : classes;
}
}
return classes.join(' ').trim();
}
return undefined;
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 79:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_987__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_987__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_987__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_987__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_987__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_987__.d(__webpack_exports__, {
/* harmony export */"convertArrToValByBraces": function convertArrToValByBraces() {
return (/* binding */_convertArrToValByBraces
);
},
/* harmony export */"convertArrToValByBrackets": function convertArrToValByBrackets() {
return (/* binding */_convertArrToValByBrackets
);
},
/* harmony export */"convertStringByCommaToValByBraces": function convertStringByCommaToValByBraces() {
return (/* binding */_convertStringByCommaToValByBraces
);
},
/* harmony export */"convertStringByCommaToValByBrackets": function convertStringByCommaToValByBrackets() {
return (/* binding */_convertStringByCommaToValByBrackets
);
}
/* harmony export */
});
/**
* Convert value to string separated by square brackets
* @param {String} str such as: 1,2,3
* @returns {String} such as: [1][2][3]
*/
function _convertStringByCommaToValByBrackets(str) {
if (typeof str === 'undefined' || str === null || str === '') {
return '';
}
return str.split(',').map(function (v) {
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
}).join('');
}
/**
* Convert array value to string separated by square brackets
* @param {String[]} arr such as: ['1','2','3']
* @returns {String} such as: [1][2][3]
*/
function _convertArrToValByBrackets(arr) {
if (!Array.isArray(arr)) return '';
return arr.map(function (v) {
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
}).join('');
}
/**
* Convert value to string separated by curly braces
* @param {String} str such as: 1,2,3
* @returns {String} such as: {1}{2}{3}
*/
function _convertStringByCommaToValByBraces(str) {
if (typeof str === 'undefined' || str === null || str === '') {
return '';
}
return str.split(',').map(function (v) {
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
}).join('');
}
/**
* Convert array value to string separated by curly braces
* @param {String[]} arr such as: ['1','2','3']
* @returns {String} such as: {1}{2}{3}
*/
function _convertArrToValByBraces(arr) {
if (!Array.isArray(arr)) return '';
return arr.map(function (v) {
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
}).join('');
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 135:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_987__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_987__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_987__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_987__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_987__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_987__.d(__webpack_exports__, {
/* harmony export */"extractContentsOfBraces": function extractContentsOfBraces() {
return (/* binding */_extractContentsOfBraces
);
},
/* harmony export */"extractContentsOfBrackets": function extractContentsOfBrackets() {
return (/* binding */_extractContentsOfBrackets
);
},
/* harmony export */"extractContentsOfMixedCharactersWithBraces": function extractContentsOfMixedCharactersWithBraces() {
return (/* binding */_extractContentsOfMixedCharactersWithBraces
);
},
/* harmony export */"extractContentsOfMixedCharactersWithComma": function extractContentsOfMixedCharactersWithComma() {
return (/* binding */_extractContentsOfMixedCharactersWithComma
);
},
/* harmony export */"extractContentsOfParentheses": function extractContentsOfParentheses() {
return (/* binding */_extractContentsOfParentheses
);
},
/* harmony export */"extractorExist": function extractorExist() {
return (/* binding */_extractorExist
);
}
/* harmony export */
});
/**
* Determine whether an extractor is included
* @param {String} str => input string. such as 'a[1], b[2]', '{a[1]}'
* @returns {Boolean}
*/
function _extractorExist(str) {
if (typeof str === 'undefined' || str === null || str === '') {
return false;
}
var res = false;
if (str !== null && str !== void 0 && str.match(/(\[.*?\])/gi)) {
res = true;
}
return res;
}
/**
* Extract the contents of square brackets
* @param {String} str => input string. such as '[1,2] [f][c]'
* @param {Boolean} commaSeparated => flag to determine if the result should be comma separated or not
* @returns {Array<string>|string} such as: ['1,2','f','c']
*/
function _extractContentsOfBrackets(str) {
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (typeof str === 'undefined' || str === null || str === '') {
return !commaSeparated ? [] : '';
}
var res = str.match(/[^\[]+(?=(\[ \])|\])/g);
if (commaSeparated) {
return res === null ? '' : res.join(',').replace(/\,+$/, '');
} else {
return res === null ? '' : res;
}
}
/**
* Extract the contents of curly braces
* @param {String} str => input string. such as '{1,2} {f}{c}'
* @param {Boolean} commaSeparated => flag to determine if the result should be comma separated or not
* @returns {Array<string>|string} such as: ['1,2','f','c']
*/
function _extractContentsOfBraces(str) {
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (typeof str === 'undefined' || str === null || str === '') {
return !commaSeparated ? [] : '';
}
var res = str.match(/[^\{]+(?=(\{ \})|\})/g);
if (commaSeparated) {
return res === null ? '' : res.join(',').replace(/\,+$/, '');
} else {
return res === null ? '' : res;
}
}
/**
* Extract the contents of parentheses
* @param {String} str => input string. such as '(1,2) (f)(c)'
* @param {Boolean} commaSeparated => flag to determine if the result should be comma separated or not
* @returns {Array<string>|string} such as: ['1,2','f','c']
*/
function _extractContentsOfParentheses(str) {
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (typeof str === 'undefined' || str === null || str === '') {
return !commaSeparated ? [] : '';
}
var res = str.match(/[^\(]+(?=(\( \))|\))/g);
if (commaSeparated) {
return res === null ? '' : res.join(',').replace(/\,+$/, '');
} else {
return res === null ? '' : res;
}
}
/**
* Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
*
* Example:
* Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
* Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
*
* Output: [
* { label: "Poor", value: "c" },
* { label: "Sub-option 4", value: "c-2" },
* { label: "Empty", value: "" }
* ]
*
* @param {string} str - The input string containing one or more `{label[value]}` segments.
* @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
*/
function _extractContentsOfMixedCharactersWithBraces(str) {
// Fix the extra '{' at the beginning
var cleaned = str.replace(/^{{/, '{');
// Remove empty {} or {[]} tail
var trimmed = cleaned.replace(/\{\[\]\}$/, '');
// The match is like {label[value]}
var pattern = /\{(.*?)\[(.*?)\]\}/g;
var matches = Array.from(trimmed.matchAll(pattern));
return matches.map(function (match) {
return {
label: match[1],
value: match[2]
};
});
}
/**
* Parses a comma-separated string of `label[value]` pairs into an array of objects.
*
* Example:
* Input: "Poor[c],Sub-option 4[c-2],Empty[]"
* Output: [
* { label: "Poor", value: "c" },
* { label: "Sub-option 4", value: "c-2" },
* { label: "Empty", value: "" }
* ]
*
* @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
* @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
*/
function _extractContentsOfMixedCharactersWithComma(str) {
return str.split(",").map(function (item) {
return item.trim();
}).map(function (item) {
var match = item.match(/^(.*?)\[(.*?)\]$/);
if (match) {
return {
label: match[1],
value: match[2]
};
}
return null;
}).filter(Boolean);
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 575:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_993__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_993__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_993__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_993__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_993__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_993__.d(__webpack_exports__, {
/* harmony export */"deepClone": function deepClone() {
return (/* binding */_deepClone
);
},
/* harmony export */"flatData": function flatData() {
return (/* binding */_flatData
);
},
/* harmony export */"removeArrDuplicateItems": function removeArrDuplicateItems() {
return (/* binding */_removeArrDuplicateItems
);
}
/* harmony export */
});
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
/**
* Remove Duplicate objects from JSON Array
* @param {Array} obj
* @param {String} fieldName
*/
function _removeArrDuplicateItems(obj, fieldName) {
if (!Array.isArray(obj)) return [];
var clean = obj.filter(function (item, index, self) {
return index === self.findIndex(function (t) {
return t[fieldName] === item[fieldName];
});
});
return clean;
}
;
/**
* Deep clone
* @param {*} obj
*/
function _deepClone(obj) {
if (Array.isArray(obj)) {
return obj.map(function (item) {
return _deepClone(item);
});
} else if (_typeof(obj) === 'object' && obj !== null) {
var clone = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
clone[key] = _deepClone(obj[key]);
}
}
return clone;
} else {
return obj;
}
}
/**
* Flat Data
* @param {*} data
* @returns
*/
function _flatData(data) {
var result = [];
var iterate = function iterate(obj) {
if (!obj) {
return;
}
obj.forEach(function (item) {
result.push(item);
if (item.children) {
iterate(item.children);
}
// delete current item children
delete item.children;
});
};
iterate(data);
return result;
}
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 85:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/
var __webpack_modules__ = {
/***/787: /***/function _(module) {
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
/***/
}
/******/
};
/************************************************************************/
/******/ // The module cache
/******/
var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/
function __nested_webpack_require_1465__(moduleId) {
/******/ // Check if module is in cache
/******/var cachedModule = __webpack_module_cache__[moduleId];
/******/
if (cachedModule !== undefined) {
/******/return cachedModule.exports;
/******/
}
/******/ // Create a new module (and put it into the cache)
/******/
var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/exports: {}
/******/
};
/******/
/******/ // Execute the module function
/******/
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
/******/
/******/ // Return the exports of the module
/******/
return module.exports;
/******/
}
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/
(function () {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/__nested_webpack_require_1465__.n = function (module) {
/******/var getter = module && module.__esModule ? /******/function () {
return module['default'];
} : /******/function () {
return module;
};
/******/
__nested_webpack_require_1465__.d(getter, {
a: getter
});
/******/
return getter;
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_1465__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_1465__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_1465__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(function () {
__nested_webpack_require_1465__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_1465__.d(__webpack_exports__, {
/* harmony export */"default": function _default() {
return __WEBPACK_DEFAULT_EXPORT__;
}
/* harmony export */
});
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
/* harmony import */
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/**
* Create an available ID
*
*/
var useComId = function useComId() {
return "ID-".concat((0, react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-"));
};
/* harmony default export */
var __WEBPACK_DEFAULT_EXPORT__ = useComId;
})();
/******/
return __webpack_exports__;
/******/
}()
);
});
/***/ }),
/***/ 455:
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
(function webpackUniversalModuleDefinition(root, factory) {
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
})(this, function () {
return (/******/function () {
// webpackBootstrap
/******/
"use strict";
/******/ // The require scope
/******/
var __nested_webpack_require_993__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/
(function () {
/******/ // define getter functions for harmony exports
/******/__nested_webpack_require_993__.d = function (exports, definition) {
/******/for (var key in definition) {
/******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
/******/Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/
(function () {
/******/__nested_webpack_require_993__.o = function (obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
/******/
})();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/
(function () {
/******/ // define __esModule on exports
/******/__nested_webpack_require_993__.r = function (exports) {
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/Object.defineProperty(exports, Symbol.toStringTag, {
value: 'Module'
});
/******/
}
/******/
Object.defineProperty(exports, '__esModule', {
value: true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__nested_webpack_require_993__.r(__webpack_exports__);
/* harmony export */
__nested_webpack_require_993__.d(__webpack_exports__, {
/* harmony export */"fixAndParseJSON": function fixAndParseJSON() {
return (/* binding */_fixAndParseJSON
);
},
/* harmony export */"isEmail": function isEmail() {
return (/* binding */_isEmail
);
},
/* harmony export */"isEmpty": function isEmpty() {
return (/* binding */_isEmpty
);
},
/* harmony export */"isInt": function isInt() {
return (/* binding */_isInt
);
},
/* harmony export */"isJSON": function isJSON() {
return (/* binding */_isJSON
);
},
/* harmony export */"isMobile": function isMobile() {
return (/* binding */_isMobile
);
},
/* harmony export */"isNumber": function isNumber() {
return (/* binding */_isNumber
);
},
/* harmony export */"isTel": function isTel() {
return (/* binding */_isTel
);
},
/* harmony export */"isValidNumeric": function isValidNumeric() {
return (/* binding */_isValidNumeric
);
}
/* harmony export */
});
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _typeof(obj);
}
/**
* Fix And Parse JSON (Support for handling complex escape JSON strings)
* @desc recursively fix top-level key/value (recursively handles when encountering top-level values that are objects/arrays)
* @private
*/
/*
- Still prioritize JSON.parse first;
- After parse fails, do unescaping (\\" → ");
- Then process the outermost layer (object or array) key by key, value by value;
- If a top-level value is an unquoted object or array (e.g., messages: [ {...} ]), recursively treat that value as a new outermost layer for fixing;
- For strings wrapped in quotes ('...' or "..."), only extract the outer layer and re-encode with JSON.stringify (ensuring internal single/double quotes won't be mistakenly changed);
- Set MAX_DEPTH to prevent infinite recursion.
*/
/*
@Examples:
// ✅ Valid JSON (contains svg and single quote content)
const okJson = `{
"label":"<svg width='16' height='16'><path fill='currentColor' d='M19 13h-6'/></svg> 新建会话",
"value":"new",
"onClick":"method.setVal(''); method.clearData();"
}`;
const okJson2 = `{
label:"<svg width='16' height='16'><path fill='currentColor' d='M19 13h-6'/></svg> 新建会话",
value:"new",
onClick:"method.setVal(''); method.clearData();"
}`;
// ⚠️ Single quote JSON
const badJson = "{'model':'{model}','messages':[{'role':'user','content':'{message}'}],'stream': true}";
// ⚠️ Escaped JSON
const badJson2 = "{\\\"label\\\":\\\"<svg width='16' height='16' viewBox='0 0 24 24'><path fill='currentColor' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/></svg> 新建会话\\\",\\\"value\\\":\\\"new\\\",\\\"onClick\\\":\\\"method.setVal(''); method.clearData();\\\"}";
const badJson3 = "{\"label\":\"<svg width='16' height='16' viewBox='0 0 24 24'><path fill='currentColor' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/></svg> 新建会话\",\"value\":\"new\",\"onClick\":\"method.setVal(''); method.clearData();\"}";
const badJson4 = "[{\"label\":\"<svg fill='currentColor' width='12' height='12' viewBox='0 0 24 24'><path d='M20.5 9a3.49 3.49 0 0 0-3.45 3h-1.1a2.49 2.49 0 0 0-4.396-1.052L8.878 9.731l3.143-4.225a2.458 2.458 0 0 0 2.98-.019L17.339 8H16v1h3V6h-1v1.243l-2.336-2.512A2.473 2.473 0 0 0 16 3.5a2.5 2.5 0 0 0-5 0 2.474 2.474 0 0 0 .343 1.243L7.947 9.308 4.955 7.947a2.404 2.404 0 0 0-.161-1.438l3.704-1.385-.44 1.371.942.333L10 4 7.172 3l-.334.943 1.01.357-3.659 1.368a2.498 2.498 0 1 0-.682 4.117l2.085 2.688-2.053 2.76a2.5 2.5 0 1 0 .87 3.864l3.484 1.587-1.055.373.334.943L10 21l-1-2.828-.943.333.435 1.354-3.608-1.645A2.471 2.471 0 0 0 5 17.5a2.5 2.5 0 0 0-.058-.527l3.053-1.405 3.476 4.48a2.498 2.498 0 1 0 4.113.075L18 17.707V19h1v-3h-3v1h1.293l-2.416 2.416a2.466 2.466 0 0 0-2.667-.047l-3.283-4.23 2.554-1.176A2.494 2.494 0 0 0 15.95 13h1.1a3.493 3.493 0 1 0 3.45-4zm-7-7A1.5 1.5 0 1 1 12 3.5 1.502 1.502 0 0 1 13.5 2zm0 18a1.5 1.5 0 1 1-1.5 1.5 1.502 1.502 0 0 1 1.5-1.5zM1 7.5a1.5 1.5 0 1 1 2.457 1.145l-.144.112A1.496 1.496 0 0 1 1 7.5zm3.32 1.703a2.507 2.507 0 0 0 .264-.326l2.752 1.251-1.124 1.512zM2.5 19A1.5 1.5 0 1 1 4 17.5 1.502 1.502 0 0 1 2.5 19zm2.037-2.941a2.518 2.518 0 0 0-.193-.234l1.885-2.532 1.136 1.464zm3.76-1.731L6.849 12.46l1.42-1.908L11.1 11.84a2.29 2.29 0 0 0-.033 1.213zM13.5 14a1.5 1.5 0 1 1 1.5-1.5 1.502 1.502 0 0 1-1.5 1.5zm7 1a2.5 2.5 0 1 1 2.5-2.5 2.502 2.502 0 0 1-2.5 2.5zm1.5-2.5a1.5 1.5 0 1 1-1.5-1.5 1.502 1.502 0 0 1 1.5 1.5z'/><path fill='none' d='M0 0h24v24H0z'/></svg> 深度思考\",\"value\":\"brief\",\"onClick\":\"if(isActive){method.executeCustomMethod('changeModel', true)}else{method.executeCustomMethod('changeModel', false)}\"},{\"label\":\"<svg fill='currentColor' width='12' height='12' viewBox='0 0 24 24'><path d='M19 2H5c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h3.586L12 21.414 15.414 18H19c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zm0 14h-4.414L12 18.586 9.414 16H5V4h14v12z'/></svg> 精简回答\",\"value\":\"brief\",\"onClick\":\"if(isActive){method.setContextData({systemPrompt:'请精简回答,字数控制在150个字左右, 思考过程请简洁简短',mergedText:method.getContextData().mergedText,analyzeMetrics:method.getContextData().analyzeMetrics});}else{method.setContextData({mergedText:method.getContextData().mergedText,analyzeMetrics:method.getContextData().analyzeMetrics});}\"},{\"label\":\"<svg fill='none' width='12' height='12' viewBox='0 0 16 16'><path d='M7 0.0618896V9H15.9381C15.446 12.9463 12.0796 16 8 16C3.58172 16 0 12.4183 0 8C0 3.92038 3.05369 0.553988 7 0.0618896Z' fill='currentColor'/><path d='M9 0.0618897V7H15.9381C15.4869 3.38128 12.6187 0.513137 9 0.0618897Z' fill='currentColor'/></svg> 指标分析\",\"value\":\"lab\",\"onClick\":\"return method.executeCustomMethod('getLibList')\",\"isSelect\":true,\"dynamicOptions\":true}]";
// ❌ Invalid JSON with missing } or ]
const errorJson001 = "{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': '{chatId}', 'token': '{token}'";
const errorJson002 = "[{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': '{chatId}', 'token': '{token}'}";
// ❌ Invalid JSON with missing quotes
const errorJson003 = "{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': {chatId}', 'token': '{token}'}";
// ❌ Invalid JSON with extra commas
const errorJson004 = `{
"common": { "app_id": "de805836" },
"business": {
"language": "zh_cn",
"domain": "iat",
"accent": "mandarin",
"dwa": "wpgs",
},
"data": { "status": 0 }
}`;
console.log('okJson =>', fixAndParseJSON(okJson)); // Can parse normally success = true
console.log('okJson =>', fixAndParseJSON(okJson2)); // Can parse normally success = true
console.log('badJson =>', fixAndParseJSON(badJson)); // Can parse after fixing success = true
console.log('badJson =>', fixAndParseJSON(badJson2)); // Can parse after fixing success = true
console.log('badJson =>', fixAndParseJSON(badJson3)); // Can parse after fixing success = true
console.log('badJson =>', fixAndParseJSON(badJson4)); // Can parse after fixing success = true
console.log('errorJson =>', fixAndParseJSON(errorJson001)); // {success: false, error: 'Invalid JSON format', details: 'Invalid object: mismatched braces'}
console.log('errorJson =>', fixAndParseJSON(errorJson002)); // {success: false, error: 'Invalid JSON format', details: "Expected property name or '}' in JSON at position 2 (line 1 column 3)"}
console.log('errorJson =>', fixAndParseJSON(errorJson003)); // {success: false, error: 'Invalid JSON format', details: 'Invalid object: mismatched braces'}
console.log('errorJson =>', fixAndParseJSON(errorJson004)); // {success: false, error: 'Invalid JSON format', details: 'Trailing comma detected in object'}
*/
/**
* Fix And Parse JSON (Support for handling complex escape JSON strings)
* @desc recursively fix top-level key/value (recursively handles when encountering top-level values that are objects/arrays)
* @private
*/
// Type definitions
function _fixAndParseJSON(input) {
var MAX_DEPTH = 6;
// 1. Quick attempt
try {
return {
success: true,