Newer
Older
CVSS_3.0_GUI / node_modules / nwjs-builder-phoenix / node_modules / plist / dist / plist-build.js
root on 7 May 2019 119 KB Initial commit
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.plist = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. (function (Buffer){
  3.  
  4. /**
  5. * Module dependencies.
  6. */
  7.  
  8. var base64 = require('base64-js');
  9. var xmlbuilder = require('xmlbuilder');
  10.  
  11. /**
  12. * Module exports.
  13. */
  14.  
  15. exports.build = build;
  16.  
  17. /**
  18. * Accepts a `Date` instance and returns an ISO date string.
  19. *
  20. * @param {Date} d - Date instance to serialize
  21. * @returns {String} ISO date string representation of `d`
  22. * @api private
  23. */
  24.  
  25. function ISODateString(d){
  26. function pad(n){
  27. return n < 10 ? '0' + n : n;
  28. }
  29. return d.getUTCFullYear()+'-'
  30. + pad(d.getUTCMonth()+1)+'-'
  31. + pad(d.getUTCDate())+'T'
  32. + pad(d.getUTCHours())+':'
  33. + pad(d.getUTCMinutes())+':'
  34. + pad(d.getUTCSeconds())+'Z';
  35. }
  36.  
  37. /**
  38. * Returns the internal "type" of `obj` via the
  39. * `Object.prototype.toString()` trick.
  40. *
  41. * @param {Mixed} obj - any value
  42. * @returns {String} the internal "type" name
  43. * @api private
  44. */
  45.  
  46. var toString = Object.prototype.toString;
  47. function type (obj) {
  48. var m = toString.call(obj).match(/\[object (.*)\]/);
  49. return m ? m[1] : m;
  50. }
  51.  
  52. /**
  53. * Generate an XML plist string from the input object `obj`.
  54. *
  55. * @param {Object} obj - the object to convert
  56. * @param {Object} [opts] - optional options object
  57. * @returns {String} converted plist XML string
  58. * @api public
  59. */
  60.  
  61. function build (obj, opts) {
  62. var XMLHDR = {
  63. version: '1.0',
  64. encoding: 'UTF-8'
  65. };
  66.  
  67. var XMLDTD = {
  68. pubid: '-//Apple//DTD PLIST 1.0//EN',
  69. sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
  70. };
  71.  
  72. var doc = xmlbuilder.create('plist');
  73.  
  74. doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone);
  75. doc.dtd(XMLDTD.pubid, XMLDTD.sysid);
  76. doc.att('version', '1.0');
  77.  
  78. walk_obj(obj, doc);
  79.  
  80. if (!opts) opts = {};
  81. // default `pretty` to `true`
  82. opts.pretty = opts.pretty !== false;
  83. return doc.end(opts);
  84. }
  85.  
  86. /**
  87. * depth first, recursive traversal of a javascript object. when complete,
  88. * next_child contains a reference to the build XML object.
  89. *
  90. * @api private
  91. */
  92.  
  93. function walk_obj(next, next_child) {
  94. var tag_type, i, prop;
  95. var name = type(next);
  96.  
  97. if ('Undefined' == name) {
  98. return;
  99. } else if (Array.isArray(next)) {
  100. next_child = next_child.ele('array');
  101. for (i = 0; i < next.length; i++) {
  102. walk_obj(next[i], next_child);
  103. }
  104.  
  105. } else if (Buffer.isBuffer(next)) {
  106. next_child.ele('data').raw(next.toString('base64'));
  107.  
  108. } else if ('Object' == name) {
  109. next_child = next_child.ele('dict');
  110. for (prop in next) {
  111. if (next.hasOwnProperty(prop)) {
  112. next_child.ele('key').txt(prop);
  113. walk_obj(next[prop], next_child);
  114. }
  115. }
  116.  
  117. } else if ('Number' == name) {
  118. // detect if this is an integer or real
  119. // TODO: add an ability to force one way or another via a "cast"
  120. tag_type = (next % 1 === 0) ? 'integer' : 'real';
  121. next_child.ele(tag_type).txt(next.toString());
  122.  
  123. } else if ('Date' == name) {
  124. next_child.ele('date').txt(ISODateString(new Date(next)));
  125.  
  126. } else if ('Boolean' == name) {
  127. next_child.ele(next ? 'true' : 'false');
  128.  
  129. } else if ('String' == name) {
  130. next_child.ele('string').txt(next);
  131.  
  132. } else if ('ArrayBuffer' == name) {
  133. next_child.ele('data').raw(base64.fromByteArray(next));
  134.  
  135. } else if (next && next.buffer && 'ArrayBuffer' == type(next.buffer)) {
  136. // a typed array
  137. next_child.ele('data').raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
  138.  
  139. }
  140. }
  141.  
  142. }).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")})
  143. },{"../node_modules/is-buffer/index.js":3,"base64-js":2,"xmlbuilder":79}],2:[function(require,module,exports){
  144. var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  145.  
  146. ;(function (exports) {
  147. 'use strict';
  148.  
  149. var Arr = (typeof Uint8Array !== 'undefined')
  150. ? Uint8Array
  151. : Array
  152.  
  153. var PLUS = '+'.charCodeAt(0)
  154. var SLASH = '/'.charCodeAt(0)
  155. var NUMBER = '0'.charCodeAt(0)
  156. var LOWER = 'a'.charCodeAt(0)
  157. var UPPER = 'A'.charCodeAt(0)
  158. var PLUS_URL_SAFE = '-'.charCodeAt(0)
  159. var SLASH_URL_SAFE = '_'.charCodeAt(0)
  160.  
  161. function decode (elt) {
  162. var code = elt.charCodeAt(0)
  163. if (code === PLUS ||
  164. code === PLUS_URL_SAFE)
  165. return 62 // '+'
  166. if (code === SLASH ||
  167. code === SLASH_URL_SAFE)
  168. return 63 // '/'
  169. if (code < NUMBER)
  170. return -1 //no match
  171. if (code < NUMBER + 10)
  172. return code - NUMBER + 26 + 26
  173. if (code < UPPER + 26)
  174. return code - UPPER
  175. if (code < LOWER + 26)
  176. return code - LOWER + 26
  177. }
  178.  
  179. function b64ToByteArray (b64) {
  180. var i, j, l, tmp, placeHolders, arr
  181.  
  182. if (b64.length % 4 > 0) {
  183. throw new Error('Invalid string. Length must be a multiple of 4')
  184. }
  185.  
  186. // the number of equal signs (place holders)
  187. // if there are two placeholders, than the two characters before it
  188. // represent one byte
  189. // if there is only one, then the three characters before it represent 2 bytes
  190. // this is just a cheap hack to not do indexOf twice
  191. var len = b64.length
  192. placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
  193.  
  194. // base64 is 4/3 + up to two characters of the original data
  195. arr = new Arr(b64.length * 3 / 4 - placeHolders)
  196.  
  197. // if there are placeholders, only get up to the last complete 4 chars
  198. l = placeHolders > 0 ? b64.length - 4 : b64.length
  199.  
  200. var L = 0
  201.  
  202. function push (v) {
  203. arr[L++] = v
  204. }
  205.  
  206. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  207. tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
  208. push((tmp & 0xFF0000) >> 16)
  209. push((tmp & 0xFF00) >> 8)
  210. push(tmp & 0xFF)
  211. }
  212.  
  213. if (placeHolders === 2) {
  214. tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
  215. push(tmp & 0xFF)
  216. } else if (placeHolders === 1) {
  217. tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
  218. push((tmp >> 8) & 0xFF)
  219. push(tmp & 0xFF)
  220. }
  221.  
  222. return arr
  223. }
  224.  
  225. function uint8ToBase64 (uint8) {
  226. var i,
  227. extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
  228. output = "",
  229. temp, length
  230.  
  231. function encode (num) {
  232. return lookup.charAt(num)
  233. }
  234.  
  235. function tripletToBase64 (num) {
  236. return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
  237. }
  238.  
  239. // go through the array every three bytes, we'll deal with trailing stuff later
  240. for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
  241. temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  242. output += tripletToBase64(temp)
  243. }
  244.  
  245. // pad the end with zeros, but make sure to not forget the extra bytes
  246. switch (extraBytes) {
  247. case 1:
  248. temp = uint8[uint8.length - 1]
  249. output += encode(temp >> 2)
  250. output += encode((temp << 4) & 0x3F)
  251. output += '=='
  252. break
  253. case 2:
  254. temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
  255. output += encode(temp >> 10)
  256. output += encode((temp >> 4) & 0x3F)
  257. output += encode((temp << 2) & 0x3F)
  258. output += '='
  259. break
  260. }
  261.  
  262. return output
  263. }
  264.  
  265. exports.toByteArray = b64ToByteArray
  266. exports.fromByteArray = uint8ToBase64
  267. }(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
  268.  
  269. },{}],3:[function(require,module,exports){
  270. /**
  271. * Determine if an object is Buffer
  272. *
  273. * Author: Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  274. * License: MIT
  275. *
  276. * `npm install is-buffer`
  277. */
  278.  
  279. module.exports = function (obj) {
  280. return !!(obj != null &&
  281. (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
  282. (obj.constructor &&
  283. typeof obj.constructor.isBuffer === 'function' &&
  284. obj.constructor.isBuffer(obj))
  285. ))
  286. }
  287.  
  288. },{}],4:[function(require,module,exports){
  289. /**
  290. * Gets the last element of `array`.
  291. *
  292. * @static
  293. * @memberOf _
  294. * @category Array
  295. * @param {Array} array The array to query.
  296. * @returns {*} Returns the last element of `array`.
  297. * @example
  298. *
  299. * _.last([1, 2, 3]);
  300. * // => 3
  301. */
  302. function last(array) {
  303. var length = array ? array.length : 0;
  304. return length ? array[length - 1] : undefined;
  305. }
  306.  
  307. module.exports = last;
  308.  
  309. },{}],5:[function(require,module,exports){
  310. var arrayEvery = require('../internal/arrayEvery'),
  311. baseCallback = require('../internal/baseCallback'),
  312. baseEvery = require('../internal/baseEvery'),
  313. isArray = require('../lang/isArray'),
  314. isIterateeCall = require('../internal/isIterateeCall');
  315.  
  316. /**
  317. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  318. * The predicate is bound to `thisArg` and invoked with three arguments:
  319. * (value, index|key, collection).
  320. *
  321. * If a property name is provided for `predicate` the created `_.property`
  322. * style callback returns the property value of the given element.
  323. *
  324. * If a value is also provided for `thisArg` the created `_.matchesProperty`
  325. * style callback returns `true` for elements that have a matching property
  326. * value, else `false`.
  327. *
  328. * If an object is provided for `predicate` the created `_.matches` style
  329. * callback returns `true` for elements that have the properties of the given
  330. * object, else `false`.
  331. *
  332. * @static
  333. * @memberOf _
  334. * @alias all
  335. * @category Collection
  336. * @param {Array|Object|string} collection The collection to iterate over.
  337. * @param {Function|Object|string} [predicate=_.identity] The function invoked
  338. * per iteration.
  339. * @param {*} [thisArg] The `this` binding of `predicate`.
  340. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  341. * else `false`.
  342. * @example
  343. *
  344. * _.every([true, 1, null, 'yes'], Boolean);
  345. * // => false
  346. *
  347. * var users = [
  348. * { 'user': 'barney', 'active': false },
  349. * { 'user': 'fred', 'active': false }
  350. * ];
  351. *
  352. * // using the `_.matches` callback shorthand
  353. * _.every(users, { 'user': 'barney', 'active': false });
  354. * // => false
  355. *
  356. * // using the `_.matchesProperty` callback shorthand
  357. * _.every(users, 'active', false);
  358. * // => true
  359. *
  360. * // using the `_.property` callback shorthand
  361. * _.every(users, 'active');
  362. * // => false
  363. */
  364. function every(collection, predicate, thisArg) {
  365. var func = isArray(collection) ? arrayEvery : baseEvery;
  366. if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
  367. predicate = undefined;
  368. }
  369. if (typeof predicate != 'function' || thisArg !== undefined) {
  370. predicate = baseCallback(predicate, thisArg, 3);
  371. }
  372. return func(collection, predicate);
  373. }
  374.  
  375. module.exports = every;
  376.  
  377. },{"../internal/arrayEvery":7,"../internal/baseCallback":11,"../internal/baseEvery":15,"../internal/isIterateeCall":40,"../lang/isArray":49}],6:[function(require,module,exports){
  378. /** Used as the `TypeError` message for "Functions" methods. */
  379. var FUNC_ERROR_TEXT = 'Expected a function';
  380.  
  381. /* Native method references for those with the same name as other `lodash` methods. */
  382. var nativeMax = Math.max;
  383.  
  384. /**
  385. * Creates a function that invokes `func` with the `this` binding of the
  386. * created function and arguments from `start` and beyond provided as an array.
  387. *
  388. * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
  389. *
  390. * @static
  391. * @memberOf _
  392. * @category Function
  393. * @param {Function} func The function to apply a rest parameter to.
  394. * @param {number} [start=func.length-1] The start position of the rest parameter.
  395. * @returns {Function} Returns the new function.
  396. * @example
  397. *
  398. * var say = _.restParam(function(what, names) {
  399. * return what + ' ' + _.initial(names).join(', ') +
  400. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  401. * });
  402. *
  403. * say('hello', 'fred', 'barney', 'pebbles');
  404. * // => 'hello fred, barney, & pebbles'
  405. */
  406. function restParam(func, start) {
  407. if (typeof func != 'function') {
  408. throw new TypeError(FUNC_ERROR_TEXT);
  409. }
  410. start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
  411. return function() {
  412. var args = arguments,
  413. index = -1,
  414. length = nativeMax(args.length - start, 0),
  415. rest = Array(length);
  416.  
  417. while (++index < length) {
  418. rest[index] = args[start + index];
  419. }
  420. switch (start) {
  421. case 0: return func.call(this, rest);
  422. case 1: return func.call(this, args[0], rest);
  423. case 2: return func.call(this, args[0], args[1], rest);
  424. }
  425. var otherArgs = Array(start + 1);
  426. index = -1;
  427. while (++index < start) {
  428. otherArgs[index] = args[index];
  429. }
  430. otherArgs[start] = rest;
  431. return func.apply(this, otherArgs);
  432. };
  433. }
  434.  
  435. module.exports = restParam;
  436.  
  437. },{}],7:[function(require,module,exports){
  438. /**
  439. * A specialized version of `_.every` for arrays without support for callback
  440. * shorthands and `this` binding.
  441. *
  442. * @private
  443. * @param {Array} array The array to iterate over.
  444. * @param {Function} predicate The function invoked per iteration.
  445. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  446. * else `false`.
  447. */
  448. function arrayEvery(array, predicate) {
  449. var index = -1,
  450. length = array.length;
  451.  
  452. while (++index < length) {
  453. if (!predicate(array[index], index, array)) {
  454. return false;
  455. }
  456. }
  457. return true;
  458. }
  459.  
  460. module.exports = arrayEvery;
  461.  
  462. },{}],8:[function(require,module,exports){
  463. /**
  464. * A specialized version of `_.some` for arrays without support for callback
  465. * shorthands and `this` binding.
  466. *
  467. * @private
  468. * @param {Array} array The array to iterate over.
  469. * @param {Function} predicate The function invoked per iteration.
  470. * @returns {boolean} Returns `true` if any element passes the predicate check,
  471. * else `false`.
  472. */
  473. function arraySome(array, predicate) {
  474. var index = -1,
  475. length = array.length;
  476.  
  477. while (++index < length) {
  478. if (predicate(array[index], index, array)) {
  479. return true;
  480. }
  481. }
  482. return false;
  483. }
  484.  
  485. module.exports = arraySome;
  486.  
  487. },{}],9:[function(require,module,exports){
  488. var keys = require('../object/keys');
  489.  
  490. /**
  491. * A specialized version of `_.assign` for customizing assigned values without
  492. * support for argument juggling, multiple sources, and `this` binding `customizer`
  493. * functions.
  494. *
  495. * @private
  496. * @param {Object} object The destination object.
  497. * @param {Object} source The source object.
  498. * @param {Function} customizer The function to customize assigned values.
  499. * @returns {Object} Returns `object`.
  500. */
  501. function assignWith(object, source, customizer) {
  502. var index = -1,
  503. props = keys(source),
  504. length = props.length;
  505.  
  506. while (++index < length) {
  507. var key = props[index],
  508. value = object[key],
  509. result = customizer(value, source[key], key, object, source);
  510.  
  511. if ((result === result ? (result !== value) : (value === value)) ||
  512. (value === undefined && !(key in object))) {
  513. object[key] = result;
  514. }
  515. }
  516. return object;
  517. }
  518.  
  519. module.exports = assignWith;
  520.  
  521. },{"../object/keys":58}],10:[function(require,module,exports){
  522. var baseCopy = require('./baseCopy'),
  523. keys = require('../object/keys');
  524.  
  525. /**
  526. * The base implementation of `_.assign` without support for argument juggling,
  527. * multiple sources, and `customizer` functions.
  528. *
  529. * @private
  530. * @param {Object} object The destination object.
  531. * @param {Object} source The source object.
  532. * @returns {Object} Returns `object`.
  533. */
  534. function baseAssign(object, source) {
  535. return source == null
  536. ? object
  537. : baseCopy(source, keys(source), object);
  538. }
  539.  
  540. module.exports = baseAssign;
  541.  
  542. },{"../object/keys":58,"./baseCopy":12}],11:[function(require,module,exports){
  543. var baseMatches = require('./baseMatches'),
  544. baseMatchesProperty = require('./baseMatchesProperty'),
  545. bindCallback = require('./bindCallback'),
  546. identity = require('../utility/identity'),
  547. property = require('../utility/property');
  548.  
  549. /**
  550. * The base implementation of `_.callback` which supports specifying the
  551. * number of arguments to provide to `func`.
  552. *
  553. * @private
  554. * @param {*} [func=_.identity] The value to convert to a callback.
  555. * @param {*} [thisArg] The `this` binding of `func`.
  556. * @param {number} [argCount] The number of arguments to provide to `func`.
  557. * @returns {Function} Returns the callback.
  558. */
  559. function baseCallback(func, thisArg, argCount) {
  560. var type = typeof func;
  561. if (type == 'function') {
  562. return thisArg === undefined
  563. ? func
  564. : bindCallback(func, thisArg, argCount);
  565. }
  566. if (func == null) {
  567. return identity;
  568. }
  569. if (type == 'object') {
  570. return baseMatches(func);
  571. }
  572. return thisArg === undefined
  573. ? property(func)
  574. : baseMatchesProperty(func, thisArg);
  575. }
  576.  
  577. module.exports = baseCallback;
  578.  
  579. },{"../utility/identity":61,"../utility/property":62,"./baseMatches":22,"./baseMatchesProperty":23,"./bindCallback":28}],12:[function(require,module,exports){
  580. /**
  581. * Copies properties of `source` to `object`.
  582. *
  583. * @private
  584. * @param {Object} source The object to copy properties from.
  585. * @param {Array} props The property names to copy.
  586. * @param {Object} [object={}] The object to copy properties to.
  587. * @returns {Object} Returns `object`.
  588. */
  589. function baseCopy(source, props, object) {
  590. object || (object = {});
  591.  
  592. var index = -1,
  593. length = props.length;
  594.  
  595. while (++index < length) {
  596. var key = props[index];
  597. object[key] = source[key];
  598. }
  599. return object;
  600. }
  601.  
  602. module.exports = baseCopy;
  603.  
  604. },{}],13:[function(require,module,exports){
  605. var isObject = require('../lang/isObject');
  606.  
  607. /**
  608. * The base implementation of `_.create` without support for assigning
  609. * properties to the created object.
  610. *
  611. * @private
  612. * @param {Object} prototype The object to inherit from.
  613. * @returns {Object} Returns the new object.
  614. */
  615. var baseCreate = (function() {
  616. function object() {}
  617. return function(prototype) {
  618. if (isObject(prototype)) {
  619. object.prototype = prototype;
  620. var result = new object;
  621. object.prototype = undefined;
  622. }
  623. return result || {};
  624. };
  625. }());
  626.  
  627. module.exports = baseCreate;
  628.  
  629. },{"../lang/isObject":53}],14:[function(require,module,exports){
  630. var baseForOwn = require('./baseForOwn'),
  631. createBaseEach = require('./createBaseEach');
  632.  
  633. /**
  634. * The base implementation of `_.forEach` without support for callback
  635. * shorthands and `this` binding.
  636. *
  637. * @private
  638. * @param {Array|Object|string} collection The collection to iterate over.
  639. * @param {Function} iteratee The function invoked per iteration.
  640. * @returns {Array|Object|string} Returns `collection`.
  641. */
  642. var baseEach = createBaseEach(baseForOwn);
  643.  
  644. module.exports = baseEach;
  645.  
  646. },{"./baseForOwn":17,"./createBaseEach":30}],15:[function(require,module,exports){
  647. var baseEach = require('./baseEach');
  648.  
  649. /**
  650. * The base implementation of `_.every` without support for callback
  651. * shorthands and `this` binding.
  652. *
  653. * @private
  654. * @param {Array|Object|string} collection The collection to iterate over.
  655. * @param {Function} predicate The function invoked per iteration.
  656. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  657. * else `false`
  658. */
  659. function baseEvery(collection, predicate) {
  660. var result = true;
  661. baseEach(collection, function(value, index, collection) {
  662. result = !!predicate(value, index, collection);
  663. return result;
  664. });
  665. return result;
  666. }
  667.  
  668. module.exports = baseEvery;
  669.  
  670. },{"./baseEach":14}],16:[function(require,module,exports){
  671. var createBaseFor = require('./createBaseFor');
  672.  
  673. /**
  674. * The base implementation of `baseForIn` and `baseForOwn` which iterates
  675. * over `object` properties returned by `keysFunc` invoking `iteratee` for
  676. * each property. Iteratee functions may exit iteration early by explicitly
  677. * returning `false`.
  678. *
  679. * @private
  680. * @param {Object} object The object to iterate over.
  681. * @param {Function} iteratee The function invoked per iteration.
  682. * @param {Function} keysFunc The function to get the keys of `object`.
  683. * @returns {Object} Returns `object`.
  684. */
  685. var baseFor = createBaseFor();
  686.  
  687. module.exports = baseFor;
  688.  
  689. },{"./createBaseFor":31}],17:[function(require,module,exports){
  690. var baseFor = require('./baseFor'),
  691. keys = require('../object/keys');
  692.  
  693. /**
  694. * The base implementation of `_.forOwn` without support for callback
  695. * shorthands and `this` binding.
  696. *
  697. * @private
  698. * @param {Object} object The object to iterate over.
  699. * @param {Function} iteratee The function invoked per iteration.
  700. * @returns {Object} Returns `object`.
  701. */
  702. function baseForOwn(object, iteratee) {
  703. return baseFor(object, iteratee, keys);
  704. }
  705.  
  706. module.exports = baseForOwn;
  707.  
  708. },{"../object/keys":58,"./baseFor":16}],18:[function(require,module,exports){
  709. var toObject = require('./toObject');
  710.  
  711. /**
  712. * The base implementation of `get` without support for string paths
  713. * and default values.
  714. *
  715. * @private
  716. * @param {Object} object The object to query.
  717. * @param {Array} path The path of the property to get.
  718. * @param {string} [pathKey] The key representation of path.
  719. * @returns {*} Returns the resolved value.
  720. */
  721. function baseGet(object, path, pathKey) {
  722. if (object == null) {
  723. return;
  724. }
  725. if (pathKey !== undefined && pathKey in toObject(object)) {
  726. path = [pathKey];
  727. }
  728. var index = 0,
  729. length = path.length;
  730.  
  731. while (object != null && index < length) {
  732. object = object[path[index++]];
  733. }
  734. return (index && index == length) ? object : undefined;
  735. }
  736.  
  737. module.exports = baseGet;
  738.  
  739. },{"./toObject":46}],19:[function(require,module,exports){
  740. var baseIsEqualDeep = require('./baseIsEqualDeep'),
  741. isObject = require('../lang/isObject'),
  742. isObjectLike = require('./isObjectLike');
  743.  
  744. /**
  745. * The base implementation of `_.isEqual` without support for `this` binding
  746. * `customizer` functions.
  747. *
  748. * @private
  749. * @param {*} value The value to compare.
  750. * @param {*} other The other value to compare.
  751. * @param {Function} [customizer] The function to customize comparing values.
  752. * @param {boolean} [isLoose] Specify performing partial comparisons.
  753. * @param {Array} [stackA] Tracks traversed `value` objects.
  754. * @param {Array} [stackB] Tracks traversed `other` objects.
  755. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  756. */
  757. function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
  758. if (value === other) {
  759. return true;
  760. }
  761. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  762. return value !== value && other !== other;
  763. }
  764. return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
  765. }
  766.  
  767. module.exports = baseIsEqual;
  768.  
  769. },{"../lang/isObject":53,"./baseIsEqualDeep":20,"./isObjectLike":43}],20:[function(require,module,exports){
  770. var equalArrays = require('./equalArrays'),
  771. equalByTag = require('./equalByTag'),
  772. equalObjects = require('./equalObjects'),
  773. isArray = require('../lang/isArray'),
  774. isTypedArray = require('../lang/isTypedArray');
  775.  
  776. /** `Object#toString` result references. */
  777. var argsTag = '[object Arguments]',
  778. arrayTag = '[object Array]',
  779. objectTag = '[object Object]';
  780.  
  781. /** Used for native method references. */
  782. var objectProto = Object.prototype;
  783.  
  784. /** Used to check objects for own properties. */
  785. var hasOwnProperty = objectProto.hasOwnProperty;
  786.  
  787. /**
  788. * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
  789. * of values.
  790. */
  791. var objToString = objectProto.toString;
  792.  
  793. /**
  794. * A specialized version of `baseIsEqual` for arrays and objects which performs
  795. * deep comparisons and tracks traversed objects enabling objects with circular
  796. * references to be compared.
  797. *
  798. * @private
  799. * @param {Object} object The object to compare.
  800. * @param {Object} other The other object to compare.
  801. * @param {Function} equalFunc The function to determine equivalents of values.
  802. * @param {Function} [customizer] The function to customize comparing objects.
  803. * @param {boolean} [isLoose] Specify performing partial comparisons.
  804. * @param {Array} [stackA=[]] Tracks traversed `value` objects.
  805. * @param {Array} [stackB=[]] Tracks traversed `other` objects.
  806. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  807. */
  808. function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
  809. var objIsArr = isArray(object),
  810. othIsArr = isArray(other),
  811. objTag = arrayTag,
  812. othTag = arrayTag;
  813.  
  814. if (!objIsArr) {
  815. objTag = objToString.call(object);
  816. if (objTag == argsTag) {
  817. objTag = objectTag;
  818. } else if (objTag != objectTag) {
  819. objIsArr = isTypedArray(object);
  820. }
  821. }
  822. if (!othIsArr) {
  823. othTag = objToString.call(other);
  824. if (othTag == argsTag) {
  825. othTag = objectTag;
  826. } else if (othTag != objectTag) {
  827. othIsArr = isTypedArray(other);
  828. }
  829. }
  830. var objIsObj = objTag == objectTag,
  831. othIsObj = othTag == objectTag,
  832. isSameTag = objTag == othTag;
  833.  
  834. if (isSameTag && !(objIsArr || objIsObj)) {
  835. return equalByTag(object, other, objTag);
  836. }
  837. if (!isLoose) {
  838. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  839. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  840.  
  841. if (objIsWrapped || othIsWrapped) {
  842. return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
  843. }
  844. }
  845. if (!isSameTag) {
  846. return false;
  847. }
  848. // Assume cyclic values are equal.
  849. // For more information on detecting circular references see https://es5.github.io/#JO.
  850. stackA || (stackA = []);
  851. stackB || (stackB = []);
  852.  
  853. var length = stackA.length;
  854. while (length--) {
  855. if (stackA[length] == object) {
  856. return stackB[length] == other;
  857. }
  858. }
  859. // Add `object` and `other` to the stack of traversed objects.
  860. stackA.push(object);
  861. stackB.push(other);
  862.  
  863. var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
  864.  
  865. stackA.pop();
  866. stackB.pop();
  867.  
  868. return result;
  869. }
  870.  
  871. module.exports = baseIsEqualDeep;
  872.  
  873. },{"../lang/isArray":49,"../lang/isTypedArray":55,"./equalArrays":32,"./equalByTag":33,"./equalObjects":34}],21:[function(require,module,exports){
  874. var baseIsEqual = require('./baseIsEqual'),
  875. toObject = require('./toObject');
  876.  
  877. /**
  878. * The base implementation of `_.isMatch` without support for callback
  879. * shorthands and `this` binding.
  880. *
  881. * @private
  882. * @param {Object} object The object to inspect.
  883. * @param {Array} matchData The propery names, values, and compare flags to match.
  884. * @param {Function} [customizer] The function to customize comparing objects.
  885. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  886. */
  887. function baseIsMatch(object, matchData, customizer) {
  888. var index = matchData.length,
  889. length = index,
  890. noCustomizer = !customizer;
  891.  
  892. if (object == null) {
  893. return !length;
  894. }
  895. object = toObject(object);
  896. while (index--) {
  897. var data = matchData[index];
  898. if ((noCustomizer && data[2])
  899. ? data[1] !== object[data[0]]
  900. : !(data[0] in object)
  901. ) {
  902. return false;
  903. }
  904. }
  905. while (++index < length) {
  906. data = matchData[index];
  907. var key = data[0],
  908. objValue = object[key],
  909. srcValue = data[1];
  910.  
  911. if (noCustomizer && data[2]) {
  912. if (objValue === undefined && !(key in object)) {
  913. return false;
  914. }
  915. } else {
  916. var result = customizer ? customizer(objValue, srcValue, key) : undefined;
  917. if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
  918. return false;
  919. }
  920. }
  921. }
  922. return true;
  923. }
  924.  
  925. module.exports = baseIsMatch;
  926.  
  927. },{"./baseIsEqual":19,"./toObject":46}],22:[function(require,module,exports){
  928. var baseIsMatch = require('./baseIsMatch'),
  929. getMatchData = require('./getMatchData'),
  930. toObject = require('./toObject');
  931.  
  932. /**
  933. * The base implementation of `_.matches` which does not clone `source`.
  934. *
  935. * @private
  936. * @param {Object} source The object of property values to match.
  937. * @returns {Function} Returns the new function.
  938. */
  939. function baseMatches(source) {
  940. var matchData = getMatchData(source);
  941. if (matchData.length == 1 && matchData[0][2]) {
  942. var key = matchData[0][0],
  943. value = matchData[0][1];
  944.  
  945. return function(object) {
  946. if (object == null) {
  947. return false;
  948. }
  949. return object[key] === value && (value !== undefined || (key in toObject(object)));
  950. };
  951. }
  952. return function(object) {
  953. return baseIsMatch(object, matchData);
  954. };
  955. }
  956.  
  957. module.exports = baseMatches;
  958.  
  959. },{"./baseIsMatch":21,"./getMatchData":36,"./toObject":46}],23:[function(require,module,exports){
  960. var baseGet = require('./baseGet'),
  961. baseIsEqual = require('./baseIsEqual'),
  962. baseSlice = require('./baseSlice'),
  963. isArray = require('../lang/isArray'),
  964. isKey = require('./isKey'),
  965. isStrictComparable = require('./isStrictComparable'),
  966. last = require('../array/last'),
  967. toObject = require('./toObject'),
  968. toPath = require('./toPath');
  969.  
  970. /**
  971. * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
  972. *
  973. * @private
  974. * @param {string} path The path of the property to get.
  975. * @param {*} srcValue The value to compare.
  976. * @returns {Function} Returns the new function.
  977. */
  978. function baseMatchesProperty(path, srcValue) {
  979. var isArr = isArray(path),
  980. isCommon = isKey(path) && isStrictComparable(srcValue),
  981. pathKey = (path + '');
  982.  
  983. path = toPath(path);
  984. return function(object) {
  985. if (object == null) {
  986. return false;
  987. }
  988. var key = pathKey;
  989. object = toObject(object);
  990. if ((isArr || !isCommon) && !(key in object)) {
  991. object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
  992. if (object == null) {
  993. return false;
  994. }
  995. key = last(path);
  996. object = toObject(object);
  997. }
  998. return object[key] === srcValue
  999. ? (srcValue !== undefined || (key in object))
  1000. : baseIsEqual(srcValue, object[key], undefined, true);
  1001. };
  1002. }
  1003.  
  1004. module.exports = baseMatchesProperty;
  1005.  
  1006. },{"../array/last":4,"../lang/isArray":49,"./baseGet":18,"./baseIsEqual":19,"./baseSlice":26,"./isKey":41,"./isStrictComparable":44,"./toObject":46,"./toPath":47}],24:[function(require,module,exports){
  1007. /**
  1008. * The base implementation of `_.property` without support for deep paths.
  1009. *
  1010. * @private
  1011. * @param {string} key The key of the property to get.
  1012. * @returns {Function} Returns the new function.
  1013. */
  1014. function baseProperty(key) {
  1015. return function(object) {
  1016. return object == null ? undefined : object[key];
  1017. };
  1018. }
  1019.  
  1020. module.exports = baseProperty;
  1021.  
  1022. },{}],25:[function(require,module,exports){
  1023. var baseGet = require('./baseGet'),
  1024. toPath = require('./toPath');
  1025.  
  1026. /**
  1027. * A specialized version of `baseProperty` which supports deep paths.
  1028. *
  1029. * @private
  1030. * @param {Array|string} path The path of the property to get.
  1031. * @returns {Function} Returns the new function.
  1032. */
  1033. function basePropertyDeep(path) {
  1034. var pathKey = (path + '');
  1035. path = toPath(path);
  1036. return function(object) {
  1037. return baseGet(object, path, pathKey);
  1038. };
  1039. }
  1040.  
  1041. module.exports = basePropertyDeep;
  1042.  
  1043. },{"./baseGet":18,"./toPath":47}],26:[function(require,module,exports){
  1044. /**
  1045. * The base implementation of `_.slice` without an iteratee call guard.
  1046. *
  1047. * @private
  1048. * @param {Array} array The array to slice.
  1049. * @param {number} [start=0] The start position.
  1050. * @param {number} [end=array.length] The end position.
  1051. * @returns {Array} Returns the slice of `array`.
  1052. */
  1053. function baseSlice(array, start, end) {
  1054. var index = -1,
  1055. length = array.length;
  1056.  
  1057. start = start == null ? 0 : (+start || 0);
  1058. if (start < 0) {
  1059. start = -start > length ? 0 : (length + start);
  1060. }
  1061. end = (end === undefined || end > length) ? length : (+end || 0);
  1062. if (end < 0) {
  1063. end += length;
  1064. }
  1065. length = start > end ? 0 : ((end - start) >>> 0);
  1066. start >>>= 0;
  1067.  
  1068. var result = Array(length);
  1069. while (++index < length) {
  1070. result[index] = array[index + start];
  1071. }
  1072. return result;
  1073. }
  1074.  
  1075. module.exports = baseSlice;
  1076.  
  1077. },{}],27:[function(require,module,exports){
  1078. /**
  1079. * Converts `value` to a string if it's not one. An empty string is returned
  1080. * for `null` or `undefined` values.
  1081. *
  1082. * @private
  1083. * @param {*} value The value to process.
  1084. * @returns {string} Returns the string.
  1085. */
  1086. function baseToString(value) {
  1087. return value == null ? '' : (value + '');
  1088. }
  1089.  
  1090. module.exports = baseToString;
  1091.  
  1092. },{}],28:[function(require,module,exports){
  1093. var identity = require('../utility/identity');
  1094.  
  1095. /**
  1096. * A specialized version of `baseCallback` which only supports `this` binding
  1097. * and specifying the number of arguments to provide to `func`.
  1098. *
  1099. * @private
  1100. * @param {Function} func The function to bind.
  1101. * @param {*} thisArg The `this` binding of `func`.
  1102. * @param {number} [argCount] The number of arguments to provide to `func`.
  1103. * @returns {Function} Returns the callback.
  1104. */
  1105. function bindCallback(func, thisArg, argCount) {
  1106. if (typeof func != 'function') {
  1107. return identity;
  1108. }
  1109. if (thisArg === undefined) {
  1110. return func;
  1111. }
  1112. switch (argCount) {
  1113. case 1: return function(value) {
  1114. return func.call(thisArg, value);
  1115. };
  1116. case 3: return function(value, index, collection) {
  1117. return func.call(thisArg, value, index, collection);
  1118. };
  1119. case 4: return function(accumulator, value, index, collection) {
  1120. return func.call(thisArg, accumulator, value, index, collection);
  1121. };
  1122. case 5: return function(value, other, key, object, source) {
  1123. return func.call(thisArg, value, other, key, object, source);
  1124. };
  1125. }
  1126. return function() {
  1127. return func.apply(thisArg, arguments);
  1128. };
  1129. }
  1130.  
  1131. module.exports = bindCallback;
  1132.  
  1133. },{"../utility/identity":61}],29:[function(require,module,exports){
  1134. var bindCallback = require('./bindCallback'),
  1135. isIterateeCall = require('./isIterateeCall'),
  1136. restParam = require('../function/restParam');
  1137.  
  1138. /**
  1139. * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
  1140. *
  1141. * @private
  1142. * @param {Function} assigner The function to assign values.
  1143. * @returns {Function} Returns the new assigner function.
  1144. */
  1145. function createAssigner(assigner) {
  1146. return restParam(function(object, sources) {
  1147. var index = -1,
  1148. length = object == null ? 0 : sources.length,
  1149. customizer = length > 2 ? sources[length - 2] : undefined,
  1150. guard = length > 2 ? sources[2] : undefined,
  1151. thisArg = length > 1 ? sources[length - 1] : undefined;
  1152.  
  1153. if (typeof customizer == 'function') {
  1154. customizer = bindCallback(customizer, thisArg, 5);
  1155. length -= 2;
  1156. } else {
  1157. customizer = typeof thisArg == 'function' ? thisArg : undefined;
  1158. length -= (customizer ? 1 : 0);
  1159. }
  1160. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1161. customizer = length < 3 ? undefined : customizer;
  1162. length = 1;
  1163. }
  1164. while (++index < length) {
  1165. var source = sources[index];
  1166. if (source) {
  1167. assigner(object, source, customizer);
  1168. }
  1169. }
  1170. return object;
  1171. });
  1172. }
  1173.  
  1174. module.exports = createAssigner;
  1175.  
  1176. },{"../function/restParam":6,"./bindCallback":28,"./isIterateeCall":40}],30:[function(require,module,exports){
  1177. var getLength = require('./getLength'),
  1178. isLength = require('./isLength'),
  1179. toObject = require('./toObject');
  1180.  
  1181. /**
  1182. * Creates a `baseEach` or `baseEachRight` function.
  1183. *
  1184. * @private
  1185. * @param {Function} eachFunc The function to iterate over a collection.
  1186. * @param {boolean} [fromRight] Specify iterating from right to left.
  1187. * @returns {Function} Returns the new base function.
  1188. */
  1189. function createBaseEach(eachFunc, fromRight) {
  1190. return function(collection, iteratee) {
  1191. var length = collection ? getLength(collection) : 0;
  1192. if (!isLength(length)) {
  1193. return eachFunc(collection, iteratee);
  1194. }
  1195. var index = fromRight ? length : -1,
  1196. iterable = toObject(collection);
  1197.  
  1198. while ((fromRight ? index-- : ++index < length)) {
  1199. if (iteratee(iterable[index], index, iterable) === false) {
  1200. break;
  1201. }
  1202. }
  1203. return collection;
  1204. };
  1205. }
  1206.  
  1207. module.exports = createBaseEach;
  1208.  
  1209. },{"./getLength":35,"./isLength":42,"./toObject":46}],31:[function(require,module,exports){
  1210. var toObject = require('./toObject');
  1211.  
  1212. /**
  1213. * Creates a base function for `_.forIn` or `_.forInRight`.
  1214. *
  1215. * @private
  1216. * @param {boolean} [fromRight] Specify iterating from right to left.
  1217. * @returns {Function} Returns the new base function.
  1218. */
  1219. function createBaseFor(fromRight) {
  1220. return function(object, iteratee, keysFunc) {
  1221. var iterable = toObject(object),
  1222. props = keysFunc(object),
  1223. length = props.length,
  1224. index = fromRight ? length : -1;
  1225.  
  1226. while ((fromRight ? index-- : ++index < length)) {
  1227. var key = props[index];
  1228. if (iteratee(iterable[key], key, iterable) === false) {
  1229. break;
  1230. }
  1231. }
  1232. return object;
  1233. };
  1234. }
  1235.  
  1236. module.exports = createBaseFor;
  1237.  
  1238. },{"./toObject":46}],32:[function(require,module,exports){
  1239. var arraySome = require('./arraySome');
  1240.  
  1241. /**
  1242. * A specialized version of `baseIsEqualDeep` for arrays with support for
  1243. * partial deep comparisons.
  1244. *
  1245. * @private
  1246. * @param {Array} array The array to compare.
  1247. * @param {Array} other The other array to compare.
  1248. * @param {Function} equalFunc The function to determine equivalents of values.
  1249. * @param {Function} [customizer] The function to customize comparing arrays.
  1250. * @param {boolean} [isLoose] Specify performing partial comparisons.
  1251. * @param {Array} [stackA] Tracks traversed `value` objects.
  1252. * @param {Array} [stackB] Tracks traversed `other` objects.
  1253. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  1254. */
  1255. function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
  1256. var index = -1,
  1257. arrLength = array.length,
  1258. othLength = other.length;
  1259.  
  1260. if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
  1261. return false;
  1262. }
  1263. // Ignore non-index properties.
  1264. while (++index < arrLength) {
  1265. var arrValue = array[index],
  1266. othValue = other[index],
  1267. result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
  1268.  
  1269. if (result !== undefined) {
  1270. if (result) {
  1271. continue;
  1272. }
  1273. return false;
  1274. }
  1275. // Recursively compare arrays (susceptible to call stack limits).
  1276. if (isLoose) {
  1277. if (!arraySome(other, function(othValue) {
  1278. return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
  1279. })) {
  1280. return false;
  1281. }
  1282. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
  1283. return false;
  1284. }
  1285. }
  1286. return true;
  1287. }
  1288.  
  1289. module.exports = equalArrays;
  1290.  
  1291. },{"./arraySome":8}],33:[function(require,module,exports){
  1292. /** `Object#toString` result references. */
  1293. var boolTag = '[object Boolean]',
  1294. dateTag = '[object Date]',
  1295. errorTag = '[object Error]',
  1296. numberTag = '[object Number]',
  1297. regexpTag = '[object RegExp]',
  1298. stringTag = '[object String]';
  1299.  
  1300. /**
  1301. * A specialized version of `baseIsEqualDeep` for comparing objects of
  1302. * the same `toStringTag`.
  1303. *
  1304. * **Note:** This function only supports comparing values with tags of
  1305. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  1306. *
  1307. * @private
  1308. * @param {Object} object The object to compare.
  1309. * @param {Object} other The other object to compare.
  1310. * @param {string} tag The `toStringTag` of the objects to compare.
  1311. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1312. */
  1313. function equalByTag(object, other, tag) {
  1314. switch (tag) {
  1315. case boolTag:
  1316. case dateTag:
  1317. // Coerce dates and booleans to numbers, dates to milliseconds and booleans
  1318. // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
  1319. return +object == +other;
  1320.  
  1321. case errorTag:
  1322. return object.name == other.name && object.message == other.message;
  1323.  
  1324. case numberTag:
  1325. // Treat `NaN` vs. `NaN` as equal.
  1326. return (object != +object)
  1327. ? other != +other
  1328. : object == +other;
  1329.  
  1330. case regexpTag:
  1331. case stringTag:
  1332. // Coerce regexes to strings and treat strings primitives and string
  1333. // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
  1334. return object == (other + '');
  1335. }
  1336. return false;
  1337. }
  1338.  
  1339. module.exports = equalByTag;
  1340.  
  1341. },{}],34:[function(require,module,exports){
  1342. var keys = require('../object/keys');
  1343.  
  1344. /** Used for native method references. */
  1345. var objectProto = Object.prototype;
  1346.  
  1347. /** Used to check objects for own properties. */
  1348. var hasOwnProperty = objectProto.hasOwnProperty;
  1349.  
  1350. /**
  1351. * A specialized version of `baseIsEqualDeep` for objects with support for
  1352. * partial deep comparisons.
  1353. *
  1354. * @private
  1355. * @param {Object} object The object to compare.
  1356. * @param {Object} other The other object to compare.
  1357. * @param {Function} equalFunc The function to determine equivalents of values.
  1358. * @param {Function} [customizer] The function to customize comparing values.
  1359. * @param {boolean} [isLoose] Specify performing partial comparisons.
  1360. * @param {Array} [stackA] Tracks traversed `value` objects.
  1361. * @param {Array} [stackB] Tracks traversed `other` objects.
  1362. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1363. */
  1364. function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
  1365. var objProps = keys(object),
  1366. objLength = objProps.length,
  1367. othProps = keys(other),
  1368. othLength = othProps.length;
  1369.  
  1370. if (objLength != othLength && !isLoose) {
  1371. return false;
  1372. }
  1373. var index = objLength;
  1374. while (index--) {
  1375. var key = objProps[index];
  1376. if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
  1377. return false;
  1378. }
  1379. }
  1380. var skipCtor = isLoose;
  1381. while (++index < objLength) {
  1382. key = objProps[index];
  1383. var objValue = object[key],
  1384. othValue = other[key],
  1385. result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
  1386.  
  1387. // Recursively compare objects (susceptible to call stack limits).
  1388. if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
  1389. return false;
  1390. }
  1391. skipCtor || (skipCtor = key == 'constructor');
  1392. }
  1393. if (!skipCtor) {
  1394. var objCtor = object.constructor,
  1395. othCtor = other.constructor;
  1396.  
  1397. // Non `Object` object instances with different constructors are not equal.
  1398. if (objCtor != othCtor &&
  1399. ('constructor' in object && 'constructor' in other) &&
  1400. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  1401. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  1402. return false;
  1403. }
  1404. }
  1405. return true;
  1406. }
  1407.  
  1408. module.exports = equalObjects;
  1409.  
  1410. },{"../object/keys":58}],35:[function(require,module,exports){
  1411. var baseProperty = require('./baseProperty');
  1412.  
  1413. /**
  1414. * Gets the "length" property value of `object`.
  1415. *
  1416. * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
  1417. * that affects Safari on at least iOS 8.1-8.3 ARM64.
  1418. *
  1419. * @private
  1420. * @param {Object} object The object to query.
  1421. * @returns {*} Returns the "length" value.
  1422. */
  1423. var getLength = baseProperty('length');
  1424.  
  1425. module.exports = getLength;
  1426.  
  1427. },{"./baseProperty":24}],36:[function(require,module,exports){
  1428. var isStrictComparable = require('./isStrictComparable'),
  1429. pairs = require('../object/pairs');
  1430.  
  1431. /**
  1432. * Gets the propery names, values, and compare flags of `object`.
  1433. *
  1434. * @private
  1435. * @param {Object} object The object to query.
  1436. * @returns {Array} Returns the match data of `object`.
  1437. */
  1438. function getMatchData(object) {
  1439. var result = pairs(object),
  1440. length = result.length;
  1441.  
  1442. while (length--) {
  1443. result[length][2] = isStrictComparable(result[length][1]);
  1444. }
  1445. return result;
  1446. }
  1447.  
  1448. module.exports = getMatchData;
  1449.  
  1450. },{"../object/pairs":60,"./isStrictComparable":44}],37:[function(require,module,exports){
  1451. var isNative = require('../lang/isNative');
  1452.  
  1453. /**
  1454. * Gets the native function at `key` of `object`.
  1455. *
  1456. * @private
  1457. * @param {Object} object The object to query.
  1458. * @param {string} key The key of the method to get.
  1459. * @returns {*} Returns the function if it's native, else `undefined`.
  1460. */
  1461. function getNative(object, key) {
  1462. var value = object == null ? undefined : object[key];
  1463. return isNative(value) ? value : undefined;
  1464. }
  1465.  
  1466. module.exports = getNative;
  1467.  
  1468. },{"../lang/isNative":52}],38:[function(require,module,exports){
  1469. var getLength = require('./getLength'),
  1470. isLength = require('./isLength');
  1471.  
  1472. /**
  1473. * Checks if `value` is array-like.
  1474. *
  1475. * @private
  1476. * @param {*} value The value to check.
  1477. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  1478. */
  1479. function isArrayLike(value) {
  1480. return value != null && isLength(getLength(value));
  1481. }
  1482.  
  1483. module.exports = isArrayLike;
  1484.  
  1485. },{"./getLength":35,"./isLength":42}],39:[function(require,module,exports){
  1486. /** Used to detect unsigned integer values. */
  1487. var reIsUint = /^\d+$/;
  1488.  
  1489. /**
  1490. * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
  1491. * of an array-like value.
  1492. */
  1493. var MAX_SAFE_INTEGER = 9007199254740991;
  1494.  
  1495. /**
  1496. * Checks if `value` is a valid array-like index.
  1497. *
  1498. * @private
  1499. * @param {*} value The value to check.
  1500. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  1501. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  1502. */
  1503. function isIndex(value, length) {
  1504. value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
  1505. length = length == null ? MAX_SAFE_INTEGER : length;
  1506. return value > -1 && value % 1 == 0 && value < length;
  1507. }
  1508.  
  1509. module.exports = isIndex;
  1510.  
  1511. },{}],40:[function(require,module,exports){
  1512. var isArrayLike = require('./isArrayLike'),
  1513. isIndex = require('./isIndex'),
  1514. isObject = require('../lang/isObject');
  1515.  
  1516. /**
  1517. * Checks if the provided arguments are from an iteratee call.
  1518. *
  1519. * @private
  1520. * @param {*} value The potential iteratee value argument.
  1521. * @param {*} index The potential iteratee index or key argument.
  1522. * @param {*} object The potential iteratee object argument.
  1523. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
  1524. */
  1525. function isIterateeCall(value, index, object) {
  1526. if (!isObject(object)) {
  1527. return false;
  1528. }
  1529. var type = typeof index;
  1530. if (type == 'number'
  1531. ? (isArrayLike(object) && isIndex(index, object.length))
  1532. : (type == 'string' && index in object)) {
  1533. var other = object[index];
  1534. return value === value ? (value === other) : (other !== other);
  1535. }
  1536. return false;
  1537. }
  1538.  
  1539. module.exports = isIterateeCall;
  1540.  
  1541. },{"../lang/isObject":53,"./isArrayLike":38,"./isIndex":39}],41:[function(require,module,exports){
  1542. var isArray = require('../lang/isArray'),
  1543. toObject = require('./toObject');
  1544.  
  1545. /** Used to match property names within property paths. */
  1546. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
  1547. reIsPlainProp = /^\w*$/;
  1548.  
  1549. /**
  1550. * Checks if `value` is a property name and not a property path.
  1551. *
  1552. * @private
  1553. * @param {*} value The value to check.
  1554. * @param {Object} [object] The object to query keys on.
  1555. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  1556. */
  1557. function isKey(value, object) {
  1558. var type = typeof value;
  1559. if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
  1560. return true;
  1561. }
  1562. if (isArray(value)) {
  1563. return false;
  1564. }
  1565. var result = !reIsDeepProp.test(value);
  1566. return result || (object != null && value in toObject(object));
  1567. }
  1568.  
  1569. module.exports = isKey;
  1570.  
  1571. },{"../lang/isArray":49,"./toObject":46}],42:[function(require,module,exports){
  1572. /**
  1573. * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
  1574. * of an array-like value.
  1575. */
  1576. var MAX_SAFE_INTEGER = 9007199254740991;
  1577.  
  1578. /**
  1579. * Checks if `value` is a valid array-like length.
  1580. *
  1581. * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
  1582. *
  1583. * @private
  1584. * @param {*} value The value to check.
  1585. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  1586. */
  1587. function isLength(value) {
  1588. return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  1589. }
  1590.  
  1591. module.exports = isLength;
  1592.  
  1593. },{}],43:[function(require,module,exports){
  1594. /**
  1595. * Checks if `value` is object-like.
  1596. *
  1597. * @private
  1598. * @param {*} value The value to check.
  1599. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1600. */
  1601. function isObjectLike(value) {
  1602. return !!value && typeof value == 'object';
  1603. }
  1604.  
  1605. module.exports = isObjectLike;
  1606.  
  1607. },{}],44:[function(require,module,exports){
  1608. var isObject = require('../lang/isObject');
  1609.  
  1610. /**
  1611. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  1612. *
  1613. * @private
  1614. * @param {*} value The value to check.
  1615. * @returns {boolean} Returns `true` if `value` if suitable for strict
  1616. * equality comparisons, else `false`.
  1617. */
  1618. function isStrictComparable(value) {
  1619. return value === value && !isObject(value);
  1620. }
  1621.  
  1622. module.exports = isStrictComparable;
  1623.  
  1624. },{"../lang/isObject":53}],45:[function(require,module,exports){
  1625. var isArguments = require('../lang/isArguments'),
  1626. isArray = require('../lang/isArray'),
  1627. isIndex = require('./isIndex'),
  1628. isLength = require('./isLength'),
  1629. keysIn = require('../object/keysIn');
  1630.  
  1631. /** Used for native method references. */
  1632. var objectProto = Object.prototype;
  1633.  
  1634. /** Used to check objects for own properties. */
  1635. var hasOwnProperty = objectProto.hasOwnProperty;
  1636.  
  1637. /**
  1638. * A fallback implementation of `Object.keys` which creates an array of the
  1639. * own enumerable property names of `object`.
  1640. *
  1641. * @private
  1642. * @param {Object} object The object to query.
  1643. * @returns {Array} Returns the array of property names.
  1644. */
  1645. function shimKeys(object) {
  1646. var props = keysIn(object),
  1647. propsLength = props.length,
  1648. length = propsLength && object.length;
  1649.  
  1650. var allowIndexes = !!length && isLength(length) &&
  1651. (isArray(object) || isArguments(object));
  1652.  
  1653. var index = -1,
  1654. result = [];
  1655.  
  1656. while (++index < propsLength) {
  1657. var key = props[index];
  1658. if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
  1659. result.push(key);
  1660. }
  1661. }
  1662. return result;
  1663. }
  1664.  
  1665. module.exports = shimKeys;
  1666.  
  1667. },{"../lang/isArguments":48,"../lang/isArray":49,"../object/keysIn":59,"./isIndex":39,"./isLength":42}],46:[function(require,module,exports){
  1668. var isObject = require('../lang/isObject');
  1669.  
  1670. /**
  1671. * Converts `value` to an object if it's not one.
  1672. *
  1673. * @private
  1674. * @param {*} value The value to process.
  1675. * @returns {Object} Returns the object.
  1676. */
  1677. function toObject(value) {
  1678. return isObject(value) ? value : Object(value);
  1679. }
  1680.  
  1681. module.exports = toObject;
  1682.  
  1683. },{"../lang/isObject":53}],47:[function(require,module,exports){
  1684. var baseToString = require('./baseToString'),
  1685. isArray = require('../lang/isArray');
  1686.  
  1687. /** Used to match property names within property paths. */
  1688. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
  1689.  
  1690. /** Used to match backslashes in property paths. */
  1691. var reEscapeChar = /\\(\\)?/g;
  1692.  
  1693. /**
  1694. * Converts `value` to property path array if it's not one.
  1695. *
  1696. * @private
  1697. * @param {*} value The value to process.
  1698. * @returns {Array} Returns the property path array.
  1699. */
  1700. function toPath(value) {
  1701. if (isArray(value)) {
  1702. return value;
  1703. }
  1704. var result = [];
  1705. baseToString(value).replace(rePropName, function(match, number, quote, string) {
  1706. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  1707. });
  1708. return result;
  1709. }
  1710.  
  1711. module.exports = toPath;
  1712.  
  1713. },{"../lang/isArray":49,"./baseToString":27}],48:[function(require,module,exports){
  1714. var isArrayLike = require('../internal/isArrayLike'),
  1715. isObjectLike = require('../internal/isObjectLike');
  1716.  
  1717. /** Used for native method references. */
  1718. var objectProto = Object.prototype;
  1719.  
  1720. /** Used to check objects for own properties. */
  1721. var hasOwnProperty = objectProto.hasOwnProperty;
  1722.  
  1723. /** Native method references. */
  1724. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  1725.  
  1726. /**
  1727. * Checks if `value` is classified as an `arguments` object.
  1728. *
  1729. * @static
  1730. * @memberOf _
  1731. * @category Lang
  1732. * @param {*} value The value to check.
  1733. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
  1734. * @example
  1735. *
  1736. * _.isArguments(function() { return arguments; }());
  1737. * // => true
  1738. *
  1739. * _.isArguments([1, 2, 3]);
  1740. * // => false
  1741. */
  1742. function isArguments(value) {
  1743. return isObjectLike(value) && isArrayLike(value) &&
  1744. hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
  1745. }
  1746.  
  1747. module.exports = isArguments;
  1748.  
  1749. },{"../internal/isArrayLike":38,"../internal/isObjectLike":43}],49:[function(require,module,exports){
  1750. var getNative = require('../internal/getNative'),
  1751. isLength = require('../internal/isLength'),
  1752. isObjectLike = require('../internal/isObjectLike');
  1753.  
  1754. /** `Object#toString` result references. */
  1755. var arrayTag = '[object Array]';
  1756.  
  1757. /** Used for native method references. */
  1758. var objectProto = Object.prototype;
  1759.  
  1760. /**
  1761. * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
  1762. * of values.
  1763. */
  1764. var objToString = objectProto.toString;
  1765.  
  1766. /* Native method references for those with the same name as other `lodash` methods. */
  1767. var nativeIsArray = getNative(Array, 'isArray');
  1768.  
  1769. /**
  1770. * Checks if `value` is classified as an `Array` object.
  1771. *
  1772. * @static
  1773. * @memberOf _
  1774. * @category Lang
  1775. * @param {*} value The value to check.
  1776. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
  1777. * @example
  1778. *
  1779. * _.isArray([1, 2, 3]);
  1780. * // => true
  1781. *
  1782. * _.isArray(function() { return arguments; }());
  1783. * // => false
  1784. */
  1785. var isArray = nativeIsArray || function(value) {
  1786. return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
  1787. };
  1788.  
  1789. module.exports = isArray;
  1790.  
  1791. },{"../internal/getNative":37,"../internal/isLength":42,"../internal/isObjectLike":43}],50:[function(require,module,exports){
  1792. var isArguments = require('./isArguments'),
  1793. isArray = require('./isArray'),
  1794. isArrayLike = require('../internal/isArrayLike'),
  1795. isFunction = require('./isFunction'),
  1796. isObjectLike = require('../internal/isObjectLike'),
  1797. isString = require('./isString'),
  1798. keys = require('../object/keys');
  1799.  
  1800. /**
  1801. * Checks if `value` is empty. A value is considered empty unless it's an
  1802. * `arguments` object, array, string, or jQuery-like collection with a length
  1803. * greater than `0` or an object with own enumerable properties.
  1804. *
  1805. * @static
  1806. * @memberOf _
  1807. * @category Lang
  1808. * @param {Array|Object|string} value The value to inspect.
  1809. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  1810. * @example
  1811. *
  1812. * _.isEmpty(null);
  1813. * // => true
  1814. *
  1815. * _.isEmpty(true);
  1816. * // => true
  1817. *
  1818. * _.isEmpty(1);
  1819. * // => true
  1820. *
  1821. * _.isEmpty([1, 2, 3]);
  1822. * // => false
  1823. *
  1824. * _.isEmpty({ 'a': 1 });
  1825. * // => false
  1826. */
  1827. function isEmpty(value) {
  1828. if (value == null) {
  1829. return true;
  1830. }
  1831. if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
  1832. (isObjectLike(value) && isFunction(value.splice)))) {
  1833. return !value.length;
  1834. }
  1835. return !keys(value).length;
  1836. }
  1837.  
  1838. module.exports = isEmpty;
  1839.  
  1840. },{"../internal/isArrayLike":38,"../internal/isObjectLike":43,"../object/keys":58,"./isArguments":48,"./isArray":49,"./isFunction":51,"./isString":54}],51:[function(require,module,exports){
  1841. var isObject = require('./isObject');
  1842.  
  1843. /** `Object#toString` result references. */
  1844. var funcTag = '[object Function]';
  1845.  
  1846. /** Used for native method references. */
  1847. var objectProto = Object.prototype;
  1848.  
  1849. /**
  1850. * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
  1851. * of values.
  1852. */
  1853. var objToString = objectProto.toString;
  1854.  
  1855. /**
  1856. * Checks if `value` is classified as a `Function` object.
  1857. *
  1858. * @static
  1859. * @memberOf _
  1860. * @category Lang
  1861. * @param {*} value The value to check.
  1862. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
  1863. * @example
  1864. *
  1865. * _.isFunction(_);
  1866. * // => true
  1867. *
  1868. * _.isFunction(/abc/);
  1869. * // => false
  1870. */
  1871. function isFunction(value) {
  1872. // The use of `Object#toString` avoids issues with the `typeof` operator
  1873. // in older versions of Chrome and Safari which return 'function' for regexes
  1874. // and Safari 8 which returns 'object' for typed array constructors.
  1875. return isObject(value) && objToString.call(value) == funcTag;
  1876. }
  1877.  
  1878. module.exports = isFunction;
  1879.  
  1880. },{"./isObject":53}],52:[function(require,module,exports){
  1881. var isFunction = require('./isFunction'),
  1882. isObjectLike = require('../internal/isObjectLike');
  1883.  
  1884. /** Used to detect host constructors (Safari > 5). */
  1885. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1886.  
  1887. /** Used for native method references. */
  1888. var objectProto = Object.prototype;
  1889.  
  1890. /** Used to resolve the decompiled source of functions. */
  1891. var fnToString = Function.prototype.toString;
  1892.  
  1893. /** Used to check objects for own properties. */
  1894. var hasOwnProperty = objectProto.hasOwnProperty;
  1895.  
  1896. /** Used to detect if a method is native. */
  1897. var reIsNative = RegExp('^' +
  1898. fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
  1899. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1900. );
  1901.  
  1902. /**
  1903. * Checks if `value` is a native function.
  1904. *
  1905. * @static
  1906. * @memberOf _
  1907. * @category Lang
  1908. * @param {*} value The value to check.
  1909. * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
  1910. * @example
  1911. *
  1912. * _.isNative(Array.prototype.push);
  1913. * // => true
  1914. *
  1915. * _.isNative(_);
  1916. * // => false
  1917. */
  1918. function isNative(value) {
  1919. if (value == null) {
  1920. return false;
  1921. }
  1922. if (isFunction(value)) {
  1923. return reIsNative.test(fnToString.call(value));
  1924. }
  1925. return isObjectLike(value) && reIsHostCtor.test(value);
  1926. }
  1927.  
  1928. module.exports = isNative;
  1929.  
  1930. },{"../internal/isObjectLike":43,"./isFunction":51}],53:[function(require,module,exports){
  1931. /**
  1932. * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
  1933. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1934. *
  1935. * @static
  1936. * @memberOf _
  1937. * @category Lang
  1938. * @param {*} value The value to check.
  1939. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1940. * @example
  1941. *
  1942. * _.isObject({});
  1943. * // => true
  1944. *
  1945. * _.isObject([1, 2, 3]);
  1946. * // => true
  1947. *
  1948. * _.isObject(1);
  1949. * // => false
  1950. */
  1951. function isObject(value) {
  1952. // Avoid a V8 JIT bug in Chrome 19-20.
  1953. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
  1954. var type = typeof value;
  1955. return !!value && (type == 'object' || type == 'function');
  1956. }
  1957.  
  1958. module.exports = isObject;
  1959.  
  1960. },{}],54:[function(require,module,exports){
  1961. var isObjectLike = require('../internal/isObjectLike');
  1962.  
  1963. /** `Object#toString` result references. */
  1964. var stringTag = '[object String]';
  1965.  
  1966. /** Used for native method references. */
  1967. var objectProto = Object.prototype;
  1968.  
  1969. /**
  1970. * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
  1971. * of values.
  1972. */
  1973. var objToString = objectProto.toString;
  1974.  
  1975. /**
  1976. * Checks if `value` is classified as a `String` primitive or object.
  1977. *
  1978. * @static
  1979. * @memberOf _
  1980. * @category Lang
  1981. * @param {*} value The value to check.
  1982. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
  1983. * @example
  1984. *
  1985. * _.isString('abc');
  1986. * // => true
  1987. *
  1988. * _.isString(1);
  1989. * // => false
  1990. */
  1991. function isString(value) {
  1992. return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
  1993. }
  1994.  
  1995. module.exports = isString;
  1996.  
  1997. },{"../internal/isObjectLike":43}],55:[function(require,module,exports){
  1998. var isLength = require('../internal/isLength'),
  1999. isObjectLike = require('../internal/isObjectLike');
  2000.  
  2001. /** `Object#toString` result references. */
  2002. var argsTag = '[object Arguments]',
  2003. arrayTag = '[object Array]',
  2004. boolTag = '[object Boolean]',
  2005. dateTag = '[object Date]',
  2006. errorTag = '[object Error]',
  2007. funcTag = '[object Function]',
  2008. mapTag = '[object Map]',
  2009. numberTag = '[object Number]',
  2010. objectTag = '[object Object]',
  2011. regexpTag = '[object RegExp]',
  2012. setTag = '[object Set]',
  2013. stringTag = '[object String]',
  2014. weakMapTag = '[object WeakMap]';
  2015.  
  2016. var arrayBufferTag = '[object ArrayBuffer]',
  2017. float32Tag = '[object Float32Array]',
  2018. float64Tag = '[object Float64Array]',
  2019. int8Tag = '[object Int8Array]',
  2020. int16Tag = '[object Int16Array]',
  2021. int32Tag = '[object Int32Array]',
  2022. uint8Tag = '[object Uint8Array]',
  2023. uint8ClampedTag = '[object Uint8ClampedArray]',
  2024. uint16Tag = '[object Uint16Array]',
  2025. uint32Tag = '[object Uint32Array]';
  2026.  
  2027. /** Used to identify `toStringTag` values of typed arrays. */
  2028. var typedArrayTags = {};
  2029. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  2030. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  2031. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  2032. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  2033. typedArrayTags[uint32Tag] = true;
  2034. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  2035. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  2036. typedArrayTags[dateTag] = typedArrayTags[errorTag] =
  2037. typedArrayTags[funcTag] = typedArrayTags[mapTag] =
  2038. typedArrayTags[numberTag] = typedArrayTags[objectTag] =
  2039. typedArrayTags[regexpTag] = typedArrayTags[setTag] =
  2040. typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
  2041.  
  2042. /** Used for native method references. */
  2043. var objectProto = Object.prototype;
  2044.  
  2045. /**
  2046. * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
  2047. * of values.
  2048. */
  2049. var objToString = objectProto.toString;
  2050.  
  2051. /**
  2052. * Checks if `value` is classified as a typed array.
  2053. *
  2054. * @static
  2055. * @memberOf _
  2056. * @category Lang
  2057. * @param {*} value The value to check.
  2058. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
  2059. * @example
  2060. *
  2061. * _.isTypedArray(new Uint8Array);
  2062. * // => true
  2063. *
  2064. * _.isTypedArray([]);
  2065. * // => false
  2066. */
  2067. function isTypedArray(value) {
  2068. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
  2069. }
  2070.  
  2071. module.exports = isTypedArray;
  2072.  
  2073. },{"../internal/isLength":42,"../internal/isObjectLike":43}],56:[function(require,module,exports){
  2074. var assignWith = require('../internal/assignWith'),
  2075. baseAssign = require('../internal/baseAssign'),
  2076. createAssigner = require('../internal/createAssigner');
  2077.  
  2078. /**
  2079. * Assigns own enumerable properties of source object(s) to the destination
  2080. * object. Subsequent sources overwrite property assignments of previous sources.
  2081. * If `customizer` is provided it's invoked to produce the assigned values.
  2082. * The `customizer` is bound to `thisArg` and invoked with five arguments:
  2083. * (objectValue, sourceValue, key, object, source).
  2084. *
  2085. * **Note:** This method mutates `object` and is based on
  2086. * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
  2087. *
  2088. * @static
  2089. * @memberOf _
  2090. * @alias extend
  2091. * @category Object
  2092. * @param {Object} object The destination object.
  2093. * @param {...Object} [sources] The source objects.
  2094. * @param {Function} [customizer] The function to customize assigned values.
  2095. * @param {*} [thisArg] The `this` binding of `customizer`.
  2096. * @returns {Object} Returns `object`.
  2097. * @example
  2098. *
  2099. * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
  2100. * // => { 'user': 'fred', 'age': 40 }
  2101. *
  2102. * // using a customizer callback
  2103. * var defaults = _.partialRight(_.assign, function(value, other) {
  2104. * return _.isUndefined(value) ? other : value;
  2105. * });
  2106. *
  2107. * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
  2108. * // => { 'user': 'barney', 'age': 36 }
  2109. */
  2110. var assign = createAssigner(function(object, source, customizer) {
  2111. return customizer
  2112. ? assignWith(object, source, customizer)
  2113. : baseAssign(object, source);
  2114. });
  2115.  
  2116. module.exports = assign;
  2117.  
  2118. },{"../internal/assignWith":9,"../internal/baseAssign":10,"../internal/createAssigner":29}],57:[function(require,module,exports){
  2119. var baseAssign = require('../internal/baseAssign'),
  2120. baseCreate = require('../internal/baseCreate'),
  2121. isIterateeCall = require('../internal/isIterateeCall');
  2122.  
  2123. /**
  2124. * Creates an object that inherits from the given `prototype` object. If a
  2125. * `properties` object is provided its own enumerable properties are assigned
  2126. * to the created object.
  2127. *
  2128. * @static
  2129. * @memberOf _
  2130. * @category Object
  2131. * @param {Object} prototype The object to inherit from.
  2132. * @param {Object} [properties] The properties to assign to the object.
  2133. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
  2134. * @returns {Object} Returns the new object.
  2135. * @example
  2136. *
  2137. * function Shape() {
  2138. * this.x = 0;
  2139. * this.y = 0;
  2140. * }
  2141. *
  2142. * function Circle() {
  2143. * Shape.call(this);
  2144. * }
  2145. *
  2146. * Circle.prototype = _.create(Shape.prototype, {
  2147. * 'constructor': Circle
  2148. * });
  2149. *
  2150. * var circle = new Circle;
  2151. * circle instanceof Circle;
  2152. * // => true
  2153. *
  2154. * circle instanceof Shape;
  2155. * // => true
  2156. */
  2157. function create(prototype, properties, guard) {
  2158. var result = baseCreate(prototype);
  2159. if (guard && isIterateeCall(prototype, properties, guard)) {
  2160. properties = undefined;
  2161. }
  2162. return properties ? baseAssign(result, properties) : result;
  2163. }
  2164.  
  2165. module.exports = create;
  2166.  
  2167. },{"../internal/baseAssign":10,"../internal/baseCreate":13,"../internal/isIterateeCall":40}],58:[function(require,module,exports){
  2168. var getNative = require('../internal/getNative'),
  2169. isArrayLike = require('../internal/isArrayLike'),
  2170. isObject = require('../lang/isObject'),
  2171. shimKeys = require('../internal/shimKeys');
  2172.  
  2173. /* Native method references for those with the same name as other `lodash` methods. */
  2174. var nativeKeys = getNative(Object, 'keys');
  2175.  
  2176. /**
  2177. * Creates an array of the own enumerable property names of `object`.
  2178. *
  2179. * **Note:** Non-object values are coerced to objects. See the
  2180. * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
  2181. * for more details.
  2182. *
  2183. * @static
  2184. * @memberOf _
  2185. * @category Object
  2186. * @param {Object} object The object to query.
  2187. * @returns {Array} Returns the array of property names.
  2188. * @example
  2189. *
  2190. * function Foo() {
  2191. * this.a = 1;
  2192. * this.b = 2;
  2193. * }
  2194. *
  2195. * Foo.prototype.c = 3;
  2196. *
  2197. * _.keys(new Foo);
  2198. * // => ['a', 'b'] (iteration order is not guaranteed)
  2199. *
  2200. * _.keys('hi');
  2201. * // => ['0', '1']
  2202. */
  2203. var keys = !nativeKeys ? shimKeys : function(object) {
  2204. var Ctor = object == null ? undefined : object.constructor;
  2205. if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
  2206. (typeof object != 'function' && isArrayLike(object))) {
  2207. return shimKeys(object);
  2208. }
  2209. return isObject(object) ? nativeKeys(object) : [];
  2210. };
  2211.  
  2212. module.exports = keys;
  2213.  
  2214. },{"../internal/getNative":37,"../internal/isArrayLike":38,"../internal/shimKeys":45,"../lang/isObject":53}],59:[function(require,module,exports){
  2215. var isArguments = require('../lang/isArguments'),
  2216. isArray = require('../lang/isArray'),
  2217. isIndex = require('../internal/isIndex'),
  2218. isLength = require('../internal/isLength'),
  2219. isObject = require('../lang/isObject');
  2220.  
  2221. /** Used for native method references. */
  2222. var objectProto = Object.prototype;
  2223.  
  2224. /** Used to check objects for own properties. */
  2225. var hasOwnProperty = objectProto.hasOwnProperty;
  2226.  
  2227. /**
  2228. * Creates an array of the own and inherited enumerable property names of `object`.
  2229. *
  2230. * **Note:** Non-object values are coerced to objects.
  2231. *
  2232. * @static
  2233. * @memberOf _
  2234. * @category Object
  2235. * @param {Object} object The object to query.
  2236. * @returns {Array} Returns the array of property names.
  2237. * @example
  2238. *
  2239. * function Foo() {
  2240. * this.a = 1;
  2241. * this.b = 2;
  2242. * }
  2243. *
  2244. * Foo.prototype.c = 3;
  2245. *
  2246. * _.keysIn(new Foo);
  2247. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  2248. */
  2249. function keysIn(object) {
  2250. if (object == null) {
  2251. return [];
  2252. }
  2253. if (!isObject(object)) {
  2254. object = Object(object);
  2255. }
  2256. var length = object.length;
  2257. length = (length && isLength(length) &&
  2258. (isArray(object) || isArguments(object)) && length) || 0;
  2259.  
  2260. var Ctor = object.constructor,
  2261. index = -1,
  2262. isProto = typeof Ctor == 'function' && Ctor.prototype === object,
  2263. result = Array(length),
  2264. skipIndexes = length > 0;
  2265.  
  2266. while (++index < length) {
  2267. result[index] = (index + '');
  2268. }
  2269. for (var key in object) {
  2270. if (!(skipIndexes && isIndex(key, length)) &&
  2271. !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  2272. result.push(key);
  2273. }
  2274. }
  2275. return result;
  2276. }
  2277.  
  2278. module.exports = keysIn;
  2279.  
  2280. },{"../internal/isIndex":39,"../internal/isLength":42,"../lang/isArguments":48,"../lang/isArray":49,"../lang/isObject":53}],60:[function(require,module,exports){
  2281. var keys = require('./keys'),
  2282. toObject = require('../internal/toObject');
  2283.  
  2284. /**
  2285. * Creates a two dimensional array of the key-value pairs for `object`,
  2286. * e.g. `[[key1, value1], [key2, value2]]`.
  2287. *
  2288. * @static
  2289. * @memberOf _
  2290. * @category Object
  2291. * @param {Object} object The object to query.
  2292. * @returns {Array} Returns the new array of key-value pairs.
  2293. * @example
  2294. *
  2295. * _.pairs({ 'barney': 36, 'fred': 40 });
  2296. * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
  2297. */
  2298. function pairs(object) {
  2299. object = toObject(object);
  2300.  
  2301. var index = -1,
  2302. props = keys(object),
  2303. length = props.length,
  2304. result = Array(length);
  2305.  
  2306. while (++index < length) {
  2307. var key = props[index];
  2308. result[index] = [key, object[key]];
  2309. }
  2310. return result;
  2311. }
  2312.  
  2313. module.exports = pairs;
  2314.  
  2315. },{"../internal/toObject":46,"./keys":58}],61:[function(require,module,exports){
  2316. /**
  2317. * This method returns the first argument provided to it.
  2318. *
  2319. * @static
  2320. * @memberOf _
  2321. * @category Utility
  2322. * @param {*} value Any value.
  2323. * @returns {*} Returns `value`.
  2324. * @example
  2325. *
  2326. * var object = { 'user': 'fred' };
  2327. *
  2328. * _.identity(object) === object;
  2329. * // => true
  2330. */
  2331. function identity(value) {
  2332. return value;
  2333. }
  2334.  
  2335. module.exports = identity;
  2336.  
  2337. },{}],62:[function(require,module,exports){
  2338. var baseProperty = require('../internal/baseProperty'),
  2339. basePropertyDeep = require('../internal/basePropertyDeep'),
  2340. isKey = require('../internal/isKey');
  2341.  
  2342. /**
  2343. * Creates a function that returns the property value at `path` on a
  2344. * given object.
  2345. *
  2346. * @static
  2347. * @memberOf _
  2348. * @category Utility
  2349. * @param {Array|string} path The path of the property to get.
  2350. * @returns {Function} Returns the new function.
  2351. * @example
  2352. *
  2353. * var objects = [
  2354. * { 'a': { 'b': { 'c': 2 } } },
  2355. * { 'a': { 'b': { 'c': 1 } } }
  2356. * ];
  2357. *
  2358. * _.map(objects, _.property('a.b.c'));
  2359. * // => [2, 1]
  2360. *
  2361. * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
  2362. * // => [1, 2]
  2363. */
  2364. function property(path) {
  2365. return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
  2366. }
  2367.  
  2368. module.exports = property;
  2369.  
  2370. },{"../internal/baseProperty":24,"../internal/basePropertyDeep":25,"../internal/isKey":41}],63:[function(require,module,exports){
  2371. // Generated by CoffeeScript 1.9.1
  2372. (function() {
  2373. var XMLAttribute, create;
  2374.  
  2375. create = require('lodash/object/create');
  2376.  
  2377. module.exports = XMLAttribute = (function() {
  2378. function XMLAttribute(parent, name, value) {
  2379. this.stringify = parent.stringify;
  2380. if (name == null) {
  2381. throw new Error("Missing attribute name of element " + parent.name);
  2382. }
  2383. if (value == null) {
  2384. throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name);
  2385. }
  2386. this.name = this.stringify.attName(name);
  2387. this.value = this.stringify.attValue(value);
  2388. }
  2389.  
  2390. XMLAttribute.prototype.clone = function() {
  2391. return create(XMLAttribute.prototype, this);
  2392. };
  2393.  
  2394. XMLAttribute.prototype.toString = function(options, level) {
  2395. return ' ' + this.name + '="' + this.value + '"';
  2396. };
  2397.  
  2398. return XMLAttribute;
  2399.  
  2400. })();
  2401.  
  2402. }).call(this);
  2403.  
  2404. },{"lodash/object/create":57}],64:[function(require,module,exports){
  2405. // Generated by CoffeeScript 1.9.1
  2406. (function() {
  2407. var XMLBuilder, XMLDeclaration, XMLDocType, XMLElement, XMLStringifier;
  2408.  
  2409. XMLStringifier = require('./XMLStringifier');
  2410.  
  2411. XMLDeclaration = require('./XMLDeclaration');
  2412.  
  2413. XMLDocType = require('./XMLDocType');
  2414.  
  2415. XMLElement = require('./XMLElement');
  2416.  
  2417. module.exports = XMLBuilder = (function() {
  2418. function XMLBuilder(name, options) {
  2419. var root, temp;
  2420. if (name == null) {
  2421. throw new Error("Root element needs a name");
  2422. }
  2423. if (options == null) {
  2424. options = {};
  2425. }
  2426. this.options = options;
  2427. this.stringify = new XMLStringifier(options);
  2428. temp = new XMLElement(this, 'doc');
  2429. root = temp.element(name);
  2430. root.isRoot = true;
  2431. root.documentObject = this;
  2432. this.rootObject = root;
  2433. if (!options.headless) {
  2434. root.declaration(options);
  2435. if ((options.pubID != null) || (options.sysID != null)) {
  2436. root.doctype(options);
  2437. }
  2438. }
  2439. }
  2440.  
  2441. XMLBuilder.prototype.root = function() {
  2442. return this.rootObject;
  2443. };
  2444.  
  2445. XMLBuilder.prototype.end = function(options) {
  2446. return this.toString(options);
  2447. };
  2448.  
  2449. XMLBuilder.prototype.toString = function(options) {
  2450. var indent, newline, offset, pretty, r, ref, ref1, ref2;
  2451. pretty = (options != null ? options.pretty : void 0) || false;
  2452. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2453. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2454. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2455. r = '';
  2456. if (this.xmldec != null) {
  2457. r += this.xmldec.toString(options);
  2458. }
  2459. if (this.doctype != null) {
  2460. r += this.doctype.toString(options);
  2461. }
  2462. r += this.rootObject.toString(options);
  2463. if (pretty && r.slice(-newline.length) === newline) {
  2464. r = r.slice(0, -newline.length);
  2465. }
  2466. return r;
  2467. };
  2468.  
  2469. return XMLBuilder;
  2470.  
  2471. })();
  2472.  
  2473. }).call(this);
  2474.  
  2475. },{"./XMLDeclaration":71,"./XMLDocType":72,"./XMLElement":73,"./XMLStringifier":77}],65:[function(require,module,exports){
  2476. // Generated by CoffeeScript 1.9.1
  2477. (function() {
  2478. var XMLCData, XMLNode, create,
  2479. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  2480. hasProp = {}.hasOwnProperty;
  2481.  
  2482. create = require('lodash/object/create');
  2483.  
  2484. XMLNode = require('./XMLNode');
  2485.  
  2486. module.exports = XMLCData = (function(superClass) {
  2487. extend(XMLCData, superClass);
  2488.  
  2489. function XMLCData(parent, text) {
  2490. XMLCData.__super__.constructor.call(this, parent);
  2491. if (text == null) {
  2492. throw new Error("Missing CDATA text");
  2493. }
  2494. this.text = this.stringify.cdata(text);
  2495. }
  2496.  
  2497. XMLCData.prototype.clone = function() {
  2498. return create(XMLCData.prototype, this);
  2499. };
  2500.  
  2501. XMLCData.prototype.toString = function(options, level) {
  2502. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2503. pretty = (options != null ? options.pretty : void 0) || false;
  2504. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2505. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2506. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2507. level || (level = 0);
  2508. space = new Array(level + offset + 1).join(indent);
  2509. r = '';
  2510. if (pretty) {
  2511. r += space;
  2512. }
  2513. r += '<![CDATA[' + this.text + ']]>';
  2514. if (pretty) {
  2515. r += newline;
  2516. }
  2517. return r;
  2518. };
  2519.  
  2520. return XMLCData;
  2521.  
  2522. })(XMLNode);
  2523.  
  2524. }).call(this);
  2525.  
  2526. },{"./XMLNode":74,"lodash/object/create":57}],66:[function(require,module,exports){
  2527. // Generated by CoffeeScript 1.9.1
  2528. (function() {
  2529. var XMLComment, XMLNode, create,
  2530. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  2531. hasProp = {}.hasOwnProperty;
  2532.  
  2533. create = require('lodash/object/create');
  2534.  
  2535. XMLNode = require('./XMLNode');
  2536.  
  2537. module.exports = XMLComment = (function(superClass) {
  2538. extend(XMLComment, superClass);
  2539.  
  2540. function XMLComment(parent, text) {
  2541. XMLComment.__super__.constructor.call(this, parent);
  2542. if (text == null) {
  2543. throw new Error("Missing comment text");
  2544. }
  2545. this.text = this.stringify.comment(text);
  2546. }
  2547.  
  2548. XMLComment.prototype.clone = function() {
  2549. return create(XMLComment.prototype, this);
  2550. };
  2551.  
  2552. XMLComment.prototype.toString = function(options, level) {
  2553. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2554. pretty = (options != null ? options.pretty : void 0) || false;
  2555. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2556. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2557. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2558. level || (level = 0);
  2559. space = new Array(level + offset + 1).join(indent);
  2560. r = '';
  2561. if (pretty) {
  2562. r += space;
  2563. }
  2564. r += '<!-- ' + this.text + ' -->';
  2565. if (pretty) {
  2566. r += newline;
  2567. }
  2568. return r;
  2569. };
  2570.  
  2571. return XMLComment;
  2572.  
  2573. })(XMLNode);
  2574.  
  2575. }).call(this);
  2576.  
  2577. },{"./XMLNode":74,"lodash/object/create":57}],67:[function(require,module,exports){
  2578. // Generated by CoffeeScript 1.9.1
  2579. (function() {
  2580. var XMLDTDAttList, create;
  2581.  
  2582. create = require('lodash/object/create');
  2583.  
  2584. module.exports = XMLDTDAttList = (function() {
  2585. function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  2586. this.stringify = parent.stringify;
  2587. if (elementName == null) {
  2588. throw new Error("Missing DTD element name");
  2589. }
  2590. if (attributeName == null) {
  2591. throw new Error("Missing DTD attribute name");
  2592. }
  2593. if (!attributeType) {
  2594. throw new Error("Missing DTD attribute type");
  2595. }
  2596. if (!defaultValueType) {
  2597. throw new Error("Missing DTD attribute default");
  2598. }
  2599. if (defaultValueType.indexOf('#') !== 0) {
  2600. defaultValueType = '#' + defaultValueType;
  2601. }
  2602. if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
  2603. throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
  2604. }
  2605. if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
  2606. throw new Error("Default value only applies to #FIXED or #DEFAULT");
  2607. }
  2608. this.elementName = this.stringify.eleName(elementName);
  2609. this.attributeName = this.stringify.attName(attributeName);
  2610. this.attributeType = this.stringify.dtdAttType(attributeType);
  2611. this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
  2612. this.defaultValueType = defaultValueType;
  2613. }
  2614.  
  2615. XMLDTDAttList.prototype.toString = function(options, level) {
  2616. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2617. pretty = (options != null ? options.pretty : void 0) || false;
  2618. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2619. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2620. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2621. level || (level = 0);
  2622. space = new Array(level + offset + 1).join(indent);
  2623. r = '';
  2624. if (pretty) {
  2625. r += space;
  2626. }
  2627. r += '<!ATTLIST ' + this.elementName + ' ' + this.attributeName + ' ' + this.attributeType;
  2628. if (this.defaultValueType !== '#DEFAULT') {
  2629. r += ' ' + this.defaultValueType;
  2630. }
  2631. if (this.defaultValue) {
  2632. r += ' "' + this.defaultValue + '"';
  2633. }
  2634. r += '>';
  2635. if (pretty) {
  2636. r += newline;
  2637. }
  2638. return r;
  2639. };
  2640.  
  2641. return XMLDTDAttList;
  2642.  
  2643. })();
  2644.  
  2645. }).call(this);
  2646.  
  2647. },{"lodash/object/create":57}],68:[function(require,module,exports){
  2648. // Generated by CoffeeScript 1.9.1
  2649. (function() {
  2650. var XMLDTDElement, create;
  2651.  
  2652. create = require('lodash/object/create');
  2653.  
  2654. module.exports = XMLDTDElement = (function() {
  2655. function XMLDTDElement(parent, name, value) {
  2656. this.stringify = parent.stringify;
  2657. if (name == null) {
  2658. throw new Error("Missing DTD element name");
  2659. }
  2660. if (!value) {
  2661. value = '(#PCDATA)';
  2662. }
  2663. if (Array.isArray(value)) {
  2664. value = '(' + value.join(',') + ')';
  2665. }
  2666. this.name = this.stringify.eleName(name);
  2667. this.value = this.stringify.dtdElementValue(value);
  2668. }
  2669.  
  2670. XMLDTDElement.prototype.toString = function(options, level) {
  2671. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2672. pretty = (options != null ? options.pretty : void 0) || false;
  2673. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2674. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2675. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2676. level || (level = 0);
  2677. space = new Array(level + offset + 1).join(indent);
  2678. r = '';
  2679. if (pretty) {
  2680. r += space;
  2681. }
  2682. r += '<!ELEMENT ' + this.name + ' ' + this.value + '>';
  2683. if (pretty) {
  2684. r += newline;
  2685. }
  2686. return r;
  2687. };
  2688.  
  2689. return XMLDTDElement;
  2690.  
  2691. })();
  2692.  
  2693. }).call(this);
  2694.  
  2695. },{"lodash/object/create":57}],69:[function(require,module,exports){
  2696. // Generated by CoffeeScript 1.9.1
  2697. (function() {
  2698. var XMLDTDEntity, create, isObject;
  2699.  
  2700. create = require('lodash/object/create');
  2701.  
  2702. isObject = require('lodash/lang/isObject');
  2703.  
  2704. module.exports = XMLDTDEntity = (function() {
  2705. function XMLDTDEntity(parent, pe, name, value) {
  2706. this.stringify = parent.stringify;
  2707. if (name == null) {
  2708. throw new Error("Missing entity name");
  2709. }
  2710. if (value == null) {
  2711. throw new Error("Missing entity value");
  2712. }
  2713. this.pe = !!pe;
  2714. this.name = this.stringify.eleName(name);
  2715. if (!isObject(value)) {
  2716. this.value = this.stringify.dtdEntityValue(value);
  2717. } else {
  2718. if (!value.pubID && !value.sysID) {
  2719. throw new Error("Public and/or system identifiers are required for an external entity");
  2720. }
  2721. if (value.pubID && !value.sysID) {
  2722. throw new Error("System identifier is required for a public external entity");
  2723. }
  2724. if (value.pubID != null) {
  2725. this.pubID = this.stringify.dtdPubID(value.pubID);
  2726. }
  2727. if (value.sysID != null) {
  2728. this.sysID = this.stringify.dtdSysID(value.sysID);
  2729. }
  2730. if (value.nData != null) {
  2731. this.nData = this.stringify.dtdNData(value.nData);
  2732. }
  2733. if (this.pe && this.nData) {
  2734. throw new Error("Notation declaration is not allowed in a parameter entity");
  2735. }
  2736. }
  2737. }
  2738.  
  2739. XMLDTDEntity.prototype.toString = function(options, level) {
  2740. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2741. pretty = (options != null ? options.pretty : void 0) || false;
  2742. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2743. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2744. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2745. level || (level = 0);
  2746. space = new Array(level + offset + 1).join(indent);
  2747. r = '';
  2748. if (pretty) {
  2749. r += space;
  2750. }
  2751. r += '<!ENTITY';
  2752. if (this.pe) {
  2753. r += ' %';
  2754. }
  2755. r += ' ' + this.name;
  2756. if (this.value) {
  2757. r += ' "' + this.value + '"';
  2758. } else {
  2759. if (this.pubID && this.sysID) {
  2760. r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
  2761. } else if (this.sysID) {
  2762. r += ' SYSTEM "' + this.sysID + '"';
  2763. }
  2764. if (this.nData) {
  2765. r += ' NDATA ' + this.nData;
  2766. }
  2767. }
  2768. r += '>';
  2769. if (pretty) {
  2770. r += newline;
  2771. }
  2772. return r;
  2773. };
  2774.  
  2775. return XMLDTDEntity;
  2776.  
  2777. })();
  2778.  
  2779. }).call(this);
  2780.  
  2781. },{"lodash/lang/isObject":53,"lodash/object/create":57}],70:[function(require,module,exports){
  2782. // Generated by CoffeeScript 1.9.1
  2783. (function() {
  2784. var XMLDTDNotation, create;
  2785.  
  2786. create = require('lodash/object/create');
  2787.  
  2788. module.exports = XMLDTDNotation = (function() {
  2789. function XMLDTDNotation(parent, name, value) {
  2790. this.stringify = parent.stringify;
  2791. if (name == null) {
  2792. throw new Error("Missing notation name");
  2793. }
  2794. if (!value.pubID && !value.sysID) {
  2795. throw new Error("Public or system identifiers are required for an external entity");
  2796. }
  2797. this.name = this.stringify.eleName(name);
  2798. if (value.pubID != null) {
  2799. this.pubID = this.stringify.dtdPubID(value.pubID);
  2800. }
  2801. if (value.sysID != null) {
  2802. this.sysID = this.stringify.dtdSysID(value.sysID);
  2803. }
  2804. }
  2805.  
  2806. XMLDTDNotation.prototype.toString = function(options, level) {
  2807. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2808. pretty = (options != null ? options.pretty : void 0) || false;
  2809. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2810. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2811. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2812. level || (level = 0);
  2813. space = new Array(level + offset + 1).join(indent);
  2814. r = '';
  2815. if (pretty) {
  2816. r += space;
  2817. }
  2818. r += '<!NOTATION ' + this.name;
  2819. if (this.pubID && this.sysID) {
  2820. r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
  2821. } else if (this.pubID) {
  2822. r += ' PUBLIC "' + this.pubID + '"';
  2823. } else if (this.sysID) {
  2824. r += ' SYSTEM "' + this.sysID + '"';
  2825. }
  2826. r += '>';
  2827. if (pretty) {
  2828. r += newline;
  2829. }
  2830. return r;
  2831. };
  2832.  
  2833. return XMLDTDNotation;
  2834.  
  2835. })();
  2836.  
  2837. }).call(this);
  2838.  
  2839. },{"lodash/object/create":57}],71:[function(require,module,exports){
  2840. // Generated by CoffeeScript 1.9.1
  2841. (function() {
  2842. var XMLDeclaration, XMLNode, create, isObject,
  2843. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  2844. hasProp = {}.hasOwnProperty;
  2845.  
  2846. create = require('lodash/object/create');
  2847.  
  2848. isObject = require('lodash/lang/isObject');
  2849.  
  2850. XMLNode = require('./XMLNode');
  2851.  
  2852. module.exports = XMLDeclaration = (function(superClass) {
  2853. extend(XMLDeclaration, superClass);
  2854.  
  2855. function XMLDeclaration(parent, version, encoding, standalone) {
  2856. var ref;
  2857. XMLDeclaration.__super__.constructor.call(this, parent);
  2858. if (isObject(version)) {
  2859. ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
  2860. }
  2861. if (!version) {
  2862. version = '1.0';
  2863. }
  2864. this.version = this.stringify.xmlVersion(version);
  2865. if (encoding != null) {
  2866. this.encoding = this.stringify.xmlEncoding(encoding);
  2867. }
  2868. if (standalone != null) {
  2869. this.standalone = this.stringify.xmlStandalone(standalone);
  2870. }
  2871. }
  2872.  
  2873. XMLDeclaration.prototype.toString = function(options, level) {
  2874. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  2875. pretty = (options != null ? options.pretty : void 0) || false;
  2876. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  2877. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  2878. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  2879. level || (level = 0);
  2880. space = new Array(level + offset + 1).join(indent);
  2881. r = '';
  2882. if (pretty) {
  2883. r += space;
  2884. }
  2885. r += '<?xml';
  2886. r += ' version="' + this.version + '"';
  2887. if (this.encoding != null) {
  2888. r += ' encoding="' + this.encoding + '"';
  2889. }
  2890. if (this.standalone != null) {
  2891. r += ' standalone="' + this.standalone + '"';
  2892. }
  2893. r += '?>';
  2894. if (pretty) {
  2895. r += newline;
  2896. }
  2897. return r;
  2898. };
  2899.  
  2900. return XMLDeclaration;
  2901.  
  2902. })(XMLNode);
  2903.  
  2904. }).call(this);
  2905.  
  2906. },{"./XMLNode":74,"lodash/lang/isObject":53,"lodash/object/create":57}],72:[function(require,module,exports){
  2907. // Generated by CoffeeScript 1.9.1
  2908. (function() {
  2909. var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLProcessingInstruction, create, isObject;
  2910.  
  2911. create = require('lodash/object/create');
  2912.  
  2913. isObject = require('lodash/lang/isObject');
  2914.  
  2915. XMLCData = require('./XMLCData');
  2916.  
  2917. XMLComment = require('./XMLComment');
  2918.  
  2919. XMLDTDAttList = require('./XMLDTDAttList');
  2920.  
  2921. XMLDTDEntity = require('./XMLDTDEntity');
  2922.  
  2923. XMLDTDElement = require('./XMLDTDElement');
  2924.  
  2925. XMLDTDNotation = require('./XMLDTDNotation');
  2926.  
  2927. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  2928.  
  2929. module.exports = XMLDocType = (function() {
  2930. function XMLDocType(parent, pubID, sysID) {
  2931. var ref, ref1;
  2932. this.documentObject = parent;
  2933. this.stringify = this.documentObject.stringify;
  2934. this.children = [];
  2935. if (isObject(pubID)) {
  2936. ref = pubID, pubID = ref.pubID, sysID = ref.sysID;
  2937. }
  2938. if (sysID == null) {
  2939. ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];
  2940. }
  2941. if (pubID != null) {
  2942. this.pubID = this.stringify.dtdPubID(pubID);
  2943. }
  2944. if (sysID != null) {
  2945. this.sysID = this.stringify.dtdSysID(sysID);
  2946. }
  2947. }
  2948.  
  2949. XMLDocType.prototype.element = function(name, value) {
  2950. var child;
  2951. child = new XMLDTDElement(this, name, value);
  2952. this.children.push(child);
  2953. return this;
  2954. };
  2955.  
  2956. XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  2957. var child;
  2958. child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  2959. this.children.push(child);
  2960. return this;
  2961. };
  2962.  
  2963. XMLDocType.prototype.entity = function(name, value) {
  2964. var child;
  2965. child = new XMLDTDEntity(this, false, name, value);
  2966. this.children.push(child);
  2967. return this;
  2968. };
  2969.  
  2970. XMLDocType.prototype.pEntity = function(name, value) {
  2971. var child;
  2972. child = new XMLDTDEntity(this, true, name, value);
  2973. this.children.push(child);
  2974. return this;
  2975. };
  2976.  
  2977. XMLDocType.prototype.notation = function(name, value) {
  2978. var child;
  2979. child = new XMLDTDNotation(this, name, value);
  2980. this.children.push(child);
  2981. return this;
  2982. };
  2983.  
  2984. XMLDocType.prototype.cdata = function(value) {
  2985. var child;
  2986. child = new XMLCData(this, value);
  2987. this.children.push(child);
  2988. return this;
  2989. };
  2990.  
  2991. XMLDocType.prototype.comment = function(value) {
  2992. var child;
  2993. child = new XMLComment(this, value);
  2994. this.children.push(child);
  2995. return this;
  2996. };
  2997.  
  2998. XMLDocType.prototype.instruction = function(target, value) {
  2999. var child;
  3000. child = new XMLProcessingInstruction(this, target, value);
  3001. this.children.push(child);
  3002. return this;
  3003. };
  3004.  
  3005. XMLDocType.prototype.root = function() {
  3006. return this.documentObject.root();
  3007. };
  3008.  
  3009. XMLDocType.prototype.document = function() {
  3010. return this.documentObject;
  3011. };
  3012.  
  3013. XMLDocType.prototype.toString = function(options, level) {
  3014. var child, i, indent, len, newline, offset, pretty, r, ref, ref1, ref2, ref3, space;
  3015. pretty = (options != null ? options.pretty : void 0) || false;
  3016. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  3017. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  3018. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  3019. level || (level = 0);
  3020. space = new Array(level + offset + 1).join(indent);
  3021. r = '';
  3022. if (pretty) {
  3023. r += space;
  3024. }
  3025. r += '<!DOCTYPE ' + this.root().name;
  3026. if (this.pubID && this.sysID) {
  3027. r += ' PUBLIC "' + this.pubID + '" "' + this.sysID + '"';
  3028. } else if (this.sysID) {
  3029. r += ' SYSTEM "' + this.sysID + '"';
  3030. }
  3031. if (this.children.length > 0) {
  3032. r += ' [';
  3033. if (pretty) {
  3034. r += newline;
  3035. }
  3036. ref3 = this.children;
  3037. for (i = 0, len = ref3.length; i < len; i++) {
  3038. child = ref3[i];
  3039. r += child.toString(options, level + 1);
  3040. }
  3041. r += ']';
  3042. }
  3043. r += '>';
  3044. if (pretty) {
  3045. r += newline;
  3046. }
  3047. return r;
  3048. };
  3049.  
  3050. XMLDocType.prototype.ele = function(name, value) {
  3051. return this.element(name, value);
  3052. };
  3053.  
  3054. XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  3055. return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
  3056. };
  3057.  
  3058. XMLDocType.prototype.ent = function(name, value) {
  3059. return this.entity(name, value);
  3060. };
  3061.  
  3062. XMLDocType.prototype.pent = function(name, value) {
  3063. return this.pEntity(name, value);
  3064. };
  3065.  
  3066. XMLDocType.prototype.not = function(name, value) {
  3067. return this.notation(name, value);
  3068. };
  3069.  
  3070. XMLDocType.prototype.dat = function(value) {
  3071. return this.cdata(value);
  3072. };
  3073.  
  3074. XMLDocType.prototype.com = function(value) {
  3075. return this.comment(value);
  3076. };
  3077.  
  3078. XMLDocType.prototype.ins = function(target, value) {
  3079. return this.instruction(target, value);
  3080. };
  3081.  
  3082. XMLDocType.prototype.up = function() {
  3083. return this.root();
  3084. };
  3085.  
  3086. XMLDocType.prototype.doc = function() {
  3087. return this.document();
  3088. };
  3089.  
  3090. return XMLDocType;
  3091.  
  3092. })();
  3093.  
  3094. }).call(this);
  3095.  
  3096. },{"./XMLCData":65,"./XMLComment":66,"./XMLDTDAttList":67,"./XMLDTDElement":68,"./XMLDTDEntity":69,"./XMLDTDNotation":70,"./XMLProcessingInstruction":75,"lodash/lang/isObject":53,"lodash/object/create":57}],73:[function(require,module,exports){
  3097. // Generated by CoffeeScript 1.9.1
  3098. (function() {
  3099. var XMLAttribute, XMLElement, XMLNode, XMLProcessingInstruction, create, every, isFunction, isObject,
  3100. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  3101. hasProp = {}.hasOwnProperty;
  3102.  
  3103. create = require('lodash/object/create');
  3104.  
  3105. isObject = require('lodash/lang/isObject');
  3106.  
  3107. isFunction = require('lodash/lang/isFunction');
  3108.  
  3109. every = require('lodash/collection/every');
  3110.  
  3111. XMLNode = require('./XMLNode');
  3112.  
  3113. XMLAttribute = require('./XMLAttribute');
  3114.  
  3115. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  3116.  
  3117. module.exports = XMLElement = (function(superClass) {
  3118. extend(XMLElement, superClass);
  3119.  
  3120. function XMLElement(parent, name, attributes) {
  3121. XMLElement.__super__.constructor.call(this, parent);
  3122. if (name == null) {
  3123. throw new Error("Missing element name");
  3124. }
  3125. this.name = this.stringify.eleName(name);
  3126. this.children = [];
  3127. this.instructions = [];
  3128. this.attributes = {};
  3129. if (attributes != null) {
  3130. this.attribute(attributes);
  3131. }
  3132. }
  3133.  
  3134. XMLElement.prototype.clone = function() {
  3135. var att, attName, clonedSelf, i, len, pi, ref, ref1;
  3136. clonedSelf = create(XMLElement.prototype, this);
  3137. if (clonedSelf.isRoot) {
  3138. clonedSelf.documentObject = null;
  3139. }
  3140. clonedSelf.attributes = {};
  3141. ref = this.attributes;
  3142. for (attName in ref) {
  3143. if (!hasProp.call(ref, attName)) continue;
  3144. att = ref[attName];
  3145. clonedSelf.attributes[attName] = att.clone();
  3146. }
  3147. clonedSelf.instructions = [];
  3148. ref1 = this.instructions;
  3149. for (i = 0, len = ref1.length; i < len; i++) {
  3150. pi = ref1[i];
  3151. clonedSelf.instructions.push(pi.clone());
  3152. }
  3153. clonedSelf.children = [];
  3154. this.children.forEach(function(child) {
  3155. var clonedChild;
  3156. clonedChild = child.clone();
  3157. clonedChild.parent = clonedSelf;
  3158. return clonedSelf.children.push(clonedChild);
  3159. });
  3160. return clonedSelf;
  3161. };
  3162.  
  3163. XMLElement.prototype.attribute = function(name, value) {
  3164. var attName, attValue;
  3165. if (name != null) {
  3166. name = name.valueOf();
  3167. }
  3168. if (isObject(name)) {
  3169. for (attName in name) {
  3170. if (!hasProp.call(name, attName)) continue;
  3171. attValue = name[attName];
  3172. this.attribute(attName, attValue);
  3173. }
  3174. } else {
  3175. if (isFunction(value)) {
  3176. value = value.apply();
  3177. }
  3178. if (!this.options.skipNullAttributes || (value != null)) {
  3179. this.attributes[name] = new XMLAttribute(this, name, value);
  3180. }
  3181. }
  3182. return this;
  3183. };
  3184.  
  3185. XMLElement.prototype.removeAttribute = function(name) {
  3186. var attName, i, len;
  3187. if (name == null) {
  3188. throw new Error("Missing attribute name");
  3189. }
  3190. name = name.valueOf();
  3191. if (Array.isArray(name)) {
  3192. for (i = 0, len = name.length; i < len; i++) {
  3193. attName = name[i];
  3194. delete this.attributes[attName];
  3195. }
  3196. } else {
  3197. delete this.attributes[name];
  3198. }
  3199. return this;
  3200. };
  3201.  
  3202. XMLElement.prototype.instruction = function(target, value) {
  3203. var i, insTarget, insValue, instruction, len;
  3204. if (target != null) {
  3205. target = target.valueOf();
  3206. }
  3207. if (value != null) {
  3208. value = value.valueOf();
  3209. }
  3210. if (Array.isArray(target)) {
  3211. for (i = 0, len = target.length; i < len; i++) {
  3212. insTarget = target[i];
  3213. this.instruction(insTarget);
  3214. }
  3215. } else if (isObject(target)) {
  3216. for (insTarget in target) {
  3217. if (!hasProp.call(target, insTarget)) continue;
  3218. insValue = target[insTarget];
  3219. this.instruction(insTarget, insValue);
  3220. }
  3221. } else {
  3222. if (isFunction(value)) {
  3223. value = value.apply();
  3224. }
  3225. instruction = new XMLProcessingInstruction(this, target, value);
  3226. this.instructions.push(instruction);
  3227. }
  3228. return this;
  3229. };
  3230.  
  3231. XMLElement.prototype.toString = function(options, level) {
  3232. var att, child, i, indent, instruction, j, len, len1, name, newline, offset, pretty, r, ref, ref1, ref2, ref3, ref4, ref5, space;
  3233. pretty = (options != null ? options.pretty : void 0) || false;
  3234. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  3235. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  3236. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  3237. level || (level = 0);
  3238. space = new Array(level + offset + 1).join(indent);
  3239. r = '';
  3240. ref3 = this.instructions;
  3241. for (i = 0, len = ref3.length; i < len; i++) {
  3242. instruction = ref3[i];
  3243. r += instruction.toString(options, level);
  3244. }
  3245. if (pretty) {
  3246. r += space;
  3247. }
  3248. r += '<' + this.name;
  3249. ref4 = this.attributes;
  3250. for (name in ref4) {
  3251. if (!hasProp.call(ref4, name)) continue;
  3252. att = ref4[name];
  3253. r += att.toString(options);
  3254. }
  3255. if (this.children.length === 0 || every(this.children, function(e) {
  3256. return e.value === '';
  3257. })) {
  3258. r += '/>';
  3259. if (pretty) {
  3260. r += newline;
  3261. }
  3262. } else if (pretty && this.children.length === 1 && (this.children[0].value != null)) {
  3263. r += '>';
  3264. r += this.children[0].value;
  3265. r += '</' + this.name + '>';
  3266. r += newline;
  3267. } else {
  3268. r += '>';
  3269. if (pretty) {
  3270. r += newline;
  3271. }
  3272. ref5 = this.children;
  3273. for (j = 0, len1 = ref5.length; j < len1; j++) {
  3274. child = ref5[j];
  3275. r += child.toString(options, level + 1);
  3276. }
  3277. if (pretty) {
  3278. r += space;
  3279. }
  3280. r += '</' + this.name + '>';
  3281. if (pretty) {
  3282. r += newline;
  3283. }
  3284. }
  3285. return r;
  3286. };
  3287.  
  3288. XMLElement.prototype.att = function(name, value) {
  3289. return this.attribute(name, value);
  3290. };
  3291.  
  3292. XMLElement.prototype.ins = function(target, value) {
  3293. return this.instruction(target, value);
  3294. };
  3295.  
  3296. XMLElement.prototype.a = function(name, value) {
  3297. return this.attribute(name, value);
  3298. };
  3299.  
  3300. XMLElement.prototype.i = function(target, value) {
  3301. return this.instruction(target, value);
  3302. };
  3303.  
  3304. return XMLElement;
  3305.  
  3306. })(XMLNode);
  3307.  
  3308. }).call(this);
  3309.  
  3310. },{"./XMLAttribute":63,"./XMLNode":74,"./XMLProcessingInstruction":75,"lodash/collection/every":5,"lodash/lang/isFunction":51,"lodash/lang/isObject":53,"lodash/object/create":57}],74:[function(require,module,exports){
  3311. // Generated by CoffeeScript 1.9.1
  3312. (function() {
  3313. var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLRaw, XMLText, isEmpty, isFunction, isObject,
  3314. hasProp = {}.hasOwnProperty;
  3315.  
  3316. isObject = require('lodash/lang/isObject');
  3317.  
  3318. isFunction = require('lodash/lang/isFunction');
  3319.  
  3320. isEmpty = require('lodash/lang/isEmpty');
  3321.  
  3322. XMLElement = null;
  3323.  
  3324. XMLCData = null;
  3325.  
  3326. XMLComment = null;
  3327.  
  3328. XMLDeclaration = null;
  3329.  
  3330. XMLDocType = null;
  3331.  
  3332. XMLRaw = null;
  3333.  
  3334. XMLText = null;
  3335.  
  3336. module.exports = XMLNode = (function() {
  3337. function XMLNode(parent) {
  3338. this.parent = parent;
  3339. this.options = this.parent.options;
  3340. this.stringify = this.parent.stringify;
  3341. if (XMLElement === null) {
  3342. XMLElement = require('./XMLElement');
  3343. XMLCData = require('./XMLCData');
  3344. XMLComment = require('./XMLComment');
  3345. XMLDeclaration = require('./XMLDeclaration');
  3346. XMLDocType = require('./XMLDocType');
  3347. XMLRaw = require('./XMLRaw');
  3348. XMLText = require('./XMLText');
  3349. }
  3350. }
  3351.  
  3352. XMLNode.prototype.element = function(name, attributes, text) {
  3353. var childNode, item, j, k, key, lastChild, len, len1, ref, val;
  3354. lastChild = null;
  3355. if (attributes == null) {
  3356. attributes = {};
  3357. }
  3358. attributes = attributes.valueOf();
  3359. if (!isObject(attributes)) {
  3360. ref = [attributes, text], text = ref[0], attributes = ref[1];
  3361. }
  3362. if (name != null) {
  3363. name = name.valueOf();
  3364. }
  3365. if (Array.isArray(name)) {
  3366. for (j = 0, len = name.length; j < len; j++) {
  3367. item = name[j];
  3368. lastChild = this.element(item);
  3369. }
  3370. } else if (isFunction(name)) {
  3371. lastChild = this.element(name.apply());
  3372. } else if (isObject(name)) {
  3373. for (key in name) {
  3374. if (!hasProp.call(name, key)) continue;
  3375. val = name[key];
  3376. if (isFunction(val)) {
  3377. val = val.apply();
  3378. }
  3379. if ((isObject(val)) && (isEmpty(val))) {
  3380. val = null;
  3381. }
  3382. if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
  3383. lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
  3384. } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && key.indexOf(this.stringify.convertPIKey) === 0) {
  3385. lastChild = this.instruction(key.substr(this.stringify.convertPIKey.length), val);
  3386. } else if (Array.isArray(val)) {
  3387. for (k = 0, len1 = val.length; k < len1; k++) {
  3388. item = val[k];
  3389. childNode = {};
  3390. childNode[key] = item;
  3391. lastChild = this.element(childNode);
  3392. }
  3393. } else if (isObject(val)) {
  3394. lastChild = this.element(key);
  3395. lastChild.element(val);
  3396. } else {
  3397. lastChild = this.element(key, val);
  3398. }
  3399. }
  3400. } else {
  3401. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
  3402. lastChild = this.text(text);
  3403. } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
  3404. lastChild = this.cdata(text);
  3405. } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
  3406. lastChild = this.comment(text);
  3407. } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
  3408. lastChild = this.raw(text);
  3409. } else {
  3410. lastChild = this.node(name, attributes, text);
  3411. }
  3412. }
  3413. if (lastChild == null) {
  3414. throw new Error("Could not create any elements with: " + name);
  3415. }
  3416. return lastChild;
  3417. };
  3418.  
  3419. XMLNode.prototype.insertBefore = function(name, attributes, text) {
  3420. var child, i, removed;
  3421. if (this.isRoot) {
  3422. throw new Error("Cannot insert elements at root level");
  3423. }
  3424. i = this.parent.children.indexOf(this);
  3425. removed = this.parent.children.splice(i);
  3426. child = this.parent.element(name, attributes, text);
  3427. Array.prototype.push.apply(this.parent.children, removed);
  3428. return child;
  3429. };
  3430.  
  3431. XMLNode.prototype.insertAfter = function(name, attributes, text) {
  3432. var child, i, removed;
  3433. if (this.isRoot) {
  3434. throw new Error("Cannot insert elements at root level");
  3435. }
  3436. i = this.parent.children.indexOf(this);
  3437. removed = this.parent.children.splice(i + 1);
  3438. child = this.parent.element(name, attributes, text);
  3439. Array.prototype.push.apply(this.parent.children, removed);
  3440. return child;
  3441. };
  3442.  
  3443. XMLNode.prototype.remove = function() {
  3444. var i, ref;
  3445. if (this.isRoot) {
  3446. throw new Error("Cannot remove the root element");
  3447. }
  3448. i = this.parent.children.indexOf(this);
  3449. [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref = [])), ref;
  3450. return this.parent;
  3451. };
  3452.  
  3453. XMLNode.prototype.node = function(name, attributes, text) {
  3454. var child, ref;
  3455. if (name != null) {
  3456. name = name.valueOf();
  3457. }
  3458. if (attributes == null) {
  3459. attributes = {};
  3460. }
  3461. attributes = attributes.valueOf();
  3462. if (!isObject(attributes)) {
  3463. ref = [attributes, text], text = ref[0], attributes = ref[1];
  3464. }
  3465. child = new XMLElement(this, name, attributes);
  3466. if (text != null) {
  3467. child.text(text);
  3468. }
  3469. this.children.push(child);
  3470. return child;
  3471. };
  3472.  
  3473. XMLNode.prototype.text = function(value) {
  3474. var child;
  3475. child = new XMLText(this, value);
  3476. this.children.push(child);
  3477. return this;
  3478. };
  3479.  
  3480. XMLNode.prototype.cdata = function(value) {
  3481. var child;
  3482. child = new XMLCData(this, value);
  3483. this.children.push(child);
  3484. return this;
  3485. };
  3486.  
  3487. XMLNode.prototype.comment = function(value) {
  3488. var child;
  3489. child = new XMLComment(this, value);
  3490. this.children.push(child);
  3491. return this;
  3492. };
  3493.  
  3494. XMLNode.prototype.raw = function(value) {
  3495. var child;
  3496. child = new XMLRaw(this, value);
  3497. this.children.push(child);
  3498. return this;
  3499. };
  3500.  
  3501. XMLNode.prototype.declaration = function(version, encoding, standalone) {
  3502. var doc, xmldec;
  3503. doc = this.document();
  3504. xmldec = new XMLDeclaration(doc, version, encoding, standalone);
  3505. doc.xmldec = xmldec;
  3506. return doc.root();
  3507. };
  3508.  
  3509. XMLNode.prototype.doctype = function(pubID, sysID) {
  3510. var doc, doctype;
  3511. doc = this.document();
  3512. doctype = new XMLDocType(doc, pubID, sysID);
  3513. doc.doctype = doctype;
  3514. return doctype;
  3515. };
  3516.  
  3517. XMLNode.prototype.up = function() {
  3518. if (this.isRoot) {
  3519. throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
  3520. }
  3521. return this.parent;
  3522. };
  3523.  
  3524. XMLNode.prototype.root = function() {
  3525. var child;
  3526. if (this.isRoot) {
  3527. return this;
  3528. }
  3529. child = this.parent;
  3530. while (!child.isRoot) {
  3531. child = child.parent;
  3532. }
  3533. return child;
  3534. };
  3535.  
  3536. XMLNode.prototype.document = function() {
  3537. return this.root().documentObject;
  3538. };
  3539.  
  3540. XMLNode.prototype.end = function(options) {
  3541. return this.document().toString(options);
  3542. };
  3543.  
  3544. XMLNode.prototype.prev = function() {
  3545. var i;
  3546. if (this.isRoot) {
  3547. throw new Error("Root node has no siblings");
  3548. }
  3549. i = this.parent.children.indexOf(this);
  3550. if (i < 1) {
  3551. throw new Error("Already at the first node");
  3552. }
  3553. return this.parent.children[i - 1];
  3554. };
  3555.  
  3556. XMLNode.prototype.next = function() {
  3557. var i;
  3558. if (this.isRoot) {
  3559. throw new Error("Root node has no siblings");
  3560. }
  3561. i = this.parent.children.indexOf(this);
  3562. if (i === -1 || i === this.parent.children.length - 1) {
  3563. throw new Error("Already at the last node");
  3564. }
  3565. return this.parent.children[i + 1];
  3566. };
  3567.  
  3568. XMLNode.prototype.importXMLBuilder = function(xmlbuilder) {
  3569. var clonedRoot;
  3570. clonedRoot = xmlbuilder.root().clone();
  3571. clonedRoot.parent = this;
  3572. clonedRoot.isRoot = false;
  3573. this.children.push(clonedRoot);
  3574. return this;
  3575. };
  3576.  
  3577. XMLNode.prototype.ele = function(name, attributes, text) {
  3578. return this.element(name, attributes, text);
  3579. };
  3580.  
  3581. XMLNode.prototype.nod = function(name, attributes, text) {
  3582. return this.node(name, attributes, text);
  3583. };
  3584.  
  3585. XMLNode.prototype.txt = function(value) {
  3586. return this.text(value);
  3587. };
  3588.  
  3589. XMLNode.prototype.dat = function(value) {
  3590. return this.cdata(value);
  3591. };
  3592.  
  3593. XMLNode.prototype.com = function(value) {
  3594. return this.comment(value);
  3595. };
  3596.  
  3597. XMLNode.prototype.doc = function() {
  3598. return this.document();
  3599. };
  3600.  
  3601. XMLNode.prototype.dec = function(version, encoding, standalone) {
  3602. return this.declaration(version, encoding, standalone);
  3603. };
  3604.  
  3605. XMLNode.prototype.dtd = function(pubID, sysID) {
  3606. return this.doctype(pubID, sysID);
  3607. };
  3608.  
  3609. XMLNode.prototype.e = function(name, attributes, text) {
  3610. return this.element(name, attributes, text);
  3611. };
  3612.  
  3613. XMLNode.prototype.n = function(name, attributes, text) {
  3614. return this.node(name, attributes, text);
  3615. };
  3616.  
  3617. XMLNode.prototype.t = function(value) {
  3618. return this.text(value);
  3619. };
  3620.  
  3621. XMLNode.prototype.d = function(value) {
  3622. return this.cdata(value);
  3623. };
  3624.  
  3625. XMLNode.prototype.c = function(value) {
  3626. return this.comment(value);
  3627. };
  3628.  
  3629. XMLNode.prototype.r = function(value) {
  3630. return this.raw(value);
  3631. };
  3632.  
  3633. XMLNode.prototype.u = function() {
  3634. return this.up();
  3635. };
  3636.  
  3637. return XMLNode;
  3638.  
  3639. })();
  3640.  
  3641. }).call(this);
  3642.  
  3643. },{"./XMLCData":65,"./XMLComment":66,"./XMLDeclaration":71,"./XMLDocType":72,"./XMLElement":73,"./XMLRaw":76,"./XMLText":78,"lodash/lang/isEmpty":50,"lodash/lang/isFunction":51,"lodash/lang/isObject":53}],75:[function(require,module,exports){
  3644. // Generated by CoffeeScript 1.9.1
  3645. (function() {
  3646. var XMLProcessingInstruction, create;
  3647.  
  3648. create = require('lodash/object/create');
  3649.  
  3650. module.exports = XMLProcessingInstruction = (function() {
  3651. function XMLProcessingInstruction(parent, target, value) {
  3652. this.stringify = parent.stringify;
  3653. if (target == null) {
  3654. throw new Error("Missing instruction target");
  3655. }
  3656. this.target = this.stringify.insTarget(target);
  3657. if (value) {
  3658. this.value = this.stringify.insValue(value);
  3659. }
  3660. }
  3661.  
  3662. XMLProcessingInstruction.prototype.clone = function() {
  3663. return create(XMLProcessingInstruction.prototype, this);
  3664. };
  3665.  
  3666. XMLProcessingInstruction.prototype.toString = function(options, level) {
  3667. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  3668. pretty = (options != null ? options.pretty : void 0) || false;
  3669. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  3670. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  3671. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  3672. level || (level = 0);
  3673. space = new Array(level + offset + 1).join(indent);
  3674. r = '';
  3675. if (pretty) {
  3676. r += space;
  3677. }
  3678. r += '<?';
  3679. r += this.target;
  3680. if (this.value) {
  3681. r += ' ' + this.value;
  3682. }
  3683. r += '?>';
  3684. if (pretty) {
  3685. r += newline;
  3686. }
  3687. return r;
  3688. };
  3689.  
  3690. return XMLProcessingInstruction;
  3691.  
  3692. })();
  3693.  
  3694. }).call(this);
  3695.  
  3696. },{"lodash/object/create":57}],76:[function(require,module,exports){
  3697. // Generated by CoffeeScript 1.9.1
  3698. (function() {
  3699. var XMLNode, XMLRaw, create,
  3700. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  3701. hasProp = {}.hasOwnProperty;
  3702.  
  3703. create = require('lodash/object/create');
  3704.  
  3705. XMLNode = require('./XMLNode');
  3706.  
  3707. module.exports = XMLRaw = (function(superClass) {
  3708. extend(XMLRaw, superClass);
  3709.  
  3710. function XMLRaw(parent, text) {
  3711. XMLRaw.__super__.constructor.call(this, parent);
  3712. if (text == null) {
  3713. throw new Error("Missing raw text");
  3714. }
  3715. this.value = this.stringify.raw(text);
  3716. }
  3717.  
  3718. XMLRaw.prototype.clone = function() {
  3719. return create(XMLRaw.prototype, this);
  3720. };
  3721.  
  3722. XMLRaw.prototype.toString = function(options, level) {
  3723. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  3724. pretty = (options != null ? options.pretty : void 0) || false;
  3725. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  3726. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  3727. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  3728. level || (level = 0);
  3729. space = new Array(level + offset + 1).join(indent);
  3730. r = '';
  3731. if (pretty) {
  3732. r += space;
  3733. }
  3734. r += this.value;
  3735. if (pretty) {
  3736. r += newline;
  3737. }
  3738. return r;
  3739. };
  3740.  
  3741. return XMLRaw;
  3742.  
  3743. })(XMLNode);
  3744.  
  3745. }).call(this);
  3746.  
  3747. },{"./XMLNode":74,"lodash/object/create":57}],77:[function(require,module,exports){
  3748. // Generated by CoffeeScript 1.9.1
  3749. (function() {
  3750. var XMLStringifier,
  3751. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  3752. hasProp = {}.hasOwnProperty;
  3753.  
  3754. module.exports = XMLStringifier = (function() {
  3755. function XMLStringifier(options) {
  3756. this.assertLegalChar = bind(this.assertLegalChar, this);
  3757. var key, ref, value;
  3758. this.allowSurrogateChars = options != null ? options.allowSurrogateChars : void 0;
  3759. ref = (options != null ? options.stringify : void 0) || {};
  3760. for (key in ref) {
  3761. if (!hasProp.call(ref, key)) continue;
  3762. value = ref[key];
  3763. this[key] = value;
  3764. }
  3765. }
  3766.  
  3767. XMLStringifier.prototype.eleName = function(val) {
  3768. val = '' + val || '';
  3769. return this.assertLegalChar(val);
  3770. };
  3771.  
  3772. XMLStringifier.prototype.eleText = function(val) {
  3773. val = '' + val || '';
  3774. return this.assertLegalChar(this.elEscape(val));
  3775. };
  3776.  
  3777. XMLStringifier.prototype.cdata = function(val) {
  3778. val = '' + val || '';
  3779. if (val.match(/]]>/)) {
  3780. throw new Error("Invalid CDATA text: " + val);
  3781. }
  3782. return this.assertLegalChar(val);
  3783. };
  3784.  
  3785. XMLStringifier.prototype.comment = function(val) {
  3786. val = '' + val || '';
  3787. if (val.match(/--/)) {
  3788. throw new Error("Comment text cannot contain double-hypen: " + val);
  3789. }
  3790. return this.assertLegalChar(val);
  3791. };
  3792.  
  3793. XMLStringifier.prototype.raw = function(val) {
  3794. return '' + val || '';
  3795. };
  3796.  
  3797. XMLStringifier.prototype.attName = function(val) {
  3798. return '' + val || '';
  3799. };
  3800.  
  3801. XMLStringifier.prototype.attValue = function(val) {
  3802. val = '' + val || '';
  3803. return this.attEscape(val);
  3804. };
  3805.  
  3806. XMLStringifier.prototype.insTarget = function(val) {
  3807. return '' + val || '';
  3808. };
  3809.  
  3810. XMLStringifier.prototype.insValue = function(val) {
  3811. val = '' + val || '';
  3812. if (val.match(/\?>/)) {
  3813. throw new Error("Invalid processing instruction value: " + val);
  3814. }
  3815. return val;
  3816. };
  3817.  
  3818. XMLStringifier.prototype.xmlVersion = function(val) {
  3819. val = '' + val || '';
  3820. if (!val.match(/1\.[0-9]+/)) {
  3821. throw new Error("Invalid version number: " + val);
  3822. }
  3823. return val;
  3824. };
  3825.  
  3826. XMLStringifier.prototype.xmlEncoding = function(val) {
  3827. val = '' + val || '';
  3828. if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/)) {
  3829. throw new Error("Invalid encoding: " + val);
  3830. }
  3831. return val;
  3832. };
  3833.  
  3834. XMLStringifier.prototype.xmlStandalone = function(val) {
  3835. if (val) {
  3836. return "yes";
  3837. } else {
  3838. return "no";
  3839. }
  3840. };
  3841.  
  3842. XMLStringifier.prototype.dtdPubID = function(val) {
  3843. return '' + val || '';
  3844. };
  3845.  
  3846. XMLStringifier.prototype.dtdSysID = function(val) {
  3847. return '' + val || '';
  3848. };
  3849.  
  3850. XMLStringifier.prototype.dtdElementValue = function(val) {
  3851. return '' + val || '';
  3852. };
  3853.  
  3854. XMLStringifier.prototype.dtdAttType = function(val) {
  3855. return '' + val || '';
  3856. };
  3857.  
  3858. XMLStringifier.prototype.dtdAttDefault = function(val) {
  3859. if (val != null) {
  3860. return '' + val || '';
  3861. } else {
  3862. return val;
  3863. }
  3864. };
  3865.  
  3866. XMLStringifier.prototype.dtdEntityValue = function(val) {
  3867. return '' + val || '';
  3868. };
  3869.  
  3870. XMLStringifier.prototype.dtdNData = function(val) {
  3871. return '' + val || '';
  3872. };
  3873.  
  3874. XMLStringifier.prototype.convertAttKey = '@';
  3875.  
  3876. XMLStringifier.prototype.convertPIKey = '?';
  3877.  
  3878. XMLStringifier.prototype.convertTextKey = '#text';
  3879.  
  3880. XMLStringifier.prototype.convertCDataKey = '#cdata';
  3881.  
  3882. XMLStringifier.prototype.convertCommentKey = '#comment';
  3883.  
  3884. XMLStringifier.prototype.convertRawKey = '#raw';
  3885.  
  3886. XMLStringifier.prototype.assertLegalChar = function(str) {
  3887. var chars, chr;
  3888. if (this.allowSurrogateChars) {
  3889. chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/;
  3890. } else {
  3891. chars = /[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/;
  3892. }
  3893. chr = str.match(chars);
  3894. if (chr) {
  3895. throw new Error("Invalid character (" + chr + ") in string: " + str + " at index " + chr.index);
  3896. }
  3897. return str;
  3898. };
  3899.  
  3900. XMLStringifier.prototype.elEscape = function(str) {
  3901. return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r/g, '&#xD;');
  3902. };
  3903.  
  3904. XMLStringifier.prototype.attEscape = function(str) {
  3905. return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
  3906. };
  3907.  
  3908. return XMLStringifier;
  3909.  
  3910. })();
  3911.  
  3912. }).call(this);
  3913.  
  3914. },{}],78:[function(require,module,exports){
  3915. // Generated by CoffeeScript 1.9.1
  3916. (function() {
  3917. var XMLNode, XMLText, create,
  3918. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  3919. hasProp = {}.hasOwnProperty;
  3920.  
  3921. create = require('lodash/object/create');
  3922.  
  3923. XMLNode = require('./XMLNode');
  3924.  
  3925. module.exports = XMLText = (function(superClass) {
  3926. extend(XMLText, superClass);
  3927.  
  3928. function XMLText(parent, text) {
  3929. XMLText.__super__.constructor.call(this, parent);
  3930. if (text == null) {
  3931. throw new Error("Missing element text");
  3932. }
  3933. this.value = this.stringify.eleText(text);
  3934. }
  3935.  
  3936. XMLText.prototype.clone = function() {
  3937. return create(XMLText.prototype, this);
  3938. };
  3939.  
  3940. XMLText.prototype.toString = function(options, level) {
  3941. var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
  3942. pretty = (options != null ? options.pretty : void 0) || false;
  3943. indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
  3944. offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
  3945. newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
  3946. level || (level = 0);
  3947. space = new Array(level + offset + 1).join(indent);
  3948. r = '';
  3949. if (pretty) {
  3950. r += space;
  3951. }
  3952. r += this.value;
  3953. if (pretty) {
  3954. r += newline;
  3955. }
  3956. return r;
  3957. };
  3958.  
  3959. return XMLText;
  3960.  
  3961. })(XMLNode);
  3962.  
  3963. }).call(this);
  3964.  
  3965. },{"./XMLNode":74,"lodash/object/create":57}],79:[function(require,module,exports){
  3966. // Generated by CoffeeScript 1.9.1
  3967. (function() {
  3968. var XMLBuilder, assign;
  3969.  
  3970. assign = require('lodash/object/assign');
  3971.  
  3972. XMLBuilder = require('./XMLBuilder');
  3973.  
  3974. module.exports.create = function(name, xmldec, doctype, options) {
  3975. options = assign({}, xmldec, doctype, options);
  3976. return new XMLBuilder(name, options).root();
  3977. };
  3978.  
  3979. }).call(this);
  3980.  
  3981. },{"./XMLBuilder":64,"lodash/object/assign":56}]},{},[1])(1)
  3982. });
Buy Me A Coffee