- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
143 lines
3.9 KiB
JavaScript
143 lines
3.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
/**
|
|
* Utility for encoding.
|
|
*/
|
|
class XMLEncodeUtility {
|
|
/**
|
|
* Encodes attribute value.
|
|
*
|
|
* @param value Value.
|
|
* @returns Escaped value.
|
|
*/
|
|
static encodeXMLAttributeValue(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return value
|
|
.replace(/&/gu, '&')
|
|
.replace(/"/gu, '"')
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>')
|
|
.replace(/\t/gu, '	')
|
|
.replace(/\n/gu, '
')
|
|
.replace(/\r/gu, '
');
|
|
}
|
|
/**
|
|
* Decodes attribute value.
|
|
*
|
|
* @param value Value.
|
|
* @returns Decoded value.
|
|
*/
|
|
static decodeXMLAttributeValue(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return value
|
|
.replace(/"/gu, '"')
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>')
|
|
.replace(/	/gu, '\t')
|
|
.replace(/
/gu, '\n')
|
|
.replace(/
/gu, '\r')
|
|
.replace(/&/gu, '&');
|
|
}
|
|
/**
|
|
* Encodes attribute value.
|
|
*
|
|
* @param value Value.
|
|
* @returns Escaped value.
|
|
*/
|
|
static encodeHTMLAttributeValue(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return value.replace(/&/gu, '&').replace(/"/gu, '"');
|
|
}
|
|
/**
|
|
* Decodes attribute value.
|
|
*
|
|
* @param value Value.
|
|
* @returns Decoded value.
|
|
*/
|
|
static decodeHTMLAttributeValue(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return value.replace(/"/gu, '"').replace(/&/gu, '&');
|
|
}
|
|
/**
|
|
* Encodes text content.
|
|
*
|
|
* @param text Value.
|
|
* @returns Escaped value.
|
|
*/
|
|
static encodeTextContent(text) {
|
|
if (text === null) {
|
|
return '';
|
|
}
|
|
return text
|
|
.replace(/&/gu, '&')
|
|
.replace(/\xA0/gu, ' ')
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>');
|
|
}
|
|
/**
|
|
* Decodes text content.
|
|
*
|
|
* @param text Value.
|
|
* @returns Decoded value.
|
|
*/
|
|
static decodeTextContent(text) {
|
|
if (text === null) {
|
|
return '';
|
|
}
|
|
return text
|
|
.replace(/ /gu, String.fromCharCode(160))
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>')
|
|
.replace(/&/gu, '&');
|
|
}
|
|
/**
|
|
* Decodes HTML entities.
|
|
*
|
|
* @param value Value.
|
|
* @returns Decoded value.
|
|
*/
|
|
static decodeHTMLEntities(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return value
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>')
|
|
.replace(/ /gu, String.fromCharCode(160))
|
|
.replace(/"/gu, '"')
|
|
.replace(/'/gu, "'")
|
|
.replace(/&#(\d+);/gu, (_match, dec) => String.fromCharCode(parseInt(dec, 10)))
|
|
.replace(/&#x([A-Fa-f\d]+);/gu, (_match, hex) => String.fromCharCode(parseInt(hex, 16)))
|
|
.replace(/&/gu, '&');
|
|
}
|
|
/**
|
|
* Decodes XML entities.
|
|
*
|
|
* @param value Value.
|
|
* @returns Decoded value.
|
|
*/
|
|
static decodeXMLEntities(value) {
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
return (value
|
|
.replace(/</gu, '<')
|
|
.replace(/>/gu, '>')
|
|
// " " Should not be supported in XML.
|
|
.replace(/"/gu, '"')
|
|
.replace(/'/gu, "'")
|
|
.replace(/&#(\d+);/gu, (_match, dec) => String.fromCharCode(parseInt(dec, 10)))
|
|
.replace(/&#x([A-Fa-f\d]+);/gu, (_match, hex) => String.fromCharCode(parseInt(hex, 16)))
|
|
.replace(/&/gu, '&'));
|
|
}
|
|
}
|
|
exports.default = XMLEncodeUtility;
|
|
//# sourceMappingURL=XMLEncodeUtility.cjs.map
|