@absolutejs/absolute 0.19.0-beta.354 → 0.19.0-beta.356

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.
@@ -78,1697 +78,918 @@ var __legacyMetadataTS = (k, v) => {
78
78
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
79
79
  var __require = import.meta.require;
80
80
 
81
- // src/utils/escapeScriptContent.ts
82
- var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
83
- const escaped = ESCAPE_LOOKUP[char];
84
- return escaped !== undefined ? escaped : char;
85
- });
86
- var init_escapeScriptContent = __esm(() => {
87
- ESCAPE_LOOKUP = {
88
- "\u2028": "\\u2028",
89
- "\u2029": "\\u2029",
90
- "&": "\\u0026",
91
- "<": "\\u003C",
92
- ">": "\\u003E"
93
- };
94
- ESCAPE_REGEX = /[&><\u2028\u2029]/g;
95
- });
96
-
97
- // src/constants.ts
98
- var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000;
99
- var init_constants = __esm(() => {
100
- MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
101
- MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
102
- TWO_THIRDS = 2 / 3;
81
+ // node_modules/@angular/compiler/fesm2022/compiler.mjs
82
+ var exports_compiler = {};
83
+ __export(exports_compiler, {
84
+ visitAll: () => visitAll,
85
+ verifyHostBindings: () => verifyHostBindings,
86
+ tmplAstVisitAll: () => visitAll$1,
87
+ splitNsName: () => splitNsName,
88
+ setEnableTemplateSourceLocations: () => setEnableTemplateSourceLocations,
89
+ sanitizeIdentifier: () => sanitizeIdentifier,
90
+ r3JitTypeSourceSpan: () => r3JitTypeSourceSpan,
91
+ publishFacade: () => publishFacade,
92
+ preserveWhitespacesDefault: () => preserveWhitespacesDefault,
93
+ parseTemplate: () => parseTemplate,
94
+ parseHostBindings: () => parseHostBindings,
95
+ outputAst: () => output_ast,
96
+ mergeNsAndName: () => mergeNsAndName,
97
+ makeBindingParser: () => makeBindingParser,
98
+ literalMap: () => literalMap,
99
+ literal: () => literal,
100
+ leadingComment: () => leadingComment,
101
+ jsDocComment: () => jsDocComment,
102
+ isNgTemplate: () => isNgTemplate,
103
+ isNgContent: () => isNgContent,
104
+ isNgContainer: () => isNgContainer,
105
+ identifierName: () => identifierName,
106
+ getSafePropertyAccessString: () => getSafePropertyAccessString,
107
+ getNsPrefix: () => getNsPrefix,
108
+ getHtmlTagDefinition: () => getHtmlTagDefinition,
109
+ findMatchingDirectivesAndPipes: () => findMatchingDirectivesAndPipes,
110
+ escapeRegExp: () => escapeRegExp,
111
+ encapsulateStyle: () => encapsulateStyle,
112
+ emitDistinctChangesOnlyDefaultValue: () => emitDistinctChangesOnlyDefaultValue,
113
+ devOnlyGuardedExpression: () => devOnlyGuardedExpression,
114
+ createMayBeForwardRefExpression: () => createMayBeForwardRefExpression,
115
+ createInjectableType: () => createInjectableType,
116
+ createCssSelectorFromNode: () => createCssSelectorFromNode,
117
+ core: () => core,
118
+ computeMsgId: () => computeMsgId,
119
+ compilePipeFromMetadata: () => compilePipeFromMetadata,
120
+ compileOpaqueAsyncClassMetadata: () => compileOpaqueAsyncClassMetadata,
121
+ compileNgModule: () => compileNgModule,
122
+ compileInjector: () => compileInjector,
123
+ compileInjectable: () => compileInjectable,
124
+ compileHmrUpdateCallback: () => compileHmrUpdateCallback,
125
+ compileHmrInitializer: () => compileHmrInitializer,
126
+ compileFactoryFunction: () => compileFactoryFunction,
127
+ compileDirectiveFromMetadata: () => compileDirectiveFromMetadata,
128
+ compileDeferResolverFunction: () => compileDeferResolverFunction,
129
+ compileDeclarePipeFromMetadata: () => compileDeclarePipeFromMetadata,
130
+ compileDeclareNgModuleFromMetadata: () => compileDeclareNgModuleFromMetadata,
131
+ compileDeclareInjectorFromMetadata: () => compileDeclareInjectorFromMetadata,
132
+ compileDeclareInjectableFromMetadata: () => compileDeclareInjectableFromMetadata,
133
+ compileDeclareFactoryFunction: () => compileDeclareFactoryFunction,
134
+ compileDeclareDirectiveFromMetadata: () => compileDeclareDirectiveFromMetadata,
135
+ compileDeclareComponentFromMetadata: () => compileDeclareComponentFromMetadata,
136
+ compileDeclareClassMetadata: () => compileDeclareClassMetadata,
137
+ compileComponentFromMetadata: () => compileComponentFromMetadata,
138
+ compileComponentDeclareClassMetadata: () => compileComponentDeclareClassMetadata,
139
+ compileComponentClassMetadata: () => compileComponentClassMetadata,
140
+ compileClassMetadata: () => compileClassMetadata,
141
+ compileClassDebugInfo: () => compileClassDebugInfo,
142
+ _ATTR_TO_PROP: () => _ATTR_TO_PROP,
143
+ Xtb: () => Xtb,
144
+ XmlParser: () => XmlParser,
145
+ Xmb: () => Xmb,
146
+ Xliff2: () => Xliff2,
147
+ Xliff: () => Xliff,
148
+ WrappedNodeExpr: () => WrappedNodeExpr,
149
+ VoidExpression: () => VoidExpression,
150
+ VoidExpr: () => VoidExpr,
151
+ ViewEncapsulation: () => ViewEncapsulation$1,
152
+ Version: () => Version,
153
+ VariableBinding: () => VariableBinding,
154
+ VERSION: () => VERSION,
155
+ UnaryOperatorExpr: () => UnaryOperatorExpr,
156
+ UnaryOperator: () => UnaryOperator,
157
+ Unary: () => Unary,
158
+ TypeofExpression: () => TypeofExpression,
159
+ TypeofExpr: () => TypeofExpr,
160
+ TypeModifier: () => TypeModifier,
161
+ Type: () => Type,
162
+ TreeError: () => TreeError,
163
+ TransplantedType: () => TransplantedType,
164
+ TokenType: () => TokenType,
165
+ Token: () => Token,
166
+ TmplAstViewportDeferredTrigger: () => ViewportDeferredTrigger,
167
+ TmplAstVariable: () => Variable,
168
+ TmplAstUnknownBlock: () => UnknownBlock,
169
+ TmplAstTimerDeferredTrigger: () => TimerDeferredTrigger,
170
+ TmplAstTextAttribute: () => TextAttribute,
171
+ TmplAstText: () => Text$3,
172
+ TmplAstTemplate: () => Template,
173
+ TmplAstSwitchExhaustiveCheck: () => SwitchExhaustiveCheck,
174
+ TmplAstSwitchBlockCaseGroup: () => SwitchBlockCaseGroup,
175
+ TmplAstSwitchBlockCase: () => SwitchBlockCase,
176
+ TmplAstSwitchBlock: () => SwitchBlock,
177
+ TmplAstReference: () => Reference,
178
+ TmplAstRecursiveVisitor: () => RecursiveVisitor$1,
179
+ TmplAstNeverDeferredTrigger: () => NeverDeferredTrigger,
180
+ TmplAstLetDeclaration: () => LetDeclaration$1,
181
+ TmplAstInteractionDeferredTrigger: () => InteractionDeferredTrigger,
182
+ TmplAstImmediateDeferredTrigger: () => ImmediateDeferredTrigger,
183
+ TmplAstIfBlockBranch: () => IfBlockBranch,
184
+ TmplAstIfBlock: () => IfBlock,
185
+ TmplAstIdleDeferredTrigger: () => IdleDeferredTrigger,
186
+ TmplAstIcu: () => Icu$1,
187
+ TmplAstHoverDeferredTrigger: () => HoverDeferredTrigger,
188
+ TmplAstHostElement: () => HostElement,
189
+ TmplAstForLoopBlockEmpty: () => ForLoopBlockEmpty,
190
+ TmplAstForLoopBlock: () => ForLoopBlock,
191
+ TmplAstElement: () => Element$1,
192
+ TmplAstDirective: () => Directive$1,
193
+ TmplAstDeferredTrigger: () => DeferredTrigger,
194
+ TmplAstDeferredBlockPlaceholder: () => DeferredBlockPlaceholder,
195
+ TmplAstDeferredBlockLoading: () => DeferredBlockLoading,
196
+ TmplAstDeferredBlockError: () => DeferredBlockError,
197
+ TmplAstDeferredBlock: () => DeferredBlock,
198
+ TmplAstContent: () => Content,
199
+ TmplAstComponent: () => Component$1,
200
+ TmplAstBoundText: () => BoundText,
201
+ TmplAstBoundEvent: () => BoundEvent,
202
+ TmplAstBoundDeferredTrigger: () => BoundDeferredTrigger,
203
+ TmplAstBoundAttribute: () => BoundAttribute,
204
+ TmplAstBlockNode: () => BlockNode,
205
+ ThisReceiver: () => ThisReceiver,
206
+ Text: () => Text4,
207
+ TemplateLiteralExpr: () => TemplateLiteralExpr,
208
+ TemplateLiteralElementExpr: () => TemplateLiteralElementExpr,
209
+ TemplateLiteralElement: () => TemplateLiteralElement,
210
+ TemplateLiteral: () => TemplateLiteral,
211
+ TemplateBindingParseResult: () => TemplateBindingParseResult,
212
+ TaggedTemplateLiteralExpr: () => TaggedTemplateLiteralExpr,
213
+ TaggedTemplateLiteral: () => TaggedTemplateLiteral,
214
+ TagContentType: () => TagContentType,
215
+ StringTokenKind: () => StringTokenKind,
216
+ StringToken: () => StringToken,
217
+ StmtModifier: () => StmtModifier,
218
+ Statement: () => Statement,
219
+ SpreadElementExpr: () => SpreadElementExpr,
220
+ SpreadElement: () => SpreadElement,
221
+ SplitInterpolation: () => SplitInterpolation,
222
+ Serializer: () => Serializer,
223
+ SelectorlessMatcher: () => SelectorlessMatcher,
224
+ SelectorMatcher: () => SelectorMatcher,
225
+ SelectorListContext: () => SelectorListContext,
226
+ SelectorContext: () => SelectorContext,
227
+ SafePropertyRead: () => SafePropertyRead,
228
+ SafeKeyedRead: () => SafeKeyedRead,
229
+ SafeCall: () => SafeCall,
230
+ STRING_TYPE: () => STRING_TYPE,
231
+ SECURITY_SCHEMA: () => SECURITY_SCHEMA,
232
+ SCHEMA: () => SCHEMA,
233
+ ReturnStatement: () => ReturnStatement,
234
+ ResourceLoader: () => ResourceLoader,
235
+ RegularExpressionLiteralExpr: () => RegularExpressionLiteralExpr,
236
+ RegularExpressionLiteral: () => RegularExpressionLiteral,
237
+ RecursiveVisitor: () => RecursiveVisitor2,
238
+ RecursiveAstVisitor: () => RecursiveAstVisitor2,
239
+ ReadVarExpr: () => ReadVarExpr,
240
+ ReadPropExpr: () => ReadPropExpr,
241
+ ReadKeyExpr: () => ReadKeyExpr,
242
+ R3TemplateDependencyKind: () => R3TemplateDependencyKind,
243
+ R3TargetBinder: () => R3TargetBinder,
244
+ R3SelectorScopeMode: () => R3SelectorScopeMode,
245
+ R3NgModuleMetadataKind: () => R3NgModuleMetadataKind,
246
+ R3Identifiers: () => Identifiers,
247
+ PropertyRead: () => PropertyRead,
248
+ PrefixNot: () => PrefixNot,
249
+ Parser: () => Parser2,
250
+ ParsedVariable: () => ParsedVariable,
251
+ ParsedPropertyType: () => ParsedPropertyType,
252
+ ParsedProperty: () => ParsedProperty,
253
+ ParsedEventType: () => ParsedEventType,
254
+ ParsedEvent: () => ParsedEvent,
255
+ ParseTreeResult: () => ParseTreeResult,
256
+ ParseSpan: () => ParseSpan,
257
+ ParseSourceSpan: () => ParseSourceSpan,
258
+ ParseSourceFile: () => ParseSourceFile,
259
+ ParseLocation: () => ParseLocation,
260
+ ParseErrorLevel: () => ParseErrorLevel,
261
+ ParseError: () => ParseError,
262
+ ParenthesizedExpression: () => ParenthesizedExpression,
263
+ ParenthesizedExpr: () => ParenthesizedExpr,
264
+ NotExpr: () => NotExpr,
265
+ NonNullAssert: () => NonNullAssert,
266
+ NodeWithI18n: () => NodeWithI18n,
267
+ NO_ERRORS_SCHEMA: () => NO_ERRORS_SCHEMA,
268
+ NONE_TYPE: () => NONE_TYPE,
269
+ MessageBundle: () => MessageBundle,
270
+ MapType: () => MapType,
271
+ LocalizedString: () => LocalizedString,
272
+ LiteralPrimitive: () => LiteralPrimitive,
273
+ LiteralMapSpreadAssignment: () => LiteralMapSpreadAssignment,
274
+ LiteralMapPropertyAssignment: () => LiteralMapPropertyAssignment,
275
+ LiteralMapExpr: () => LiteralMapExpr,
276
+ LiteralMap: () => LiteralMap,
277
+ LiteralExpr: () => LiteralExpr,
278
+ LiteralArrayExpr: () => LiteralArrayExpr,
279
+ LiteralArray: () => LiteralArray,
280
+ Lexer: () => Lexer,
281
+ LetDeclaration: () => LetDeclaration2,
282
+ LeadingComment: () => LeadingComment,
283
+ KeyedRead: () => KeyedRead,
284
+ JitEvaluator: () => JitEvaluator,
285
+ JSDocComment: () => JSDocComment,
286
+ InvokeFunctionExpr: () => InvokeFunctionExpr,
287
+ Interpolation: () => Interpolation$1,
288
+ InstantiateExpr: () => InstantiateExpr,
289
+ ImplicitReceiver: () => ImplicitReceiver,
290
+ IfStmt: () => IfStmt,
291
+ I18NHtmlParser: () => I18NHtmlParser,
292
+ HtmlTagDefinition: () => HtmlTagDefinition,
293
+ HtmlParser: () => HtmlParser,
294
+ FunctionExpr: () => FunctionExpr,
295
+ FactoryTarget: () => FactoryTarget,
296
+ ExternalReference: () => ExternalReference,
297
+ ExternalExpr: () => ExternalExpr,
298
+ ExpressionType: () => ExpressionType,
299
+ ExpressionStatement: () => ExpressionStatement,
300
+ ExpressionBinding: () => ExpressionBinding,
301
+ Expression: () => Expression,
302
+ ExpansionCase: () => ExpansionCase,
303
+ Expansion: () => Expansion,
304
+ EmptyExpr: () => EmptyExpr$1,
305
+ EmitterVisitorContext: () => EmitterVisitorContext,
306
+ ElementSchemaRegistry: () => ElementSchemaRegistry,
307
+ Element: () => Element2,
308
+ EOF: () => EOF,
309
+ DynamicImportExpr: () => DynamicImportExpr,
310
+ DomElementSchemaRegistry: () => DomElementSchemaRegistry,
311
+ Directive: () => Directive2,
312
+ DeclareVarStmt: () => DeclareVarStmt,
313
+ DeclareFunctionStmt: () => DeclareFunctionStmt,
314
+ DYNAMIC_TYPE: () => DYNAMIC_TYPE,
315
+ CssSelector: () => CssSelector,
316
+ ConstantPool: () => ConstantPool,
317
+ ConditionalExpr: () => ConditionalExpr,
318
+ Conditional: () => Conditional,
319
+ Component: () => Component2,
320
+ CompilerFacadeImpl: () => CompilerFacadeImpl,
321
+ CompilerConfig: () => CompilerConfig,
322
+ Comment: () => Comment2,
323
+ CommaExpr: () => CommaExpr,
324
+ CombinedRecursiveAstVisitor: () => CombinedRecursiveAstVisitor,
325
+ ChangeDetectionStrategy: () => ChangeDetectionStrategy,
326
+ Chain: () => Chain,
327
+ Call: () => Call,
328
+ CUSTOM_ELEMENTS_SCHEMA: () => CUSTOM_ELEMENTS_SCHEMA,
329
+ BuiltinTypeName: () => BuiltinTypeName,
330
+ BuiltinType: () => BuiltinType,
331
+ BoundElementProperty: () => BoundElementProperty,
332
+ BlockParameter: () => BlockParameter,
333
+ Block: () => Block,
334
+ BindingType: () => BindingType,
335
+ BindingPipeType: () => BindingPipeType,
336
+ BindingPipe: () => BindingPipe,
337
+ BinaryOperatorExpr: () => BinaryOperatorExpr,
338
+ BinaryOperator: () => BinaryOperator,
339
+ Binary: () => Binary,
340
+ Attribute: () => Attribute,
341
+ ArrowFunctionIdentifierParameter: () => ArrowFunctionIdentifierParameter,
342
+ ArrowFunctionExpr: () => ArrowFunctionExpr$1,
343
+ ArrowFunction: () => ArrowFunction,
344
+ ArrayType: () => ArrayType,
345
+ AbsoluteSourceSpan: () => AbsoluteSourceSpan,
346
+ ASTWithSource: () => ASTWithSource,
347
+ ASTWithName: () => ASTWithName,
348
+ AST: () => AST
103
349
  });
104
350
 
105
- // src/core/islandPageContext.ts
106
- var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG2 = "</head>", buildIslandsHeadMarkup = (manifest) => {
107
- const manifestScript = `<script>window.__ABSOLUTE_MANIFEST__ = ${JSON.stringify(manifest)}</script>`;
108
- const islandStateScript = `<script>window.__ABS_ISLAND_STATE__ = ${JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {})}</script>`;
109
- const bootstrapPath = manifest[BOOTSTRAP_MANIFEST_KEY];
110
- const bootstrapScript = bootstrapPath ? `<script type="module" src="${bootstrapPath}"></script>` : "";
111
- return `${manifestScript}${islandStateScript}${bootstrapScript}`;
112
- }, injectHeadMarkup = (html, markup) => {
113
- const closingHeadIndex = html.indexOf("</head>");
114
- if (closingHeadIndex >= 0) {
115
- return `${html.slice(0, closingHeadIndex)}${markup}${html.slice(closingHeadIndex)}`;
116
- }
117
- const openingBodyIndex = html.indexOf("<body");
118
- if (openingBodyIndex >= 0) {
119
- const bodyStart = html.indexOf(">", openingBodyIndex);
120
- if (bodyStart >= 0) {
121
- return `${html.slice(0, openingBodyIndex)}<head>${markup}</head>${html.slice(openingBodyIndex)}`;
122
- }
123
- }
124
- return `<!DOCTYPE html><html><head>${markup}</head><body>${html}</body></html>`;
125
- }, streamChunkToString2 = (value, decoder) => typeof value === "string" ? value : decoder.decode(value, { stream: true }), pipeStreamWithHeadInjection = (stream, markup) => {
126
- const encoder = new TextEncoder;
127
- const decoder = new TextDecoder;
128
- const lookbehind = CLOSING_HEAD_TAG2.length - 1;
129
- return new ReadableStream({
130
- async start(controller) {
131
- const reader = stream.getReader();
132
- let injected = false;
133
- let pending = "";
134
- try {
135
- for (;; ) {
136
- const { done, value } = await reader.read();
137
- if (done)
138
- break;
139
- if (!value)
140
- continue;
141
- pending += streamChunkToString2(value, decoder);
142
- if (injected) {
143
- controller.enqueue(encoder.encode(pending));
144
- pending = "";
145
- continue;
146
- }
147
- const headIndex = pending.indexOf(CLOSING_HEAD_TAG2);
148
- if (headIndex >= 0) {
149
- const next = `${pending.slice(0, headIndex)}${markup}${pending.slice(headIndex)}`;
150
- controller.enqueue(encoder.encode(next));
151
- pending = "";
152
- injected = true;
153
- continue;
154
- }
155
- if (pending.length > lookbehind) {
156
- const safeText = pending.slice(0, pending.length - lookbehind);
157
- controller.enqueue(encoder.encode(safeText));
158
- pending = pending.slice(-lookbehind);
159
- }
351
+ class CssSelector {
352
+ element = null;
353
+ classNames = [];
354
+ attrs = [];
355
+ notSelectors = [];
356
+ static parse(selector) {
357
+ const results = [];
358
+ const _addResult = (res, cssSel) => {
359
+ if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) {
360
+ cssSel.element = "*";
361
+ }
362
+ res.push(cssSel);
363
+ };
364
+ let cssSelector = new CssSelector;
365
+ let match;
366
+ let current = cssSelector;
367
+ let inNot = false;
368
+ _SELECTOR_REGEXP.lastIndex = 0;
369
+ while (match = _SELECTOR_REGEXP.exec(selector)) {
370
+ if (match[1]) {
371
+ if (inNot) {
372
+ throw new Error("Nesting :not in a selector is not allowed");
160
373
  }
161
- pending += decoder.decode();
162
- if (!injected) {
163
- pending = injectHeadMarkup(pending, markup);
374
+ inNot = true;
375
+ current = new CssSelector;
376
+ cssSelector.notSelectors.push(current);
377
+ }
378
+ const tag = match[2];
379
+ if (tag) {
380
+ const prefix = match[3];
381
+ if (prefix === "#") {
382
+ current.addAttribute("id", tag.slice(1));
383
+ } else if (prefix === ".") {
384
+ current.addClassName(tag.slice(1));
385
+ } else {
386
+ current.setElement(tag);
164
387
  }
165
- if (pending.length > 0) {
166
- controller.enqueue(encoder.encode(pending));
388
+ }
389
+ const attribute = match[4];
390
+ if (attribute) {
391
+ current.addAttribute(current.unescapeAttribute(attribute), match[6]);
392
+ }
393
+ if (match[7]) {
394
+ inNot = false;
395
+ current = cssSelector;
396
+ }
397
+ if (match[8]) {
398
+ if (inNot) {
399
+ throw new Error("Multiple selectors in :not are not supported");
167
400
  }
168
- controller.close();
169
- } catch (error) {
170
- controller.error(error);
401
+ _addResult(results, cssSelector);
402
+ cssSelector = current = new CssSelector;
171
403
  }
172
404
  }
173
- });
174
- }, pipeStreamWithIslandMarkerDetection = (stream, markup) => {
175
- const encoder = new TextEncoder;
176
- const decoder = new TextDecoder;
177
- const lookbehind = Math.max(ISLAND_MARKER.length, 1024);
178
- return new ReadableStream({
179
- async start(controller) {
180
- const reader = stream.getReader();
181
- let injected = false;
182
- let pending = "";
183
- try {
184
- for (;; ) {
185
- const { done, value } = await reader.read();
186
- if (done)
187
- break;
188
- if (!value)
189
- continue;
190
- pending += streamChunkToString2(value, decoder);
191
- if (injected) {
192
- controller.enqueue(encoder.encode(pending));
193
- pending = "";
194
- continue;
195
- }
196
- const markerIndex = pending.indexOf(ISLAND_MARKER);
197
- if (markerIndex >= 0) {
198
- const tagStart = pending.lastIndexOf("<", markerIndex);
199
- const injectAt = tagStart >= 0 ? tagStart : markerIndex;
200
- const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
201
- controller.enqueue(encoder.encode(next));
202
- pending = "";
203
- injected = true;
204
- continue;
205
- }
206
- if (pending.length > lookbehind) {
207
- const safeText = pending.slice(0, pending.length - lookbehind);
208
- controller.enqueue(encoder.encode(safeText));
209
- pending = pending.slice(-lookbehind);
210
- }
211
- }
212
- pending += decoder.decode();
213
- if (pending.length > 0) {
214
- controller.enqueue(encoder.encode(pending));
215
- }
216
- controller.close();
217
- } catch (error) {
218
- controller.error(error);
405
+ _addResult(results, cssSelector);
406
+ return results;
407
+ }
408
+ unescapeAttribute(attr) {
409
+ let result = "";
410
+ let escaping = false;
411
+ for (let i = 0;i < attr.length; i++) {
412
+ const char = attr.charAt(i);
413
+ if (char === "\\") {
414
+ escaping = true;
415
+ continue;
416
+ }
417
+ if (char === "$" && !escaping) {
418
+ throw new Error(`Error in attribute selector "${attr}". ` + `Unescaped "$" is not supported. Please escape with "\\$".`);
219
419
  }
420
+ escaping = false;
421
+ result += char;
220
422
  }
221
- });
222
- }, htmlContainsIslands = (html) => html.includes(ISLAND_MARKER), injectIslandPageContext = (html, options) => {
223
- const manifest = globalThis.__absoluteManifest;
224
- const hasIslands = options?.hasIslands ?? htmlContainsIslands(html);
225
- if (!manifest || !hasIslands) {
226
- return html;
423
+ return result;
227
424
  }
228
- if (html.includes(MANIFEST_MARKER) || html.includes(ISLAND_STATE_MARKER)) {
229
- return html;
425
+ escapeAttribute(attr) {
426
+ return attr.replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
230
427
  }
231
- return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
232
- }, injectIslandPageContextStream = (stream, options) => {
233
- const manifest = globalThis.__absoluteManifest;
234
- if (!manifest)
235
- return stream;
236
- const markup = buildIslandsHeadMarkup(manifest);
237
- if (options?.hasIslands === true) {
238
- return pipeStreamWithHeadInjection(stream, markup);
428
+ isElementSelector() {
429
+ return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0;
239
430
  }
240
- if (options?.hasIslands === false) {
241
- return stream;
431
+ hasElementSelector() {
432
+ return !!this.element;
242
433
  }
243
- return pipeStreamWithIslandMarkerDetection(stream, markup);
244
- }, setCurrentIslandManifest = (manifest) => {
245
- globalThis.__absoluteManifest = manifest;
246
- };
247
-
248
- // src/utils/ssrErrorPage.ts
249
- var ssrErrorPage = (framework, error) => {
250
- const frameworkColors = {
251
- angular: "#dd0031",
252
- html: "#e34c26",
253
- htmx: "#1a365d",
254
- react: "#61dafb",
255
- svelte: "#ff3e00",
256
- vue: "#42b883"
257
- };
258
- const accent = frameworkColors[framework] ?? "#94a3b8";
259
- const label = framework.charAt(0).toUpperCase() + framework.slice(1);
260
- const message = error instanceof Error ? error.message : String(error);
261
- return `<!DOCTYPE html>
262
- <html>
263
- <head>
264
- <meta charset="utf-8">
265
- <meta name="viewport" content="width=device-width, initial-scale=1">
266
- <title>SSR Error - AbsoluteJS</title>
267
- <style>
268
- *{margin:0;padding:0;box-sizing:border-box}
269
- body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}
270
- .card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}
271
- .header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}
272
- .brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
273
- .badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}
274
- .kind{color:#94a3b8;font-size:13px;font-weight:500}
275
- .content{padding:24px}
276
- .label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
277
- .message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}
278
- .hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}
279
- </style>
280
- </head>
281
- <body>
282
- <div class="card">
283
- <div class="header">
284
- <div style="display:flex;align-items:center;gap:12px">
285
- <span class="brand">AbsoluteJS</span>
286
- <span class="badge">${label}</span>
287
- </div>
288
- <span class="kind">Server Render Error</span>
289
- </div>
290
- <div class="content">
291
- <div class="label">What went wrong</div>
292
- <pre class="message">${message.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</pre>
293
- <div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
294
- </div>
295
- </div>
296
- </body>
297
- </html>`;
298
- };
299
-
300
- // src/utils/stringModifiers.ts
301
- var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
302
- if (!str.includes("-") && !str.includes("_")) {
303
- return str.charAt(0).toUpperCase() + str.slice(1);
434
+ setElement(element = null) {
435
+ this.element = element;
304
436
  }
305
- return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
306
- }, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
307
-
308
- // src/utils/resolveConvention.ts
309
- import { basename } from "path";
310
- var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
311
- const value = Reflect.get(globalThis, CONVENTIONS_KEY);
312
- if (isConventionsMap(value))
313
- return value;
314
- const empty = {};
315
- return empty;
316
- }, derivePageName = (pagePath) => {
317
- const base = basename(pagePath);
318
- const dotIndex = base.indexOf(".");
319
- const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
320
- return toPascal(name);
321
- }, resolveErrorConventionPath = (framework, pageName) => {
322
- const conventions = getMap()[framework];
323
- if (!conventions)
324
- return;
325
- return conventions.pages?.[pageName]?.error ?? conventions.defaults?.error;
326
- }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map) => {
327
- Reflect.set(globalThis, CONVENTIONS_KEY, map);
328
- }, isDev = () => true, buildErrorProps = (error) => {
329
- const message = error instanceof Error ? error.message : String(error);
330
- const stack = isDev() && error instanceof Error ? error.stack : undefined;
331
- return { error: { message, stack } };
332
- }, renderReactError = async (conventionPath, errorProps) => {
333
- const { createElement } = await import("react");
334
- const { renderToReadableStream } = await import("react-dom/server");
335
- const mod = await import(conventionPath);
336
- const [firstKey] = Object.keys(mod);
337
- const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
338
- const element = createElement(ErrorComponent, errorProps);
339
- const stream = await renderToReadableStream(element);
340
- return new Response(stream, {
341
- headers: { "Content-Type": "text/html" },
342
- status: 500
343
- });
344
- }, renderSvelteError = async (conventionPath, errorProps) => {
345
- const { render } = await import("svelte/server");
346
- const mod = await import(conventionPath);
347
- const ErrorComponent = mod.default;
348
- const { head, body } = render(ErrorComponent, {
349
- props: errorProps
350
- });
351
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
352
- return new Response(html, {
353
- headers: { "Content-Type": "text/html" },
354
- status: 500
355
- });
356
- }, unescapeVueStyles = (ssrBody) => {
357
- let styles = "";
358
- const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
359
- styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
360
- return "";
361
- });
362
- return { body, styles };
363
- }, renderVueError = async (conventionPath, errorProps) => {
364
- const { createSSRApp, h } = await import("vue");
365
- const { renderToString } = await import("vue/server-renderer");
366
- const mod = await import(conventionPath);
367
- const ErrorComponent = mod.default;
368
- const app = createSSRApp({
369
- render: () => h(ErrorComponent, errorProps)
370
- });
371
- const rawBody = await renderToString(app);
372
- const { styles, body } = unescapeVueStyles(rawBody);
373
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
374
- return new Response(html, {
375
- headers: { "Content-Type": "text/html" },
376
- status: 500
377
- });
378
- }, renderAngularError = async (conventionPath, errorProps) => {
379
- const mod = await import(conventionPath);
380
- const renderError = mod.default ?? mod.renderError;
381
- if (typeof renderError !== "function")
382
- return null;
383
- const html = renderError(errorProps);
384
- return new Response(html, {
385
- headers: { "Content-Type": "text/html" },
386
- status: 500
387
- });
388
- }, logConventionRenderError = (framework, label, renderError) => {
389
- const message = renderError instanceof Error ? renderError.message : "";
390
- if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
391
- console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
392
- return;
437
+ getAttrs() {
438
+ const result = [];
439
+ if (this.classNames.length > 0) {
440
+ result.push("class", this.classNames.join(" "));
441
+ }
442
+ return result.concat(this.attrs);
393
443
  }
394
- console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
395
- }, ERROR_RENDERERS, renderConventionError = async (framework, pageName, error) => {
396
- const conventionPath = resolveErrorConventionPath(framework, pageName);
397
- if (!conventionPath)
398
- return null;
399
- const errorProps = buildErrorProps(error);
400
- const renderer = ERROR_RENDERERS[framework];
401
- if (!renderer)
402
- return null;
403
- try {
404
- return await renderer(conventionPath, errorProps);
405
- } catch (renderError) {
406
- logConventionRenderError(framework, "error", renderError);
444
+ addAttribute(name, value = "") {
445
+ this.attrs.push(name, value && value.toLowerCase() || "");
407
446
  }
408
- return null;
409
- }, renderReactNotFound = async (conventionPath) => {
410
- const { createElement } = await import("react");
411
- const { renderToReadableStream } = await import("react-dom/server");
412
- const mod = await import(conventionPath);
413
- const [nfKey] = Object.keys(mod);
414
- const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
415
- const element = createElement(NotFoundComponent);
416
- const stream = await renderToReadableStream(element);
417
- return new Response(stream, {
418
- headers: { "Content-Type": "text/html" },
419
- status: 404
420
- });
421
- }, renderSvelteNotFound = async (conventionPath) => {
422
- const { render } = await import("svelte/server");
423
- const mod = await import(conventionPath);
424
- const NotFoundComponent = mod.default;
425
- const { head, body } = render(NotFoundComponent);
426
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
427
- return new Response(html, {
428
- headers: { "Content-Type": "text/html" },
429
- status: 404
430
- });
431
- }, renderVueNotFound = async (conventionPath) => {
432
- const { createSSRApp, h } = await import("vue");
433
- const { renderToString } = await import("vue/server-renderer");
434
- const mod = await import(conventionPath);
435
- const NotFoundComponent = mod.default;
436
- const app = createSSRApp({
437
- render: () => h(NotFoundComponent)
438
- });
439
- const rawBody = await renderToString(app);
440
- const { styles, body } = unescapeVueStyles(rawBody);
441
- const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
442
- return new Response(html, {
443
- headers: { "Content-Type": "text/html" },
444
- status: 404
445
- });
446
- }, renderAngularNotFound = async (conventionPath) => {
447
- const mod = await import(conventionPath);
448
- const renderNotFound = mod.default ?? mod.renderNotFound;
449
- if (typeof renderNotFound !== "function")
450
- return null;
451
- const html = renderNotFound();
452
- return new Response(html, {
453
- headers: { "Content-Type": "text/html" },
454
- status: 404
455
- });
456
- }, NOT_FOUND_RENDERERS, renderConventionNotFound = async (framework) => {
457
- const conventionPath = resolveNotFoundConventionPath(framework);
458
- if (!conventionPath)
459
- return null;
460
- const renderer = NOT_FOUND_RENDERERS[framework];
461
- if (!renderer)
462
- return null;
463
- try {
464
- return await renderer(conventionPath);
465
- } catch (renderError) {
466
- logConventionRenderError(framework, "not-found", renderError);
447
+ addClassName(name) {
448
+ this.classNames.push(name.toLowerCase());
467
449
  }
468
- return null;
469
- }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
470
- for (const framework of NOT_FOUND_PRIORITY) {
471
- if (!getMap()[framework]?.defaults?.notFound)
472
- continue;
473
- const response = await renderConventionNotFound(framework);
474
- if (response)
475
- return response;
450
+ toString() {
451
+ let res = this.element || "";
452
+ if (this.classNames) {
453
+ this.classNames.forEach((klass) => res += `.${klass}`);
454
+ }
455
+ if (this.attrs) {
456
+ for (let i = 0;i < this.attrs.length; i += 2) {
457
+ const name = this.escapeAttribute(this.attrs[i]);
458
+ const value = this.attrs[i + 1];
459
+ res += `[${name}${value ? "=" + value : ""}]`;
460
+ }
461
+ }
462
+ this.notSelectors.forEach((notSelector) => res += `:not(${notSelector})`);
463
+ return res;
476
464
  }
477
- return null;
478
- };
479
- var init_resolveConvention = __esm(() => {
480
- ERROR_RENDERERS = {
481
- angular: renderAngularError,
482
- react: renderReactError,
483
- svelte: renderSvelteError,
484
- vue: renderVueError
485
- };
486
- NOT_FOUND_RENDERERS = {
487
- angular: renderAngularNotFound,
488
- react: renderReactNotFound,
489
- svelte: renderSvelteNotFound,
490
- vue: renderVueNotFound
491
- };
492
- NOT_FOUND_PRIORITY = [
493
- "react",
494
- "svelte",
495
- "vue",
496
- "angular"
497
- ];
498
- });
465
+ }
499
466
 
500
- // src/utils/registerClientScript.ts
501
- var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
502
- const id = requestId || getSsrContextId() || getRequestId();
503
- if (!scriptRegistry.has(id)) {
504
- scriptRegistry.set(id, new Set);
467
+ class SelectorMatcher {
468
+ static createNotMatcher(notSelectors) {
469
+ const notMatcher = new SelectorMatcher;
470
+ notMatcher.addSelectables(notSelectors, null);
471
+ return notMatcher;
505
472
  }
506
- scriptRegistry.get(id)?.add(script);
507
- return id;
508
- }, setSsrContextGetter = (getter) => {
509
- ssrContextGetter = getter;
510
- }, clearAllClientScripts = () => {
511
- scriptRegistry.clear();
512
- }, generateClientScriptCode = (scripts) => {
513
- if (scripts.length === 0) {
514
- return "";
473
+ _elementMap = new Map;
474
+ _elementPartialMap = new Map;
475
+ _classMap = new Map;
476
+ _classPartialMap = new Map;
477
+ _attrValueMap = new Map;
478
+ _attrValuePartialMap = new Map;
479
+ _listContexts = [];
480
+ addSelectables(cssSelectors, callbackCtxt) {
481
+ let listContext = null;
482
+ if (cssSelectors.length > 1) {
483
+ listContext = new SelectorListContext(cssSelectors);
484
+ this._listContexts.push(listContext);
485
+ }
486
+ for (let i = 0;i < cssSelectors.length; i++) {
487
+ this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
488
+ }
515
489
  }
516
- const scriptCode = scripts.map((script, index) => {
517
- const funcString = script.toString();
518
- const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
519
- if (!bodyMatch || !bodyMatch[1]) {
520
- return "";
490
+ _addSelectable(cssSelector, callbackCtxt, listContext) {
491
+ let matcher = this;
492
+ const element = cssSelector.element;
493
+ const classNames = cssSelector.classNames;
494
+ const attrs = cssSelector.attrs;
495
+ const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
496
+ if (element) {
497
+ const isTerminal = attrs.length === 0 && classNames.length === 0;
498
+ if (isTerminal) {
499
+ this._addTerminal(matcher._elementMap, element, selectable);
500
+ } else {
501
+ matcher = this._addPartial(matcher._elementPartialMap, element);
502
+ }
503
+ }
504
+ if (classNames) {
505
+ for (let i = 0;i < classNames.length; i++) {
506
+ const isTerminal = attrs.length === 0 && i === classNames.length - 1;
507
+ const className = classNames[i];
508
+ if (isTerminal) {
509
+ this._addTerminal(matcher._classMap, className, selectable);
510
+ } else {
511
+ matcher = this._addPartial(matcher._classPartialMap, className);
512
+ }
513
+ }
514
+ }
515
+ if (attrs) {
516
+ for (let i = 0;i < attrs.length; i += 2) {
517
+ const isTerminal = i === attrs.length - 2;
518
+ const name = attrs[i];
519
+ const value = attrs[i + 1];
520
+ if (isTerminal) {
521
+ const terminalMap = matcher._attrValueMap;
522
+ let terminalValuesMap = terminalMap.get(name);
523
+ if (!terminalValuesMap) {
524
+ terminalValuesMap = new Map;
525
+ terminalMap.set(name, terminalValuesMap);
526
+ }
527
+ this._addTerminal(terminalValuesMap, value, selectable);
528
+ } else {
529
+ const partialMap = matcher._attrValuePartialMap;
530
+ let partialValuesMap = partialMap.get(name);
531
+ if (!partialValuesMap) {
532
+ partialValuesMap = new Map;
533
+ partialMap.set(name, partialValuesMap);
534
+ }
535
+ matcher = this._addPartial(partialValuesMap, value);
536
+ }
537
+ }
521
538
  }
522
- const body = bodyMatch[1].trim();
523
- return `
524
- (function() {
525
- var executed = false;
526
- function executeScript_${index}() {
527
- if (executed) return;
528
- executed = true;
529
- ${body}
530
- }
531
-
532
- if (document.readyState === 'complete' || document.readyState === 'interactive') {
533
- executeScript_${index}();
534
- } else {
535
- document.addEventListener('DOMContentLoaded', executeScript_${index});
536
- }
537
-
538
- // Watch for hydration-added elements
539
- var observer = new MutationObserver(function() {
540
- executeScript_${index}();
541
- if (executed) observer.disconnect();
542
- });
543
- if (!executed) {
544
- observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
545
- }
546
-
547
- // Single fallback timeout
548
- setTimeout(function() {
549
- executeScript_${index}();
550
- observer.disconnect();
551
- }, 1000);
552
- })();`;
553
- }).join(`
554
- `);
555
- return `<script>
556
- (function() {
557
- ${scriptCode}
558
- })();
559
- </script>`;
560
- }, getAndClearClientScripts = (requestId) => {
561
- const id = requestId || ssrContextGetter?.();
562
- if (!id)
563
- return [];
564
- const scripts = scriptRegistry.get(id);
565
- if (!scripts) {
566
- return [];
567
539
  }
568
- const scriptArray = Array.from(scripts);
569
- scriptRegistry.delete(id);
570
- return scriptArray;
571
- };
572
- var init_registerClientScript = __esm(() => {
573
- scriptRegistry = new Map;
574
- if (typeof globalThis !== "undefined") {
575
- Object.assign(globalThis, { registerClientScript });
540
+ _addTerminal(map, name, selectable) {
541
+ let terminalList = map.get(name);
542
+ if (!terminalList) {
543
+ terminalList = [];
544
+ map.set(name, terminalList);
545
+ }
546
+ terminalList.push(selectable);
576
547
  }
577
- });
578
-
579
- // src/angular/injectorPatch.ts
580
- import { existsSync, readFileSync, writeFileSync } from "fs";
581
- import { dirname, join, resolve } from "path";
582
- var applyInjectorPatch = (chunkPath, content) => {
583
- if (content.includes('Symbol.for("angular.currentInjector")')) {
584
- return;
548
+ _addPartial(map, name) {
549
+ let matcher = map.get(name);
550
+ if (!matcher) {
551
+ matcher = new SelectorMatcher;
552
+ map.set(name, matcher);
553
+ }
554
+ return matcher;
585
555
  }
586
- const original = [
587
- "let _currentInjector = undefined;",
588
- "function getCurrentInjector() {",
589
- " return _currentInjector;",
590
- "}",
591
- "function setCurrentInjector(injector) {",
592
- " const former = _currentInjector;",
593
- " _currentInjector = injector;",
594
- " return former;",
595
- "}"
596
- ].join(`
597
- `);
598
- const replacement = [
599
- 'const _injSym = Symbol.for("angular.currentInjector");',
600
- "if (!globalThis[_injSym]) globalThis[_injSym] = { v: undefined };",
601
- "function getCurrentInjector() {",
602
- " return globalThis[_injSym].v;",
603
- "}",
604
- "function setCurrentInjector(injector) {",
605
- " const former = globalThis[_injSym].v;",
606
- " globalThis[_injSym].v = injector;",
607
- " return former;",
608
- "}"
609
- ].join(`
610
- `);
611
- const patched = content.replace(original, replacement);
612
- if (patched === content) {
613
- return;
556
+ match(cssSelector, matchedCallback) {
557
+ let result = false;
558
+ const element = cssSelector.element;
559
+ const classNames = cssSelector.classNames;
560
+ const attrs = cssSelector.attrs;
561
+ for (let i = 0;i < this._listContexts.length; i++) {
562
+ this._listContexts[i].alreadyMatched = false;
563
+ }
564
+ result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
565
+ result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result;
566
+ if (classNames) {
567
+ for (let i = 0;i < classNames.length; i++) {
568
+ const className = classNames[i];
569
+ result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
570
+ result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result;
571
+ }
572
+ }
573
+ if (attrs) {
574
+ for (let i = 0;i < attrs.length; i += 2) {
575
+ const name = attrs[i];
576
+ const value = attrs[i + 1];
577
+ const terminalValuesMap = this._attrValueMap.get(name);
578
+ if (value) {
579
+ result = this._matchTerminal(terminalValuesMap, "", cssSelector, matchedCallback) || result;
580
+ }
581
+ result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
582
+ const partialValuesMap = this._attrValuePartialMap.get(name);
583
+ if (value) {
584
+ result = this._matchPartial(partialValuesMap, "", cssSelector, matchedCallback) || result;
585
+ }
586
+ result = this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
587
+ }
588
+ }
589
+ return result;
614
590
  }
615
- writeFileSync(chunkPath, patched, "utf-8");
616
- }, resolveAngularCoreDir = () => {
617
- const fromProject = resolve(process.cwd(), "node_modules/@angular/core");
618
- if (existsSync(join(fromProject, "package.json"))) {
619
- return fromProject;
591
+ _matchTerminal(map, name, cssSelector, matchedCallback) {
592
+ if (!map || typeof name !== "string") {
593
+ return false;
594
+ }
595
+ let selectables = map.get(name) || [];
596
+ const starSelectables = map.get("*");
597
+ if (starSelectables) {
598
+ selectables = selectables.concat(starSelectables);
599
+ }
600
+ if (selectables.length === 0) {
601
+ return false;
602
+ }
603
+ let selectable;
604
+ let result = false;
605
+ for (let i = 0;i < selectables.length; i++) {
606
+ selectable = selectables[i];
607
+ result = selectable.finalize(cssSelector, matchedCallback) || result;
608
+ }
609
+ return result;
620
610
  }
621
- return dirname(__require.resolve("@angular/core/package.json"));
622
- }, patchAngularInjectorSingleton = () => {
623
- try {
624
- const coreDir = resolveAngularCoreDir();
625
- const chunkPath = join(coreDir, "fesm2022", "_not_found-chunk.mjs");
626
- const content = readFileSync(chunkPath, "utf-8");
627
- applyInjectorPatch(chunkPath, content);
628
- } catch {}
629
- };
630
- var init_injectorPatch = __esm(() => {
631
- patchAngularInjectorSingleton();
632
- });
633
-
634
- // src/angular/resolveAngularPackage.ts
635
- import { existsSync as existsSync2 } from "fs";
636
- import { resolve as resolve2 } from "path";
637
- var resolveAngularPackage = (specifier) => {
638
- const fromProject = resolve2(process.cwd(), "node_modules", specifier);
639
- if (existsSync2(fromProject)) {
640
- return fromProject;
611
+ _matchPartial(map, name, cssSelector, matchedCallback) {
612
+ if (!map || typeof name !== "string") {
613
+ return false;
614
+ }
615
+ const nestedSelector = map.get(name);
616
+ if (!nestedSelector) {
617
+ return false;
618
+ }
619
+ return nestedSelector.match(cssSelector, matchedCallback);
641
620
  }
642
- return specifier;
643
- };
644
- var init_resolveAngularPackage = () => {};
621
+ }
645
622
 
646
- // src/angular/angularPatch.ts
647
- var exports_angularPatch = {};
648
- __export(exports_angularPatch, {
649
- applyPatches: () => applyPatches
650
- });
651
- var ensureHead = (doc) => {
652
- if (!doc || doc.head || !doc.documentElement) {
653
- return;
623
+ class SelectorListContext {
624
+ selectors;
625
+ alreadyMatched = false;
626
+ constructor(selectors) {
627
+ this.selectors = selectors;
654
628
  }
655
- const head = doc.createElement("head");
656
- doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
657
- }, applyPatches = async () => {
658
- const { \u{275}DominoAdapter } = await import(resolveAngularPackage("@angular/platform-server"));
659
- if (!\u{275}DominoAdapter?.prototype) {
660
- console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
661
- return false;
629
+ }
630
+
631
+ class SelectorContext {
632
+ selector;
633
+ cbContext;
634
+ listContext;
635
+ notSelectors;
636
+ constructor(selector, cbContext, listContext) {
637
+ this.selector = selector;
638
+ this.cbContext = cbContext;
639
+ this.listContext = listContext;
640
+ this.notSelectors = selector.notSelectors;
662
641
  }
663
- const proto = \u{275}DominoAdapter.prototype;
664
- const origGetBaseHref = proto.getBaseHref;
665
- proto.getBaseHref = function(doc) {
666
- if (!doc || !doc.head || typeof doc.head.children === "undefined") {
667
- return "";
642
+ finalize(cssSelector, callback) {
643
+ let result = true;
644
+ if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
645
+ const notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
646
+ result = !notMatcher.match(cssSelector, null);
668
647
  }
669
- return origGetBaseHref.call(this, doc);
670
- };
671
- const origCreateHtmlDocument = proto.createHtmlDocument;
672
- proto.createHtmlDocument = function() {
673
- const doc = origCreateHtmlDocument.call(this);
674
- ensureHead(doc);
675
- return doc;
676
- };
677
- const origGetDefaultDocument = proto.getDefaultDocument;
678
- proto.getDefaultDocument = function() {
679
- const doc = origGetDefaultDocument.call(this);
680
- ensureHead(doc);
681
- return doc;
682
- };
683
- return true;
684
- };
685
- var init_angularPatch = __esm(() => {
686
- init_resolveAngularPackage();
687
- });
648
+ if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
649
+ if (this.listContext) {
650
+ this.listContext.alreadyMatched = true;
651
+ }
652
+ callback(this.selector, this.cbContext);
653
+ }
654
+ return result;
655
+ }
656
+ }
688
657
 
689
- // src/angular/angularDeps.ts
690
- var initDominoAdapter = (platformServer) => {
691
- try {
692
- const DominoAdapter = platformServer.\u{275}DominoAdapter;
693
- DominoAdapter?.makeCurrent?.();
694
- } catch (err) {
695
- console.error("Failed to initialize DominoAdapter:", err);
658
+ class SelectorlessMatcher {
659
+ registry;
660
+ constructor(registry) {
661
+ this.registry = registry;
696
662
  }
697
- }, loadAngularDeps = async () => {
698
- patchAngularInjectorSingleton();
699
- await import(resolveAngularPackage("@angular/compiler"));
700
- const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
701
- await applyPatches2();
702
- const [platformBrowser, platformServer, common, core] = await Promise.all([
703
- import(resolveAngularPackage("@angular/platform-browser")),
704
- import(resolveAngularPackage("@angular/platform-server")),
705
- import(resolveAngularPackage("@angular/common")),
706
- import(resolveAngularPackage("@angular/core"))
707
- ]);
708
- if (false) {}
709
- initDominoAdapter(platformServer);
710
- return {
711
- APP_BASE_HREF: common.APP_BASE_HREF,
712
- bootstrapApplication: platformBrowser.bootstrapApplication,
713
- DomSanitizer: platformBrowser.DomSanitizer,
714
- provideClientHydration: platformBrowser.provideClientHydration,
715
- provideServerRendering: platformServer.provideServerRendering,
716
- provideZonelessChangeDetection: core.provideZonelessChangeDetection,
717
- reflectComponentType: core.reflectComponentType,
718
- renderApplication: platformServer.renderApplication,
719
- Sanitizer: core.Sanitizer,
720
- SecurityContext: core.SecurityContext
721
- };
722
- }, angularDeps = null, getAngularDeps = () => {
723
- if (!angularDeps) {
724
- angularDeps = loadAngularDeps();
663
+ match(name) {
664
+ return this.registry.has(name) ? this.registry.get(name) : [];
725
665
  }
726
- return angularDeps;
727
- };
728
- var init_angularDeps = __esm(() => {
729
- init_injectorPatch();
730
- init_resolveAngularPackage();
731
- });
732
-
733
- // src/core/currentIslandRegistry.ts
734
- var requireCurrentIslandRegistry = () => {
735
- const registry = globalThis.__absoluteIslandRegistry;
736
- if (!registry) {
737
- throw new Error("No island registry is active. Configure `islands.registry` in absolute.config.ts before rendering <Island />.");
666
+ }
667
+ function parserSelectorToSimpleSelector(selector) {
668
+ const classes = selector.classNames && selector.classNames.length ? [8, ...selector.classNames] : [];
669
+ const elementName = selector.element && selector.element !== "*" ? selector.element : "";
670
+ return [elementName, ...selector.attrs, ...classes];
671
+ }
672
+ function parserSelectorToNegativeSelector(selector) {
673
+ const classes = selector.classNames && selector.classNames.length ? [8, ...selector.classNames] : [];
674
+ if (selector.element) {
675
+ return [1 | 4, selector.element, ...selector.attrs, ...classes];
676
+ } else if (selector.attrs.length) {
677
+ return [1 | 2, ...selector.attrs, ...classes];
678
+ } else {
679
+ return selector.classNames && selector.classNames.length ? [1 | 8, ...selector.classNames] : [];
738
680
  }
739
- return registry;
740
- }, setCurrentIslandRegistry = (registry) => {
741
- globalThis.__absoluteIslandRegistry = registry;
742
- };
681
+ }
682
+ function parserSelectorToR3Selector(selector) {
683
+ const positive = parserSelectorToSimpleSelector(selector);
684
+ const negative = selector.notSelectors && selector.notSelectors.length ? selector.notSelectors.map((notSelector) => parserSelectorToNegativeSelector(notSelector)) : [];
685
+ return positive.concat(...negative);
686
+ }
687
+ function parseSelectorToR3Selector(selector) {
688
+ return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
689
+ }
690
+ function digest$1(message) {
691
+ return message.id || computeDigest(message);
692
+ }
693
+ function computeDigest(message) {
694
+ return sha1(serializeNodes(message.nodes).join("") + `[${message.meaning}]`);
695
+ }
696
+ function decimalDigest(message) {
697
+ return message.id || computeDecimalDigest(message);
698
+ }
699
+ function computeDecimalDigest(message) {
700
+ const visitor = new _SerializerIgnoreIcuExpVisitor;
701
+ const parts = message.nodes.map((a) => a.visit(visitor, null));
702
+ return computeMsgId(parts.join(""), message.meaning);
703
+ }
743
704
 
744
- // src/angular/ssrRender.ts
745
- var routePropsCache, cacheRouteData = (pagePath, data) => {
746
- const cacheKey = pagePath.split("?")[0] ?? pagePath;
747
- routePropsCache.set(cacheKey, data);
748
- }, getCachedRouteData = (pagePath) => routePropsCache.get(pagePath), selectorCache, buildDeps = (ssrResult, baseDeps) => {
749
- if (!ssrResult?.core) {
750
- return baseDeps;
705
+ class _SerializerVisitor {
706
+ visitText(text, context) {
707
+ return text.value;
751
708
  }
752
- const { common, core, platformBrowser, platformServer } = ssrResult;
753
- return {
754
- APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
755
- bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
756
- DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
757
- provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
758
- provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
759
- provideZonelessChangeDetection: core.provideZonelessChangeDetection,
760
- reflectComponentType: core.reflectComponentType,
761
- renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
762
- Sanitizer: core.Sanitizer,
763
- SecurityContext: core.SecurityContext
764
- };
765
- }, buildProviders = (deps, sanitizer, maybeProps, tokenMap) => {
766
- const providers = [
767
- deps.provideServerRendering(),
768
- deps.provideClientHydration(),
769
- deps.provideZonelessChangeDetection(),
770
- { provide: deps.APP_BASE_HREF, useValue: "/" },
771
- {
772
- provide: deps.DomSanitizer,
773
- useValue: sanitizer
774
- },
775
- { provide: deps.Sanitizer, useValue: sanitizer }
776
- ];
777
- if (!maybeProps) {
778
- return providers;
709
+ visitContainer(container, context) {
710
+ return `[${container.children.map((child) => child.visit(this)).join(", ")}]`;
779
711
  }
780
- const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
781
- token: tokenMap.get(toScreamingSnake(propName)),
782
- value: propValue
783
- })).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
784
- return [...providers, ...propProviders];
785
- }, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
786
- if (!value || typeof value !== "object") {
787
- return false;
712
+ visitIcu(icu, context) {
713
+ const strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
714
+ return `{${icu.expression}, ${icu.type}, ${strCases.join(", ")}}`;
788
715
  }
789
- return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
790
- }, discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value))), loadSsrDeps = async (pagePath) => {
791
- const ssrDepsPath = (pagePath.split("?")[0] ?? pagePath).replace(/\.js$/, ".ssr-deps.js");
792
- try {
793
- const ssrDeps = await import(ssrDepsPath);
794
- const result = {
795
- common: ssrDeps.__angularCommon,
796
- core: ssrDeps.__angularCore,
797
- platformBrowser: ssrDeps.__angularPlatformBrowser,
798
- platformServer: ssrDeps.__angularPlatformServer
799
- };
800
- return result;
801
- } catch {
802
- return null;
716
+ visitTagPlaceholder(ph, context) {
717
+ return ph.isVoid ? `<ph tag name="${ph.startName}"/>` : `<ph tag name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
803
718
  }
804
- }, resolveSelector = (deps, pagePath, PageComponent) => {
805
- const cached = selectorCache.get(pagePath);
806
- if (cached) {
807
- return cached;
719
+ visitPlaceholder(ph, context) {
720
+ return ph.value ? `<ph name="${ph.name}">${ph.value}</ph>` : `<ph name="${ph.name}"/>`;
808
721
  }
809
- const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
810
- selectorCache.set(pagePath, selector);
811
- return selector;
812
- }, injectBeforeClose = (html, snippet) => {
813
- if (html.includes("</body>")) {
814
- return html.replace("</body>", `${snippet}</body>`);
722
+ visitIcuPlaceholder(ph, context) {
723
+ return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
815
724
  }
816
- if (html.includes("</html>")) {
817
- return html.replace("</html>", `${snippet}</html>`);
725
+ visitBlockPlaceholder(ph, context) {
726
+ return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
818
727
  }
819
- return html + snippet;
820
- }, injectSsrScripts = (html, requestId, indexPath, props) => {
821
- let result = html;
822
- const registeredScripts = getAndClearClientScripts(requestId);
823
- if (registeredScripts.length > 0) {
824
- result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
728
+ }
729
+ function serializeNodes(nodes) {
730
+ return nodes.map((a) => a.visit(serializerVisitor$1, null));
731
+ }
732
+ function sha1(str) {
733
+ textEncoder ??= new TextEncoder;
734
+ const utf8 = [...textEncoder.encode(str)];
735
+ const words32 = bytesToWords32(utf8, Endian.Big);
736
+ const len = utf8.length * 8;
737
+ const w = new Uint32Array(80);
738
+ let a = 1732584193, b = 4023233417, c = 2562383102, d = 271733878, e = 3285377520;
739
+ words32[len >> 5] |= 128 << 24 - len % 32;
740
+ words32[(len + 64 >> 9 << 4) + 15] = len;
741
+ for (let i = 0;i < words32.length; i += 16) {
742
+ const h0 = a, h1 = b, h2 = c, h3 = d, h4 = e;
743
+ for (let j = 0;j < 80; j++) {
744
+ if (j < 16) {
745
+ w[j] = words32[i + j];
746
+ } else {
747
+ w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
748
+ }
749
+ const fkVal = fk(j, b, c, d);
750
+ const f = fkVal[0];
751
+ const k = fkVal[1];
752
+ const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
753
+ e = d;
754
+ d = c;
755
+ c = rol32(b, 30);
756
+ b = a;
757
+ a = temp;
758
+ }
759
+ a = add32(a, h0);
760
+ b = add32(b, h1);
761
+ c = add32(c, h2);
762
+ d = add32(d, h3);
763
+ e = add32(e, h4);
825
764
  }
826
- if (props) {
827
- result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_PAGE_PROPS__ = ${JSON.stringify(props)};</script>`);
765
+ return toHexU32(a) + toHexU32(b) + toHexU32(c) + toHexU32(d) + toHexU32(e);
766
+ }
767
+ function toHexU32(value) {
768
+ return (value >>> 0).toString(16).padStart(8, "0");
769
+ }
770
+ function fk(index, b, c, d) {
771
+ if (index < 20) {
772
+ return [b & c | ~b & d, 1518500249];
828
773
  }
829
- if (indexPath) {
830
- result = injectBeforeClose(result, `<script type="module" src="${indexPath}"></script>`);
774
+ if (index < 40) {
775
+ return [b ^ c ^ d, 1859775393];
831
776
  }
832
- return result;
833
- }, renderAngularApp = async (deps, PageComponent, providers, document2) => {
834
- const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
835
- return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
836
- document: document2,
837
- platformProviders: [],
838
- url: "/"
839
- }));
840
- }, withSuppressedAngularDevLogs = async (render) => {
841
- const origLog = console.log;
842
- console.log = (...args) => {
843
- if (typeof args[0] === "string" && args[0].includes("development mode")) {
844
- return;
777
+ if (index < 60) {
778
+ return [b & c | b & d | c & d, 2400959708];
779
+ }
780
+ return [b ^ c ^ d, 3395469782];
781
+ }
782
+ function fingerprint(str) {
783
+ textEncoder ??= new TextEncoder;
784
+ const utf8 = textEncoder.encode(str);
785
+ const view = new DataView(utf8.buffer, utf8.byteOffset, utf8.byteLength);
786
+ let hi = hash32(view, utf8.length, 0);
787
+ let lo = hash32(view, utf8.length, 102072);
788
+ if (hi == 0 && (lo == 0 || lo == 1)) {
789
+ hi = hi ^ 319790063;
790
+ lo = lo ^ -1801410264;
791
+ }
792
+ return BigInt.asUintN(32, BigInt(hi)) << BigInt(32) | BigInt.asUintN(32, BigInt(lo));
793
+ }
794
+ function computeMsgId(msg, meaning = "") {
795
+ let msgFingerprint = fingerprint(msg);
796
+ if (meaning) {
797
+ msgFingerprint = BigInt.asUintN(64, msgFingerprint << BigInt(1)) | msgFingerprint >> BigInt(63) & BigInt(1);
798
+ msgFingerprint += fingerprint(meaning);
799
+ }
800
+ return BigInt.asUintN(63, msgFingerprint).toString();
801
+ }
802
+ function hash32(view, length, c) {
803
+ let a = 2654435769, b = 2654435769;
804
+ let index = 0;
805
+ const end = length - 12;
806
+ for (;index <= end; index += 12) {
807
+ a += view.getUint32(index, true);
808
+ b += view.getUint32(index + 4, true);
809
+ c += view.getUint32(index + 8, true);
810
+ const res = mix(a, b, c);
811
+ a = res[0], b = res[1], c = res[2];
812
+ }
813
+ const remainder = length - index;
814
+ c += length;
815
+ if (remainder >= 4) {
816
+ a += view.getUint32(index, true);
817
+ index += 4;
818
+ if (remainder >= 8) {
819
+ b += view.getUint32(index, true);
820
+ index += 4;
821
+ if (remainder >= 9) {
822
+ c += view.getUint8(index++) << 8;
823
+ }
824
+ if (remainder >= 10) {
825
+ c += view.getUint8(index++) << 16;
826
+ }
827
+ if (remainder === 11) {
828
+ c += view.getUint8(index++) << 24;
829
+ }
830
+ } else {
831
+ if (remainder >= 5) {
832
+ b += view.getUint8(index++);
833
+ }
834
+ if (remainder >= 6) {
835
+ b += view.getUint8(index++) << 8;
836
+ }
837
+ if (remainder === 7) {
838
+ b += view.getUint8(index++) << 16;
839
+ }
840
+ }
841
+ } else {
842
+ if (remainder >= 1) {
843
+ a += view.getUint8(index++);
844
+ }
845
+ if (remainder >= 2) {
846
+ a += view.getUint8(index++) << 8;
847
+ }
848
+ if (remainder === 3) {
849
+ a += view.getUint8(index++) << 16;
845
850
  }
846
- origLog.apply(console, args);
847
- };
848
- try {
849
- return await render();
850
- } finally {
851
- console.log = origLog;
852
851
  }
853
- };
854
- var init_ssrRender = __esm(() => {
855
- init_registerClientScript();
856
- routePropsCache = new Map;
857
- selectorCache = new Map;
858
- });
852
+ return mix(a, b, c)[2];
853
+ }
854
+ function mix(a, b, c) {
855
+ a -= b;
856
+ a -= c;
857
+ a ^= c >>> 13;
858
+ b -= c;
859
+ b -= a;
860
+ b ^= a << 8;
861
+ c -= a;
862
+ c -= b;
863
+ c ^= b >>> 13;
864
+ a -= b;
865
+ a -= c;
866
+ a ^= c >>> 12;
867
+ b -= c;
868
+ b -= a;
869
+ b ^= a << 16;
870
+ c -= a;
871
+ c -= b;
872
+ c ^= b >>> 5;
873
+ a -= b;
874
+ a -= c;
875
+ a ^= c >>> 3;
876
+ b -= c;
877
+ b -= a;
878
+ b ^= a << 10;
879
+ c -= a;
880
+ c -= b;
881
+ c ^= b >>> 15;
882
+ return [a, b, c];
883
+ }
884
+ function add32(a, b) {
885
+ return add32to64(a, b)[1];
886
+ }
887
+ function add32to64(a, b) {
888
+ const low = (a & 65535) + (b & 65535);
889
+ const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
890
+ return [high >>> 16, high << 16 | low & 65535];
891
+ }
892
+ function rol32(a, count) {
893
+ return a << count | a >>> 32 - count;
894
+ }
895
+ function bytesToWords32(bytes, endian) {
896
+ const size = bytes.length + 3 >>> 2;
897
+ const words32 = [];
898
+ for (let i = 0;i < size; i++) {
899
+ words32[i] = wordAt(bytes, i * 4, endian);
900
+ }
901
+ return words32;
902
+ }
903
+ function byteAt(bytes, index) {
904
+ return index >= bytes.length ? 0 : bytes[index];
905
+ }
906
+ function wordAt(bytes, index, endian) {
907
+ let word = 0;
908
+ if (endian === Endian.Big) {
909
+ for (let i = 0;i < 4; i++) {
910
+ word += byteAt(bytes, index + i) << 24 - 8 * i;
911
+ }
912
+ } else {
913
+ for (let i = 0;i < 4; i++) {
914
+ word += byteAt(bytes, index + i) << 8 * i;
915
+ }
916
+ }
917
+ return word;
918
+ }
859
919
 
860
- // node_modules/@angular/compiler/fesm2022/compiler.mjs
861
- var exports_compiler = {};
862
- __export(exports_compiler, {
863
- visitAll: () => visitAll,
864
- verifyHostBindings: () => verifyHostBindings,
865
- tmplAstVisitAll: () => visitAll$1,
866
- splitNsName: () => splitNsName,
867
- setEnableTemplateSourceLocations: () => setEnableTemplateSourceLocations,
868
- sanitizeIdentifier: () => sanitizeIdentifier,
869
- r3JitTypeSourceSpan: () => r3JitTypeSourceSpan,
870
- publishFacade: () => publishFacade,
871
- preserveWhitespacesDefault: () => preserveWhitespacesDefault,
872
- parseTemplate: () => parseTemplate,
873
- parseHostBindings: () => parseHostBindings,
874
- outputAst: () => output_ast,
875
- mergeNsAndName: () => mergeNsAndName,
876
- makeBindingParser: () => makeBindingParser,
877
- literalMap: () => literalMap,
878
- literal: () => literal,
879
- leadingComment: () => leadingComment,
880
- jsDocComment: () => jsDocComment,
881
- isNgTemplate: () => isNgTemplate,
882
- isNgContent: () => isNgContent,
883
- isNgContainer: () => isNgContainer,
884
- identifierName: () => identifierName,
885
- getSafePropertyAccessString: () => getSafePropertyAccessString,
886
- getNsPrefix: () => getNsPrefix,
887
- getHtmlTagDefinition: () => getHtmlTagDefinition,
888
- findMatchingDirectivesAndPipes: () => findMatchingDirectivesAndPipes,
889
- escapeRegExp: () => escapeRegExp,
890
- encapsulateStyle: () => encapsulateStyle,
891
- emitDistinctChangesOnlyDefaultValue: () => emitDistinctChangesOnlyDefaultValue,
892
- devOnlyGuardedExpression: () => devOnlyGuardedExpression,
893
- createMayBeForwardRefExpression: () => createMayBeForwardRefExpression,
894
- createInjectableType: () => createInjectableType,
895
- createCssSelectorFromNode: () => createCssSelectorFromNode,
896
- core: () => core,
897
- computeMsgId: () => computeMsgId,
898
- compilePipeFromMetadata: () => compilePipeFromMetadata,
899
- compileOpaqueAsyncClassMetadata: () => compileOpaqueAsyncClassMetadata,
900
- compileNgModule: () => compileNgModule,
901
- compileInjector: () => compileInjector,
902
- compileInjectable: () => compileInjectable,
903
- compileHmrUpdateCallback: () => compileHmrUpdateCallback,
904
- compileHmrInitializer: () => compileHmrInitializer,
905
- compileFactoryFunction: () => compileFactoryFunction,
906
- compileDirectiveFromMetadata: () => compileDirectiveFromMetadata,
907
- compileDeferResolverFunction: () => compileDeferResolverFunction,
908
- compileDeclarePipeFromMetadata: () => compileDeclarePipeFromMetadata,
909
- compileDeclareNgModuleFromMetadata: () => compileDeclareNgModuleFromMetadata,
910
- compileDeclareInjectorFromMetadata: () => compileDeclareInjectorFromMetadata,
911
- compileDeclareInjectableFromMetadata: () => compileDeclareInjectableFromMetadata,
912
- compileDeclareFactoryFunction: () => compileDeclareFactoryFunction,
913
- compileDeclareDirectiveFromMetadata: () => compileDeclareDirectiveFromMetadata,
914
- compileDeclareComponentFromMetadata: () => compileDeclareComponentFromMetadata,
915
- compileDeclareClassMetadata: () => compileDeclareClassMetadata,
916
- compileComponentFromMetadata: () => compileComponentFromMetadata,
917
- compileComponentDeclareClassMetadata: () => compileComponentDeclareClassMetadata,
918
- compileComponentClassMetadata: () => compileComponentClassMetadata,
919
- compileClassMetadata: () => compileClassMetadata,
920
- compileClassDebugInfo: () => compileClassDebugInfo,
921
- _ATTR_TO_PROP: () => _ATTR_TO_PROP,
922
- Xtb: () => Xtb,
923
- XmlParser: () => XmlParser,
924
- Xmb: () => Xmb,
925
- Xliff2: () => Xliff2,
926
- Xliff: () => Xliff,
927
- WrappedNodeExpr: () => WrappedNodeExpr,
928
- VoidExpression: () => VoidExpression,
929
- VoidExpr: () => VoidExpr,
930
- ViewEncapsulation: () => ViewEncapsulation$1,
931
- Version: () => Version,
932
- VariableBinding: () => VariableBinding,
933
- VERSION: () => VERSION,
934
- UnaryOperatorExpr: () => UnaryOperatorExpr,
935
- UnaryOperator: () => UnaryOperator,
936
- Unary: () => Unary,
937
- TypeofExpression: () => TypeofExpression,
938
- TypeofExpr: () => TypeofExpr,
939
- TypeModifier: () => TypeModifier,
940
- Type: () => Type,
941
- TreeError: () => TreeError,
942
- TransplantedType: () => TransplantedType,
943
- TokenType: () => TokenType,
944
- Token: () => Token,
945
- TmplAstViewportDeferredTrigger: () => ViewportDeferredTrigger,
946
- TmplAstVariable: () => Variable,
947
- TmplAstUnknownBlock: () => UnknownBlock,
948
- TmplAstTimerDeferredTrigger: () => TimerDeferredTrigger,
949
- TmplAstTextAttribute: () => TextAttribute,
950
- TmplAstText: () => Text$3,
951
- TmplAstTemplate: () => Template,
952
- TmplAstSwitchExhaustiveCheck: () => SwitchExhaustiveCheck,
953
- TmplAstSwitchBlockCaseGroup: () => SwitchBlockCaseGroup,
954
- TmplAstSwitchBlockCase: () => SwitchBlockCase,
955
- TmplAstSwitchBlock: () => SwitchBlock,
956
- TmplAstReference: () => Reference,
957
- TmplAstRecursiveVisitor: () => RecursiveVisitor$1,
958
- TmplAstNeverDeferredTrigger: () => NeverDeferredTrigger,
959
- TmplAstLetDeclaration: () => LetDeclaration$1,
960
- TmplAstInteractionDeferredTrigger: () => InteractionDeferredTrigger,
961
- TmplAstImmediateDeferredTrigger: () => ImmediateDeferredTrigger,
962
- TmplAstIfBlockBranch: () => IfBlockBranch,
963
- TmplAstIfBlock: () => IfBlock,
964
- TmplAstIdleDeferredTrigger: () => IdleDeferredTrigger,
965
- TmplAstIcu: () => Icu$1,
966
- TmplAstHoverDeferredTrigger: () => HoverDeferredTrigger,
967
- TmplAstHostElement: () => HostElement,
968
- TmplAstForLoopBlockEmpty: () => ForLoopBlockEmpty,
969
- TmplAstForLoopBlock: () => ForLoopBlock,
970
- TmplAstElement: () => Element$1,
971
- TmplAstDirective: () => Directive$1,
972
- TmplAstDeferredTrigger: () => DeferredTrigger,
973
- TmplAstDeferredBlockPlaceholder: () => DeferredBlockPlaceholder,
974
- TmplAstDeferredBlockLoading: () => DeferredBlockLoading,
975
- TmplAstDeferredBlockError: () => DeferredBlockError,
976
- TmplAstDeferredBlock: () => DeferredBlock,
977
- TmplAstContent: () => Content,
978
- TmplAstComponent: () => Component$1,
979
- TmplAstBoundText: () => BoundText,
980
- TmplAstBoundEvent: () => BoundEvent,
981
- TmplAstBoundDeferredTrigger: () => BoundDeferredTrigger,
982
- TmplAstBoundAttribute: () => BoundAttribute,
983
- TmplAstBlockNode: () => BlockNode,
984
- ThisReceiver: () => ThisReceiver,
985
- Text: () => Text4,
986
- TemplateLiteralExpr: () => TemplateLiteralExpr,
987
- TemplateLiteralElementExpr: () => TemplateLiteralElementExpr,
988
- TemplateLiteralElement: () => TemplateLiteralElement,
989
- TemplateLiteral: () => TemplateLiteral,
990
- TemplateBindingParseResult: () => TemplateBindingParseResult,
991
- TaggedTemplateLiteralExpr: () => TaggedTemplateLiteralExpr,
992
- TaggedTemplateLiteral: () => TaggedTemplateLiteral,
993
- TagContentType: () => TagContentType,
994
- StringTokenKind: () => StringTokenKind,
995
- StringToken: () => StringToken,
996
- StmtModifier: () => StmtModifier,
997
- Statement: () => Statement,
998
- SpreadElementExpr: () => SpreadElementExpr,
999
- SpreadElement: () => SpreadElement,
1000
- SplitInterpolation: () => SplitInterpolation,
1001
- Serializer: () => Serializer,
1002
- SelectorlessMatcher: () => SelectorlessMatcher,
1003
- SelectorMatcher: () => SelectorMatcher,
1004
- SelectorListContext: () => SelectorListContext,
1005
- SelectorContext: () => SelectorContext,
1006
- SafePropertyRead: () => SafePropertyRead,
1007
- SafeKeyedRead: () => SafeKeyedRead,
1008
- SafeCall: () => SafeCall,
1009
- STRING_TYPE: () => STRING_TYPE,
1010
- SECURITY_SCHEMA: () => SECURITY_SCHEMA,
1011
- SCHEMA: () => SCHEMA,
1012
- ReturnStatement: () => ReturnStatement,
1013
- ResourceLoader: () => ResourceLoader,
1014
- RegularExpressionLiteralExpr: () => RegularExpressionLiteralExpr,
1015
- RegularExpressionLiteral: () => RegularExpressionLiteral,
1016
- RecursiveVisitor: () => RecursiveVisitor2,
1017
- RecursiveAstVisitor: () => RecursiveAstVisitor2,
1018
- ReadVarExpr: () => ReadVarExpr,
1019
- ReadPropExpr: () => ReadPropExpr,
1020
- ReadKeyExpr: () => ReadKeyExpr,
1021
- R3TemplateDependencyKind: () => R3TemplateDependencyKind,
1022
- R3TargetBinder: () => R3TargetBinder,
1023
- R3SelectorScopeMode: () => R3SelectorScopeMode,
1024
- R3NgModuleMetadataKind: () => R3NgModuleMetadataKind,
1025
- R3Identifiers: () => Identifiers,
1026
- PropertyRead: () => PropertyRead,
1027
- PrefixNot: () => PrefixNot,
1028
- Parser: () => Parser2,
1029
- ParsedVariable: () => ParsedVariable,
1030
- ParsedPropertyType: () => ParsedPropertyType,
1031
- ParsedProperty: () => ParsedProperty,
1032
- ParsedEventType: () => ParsedEventType,
1033
- ParsedEvent: () => ParsedEvent,
1034
- ParseTreeResult: () => ParseTreeResult,
1035
- ParseSpan: () => ParseSpan,
1036
- ParseSourceSpan: () => ParseSourceSpan,
1037
- ParseSourceFile: () => ParseSourceFile,
1038
- ParseLocation: () => ParseLocation,
1039
- ParseErrorLevel: () => ParseErrorLevel,
1040
- ParseError: () => ParseError,
1041
- ParenthesizedExpression: () => ParenthesizedExpression,
1042
- ParenthesizedExpr: () => ParenthesizedExpr,
1043
- NotExpr: () => NotExpr,
1044
- NonNullAssert: () => NonNullAssert,
1045
- NodeWithI18n: () => NodeWithI18n,
1046
- NO_ERRORS_SCHEMA: () => NO_ERRORS_SCHEMA,
1047
- NONE_TYPE: () => NONE_TYPE,
1048
- MessageBundle: () => MessageBundle,
1049
- MapType: () => MapType,
1050
- LocalizedString: () => LocalizedString,
1051
- LiteralPrimitive: () => LiteralPrimitive,
1052
- LiteralMapSpreadAssignment: () => LiteralMapSpreadAssignment,
1053
- LiteralMapPropertyAssignment: () => LiteralMapPropertyAssignment,
1054
- LiteralMapExpr: () => LiteralMapExpr,
1055
- LiteralMap: () => LiteralMap,
1056
- LiteralExpr: () => LiteralExpr,
1057
- LiteralArrayExpr: () => LiteralArrayExpr,
1058
- LiteralArray: () => LiteralArray,
1059
- Lexer: () => Lexer,
1060
- LetDeclaration: () => LetDeclaration2,
1061
- LeadingComment: () => LeadingComment,
1062
- KeyedRead: () => KeyedRead,
1063
- JitEvaluator: () => JitEvaluator,
1064
- JSDocComment: () => JSDocComment,
1065
- InvokeFunctionExpr: () => InvokeFunctionExpr,
1066
- Interpolation: () => Interpolation$1,
1067
- InstantiateExpr: () => InstantiateExpr,
1068
- ImplicitReceiver: () => ImplicitReceiver,
1069
- IfStmt: () => IfStmt,
1070
- I18NHtmlParser: () => I18NHtmlParser,
1071
- HtmlTagDefinition: () => HtmlTagDefinition,
1072
- HtmlParser: () => HtmlParser,
1073
- FunctionExpr: () => FunctionExpr,
1074
- FactoryTarget: () => FactoryTarget,
1075
- ExternalReference: () => ExternalReference,
1076
- ExternalExpr: () => ExternalExpr,
1077
- ExpressionType: () => ExpressionType,
1078
- ExpressionStatement: () => ExpressionStatement,
1079
- ExpressionBinding: () => ExpressionBinding,
1080
- Expression: () => Expression,
1081
- ExpansionCase: () => ExpansionCase,
1082
- Expansion: () => Expansion,
1083
- EmptyExpr: () => EmptyExpr$1,
1084
- EmitterVisitorContext: () => EmitterVisitorContext,
1085
- ElementSchemaRegistry: () => ElementSchemaRegistry,
1086
- Element: () => Element2,
1087
- EOF: () => EOF,
1088
- DynamicImportExpr: () => DynamicImportExpr,
1089
- DomElementSchemaRegistry: () => DomElementSchemaRegistry,
1090
- Directive: () => Directive2,
1091
- DeclareVarStmt: () => DeclareVarStmt,
1092
- DeclareFunctionStmt: () => DeclareFunctionStmt,
1093
- DYNAMIC_TYPE: () => DYNAMIC_TYPE,
1094
- CssSelector: () => CssSelector,
1095
- ConstantPool: () => ConstantPool,
1096
- ConditionalExpr: () => ConditionalExpr,
1097
- Conditional: () => Conditional,
1098
- Component: () => Component2,
1099
- CompilerFacadeImpl: () => CompilerFacadeImpl,
1100
- CompilerConfig: () => CompilerConfig,
1101
- Comment: () => Comment2,
1102
- CommaExpr: () => CommaExpr,
1103
- CombinedRecursiveAstVisitor: () => CombinedRecursiveAstVisitor,
1104
- ChangeDetectionStrategy: () => ChangeDetectionStrategy,
1105
- Chain: () => Chain,
1106
- Call: () => Call,
1107
- CUSTOM_ELEMENTS_SCHEMA: () => CUSTOM_ELEMENTS_SCHEMA,
1108
- BuiltinTypeName: () => BuiltinTypeName,
1109
- BuiltinType: () => BuiltinType,
1110
- BoundElementProperty: () => BoundElementProperty,
1111
- BlockParameter: () => BlockParameter,
1112
- Block: () => Block,
1113
- BindingType: () => BindingType,
1114
- BindingPipeType: () => BindingPipeType,
1115
- BindingPipe: () => BindingPipe,
1116
- BinaryOperatorExpr: () => BinaryOperatorExpr,
1117
- BinaryOperator: () => BinaryOperator,
1118
- Binary: () => Binary,
1119
- Attribute: () => Attribute,
1120
- ArrowFunctionIdentifierParameter: () => ArrowFunctionIdentifierParameter,
1121
- ArrowFunctionExpr: () => ArrowFunctionExpr$1,
1122
- ArrowFunction: () => ArrowFunction,
1123
- ArrayType: () => ArrayType,
1124
- AbsoluteSourceSpan: () => AbsoluteSourceSpan,
1125
- ASTWithSource: () => ASTWithSource,
1126
- ASTWithName: () => ASTWithName,
1127
- AST: () => AST
1128
- });
1129
-
1130
- class CssSelector {
1131
- element = null;
1132
- classNames = [];
1133
- attrs = [];
1134
- notSelectors = [];
1135
- static parse(selector) {
1136
- const results = [];
1137
- const _addResult = (res, cssSel) => {
1138
- if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) {
1139
- cssSel.element = "*";
1140
- }
1141
- res.push(cssSel);
1142
- };
1143
- let cssSelector = new CssSelector;
1144
- let match;
1145
- let current = cssSelector;
1146
- let inNot = false;
1147
- _SELECTOR_REGEXP.lastIndex = 0;
1148
- while (match = _SELECTOR_REGEXP.exec(selector)) {
1149
- if (match[1]) {
1150
- if (inNot) {
1151
- throw new Error("Nesting :not in a selector is not allowed");
1152
- }
1153
- inNot = true;
1154
- current = new CssSelector;
1155
- cssSelector.notSelectors.push(current);
1156
- }
1157
- const tag = match[2];
1158
- if (tag) {
1159
- const prefix = match[3];
1160
- if (prefix === "#") {
1161
- current.addAttribute("id", tag.slice(1));
1162
- } else if (prefix === ".") {
1163
- current.addClassName(tag.slice(1));
1164
- } else {
1165
- current.setElement(tag);
1166
- }
1167
- }
1168
- const attribute = match[4];
1169
- if (attribute) {
1170
- current.addAttribute(current.unescapeAttribute(attribute), match[6]);
1171
- }
1172
- if (match[7]) {
1173
- inNot = false;
1174
- current = cssSelector;
1175
- }
1176
- if (match[8]) {
1177
- if (inNot) {
1178
- throw new Error("Multiple selectors in :not are not supported");
1179
- }
1180
- _addResult(results, cssSelector);
1181
- cssSelector = current = new CssSelector;
1182
- }
1183
- }
1184
- _addResult(results, cssSelector);
1185
- return results;
920
+ class Type {
921
+ modifiers;
922
+ constructor(modifiers = TypeModifier.None) {
923
+ this.modifiers = modifiers;
1186
924
  }
1187
- unescapeAttribute(attr) {
1188
- let result = "";
1189
- let escaping = false;
1190
- for (let i = 0;i < attr.length; i++) {
1191
- const char = attr.charAt(i);
1192
- if (char === "\\") {
1193
- escaping = true;
1194
- continue;
1195
- }
1196
- if (char === "$" && !escaping) {
1197
- throw new Error(`Error in attribute selector "${attr}". ` + `Unescaped "$" is not supported. Please escape with "\\$".`);
1198
- }
1199
- escaping = false;
1200
- result += char;
925
+ hasModifier(modifier) {
926
+ return (this.modifiers & modifier) !== 0;
927
+ }
928
+ }
929
+ function nullSafeIsEquivalent(base, other) {
930
+ if (base == null || other == null) {
931
+ return base == other;
932
+ }
933
+ return base.isEquivalent(other);
934
+ }
935
+ function areAllEquivalentPredicate(base, other, equivalentPredicate) {
936
+ const len = base.length;
937
+ if (len !== other.length) {
938
+ return false;
939
+ }
940
+ for (let i = 0;i < len; i++) {
941
+ if (!equivalentPredicate(base[i], other[i])) {
942
+ return false;
1201
943
  }
1202
- return result;
1203
944
  }
1204
- escapeAttribute(attr) {
1205
- return attr.replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
945
+ return true;
946
+ }
947
+ function areAllEquivalent(base, other) {
948
+ return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));
949
+ }
950
+
951
+ class Expression {
952
+ type;
953
+ sourceSpan;
954
+ constructor(type, sourceSpan) {
955
+ this.type = type || null;
956
+ this.sourceSpan = sourceSpan || null;
1206
957
  }
1207
- isElementSelector() {
1208
- return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0;
958
+ prop(name, sourceSpan) {
959
+ return new ReadPropExpr(this, name, null, sourceSpan);
1209
960
  }
1210
- hasElementSelector() {
1211
- return !!this.element;
961
+ key(index, type, sourceSpan) {
962
+ return new ReadKeyExpr(this, index, type, sourceSpan);
1212
963
  }
1213
- setElement(element = null) {
1214
- this.element = element;
964
+ callFn(params, sourceSpan, pure) {
965
+ return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
1215
966
  }
1216
- getAttrs() {
1217
- const result = [];
1218
- if (this.classNames.length > 0) {
1219
- result.push("class", this.classNames.join(" "));
1220
- }
1221
- return result.concat(this.attrs);
967
+ instantiate(params, type, sourceSpan) {
968
+ return new InstantiateExpr(this, params, type, sourceSpan);
1222
969
  }
1223
- addAttribute(name, value = "") {
1224
- this.attrs.push(name, value && value.toLowerCase() || "");
970
+ conditional(trueCase, falseCase = null, sourceSpan) {
971
+ return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
1225
972
  }
1226
- addClassName(name) {
1227
- this.classNames.push(name.toLowerCase());
973
+ equals(rhs, sourceSpan) {
974
+ return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
1228
975
  }
1229
- toString() {
1230
- let res = this.element || "";
1231
- if (this.classNames) {
1232
- this.classNames.forEach((klass) => res += `.${klass}`);
1233
- }
1234
- if (this.attrs) {
1235
- for (let i = 0;i < this.attrs.length; i += 2) {
1236
- const name = this.escapeAttribute(this.attrs[i]);
1237
- const value = this.attrs[i + 1];
1238
- res += `[${name}${value ? "=" + value : ""}]`;
1239
- }
1240
- }
1241
- this.notSelectors.forEach((notSelector) => res += `:not(${notSelector})`);
1242
- return res;
976
+ notEquals(rhs, sourceSpan) {
977
+ return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
1243
978
  }
1244
- }
1245
-
1246
- class SelectorMatcher {
1247
- static createNotMatcher(notSelectors) {
1248
- const notMatcher = new SelectorMatcher;
1249
- notMatcher.addSelectables(notSelectors, null);
1250
- return notMatcher;
979
+ identical(rhs, sourceSpan) {
980
+ return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
1251
981
  }
1252
- _elementMap = new Map;
1253
- _elementPartialMap = new Map;
1254
- _classMap = new Map;
1255
- _classPartialMap = new Map;
1256
- _attrValueMap = new Map;
1257
- _attrValuePartialMap = new Map;
1258
- _listContexts = [];
1259
- addSelectables(cssSelectors, callbackCtxt) {
1260
- let listContext = null;
1261
- if (cssSelectors.length > 1) {
1262
- listContext = new SelectorListContext(cssSelectors);
1263
- this._listContexts.push(listContext);
1264
- }
1265
- for (let i = 0;i < cssSelectors.length; i++) {
1266
- this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
1267
- }
982
+ notIdentical(rhs, sourceSpan) {
983
+ return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
1268
984
  }
1269
- _addSelectable(cssSelector, callbackCtxt, listContext) {
1270
- let matcher = this;
1271
- const element = cssSelector.element;
1272
- const classNames = cssSelector.classNames;
1273
- const attrs = cssSelector.attrs;
1274
- const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
1275
- if (element) {
1276
- const isTerminal = attrs.length === 0 && classNames.length === 0;
1277
- if (isTerminal) {
1278
- this._addTerminal(matcher._elementMap, element, selectable);
1279
- } else {
1280
- matcher = this._addPartial(matcher._elementPartialMap, element);
1281
- }
1282
- }
1283
- if (classNames) {
1284
- for (let i = 0;i < classNames.length; i++) {
1285
- const isTerminal = attrs.length === 0 && i === classNames.length - 1;
1286
- const className = classNames[i];
1287
- if (isTerminal) {
1288
- this._addTerminal(matcher._classMap, className, selectable);
1289
- } else {
1290
- matcher = this._addPartial(matcher._classPartialMap, className);
1291
- }
1292
- }
1293
- }
1294
- if (attrs) {
1295
- for (let i = 0;i < attrs.length; i += 2) {
1296
- const isTerminal = i === attrs.length - 2;
1297
- const name = attrs[i];
1298
- const value = attrs[i + 1];
1299
- if (isTerminal) {
1300
- const terminalMap = matcher._attrValueMap;
1301
- let terminalValuesMap = terminalMap.get(name);
1302
- if (!terminalValuesMap) {
1303
- terminalValuesMap = new Map;
1304
- terminalMap.set(name, terminalValuesMap);
1305
- }
1306
- this._addTerminal(terminalValuesMap, value, selectable);
1307
- } else {
1308
- const partialMap = matcher._attrValuePartialMap;
1309
- let partialValuesMap = partialMap.get(name);
1310
- if (!partialValuesMap) {
1311
- partialValuesMap = new Map;
1312
- partialMap.set(name, partialValuesMap);
1313
- }
1314
- matcher = this._addPartial(partialValuesMap, value);
1315
- }
1316
- }
1317
- }
985
+ minus(rhs, sourceSpan) {
986
+ return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
1318
987
  }
1319
- _addTerminal(map, name, selectable) {
1320
- let terminalList = map.get(name);
1321
- if (!terminalList) {
1322
- terminalList = [];
1323
- map.set(name, terminalList);
1324
- }
1325
- terminalList.push(selectable);
988
+ plus(rhs, sourceSpan) {
989
+ return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
1326
990
  }
1327
- _addPartial(map, name) {
1328
- let matcher = map.get(name);
1329
- if (!matcher) {
1330
- matcher = new SelectorMatcher;
1331
- map.set(name, matcher);
1332
- }
1333
- return matcher;
1334
- }
1335
- match(cssSelector, matchedCallback) {
1336
- let result = false;
1337
- const element = cssSelector.element;
1338
- const classNames = cssSelector.classNames;
1339
- const attrs = cssSelector.attrs;
1340
- for (let i = 0;i < this._listContexts.length; i++) {
1341
- this._listContexts[i].alreadyMatched = false;
1342
- }
1343
- result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
1344
- result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result;
1345
- if (classNames) {
1346
- for (let i = 0;i < classNames.length; i++) {
1347
- const className = classNames[i];
1348
- result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
1349
- result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result;
1350
- }
1351
- }
1352
- if (attrs) {
1353
- for (let i = 0;i < attrs.length; i += 2) {
1354
- const name = attrs[i];
1355
- const value = attrs[i + 1];
1356
- const terminalValuesMap = this._attrValueMap.get(name);
1357
- if (value) {
1358
- result = this._matchTerminal(terminalValuesMap, "", cssSelector, matchedCallback) || result;
1359
- }
1360
- result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
1361
- const partialValuesMap = this._attrValuePartialMap.get(name);
1362
- if (value) {
1363
- result = this._matchPartial(partialValuesMap, "", cssSelector, matchedCallback) || result;
1364
- }
1365
- result = this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
1366
- }
1367
- }
1368
- return result;
1369
- }
1370
- _matchTerminal(map, name, cssSelector, matchedCallback) {
1371
- if (!map || typeof name !== "string") {
1372
- return false;
1373
- }
1374
- let selectables = map.get(name) || [];
1375
- const starSelectables = map.get("*");
1376
- if (starSelectables) {
1377
- selectables = selectables.concat(starSelectables);
1378
- }
1379
- if (selectables.length === 0) {
1380
- return false;
1381
- }
1382
- let selectable;
1383
- let result = false;
1384
- for (let i = 0;i < selectables.length; i++) {
1385
- selectable = selectables[i];
1386
- result = selectable.finalize(cssSelector, matchedCallback) || result;
1387
- }
1388
- return result;
1389
- }
1390
- _matchPartial(map, name, cssSelector, matchedCallback) {
1391
- if (!map || typeof name !== "string") {
1392
- return false;
1393
- }
1394
- const nestedSelector = map.get(name);
1395
- if (!nestedSelector) {
1396
- return false;
1397
- }
1398
- return nestedSelector.match(cssSelector, matchedCallback);
1399
- }
1400
- }
1401
-
1402
- class SelectorListContext {
1403
- selectors;
1404
- alreadyMatched = false;
1405
- constructor(selectors) {
1406
- this.selectors = selectors;
1407
- }
1408
- }
1409
-
1410
- class SelectorContext {
1411
- selector;
1412
- cbContext;
1413
- listContext;
1414
- notSelectors;
1415
- constructor(selector, cbContext, listContext) {
1416
- this.selector = selector;
1417
- this.cbContext = cbContext;
1418
- this.listContext = listContext;
1419
- this.notSelectors = selector.notSelectors;
1420
- }
1421
- finalize(cssSelector, callback) {
1422
- let result = true;
1423
- if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
1424
- const notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
1425
- result = !notMatcher.match(cssSelector, null);
1426
- }
1427
- if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
1428
- if (this.listContext) {
1429
- this.listContext.alreadyMatched = true;
1430
- }
1431
- callback(this.selector, this.cbContext);
1432
- }
1433
- return result;
1434
- }
1435
- }
1436
-
1437
- class SelectorlessMatcher {
1438
- registry;
1439
- constructor(registry) {
1440
- this.registry = registry;
1441
- }
1442
- match(name) {
1443
- return this.registry.has(name) ? this.registry.get(name) : [];
1444
- }
1445
- }
1446
- function parserSelectorToSimpleSelector(selector) {
1447
- const classes = selector.classNames && selector.classNames.length ? [8, ...selector.classNames] : [];
1448
- const elementName = selector.element && selector.element !== "*" ? selector.element : "";
1449
- return [elementName, ...selector.attrs, ...classes];
1450
- }
1451
- function parserSelectorToNegativeSelector(selector) {
1452
- const classes = selector.classNames && selector.classNames.length ? [8, ...selector.classNames] : [];
1453
- if (selector.element) {
1454
- return [1 | 4, selector.element, ...selector.attrs, ...classes];
1455
- } else if (selector.attrs.length) {
1456
- return [1 | 2, ...selector.attrs, ...classes];
1457
- } else {
1458
- return selector.classNames && selector.classNames.length ? [1 | 8, ...selector.classNames] : [];
1459
- }
1460
- }
1461
- function parserSelectorToR3Selector(selector) {
1462
- const positive = parserSelectorToSimpleSelector(selector);
1463
- const negative = selector.notSelectors && selector.notSelectors.length ? selector.notSelectors.map((notSelector) => parserSelectorToNegativeSelector(notSelector)) : [];
1464
- return positive.concat(...negative);
1465
- }
1466
- function parseSelectorToR3Selector(selector) {
1467
- return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
1468
- }
1469
- function digest$1(message) {
1470
- return message.id || computeDigest(message);
1471
- }
1472
- function computeDigest(message) {
1473
- return sha1(serializeNodes(message.nodes).join("") + `[${message.meaning}]`);
1474
- }
1475
- function decimalDigest(message) {
1476
- return message.id || computeDecimalDigest(message);
1477
- }
1478
- function computeDecimalDigest(message) {
1479
- const visitor = new _SerializerIgnoreIcuExpVisitor;
1480
- const parts = message.nodes.map((a) => a.visit(visitor, null));
1481
- return computeMsgId(parts.join(""), message.meaning);
1482
- }
1483
-
1484
- class _SerializerVisitor {
1485
- visitText(text, context) {
1486
- return text.value;
1487
- }
1488
- visitContainer(container, context) {
1489
- return `[${container.children.map((child) => child.visit(this)).join(", ")}]`;
1490
- }
1491
- visitIcu(icu, context) {
1492
- const strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
1493
- return `{${icu.expression}, ${icu.type}, ${strCases.join(", ")}}`;
1494
- }
1495
- visitTagPlaceholder(ph, context) {
1496
- return ph.isVoid ? `<ph tag name="${ph.startName}"/>` : `<ph tag name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
1497
- }
1498
- visitPlaceholder(ph, context) {
1499
- return ph.value ? `<ph name="${ph.name}">${ph.value}</ph>` : `<ph name="${ph.name}"/>`;
1500
- }
1501
- visitIcuPlaceholder(ph, context) {
1502
- return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
1503
- }
1504
- visitBlockPlaceholder(ph, context) {
1505
- return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
1506
- }
1507
- }
1508
- function serializeNodes(nodes) {
1509
- return nodes.map((a) => a.visit(serializerVisitor$1, null));
1510
- }
1511
- function sha1(str) {
1512
- textEncoder ??= new TextEncoder;
1513
- const utf8 = [...textEncoder.encode(str)];
1514
- const words32 = bytesToWords32(utf8, Endian.Big);
1515
- const len = utf8.length * 8;
1516
- const w = new Uint32Array(80);
1517
- let a = 1732584193, b = 4023233417, c = 2562383102, d = 271733878, e = 3285377520;
1518
- words32[len >> 5] |= 128 << 24 - len % 32;
1519
- words32[(len + 64 >> 9 << 4) + 15] = len;
1520
- for (let i = 0;i < words32.length; i += 16) {
1521
- const h0 = a, h1 = b, h2 = c, h3 = d, h4 = e;
1522
- for (let j = 0;j < 80; j++) {
1523
- if (j < 16) {
1524
- w[j] = words32[i + j];
1525
- } else {
1526
- w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
1527
- }
1528
- const fkVal = fk(j, b, c, d);
1529
- const f = fkVal[0];
1530
- const k = fkVal[1];
1531
- const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
1532
- e = d;
1533
- d = c;
1534
- c = rol32(b, 30);
1535
- b = a;
1536
- a = temp;
1537
- }
1538
- a = add32(a, h0);
1539
- b = add32(b, h1);
1540
- c = add32(c, h2);
1541
- d = add32(d, h3);
1542
- e = add32(e, h4);
1543
- }
1544
- return toHexU32(a) + toHexU32(b) + toHexU32(c) + toHexU32(d) + toHexU32(e);
1545
- }
1546
- function toHexU32(value) {
1547
- return (value >>> 0).toString(16).padStart(8, "0");
1548
- }
1549
- function fk(index, b, c, d) {
1550
- if (index < 20) {
1551
- return [b & c | ~b & d, 1518500249];
1552
- }
1553
- if (index < 40) {
1554
- return [b ^ c ^ d, 1859775393];
1555
- }
1556
- if (index < 60) {
1557
- return [b & c | b & d | c & d, 2400959708];
1558
- }
1559
- return [b ^ c ^ d, 3395469782];
1560
- }
1561
- function fingerprint(str) {
1562
- textEncoder ??= new TextEncoder;
1563
- const utf8 = textEncoder.encode(str);
1564
- const view = new DataView(utf8.buffer, utf8.byteOffset, utf8.byteLength);
1565
- let hi = hash32(view, utf8.length, 0);
1566
- let lo = hash32(view, utf8.length, 102072);
1567
- if (hi == 0 && (lo == 0 || lo == 1)) {
1568
- hi = hi ^ 319790063;
1569
- lo = lo ^ -1801410264;
1570
- }
1571
- return BigInt.asUintN(32, BigInt(hi)) << BigInt(32) | BigInt.asUintN(32, BigInt(lo));
1572
- }
1573
- function computeMsgId(msg, meaning = "") {
1574
- let msgFingerprint = fingerprint(msg);
1575
- if (meaning) {
1576
- msgFingerprint = BigInt.asUintN(64, msgFingerprint << BigInt(1)) | msgFingerprint >> BigInt(63) & BigInt(1);
1577
- msgFingerprint += fingerprint(meaning);
1578
- }
1579
- return BigInt.asUintN(63, msgFingerprint).toString();
1580
- }
1581
- function hash32(view, length, c) {
1582
- let a = 2654435769, b = 2654435769;
1583
- let index = 0;
1584
- const end = length - 12;
1585
- for (;index <= end; index += 12) {
1586
- a += view.getUint32(index, true);
1587
- b += view.getUint32(index + 4, true);
1588
- c += view.getUint32(index + 8, true);
1589
- const res = mix(a, b, c);
1590
- a = res[0], b = res[1], c = res[2];
1591
- }
1592
- const remainder = length - index;
1593
- c += length;
1594
- if (remainder >= 4) {
1595
- a += view.getUint32(index, true);
1596
- index += 4;
1597
- if (remainder >= 8) {
1598
- b += view.getUint32(index, true);
1599
- index += 4;
1600
- if (remainder >= 9) {
1601
- c += view.getUint8(index++) << 8;
1602
- }
1603
- if (remainder >= 10) {
1604
- c += view.getUint8(index++) << 16;
1605
- }
1606
- if (remainder === 11) {
1607
- c += view.getUint8(index++) << 24;
1608
- }
1609
- } else {
1610
- if (remainder >= 5) {
1611
- b += view.getUint8(index++);
1612
- }
1613
- if (remainder >= 6) {
1614
- b += view.getUint8(index++) << 8;
1615
- }
1616
- if (remainder === 7) {
1617
- b += view.getUint8(index++) << 16;
1618
- }
1619
- }
1620
- } else {
1621
- if (remainder >= 1) {
1622
- a += view.getUint8(index++);
1623
- }
1624
- if (remainder >= 2) {
1625
- a += view.getUint8(index++) << 8;
1626
- }
1627
- if (remainder === 3) {
1628
- a += view.getUint8(index++) << 16;
1629
- }
1630
- }
1631
- return mix(a, b, c)[2];
1632
- }
1633
- function mix(a, b, c) {
1634
- a -= b;
1635
- a -= c;
1636
- a ^= c >>> 13;
1637
- b -= c;
1638
- b -= a;
1639
- b ^= a << 8;
1640
- c -= a;
1641
- c -= b;
1642
- c ^= b >>> 13;
1643
- a -= b;
1644
- a -= c;
1645
- a ^= c >>> 12;
1646
- b -= c;
1647
- b -= a;
1648
- b ^= a << 16;
1649
- c -= a;
1650
- c -= b;
1651
- c ^= b >>> 5;
1652
- a -= b;
1653
- a -= c;
1654
- a ^= c >>> 3;
1655
- b -= c;
1656
- b -= a;
1657
- b ^= a << 10;
1658
- c -= a;
1659
- c -= b;
1660
- c ^= b >>> 15;
1661
- return [a, b, c];
1662
- }
1663
- function add32(a, b) {
1664
- return add32to64(a, b)[1];
1665
- }
1666
- function add32to64(a, b) {
1667
- const low = (a & 65535) + (b & 65535);
1668
- const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
1669
- return [high >>> 16, high << 16 | low & 65535];
1670
- }
1671
- function rol32(a, count) {
1672
- return a << count | a >>> 32 - count;
1673
- }
1674
- function bytesToWords32(bytes, endian) {
1675
- const size = bytes.length + 3 >>> 2;
1676
- const words32 = [];
1677
- for (let i = 0;i < size; i++) {
1678
- words32[i] = wordAt(bytes, i * 4, endian);
1679
- }
1680
- return words32;
1681
- }
1682
- function byteAt(bytes, index) {
1683
- return index >= bytes.length ? 0 : bytes[index];
1684
- }
1685
- function wordAt(bytes, index, endian) {
1686
- let word = 0;
1687
- if (endian === Endian.Big) {
1688
- for (let i = 0;i < 4; i++) {
1689
- word += byteAt(bytes, index + i) << 24 - 8 * i;
1690
- }
1691
- } else {
1692
- for (let i = 0;i < 4; i++) {
1693
- word += byteAt(bytes, index + i) << 8 * i;
1694
- }
1695
- }
1696
- return word;
1697
- }
1698
-
1699
- class Type {
1700
- modifiers;
1701
- constructor(modifiers = TypeModifier.None) {
1702
- this.modifiers = modifiers;
1703
- }
1704
- hasModifier(modifier) {
1705
- return (this.modifiers & modifier) !== 0;
1706
- }
1707
- }
1708
- function nullSafeIsEquivalent(base, other) {
1709
- if (base == null || other == null) {
1710
- return base == other;
1711
- }
1712
- return base.isEquivalent(other);
1713
- }
1714
- function areAllEquivalentPredicate(base, other, equivalentPredicate) {
1715
- const len = base.length;
1716
- if (len !== other.length) {
1717
- return false;
1718
- }
1719
- for (let i = 0;i < len; i++) {
1720
- if (!equivalentPredicate(base[i], other[i])) {
1721
- return false;
1722
- }
1723
- }
1724
- return true;
1725
- }
1726
- function areAllEquivalent(base, other) {
1727
- return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));
1728
- }
1729
-
1730
- class Expression {
1731
- type;
1732
- sourceSpan;
1733
- constructor(type, sourceSpan) {
1734
- this.type = type || null;
1735
- this.sourceSpan = sourceSpan || null;
1736
- }
1737
- prop(name, sourceSpan) {
1738
- return new ReadPropExpr(this, name, null, sourceSpan);
1739
- }
1740
- key(index, type, sourceSpan) {
1741
- return new ReadKeyExpr(this, index, type, sourceSpan);
1742
- }
1743
- callFn(params, sourceSpan, pure) {
1744
- return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
1745
- }
1746
- instantiate(params, type, sourceSpan) {
1747
- return new InstantiateExpr(this, params, type, sourceSpan);
1748
- }
1749
- conditional(trueCase, falseCase = null, sourceSpan) {
1750
- return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
1751
- }
1752
- equals(rhs, sourceSpan) {
1753
- return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
1754
- }
1755
- notEquals(rhs, sourceSpan) {
1756
- return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
1757
- }
1758
- identical(rhs, sourceSpan) {
1759
- return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
1760
- }
1761
- notIdentical(rhs, sourceSpan) {
1762
- return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
1763
- }
1764
- minus(rhs, sourceSpan) {
1765
- return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
1766
- }
1767
- plus(rhs, sourceSpan) {
1768
- return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
1769
- }
1770
- divide(rhs, sourceSpan) {
1771
- return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
991
+ divide(rhs, sourceSpan) {
992
+ return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
1772
993
  }
1773
994
  multiply(rhs, sourceSpan) {
1774
995
  return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
@@ -29882,194 +29103,973 @@ ${errors.join(`
29882
29103
  i18nNodesByMsgId
29883
29104
  };
29884
29105
  }
29885
- digest(message) {
29886
- return digest$1(message);
29106
+ digest(message) {
29107
+ return digest$1(message);
29108
+ }
29109
+ };
29110
+ Xliff2 = class Xliff2 extends Serializer {
29111
+ write(messages, locale) {
29112
+ const visitor = new _WriteVisitor2;
29113
+ const units = [];
29114
+ messages.forEach((message) => {
29115
+ const unit = new Tag(_UNIT_TAG, {
29116
+ id: message.id
29117
+ });
29118
+ const notes = new Tag("notes");
29119
+ if (message.description || message.meaning) {
29120
+ if (message.description) {
29121
+ notes.children.push(new CR(8), new Tag("note", {
29122
+ category: "description"
29123
+ }, [new Text$1(message.description)]));
29124
+ }
29125
+ if (message.meaning) {
29126
+ notes.children.push(new CR(8), new Tag("note", {
29127
+ category: "meaning"
29128
+ }, [new Text$1(message.meaning)]));
29129
+ }
29130
+ }
29131
+ message.sources.forEach((source) => {
29132
+ notes.children.push(new CR(8), new Tag("note", {
29133
+ category: "location"
29134
+ }, [new Text$1(`${source.filePath}:${source.startLine}${source.endLine !== source.startLine ? "," + source.endLine : ""}`)]));
29135
+ });
29136
+ notes.children.push(new CR(6));
29137
+ unit.children.push(new CR(6), notes);
29138
+ const segment = new Tag("segment");
29139
+ segment.children.push(new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes)), new CR(6));
29140
+ unit.children.push(new CR(6), segment, new CR(4));
29141
+ units.push(new CR(4), unit);
29142
+ });
29143
+ const file = new Tag("file", {
29144
+ original: "ng.template",
29145
+ id: "ngi18n"
29146
+ }, [...units, new CR(2)]);
29147
+ const xliff = new Tag(_XLIFF_TAG, {
29148
+ version: _VERSION,
29149
+ xmlns: _XMLNS,
29150
+ srcLang: locale || _DEFAULT_SOURCE_LANG
29151
+ }, [new CR(2), file, new CR]);
29152
+ return serialize$1([new Declaration({
29153
+ version: "1.0",
29154
+ encoding: "UTF-8"
29155
+ }), new CR, xliff, new CR]);
29156
+ }
29157
+ load(content, url) {
29158
+ const xliff2Parser = new Xliff2Parser;
29159
+ const {
29160
+ locale,
29161
+ msgIdToHtml,
29162
+ errors
29163
+ } = xliff2Parser.parse(content, url);
29164
+ const i18nNodesByMsgId = {};
29165
+ const converter = new XmlToI18n$1;
29166
+ Object.keys(msgIdToHtml).forEach((msgId) => {
29167
+ const {
29168
+ i18nNodes,
29169
+ errors: e
29170
+ } = converter.convert(msgIdToHtml[msgId], url);
29171
+ errors.push(...e);
29172
+ i18nNodesByMsgId[msgId] = i18nNodes;
29173
+ });
29174
+ if (errors.length) {
29175
+ throw new Error(`xliff2 parse errors:
29176
+ ${errors.join(`
29177
+ `)}`);
29178
+ }
29179
+ return {
29180
+ locale,
29181
+ i18nNodesByMsgId
29182
+ };
29183
+ }
29184
+ digest(message) {
29185
+ return decimalDigest(message);
29186
+ }
29187
+ };
29188
+ Xtb = class Xtb extends Serializer {
29189
+ write(messages, locale) {
29190
+ throw new Error("Unsupported");
29191
+ }
29192
+ load(content, url) {
29193
+ const xtbParser = new XtbParser;
29194
+ const {
29195
+ locale,
29196
+ msgIdToHtml,
29197
+ errors
29198
+ } = xtbParser.parse(content, url);
29199
+ const i18nNodesByMsgId = {};
29200
+ const converter = new XmlToI18n3;
29201
+ Object.keys(msgIdToHtml).forEach((msgId) => {
29202
+ const valueFn = function() {
29203
+ const {
29204
+ i18nNodes,
29205
+ errors: errors2
29206
+ } = converter.convert(msgIdToHtml[msgId], url);
29207
+ if (errors2.length) {
29208
+ throw new Error(`xtb parse errors:
29209
+ ${errors2.join(`
29210
+ `)}`);
29211
+ }
29212
+ return i18nNodes;
29213
+ };
29214
+ createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
29215
+ });
29216
+ if (errors.length) {
29217
+ throw new Error(`xtb parse errors:
29218
+ ${errors.join(`
29219
+ `)}`);
29220
+ }
29221
+ return {
29222
+ locale,
29223
+ i18nNodesByMsgId
29224
+ };
29225
+ }
29226
+ digest(message) {
29227
+ return digest(message);
29228
+ }
29229
+ createNameMapper(message) {
29230
+ return new SimplePlaceholderMapper(message, toPublicName);
29231
+ }
29232
+ };
29233
+ MapPlaceholderNames = class MapPlaceholderNames extends CloneVisitor {
29234
+ convert(nodes, mapper) {
29235
+ return mapper ? nodes.map((n) => n.visit(this, mapper)) : nodes;
29236
+ }
29237
+ visitTagPlaceholder(ph, mapper) {
29238
+ const startName = mapper.toPublicName(ph.startName);
29239
+ const closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
29240
+ const children = ph.children.map((n) => n.visit(this, mapper));
29241
+ return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
29242
+ }
29243
+ visitBlockPlaceholder(ph, mapper) {
29244
+ const startName = mapper.toPublicName(ph.startName);
29245
+ const closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
29246
+ const children = ph.children.map((n) => n.visit(this, mapper));
29247
+ return new BlockPlaceholder(ph.name, ph.parameters, startName, closeName, children, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
29248
+ }
29249
+ visitPlaceholder(ph, mapper) {
29250
+ return new Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
29251
+ }
29252
+ visitIcuPlaceholder(ph, mapper) {
29253
+ return new IcuPlaceholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
29254
+ }
29255
+ };
29256
+ BlockPresenceVisitor = class BlockPresenceVisitor extends RecursiveVisitor$1 {
29257
+ hasBlocks = false;
29258
+ visitDeferredBlock() {
29259
+ this.hasBlocks = true;
29260
+ }
29261
+ visitDeferredBlockPlaceholder() {
29262
+ this.hasBlocks = true;
29263
+ }
29264
+ visitDeferredBlockLoading() {
29265
+ this.hasBlocks = true;
29266
+ }
29267
+ visitDeferredBlockError() {
29268
+ this.hasBlocks = true;
29269
+ }
29270
+ visitIfBlock() {
29271
+ this.hasBlocks = true;
29272
+ }
29273
+ visitIfBlockBranch() {
29274
+ this.hasBlocks = true;
29275
+ }
29276
+ visitForLoopBlock() {
29277
+ this.hasBlocks = true;
29278
+ }
29279
+ visitForLoopBlockEmpty() {
29280
+ this.hasBlocks = true;
29281
+ }
29282
+ visitSwitchBlock() {
29283
+ this.hasBlocks = true;
29284
+ }
29285
+ visitSwitchBlockCase() {
29286
+ this.hasBlocks = true;
29287
+ }
29288
+ visitSwitchBlockCaseGroup() {
29289
+ this.hasBlocks = true;
29290
+ }
29291
+ };
29292
+ VERSION = new Version("21.2.6");
29293
+ publishFacade(_global);
29294
+ });
29295
+
29296
+ // src/utils/escapeScriptContent.ts
29297
+ var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
29298
+ const escaped = ESCAPE_LOOKUP[char];
29299
+ return escaped !== undefined ? escaped : char;
29300
+ });
29301
+ var init_escapeScriptContent = __esm(() => {
29302
+ ESCAPE_LOOKUP = {
29303
+ "\u2028": "\\u2028",
29304
+ "\u2029": "\\u2029",
29305
+ "&": "\\u0026",
29306
+ "<": "\\u003C",
29307
+ ">": "\\u003E"
29308
+ };
29309
+ ESCAPE_REGEX = /[&><\u2028\u2029]/g;
29310
+ });
29311
+
29312
+ // src/constants.ts
29313
+ var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000;
29314
+ var init_constants = __esm(() => {
29315
+ MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
29316
+ MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
29317
+ TWO_THIRDS = 2 / 3;
29318
+ });
29319
+
29320
+ // src/core/islandPageContext.ts
29321
+ var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG2 = "</head>", buildIslandsHeadMarkup = (manifest) => {
29322
+ const manifestScript = `<script>window.__ABSOLUTE_MANIFEST__ = ${JSON.stringify(manifest)}</script>`;
29323
+ const islandStateScript = `<script>window.__ABS_ISLAND_STATE__ = ${JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {})}</script>`;
29324
+ const bootstrapPath = manifest[BOOTSTRAP_MANIFEST_KEY];
29325
+ const bootstrapScript = bootstrapPath ? `<script type="module" src="${bootstrapPath}"></script>` : "";
29326
+ return `${manifestScript}${islandStateScript}${bootstrapScript}`;
29327
+ }, injectHeadMarkup = (html, markup) => {
29328
+ const closingHeadIndex = html.indexOf("</head>");
29329
+ if (closingHeadIndex >= 0) {
29330
+ return `${html.slice(0, closingHeadIndex)}${markup}${html.slice(closingHeadIndex)}`;
29331
+ }
29332
+ const openingBodyIndex = html.indexOf("<body");
29333
+ if (openingBodyIndex >= 0) {
29334
+ const bodyStart = html.indexOf(">", openingBodyIndex);
29335
+ if (bodyStart >= 0) {
29336
+ return `${html.slice(0, openingBodyIndex)}<head>${markup}</head>${html.slice(openingBodyIndex)}`;
29337
+ }
29338
+ }
29339
+ return `<!DOCTYPE html><html><head>${markup}</head><body>${html}</body></html>`;
29340
+ }, streamChunkToString2 = (value, decoder) => typeof value === "string" ? value : decoder.decode(value, { stream: true }), pipeStreamWithHeadInjection = (stream, markup) => {
29341
+ const encoder = new TextEncoder;
29342
+ const decoder = new TextDecoder;
29343
+ const lookbehind = CLOSING_HEAD_TAG2.length - 1;
29344
+ return new ReadableStream({
29345
+ async start(controller) {
29346
+ const reader = stream.getReader();
29347
+ let injected = false;
29348
+ let pending = "";
29349
+ try {
29350
+ for (;; ) {
29351
+ const { done, value } = await reader.read();
29352
+ if (done)
29353
+ break;
29354
+ if (!value)
29355
+ continue;
29356
+ pending += streamChunkToString2(value, decoder);
29357
+ if (injected) {
29358
+ controller.enqueue(encoder.encode(pending));
29359
+ pending = "";
29360
+ continue;
29361
+ }
29362
+ const headIndex = pending.indexOf(CLOSING_HEAD_TAG2);
29363
+ if (headIndex >= 0) {
29364
+ const next = `${pending.slice(0, headIndex)}${markup}${pending.slice(headIndex)}`;
29365
+ controller.enqueue(encoder.encode(next));
29366
+ pending = "";
29367
+ injected = true;
29368
+ continue;
29369
+ }
29370
+ if (pending.length > lookbehind) {
29371
+ const safeText = pending.slice(0, pending.length - lookbehind);
29372
+ controller.enqueue(encoder.encode(safeText));
29373
+ pending = pending.slice(-lookbehind);
29374
+ }
29375
+ }
29376
+ pending += decoder.decode();
29377
+ if (!injected) {
29378
+ pending = injectHeadMarkup(pending, markup);
29379
+ }
29380
+ if (pending.length > 0) {
29381
+ controller.enqueue(encoder.encode(pending));
29382
+ }
29383
+ controller.close();
29384
+ } catch (error) {
29385
+ controller.error(error);
29386
+ }
29387
+ }
29388
+ });
29389
+ }, pipeStreamWithIslandMarkerDetection = (stream, markup) => {
29390
+ const encoder = new TextEncoder;
29391
+ const decoder = new TextDecoder;
29392
+ const lookbehind = Math.max(ISLAND_MARKER.length, 1024);
29393
+ return new ReadableStream({
29394
+ async start(controller) {
29395
+ const reader = stream.getReader();
29396
+ let injected = false;
29397
+ let pending = "";
29398
+ try {
29399
+ for (;; ) {
29400
+ const { done, value } = await reader.read();
29401
+ if (done)
29402
+ break;
29403
+ if (!value)
29404
+ continue;
29405
+ pending += streamChunkToString2(value, decoder);
29406
+ if (injected) {
29407
+ controller.enqueue(encoder.encode(pending));
29408
+ pending = "";
29409
+ continue;
29410
+ }
29411
+ const markerIndex = pending.indexOf(ISLAND_MARKER);
29412
+ if (markerIndex >= 0) {
29413
+ const tagStart = pending.lastIndexOf("<", markerIndex);
29414
+ const injectAt = tagStart >= 0 ? tagStart : markerIndex;
29415
+ const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
29416
+ controller.enqueue(encoder.encode(next));
29417
+ pending = "";
29418
+ injected = true;
29419
+ continue;
29420
+ }
29421
+ if (pending.length > lookbehind) {
29422
+ const safeText = pending.slice(0, pending.length - lookbehind);
29423
+ controller.enqueue(encoder.encode(safeText));
29424
+ pending = pending.slice(-lookbehind);
29425
+ }
29426
+ }
29427
+ pending += decoder.decode();
29428
+ if (pending.length > 0) {
29429
+ controller.enqueue(encoder.encode(pending));
29430
+ }
29431
+ controller.close();
29432
+ } catch (error) {
29433
+ controller.error(error);
29434
+ }
29435
+ }
29436
+ });
29437
+ }, htmlContainsIslands = (html) => html.includes(ISLAND_MARKER), injectIslandPageContext = (html, options) => {
29438
+ const manifest = globalThis.__absoluteManifest;
29439
+ const hasIslands = options?.hasIslands ?? htmlContainsIslands(html);
29440
+ if (!manifest || !hasIslands) {
29441
+ return html;
29442
+ }
29443
+ if (html.includes(MANIFEST_MARKER) || html.includes(ISLAND_STATE_MARKER)) {
29444
+ return html;
29445
+ }
29446
+ return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
29447
+ }, injectIslandPageContextStream = (stream, options) => {
29448
+ const manifest = globalThis.__absoluteManifest;
29449
+ if (!manifest)
29450
+ return stream;
29451
+ const markup = buildIslandsHeadMarkup(manifest);
29452
+ if (options?.hasIslands === true) {
29453
+ return pipeStreamWithHeadInjection(stream, markup);
29454
+ }
29455
+ if (options?.hasIslands === false) {
29456
+ return stream;
29457
+ }
29458
+ return pipeStreamWithIslandMarkerDetection(stream, markup);
29459
+ }, setCurrentIslandManifest = (manifest) => {
29460
+ globalThis.__absoluteManifest = manifest;
29461
+ };
29462
+
29463
+ // src/utils/ssrErrorPage.ts
29464
+ var ssrErrorPage = (framework, error) => {
29465
+ const frameworkColors = {
29466
+ angular: "#dd0031",
29467
+ html: "#e34c26",
29468
+ htmx: "#1a365d",
29469
+ react: "#61dafb",
29470
+ svelte: "#ff3e00",
29471
+ vue: "#42b883"
29472
+ };
29473
+ const accent = frameworkColors[framework] ?? "#94a3b8";
29474
+ const label = framework.charAt(0).toUpperCase() + framework.slice(1);
29475
+ const message = error instanceof Error ? error.message : String(error);
29476
+ return `<!DOCTYPE html>
29477
+ <html>
29478
+ <head>
29479
+ <meta charset="utf-8">
29480
+ <meta name="viewport" content="width=device-width, initial-scale=1">
29481
+ <title>SSR Error - AbsoluteJS</title>
29482
+ <style>
29483
+ *{margin:0;padding:0;box-sizing:border-box}
29484
+ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}
29485
+ .card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}
29486
+ .header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}
29487
+ .brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
29488
+ .badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}
29489
+ .kind{color:#94a3b8;font-size:13px;font-weight:500}
29490
+ .content{padding:24px}
29491
+ .label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
29492
+ .message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}
29493
+ .hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}
29494
+ </style>
29495
+ </head>
29496
+ <body>
29497
+ <div class="card">
29498
+ <div class="header">
29499
+ <div style="display:flex;align-items:center;gap:12px">
29500
+ <span class="brand">AbsoluteJS</span>
29501
+ <span class="badge">${label}</span>
29502
+ </div>
29503
+ <span class="kind">Server Render Error</span>
29504
+ </div>
29505
+ <div class="content">
29506
+ <div class="label">What went wrong</div>
29507
+ <pre class="message">${message.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</pre>
29508
+ <div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
29509
+ </div>
29510
+ </div>
29511
+ </body>
29512
+ </html>`;
29513
+ };
29514
+
29515
+ // src/utils/stringModifiers.ts
29516
+ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
29517
+ if (!str.includes("-") && !str.includes("_")) {
29518
+ return str.charAt(0).toUpperCase() + str.slice(1);
29519
+ }
29520
+ return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
29521
+ }, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
29522
+
29523
+ // src/utils/resolveConvention.ts
29524
+ import { basename } from "path";
29525
+ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
29526
+ const value = Reflect.get(globalThis, CONVENTIONS_KEY);
29527
+ if (isConventionsMap(value))
29528
+ return value;
29529
+ const empty = {};
29530
+ return empty;
29531
+ }, derivePageName = (pagePath) => {
29532
+ const base = basename(pagePath);
29533
+ const dotIndex = base.indexOf(".");
29534
+ const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
29535
+ return toPascal(name);
29536
+ }, resolveErrorConventionPath = (framework, pageName) => {
29537
+ const conventions = getMap()[framework];
29538
+ if (!conventions)
29539
+ return;
29540
+ return conventions.pages?.[pageName]?.error ?? conventions.defaults?.error;
29541
+ }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map) => {
29542
+ Reflect.set(globalThis, CONVENTIONS_KEY, map);
29543
+ }, isDev = () => true, buildErrorProps = (error) => {
29544
+ const message = error instanceof Error ? error.message : String(error);
29545
+ const stack = isDev() && error instanceof Error ? error.stack : undefined;
29546
+ return { error: { message, stack } };
29547
+ }, renderReactError = async (conventionPath, errorProps) => {
29548
+ const { createElement } = await import("react");
29549
+ const { renderToReadableStream } = await import("react-dom/server");
29550
+ const mod = await import(conventionPath);
29551
+ const [firstKey] = Object.keys(mod);
29552
+ const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
29553
+ const element2 = createElement(ErrorComponent, errorProps);
29554
+ const stream = await renderToReadableStream(element2);
29555
+ return new Response(stream, {
29556
+ headers: { "Content-Type": "text/html" },
29557
+ status: 500
29558
+ });
29559
+ }, renderSvelteError = async (conventionPath, errorProps) => {
29560
+ const { render } = await import("svelte/server");
29561
+ const mod = await import(conventionPath);
29562
+ const ErrorComponent = mod.default;
29563
+ const { head, body } = render(ErrorComponent, {
29564
+ props: errorProps
29565
+ });
29566
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
29567
+ return new Response(html, {
29568
+ headers: { "Content-Type": "text/html" },
29569
+ status: 500
29570
+ });
29571
+ }, unescapeVueStyles = (ssrBody) => {
29572
+ let styles = "";
29573
+ const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
29574
+ styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
29575
+ return "";
29576
+ });
29577
+ return { body, styles };
29578
+ }, renderVueError = async (conventionPath, errorProps) => {
29579
+ const { createSSRApp, h } = await import("vue");
29580
+ const { renderToString } = await import("vue/server-renderer");
29581
+ const mod = await import(conventionPath);
29582
+ const ErrorComponent = mod.default;
29583
+ const app = createSSRApp({
29584
+ render: () => h(ErrorComponent, errorProps)
29585
+ });
29586
+ const rawBody = await renderToString(app);
29587
+ const { styles, body } = unescapeVueStyles(rawBody);
29588
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
29589
+ return new Response(html, {
29590
+ headers: { "Content-Type": "text/html" },
29591
+ status: 500
29592
+ });
29593
+ }, renderAngularError = async (conventionPath, errorProps) => {
29594
+ const mod = await import(conventionPath);
29595
+ const renderError = mod.default ?? mod.renderError;
29596
+ if (typeof renderError !== "function")
29597
+ return null;
29598
+ const html = renderError(errorProps);
29599
+ return new Response(html, {
29600
+ headers: { "Content-Type": "text/html" },
29601
+ status: 500
29602
+ });
29603
+ }, logConventionRenderError = (framework, label, renderError) => {
29604
+ const message = renderError instanceof Error ? renderError.message : "";
29605
+ if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
29606
+ console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
29607
+ return;
29608
+ }
29609
+ console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
29610
+ }, ERROR_RENDERERS, renderConventionError = async (framework, pageName, error) => {
29611
+ const conventionPath = resolveErrorConventionPath(framework, pageName);
29612
+ if (!conventionPath)
29613
+ return null;
29614
+ const errorProps = buildErrorProps(error);
29615
+ const renderer = ERROR_RENDERERS[framework];
29616
+ if (!renderer)
29617
+ return null;
29618
+ try {
29619
+ return await renderer(conventionPath, errorProps);
29620
+ } catch (renderError) {
29621
+ logConventionRenderError(framework, "error", renderError);
29622
+ }
29623
+ return null;
29624
+ }, renderReactNotFound = async (conventionPath) => {
29625
+ const { createElement } = await import("react");
29626
+ const { renderToReadableStream } = await import("react-dom/server");
29627
+ const mod = await import(conventionPath);
29628
+ const [nfKey] = Object.keys(mod);
29629
+ const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
29630
+ const element2 = createElement(NotFoundComponent);
29631
+ const stream = await renderToReadableStream(element2);
29632
+ return new Response(stream, {
29633
+ headers: { "Content-Type": "text/html" },
29634
+ status: 404
29635
+ });
29636
+ }, renderSvelteNotFound = async (conventionPath) => {
29637
+ const { render } = await import("svelte/server");
29638
+ const mod = await import(conventionPath);
29639
+ const NotFoundComponent = mod.default;
29640
+ const { head, body } = render(NotFoundComponent);
29641
+ const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
29642
+ return new Response(html, {
29643
+ headers: { "Content-Type": "text/html" },
29644
+ status: 404
29645
+ });
29646
+ }, renderVueNotFound = async (conventionPath) => {
29647
+ const { createSSRApp, h } = await import("vue");
29648
+ const { renderToString } = await import("vue/server-renderer");
29649
+ const mod = await import(conventionPath);
29650
+ const NotFoundComponent = mod.default;
29651
+ const app = createSSRApp({
29652
+ render: () => h(NotFoundComponent)
29653
+ });
29654
+ const rawBody = await renderToString(app);
29655
+ const { styles, body } = unescapeVueStyles(rawBody);
29656
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
29657
+ return new Response(html, {
29658
+ headers: { "Content-Type": "text/html" },
29659
+ status: 404
29660
+ });
29661
+ }, renderAngularNotFound = async (conventionPath) => {
29662
+ const mod = await import(conventionPath);
29663
+ const renderNotFound = mod.default ?? mod.renderNotFound;
29664
+ if (typeof renderNotFound !== "function")
29665
+ return null;
29666
+ const html = renderNotFound();
29667
+ return new Response(html, {
29668
+ headers: { "Content-Type": "text/html" },
29669
+ status: 404
29670
+ });
29671
+ }, NOT_FOUND_RENDERERS, renderConventionNotFound = async (framework) => {
29672
+ const conventionPath = resolveNotFoundConventionPath(framework);
29673
+ if (!conventionPath)
29674
+ return null;
29675
+ const renderer = NOT_FOUND_RENDERERS[framework];
29676
+ if (!renderer)
29677
+ return null;
29678
+ try {
29679
+ return await renderer(conventionPath);
29680
+ } catch (renderError) {
29681
+ logConventionRenderError(framework, "not-found", renderError);
29682
+ }
29683
+ return null;
29684
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
29685
+ for (const framework of NOT_FOUND_PRIORITY) {
29686
+ if (!getMap()[framework]?.defaults?.notFound)
29687
+ continue;
29688
+ const response = await renderConventionNotFound(framework);
29689
+ if (response)
29690
+ return response;
29691
+ }
29692
+ return null;
29693
+ };
29694
+ var init_resolveConvention = __esm(() => {
29695
+ ERROR_RENDERERS = {
29696
+ angular: renderAngularError,
29697
+ react: renderReactError,
29698
+ svelte: renderSvelteError,
29699
+ vue: renderVueError
29700
+ };
29701
+ NOT_FOUND_RENDERERS = {
29702
+ angular: renderAngularNotFound,
29703
+ react: renderReactNotFound,
29704
+ svelte: renderSvelteNotFound,
29705
+ vue: renderVueNotFound
29706
+ };
29707
+ NOT_FOUND_PRIORITY = [
29708
+ "react",
29709
+ "svelte",
29710
+ "vue",
29711
+ "angular"
29712
+ ];
29713
+ });
29714
+
29715
+ // src/utils/registerClientScript.ts
29716
+ var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
29717
+ const id = requestId || getSsrContextId() || getRequestId();
29718
+ if (!scriptRegistry.has(id)) {
29719
+ scriptRegistry.set(id, new Set);
29720
+ }
29721
+ scriptRegistry.get(id)?.add(script);
29722
+ return id;
29723
+ }, setSsrContextGetter = (getter) => {
29724
+ ssrContextGetter = getter;
29725
+ }, clearAllClientScripts = () => {
29726
+ scriptRegistry.clear();
29727
+ }, generateClientScriptCode = (scripts) => {
29728
+ if (scripts.length === 0) {
29729
+ return "";
29730
+ }
29731
+ const scriptCode = scripts.map((script, index) => {
29732
+ const funcString = script.toString();
29733
+ const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
29734
+ if (!bodyMatch || !bodyMatch[1]) {
29735
+ return "";
29736
+ }
29737
+ const body = bodyMatch[1].trim();
29738
+ return `
29739
+ (function() {
29740
+ var executed = false;
29741
+ function executeScript_${index}() {
29742
+ if (executed) return;
29743
+ executed = true;
29744
+ ${body}
29745
+ }
29746
+
29747
+ if (document.readyState === 'complete' || document.readyState === 'interactive') {
29748
+ executeScript_${index}();
29749
+ } else {
29750
+ document.addEventListener('DOMContentLoaded', executeScript_${index});
29751
+ }
29752
+
29753
+ // Watch for hydration-added elements
29754
+ var observer = new MutationObserver(function() {
29755
+ executeScript_${index}();
29756
+ if (executed) observer.disconnect();
29757
+ });
29758
+ if (!executed) {
29759
+ observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
29760
+ }
29761
+
29762
+ // Single fallback timeout
29763
+ setTimeout(function() {
29764
+ executeScript_${index}();
29765
+ observer.disconnect();
29766
+ }, 1000);
29767
+ })();`;
29768
+ }).join(`
29769
+ `);
29770
+ return `<script>
29771
+ (function() {
29772
+ ${scriptCode}
29773
+ })();
29774
+ </script>`;
29775
+ }, getAndClearClientScripts = (requestId) => {
29776
+ const id = requestId || ssrContextGetter?.();
29777
+ if (!id)
29778
+ return [];
29779
+ const scripts = scriptRegistry.get(id);
29780
+ if (!scripts) {
29781
+ return [];
29782
+ }
29783
+ const scriptArray = Array.from(scripts);
29784
+ scriptRegistry.delete(id);
29785
+ return scriptArray;
29786
+ };
29787
+ var init_registerClientScript = __esm(() => {
29788
+ scriptRegistry = new Map;
29789
+ if (typeof globalThis !== "undefined") {
29790
+ Object.assign(globalThis, { registerClientScript });
29791
+ }
29792
+ });
29793
+
29794
+ // src/angular/injectorPatch.ts
29795
+ import { existsSync, readFileSync, writeFileSync } from "fs";
29796
+ import { dirname, join, resolve } from "path";
29797
+ var applyInjectorPatch = (chunkPath, content) => {
29798
+ if (content.includes('Symbol.for("angular.currentInjector")')) {
29799
+ return;
29800
+ }
29801
+ const original = [
29802
+ "let _currentInjector = undefined;",
29803
+ "function getCurrentInjector() {",
29804
+ " return _currentInjector;",
29805
+ "}",
29806
+ "function setCurrentInjector(injector) {",
29807
+ " const former = _currentInjector;",
29808
+ " _currentInjector = injector;",
29809
+ " return former;",
29810
+ "}"
29811
+ ].join(`
29812
+ `);
29813
+ const replacement = [
29814
+ 'const _injSym = Symbol.for("angular.currentInjector");',
29815
+ "if (!globalThis[_injSym]) globalThis[_injSym] = { v: undefined };",
29816
+ "function getCurrentInjector() {",
29817
+ " return globalThis[_injSym].v;",
29818
+ "}",
29819
+ "function setCurrentInjector(injector) {",
29820
+ " const former = globalThis[_injSym].v;",
29821
+ " globalThis[_injSym].v = injector;",
29822
+ " return former;",
29823
+ "}"
29824
+ ].join(`
29825
+ `);
29826
+ const patched = content.replace(original, replacement);
29827
+ if (patched === content) {
29828
+ return;
29829
+ }
29830
+ writeFileSync(chunkPath, patched, "utf-8");
29831
+ }, resolveAngularCoreDir = () => {
29832
+ const fromProject = resolve(process.cwd(), "node_modules/@angular/core");
29833
+ if (existsSync(join(fromProject, "package.json"))) {
29834
+ return fromProject;
29835
+ }
29836
+ return dirname(__require.resolve("@angular/core/package.json"));
29837
+ }, patchAngularInjectorSingleton = () => {
29838
+ try {
29839
+ const coreDir = resolveAngularCoreDir();
29840
+ const chunkPath = join(coreDir, "fesm2022", "_not_found-chunk.mjs");
29841
+ const content = readFileSync(chunkPath, "utf-8");
29842
+ applyInjectorPatch(chunkPath, content);
29843
+ } catch {}
29844
+ };
29845
+ var init_injectorPatch = __esm(() => {
29846
+ patchAngularInjectorSingleton();
29847
+ });
29848
+
29849
+ // src/angular/resolveAngularPackage.ts
29850
+ import { existsSync as existsSync2 } from "fs";
29851
+ import { resolve as resolve2 } from "path";
29852
+ var resolveAngularPackage = (specifier) => {
29853
+ const fromProject = resolve2(process.cwd(), "node_modules", specifier);
29854
+ if (existsSync2(fromProject)) {
29855
+ return fromProject;
29856
+ }
29857
+ return specifier;
29858
+ };
29859
+ var init_resolveAngularPackage = () => {};
29860
+
29861
+ // src/angular/angularPatch.ts
29862
+ var exports_angularPatch = {};
29863
+ __export(exports_angularPatch, {
29864
+ applyPatches: () => applyPatches
29865
+ });
29866
+ var ensureHead = (doc) => {
29867
+ if (!doc || doc.head || !doc.documentElement) {
29868
+ return;
29869
+ }
29870
+ const head = doc.createElement("head");
29871
+ doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
29872
+ }, applyPatches = async () => {
29873
+ const { \u{275}DominoAdapter } = await import(resolveAngularPackage("@angular/platform-server"));
29874
+ if (!\u{275}DominoAdapter?.prototype) {
29875
+ console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
29876
+ return false;
29877
+ }
29878
+ const proto = \u{275}DominoAdapter.prototype;
29879
+ const origGetBaseHref = proto.getBaseHref;
29880
+ proto.getBaseHref = function(doc) {
29881
+ if (!doc || !doc.head || typeof doc.head.children === "undefined") {
29882
+ return "";
29887
29883
  }
29884
+ return origGetBaseHref.call(this, doc);
29888
29885
  };
29889
- Xliff2 = class Xliff2 extends Serializer {
29890
- write(messages, locale) {
29891
- const visitor = new _WriteVisitor2;
29892
- const units = [];
29893
- messages.forEach((message) => {
29894
- const unit = new Tag(_UNIT_TAG, {
29895
- id: message.id
29896
- });
29897
- const notes = new Tag("notes");
29898
- if (message.description || message.meaning) {
29899
- if (message.description) {
29900
- notes.children.push(new CR(8), new Tag("note", {
29901
- category: "description"
29902
- }, [new Text$1(message.description)]));
29903
- }
29904
- if (message.meaning) {
29905
- notes.children.push(new CR(8), new Tag("note", {
29906
- category: "meaning"
29907
- }, [new Text$1(message.meaning)]));
29908
- }
29909
- }
29910
- message.sources.forEach((source) => {
29911
- notes.children.push(new CR(8), new Tag("note", {
29912
- category: "location"
29913
- }, [new Text$1(`${source.filePath}:${source.startLine}${source.endLine !== source.startLine ? "," + source.endLine : ""}`)]));
29914
- });
29915
- notes.children.push(new CR(6));
29916
- unit.children.push(new CR(6), notes);
29917
- const segment = new Tag("segment");
29918
- segment.children.push(new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes)), new CR(6));
29919
- unit.children.push(new CR(6), segment, new CR(4));
29920
- units.push(new CR(4), unit);
29921
- });
29922
- const file = new Tag("file", {
29923
- original: "ng.template",
29924
- id: "ngi18n"
29925
- }, [...units, new CR(2)]);
29926
- const xliff = new Tag(_XLIFF_TAG, {
29927
- version: _VERSION,
29928
- xmlns: _XMLNS,
29929
- srcLang: locale || _DEFAULT_SOURCE_LANG
29930
- }, [new CR(2), file, new CR]);
29931
- return serialize$1([new Declaration({
29932
- version: "1.0",
29933
- encoding: "UTF-8"
29934
- }), new CR, xliff, new CR]);
29935
- }
29936
- load(content, url) {
29937
- const xliff2Parser = new Xliff2Parser;
29938
- const {
29939
- locale,
29940
- msgIdToHtml,
29941
- errors
29942
- } = xliff2Parser.parse(content, url);
29943
- const i18nNodesByMsgId = {};
29944
- const converter = new XmlToI18n$1;
29945
- Object.keys(msgIdToHtml).forEach((msgId) => {
29946
- const {
29947
- i18nNodes,
29948
- errors: e
29949
- } = converter.convert(msgIdToHtml[msgId], url);
29950
- errors.push(...e);
29951
- i18nNodesByMsgId[msgId] = i18nNodes;
29952
- });
29953
- if (errors.length) {
29954
- throw new Error(`xliff2 parse errors:
29955
- ${errors.join(`
29956
- `)}`);
29957
- }
29958
- return {
29959
- locale,
29960
- i18nNodesByMsgId
29961
- };
29962
- }
29963
- digest(message) {
29964
- return decimalDigest(message);
29965
- }
29886
+ const origCreateHtmlDocument = proto.createHtmlDocument;
29887
+ proto.createHtmlDocument = function() {
29888
+ const doc = origCreateHtmlDocument.call(this);
29889
+ ensureHead(doc);
29890
+ return doc;
29966
29891
  };
29967
- Xtb = class Xtb extends Serializer {
29968
- write(messages, locale) {
29969
- throw new Error("Unsupported");
29970
- }
29971
- load(content, url) {
29972
- const xtbParser = new XtbParser;
29973
- const {
29974
- locale,
29975
- msgIdToHtml,
29976
- errors
29977
- } = xtbParser.parse(content, url);
29978
- const i18nNodesByMsgId = {};
29979
- const converter = new XmlToI18n3;
29980
- Object.keys(msgIdToHtml).forEach((msgId) => {
29981
- const valueFn = function() {
29982
- const {
29983
- i18nNodes,
29984
- errors: errors2
29985
- } = converter.convert(msgIdToHtml[msgId], url);
29986
- if (errors2.length) {
29987
- throw new Error(`xtb parse errors:
29988
- ${errors2.join(`
29989
- `)}`);
29990
- }
29991
- return i18nNodes;
29992
- };
29993
- createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
29994
- });
29995
- if (errors.length) {
29996
- throw new Error(`xtb parse errors:
29997
- ${errors.join(`
29998
- `)}`);
29999
- }
30000
- return {
30001
- locale,
30002
- i18nNodesByMsgId
30003
- };
30004
- }
30005
- digest(message) {
30006
- return digest(message);
30007
- }
30008
- createNameMapper(message) {
30009
- return new SimplePlaceholderMapper(message, toPublicName);
30010
- }
29892
+ const origGetDefaultDocument = proto.getDefaultDocument;
29893
+ proto.getDefaultDocument = function() {
29894
+ const doc = origGetDefaultDocument.call(this);
29895
+ ensureHead(doc);
29896
+ return doc;
30011
29897
  };
30012
- MapPlaceholderNames = class MapPlaceholderNames extends CloneVisitor {
30013
- convert(nodes, mapper) {
30014
- return mapper ? nodes.map((n) => n.visit(this, mapper)) : nodes;
30015
- }
30016
- visitTagPlaceholder(ph, mapper) {
30017
- const startName = mapper.toPublicName(ph.startName);
30018
- const closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
30019
- const children = ph.children.map((n) => n.visit(this, mapper));
30020
- return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
30021
- }
30022
- visitBlockPlaceholder(ph, mapper) {
30023
- const startName = mapper.toPublicName(ph.startName);
30024
- const closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
30025
- const children = ph.children.map((n) => n.visit(this, mapper));
30026
- return new BlockPlaceholder(ph.name, ph.parameters, startName, closeName, children, ph.sourceSpan, ph.startSourceSpan, ph.endSourceSpan);
30027
- }
30028
- visitPlaceholder(ph, mapper) {
30029
- return new Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
30030
- }
30031
- visitIcuPlaceholder(ph, mapper) {
30032
- return new IcuPlaceholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
30033
- }
29898
+ return true;
29899
+ };
29900
+ var init_angularPatch = __esm(() => {
29901
+ init_resolveAngularPackage();
29902
+ });
29903
+
29904
+ // src/angular/angularDeps.ts
29905
+ var initDominoAdapter = (platformServer) => {
29906
+ try {
29907
+ const DominoAdapter = platformServer.\u{275}DominoAdapter;
29908
+ DominoAdapter?.makeCurrent?.();
29909
+ } catch (err) {
29910
+ console.error("Failed to initialize DominoAdapter:", err);
29911
+ }
29912
+ }, loadAngularDeps = async () => {
29913
+ patchAngularInjectorSingleton();
29914
+ await import(resolveAngularPackage("@angular/compiler"));
29915
+ const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
29916
+ await applyPatches2();
29917
+ const [platformBrowser, platformServer, common, core2] = await Promise.all([
29918
+ import(resolveAngularPackage("@angular/platform-browser")),
29919
+ import(resolveAngularPackage("@angular/platform-server")),
29920
+ import(resolveAngularPackage("@angular/common")),
29921
+ import(resolveAngularPackage("@angular/core"))
29922
+ ]);
29923
+ if (false) {}
29924
+ initDominoAdapter(platformServer);
29925
+ return {
29926
+ APP_BASE_HREF: common.APP_BASE_HREF,
29927
+ bootstrapApplication: platformBrowser.bootstrapApplication,
29928
+ DomSanitizer: platformBrowser.DomSanitizer,
29929
+ provideClientHydration: platformBrowser.provideClientHydration,
29930
+ provideServerRendering: platformServer.provideServerRendering,
29931
+ provideZonelessChangeDetection: core2.provideZonelessChangeDetection,
29932
+ reflectComponentType: core2.reflectComponentType,
29933
+ renderApplication: platformServer.renderApplication,
29934
+ Sanitizer: core2.Sanitizer,
29935
+ SecurityContext: core2.SecurityContext
30034
29936
  };
30035
- BlockPresenceVisitor = class BlockPresenceVisitor extends RecursiveVisitor$1 {
30036
- hasBlocks = false;
30037
- visitDeferredBlock() {
30038
- this.hasBlocks = true;
30039
- }
30040
- visitDeferredBlockPlaceholder() {
30041
- this.hasBlocks = true;
30042
- }
30043
- visitDeferredBlockLoading() {
30044
- this.hasBlocks = true;
30045
- }
30046
- visitDeferredBlockError() {
30047
- this.hasBlocks = true;
30048
- }
30049
- visitIfBlock() {
30050
- this.hasBlocks = true;
30051
- }
30052
- visitIfBlockBranch() {
30053
- this.hasBlocks = true;
30054
- }
30055
- visitForLoopBlock() {
30056
- this.hasBlocks = true;
30057
- }
30058
- visitForLoopBlockEmpty() {
30059
- this.hasBlocks = true;
30060
- }
30061
- visitSwitchBlock() {
30062
- this.hasBlocks = true;
30063
- }
30064
- visitSwitchBlockCase() {
30065
- this.hasBlocks = true;
30066
- }
30067
- visitSwitchBlockCaseGroup() {
30068
- this.hasBlocks = true;
29937
+ }, angularDeps = null, getAngularDeps = () => {
29938
+ if (!angularDeps) {
29939
+ angularDeps = loadAngularDeps();
29940
+ }
29941
+ return angularDeps;
29942
+ };
29943
+ var init_angularDeps = __esm(() => {
29944
+ init_injectorPatch();
29945
+ init_resolveAngularPackage();
29946
+ });
29947
+
29948
+ // src/core/currentIslandRegistry.ts
29949
+ var requireCurrentIslandRegistry = () => {
29950
+ const registry = globalThis.__absoluteIslandRegistry;
29951
+ if (!registry) {
29952
+ throw new Error("No island registry is active. Configure `islands.registry` in absolute.config.ts before rendering <Island />.");
29953
+ }
29954
+ return registry;
29955
+ }, setCurrentIslandRegistry = (registry) => {
29956
+ globalThis.__absoluteIslandRegistry = registry;
29957
+ };
29958
+
29959
+ // src/angular/ssrRender.ts
29960
+ var routePropsCache, cacheRouteData = (pagePath, data) => {
29961
+ const cacheKey = pagePath.split("?")[0] ?? pagePath;
29962
+ routePropsCache.set(cacheKey, data);
29963
+ }, getCachedRouteData = (pagePath) => routePropsCache.get(pagePath), selectorCache, buildDeps = (ssrResult, baseDeps) => {
29964
+ if (!ssrResult?.core) {
29965
+ return baseDeps;
29966
+ }
29967
+ const { common, core: core2, platformBrowser, platformServer } = ssrResult;
29968
+ return {
29969
+ APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
29970
+ bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
29971
+ DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
29972
+ provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
29973
+ provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
29974
+ provideZonelessChangeDetection: core2.provideZonelessChangeDetection,
29975
+ reflectComponentType: core2.reflectComponentType,
29976
+ renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
29977
+ Sanitizer: core2.Sanitizer,
29978
+ SecurityContext: core2.SecurityContext
29979
+ };
29980
+ }, buildProviders = (deps, sanitizer, maybeProps, tokenMap) => {
29981
+ const providers = [
29982
+ deps.provideServerRendering(),
29983
+ deps.provideClientHydration(),
29984
+ deps.provideZonelessChangeDetection(),
29985
+ { provide: deps.APP_BASE_HREF, useValue: "/" },
29986
+ {
29987
+ provide: deps.DomSanitizer,
29988
+ useValue: sanitizer
29989
+ },
29990
+ { provide: deps.Sanitizer, useValue: sanitizer }
29991
+ ];
29992
+ if (!maybeProps) {
29993
+ return providers;
29994
+ }
29995
+ const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
29996
+ token: tokenMap.get(toScreamingSnake(propName)),
29997
+ value: propValue
29998
+ })).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
29999
+ return [...providers, ...propProviders];
30000
+ }, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
30001
+ if (!value || typeof value !== "object") {
30002
+ return false;
30003
+ }
30004
+ return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
30005
+ }, discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value))), loadSsrDeps = async (pagePath) => {
30006
+ const ssrDepsPath = (pagePath.split("?")[0] ?? pagePath).replace(/\.js$/, ".ssr-deps.js");
30007
+ try {
30008
+ const ssrDeps = await import(ssrDepsPath);
30009
+ const result = {
30010
+ common: ssrDeps.__angularCommon,
30011
+ core: ssrDeps.__angularCore,
30012
+ platformBrowser: ssrDeps.__angularPlatformBrowser,
30013
+ platformServer: ssrDeps.__angularPlatformServer
30014
+ };
30015
+ return result;
30016
+ } catch {
30017
+ return null;
30018
+ }
30019
+ }, resolveSelector = (deps, pagePath, PageComponent) => {
30020
+ const cached = selectorCache.get(pagePath);
30021
+ if (cached) {
30022
+ return cached;
30023
+ }
30024
+ const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
30025
+ selectorCache.set(pagePath, selector);
30026
+ return selector;
30027
+ }, injectBeforeClose = (html, snippet) => {
30028
+ if (html.includes("</body>")) {
30029
+ return html.replace("</body>", `${snippet}</body>`);
30030
+ }
30031
+ if (html.includes("</html>")) {
30032
+ return html.replace("</html>", `${snippet}</html>`);
30033
+ }
30034
+ return html + snippet;
30035
+ }, injectSsrScripts = (html, requestId, indexPath, props) => {
30036
+ let result = html;
30037
+ const registeredScripts = getAndClearClientScripts(requestId);
30038
+ if (registeredScripts.length > 0) {
30039
+ result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
30040
+ }
30041
+ if (props) {
30042
+ result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_PAGE_PROPS__ = ${JSON.stringify(props)};</script>`);
30043
+ }
30044
+ if (indexPath) {
30045
+ result = injectBeforeClose(result, `<script type="module" src="${indexPath}"></script>`);
30046
+ }
30047
+ return result;
30048
+ }, renderAngularApp = async (deps, PageComponent, providers, document2) => {
30049
+ const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
30050
+ return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
30051
+ document: document2,
30052
+ platformProviders: [],
30053
+ url: "/"
30054
+ }));
30055
+ }, withSuppressedAngularDevLogs = async (render) => {
30056
+ const origLog = console.log;
30057
+ console.log = (...args) => {
30058
+ if (typeof args[0] === "string" && args[0].includes("development mode")) {
30059
+ return;
30069
30060
  }
30061
+ origLog.apply(console, args);
30070
30062
  };
30071
- VERSION = new Version("21.2.6");
30072
- publishFacade(_global);
30063
+ try {
30064
+ return await render();
30065
+ } finally {
30066
+ console.log = origLog;
30067
+ }
30068
+ };
30069
+ var init_ssrRender = __esm(() => {
30070
+ init_registerClientScript();
30071
+ routePropsCache = new Map;
30072
+ selectorCache = new Map;
30073
30073
  });
30074
30074
 
30075
30075
  // src/angular/islands.ts
@@ -30813,12 +30813,18 @@ var escapeHtml = (str) => String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;
30813
30813
 
30814
30814
  // src/angular/pageHandler.ts
30815
30815
  import { AsyncLocalStorage } from "async_hooks";
30816
- var ssrDirty = false, lastSelector = "angular-page", isRecord4 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", readAngularPageModule = (value) => isRecord4(value) ? value : null, invalidateAngularSsrCache = () => {
30816
+ var ssrDirty = false, lastSelector = "angular-page", isRecord4 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
30817
+ if (!compilerImportPromise) {
30818
+ compilerImportPromise = Promise.resolve().then(() => (init_compiler(), exports_compiler));
30819
+ }
30820
+ return compilerImportPromise;
30821
+ }, readAngularPageModule = (value) => isRecord4(value) ? value : null, invalidateAngularSsrCache = () => {
30817
30822
  ssrDirty = true;
30818
30823
  clearSelectorCache();
30819
30824
  }, angularSsrContext, handleAngularPageRequest = async (_importer, pagePath, indexPath, headTag = "<head></head>", ...props) => {
30820
30825
  const requestId = `angular_${Date.now()}_${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
30821
30826
  return angularSsrContext.run(requestId, async () => {
30827
+ await ensureAngularCompiler();
30822
30828
  const [maybeProps] = props;
30823
30829
  cacheRouteData(pagePath, { headTag, props: maybeProps });
30824
30830
  if (ssrDirty) {
@@ -39983,6 +39989,9 @@ var init_imageProcessing = __esm(() => {
39983
39989
  };
39984
39990
  });
39985
39991
 
39992
+ // src/angular/index.ts
39993
+ init_compiler();
39994
+
39986
39995
  // src/client/streamSwap.ts
39987
39996
  var streamSwapRuntime = () => {
39988
39997
  if (window.__ABS_SLOT_RUNTIME__ === true)
@@ -40064,8 +40073,8 @@ var currentStreamingSlotPolicy = {
40064
40073
  maxSlotsPerResponse: STREAMING_SLOT_MAX_PER_RESPONSE,
40065
40074
  maxSlotHtmlSizeBytes: STREAMING_SLOT_MAX_HTML_BYTES
40066
40075
  };
40067
- var clonePolicy = (policy) => ({
40068
- ...policy
40076
+ var clonePolicy = (policy2) => ({
40077
+ ...policy2
40069
40078
  });
40070
40079
  var normalizeSlotBytes = (value, fallback) => {
40071
40080
  if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
@@ -40075,7 +40084,7 @@ var normalizeSlotBytes = (value, fallback) => {
40075
40084
  };
40076
40085
  var normalizeSlotText = (value, fallback) => typeof value === "string" ? value : fallback;
40077
40086
  var normalizeSlotError = (value, fallback) => typeof value === "string" ? value : fallback;
40078
- var hasPolicyValue = (policy, key) => Object.prototype.hasOwnProperty.call(policy, key);
40087
+ var hasPolicyValue = (policy2, key) => Object.prototype.hasOwnProperty.call(policy2, key);
40079
40088
  var applyStreamingSlotPolicyOverrides = (base, overridePolicy = {}) => ({
40080
40089
  timeoutMs: hasPolicyValue(overridePolicy, "timeoutMs") ? normalizeSlotBytes(overridePolicy.timeoutMs, base.timeoutMs) : base.timeoutMs,
40081
40090
  fallbackHtml: hasPolicyValue(overridePolicy, "fallbackHtml") ? normalizeSlotText(overridePolicy.fallbackHtml, "") : base.fallbackHtml,
@@ -40106,13 +40115,13 @@ var resolveStreamingSlotPolicy = (overridePolicy = {}) => {
40106
40115
  return applyStreamingSlotPolicyOverrides(base, overridePolicy);
40107
40116
  };
40108
40117
  var getStreamingSlotPolicy = () => clonePolicy(currentStreamingSlotPolicy);
40109
- var setStreamingSlotPolicy = (policy = {}) => {
40118
+ var setStreamingSlotPolicy = (policy2 = {}) => {
40110
40119
  const base = getStreamingSlotPolicy();
40111
- currentStreamingSlotPolicy = applyStreamingSlotPolicyOverrides(base, policy);
40120
+ currentStreamingSlotPolicy = applyStreamingSlotPolicyOverrides(base, policy2);
40112
40121
  };
40113
- var withStreamingSlotPolicy = async (policy, callback) => {
40122
+ var withStreamingSlotPolicy = async (policy2, callback) => {
40114
40123
  const previous = getStreamingSlotPolicy();
40115
- setStreamingSlotPolicy(policy);
40124
+ setStreamingSlotPolicy(policy2);
40116
40125
  try {
40117
40126
  return await callback();
40118
40127
  } finally {
@@ -40127,21 +40136,21 @@ var createTimeoutError = (slot, timeoutMs) => {
40127
40136
  error.__absTimeout = true;
40128
40137
  return error;
40129
40138
  };
40130
- var toStreamingSlot = (slot, policy) => ({
40131
- errorHtml: slot.errorHtml === undefined ? policy.errorHtml : slot.errorHtml,
40132
- fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy.fallbackHtml),
40139
+ var toStreamingSlot = (slot, policy2) => ({
40140
+ errorHtml: slot.errorHtml === undefined ? policy2.errorHtml : slot.errorHtml,
40141
+ fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy2.fallbackHtml),
40133
40142
  id: slot.id ?? createStreamingSlotId(),
40134
- timeoutMs: normalizeSlotBytes(slot.timeoutMs, policy.timeoutMs),
40143
+ timeoutMs: normalizeSlotBytes(slot.timeoutMs, policy2.timeoutMs),
40135
40144
  resolve: slot.resolve
40136
40145
  });
40137
40146
  var prepareSlots = ({
40138
- policy,
40147
+ policy: policy2,
40139
40148
  slots,
40140
40149
  onError,
40141
40150
  onSlotMetric
40142
40151
  }) => {
40143
- const preparedSlots = slots.map((slot) => toStreamingSlot(slot, policy));
40144
- const maxSlotsPerResponse = policy.maxSlotsPerResponse;
40152
+ const preparedSlots = slots.map((slot) => toStreamingSlot(slot, policy2));
40153
+ const maxSlotsPerResponse = policy2.maxSlotsPerResponse;
40145
40154
  if (maxSlotsPerResponse === 0) {
40146
40155
  const error = new Error("Streaming slot limit is set to 0");
40147
40156
  for (const slot of preparedSlots) {
@@ -40178,8 +40187,8 @@ var prepareSlots = ({
40178
40187
  return keptSlots;
40179
40188
  };
40180
40189
  var htmlByteLength = (value, encoder) => encoder.encode(value).length;
40181
- var resolveSlot = async (slot, onError, policy, onSlotMetric) => {
40182
- const safePolicy = policy ?? getStreamingSlotPolicy();
40190
+ var resolveSlot = async (slot, onError, policy2, onSlotMetric) => {
40191
+ const safePolicy = policy2 ?? getStreamingSlotPolicy();
40183
40192
  const encoder = new TextEncoder;
40184
40193
  const start = Date.now();
40185
40194
  try {
@@ -40263,12 +40272,12 @@ var streamOutOfOrderSlots = ({
40263
40272
  footerHtml = "",
40264
40273
  headerHtml = "",
40265
40274
  nonce,
40266
- policy,
40275
+ policy: policy2,
40267
40276
  onSlotMetric,
40268
40277
  onError,
40269
40278
  slots
40270
40279
  }) => {
40271
- const resolvedPolicy = resolveStreamingSlotPolicy(policy);
40280
+ const resolvedPolicy = resolveStreamingSlotPolicy(policy2);
40272
40281
  const combinedOnError = createCombinedSlotErrorHandler(resolvedPolicy.onError, onError);
40273
40282
  const combinedOnSlotMetric = createCombinedSlotMetricHandler(resolvedPolicy.onSlotMetric, onSlotMetric);
40274
40283
  const effectivePolicy = {
@@ -40376,9 +40385,9 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
40376
40385
  nonce,
40377
40386
  onError,
40378
40387
  onSlotMetric,
40379
- policy
40388
+ policy: policy2
40380
40389
  } = {}) => {
40381
- const resolvedPolicy = resolveStreamingSlotPolicy(policy);
40390
+ const resolvedPolicy = resolveStreamingSlotPolicy(policy2);
40382
40391
  const combinedOnError = createCombinedSlotErrorHandler(resolvedPolicy.onError, onError);
40383
40392
  const combinedOnSlotMetric = createCombinedSlotMetricHandler(resolvedPolicy.onSlotMetric, onSlotMetric);
40384
40393
  const effectivePolicy = {
@@ -40518,14 +40527,14 @@ var cloneHeaders = (response) => {
40518
40527
  const headers = new Headers(response.headers);
40519
40528
  return headers;
40520
40529
  };
40521
- var enhanceHtmlResponseWithStreamingSlots = (response, { nonce, onError, streamingSlots = [], policy } = {}) => {
40530
+ var enhanceHtmlResponseWithStreamingSlots = (response, { nonce, onError, streamingSlots = [], policy: policy2 } = {}) => {
40522
40531
  if (!response.body || streamingSlots.length === 0) {
40523
40532
  return response;
40524
40533
  }
40525
40534
  const body = appendStreamingSlotPatchesToStream(response.body, streamingSlots, {
40526
40535
  nonce,
40527
40536
  onError,
40528
- policy
40537
+ policy: policy2
40529
40538
  });
40530
40539
  return new Response(body, {
40531
40540
  headers: cloneHeaders(response),
@@ -40977,5 +40986,5 @@ export {
40977
40986
  DeferSlotComponent
40978
40987
  };
40979
40988
 
40980
- //# debugId=A6ACDE5F26CA47D664756E2164756E21
40989
+ //# debugId=A8ABDEF09265813C64756E2164756E21
40981
40990
  //# sourceMappingURL=index.js.map