@wavemaker/angular-codegen 11.14.1-3.6306 → 11.14.1-30.647738

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.
@@ -5867,14 +5867,14 @@ function createNgModuleType(meta) {
5867
5867
  if (meta.kind === R3NgModuleMetadataKind.Local) {
5868
5868
  return new ExpressionType$1(meta.type.value);
5869
5869
  }
5870
- const { type: moduleType, declarations, exports: exports$1, imports, includeImportTypes, publicDeclarationTypes, } = meta;
5870
+ const { type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes, } = meta;
5871
5871
  return new ExpressionType$1(importExpr(Identifiers.NgModuleDeclaration, [
5872
5872
  new ExpressionType$1(moduleType.type),
5873
5873
  publicDeclarationTypes === null
5874
5874
  ? tupleTypeOf(declarations)
5875
5875
  : tupleOfTypes(publicDeclarationTypes),
5876
5876
  includeImportTypes ? tupleTypeOf(imports) : NONE_TYPE,
5877
- tupleTypeOf(exports$1),
5877
+ tupleTypeOf(exports),
5878
5878
  ]));
5879
5879
  }
5880
5880
  /**
@@ -37685,11 +37685,22 @@ function requireConventions () {
37685
37685
  XMLNS: 'http://www.w3.org/2000/xmlns/',
37686
37686
  });
37687
37687
 
37688
+ //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
37689
+ //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
37690
+ //[5] Name ::= NameStartChar (NameChar)*
37691
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
37692
+ var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
37693
+ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
37694
+ //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
37695
+
37688
37696
  conventions.assign = assign;
37689
37697
  conventions.find = find;
37690
37698
  conventions.freeze = freeze;
37691
37699
  conventions.MIME_TYPE = MIME_TYPE;
37692
37700
  conventions.NAMESPACE = NAMESPACE;
37701
+ conventions.nameStartChar = nameStartChar;
37702
+ conventions.nameChar = nameChar;
37703
+ conventions.tagNamePattern = tagNamePattern;
37693
37704
  return conventions;
37694
37705
  }
37695
37706
 
@@ -37702,6 +37713,7 @@ function requireDom () {
37702
37713
 
37703
37714
  var find = conventions.find;
37704
37715
  var NAMESPACE = conventions.NAMESPACE;
37716
+ var tagNamePattern = conventions.tagNamePattern;
37705
37717
 
37706
37718
  /**
37707
37719
  * A prerequisite for `[].filter`, to drop elements that are empty
@@ -37811,14 +37823,14 @@ function requireDom () {
37811
37823
  ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]="DOMString size error"),2);
37812
37824
  var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]="Hierarchy request error"),3);
37813
37825
  ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]="Wrong document"),4);
37814
- ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
37826
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]="Invalid character"),5);
37815
37827
  ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]="No data allowed"),6);
37816
37828
  ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]="No modification allowed"),7);
37817
37829
  var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]="Not found"),8);
37818
37830
  ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]="Not supported"),9);
37819
37831
  var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]="Attribute in use"),10);
37820
37832
  //level2
37821
- ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
37833
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = ((ExceptionMessage[11]="Invalid state"),11);
37822
37834
  ExceptionCode.SYNTAX_ERR = ((ExceptionMessage[12]="Syntax error"),12);
37823
37835
  ExceptionCode.INVALID_MODIFICATION_ERR = ((ExceptionMessage[13]="Invalid modification"),13);
37824
37836
  ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
@@ -37868,9 +37880,10 @@ function requireDom () {
37868
37880
  item: function(index) {
37869
37881
  return index >= 0 && index < this.length ? this[index] : null;
37870
37882
  },
37871
- toString:function(isHTML,nodeFilter){
37883
+ toString:function(isHTML,nodeFilter,options){
37884
+ var requireWellFormed = !!options && !!options.requireWellFormed;
37872
37885
  for(var buf = [], i = 0;i<this.length;i++){
37873
- serializeToString(this[i],buf,isHTML,nodeFilter);
37886
+ serializeToString(this[i],buf,isHTML,nodeFilter,null,requireWellFormed);
37874
37887
  }
37875
37888
  return buf.join('');
37876
37889
  },
@@ -37932,6 +37945,13 @@ function requireDom () {
37932
37945
  * used for attributes or DocumentType entities
37933
37946
  */
37934
37947
  function NamedNodeMap() {
37948
+ // nodeName -> Attr membership index; lets the parse-time de-duplication in
37949
+ // setNamedItem resolve an existing attribute in O(1) instead of scanning the
37950
+ // list, so building an element with M attributes costs O(M) rather than O(M^2).
37951
+ // The numbered entries and length remain the sole authority for attribute order.
37952
+ // Object.create(null) so an attribute named __proto__ or constructor is an
37953
+ // ordinary key.
37954
+ this._nameIndex = Object.create(null);
37935
37955
  }
37936
37956
  function _findNodeIndex(list,node){
37937
37957
  var i = list.length;
@@ -37940,12 +37960,27 @@ function requireDom () {
37940
37960
  }
37941
37961
  }
37942
37962
 
37963
+ function _nnmIndexAdd(list, attr) {
37964
+ list._nameIndex[attr.nodeName] = attr;
37965
+ }
37966
+ function _nnmIndexRemove(list, attr) {
37967
+ // Only drop the entry if it still points at this attribute; a replacement with
37968
+ // a different nodeName may already have re-keyed it.
37969
+ if (list._nameIndex[attr.nodeName] === attr) {
37970
+ delete list._nameIndex[attr.nodeName];
37971
+ }
37972
+ }
37973
+
37943
37974
  function _addNamedNode(el,list,newAttr,oldAttr){
37944
37975
  if(oldAttr){
37945
37976
  list[_findNodeIndex(list,oldAttr)] = newAttr;
37977
+ // oldAttr leaves the list; drop its index entry (its nodeName may differ
37978
+ // from newAttr's when the replacement came via setNamedItemNS).
37979
+ _nnmIndexRemove(list, oldAttr);
37946
37980
  }else {
37947
37981
  list[list.length++] = newAttr;
37948
37982
  }
37983
+ _nnmIndexAdd(list, newAttr);
37949
37984
  if(el){
37950
37985
  newAttr.ownerElement = el;
37951
37986
  var doc = el.ownerDocument;
@@ -37964,6 +37999,7 @@ function requireDom () {
37964
37999
  list[i] = list[++i];
37965
38000
  }
37966
38001
  list.length = lastIndex;
38002
+ _nnmIndexRemove(list, attr);
37967
38003
  if(el){
37968
38004
  var doc = el.ownerDocument;
37969
38005
  if(doc){
@@ -37997,7 +38033,11 @@ function requireDom () {
37997
38033
  if(el && el!=this._ownerElement){
37998
38034
  throw new DOMException(INUSE_ATTRIBUTE_ERR);
37999
38035
  }
38000
- var oldAttr = this.getNamedItem(attr.nodeName);
38036
+ // Resolve any existing attribute with the same nodeName through the O(1)
38037
+ // membership index rather than an O(M) scan — this is the parse-dedup hot
38038
+ // path (setAttributeNode per attribute during parse). Absent -> undefined,
38039
+ // matching getNamedItem's contract.
38040
+ var oldAttr = this._nameIndex[attr.nodeName];
38001
38041
  _addNamedNode(this._ownerElement,this,attr,oldAttr);
38002
38042
  return oldAttr;
38003
38043
  },
@@ -38115,13 +38155,28 @@ function requireDom () {
38115
38155
  /**
38116
38156
  * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
38117
38157
  *
38118
- * __This behavior is slightly different from the in the specs__:
38158
+ * __This implementation differs from the specification:__
38119
38159
  * - this implementation is not validating names or qualified names
38120
38160
  * (when parsing XML strings, the SAX parser takes care of that)
38121
38161
  *
38162
+ * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
38163
+ * Creation-time validation of `publicId`, `systemId` is not enforced.
38164
+ * The serializer-level check covers all mutation vectors, including direct property writes.
38165
+ * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
38166
+ * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
38167
+ * silently omitted from the serialized output.
38168
+ *
38122
38169
  * @param {string} qualifiedName
38123
38170
  * @param {string} [publicId]
38171
+ * The external subset public identifier. Stored verbatim including surrounding quotes.
38172
+ * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
38173
+ * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
38174
+ * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
38124
38175
  * @param {string} [systemId]
38176
+ * The external subset system identifier. Stored verbatim including surrounding quotes.
38177
+ * When serialized with `requireWellFormed: true`, throws `DOMException` with code
38178
+ * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
38179
+ * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
38125
38180
  * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
38126
38181
  * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
38127
38182
  *
@@ -38187,18 +38242,73 @@ function requireDom () {
38187
38242
  return cloneNode(this.ownerDocument||this,this,deep);
38188
38243
  },
38189
38244
  // Modified in DOM Level 2:
38190
- normalize:function(){
38191
- var child = this.firstChild;
38192
- while(child){
38193
- var next = child.nextSibling;
38194
- if(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){
38195
- this.removeChild(next);
38196
- child.appendData(next.data);
38197
- }else {
38198
- child.normalize();
38199
- child = next;
38200
- }
38201
- }
38245
+ /**
38246
+ * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
38247
+ * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
38248
+ *
38249
+ * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
38250
+ * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
38251
+ * nodes.
38252
+ *
38253
+ * This method iteratively traverses all child nodes to normalize all descendant nodes within
38254
+ * the subtree.
38255
+ *
38256
+ * @throws {DOMException}
38257
+ * May throw a DOMException if operations within removeChild or appendData (which are
38258
+ * potentially invoked in this method) do not meet their specific constraints.
38259
+ * @see {@link Node.removeChild}
38260
+ * @see {@link CharacterData.appendData}
38261
+ * @see ../docs/walk-dom.md.
38262
+ */
38263
+ normalize: function () {
38264
+ walkDOM(this, null, {
38265
+ enter: function (node) {
38266
+ // Merge adjacent text children of node before walkDOM schedules them.
38267
+ // walkDOM reads lastChild/previousSibling after enter returns, so the
38268
+ // surviving post-merge children are what it descends into.
38269
+ var child = node.firstChild;
38270
+ while (child) {
38271
+ var next = child.nextSibling;
38272
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
38273
+ // Merge the whole run of adjacent text nodes at once: gather the
38274
+ // following text siblings' data, unlink them in a single pass, and
38275
+ // re-index the child list a single time. Per-sibling `removeChild`
38276
+ // (each an O(K) re-index) plus per-sibling `appendData` (each an O(K)
38277
+ // string rebuild) is O(K^2) over a long run of single-character text
38278
+ // nodes; this keeps it O(K). The first text node of the run survives
38279
+ // and carries the concatenated data, preserving node identity and
38280
+ // locator semantics.
38281
+ var tail = [];
38282
+ var sibling = next;
38283
+ while (sibling !== null && sibling.nodeType === TEXT_NODE) {
38284
+ tail.push(sibling.data);
38285
+ sibling = sibling.nextSibling;
38286
+ }
38287
+ // `sibling` is now the first non-text node after the run, or null.
38288
+ var removed = child.nextSibling;
38289
+ while (removed !== sibling) {
38290
+ var following = removed.nextSibling;
38291
+ removed.parentNode = null;
38292
+ removed.previousSibling = null;
38293
+ removed.nextSibling = null;
38294
+ removed = following;
38295
+ }
38296
+ child.nextSibling = sibling;
38297
+ if (sibling !== null) {
38298
+ sibling.previousSibling = child;
38299
+ } else {
38300
+ node.lastChild = child;
38301
+ }
38302
+ child.appendData(tail.join('')); // single O(K) string rebuild
38303
+ _onUpdateChild(node.ownerDocument, node); // single O(K) re-index
38304
+ child = sibling;
38305
+ } else {
38306
+ child = next;
38307
+ }
38308
+ }
38309
+ return true; // descend into surviving children
38310
+ },
38311
+ });
38202
38312
  },
38203
38313
  // Introduced in DOM Level 2:
38204
38314
  isSupported:function(feature, version){
@@ -38274,21 +38384,103 @@ function requireDom () {
38274
38384
  copy(NodeType,Node.prototype);
38275
38385
 
38276
38386
  /**
38277
- * @param callback return true for continue,false for break
38278
- * @return boolean true: break visit;
38387
+ * @param {Node} node
38388
+ * Root of the subtree to visit.
38389
+ * @param {function(Node): boolean} callback
38390
+ * Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
38391
+ * @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
38279
38392
  */
38280
- function _visitNode(node,callback){
38281
- if(callback(node)){
38282
- return true;
38283
- }
38284
- if(node = node.firstChild){
38285
- do{
38286
- if(_visitNode(node,callback)){return true}
38287
- }while(node=node.nextSibling)
38288
- }
38393
+ function _visitNode(node, callback) {
38394
+ return walkDOM(node, null, { enter: function (n) { return callback(n) ? walkDOM.STOP : true; } }) === walkDOM.STOP;
38289
38395
  }
38290
38396
 
38397
+ /**
38398
+ * Depth-first pre/post-order DOM tree walker.
38399
+ *
38400
+ * Visits every node in the subtree rooted at `node`. For each node:
38401
+ *
38402
+ * 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
38403
+ * return value becomes the `context` passed to each child's `enter` call and to the matching
38404
+ * `exit` call.
38405
+ * 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
38406
+ * sibling traversal continues normally.
38407
+ * 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
38408
+ * further `enter` or `exit` calls are made.
38409
+ * 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
38410
+ * safely modify the node's own child list before the walker descends. Modifying siblings of
38411
+ * the current node or any other part of the tree produces unpredictable results: nodes already
38412
+ * queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
38413
+ * the current child list are never visited.
38414
+ * 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
38415
+ * been visited, passing the same `context` that `enter`
38416
+ * returned for that node.
38417
+ *
38418
+ * This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
38419
+ * deep trees.
38420
+ *
38421
+ * @param {Node} node
38422
+ * Root of the subtree to walk.
38423
+ * @param {*} context
38424
+ * Initial context value passed to the root node's `enter`.
38425
+ * @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
38426
+ * @returns {void | walkDOM.STOP}
38427
+ * @see ../docs/walk-dom.md.
38428
+ */
38429
+ function walkDOM(node, context, callbacks) {
38430
+ // Each stack frame is {node, context, phase}:
38431
+ // walkDOM.ENTER — call enter, then push children
38432
+ // walkDOM.EXIT — call exit
38433
+ var stack = [{ node: node, context: context, phase: walkDOM.ENTER }];
38434
+ while (stack.length > 0) {
38435
+ var frame = stack.pop();
38436
+ if (frame.phase === walkDOM.ENTER) {
38437
+ var childContext = callbacks.enter(frame.node, frame.context);
38438
+ if (childContext === walkDOM.STOP) {
38439
+ return walkDOM.STOP;
38440
+ }
38441
+ // Push exit frame before children so it fires after all children are processed (Last In First Out)
38442
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
38443
+ if (childContext === null || childContext === undefined) {
38444
+ continue; // skip children
38445
+ }
38446
+ // lastChild is read after enter returns, so enter may modify the child list.
38447
+ var child = frame.node.lastChild;
38448
+ // Traverse from lastChild backwards so that pushing onto the stack
38449
+ // naturally yields firstChild on top (processed first).
38450
+ while (child) {
38451
+ stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
38452
+ child = child.previousSibling;
38453
+ }
38454
+ } else {
38455
+ // frame.phase === walkDOM.EXIT
38456
+ if (callbacks.exit) {
38457
+ callbacks.exit(frame.node, frame.context);
38458
+ }
38459
+ }
38460
+ }
38461
+ }
38291
38462
 
38463
+ /**
38464
+ * Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
38465
+ * immediately.
38466
+ *
38467
+ * @type {symbol}
38468
+ */
38469
+ walkDOM.STOP = Symbol('walkDOM.STOP');
38470
+ /**
38471
+ * Phase constant for a stack frame that has not yet been visited.
38472
+ * The `enter` callback is called and children are scheduled.
38473
+ *
38474
+ * @type {number}
38475
+ */
38476
+ walkDOM.ENTER = 0;
38477
+ /**
38478
+ * Phase constant for a stack frame whose subtree has been fully visited.
38479
+ * The `exit` callback is called.
38480
+ *
38481
+ * @type {number}
38482
+ */
38483
+ walkDOM.EXIT = 1;
38292
38484
 
38293
38485
  function Document(){
38294
38486
  this.ownerDocument = this;
@@ -38892,12 +39084,46 @@ function requireDom () {
38892
39084
  node.appendData(data);
38893
39085
  return node;
38894
39086
  },
39087
+ /**
39088
+ * Returns a new CDATASection node whose data is `data`.
39089
+ *
39090
+ * __This implementation differs from the specification:__
39091
+ * - calling this method on an HTML document does not throw `NotSupportedError`.
39092
+ *
39093
+ * @param {string} data
39094
+ * @returns {CDATASection}
39095
+ * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
39096
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
39097
+ * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
39098
+ */
38895
39099
  createCDATASection : function(data){
39100
+ if (data.indexOf(']]>') !== -1) {
39101
+ throw new DOMException(INVALID_CHARACTER_ERR, 'data contains "]]>"');
39102
+ }
38896
39103
  var node = new CDATASection();
38897
39104
  node.ownerDocument = this;
38898
39105
  node.appendData(data);
38899
39106
  return node;
38900
39107
  },
39108
+ /**
39109
+ * Returns a ProcessingInstruction node whose target is target and data is data.
39110
+ *
39111
+ * __This implementation differs from the specification:__
39112
+ * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
39113
+ *
39114
+ * Note: When the resulting document is serialized with `requireWellFormed: true`, the
39115
+ * serializer throws with code `INVALID_STATE_ERR` if `.target` is not a valid XML `NCName`
39116
+ * (a `Name` with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data`
39117
+ * contains `?>` (W3C DOM Parsing §3.2.1.7). Without that option the target and data are
39118
+ * emitted verbatim.
39119
+ *
39120
+ * @param {string} target
39121
+ * @param {string} data
39122
+ * @returns {ProcessingInstruction}
39123
+ * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
39124
+ * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
39125
+ * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
39126
+ */
38901
39127
  createProcessingInstruction : function(target,data){
38902
39128
  var node = new ProcessingInstruction();
38903
39129
  node.ownerDocument = this;
@@ -38914,7 +39140,27 @@ function requireDom () {
38914
39140
  node.specified = true;
38915
39141
  return node;
38916
39142
  },
39143
+ /**
39144
+ * Creates an EntityReference object, serialized as `&name;`.
39145
+ *
39146
+ * The `name` is validated against the XML `Name` production at creation time; an invalid name
39147
+ * throws a `DOMException` with code `INVALID_CHARACTER_ERR`. When the resulting node is
39148
+ * serialized with `requireWellFormed: true`, the serializer re-validates `nodeName` and throws
39149
+ * a `DOMException` with code `INVALID_STATE_ERR` if a later `nodeName` mutation made it invalid;
39150
+ * without that option the name is emitted verbatim.
39151
+ *
39152
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39153
+ * constructs `EntityReference` nodes, so this method is the only producer.
39154
+ *
39155
+ * @param {string} name The name of the entity to reference.
39156
+ * @returns {EntityReference}
39157
+ * @throws {DOMException} With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
39158
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
39159
+ */
38917
39160
  createEntityReference : function(name){
39161
+ if (!tagNamePattern.test(name)) {
39162
+ throw new DOMException(INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
39163
+ }
38918
39164
  var node = new EntityReference();
38919
39165
  node.ownerDocument = this;
38920
39166
  node.nodeName = name;
@@ -39123,6 +39369,20 @@ function requireDom () {
39123
39369
  _extends(CDATASection,CharacterData);
39124
39370
 
39125
39371
 
39372
+ /**
39373
+ * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
39374
+ *
39375
+ * `name`, `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
39376
+ * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
39377
+ * direct property writes succeed silently. Values are serialized verbatim when
39378
+ * `requireWellFormed` is false (the default). When the serializer is invoked with
39379
+ * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
39380
+ * field — including `name`, which is checked against the XML `Name` production — and throws
39381
+ * `DOMException` with code `INVALID_STATE_ERR` on invalid values.
39382
+ *
39383
+ * @class
39384
+ * @see https://developer.mozilla.org/docs/Web/API/DocumentType MDN
39385
+ */
39126
39386
  function DocumentType() {
39127
39387
  } DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
39128
39388
  _extends(DocumentType,Node);
@@ -39135,6 +39395,20 @@ function requireDom () {
39135
39395
  } Entity.prototype.nodeType = ENTITY_NODE;
39136
39396
  _extends(Entity,Node);
39137
39397
 
39398
+ /**
39399
+ * Represents an EntityReference node, serialized as `&nodeName;`.
39400
+ *
39401
+ * `nodeName` is the referenced entity's name, stored verbatim. When serialized with
39402
+ * `requireWellFormed: true`, the serializer validates `nodeName` against the XML `Name` production
39403
+ * and throws a `DOMException` with code `INVALID_STATE_ERR` if it does not match; without that
39404
+ * option the name is emitted verbatim between `&` and `;`.
39405
+ *
39406
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
39407
+ * constructs `EntityReference` nodes, so the only producer is `Document.createEntityReference`.
39408
+ *
39409
+ * @class
39410
+ * @see https://www.w3.org/TR/xml/#NT-Name
39411
+ */
39138
39412
  function EntityReference() {
39139
39413
  } EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
39140
39414
  _extends(EntityReference,Node);
@@ -39150,11 +39424,54 @@ function requireDom () {
39150
39424
  ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
39151
39425
  _extends(ProcessingInstruction,Node);
39152
39426
  function XMLSerializer(){}
39153
- XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){
39154
- return nodeSerializeToString.call(node,isHtml,nodeFilter);
39427
+ /**
39428
+ * Returns the result of serializing `node` to XML.
39429
+ *
39430
+ * When `options.requireWellFormed` is `true`, the serializer throws for content that would
39431
+ * produce ill-formed XML.
39432
+ *
39433
+ * __This implementation differs from the specification:__
39434
+ * - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
39435
+ * at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
39436
+ * default behaviour) unless `requireWellFormed` is `true`.
39437
+ * - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
39438
+ * is only thrown to prevent injection vectors, not for all the spec mandated checks.
39439
+ *
39440
+ * @param {Node} node
39441
+ * @param {boolean} [isHtml]
39442
+ * @param {function} [nodeFilter]
39443
+ * @param {Object} [options]
39444
+ * @param {boolean} [options.requireWellFormed=false]
39445
+ * When `true`, throws for content that would produce ill-formed XML.
39446
+ * @returns {string}
39447
+ * @throws {DOMException}
39448
+ * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
39449
+ * - an Element's qualified name (including any namespace prefix) is not a valid XML QName,
39450
+ * - an attribute's qualified name (including a synthesized `xmlns:` namespace declaration) is
39451
+ * not a valid XML QName,
39452
+ * - a CDATASection node's data contains `"]]>"`,
39453
+ * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
39454
+ * - a ProcessingInstruction's target is not a valid XML `NCName` (a `Name` with no colon) or is
39455
+ * an ASCII case-insensitive match for `"xml"`, or its data contains `"?>"`,
39456
+ * - a DocumentType's `name` is not a valid XML `Name` (XML 1.0 production [5]),
39457
+ * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
39458
+ * production,
39459
+ * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
39460
+ * production,
39461
+ * - a DocumentType's `internalSubset` contains `"]>"`, or
39462
+ * - an EntityReference's `nodeName` is not a valid XML `Name` (XML 1.0 production [5]).
39463
+ * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
39464
+ * writes succeed and are covered by the serializer-level checks above.
39465
+ * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
39466
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serialization
39467
+ * @see https://github.com/w3c/DOM-Parsing/issues/84
39468
+ */
39469
+ XMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter,options){
39470
+ return nodeSerializeToString.call(node,isHtml,nodeFilter,options);
39155
39471
  };
39156
39472
  Node.prototype.toString = nodeSerializeToString;
39157
- function nodeSerializeToString(isHtml,nodeFilter){
39473
+ function nodeSerializeToString(isHtml,nodeFilter,options){
39474
+ var requireWellFormed = !!options && !!options.requireWellFormed;
39158
39475
  var buf = [];
39159
39476
  var refNode = this.nodeType == 9 && this.documentElement || this;
39160
39477
  var prefix = refNode.prefix;
@@ -39171,7 +39488,7 @@ function requireDom () {
39171
39488
  ];
39172
39489
  }
39173
39490
  }
39174
- serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);
39491
+ serializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces,requireWellFormed);
39175
39492
  //console.log('###',this.nodeType,uri,prefix,buf.join(''))
39176
39493
  return buf.join('');
39177
39494
  }
@@ -39216,275 +39533,350 @@ function requireDom () {
39216
39533
  * @see https://www.w3.org/TR/xml11/#AVNormalize
39217
39534
  * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
39218
39535
  */
39219
- function addSerializedAttribute(buf, qualifiedName, value) {
39536
+ function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
39537
+ if (requireWellFormed && !tagNamePattern.test(qualifiedName)) {
39538
+ throw new DOMException(INVALID_STATE_ERR, 'The attribute name "' + qualifiedName + '" is not a valid XML QName');
39539
+ }
39220
39540
  buf.push(' ', qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
39221
39541
  }
39222
39542
 
39223
- function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
39543
+ function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
39224
39544
  if (!visibleNamespaces) {
39225
39545
  visibleNamespaces = [];
39226
39546
  }
39227
-
39228
- if(nodeFilter){
39229
- node = nodeFilter(node);
39230
- if(node){
39231
- if(typeof node == 'string'){
39232
- buf.push(node);
39233
- return;
39234
- }
39235
- }else {
39236
- return;
39237
- }
39238
- //buf.sort.apply(attrs, attributeSorter);
39239
- }
39240
-
39241
- switch(node.nodeType){
39242
- case ELEMENT_NODE:
39243
- var attrs = node.attributes;
39244
- var len = attrs.length;
39245
- var child = node.firstChild;
39246
- var nodeName = node.tagName;
39247
-
39248
- isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;
39249
-
39250
- var prefixedNodeName = nodeName;
39251
- if (!isHTML && !node.prefix && node.namespaceURI) {
39252
- var defaultNS;
39253
- // lookup current default ns from `xmlns` attribute
39254
- for (var ai = 0; ai < attrs.length; ai++) {
39255
- if (attrs.item(ai).name === 'xmlns') {
39256
- defaultNS = attrs.item(ai).value;
39257
- break
39258
- }
39259
- }
39260
- if (!defaultNS) {
39261
- // lookup current default ns in visibleNamespaces
39262
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
39263
- var namespace = visibleNamespaces[nsi];
39264
- if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {
39265
- defaultNS = namespace.namespace;
39266
- break
39547
+ walkDOM(node, { ns: visibleNamespaces, isHTML: isHTML }, {
39548
+ enter: function (n, ctx) {
39549
+ var ns = ctx.ns;
39550
+ var html = ctx.isHTML;
39551
+
39552
+ if (nodeFilter) {
39553
+ n = nodeFilter(n);
39554
+ if (n) {
39555
+ if (typeof n == 'string') {
39556
+ buf.push(n);
39557
+ return null;
39267
39558
  }
39559
+ } else {
39560
+ return null;
39268
39561
  }
39269
39562
  }
39270
- if (defaultNS !== node.namespaceURI) {
39271
- for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
39272
- var namespace = visibleNamespaces[nsi];
39273
- if (namespace.namespace === node.namespaceURI) {
39274
- if (namespace.prefix) {
39275
- prefixedNodeName = namespace.prefix + ':' + nodeName;
39563
+
39564
+ switch (n.nodeType) {
39565
+ case ELEMENT_NODE:
39566
+ var attrs = n.attributes;
39567
+ var len = attrs.length;
39568
+ var nodeName = n.tagName;
39569
+
39570
+ html = NAMESPACE.isHTML(n.namespaceURI) || html;
39571
+
39572
+ var prefixedNodeName = nodeName;
39573
+ if (!html && !n.prefix && n.namespaceURI) {
39574
+ var defaultNS;
39575
+ // lookup current default ns from `xmlns` attribute
39576
+ for (var ai = 0; ai < attrs.length; ai++) {
39577
+ if (attrs.item(ai).name === 'xmlns') {
39578
+ defaultNS = attrs.item(ai).value;
39579
+ break;
39580
+ }
39581
+ }
39582
+ if (!defaultNS) {
39583
+ // lookup current default ns in visibleNamespaces
39584
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
39585
+ var nsEntry = ns[nsi];
39586
+ if (nsEntry.prefix === '' && nsEntry.namespace === n.namespaceURI) {
39587
+ defaultNS = nsEntry.namespace;
39588
+ break;
39589
+ }
39590
+ }
39591
+ }
39592
+ if (defaultNS !== n.namespaceURI) {
39593
+ for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
39594
+ var nsEntry = ns[nsi];
39595
+ if (nsEntry.namespace === n.namespaceURI) {
39596
+ if (nsEntry.prefix) {
39597
+ prefixedNodeName = nsEntry.prefix + ':' + nodeName;
39598
+ }
39599
+ break;
39600
+ }
39601
+ }
39276
39602
  }
39277
- break
39278
39603
  }
39279
- }
39280
- }
39281
- }
39282
39604
 
39283
- buf.push('<', prefixedNodeName);
39605
+ if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) {
39606
+ throw new DOMException(INVALID_STATE_ERR, 'The element name "' + prefixedNodeName + '" is not a valid XML QName');
39607
+ }
39608
+ buf.push('<', prefixedNodeName);
39609
+
39610
+ // Build a fresh namespace snapshot for this element's children.
39611
+ // The slice prevents sibling elements from inheriting each other's declarations.
39612
+ var childNs = ns.slice();
39613
+ for (var i = 0; i < len; i++) {
39614
+ var attr = attrs.item(i);
39615
+ if (attr.prefix == 'xmlns') {
39616
+ childNs.push({ prefix: attr.localName, namespace: attr.value });
39617
+ } else if (attr.nodeName == 'xmlns') {
39618
+ childNs.push({ prefix: '', namespace: attr.value });
39619
+ }
39620
+ }
39284
39621
 
39285
- for(var i=0;i<len;i++){
39286
- // add namespaces for attributes
39287
- var attr = attrs.item(i);
39288
- if (attr.prefix == 'xmlns') {
39289
- visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
39290
- }else if(attr.nodeName == 'xmlns'){
39291
- visibleNamespaces.push({ prefix: '', namespace: attr.value });
39292
- }
39293
- }
39622
+ for (var i = 0; i < len; i++) {
39623
+ var attr = attrs.item(i);
39624
+ if (needNamespaceDefine(attr, html, childNs)) {
39625
+ var attrPrefix = attr.prefix || '';
39626
+ var uri = attr.namespaceURI;
39627
+ addSerializedAttribute(buf, attrPrefix ? 'xmlns:' + attrPrefix : 'xmlns', uri, requireWellFormed);
39628
+ childNs.push({ prefix: attrPrefix, namespace: uri });
39629
+ }
39630
+ // Apply nodeFilter and serialize the attribute.
39631
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
39632
+ if (filteredAttr) {
39633
+ if (typeof filteredAttr === 'string') {
39634
+ buf.push(filteredAttr);
39635
+ } else {
39636
+ addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
39637
+ }
39638
+ }
39639
+ }
39294
39640
 
39295
- for(var i=0;i<len;i++){
39296
- var attr = attrs.item(i);
39297
- if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
39298
- var prefix = attr.prefix||'';
39299
- var uri = attr.namespaceURI;
39300
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
39301
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
39302
- }
39303
- serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
39304
- }
39641
+ // add namespace for current node
39642
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
39643
+ var nodePrefix = n.prefix || '';
39644
+ var uri = n.namespaceURI;
39645
+ addSerializedAttribute(buf, nodePrefix ? 'xmlns:' + nodePrefix : 'xmlns', uri, requireWellFormed);
39646
+ childNs.push({ prefix: nodePrefix, namespace: uri });
39647
+ }
39305
39648
 
39306
- // add namespace for current node
39307
- if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
39308
- var prefix = node.prefix||'';
39309
- var uri = node.namespaceURI;
39310
- addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
39311
- visibleNamespaces.push({ prefix: prefix, namespace:uri });
39312
- }
39649
+ var child = n.firstChild;
39650
+ if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
39651
+ buf.push('>');
39652
+ if (html && /^script$/i.test(nodeName)) {
39653
+ // Inline serialization for <script> children; return null to skip walkDOM descent.
39654
+ while (child) {
39655
+ if (child.data) {
39656
+ buf.push(child.data);
39657
+ } else {
39658
+ serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
39659
+ }
39660
+ child = child.nextSibling;
39661
+ }
39662
+ buf.push('</', nodeName, '>');
39663
+ return null;
39664
+ }
39665
+ // Return child context; walkDOM descends and exit emits the closing tag.
39666
+ return { ns: childNs, isHTML: html, tag: prefixedNodeName };
39667
+ } else {
39668
+ buf.push('/>');
39669
+ return null;
39670
+ }
39671
+
39672
+ case DOCUMENT_NODE:
39673
+ case DOCUMENT_FRAGMENT_NODE:
39674
+ // Descend into children; exit is a no-op (tag is null).
39675
+ return { ns: ns.slice(), isHTML: html, tag: null };
39676
+
39677
+ case ATTRIBUTE_NODE:
39678
+ addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
39679
+ return null;
39680
+
39681
+ case TEXT_NODE:
39682
+ /**
39683
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
39684
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
39685
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
39686
+ * `&amp;` and `&lt;` respectively.
39687
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
39688
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
39689
+ * when that string is not marking the end of a CDATA section.
39690
+ *
39691
+ * In the content of elements, character data is any string of characters
39692
+ * which does not contain the start-delimiter of any markup
39693
+ * and does not include the CDATA-section-close delimiter, `]]>`.
39694
+ *
39695
+ * @see https://www.w3.org/TR/xml/#NT-CharData
39696
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
39697
+ */
39698
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
39699
+ return null;
39700
+
39701
+ case CDATA_SECTION_NODE:
39702
+ if (requireWellFormed && n.data.indexOf(']]>') !== -1) {
39703
+ throw new DOMException(INVALID_STATE_ERR, 'The CDATASection data contains "]]>"');
39704
+ }
39705
+ buf.push('<![CDATA[', n.data.replace(/]]>/g, ']]]]><![CDATA[>'), ']]>');
39706
+ return null;
39313
39707
 
39314
- if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
39315
- buf.push('>');
39316
- //if is cdata child node
39317
- if(isHTML && /^script$/i.test(nodeName)){
39318
- while(child){
39319
- if(child.data){
39320
- buf.push(child.data);
39321
- }else {
39322
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39708
+ case COMMENT_NODE:
39709
+ if (requireWellFormed && n.data.indexOf('-->') !== -1) {
39710
+ throw new DOMException(INVALID_STATE_ERR, 'The comment node data contains "-->"');
39323
39711
  }
39324
- child = child.nextSibling;
39325
- }
39326
- }else
39327
- {
39328
- while(child){
39329
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39330
- child = child.nextSibling;
39331
- }
39332
- }
39333
- buf.push('</',prefixedNodeName,'>');
39334
- }else {
39335
- buf.push('/>');
39336
- }
39337
- // remove added visible namespaces
39338
- //visibleNamespaces.length = startVisibleNamespaces;
39339
- return;
39340
- case DOCUMENT_NODE:
39341
- case DOCUMENT_FRAGMENT_NODE:
39342
- var child = node.firstChild;
39343
- while(child){
39344
- serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
39345
- child = child.nextSibling;
39346
- }
39347
- return;
39348
- case ATTRIBUTE_NODE:
39349
- return addSerializedAttribute(buf, node.name, node.value);
39350
- case TEXT_NODE:
39351
- /**
39352
- * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
39353
- * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
39354
- * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
39355
- * `&amp;` and `&lt;` respectively.
39356
- * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
39357
- * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
39358
- * when that string is not marking the end of a CDATA section.
39359
- *
39360
- * In the content of elements, character data is any string of characters
39361
- * which does not contain the start-delimiter of any markup
39362
- * and does not include the CDATA-section-close delimiter, `]]>`.
39363
- *
39364
- * @see https://www.w3.org/TR/xml/#NT-CharData
39365
- * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
39366
- */
39367
- return buf.push(node.data
39368
- .replace(/[<&>]/g,_xmlEncoder)
39369
- );
39370
- case CDATA_SECTION_NODE:
39371
- return buf.push( '<![CDATA[',node.data,']]>');
39372
- case COMMENT_NODE:
39373
- return buf.push( "<!--",node.data,"-->");
39374
- case DOCUMENT_TYPE_NODE:
39375
- var pubid = node.publicId;
39376
- var sysid = node.systemId;
39377
- buf.push('<!DOCTYPE ',node.name);
39378
- if(pubid){
39379
- buf.push(' PUBLIC ', pubid);
39380
- if (sysid && sysid!='.') {
39381
- buf.push(' ', sysid);
39712
+ buf.push('<!--', n.data, '-->');
39713
+ return null;
39714
+
39715
+ case DOCUMENT_TYPE_NODE:
39716
+ if (requireWellFormed) {
39717
+ if (!tagNamePattern.test(n.name)) {
39718
+ throw new DOMException(INVALID_STATE_ERR, 'The doctype name "' + n.name + '" is not a valid XML Name');
39719
+ }
39720
+ if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
39721
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType publicId is not a valid PubidLiteral');
39722
+ }
39723
+ if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) {
39724
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType systemId is not a valid SystemLiteral');
39725
+ }
39726
+ if (n.internalSubset && n.internalSubset.indexOf(']>') !== -1) {
39727
+ throw new DOMException(INVALID_STATE_ERR, 'DocumentType internalSubset contains "]>"');
39728
+ }
39729
+ }
39730
+ var pubid = n.publicId;
39731
+ var sysid = n.systemId;
39732
+ buf.push('<!DOCTYPE ', n.name);
39733
+ if (pubid) {
39734
+ buf.push(' PUBLIC ', pubid);
39735
+ if (sysid && sysid != '.') {
39736
+ buf.push(' ', sysid);
39737
+ }
39738
+ buf.push('>');
39739
+ } else if (sysid && sysid != '.') {
39740
+ buf.push(' SYSTEM ', sysid, '>');
39741
+ } else {
39742
+ var sub = n.internalSubset;
39743
+ if (sub) {
39744
+ buf.push(' [', sub, ']');
39745
+ }
39746
+ buf.push('>');
39747
+ }
39748
+ return null;
39749
+
39750
+ case PROCESSING_INSTRUCTION_NODE:
39751
+ if (requireWellFormed) {
39752
+ if (!tagNamePattern.test(n.target) || n.target.indexOf(':') !== -1 || n.target.toLowerCase() === 'xml') {
39753
+ throw new DOMException(
39754
+ INVALID_STATE_ERR,
39755
+ 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved'
39756
+ );
39757
+ }
39758
+ if (n.data.indexOf('?>') !== -1) {
39759
+ throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
39760
+ }
39761
+ }
39762
+ buf.push('<?', n.target, ' ', n.data, '?>');
39763
+ return null;
39764
+
39765
+ case ENTITY_REFERENCE_NODE:
39766
+ if (requireWellFormed && !tagNamePattern.test(n.nodeName)) {
39767
+ throw new DOMException(
39768
+ INVALID_STATE_ERR,
39769
+ 'The entity reference name "' + n.nodeName + '" is not a valid XML Name'
39770
+ );
39771
+ }
39772
+ buf.push('&', n.nodeName, ';');
39773
+ return null;
39774
+
39775
+ //case ENTITY_NODE:
39776
+ //case NOTATION_NODE:
39777
+ default:
39778
+ buf.push('??', n.nodeName);
39779
+ return null;
39382
39780
  }
39383
- buf.push('>');
39384
- }else if(sysid && sysid!='.'){
39385
- buf.push(' SYSTEM ', sysid, '>');
39386
- }else {
39387
- var sub = node.internalSubset;
39388
- if(sub){
39389
- buf.push(" [",sub,"]");
39781
+ },
39782
+ exit: function (n, childCtx) {
39783
+ if (childCtx && childCtx.tag) {
39784
+ buf.push('</', childCtx.tag, '>');
39390
39785
  }
39391
- buf.push(">");
39392
- }
39393
- return;
39394
- case PROCESSING_INSTRUCTION_NODE:
39395
- return buf.push( "<?",node.target," ",node.data,"?>");
39396
- case ENTITY_REFERENCE_NODE:
39397
- return buf.push( '&',node.nodeName,';');
39398
- //case ENTITY_NODE:
39399
- //case NOTATION_NODE:
39400
- default:
39401
- buf.push('??',node.nodeName);
39402
- }
39786
+ },
39787
+ });
39403
39788
  }
39404
- function importNode(doc,node,deep){
39405
- var node2;
39406
- switch (node.nodeType) {
39407
- case ELEMENT_NODE:
39408
- node2 = node.cloneNode(false);
39409
- node2.ownerDocument = doc;
39410
- //var attrs = node2.attributes;
39411
- //var len = attrs.length;
39412
- //for(var i=0;i<len;i++){
39413
- //node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));
39414
- //}
39415
- case DOCUMENT_FRAGMENT_NODE:
39416
- break;
39417
- case ATTRIBUTE_NODE:
39418
- deep = true;
39419
- break;
39420
- //case ENTITY_REFERENCE_NODE:
39421
- //case PROCESSING_INSTRUCTION_NODE:
39422
- ////case TEXT_NODE:
39423
- //case CDATA_SECTION_NODE:
39424
- //case COMMENT_NODE:
39425
- // deep = false;
39426
- // break;
39427
- //case DOCUMENT_NODE:
39428
- //case DOCUMENT_TYPE_NODE:
39429
- //cannot be imported.
39430
- //case ENTITY_NODE:
39431
- //case NOTATION_NODE:
39432
- //can not hit in level3
39433
- //default:throw e;
39434
- }
39435
- if(!node2){
39436
- node2 = node.cloneNode(false);//false
39437
- }
39438
- node2.ownerDocument = doc;
39439
- node2.parentNode = null;
39440
- if(deep){
39441
- var child = node.firstChild;
39442
- while(child){
39443
- node2.appendChild(importNode(doc,child,deep));
39444
- child = child.nextSibling;
39445
- }
39446
- }
39447
- return node2;
39789
+ /**
39790
+ * Imports a node from a different document into `doc`, creating a new copy.
39791
+ * Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
39792
+ * stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
39793
+ * Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
39794
+ * always forced to `true`
39795
+ * because an attribute's value lives in a child text node.
39796
+ *
39797
+ * @param {Document} doc
39798
+ * The document that will own the imported node.
39799
+ * @param {Node} node
39800
+ * The node to import.
39801
+ * @param {boolean} deep
39802
+ * If `true`, descendants are imported recursively.
39803
+ * @returns {Node}
39804
+ * The newly imported node, now owned by `doc`.
39805
+ */
39806
+ function importNode(doc, node, deep) {
39807
+ var destRoot;
39808
+ walkDOM(node, null, {
39809
+ enter: function (srcNode, destParent) {
39810
+ // Shallow-clone the node and stamp it into the target document.
39811
+ var destNode = srcNode.cloneNode(false);
39812
+ destNode.ownerDocument = doc;
39813
+ destNode.parentNode = null;
39814
+ // capture as the root of the imported subtree or attach to parent.
39815
+ if (destParent === null) {
39816
+ destRoot = destNode;
39817
+ } else {
39818
+ destParent.appendChild(destNode);
39819
+ }
39820
+ // ATTRIBUTE_NODE must always be imported deeply: its value lives in a child text node.
39821
+ var shouldDeep = srcNode.nodeType === ATTRIBUTE_NODE || deep;
39822
+ return shouldDeep ? destNode : null;
39823
+ },
39824
+ });
39825
+ return destRoot;
39448
39826
  }
39449
39827
  //
39450
39828
  //var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,
39451
39829
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
39452
- function cloneNode(doc,node,deep){
39453
- var node2 = new node.constructor();
39454
- for (var n in node) {
39455
- if (Object.prototype.hasOwnProperty.call(node, n)) {
39456
- var v = node[n];
39457
- if (typeof v != "object") {
39458
- if (v != node2[n]) {
39459
- node2[n] = v;
39830
+ function cloneNode(doc, node, deep) {
39831
+ var destRoot;
39832
+ walkDOM(node, null, {
39833
+ enter: function (srcNode, destParent) {
39834
+ // 1. Create a blank node of the same type and copy all scalar own properties.
39835
+ var destNode = new srcNode.constructor();
39836
+ for (var n in srcNode) {
39837
+ if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
39838
+ var v = srcNode[n];
39839
+ if (typeof v != 'object') {
39840
+ if (v != destNode[n]) {
39841
+ destNode[n] = v;
39842
+ }
39843
+ }
39460
39844
  }
39461
39845
  }
39462
- }
39463
- }
39464
- if(node.childNodes){
39465
- node2.childNodes = new NodeList();
39466
- }
39467
- node2.ownerDocument = doc;
39468
- switch (node2.nodeType) {
39469
- case ELEMENT_NODE:
39470
- var attrs = node.attributes;
39471
- var attrs2 = node2.attributes = new NamedNodeMap();
39472
- var len = attrs.length;
39473
- attrs2._ownerElement = node2;
39474
- for(var i=0;i<len;i++){
39475
- node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
39476
- }
39477
- break; case ATTRIBUTE_NODE:
39478
- deep = true;
39479
- }
39480
- if(deep){
39481
- var child = node.firstChild;
39482
- while(child){
39483
- node2.appendChild(cloneNode(doc,child,deep));
39484
- child = child.nextSibling;
39485
- }
39486
- }
39487
- return node2;
39846
+ if (srcNode.childNodes) {
39847
+ destNode.childNodes = new NodeList();
39848
+ }
39849
+ destNode.ownerDocument = doc;
39850
+ // 2. Handle node-type-specific setup.
39851
+ // Attributes are not DOM children, so they are cloned inline here
39852
+ // rather than by walkDOM descent.
39853
+ // ATTRIBUTE_NODE forces deep=true so its own children are walked.
39854
+ var shouldDeep = deep;
39855
+ switch (destNode.nodeType) {
39856
+ case ELEMENT_NODE:
39857
+ var attrs = srcNode.attributes;
39858
+ var attrs2 = (destNode.attributes = new NamedNodeMap());
39859
+ var len = attrs.length;
39860
+ attrs2._ownerElement = destNode;
39861
+ for (var i = 0; i < len; i++) {
39862
+ destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
39863
+ }
39864
+ break;
39865
+ case ATTRIBUTE_NODE:
39866
+ shouldDeep = true;
39867
+ }
39868
+ // 3. Attach to parent, or capture as the root of the cloned subtree.
39869
+ if (destParent !== null) {
39870
+ destParent.appendChild(destNode);
39871
+ } else {
39872
+ destRoot = destNode;
39873
+ }
39874
+ // 4. Return destNode as the context for children (causes walkDOM to descend),
39875
+ // or null to skip children (shallow clone).
39876
+ return shouldDeep ? destNode : null;
39877
+ },
39878
+ });
39879
+ return destRoot;
39488
39880
  }
39489
39881
 
39490
39882
  function __set__(object,key,value){
@@ -39500,49 +39892,55 @@ function requireDom () {
39500
39892
  }
39501
39893
  });
39502
39894
 
39503
- Object.defineProperty(Node.prototype,'textContent',{
39504
- get:function(){
39505
- return getTextContent(this);
39895
+ /**
39896
+ * The text content of this node and its descendants.
39897
+ *
39898
+ * Setting `textContent` on an element or document fragment replaces all child nodes with a
39899
+ * single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
39900
+ *
39901
+ * @type {string | null}
39902
+ * @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
39903
+ */
39904
+ Object.defineProperty(Node.prototype, 'textContent', {
39905
+ get: function () {
39906
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
39907
+ var buf = [];
39908
+ walkDOM(this, null, {
39909
+ enter: function (n) {
39910
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) {
39911
+ return true; // enter children
39912
+ }
39913
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) {
39914
+ return null; // excluded from text content
39915
+ }
39916
+ buf.push(n.nodeValue);
39917
+ },
39918
+ });
39919
+ return buf.join('');
39920
+ }
39921
+ return this.nodeValue;
39506
39922
  },
39507
39923
 
39508
- set:function(data){
39509
- switch(this.nodeType){
39510
- case ELEMENT_NODE:
39511
- case DOCUMENT_FRAGMENT_NODE:
39512
- while(this.firstChild){
39513
- this.removeChild(this.firstChild);
39514
- }
39515
- if(data || String(data)){
39516
- this.appendChild(this.ownerDocument.createTextNode(data));
39517
- }
39518
- break;
39924
+ set: function (data) {
39925
+ switch (this.nodeType) {
39926
+ case ELEMENT_NODE:
39927
+ case DOCUMENT_FRAGMENT_NODE:
39928
+ while (this.firstChild) {
39929
+ this.removeChild(this.firstChild);
39930
+ }
39931
+ if (data || String(data)) {
39932
+ this.appendChild(this.ownerDocument.createTextNode(data));
39933
+ }
39934
+ break;
39519
39935
 
39520
- default:
39521
- this.data = data;
39522
- this.value = data;
39523
- this.nodeValue = data;
39936
+ default:
39937
+ this.data = data;
39938
+ this.value = data;
39939
+ this.nodeValue = data;
39524
39940
  }
39525
- }
39941
+ },
39526
39942
  });
39527
39943
 
39528
- function getTextContent(node){
39529
- switch(node.nodeType){
39530
- case ELEMENT_NODE:
39531
- case DOCUMENT_FRAGMENT_NODE:
39532
- var buf = [];
39533
- node = node.firstChild;
39534
- while(node){
39535
- if(node.nodeType!==7 && node.nodeType !==8){
39536
- buf.push(getTextContent(node));
39537
- }
39538
- node = node.nextSibling;
39539
- }
39540
- return buf.join('');
39541
- default:
39542
- return node.nodeValue;
39543
- }
39544
- }
39545
-
39546
39944
  __set__ = function(object,key,value){
39547
39945
  //console.log(value)
39548
39946
  object['$$'+key] = value;
@@ -39558,6 +39956,7 @@ function requireDom () {
39558
39956
  dom.Element = Element;
39559
39957
  dom.Node = Node;
39560
39958
  dom.NodeList = NodeList;
39959
+ dom.walkDOM = walkDOM;
39561
39960
  dom.XMLSerializer = XMLSerializer;
39562
39961
  //}
39563
39962
  return dom;
@@ -39572,7 +39971,7 @@ var hasRequiredEntities;
39572
39971
  function requireEntities () {
39573
39972
  if (hasRequiredEntities) return entities;
39574
39973
  hasRequiredEntities = 1;
39575
- (function (exports$1) {
39974
+ (function (exports) {
39576
39975
 
39577
39976
  var freeze = requireConventions().freeze;
39578
39977
 
@@ -39583,7 +39982,7 @@ function requireEntities () {
39583
39982
  * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
39584
39983
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
39585
39984
  */
39586
- exports$1.XML_ENTITIES = freeze({
39985
+ exports.XML_ENTITIES = freeze({
39587
39986
  amp: '&',
39588
39987
  apos: "'",
39589
39988
  gt: '>',
@@ -39605,7 +40004,7 @@ function requireEntities () {
39605
40004
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
39606
40005
  * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
39607
40006
  */
39608
- exports$1.HTML_ENTITIES = freeze({
40007
+ exports.HTML_ENTITIES = freeze({
39609
40008
  Aacute: '\u00C1',
39610
40009
  aacute: '\u00E1',
39611
40010
  Abreve: '\u0102',
@@ -41737,7 +42136,7 @@ function requireEntities () {
41737
42136
  * @deprecated use `HTML_ENTITIES` instead
41738
42137
  * @see HTML_ENTITIES
41739
42138
  */
41740
- exports$1.entityMap = exports$1.HTML_ENTITIES;
42139
+ exports.entityMap = exports.HTML_ENTITIES;
41741
42140
  } (entities));
41742
42141
  return entities;
41743
42142
  }
@@ -41750,14 +42149,8 @@ function requireSax () {
41750
42149
  if (hasRequiredSax) return sax;
41751
42150
  hasRequiredSax = 1;
41752
42151
  var NAMESPACE = requireConventions().NAMESPACE;
42152
+ var tagNamePattern = requireConventions().tagNamePattern;
41753
42153
 
41754
- //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
41755
- //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
41756
- //[5] Name ::= NameStartChar (NameChar)*
41757
- var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;//\u10000-\uEFFFF
41758
- var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
41759
- var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
41760
- //var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
41761
42154
  //var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
41762
42155
 
41763
42156
  //S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
@@ -41868,7 +42261,13 @@ function requireSax () {
41868
42261
  switch(source.charAt(tagStart+1)){
41869
42262
  case '/':
41870
42263
  var end = source.indexOf('>',tagStart+3);
41871
- var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
42264
+ // Anchored trailing-whitespace trim. The former `/[ \t\n\r]+$/g` backtracked
42265
+ // quadratically on a name shaped `whitespace-run + non-whitespace char`
42266
+ // (an end tag `</ … x>`): from every start position it extended `[ws]+`
42267
+ // to the end and then failed the `$` anchor. This anchored form matches the
42268
+ // whole string once and captures everything up to the last non-whitespace
42269
+ // character, so it trims in linear time with byte-identical output.
42270
+ var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, '$1');
41872
42271
  var config = parseStack.pop();
41873
42272
  if(end<0){
41874
42273
 
@@ -41879,6 +42278,14 @@ function requireSax () {
41879
42278
  tagName = tagName.replace(/[\s<].*/,'');
41880
42279
  errorHandler.error("end tag name: "+tagName+' maybe not complete');
41881
42280
  end = tagStart+1+tagName.length;
42281
+ }else if(/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])){
42282
+ // The XML `ETag` production is `'</' Name S? '>'`: only optional whitespace may follow
42283
+ // the `Name`. A valid `Name` followed by whitespace and non-whitespace residue (e.g.
42284
+ // `</a\nbogus>` or `</a bogus>`) is not well-formed, but historically it was silently
42285
+ // accepted (the malformed end tag ignored, the residue dropped, the element left on the
42286
+ // stack). Report it as a recoverable `error` (which a custom errorHandler may escalate to
42287
+ // fatal) while keeping the existing recovery so the parsed DOM stays byte-identical.
42288
+ errorHandler.error('end tag name is followed by whitespace and trailing content: "'+tagName+'"');
41882
42289
  }
41883
42290
  var localNSMap = config.localNSMap;
41884
42291
  var endMatch = config.tagName == tagName;
@@ -42002,6 +42409,15 @@ function requireSax () {
42002
42409
  var s = S_TAG;//status
42003
42410
  while(true){
42004
42411
  var c = source.charAt(p);
42412
+ if (s === S_TAG && c === '<') {
42413
+ // A `<` can never occur inside a tag name. Without this guard the scan runs
42414
+ // on to the next `>` (or EOF) before the tag name is rejected, so a document
42415
+ // with many `<` inside a malformed tag makes each one-character recovery step
42416
+ // re-scan to the distant `>` — O(n^2). Stopping at the `<` keeps each recovery
42417
+ // step bounded. The candidate scanned so far is reported raw, consistent with
42418
+ // the sibling invalid-tag-name throw below.
42419
+ throw new Error('unexpected < in tag name: ' + source.slice(start, p));
42420
+ }
42005
42421
  switch(c){
42006
42422
  case '=':
42007
42423
  if(s === S_ATTR){//attrName
@@ -42194,9 +42610,13 @@ function requireSax () {
42194
42610
  if(nsPrefix !== false){//hack!!
42195
42611
  if(localNSMap == null){
42196
42612
  localNSMap = {};
42197
- //console.log(currentNSMap,0)
42198
- _copy(currentNSMap,currentNSMap={});
42199
- //console.log(currentNSMap,1)
42613
+ // Derive the child scope's namespace map by prototype-chain inheritance
42614
+ // instead of a flat copy: lookups inherit ancestor prefixes transparently,
42615
+ // so a document nesting N scopes retains O(N) map entries rather than
42616
+ // sum(1..N) = O(N^2). localNSMap stays a flat own-only record of the
42617
+ // prefixes declared at THIS element, so own-property enumeration
42618
+ // (endPrefixMapping below) still reports only local declarations.
42619
+ currentNSMap = Object.create(currentNSMap);
42200
42620
  }
42201
42621
  currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
42202
42622
  a.uri = NAMESPACE.XMLNS;
@@ -42348,7 +42768,7 @@ function requireSax () {
42348
42768
  function parseInstruction(source,start,domBuilder){
42349
42769
  var end = source.indexOf('?>',start);
42350
42770
  if(end){
42351
- var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
42771
+ var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
42352
42772
  if(match){
42353
42773
  match[0].length;
42354
42774
  domBuilder.processingInstruction(match[1], match[2]) ;
@@ -43545,7 +43965,7 @@ var hasRequiredMoment;
43545
43965
  function requireMoment () {
43546
43966
  if (hasRequiredMoment) return moment$1.exports;
43547
43967
  hasRequiredMoment = 1;
43548
- (function (module, exports$1) {
43968
+ (function (module, exports) {
43549
43969
  (function (global, factory) {
43550
43970
  module.exports = factory() ;
43551
43971
  }(this, (function () {
@@ -49235,7 +49655,7 @@ function requireMomentTimezone () {
49235
49655
  hasRequiredMomentTimezone = 1;
49236
49656
  (function (module) {
49237
49657
  //! moment-timezone.js
49238
- //! version : 0.6.0
49658
+ //! version : 0.6.3
49239
49659
  //! Copyright (c) JS Foundation and other contributors
49240
49660
  //! license : MIT
49241
49661
  //! github.com/moment/moment-timezone
@@ -49261,7 +49681,7 @@ function requireMomentTimezone () {
49261
49681
  // return moment;
49262
49682
  // }
49263
49683
 
49264
- var VERSION = "0.6.0",
49684
+ var VERSION = "0.6.3",
49265
49685
  zones = {},
49266
49686
  links = {},
49267
49687
  countries = {},
@@ -81680,7 +82100,7 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
81680
82100
  verifySemanticsOfNgModuleImport(modOrStandaloneCmpt, moduleType);
81681
82101
  verifySemanticsOfNgModuleDef(modOrStandaloneCmpt, false, moduleType);
81682
82102
  });
81683
- const exports$1 = maybeUnwrapFn(ngModuleDef.exports);
82103
+ const exports = maybeUnwrapFn(ngModuleDef.exports);
81684
82104
  declarations.forEach(verifyDeclarationsHaveDefinitions);
81685
82105
  declarations.forEach(verifyDirectivesHaveSelector);
81686
82106
  declarations.forEach((declarationType) => verifyNotStandalone(declarationType, moduleType));
@@ -81688,7 +82108,7 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
81688
82108
  ...declarations.map(resolveForwardRef),
81689
82109
  ...flatten(imports.map(computeCombinedExports)).map(resolveForwardRef),
81690
82110
  ];
81691
- exports$1.forEach(verifyExportsAreDeclaredOrReExported);
82111
+ exports.forEach(verifyExportsAreDeclaredOrReExported);
81692
82112
  declarations.forEach((decl) => verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot));
81693
82113
  const ngModule = getAnnotation(moduleType, 'NgModule');
81694
82114
  if (ngModule) {
@@ -99707,11 +100127,11 @@ const getRowActionAttrs = attrs => {
99707
100127
  return tmpl;
99708
100128
  };
99709
100129
 
99710
- const $RAF = window.requestAnimationFrame;
100130
+ const $RAF$1 = window.requestAnimationFrame;
99711
100131
  const $RAFQueue = [];
99712
100132
  const invokeLater = fn => {
99713
100133
  if (!$RAFQueue.length) {
99714
- $RAF(() => {
100134
+ $RAF$1(() => {
99715
100135
  $RAFQueue.forEach(f => f());
99716
100136
  $RAFQueue.length = 0;
99717
100137
  });
@@ -100253,220 +100673,70 @@ const getFnForEventExpr = (expr) => {
100253
100673
  return fnExecutor(expr, ExpressionType.Action);
100254
100674
  };
100255
100675
 
100256
- // Constants
100257
- const WIDGET_ID_REGEX = /^(widget-[^_]+)/;
100258
- const WIDGET_PROPERTY_REGEX = /^widget-[^_]+_(.+)$/;
100259
- const ARRAY_INDEX_PLACEHOLDER = '[$i]';
100260
- const ARRAY_INDEX_ZERO = '[0]';
100261
100676
  const registry = new Map();
100262
100677
  const watchIdGenerator = new IDGenerator('watch-id-');
100263
- const FIRST_TIME_WATCH = Object.freeze({});
100264
- /**
100265
- * Extracts widget ID from identifier (e.g., "widget-id23_eventsource" -> "widget-id23")
100266
- */
100267
- const getWidgetId = (identifier) => {
100268
- if (!identifier || typeof identifier !== 'string') {
100269
- return null;
100270
- }
100271
- const match = identifier.match(WIDGET_ID_REGEX);
100272
- return match ? match[1] : null;
100273
- };
100274
- /**
100275
- * Extracts property name from identifier (e.g., "widget-id23_eventsource" -> "eventsource")
100276
- */
100277
- const getPropertyName = (identifier) => {
100278
- if (!identifier || typeof identifier !== 'string') {
100279
- return identifier;
100280
- }
100281
- const match = identifier.match(WIDGET_PROPERTY_REGEX);
100282
- return match ? match[1] : identifier;
100283
- };
100284
- /**
100285
- * Array consumer wrapper for array-based expressions
100286
- */
100678
+ const FIRST_TIME_WATCH = {};
100679
+ Object.freeze(FIRST_TIME_WATCH);
100287
100680
  const arrayConsumer = (listenerFn, restExpr, newVal, oldVal) => {
100288
- if (!isArray(newVal)) {
100289
- return;
100290
- }
100291
- let formattedData = newVal.map(datum => findValueOf(datum, restExpr));
100292
- // Flatten if result is array of arrays
100293
- if (isArray(formattedData[0])) {
100294
- formattedData = flatten$1(formattedData);
100681
+ let data = newVal, formattedData;
100682
+ if (isArray(data)) {
100683
+ formattedData = data.map(function (datum) {
100684
+ return findValueOf(datum, restExpr);
100685
+ });
100686
+ // If resulting structure is an array of array, flatten it
100687
+ if (isArray(formattedData[0])) {
100688
+ formattedData = flatten$1(formattedData);
100689
+ }
100690
+ listenerFn(formattedData, oldVal);
100295
100691
  }
100296
- listenerFn(formattedData, oldVal);
100297
100692
  };
100298
- /**
100299
- * Updates watch info for array expressions
100300
- */
100301
- const getUpdatedWatchInfo = (expr, acceptsArray, listener) => {
100302
- const regex = /\[\$i\]/g;
100693
+ const getUpdatedWatcInfo = (expr, acceptsArray, listener) => {
100694
+ // listener doesn't accept array
100695
+ // replace all `[$i]` with `[0]` and return the expression
100696
+ let regex = /\[\$i\]/g, $I = '[$i]', $0 = '[0]';
100303
100697
  if (!acceptsArray) {
100304
100698
  return {
100305
- expr: expr.replace(regex, ARRAY_INDEX_ZERO),
100306
- listener
100699
+ 'expr': expr.replace(regex, $0),
100700
+ 'listener': listener
100307
100701
  };
100308
100702
  }
100309
- const lastIndex = expr.lastIndexOf(ARRAY_INDEX_PLACEHOLDER);
100310
- const baseExpr = expr.substring(0, lastIndex).replace(ARRAY_INDEX_PLACEHOLDER, ARRAY_INDEX_ZERO);
100311
- const restExpr = expr.substring(lastIndex + ARRAY_INDEX_PLACEHOLDER.length);
100312
- const arrayConsumerFn = restExpr
100313
- ? arrayConsumer.bind(undefined, listener, restExpr)
100314
- : listener;
100703
+ // listener accepts array
100704
+ // replace all except the last `[$i]` with `[0]` and return the expression.
100705
+ var index = expr.lastIndexOf($I), _expr = expr.substr(0, index).replace($I, $0), restExpr = expr.substr(index + 5), arrayConsumerFn = listener;
100706
+ if (restExpr) {
100707
+ arrayConsumerFn = arrayConsumer.bind(undefined, listener, restExpr);
100708
+ }
100315
100709
  return {
100316
- expr: baseExpr,
100317
- listener: arrayConsumerFn
100710
+ 'expr': _expr,
100711
+ 'listener': arrayConsumerFn
100318
100712
  };
100319
100713
  };
100320
- /**
100321
- * Determines if an expression is static (doesn't need to be watched)
100322
- */
100323
- const STATIC_EXPRESSION_NAMES = [
100324
- "row.getProperty('investment')",
100325
- "row.getProperty('factsheetLink')",
100326
- "row.getProperty('isRebalanceEligible')"
100327
- ];
100328
- const isStaticExpression = (expr) => {
100329
- if (typeof expr !== 'string') {
100330
- return false;
100331
- }
100332
- const trimmedExpr = expr.trim();
100333
- // Expressions that always evaluate to localization strings
100334
- if (trimmedExpr.includes('appLocale')) {
100335
- return true;
100336
- }
100337
- // Hard-coded static expression names
100338
- if (STATIC_EXPRESSION_NAMES.includes(trimmedExpr)) {
100339
- return true;
100340
- }
100341
- return false;
100342
- };
100343
- /**
100344
- * Gets the scope type from the scope object
100345
- */
100346
- const getScopeType = ($scope) => {
100347
- if (!$scope) {
100348
- return null;
100349
- }
100350
- if ($scope.pageName)
100351
- return 'Page';
100352
- if ($scope.prefabName)
100353
- return 'Prefab';
100354
- if ($scope.partialName)
100355
- return 'Partial';
100356
- // Check for App scope
100357
- if ($scope.Variables !== undefined &&
100358
- $scope.Actions !== undefined &&
100359
- !$scope.pageName &&
100360
- !$scope.prefabName &&
100361
- !$scope.partialName) {
100362
- return 'App';
100363
- }
100364
- if ($scope.constructor?.name === 'AppRef') {
100365
- return 'App';
100366
- }
100367
- return null;
100368
- };
100369
- /**
100370
- * Gets scope name based on scope type
100371
- */
100372
- const getScopeName = ($scope, scopeType) => {
100373
- if (!scopeType || !$scope) {
100374
- return null;
100375
- }
100376
- switch (scopeType) {
100377
- case 'Prefab': return $scope.prefabName || null;
100378
- case 'Partial': return $scope.partialName || null;
100379
- case 'Page': return $scope.pageName || null;
100380
- default: return null;
100381
- }
100382
- };
100383
- /**
100384
- * Main watch function
100385
- */
100386
100714
  const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.nextUid(), doNotClone = false, config = {}, isMuted) => {
100387
- // Handle array expressions
100388
- if (expr.includes(ARRAY_INDEX_PLACEHOLDER)) {
100389
- const watchInfo = getUpdatedWatchInfo(expr, config.arrayType || config.isList || false, listener);
100715
+ if (expr.indexOf('[$i]') !== -1) {
100716
+ let watchInfo = getUpdatedWatcInfo(expr, config && (config.arrayType || config.isList), listener);
100390
100717
  expr = watchInfo.expr;
100391
100718
  listener = watchInfo.listener;
100392
100719
  }
100393
- // Handle static expressions
100394
- if (isStaticExpression(expr)) {
100395
- try {
100396
- const fn = $parseExpr(expr);
100397
- const staticValue = fn($scope, $locals);
100398
- listener(staticValue, FIRST_TIME_WATCH);
100399
- }
100400
- catch (e) {
100401
- console.warn(`Error evaluating static expression '${expr}':`, e);
100402
- listener(undefined, FIRST_TIME_WATCH);
100403
- }
100404
- return () => { }; // No-op unsubscribe
100405
- }
100406
100720
  const fn = $parseExpr();
100407
- const scopeType = getScopeType($scope);
100408
- const scopeName = getScopeName($scope, scopeType);
100409
- const watchInfo = {
100410
- fn: fn.bind(null, $scope, $locals),
100721
+ registry.set(identifier, {
100722
+ fn: fn.bind(expr, $scope, $locals),
100411
100723
  listener,
100412
100724
  expr,
100413
100725
  last: FIRST_TIME_WATCH,
100414
100726
  doNotClone,
100415
- isMuted,
100416
- scopeType,
100417
- scopeName
100418
- };
100419
- // Store in registry
100420
- const widgetId = getWidgetId(identifier);
100421
- if (widgetId) {
100422
- const propertyName = getPropertyName(identifier);
100423
- if (!registry.has(widgetId)) {
100424
- registry.set(widgetId, {});
100425
- }
100426
- const widgetGroup = registry.get(widgetId);
100427
- widgetGroup[propertyName] = watchInfo;
100428
- }
100429
- else {
100430
- registry.set(identifier, watchInfo);
100431
- }
100727
+ isMuted: isMuted
100728
+ });
100432
100729
  return () => $unwatch(identifier);
100433
100730
  };
100434
- /**
100435
- * Unwatches a single identifier
100436
- */
100437
- const $unwatch = (identifier) => {
100438
- const widgetId = getWidgetId(identifier);
100439
- if (widgetId) {
100440
- const propertyName = getPropertyName(identifier);
100441
- const widgetGroup = registry.get(widgetId);
100442
- if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
100443
- const watchInfo = widgetGroup[propertyName];
100444
- if (watchInfo) {
100445
- delete widgetGroup[propertyName];
100446
- // Clean up empty widget groups
100447
- if (Object.keys(widgetGroup).length === 0) {
100448
- registry.delete(widgetId);
100449
- }
100450
- return true;
100451
- }
100452
- }
100453
- }
100454
- // Fallback to direct lookup
100455
- if (registry.has(identifier)) {
100456
- registry.delete(identifier);
100457
- return true;
100458
- }
100459
- return false;
100460
- };
100731
+ const $unwatch = identifier => registry.delete(identifier);
100732
+ window.watchRegistry = registry;
100461
100733
  const $appDigest = (() => {
100462
- return (force = false) => {
100734
+ return (force) => {
100463
100735
  {
100464
100736
  return;
100465
100737
  }
100466
100738
  };
100467
100739
  })();
100468
- // Export registry for debugging
100469
- // (window as any).watchRegistry = registry;
100470
100740
 
100471
100741
  var ComponentType;
100472
100742
  (function (ComponentType) {
@@ -100537,7 +100807,6 @@ const REGEX = {
100537
100807
  SUPPORTED_AUDIO_FORMAT: /\.(mp3|ogg|webm|wma|3gp|wav|m4a)$/i,
100538
100808
  SUPPORTED_VIDEO_FORMAT: /\.(mp4|ogg|webm|wmv|mpeg|mpg|avi|mov)$/i,
100539
100809
  VALID_WEB_URL: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9=:?\/\.\-]+(\.[a-zA-Z]{2,5}[\.]{0,1})?/,
100540
- VALID_IMAGE_URL: /^(https?|blob|data|file|ftp):/i,
100541
100810
  REPLACE_PATTERN: /\$\{([^\}]+)\}/g,
100542
100811
  DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i,
100543
100812
  ISO_DATE_FORMAT: /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2}:?\d{2}|Z)$/
@@ -100760,9 +101029,6 @@ const isVideoFile = (fileName) => {
100760
101029
  const isValidWebURL = (url) => {
100761
101030
  return (REGEX.VALID_WEB_URL).test(url);
100762
101031
  };
100763
- const isValidImageUrl = (url) => {
100764
- return (REGEX.VALID_IMAGE_URL).test(url?.trim());
100765
- };
100766
101032
  /*This function returns the url to the resource after checking the validity of url*/
100767
101033
  const getResourceURL = (urlString) => {
100768
101034
  return urlString;
@@ -102016,7 +102282,6 @@ var Utils = /*#__PURE__*/Object.freeze({
102016
102282
  isPageable: isPageable,
102017
102283
  isSafari: isSafari,
102018
102284
  isTablet: isTablet,
102019
- isValidImageUrl: isValidImageUrl,
102020
102285
  isValidWebURL: isValidWebURL,
102021
102286
  isVideoFile: isVideoFile,
102022
102287
  loadScript: loadScript,