UNPKG

docx4js-fork

Version:
34 lines (24 loc) 519 kB
require=(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){ "use strict";function _interopRequireDefault(r){return r&&r.__esModule?r:{default:r}}var _extends=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e])}return r},_cheerio=require("cheerio"),_cheerio2=_interopRequireDefault(_cheerio);_cheerio2.default.prototype.props=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0==this.length)return{};var t=this.constructor,n=r.names,e=r.nameFn,i=void 0===e?function(r){return n&&n[r]||r}:e,o=r.__filter,u=void 0===o?"*":o,c=r.tidy,a=void 0===c?function(r){return r}:c,f=function(t){return Object.keys(t).filter(function(r){return!r.startsWith("xmlns")}).reduce(function(n,e){var o=t[e];e=e.split(":").pop();var u=r[e]?r[e](o):o;return void 0!=u&&(n[i(e)]=u),n},{})},d=function(t,n){var e=t.name.split(":").pop(),o=r[e]?r[e](t):s(t);return void 0!=o&&(n[i(e,t,n)]=r["tidy_"+e]?r["tidy_"+e](o):o),n},s=function(r,n){var e=r.children,i=r.attribs;return e.filter(function(r){return r.name&&t(r).is(u)}).reduce(function(r,t){return d(t,r)},_extends({},f(i)))},l=s(this[0]);return a?a(l):l},_cheerio2.default.prototype.forwardUntil=function(r,t){for(var n=this.constructor.root().not(function(r){return!0}),e=function(r){return n.not(function(r){return!0}).add(r)},i=n,o=n,u=this.get(0),c=function r(t){return t&&t.parent&&(t.parent.next||r(t.parent))},a=function(r){return r&&(r.children&&r.children[0]||r.next||c(r))};u&&(u=a(u));){var f=e(u);if(f.is(r)){i=i.add(u);break}t&&f.is(t)&&(o=o.add(u))}return t?o:i},_cheerio2.default.prototype.backwardUntil=function(r,t){for(var n=this.constructor.root().not(function(r){return!0}),e=function(r){return n.not(function(r){return!0}).add(r)},i=n,o=n,u=this.get(0),c=function r(t){return t&&t.parent&&(t.parent.prev||r(t.parent))},a=function(r){return r&&(r.children&&r.children[r.children.length-1]||r.prev||c(r))};u&&(u=a(u));){var f=e(u);if(f.is(r)){i=i.add(u);break}t&&f.is(t)&&(o=o.add(next))}return t?o:i}; },{"cheerio":21}],2:[function(require,module,exports){ (function (__dirname){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _get=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,r,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_slicedToArray=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_jszip=require("jszip"),_jszip2=_interopRequireDefault(_jszip),_cheerio=require("cheerio"),_cheerio2=_interopRequireDefault(_cheerio);require("./cheerio-fn");var _htmlparser=require("htmlparser2"),normalize=function(e){return e.split("/").filter(function(e){return"."!=e}).reduceRight(function(e,t){return".."==t?e.r++:e.r?e.r--:e.trimed.unshift(t),e},{trimed:[],r:0}).trimed.join("/")},ZipDocument=function(){function e(t,r,n){_classCallCheck(this,e),this.parts=t,this.raw=r,this.props=n,this._shouldReleased=new Map}return _createClass(e,[{key:"normalizePath",value:function(){return normalize.apply(void 0,arguments)}},{key:"getPart",value:function(e){return e=normalize(e),this.parts[e]}},{key:"getDataPart",value:function(e){e=normalize(e);var t=this.parts[e],r=t._data.crc32,n=t.asUint8Array();return n.crc32=t._data.crc32=r,n}},{key:"getDataPartAsUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*/*";e=normalize(e);var r=this.parts[e],n=r._data.crc32;return this._shouldReleased.has(n)||this._shouldReleased.set(n,URL.createObjectURL(new Blob([this.getDataPart(e)],{type:t}))),this._shouldReleased.get(n)}},{key:"getPartCrc32",value:function(e){e=normalize(e);var t=this.parts[e],r=t._data.crc32;return r}},{key:"release",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,o=this._shouldReleased[Symbol.iterator]();!(e=(n=o.next()).done);e=!0){var i=_slicedToArray(n.value,2),a=i[1];URL.revokeObjectURL(a)}}catch(e){t=!0,r=e}finally{try{!e&&o.return&&o.return()}finally{if(t)throw r}}}},{key:"getObjectPart",value:function(e){e=normalize(e);var t=this.parts[e];if(t){if(t.cheerio)return t;var r=Object.assign(this.parts[e]=this.constructor.parseXml(t.asText()),{part:e});return Object.assign(r.root()[0].attribs,{part:e}),r.prototype.part=function(){return e},r}return null}},{key:"$",value:function(e){var t=function e(t){return t.root||t.parent&&e(t.parent)};return this.getObjectPart(t(e).attribs.part)(e)}},{key:"parse",value:function(e){}},{key:"render",value:function(){}},{key:"serialize",value:function(){var e=this,t=new _jszip2.default;return Object.keys(this.parts).forEach(function(r){var n=e.parts[r];n.cheerio?t.file(r,n.xml()):t.file(r,n._data,n.options)}),t}},{key:"save",value:function(e,t){e=e||this.props.name||Date.now()+".docx";var r=this.serialize();if("undefined"!=typeof document&&window.URL&&window.URL.createObjectURL){var n=r.generate(_extends({},t,{type:"blob",mimeType:this.constructor.mime})),o=window.URL.createObjectURL(n),i=document.createElement("a");document.body.appendChild(i),i.download=e,i.href=o,i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(o)}else{var a=function(){var n=r.generate(_extends({},t,{type:"nodebuffer"}));return{v:new Promise(function(t,r){return require("fs").writeFile(e,n,function(e){e?r(e):t(n)})})}}();if("object"===("undefined"==typeof a?"undefined":_typeof(a)))return a.v}}},{key:"clone",value:function(){var e=this,t=new _jszip2.default,r=r?JSON.parse(JSON.stringify(this.props)):r,n=Object.keys(this.parts).reduce(function(r,n){var o=e.parts[n];return o.cheerio?(t.file(o.name,o.xml(),o.options),r[n]=t.file(o.name)):(t.file(o.name,o._data,o.options),r[n]=t.file(o.name)),r},{});return new this.constructor(n,t,r)}}],[{key:"load",value:function(t){var r=this;return t instanceof e?Promise.resolve(t):new Promise(function(e,n){function o(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{!function(){var n=new _jszip2.default(t),i={};n.filter(function(e,t){return i[e]=t}),e(new r(i,n,o))}()}catch(e){n(e)}}if("string"==typeof t)require("fs").readFile(t,function(e,r){e?n(e):r&&o(r,{name:t.split(/[\/\\]/).pop().replace(/\.docx$/i,"")})});else if(t instanceof Blob){var i=new FileReader;i.onload=function(e){o(e.target.result,t.name?{name:t.name.replace(/\.docx$/i,""),lastModified:t.lastModified,size:t.size}:{size:t.size})},i.readAsArrayBuffer(t)}else o(t)})}},{key:"create",value:function(){return this.load(__dirname+"/../templates/blank."+this.ext)}},{key:"parseXml",value:function(e){try{var t={xmlMode:!0,decodeEntities:!1},r=new ContentDomHandler(t);new _htmlparser.Parser(r,t).end(e);var n=_cheerio2.default.load(r.dom,t);return"undefined"==typeof n.cheerio&&(n.cheerio="customized"),n}catch(e){return console.error(e),null}}}]),e}();ZipDocument.ext="unknown",ZipDocument.mime="application/zip",exports.default=ZipDocument;var ContentDomHandler=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"_addDomElement",value:function(e){if("text"!=e.type||"\r"!=e.data[0]&&"\n"!=e.data[0])return _get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"_addDomElement",this).call(this,e)}}]),t}(_htmlparser.DomHandler);module.exports=exports.default; }).call(this,"/lib") },{"./cheerio-fn":1,"cheerio":21,"fs":17,"htmlparser2":75,"jszip":91}],3:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),_document=require("../document"),_document2=_interopRequireDefault(_document),_part=require("./part"),_part2=_interopRequireDefault(_part),_color=require("color"),_color2=_interopRequireDefault(_color),_class=function(e){function t(){_classCallCheck(this,t);var e=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.main=new _part2.default("",e),e.officeDocument=new e.constructor.OfficeDocument(e.main.getRelTarget("officeDocument"),e),e}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e;return(e=this.officeDocument).render.apply(e,arguments)}},{key:"parse",value:function(){var e;return(e=this.officeDocument).parse.apply(e,arguments)}},{key:"dxa2Px",value:function(e){return this.pt2Px(e/20)}},{key:"emu2Px",value:function(e){return this.pt2Px(e/12700)}},{key:"pt2Px",value:function(e){return 96*e/72}},{key:"cm2Px",value:function(e){return this.pt2Px(28.3464567*parseInt(e))}},{key:"asColor",value:function(e,t){if(!e||0==e.length||"auto"==e)return"#000000";e=e.split(" ")[0];var r="#"==e.charAt(0)?e:RGB.test(e)?"#"+e:e;if(t){var n=t.lumMod,o=t.lumOff,u=t.tint,a=t.shade;if(n||o||u){var i=(0,_color2.default)(r);return void 0!=u&&(i=i.lighten(1-u)),void 0!=n&&(i=i.lighten(n)),void 0!=o&&(i=i.darken(o)),void 0!=a&&(i=i.red(i.red()*(1+a)).green(i.green()*(1+a)).blue(i.blue()*(1+a))),(""+i.hex()).replace(/^0x/,"#")}}return r}},{key:"toPx",value:function(e){var t=parseFloat(e),r=String(e).match(RE_LENGTH_UNIT)[1];switch(r){case"cm":return this.cm2Px(t);case"mm":return this.cm2Px(t/10);case"in":return this.pt2Px(72*t);case"pt":return this.pt2Px(t);case"ft":return this.pt2Px(864*t);default:return t}}},{key:"vender",get:function(){"Microsoft"}},{key:"product",get:function(){return"Office 2010"}},{key:"contentTypes",get:function(){return this.getObjectPart("[Content_Types].xml")("Types")}}]),t}(_document2.default);_class.OfficeDocument=_part2.default,exports.default=_class;var RGB=/([a-fA-F0-9]{2}?){3}?/,RE_LENGTH_UNIT=/^([a-zA-Z]+)$/;module.exports=exports.default; },{"../document":2,"./part":9,"color":37}],4:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _document=require("../document"),_document2=_interopRequireDefault(_document),_officeDocument=require("./officeDocument"),_officeDocument2=_interopRequireDefault(_officeDocument),_class=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),t}(_document2.default);_class.ext="docx",_class.mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",_class.OfficeDocument=_officeDocument2.default,exports.default=_class,module.exports=exports.default; },{"../document":3,"./officeDocument":5}],5:[function(require,module,exports){ "use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _objectWithoutProperties(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),_get=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(n)},_officeDocument=require("../officeDocument"),_officeDocument2=_interopRequireDefault(_officeDocument),_drawml=require("../drawml"),_drawml2=_interopRequireDefault(_drawml),_class=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,t),_createClass(e,[{key:"_init",value:function(){_get(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_init",this).call(this),this._assignRel("styles,numbering,settings".split(","));var t=this.styles;this.styles.prototype.basest=function(e){for(var r=this;r.length>0;){if(r.is(e))return t(r);r=t.root().find('w\\:style[w\\:styleId="'+r.children("w\\:basedOn").attr("w:val")+'"]')}return this.not(this)}}},{key:"render",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.identify.bind(this.constructor),r=void 0,n=void 0;return this.styles&&(r=this.renderNode(this.styles("w\\:styles").get(0),t,e)),this.numbering&&(n=this.renderNode(this.numbering("w\\:numbering").get(0),t,e)),this.renderNode(this.content("w\\:document").get(0),t,e,{styles:r,numbering:n})}},{key:"parse",value:function(t){function e(){var e=r.apply(void 0,arguments);return e&&"object"==("undefined"==typeof e?"undefined":_typeof(e))&&(t.emit.apply(t,["*",e].concat(Array.prototype.slice.call(arguments))),t.emit.apply(t,[e.type,e].concat(Array.prototype.slice.call(arguments))),t["on"+e.type]&&t["on"+e.type].apply(t,[e].concat(Array.prototype.slice.call(arguments)))),e}var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.identify.bind(this.constructor),n={},i=t.createElement.bind(t);return this.styles&&(n.styles=this.renderNode(this.styles("w\\:styles").get(0),i,e)),this.numbering&&(n.numbering=this.renderNode(this.numbering("w\\:numbering").get(0),i,e)),n.document=this.renderNode(this.content("w\\:document").get(0),i,e),n}}]),e}(_officeDocument2.default);_class.identities={document:function(t,e){var r=e.content,n=null,i=r("w\\:sectPr").each(function(t,e){var i=r(e).closest("w\\:body>*");e.content=i.prevUntil(n).toArray().reverse(),i.is(e)||e.content.push(i.get(0)),n=i}).toArray();return{type:"document",children:i}},sectPr:function(t,e){var r=function(r){return t.children.filter(function(t){return t.name=="w:"+r+"Reference"}).reduce(function(t,r){return t.set(r.attribs["w:type"],e.getRel(r.attribs["r:id"])),t},new Map)};return{type:"section",children:t.content,headers:r("header"),footers:r("footer"),hasTitlePage:!!t.children.find(function(t){return"w:titlePg"==t.name})}},p:function(t,e){var r=e.content(t),n="p",i={type:n,pr:t.children.find(function(t){var e=t.name;return"w:pPr"==e}),children:t.children.filter(function(t){var e=t.name;return"w:pPr"!=e})},o=r.find("w\\:pPr");if(o.length){var a=o.find("w\\:pStyle").attr("w:val"),c=o.children("w\\:numPr");if(!c.length&&a&&(c=e.styles('w\\:style[w\\:styleId="'+a+'"]').basest(":has(w\\:numPr)").find("w\\:numPr")),c.length&&(i.type="list",i.numId=c.find("w\\:numId").attr("w:val"),i.level=parseInt(c.find("w\\:ilvl").attr("w:val")||0)),a&&a.startsWith("Heading")){var l=e.styles('w\\:style[w\\:styleId="'+a+'"]').basest(":has(w\\:outlineLvl)").find("w\\:outlineLvl").attr("w:val");l&&(i.type="heading",i.outline=parseInt(l)+1)}}return i},r:function(t){return{type:"r",pr:t.children.find(function(t){var e=t.name;return"w:rPr"==e}),children:t.children.filter(function(t){var e=t.name;return"w:rPr"!=e})}},fldChar:function(t){return t.attribs["w:fldCharType"]},inline:function(t,e){var r=e.content(t);return{type:"drawing.inline",children:r.find("a\\:graphic>a\\:graphicData").children().toArray()}},anchor:function(t,e){var r=e.content(t),n=r.find(">a\\:graphic>a\\:graphicData"),i=n.attr("uri").split("/").pop(),o=n.children().toArray();return"wordprocessingGroup"==i&&(o=o[0].children.filter(function(t){return"wpg"!=t.name.split(":")[0]})),{type:"drawing.anchor",children:o}},pic:function(t,e){var r=e.$(t),n=r.props(_extends({},(0,_drawml2.default)(e),{tidy:function(t){var e=t.spPr,r=t.nvPicPr,n=r.cNvPr,i=void 0===n?{}:n,o=r.cNvSpPr,a=void 0===o?{}:o,c=r.nvPr,l=void 0===c?{}:c,u=t.style;u=void 0===u?{}:u;var s=u.lnRef,d=void 0===s?{}:s,f=u.fillRef,p=void 0===f?{}:f,y=u.effectRef,h=void 0===y?{}:y,v=_objectWithoutProperties(t,["spPr","nvPicPr","style"]);return _extends({},d,p,h,e,i,a,l,v)}}));return _extends({},n,{type:"picture"})},wsp:function(t,e){var r="wps\\:txbx",n=e.$(t),i=n.children(r).children("w\\:txbxContent").children().toArray(),o=function(t,e){return t.reduce(function(t,r){return t[r]=e,t},{})},a=n.props(_extends({},(0,_drawml2.default)(e),o("r,t,l,b".split(",").map(function(t){return t+"Ins"}),function(t){return e.doc.emu2Px(t)}),{__filter:":not("+r+")",tidy:function(t){var e=t.cNvSpPr,r=void 0===e?{}:e,n=t.spPr,i=void 0===n?{}:n,o=t.style;o=void 0===o?{}:o;var a=o.lnRef,c=void 0===a?{}:a,l=o.fillRef,u=void 0===l?{}:l,s=o.effectRef,d=void 0===s?{}:s,f=o.fontRef,p=void 0===f?{}:f,y=_objectWithoutProperties(t,["cNvSpPr","spPr","style"]);return _extends({},r,c,u,d,i,{textStyle:p},y)}}));return _extends({},a,{type:"shape",children:i})},Fallback:function(){return null},sdt:function(t,e){var r=e.content(t),n=r.find(">w\\:sdtPr"),i=r.find(">w\\:sdtContent"),o=i.children().toArray(),a=n.find("w\\:dataBinding").get(0);if(a){var c=a.attribs["w:xpath"],l=c.split(/[\/\:\[]/),u=(l.pop(),l.pop()),s=i.text();return{type:"property",name:u,value:s,children:o}}var d=function(){var t=n.get(0).children,a=t[t.length-1],c=a.name.split(":").pop(),l="text,picture,docPartList,docPartObj,comboBox,dropDownList,date,checkbox,repeatingSection,repeatingSectionItem".split(",").find(function(t){return t==c}),u={children:o};switch(l?u.type="control."+l:i.find("w\\:p,w\\:tbl,w\\:tr,w\\:tc").length?u.type="block":u.type="inline",r=e.content,u.type){case"control.dropDownList":case"control.comboBox":var s=function(){var t=r(i).text();return u.options=r(a).find("w\\:listItem").map(function(t,e){return{displayText:e.attribs["w:displayText"],value:e.attribs["w:value"]}}).get(),u.value=(u.options.find(function(e){return e.displayText==t})||{}).value,"break"}();if("break"===s)break;case"control.checkbox":var d=a.name.split(":")[0];u.checked="1"==r(a).find(d+"\\:checked").attr(d+":val");break;case"control.text":0==i.find("w\\:r [w\\:val~=Placeholder]").length&&(u.value=i.text());break;case"control.date":u.value=new Date(r(a).attr("w:fullDate")),u.format=r(a).find("w\\:dateFormat").attr("w:val"),u.locale=r(a).find("w\\:lid").attr("w:val")}return{v:u}}();if("object"===("undefined"==typeof d?"undefined":_typeof(d)))return d.v},hyperlink:function(t,e){if(t.attribs["r:id"]){var r=e.getRel(t.attribs["r:id"]);return{type:"hyperlink",url:r}}if(t.attribs["w:anchor"])return{type:"hyperlink",url:"#"+t.attribs["w:anchor"]}},tbl:function(t){return t.children.reduce(function(t,e){switch(e.name){case"w:tblPr":t.pr=e;break;case"w:tblGrid":t.cols=e.children;break;default:t.children.push(e)}return t},{type:"tbl",children:[],pr:null,cols:[]})},tr:function(t){return t.children.reduce(function(t,e){switch(e.name){case"w:trPr":t.pr=e,t.isHeader=!!e.children.find(function(t){return"w:tblHeader"==t.name});break;default:t.children.push(e)}return t},{type:"tr",children:[],pr:null})},tc:function(t){return t.children.reduce(function(t,e){switch(e.name){case"w:tcPr":t.pr=e;break;default:t.children.push(e)}return t},{type:"tc",children:[],pr:null})},altChunk:function(t,e){var r=t.attribs["r:id"],n=e.getRel(r),i=e.folder+e.rels("[Id="+r+"]").attr("Target"),o=e.doc.contentTypes("Override[PartName='"+i+"']").attr("ContentType");return{type:"chunk",data:n,contentType:o}},docDefaults:function(t){return{type:"style"}},style:function(t){return{type:"style",id:t.attribs["w:styleId"]}},abstractNum:function(t){return{type:"abstractNum",id:t.attribs["w:abstractNumId"]}},num:function(t){return{type:"num",id:t.attribs["w:numId"],abstractNum:t.children.find(function(t){return"w:abstractNumId"==t.name}).attribs["w:val"]}},latentStyles:function(){return null},object:function(t,e){var r=e.content(t).find("o\\:OLEObject"),n=r.attr("ProgID"),i="Embed"===r.attr("Type"),o=r.attr("r:id");return{type:"object",embed:i,prog:n,data:e.getRelOleObject(o)}}},exports.default=_class,module.exports=exports.default; },{"../drawml":6,"../officeDocument":7}],6:[function(require,module,exports){ "use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _objectWithoutProperties(t,r){var e={};for(var n in t)r.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},_part=require("../part"),_part2=_interopRequireDefault(_part);exports.default=function(t){return _extends({__filter:":not(a\\:extLst)",id:function(){}},same("latin,ea,cs".split(","),function(r){var e=r.attribs.typeface,n=void 0===e?"":e;return t.theme.font(n)}),same("lumMod,lumOff,tint,shade".split(","),function(t){var r=t.attribs.val;return parseInt(r)/1e5}),{tidy_schemeClr:function(r){var e=r.val,n=_objectWithoutProperties(r,["val"]);return t.doc.asColor(t.theme.color(e),n)},tidy_srgbClr:function(r){var e=r.val,n=_objectWithoutProperties(r,["val"]);return t.doc.asColor(e,n)},tidy_prstClr:function(r){var e=r.val,n=_objectWithoutProperties(r,["val"]);return t.doc.asColor(e,n)},sysClr:function(t){var r=t.attribs.val;return r},tidy_solidFill:function(t){var r=t.color;return r},rot:function(t){return parseInt(t)/6e4},blip:function(r){var e=r.attribs,n=e["r:embed"],o=e["r:link"];if(o)return{url:o};var i=t.$(r).part();return new _part2.default(i,t.doc).getRel(n)},prstGeom:function(t){return t.attribs.prst},pathLst:function(r){var e=r.children,n=function(r){return t.doc.emu2Px(r)};return e.filter(function(t){return"a:path"==t.name}).reduce(function(t,r){return r.children.filter(function(t){return t.name}).forEach(function(r){switch(r.name.split(":").pop()){case"moveTo":t.push("M "+n(r.children[0].attribs.x)+" "+n(r.children[0].attribs.y));break;case"lnTo":t.push("L "+n(r.children[0].attribs.x)+" "+n(r.children[0].attribs.y));break;case"cubicBezTo":t.push("L "+n(r.children[0].attribs.x)+" "+n(r.children[0].attribs.y)),t.push("Q "+n(r.children[1].attribs.x)+" "+n(r.children[1].attribs.y)+" "+n(r.children[2].attribs.x)+" "+n(r.children[2].attribs.y));break;case"arcTo":t.push("A");break;case"close":t.push("Z")}}),t},[]).join(" ")},tidy_custGeom:function(t){var r=t.pathLst;return r},lvl:function(t){return parseInt(t)},spcPts:function(r){var e=r.attribs.val;return t.doc.pt2Px(parseInt(e)/100)},tidy_spcAft:function(t){var r=t.spcPts;return r},tidy_spcBef:function(t){var r=t.spcPts;return r},buFont:function(r){var e=r.attribs.typeface;return t.theme.font(e)},buChar:function(t){var r=t.attribs.char;return r},buSzPts:function(r){var e=r.attribs.val;return t.doc.pt2Px(parseInt(e)/100)},buSzPct:function(t){var r=t.attribs.val;return parseInt(r)/1e3/100},buAutoNum:function(t){var r=t.attribs;return _extends({},r)},tidy_buClr:function(t){var r=t.color;return r},indent:function(r){return t.doc.emu2Px(r)},marL:function(r){return t.doc.emu2Px(r)},lIns:function(r){return t.doc.emu2Px(r)},rIns:function(r){return t.doc.emu2Px(r)},bIns:function(r){return t.doc.emu2Px(r)},tIns:function(r){return t.doc.emu2Px(r)},ext:function(r){var e=r.attribs,n=e.cx,o=e.cy;return{width:t.doc.emu2Px(n),height:t.doc.emu2Px(o)}},off:function(r){var e=r.attribs,n=e.x,o=e.y;return{x:t.doc.emu2Px(n),y:t.doc.emu2Px(o)}},tidy_xfrm:function(t){var r=t.ext,e=void 0===r?{}:r,n=t.off,o=void 0===n?{}:n,i=_objectWithoutProperties(t,["ext","off"]);return _extends({},e,o,i)}},same("ln,lnB,lnR,lnL,lnT,lnTlToBr,lnBlToTr".split(",").map(function(t){return"tidy_"+t}),function(r){var e=r.w,n=_objectWithoutProperties(r,["w"]);return _extends({},n,{w:e?t.doc.emu2Px(e):void 0})}),same("left,right,top,bottom".split(",").map(function(t){return"tidy_"+t}),function(t){var r=t.ln;return r}),{tidy_tcTxStyle:function(t){var r=t.color,e=_objectWithoutProperties(t,["color"]);return _extends({},e,{solidFill:r})},tidy_lnRef:function(r){var e=r.idx,n=_objectWithoutProperties(r,["idx"]);return t.theme.lnRef(e,n)},tidy_fillRef:function(r){var e=r.idx,n=_objectWithoutProperties(r,["idx"]);return t.theme.fillRef(e,n)},tidy_EffectRef:function(r){var e=r.idx,n=_objectWithoutProperties(r,["idx"]);return t.theme.effectRef(e,n)},tidy_fontRef:function(r){var e=r.idx,n=_objectWithoutProperties(r,["idx"]);return t.theme.fontRef(e,n)},tidy_noAutoFit:function(){},tidy_normAutoFit:function(t){return _extends({type:"font"},t)},tidy_spAutoFit:function(t){return _extends({type:"block"},t)},names:{schemeClr:"color",srgbClr:"color",sysClr:"color",prstClr:"color",prstGeom:"geometry",custGeom:"geometry",lnB:"bottom",lnR:"right",lnL:"left",lnT:"top",rot:"rotate",spAutoFit:"autofit",normAutoFit:"autofit",noAutoFit:"autofit"},inherit:function(){for(var t=arguments.length,r=Array(t),e=0;e<t;e++)r[e]=arguments[e];return r.reduce(function(t,r){var e=r.__filter,n=void 0===e?"":e,o=r.names,i=void 0===o?{}:o,u=_objectWithoutProperties(r,["__filter","names"]),c=t.__filter,a=void 0===c?"":c,s=t.names,f=void 0===s?{}:s,l=_objectWithoutProperties(t,["__filter","names"]);return _extends({},l,u,{__filter:[a,n].filter(function(t){return!!t}).join(","),names:_extends({},f,i)})},this)}})};var same=function(t,r){return t.reduce(function(t,e){return t[e]=r,t},{})};module.exports=exports.default; },{"../part":9}],7:[function(require,module,exports){ "use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _objectWithoutProperties(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,l=t[Symbol.iterator]();!(n=(a=l.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&l.return&&l.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),_get=function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},_part=require("./part"),_part2=_interopRequireDefault(_part),_drawml=require("./drawml"),_drawml2=_interopRequireDefault(_drawml),_class=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,t),_createClass(e,[{key:"_init",value:function(){var t=this;_get(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_init",this).apply(this,arguments),this._assignRel(["theme"]);var r=this.doc,n=function(e){return _extends({},(0,_drawml2.default)(t),{tidy_schemeClr:function(r){var n=r.val,o=_objectWithoutProperties(r,["val"]);return t.doc.asColor("phClr"==n?e.color:t.theme.color(n),o)}})};Object.assign(this.theme,{font:function(t){var e={mn:"minor",mj:"major"},r=t.split(/[+-]/g).filter(function(t){return t}),n=_slicedToArray(r,2),o=n[0],i=n[1];return o&&i?this("a\\:fontScheme>a\\:"+e[o]+"Font>a\\:"+("lt"==i?"latin":i)).attr("typeface"):t},color:function(t){var e=this("a\\:clrScheme>a\\:"+t).children().eq(0);return r.asColor(e.attr("lastClr")||e.attr("val"))},fillRef:function(t,e){return t=parseInt(t),0==t||1e3==t?{}:t>1e3?this("a\\:fmtScheme>a\\:bgFillStyleLst").children().eq(t-1001).props(n(e)):this("a\\:fmtScheme>a\\:fillStyleLst").children().eq(t-1).props(n(e))},lnRef:function(t,e){return this("a\\:fmtScheme>a\\:lnStyleLst").children().eq(parseInt(t)-1).props(n(e))},effectRef:function(t,e){return this("a\\:fmtScheme>a\\:effectStyleLst").children().eq(parseInt(t)-1).children("a\\:effectLst").props(n(e))},fontRef:function(t,e){var r=this("a\\:fmtScheme>a\\:fontScheme>a\\:"+t+"Font"),n=r.children("a\\:latin"),o=r.children("a\\:ea"),i=r.children("a\\:cs");return _extends({latin:n.attr("typeface"),ea:o.attr("typeface"),cs:i.attr("typeface")},e)}})}},{key:"_assignRel",value:function(t){var e=this;this.rels('Relationship[Target$=".xml"]').each(function(r,n){var o=e.rels(n),i=o.attr("Type").split("/").pop();t.indexOf(i)!=-1&&!function(){var t=o.attr("Target");Object.defineProperty(e,i,{configurable:!0,get:function(){return this.getRelObject(t)}})}()})}},{key:"render",value:function(t){arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.identify.bind(this.constructor)}}],[{key:"identify",value:function(t,e){var r=this.identities,n=t.name.split(":").pop();return r[n]?r[n].apply(r,arguments):n}}]),e}(_part2.default);_class.identities={},exports.default=_class,module.exports=exports.default; },{"./drawml":6,"./part":9}],8:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function parse(e){var t=_cfb2.default.parse(e),r=t.find("!ole10Native").content,n=r.slice(0,Math.min(r.length/2,512)).lastIndexOf(0)+1,i=r.indexOf(0,Math.min(n,r.length/2))-1;return new TextDecoder("utf-8").decode(new Uint8Array(r.slice(n,i)))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.parse=parse;var _cfb=require("cfb"),_cfb2=_interopRequireDefault(_cfb); },{"cfb":20}],9:[function(require,module,exports){ "use strict";function _interopRequireWildcard(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function _objectWithoutProperties(t,e){var r={};for(var a in t)e.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a]);return r}function _toConsumableArray(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(e,r,a){return r&&t(e.prototype,r),a&&t(e,a),e}}(),_ole=require("./ole"),OLE=_interopRequireWildcard(_ole),Part=function(){function t(e,r){_classCallCheck(this,t),this.name=e,this.doc=r;var a="",n="_rels/"+e+".rels",i=e.lastIndexOf("/");i!==-1&&(a=e.substring(0,i+1),n=a+"_rels/"+e.substring(i+1)+".rels"),r.parts[n]&&(this.folder=a,this.relName=n,Object.defineProperty(this,"rels",{get:function(){return this.doc.getObjectPart(this.relName)}})),this._init()}return _createClass(t,[{key:"_init",value:function(){Object.defineProperty(this,"content",{configurable:!0,get:function(){return this.doc.getObjectPart(this.name)}})}},{key:"normalizePath",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.startsWith("/")?t.substr(1):this.folder+t}},{key:"getRelPart",value:function(e){var r=this.rels('Relationship[Id="'+e+'"]'),a=r.attr("Target");return new t(this.normalizePath(a),this.doc)}},{key:"getRelTarget",value:function(t){return this.rels('[Type$="'+t+'"]').attr("Target")}},{key:"getRelObject",value:function(t){return this.doc.getObjectPart(this.normalizePath(t))}},{key:"getRel",value:function(t){var e=this.rels('Relationship[Id="'+t+'"]'),r=e.attr("Target");if("External"===e.attr("TargetMode"))return{url:r};switch(e.attr("Type").split("/").pop()){case"image":var a=this.doc.getDataPartAsUrl(this.normalizePath(r),"image/*"),n=this.doc.getPartCrc32(this.normalizePath(r));return{url:a,crc32:n};default:return r.endsWith(".xml")?this.getRelObject(r):this.doc.getPart(this.normalizePath(r))}}},{key:"_nextrId",value:function(){return Math.max.apply(Math,_toConsumableArray(this.rels("Relationship").toArray().map(function(t){return parseInt(t.attribs.Id.substring(3))})))+1}},{key:"add",value:function(t,e,r){var a="rId"+this._nextrId();this.rels("Relationships").append('<Relationship Id="'+a+'" type="'+t+'" target="'+e+'"/>');var n=this.normalizePath(e);return this.doc.raw.file(n,r),this.doc.parts[n]=this.doc.raw.file(n),a}},{key:"addImage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ext:"jpg",mime:"image/jpg"},r=e.ext,a=e.mime,n="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",i="rId"+this._nextrId(),o="media/image"+(Math.max.apply(Math,[0].concat(_toConsumableArray(this.rels("Relationship[Type$='image']").toArray().map(function(t){return parseInt(t.attribs.Target.match(/\d+\./)||[0])}))))+1)+"."+r,s=this.normalizePath(o);this.doc.raw.file(s,t),this.doc.parts[s]=this.doc.raw.file(s),this.rels("Relationships").append('<Relationship Id="'+i+'" Type="'+n+'" Target="'+o+'"/>');var l=this.doc.getObjectPart("[Content_Types].xml")("Types"),h=l.find(">Default[Extension='"+r+"']");return 0==h.length&&l.prepend('<Default Extension="'+r+'" ContentType="'+a+'"/>'),i}},{key:"addExternalImage",value:function(t){var e="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",r="rId"+this._nextrId();return this.rels("Relationships").append('<Relationship Id="'+r+'" Type="'+e+'" TargetMode="External" Target="'+t+'"/>'),r}},{key:"addChunk",value:function(t,e,r,a){e=e||"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk",r=r||this.doc.constructor.mime,a=a||this.doc.constructor.ext;var n=this._nextrId(),i="rId"+n,o="chunk/chunk"+n+"."+a,s=this.normalizePath(o);return this.doc.raw.file(s,t),this.doc.parts[s]=this.doc.raw.file(s),this.rels("Relationships").append('<Relationship Id="'+i+'" Type="'+e+'" Target="'+o+'"/>'),this.doc.contentTypes.append('<Override PartName="/'+s+'" ContentType="'+r+'"/>'),i}},{key:"getRelOleObject",value:function(t){var e=this.rels("Relationship[Id="+t+"]"),r=e.attr("Type"),a=e.attr("Target"),n=this.doc.getDataPart(this.normalizePath(a));switch(r.split("/").pop()){case"oleObject":try{return OLE.parse(n)}catch(t){return n}default:return n}}},{key:"removeRel",value:function(t){var e=this.rels('Relationship[Id="'+t+'"]');if("External"!==e.attr("TargetMode")){var r=this.normalizePath(e.attr("Target"));this.doc.contentTypes.find("[PartName='/"+r+"']").remove(),this.doc.raw.remove(r),delete this.doc.parts[r]}e.remove()}},{key:"renderNode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t,e,r){},r=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t.name.split(":").pop()},n=arguments[3],i=t.name,o=t.children,s=t.id;t.parent;if("text"==t.type)return t.data;var l=i,h={};if(a){var c=a(t,this);if(!c)return null;if("string"==typeof c)l=c;else{var u=void 0,d=c;l=d.type,u=d.children,h=_objectWithoutProperties(d,["type","children"]),void 0!==u&&(o=u)}}h.key=s,h.node=t,h.type=l,n&&Object.assign(h,n);var p=o;return Array.isArray(o)&&o.length&&(p=o.map(function(t){return t?r.renderNode(t,e,a):null}).filter(function(t){return!!t})),e(l,h,p)}},{key:"$",value:function(t){return this.doc.$(t)}}]),t}();exports.default=Part,module.exports=exports.default; },{"./ole":8}],10:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _document=require("../document"),_document2=_interopRequireDefault(_document),_officeDocument=require("./officeDocument"),_officeDocument2=_interopRequireDefault(_officeDocument),_class=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),t}(_document2.default);_class.ext="pptx",_class.mime="application/vnd.openxmlformats-officedocument.presentationml.presentation",_class.OfficeDocument=_officeDocument2.default,exports.default=_class,module.exports=exports.default; },{"../document":3,"./officeDocument":11}],11:[function(require,module,exports){ "use strict";function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _objectWithoutProperties(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_createClass=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),_get=function t(e,r,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,r);if(void 0===o){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,r,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},_officeDocument=require("../officeDocument"),_officeDocument2=_interopRequireDefault(_officeDocument),_part=require("../part"),_part2=_interopRequireDefault(_part),_drawml=require("../drawml"),_drawml2=_interopRequireDefault(_drawml),OfficeDocument=function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return _inherits(e,t),_createClass(e,[{key:"_init",value:function(){_get(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_init",this).call(this),this._assignRel("tableStyles,viewProps,presProps".split(","))}},{key:"render",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.identify.bind(this.constructor);return this.tableStyles&&this.renderNode(this.tableStyles.root().children().get(0),t,e),this.renderNode(this.content("p\\:presentation").get(0),t,e)}},{key:"slide",value:function(t){var e=(t.id,t["r:id"]);return this.getRel(e)}},{key:"master",value:function(t){t.id,t["r:id"];return this.slide.apply(this,arguments)}},{key:"notesMaster",value:function(){return this.slide.apply(this,arguments)}},{key:"handoutMaster",value:function(){return this.slide.apply(this,arguments)}},{key:"masterPartOfLayout",value:function(t){var e=this.$(t).root().get(0),r=e.attribs.part;return this.doc.getRelObject(r)}}]),e}(_officeDocument2.default);OfficeDocument.identities={presentation:function(t,e){var r=e.content("p\\:presentation"),n="p\\:handoutMasterIdLst,p\\:notesMasterIdLst,p\\:sldIdLst,p\\:sldMasterIdLst",o=r.children(n).toArray(),i={"p:sldMasterIdLst":1,"p:sldIdLst":2};o.sort(function(t,e){return(i[t.name]||99)-(i[e.name]||99)});var a=function(t){var r=t.attribs,n=r.cx,o=r.cy;return{width:e.doc.emu2Px(n),height:e.doc.emu2Px(o)}},s=r.props(_extends({},(0,_drawml2.default)(e),{__filter:":not("+n+",a\\:extLst)",sldSz:a,notesSz:a}));return _extends({},s,{type:"document",children:o})},sldMasterId:function(t,e){var r="p\\:sldLayoutIdLst,p\\:cSld",n=e.master(t.attribs),o=n("p\\:sldMaster"),i=o.props(_extends({},(0,_drawml2.default)(e),{__filter:":not("+r+",a\\:extLst)"})),a=o.children(r).toArray(),s={"p:sldLayoutLst":1,"p:cSld":2};return a.sort(function(t,e){return(s[t.name]||99)-(s[e.name]||99)}),_extends({},i,{part:n.part,children:a,type:"slideMaster"})},sldId:function(t,e){var r="p\\:cSld",n=e.slide(t.attribs),o=n("p\\:sld"),i=o.props(_extends({},(0,_drawml2.default)(e),{__filter:":not("+r+",a\\:extLst)"})),a=o.children(r).toArray(),s=e.getRelPart(t.attribs["r:id"]),d=e.doc.normalizePath(s.normalizePath(s.getRelTarget("slideLayout"))),l=new _part2.default(d,e.doc),u=e.doc.normalizePath(l.normalizePath(l.getRelTarget("slideMaster")));return _extends({},i,{part:n.part,layout:d,master:u,children:a,type:"slide"})},notesMasterId:function(t,e){var r=e.notesMaster(t.attribs);return{part:r.part,type:"noteMaster"}},handoutMasterId:function(t,e){var r=e.handoutMaster(t.attribs);return{part:r.part,type:"handoutMaster"}},sldLayoutId:function(t,e){var r="p\\:cSld",n=e.$(t).part(),o=new _part2.default(n,e.doc).getRel(t.attribs["r:id"]),i=o("p\\:sldLayout"),a=i.props({__filter:":not("+r+",a\\:extLst)"}),s=i.children(r).toArray();return _extends({},a,{part:o.part,master:n,children:s,type:"slideLayout"})},spTree:function(t,e){var r=":not(p\\:nvGrpSpPr,p\\:grpSpPr)",n=e.$(t),o=n.children(r).toArray(),i=e.$(t).props(_extends({},(0,_drawml2.default)(e),{__filter:"p\\:nvGrpSpPr,p\\:grpSpPr",tidy:function(t){var e=t.grpSpPr,r=t.nvGrpSpPr,n=r.cNvPr,o=void 0===n?{}:n,i=r.cNvSpPr,a=void 0===i?{}:i,s=r.nvPr,d=void 0===s?{}:s,l=_objectWithoutProperties(t,["grpSpPr","nvGrpSpPr"]);return _extends({},e,o,a,d,l)}}));return _extends({},i,{type:"spTree",children:o})},pic:function(t,e){var r=e.$(t).props(_extends({},(0,_drawml2.default)(e),{tidy:function(t){var e=t.spPr,r=t.nvPicPr,n=r.cNvPr,o=void 0===n?{}:n,i=r.cNvSpPr,a=void 0===i?{}:i,s=r.nvPr,d=void 0===s?{}:s,l=_objectWithoutProperties(t,["spPr","nvPicPr"]);return _extends({},e,o,a,d,l)}}));return _extends({},r,{type:"picture"})},sp:function(t,e){var r="p\\:txBody",n=e.$(t),o=n.children(r).toArray(),i=(0,_drawml2.default)(e),a=_extends({spLocks:"locks",ph:"placeholder"},i.names),s=n.props(_extends({},i,{__filter:":not("+r+",a\\:extLst)",names:a,ph:function(t){var e=t.attribs,r=e.type,n=void 0===r?"body":r,o=e.idx;return{type:n,idx:o}},tidy:function(t){var e=t.spPr,r=t.nvSpPr,n=r.cNvPr,o=void 0===n?{}:n,i=r.cNvSpPr,a=void 0===i?{}:i,s=r.nvPr,d=void 0===s?{}:s;return _extends({},e,o,a,d)}})),d=OfficeDocument.identities.txBody(o[0],e);return _extends({},s,{children:o},d,{type:"shape"})},txBody:function(t,e){var r=e.$(t),n=r.children("a\\:p").toArray(),o=r.props(_extends({},(0,_drawml2.default)(e),{lnSpcReduction:function(t){return parseInt(t)},fontScale:function(t){return parseInt(t)},__filter:":not(a\\:p,a\\:extLst)",tidy:function(t){var e=t.lstStyle,r=void 0===e?{}:e,n=t.bodyPr,o=void 0===n?{}:n,i=_objectWithoutProperties(t,["lstStyle","bodyPr"]);return _extends({},i,o,r)}}));return{textStyle:o,children:n,type:"txBody"}},p:function(t,e){var r=":not(a\\:pPr,a\\:endParaRPr)",n=e.$(t),o=n.children(r).toArray(),i=n.children("a\\:pPr").props((0,_drawml2.default)(e)),a=n.children("a\\:endParaRPr").props((0,_drawml2.default)(e));return{style:_extends({lvl:0},i),defaultStyle:a,children:o,type:"p"}},r:function(t,e){var r=":not(a\\:rPr)",n=e.$(t),o=n.children(r).toArray(),i=n.children("a\\:rPr").props(_extends({},(0,_drawml2.default)(e)));return{style:i,children:o,type:"r"}},chart:function(t,e){return{type:"chart"}},relIds:function(t,e){return{type:"diagram"}},graphicFrame:function(t,e){var r="a\\:graphic",n=e.$(t),o=n.children(r).toArray(),i=n.props(_extends({},(0,_drawml2.default)(e),{__filter:":not("+r+",a\\:extLst)",tidy:function(t){var e=t.spPr,r=t.nvGraphicFramePr,n=r.cNvPr,o=void 0===n?{}:n,i=r.cNvSpPr,a=void 0===i?{}:i,s=r.nvPr,d=void 0===s?{}:s,l=_objectWithoutProperties(t,["spPr","nvGraphicFramePr"]);return _extends({},e,o,a,d,l)}}));return _extends({},i,{children:o,type:"graphicFrame"})},tbl:function(t,e){var r="a\\:tr",n=e.$(t),o=n.children(r).toArray(),i=n.props(_extends({},(0,_drawml2.default)(e),{__filter:":not("+r+", a\\:extLst)",tableStyleId:function(t){var e=t.children;return e.find(function(t){return t.data}).data},tblGrid:function(t){var r=t.children;return r.filter(function(t){return t.name}).reduce(function(t,r){var n=r.attribs.w;retur