@memberjunction/templates 2.42.0 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/TemplateEmbed.extension.d.ts +64 -0
- package/dist/extensions/TemplateEmbed.extension.d.ts.map +1 -0
- package/dist/extensions/TemplateEmbed.extension.js +195 -0
- package/dist/extensions/TemplateEmbed.extension.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { UserInfo } from "@memberjunction/core";
|
|
2
|
+
import { NunjucksCallback, TemplateExtensionBase } from "./TemplateExtensionBase";
|
|
3
|
+
type Parser = any;
|
|
4
|
+
type Nodes = any;
|
|
5
|
+
type Lexer = any;
|
|
6
|
+
type Context = any;
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for template embedding
|
|
9
|
+
*/
|
|
10
|
+
export type TemplateEmbedConfig = {
|
|
11
|
+
/**
|
|
12
|
+
* Specific content type to use for the embedded template.
|
|
13
|
+
* If not provided, inherits from current template's content type.
|
|
14
|
+
*/
|
|
15
|
+
type?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional data to merge with or override the current template's data context.
|
|
18
|
+
* This data will be available to the embedded template.
|
|
19
|
+
*/
|
|
20
|
+
data?: any;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Extension that enables recursive template embedding using {% template "TemplateName" %} syntax.
|
|
24
|
+
*
|
|
25
|
+
* Features:
|
|
26
|
+
* - Recursive template inclusion with cycle detection
|
|
27
|
+
* - Content type inheritance with intelligent fallbacks
|
|
28
|
+
* - Data context passing and merging
|
|
29
|
+
* - Error handling for missing templates
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
* {% template "TemplateName" %}
|
|
33
|
+
* {% template "TemplateName", type="HTML" %}
|
|
34
|
+
* {% template "TemplateName", data={extra: "value"} %}
|
|
35
|
+
* {% template "TemplateName", type="PlainText", data={key: "value"} %}
|
|
36
|
+
*/
|
|
37
|
+
export declare class TemplateEmbedExtension extends TemplateExtensionBase {
|
|
38
|
+
constructor(contextUser: UserInfo);
|
|
39
|
+
parse(parser: Parser, nodes: Nodes, lexer: Lexer): any;
|
|
40
|
+
run(context: Context, _body: any, _errorBody: any, params: any[], callBack: NunjucksCallback): void;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves the content type to use for the embedded template.
|
|
43
|
+
* Priority order:
|
|
44
|
+
* 1. Explicit type parameter
|
|
45
|
+
* 2. Current template's content type
|
|
46
|
+
* 3. Highest priority content available in target template
|
|
47
|
+
*/
|
|
48
|
+
private resolveContentType;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the template content for the specified type with fallback logic.
|
|
51
|
+
*/
|
|
52
|
+
private getTemplateContent;
|
|
53
|
+
/**
|
|
54
|
+
* Prepares the data context for the embedded template by merging current context with additional data.
|
|
55
|
+
*/
|
|
56
|
+
private prepareDataContext;
|
|
57
|
+
/**
|
|
58
|
+
* Renders the embedded template content with the provided data context.
|
|
59
|
+
*/
|
|
60
|
+
private renderEmbeddedTemplate;
|
|
61
|
+
}
|
|
62
|
+
export declare function LoadTemplateEmbedExtension(): void;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=TemplateEmbed.extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateEmbed.extension.d.ts","sourceRoot":"","sources":["../../src/extensions/TemplateEmbed.extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAMlF,KAAK,MAAM,GAAG,GAAG,CAAC;AAClB,KAAK,KAAK,GAAG,GAAG,CAAC;AACjB,KAAK,KAAK,GAAG,GAAG,CAAC;AACjB,KAAK,OAAO,GAAG,GAAG,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAiBF;;;;;;;;;;;;;;GAcG;AACH,qBACa,sBAAuB,SAAQ,qBAAqB;gBAEjD,WAAW,EAAE,QAAQ;IAK1B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IAahD,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,gBAAgB;IAwFnG;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;YACW,sBAAsB;CAUvC;AAED,wBAAgB,0BAA0B,SAEzC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LoadTemplateEmbedExtension = exports.TemplateEmbedExtension = void 0;
|
|
13
|
+
const core_1 = require("@memberjunction/core");
|
|
14
|
+
const global_1 = require("@memberjunction/global");
|
|
15
|
+
const TemplateExtensionBase_1 = require("./TemplateExtensionBase");
|
|
16
|
+
const TemplateEngine_1 = require("../TemplateEngine");
|
|
17
|
+
/**
|
|
18
|
+
* Extension that enables recursive template embedding using {% template "TemplateName" %} syntax.
|
|
19
|
+
*
|
|
20
|
+
* Features:
|
|
21
|
+
* - Recursive template inclusion with cycle detection
|
|
22
|
+
* - Content type inheritance with intelligent fallbacks
|
|
23
|
+
* - Data context passing and merging
|
|
24
|
+
* - Error handling for missing templates
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* {% template "TemplateName" %}
|
|
28
|
+
* {% template "TemplateName", type="HTML" %}
|
|
29
|
+
* {% template "TemplateName", data={extra: "value"} %}
|
|
30
|
+
* {% template "TemplateName", type="PlainText", data={key: "value"} %}
|
|
31
|
+
*/
|
|
32
|
+
let TemplateEmbedExtension = class TemplateEmbedExtension extends TemplateExtensionBase_1.TemplateExtensionBase {
|
|
33
|
+
constructor(contextUser) {
|
|
34
|
+
super(contextUser);
|
|
35
|
+
this.tags = ['template'];
|
|
36
|
+
}
|
|
37
|
+
parse(parser, nodes, lexer) {
|
|
38
|
+
// Get the tag token
|
|
39
|
+
const tok = parser.nextToken();
|
|
40
|
+
// Parse the arguments - template name and optional parameters
|
|
41
|
+
const params = parser.parseSignature(null, true);
|
|
42
|
+
parser.advanceAfterBlockEnd(tok.value);
|
|
43
|
+
// Template embedding is a self-closing tag, no body content to parse
|
|
44
|
+
// Return a CallExtensionAsync node with the parsed parameters
|
|
45
|
+
return new nodes.CallExtensionAsync(this, 'run', params, []);
|
|
46
|
+
}
|
|
47
|
+
run(context, _body, _errorBody, params, callBack) {
|
|
48
|
+
try {
|
|
49
|
+
// Extract template name (first parameter)
|
|
50
|
+
if (!params || params.length === 0) {
|
|
51
|
+
throw new Error('Template name is required for template embedding');
|
|
52
|
+
}
|
|
53
|
+
const templateName = params[0];
|
|
54
|
+
if (!templateName || typeof templateName !== 'string') {
|
|
55
|
+
throw new Error('Template name must be a non-empty string');
|
|
56
|
+
}
|
|
57
|
+
// Parse optional configuration parameters
|
|
58
|
+
let config = {};
|
|
59
|
+
if (params.length > 1) {
|
|
60
|
+
// Additional parameters should be key-value pairs
|
|
61
|
+
for (let i = 1; i < params.length; i += 2) {
|
|
62
|
+
if (i + 1 < params.length) {
|
|
63
|
+
const key = params[i];
|
|
64
|
+
const value = params[i + 1];
|
|
65
|
+
config[key] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Get the template engine instance
|
|
70
|
+
const templateEngine = TemplateEngine_1.TemplateEngineServer.Instance;
|
|
71
|
+
// Initialize render context for cycle detection
|
|
72
|
+
let renderContext = context.ctx._mjRenderContext;
|
|
73
|
+
if (!renderContext) {
|
|
74
|
+
renderContext = {
|
|
75
|
+
templateStack: [],
|
|
76
|
+
currentContentType: undefined
|
|
77
|
+
};
|
|
78
|
+
context.ctx._mjRenderContext = renderContext;
|
|
79
|
+
}
|
|
80
|
+
// Check for cycles before proceeding
|
|
81
|
+
if (renderContext.templateStack.includes(templateName)) {
|
|
82
|
+
const cyclePath = [...renderContext.templateStack, templateName].join(' → ');
|
|
83
|
+
throw new Error(`Cycle detected in template embedding: ${cyclePath}`);
|
|
84
|
+
}
|
|
85
|
+
// Find the target template
|
|
86
|
+
const targetTemplate = templateEngine.FindTemplate(templateName);
|
|
87
|
+
if (!targetTemplate) {
|
|
88
|
+
throw new Error(`Template "${templateName}" not found`);
|
|
89
|
+
}
|
|
90
|
+
// Determine the content type to use
|
|
91
|
+
const contentType = this.resolveContentType(config.type, renderContext.currentContentType, targetTemplate);
|
|
92
|
+
const templateContent = this.getTemplateContent(targetTemplate, contentType);
|
|
93
|
+
if (!templateContent) {
|
|
94
|
+
throw new Error(`No suitable content found for template "${templateName}" with type "${contentType}"`);
|
|
95
|
+
}
|
|
96
|
+
// Prepare data context for the embedded template
|
|
97
|
+
const embeddedData = this.prepareDataContext(context.ctx, config.data);
|
|
98
|
+
// Add current template to the stack to prevent cycles
|
|
99
|
+
renderContext.templateStack.push(templateName);
|
|
100
|
+
const originalContentType = renderContext.currentContentType;
|
|
101
|
+
renderContext.currentContentType = templateContent.Type;
|
|
102
|
+
// Render the embedded template asynchronously
|
|
103
|
+
this.renderEmbeddedTemplate(templateEngine, templateContent, embeddedData)
|
|
104
|
+
.then((result) => {
|
|
105
|
+
// Remove template from stack after successful rendering
|
|
106
|
+
renderContext.templateStack.pop();
|
|
107
|
+
renderContext.currentContentType = originalContentType;
|
|
108
|
+
callBack(null, result);
|
|
109
|
+
})
|
|
110
|
+
.catch((error) => {
|
|
111
|
+
// Remove template from stack on error as well
|
|
112
|
+
renderContext.templateStack.pop();
|
|
113
|
+
renderContext.currentContentType = originalContentType;
|
|
114
|
+
(0, core_1.LogError)(error);
|
|
115
|
+
callBack(error);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
(0, core_1.LogError)(error);
|
|
120
|
+
callBack(error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolves the content type to use for the embedded template.
|
|
125
|
+
* Priority order:
|
|
126
|
+
* 1. Explicit type parameter
|
|
127
|
+
* 2. Current template's content type
|
|
128
|
+
* 3. Highest priority content available in target template
|
|
129
|
+
*/
|
|
130
|
+
resolveContentType(explicitType, currentType, targetTemplate) {
|
|
131
|
+
// 1. Use explicit type if provided
|
|
132
|
+
if (explicitType) {
|
|
133
|
+
return explicitType;
|
|
134
|
+
}
|
|
135
|
+
// 2. Use current content type if available
|
|
136
|
+
if (currentType) {
|
|
137
|
+
const matchingContent = targetTemplate.GetContentByType(currentType);
|
|
138
|
+
if (matchingContent && matchingContent.length > 0) {
|
|
139
|
+
return currentType;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// 3. Fall back to highest priority content
|
|
143
|
+
const highestPriorityContent = targetTemplate.GetHighestPriorityContent();
|
|
144
|
+
if (highestPriorityContent) {
|
|
145
|
+
return highestPriorityContent.Type;
|
|
146
|
+
}
|
|
147
|
+
// This should not happen if template has any content, but provide a fallback
|
|
148
|
+
throw new Error(`No content available for template "${targetTemplate.Name}"`);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Gets the template content for the specified type with fallback logic.
|
|
152
|
+
*/
|
|
153
|
+
getTemplateContent(template, contentType) {
|
|
154
|
+
// Try to get content of the specified type
|
|
155
|
+
const contentByType = template.GetContentByType(contentType);
|
|
156
|
+
if (contentByType && contentByType.length > 0) {
|
|
157
|
+
// Return highest priority content of this type
|
|
158
|
+
return contentByType.sort((a, b) => b.Priority - a.Priority)[0];
|
|
159
|
+
}
|
|
160
|
+
// Fall back to highest priority content of any type
|
|
161
|
+
return template.GetHighestPriorityContent();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Prepares the data context for the embedded template by merging current context with additional data.
|
|
165
|
+
*/
|
|
166
|
+
prepareDataContext(currentContext, additionalData) {
|
|
167
|
+
if (!additionalData) {
|
|
168
|
+
return currentContext;
|
|
169
|
+
}
|
|
170
|
+
// Create a new context object that merges current context with additional data
|
|
171
|
+
// Additional data takes precedence over current context
|
|
172
|
+
return { ...currentContext, ...additionalData };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Renders the embedded template content with the provided data context.
|
|
176
|
+
*/
|
|
177
|
+
async renderEmbeddedTemplate(templateEngine, templateContent, data) {
|
|
178
|
+
// Use the template engine's simple rendering method which handles Nunjucks environment setup
|
|
179
|
+
const result = await templateEngine.RenderTemplateSimple(templateContent.TemplateText, data);
|
|
180
|
+
if (!result.Success) {
|
|
181
|
+
throw new Error(`Failed to render embedded template: ${result.Message}`);
|
|
182
|
+
}
|
|
183
|
+
return result.Output;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
exports.TemplateEmbedExtension = TemplateEmbedExtension;
|
|
187
|
+
exports.TemplateEmbedExtension = TemplateEmbedExtension = __decorate([
|
|
188
|
+
(0, global_1.RegisterClass)(TemplateExtensionBase_1.TemplateExtensionBase, 'TemplateEmbed'),
|
|
189
|
+
__metadata("design:paramtypes", [core_1.UserInfo])
|
|
190
|
+
], TemplateEmbedExtension);
|
|
191
|
+
function LoadTemplateEmbedExtension() {
|
|
192
|
+
// This function ensures the extension class isn't tree-shaken
|
|
193
|
+
}
|
|
194
|
+
exports.LoadTemplateEmbedExtension = LoadTemplateEmbedExtension;
|
|
195
|
+
//# sourceMappingURL=TemplateEmbed.extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateEmbed.extension.js","sourceRoot":"","sources":["../../src/extensions/TemplateEmbed.extension.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA0D;AAC1D,mDAAuD;AACvD,mEAAkF;AAGlF,sDAAyD;AAuCzD;;;;;;;;;;;;;;GAcG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,6CAAqB;IAE7D,YAAY,WAAqB;QAC7B,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,MAAc,EAAE,KAAY,EAAE,KAAY;QACnD,oBAAoB;QACpB,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAE/B,8DAA8D;QAC9D,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEvC,qEAAqE;QACrE,8DAA8D;QAC9D,OAAO,IAAI,KAAK,CAAC,kBAAkB,C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AAC,6CAAqB,EAAE,eAAe,CAAC;qCAGzB,eAAQ;GAFxB,sBAAsB,CAoLlC;AAED,SAAgB,0BAA0B;IACtC,8DAA8D;AAClE,CAAC;AAFD,gEAEC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const ai_groq_1 = require("@memberjunction/ai-groq");
|
|
18
18
|
(0, ai_groq_1.LoadGroqLLM)(); // make sure it doesnt get tree shaken out, we need Groq
|
|
19
|
+
const TemplateEmbed_extension_1 = require("./extensions/TemplateEmbed.extension");
|
|
20
|
+
(0, TemplateEmbed_extension_1.LoadTemplateEmbedExtension)(); // make sure it doesnt get tree shaken out, we need template embedding
|
|
19
21
|
__exportStar(require("./TemplateEngine"), exports);
|
|
20
22
|
__exportStar(require("./extensions/AIPrompt.extension"), exports);
|
|
23
|
+
__exportStar(require("./extensions/TemplateEmbed.extension"), exports);
|
|
21
24
|
__exportStar(require("./extensions/TemplateExtensionBase"), exports);
|
|
22
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAsD;AACtD,IAAA,qBAAW,GAAE,CAAC,CAAC,wDAAwD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAsD;AACtD,IAAA,qBAAW,GAAE,CAAC,CAAC,wDAAwD;AAEvE,kFAAkF;AAClF,IAAA,oDAA0B,GAAE,CAAC,CAAC,sEAAsE;AAEpG,mDAAiC;AACjC,kEAAgD;AAChD,uEAAqD;AACrD,qEAAmD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/templates",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.0",
|
|
4
4
|
"description": "MemberJunction Templating Engine and Utilities - Used for any application that requires templating utility functionality. NOTE: this package does use Angular Universal for compilation but is not marked with the usual ng prefix because it is a server-side library and not used within Angular apps.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"typescript": "^5.4.5"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@memberjunction/core": "2.
|
|
22
|
-
"@memberjunction/templates-base-types": "2.
|
|
23
|
-
"@memberjunction/ai": "2.
|
|
24
|
-
"@memberjunction/aiengine": "2.
|
|
25
|
-
"@memberjunction/ai-groq": "2.
|
|
26
|
-
"@memberjunction/core-entities": "2.
|
|
27
|
-
"@memberjunction/global": "2.
|
|
21
|
+
"@memberjunction/core": "2.43.0",
|
|
22
|
+
"@memberjunction/templates-base-types": "2.43.0",
|
|
23
|
+
"@memberjunction/ai": "2.43.0",
|
|
24
|
+
"@memberjunction/aiengine": "2.43.0",
|
|
25
|
+
"@memberjunction/ai-groq": "2.43.0",
|
|
26
|
+
"@memberjunction/core-entities": "2.43.0",
|
|
27
|
+
"@memberjunction/global": "2.43.0",
|
|
28
28
|
"nunjucks": "3.2.4"
|
|
29
29
|
}
|
|
30
30
|
}
|