物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2780 lines
280 KiB

  1. ;/*!node_modules/office-viewer/lib/node_modules/tslib/tslib.es6.js*/
  2. amis.define("8701f02",(function(t,n,e,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=function(t,n){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},o(t,n)};n.__assign=function(){return n.__assign=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},n.__assign.apply(this,arguments)},n.__awaiter=function(t,n,e,r){return new(e||(e=Promise))((function(o,a){function i(t){try{c(r.next(t))}catch(t){a(t)}}function l(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(i,l)}c((r=r.apply(t,n||[])).next())}))},n.__extends=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)},n.__generator=function(t,n){var e,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(c){return function(l){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(e=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(t,i)}catch(t){l=[6,t],r=0}finally{e=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}},n.__read=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,a=e.call(t),i=[];try{for(;(void 0===n||n-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=a.return)&&e.call(a)}finally{if(o)throw o.error}}return i},n.__spreadArray=function(t,n,e){if(e||2===arguments.length)for(var r,o=0,a=n.length;o<a;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return t.concat(r||Array.prototype.slice.call(n))},n.__values=function(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}}));
  3. ;/*!node_modules/office-viewer/lib/OpenXML.js*/
  4. amis.define("f838841",(function(t,e,r,n){"use strict";function u(t){return t.getAttribute("w:val")||t.getAttribute("w14:val")||""}function i(t,e){if(void 0===e&&(e=!1),"boolean"==typeof t)return t;if("string"==typeof t){switch(t){case"1":case"on":case"true":return!0;case"0":case"off":case"false":return!1}if("number"==typeof t)return 0!==t}return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getAttrBoolean=function(t,e,r){return void 0===r&&(r=!0),i(t.getAttribute(e),r)},e.getAttrNumber=function(t,e,r){void 0===r&&(r=0);var n=t.getAttribute(e);return n?parseInt(n,10):r},e.getAttrPercentage=function(t,e){var r=t.getAttribute(e);return r?r.endsWith("%")?parseInt(r,10)/100:parseInt(r,10)/1e5:1},e.getVal=u,e.getValBoolean=function(t,e){return void 0===e&&(e=!0),i(u(t),e)},e.getValHex=function(t){return parseInt(u(t)||"0",16)},e.getValNumber=function(t){return parseInt(u(t),10)},e.normalizeBoolean=i}));
  5. ;/*!node_modules/office-viewer/lib/openxml/word/Font.js*/
  6. amis.define("8b96ab3",(function(e,a,t,r){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=e("8701f02"),c=e("f838841");var o=function(){function e(){}return e.fromXML=function(a,t){var r,o,s=new e;s.name=t.getAttribute("w:name")||"";try{for(var l=n.__values(t.children),i=l.next();!i.done;i=l.next()){var u=i.value,f=u.tagName;switch(f){case"w:family":s.family=c.getVal(u);break;case"w:altName":s.altName=c.getVal(u);break;case"w:panose1":case"w:charset":case"w:sig":case"w:pitch":break;case"w:embedRegular":case"w:embedBold":case"w:embedItalic":case"w:embedBoldItalic":case"w:embedSystemFonts":case"w:embedTrueTypeFonts":var w=u.getAttribute("r:id")||"",b=u.getAttribute("w:fontKey")||"",d=a.loadFont(w,b);d&&(s.url=d);break;default:console.warn("parse Font: Unknown key",f,u)}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}return s},e}();a.Font=o,a.deobfuscate=function(e,a){for(var t=a.replace(/{|}|-/g,""),r=new Array(16),n=0;n<16;n++)r[16-n-1]=parseInt(t.substr(2*n,2),16);for(n=0;n<32;n++)e[n]=e[n]^r[n%16];return e}}));
  7. ;/*!node_modules/office-viewer/lib/openxml/word/FontTable.js*/
  8. amis.define("23e79ad",(function(e,r,n,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("8701f02"),a=e("8b96ab3"),f=function(){function e(){this.fonts=[]}return e.fromXML=function(r,n){var t,f,u=Array.from(n.getElementsByTagName("w:font")),i=new e;try{for(var l=o.__values(u),s=l.next();!s.done;s=l.next()){var c=s.value,v=a.Font.fromXML(r,c);i.fonts.push(v)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(f=l.return)&&f.call(l)}finally{if(t)throw t.error}}return i},e}();r.FontTable=f}));
  9. ;/*!node_modules/office-viewer/lib/parse/parseRelationship.js*/
  10. amis.define("06bce7a",(function(e,t,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("8701f02");function n(e,t){return{id:e.getAttribute("Id")||"",type:e.getAttribute("Type")||"",target:e.getAttribute("Target")||"",targetMode:e.getAttribute("TargetMode")||"",part:t}}t.parseRelationship=n,t.parseRelationships=function(e,t){var r,a,o={},u=e.getElementsByTagName("Relationship");try{for(var l=i.__values(u),s=l.next();!s.done;s=l.next()){var d=n(s.value,t);o[d.id]=d}}catch(e){r={error:e}}finally{try{s&&!s.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}return o}}));
  11. ;/*!node_modules/office-viewer/lib/openxml/ContentType.js*/
  12. amis.define("fa6ad08",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02");r.parseContentType=function(e){var r,t,a={overrides:[]},i=[].slice.call(e.getElementsByTagName("Override"));try{for(var o=n.__values(i),l=o.next();!l.done;l=o.next()){var u=l.value;a.overrides.push({partName:u.getAttribute("PartName"),contentType:u.getAttribute("ContentType")})}}catch(e){r={error:e}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}return a}}));
  13. ;/*!node_modules/office-viewer/lib/parse/parseSize.js*/
  14. amis.define("b8eb51e",(function(t,n,e,u){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={Dxa:{mul:.066665,unit:"px"},Emu:{mul:1.3333/12700,unit:"px"},FontSize:{mul:.66665,unit:"px"},Border:{mul:.1666625,unit:"px"},Point:{mul:1.3333,unit:"px"},Percent:{mul:.02,unit:"%"},LineHeight:{mul:1/240,unit:""},VmlEmu:{mul:1/12700,unit:""}};function r(t,n){return void 0===n&&(n=i.Dxa),null==t||/.+(p[xt]|[%])$/.test(t)?t:"".concat((parseInt(t)*n.mul).toFixed(2)).concat(n.unit)}n.LengthUsage=i,n.convertAngle=function(t){return t?parseInt(t)/6e4:0},n.convertLength=r,n.parseSize=function(t,n,e){void 0===e&&(e=i.Dxa);var u=t.getAttribute(n);return u?r(String(u),e):""}}));
  15. ;/*!node_modules/office-viewer/lib/parse/parseCellMargin.js*/
  16. amis.define("ddcc71b",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var i=e("8701f02"),n=e("b8eb51e");a.parseCellMargin=function(e,a){var r,t;try{for(var s=i.__values(e.children),c=s.next();!c.done;c=s.next()){var d=c.value;switch(d.tagName){case"w:left":case"w:start":a["padding-left"]=n.parseSize(d,"w:w");break;case"w:right":case"w:end":a["padding-right"]=n.parseSize(d,"w:w");break;case"w:top":a["padding-top"]=n.parseSize(d,"w:w");break;case"w:bottom":a["padding-bottom"]=n.parseSize(d,"w:w")}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}}}));
  17. ;/*!node_modules/office-viewer/lib/parse/parseColor.js*/
  18. amis.define("428d4e6",(function(r,e,t,c){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=r("f838841"),n=["black","blue","green","red","white","yellow"],u={cyan:"#00FFFF",magenta:"#FF00FF",darkBlue:"#00008B",darkCyan:"#008B8B",darkGray:"#A9A9A9",darkGreen:"#006400",darkMagenta:"#800080",darkRed:"#8B0000",darkYellow:"#808000",lightGray:"#D3D3D3",none:"transparent"};function s(r,e,t,c){void 0===t&&(t="w:color"),void 0===c&&(c="black");var a=e.getAttribute(t);if(a)return"auto"==a?c:n.includes(a)?a:a in u?u[a]:"#".concat(a);var s=e.getAttribute("w:themeColor");return s?r.getThemeColor(s):""}function o(r,e){var t=parseInt(r.substring(0,2),16),c=parseInt(r.substring(2,4),16),a=parseInt(r.substring(4,6),16);return"rgba(".concat(t,", ").concat(c,", ").concat(a,", ").concat(e,")")}e.colorNameMap=u,e.cssColors=n,e.parseColor=function(r,e){return s(r,e,"w:val")},e.parseColorAttr=s,e.parseShdColor=function(r,e){var t=e.getAttribute("w:fill")||"",c=a.getVal(e);if("auto"===t&&(t="inherit"),6===t.length)switch(c){case"clear":return"#".concat(t);case"pct10":return o(t,.1);case"pct12":return o(t,.125);case"pct15":return o(t,.15);case"pct20":return o(t,.2);case"pct25":return o(t,.25);case"pct30":return o(t,.3);case"pct35":return o(t,.35);case"pct37":return o(t,.375);case"pct40":return o(t,.4);case"pct45":return o(t,.45);case"pct5":return o(t,.05);case"pct50":return o(t,.5);case"pct55":return o(t,.55);case"pct60":return o(t,.6);case"pct65":return o(t,.65);case"pct70":return o(t,.7);case"pct75":return o(t,.75);case"pct80":return o(t,.8);case"pct85":return o(t,.85);case"pct87":return o(t,.87);case"pct90":return o(t,.9);case"pct95":return o(t,.95);default:return console.warn("unsupport shd val",c),"#".concat(t)}return""}}));
  19. ;/*!node_modules/office-viewer/lib/parse/parseBorder.js*/
  20. amis.define("9c664ef",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("8701f02"),n=e("f838841"),c=e("428d4e6"),s=e("b8eb51e");function i(e,r){var t=n.getVal(r);if("nil"===t||"none"===t)return"none";var a=c.parseColorAttr(e,r),o=s.parseSize(r,"w:sz",s.LengthUsage.Border);return"".concat(o," solid ").concat("auto"==a?"black":a)}r.parseBorder=i,r.parseBorders=function(e,r,t){var a,n;try{for(var c=o.__values(r.children),s=c.next();!s.done;s=c.next()){var l=s.value;switch(l.tagName){case"w:start":case"w:left":t["border-left"]=i(e,l);break;case"w:end":case"w:right":t["border-right"]=i(e,l);break;case"w:top":t["border-top"]=i(e,l);break;case"w:bottom":t["border-bottom"]=i(e,l)}}}catch(e){a={error:e}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(a)throw a.error}}}}));
  21. ;/*!node_modules/office-viewer/lib/parse/parseTextDirection.js*/
  22. amis.define("8bd6045",(function(e,t,r,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseTextDirection=function(e,t){switch(e.getAttribute("w:val")){case"lr":case"lrV":case"btLr":case"lrTb":case"lrTbV":case"tbLrV":t.direction="ltr";break;case"rl":case"rlV":case"tbRl":case"tbRlV":t.direction="rtl"}}}));
  23. ;/*!node_modules/office-viewer/lib/parse/parseTblWidth.js*/
  24. amis.define("e956c2e",(function(e,t,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("b8eb51e");t.parseTblWidth=function(e){var t=e.getAttribute("w:type");return t&&"dxa"!==t?"pct"===t?i.parseSize(e,"w:w",i.LengthUsage.Percent):"auto"===t?"auto":(console.warn("parseTblWidth: ignore type",t,e),""):i.parseSize(e,"w:w")}}));
  25. ;/*!node_modules/office-viewer/lib/parse/parseInsideBorders.js*/
  26. amis.define("31210bc",(function(e,r,i,s){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("9c664ef");r.parseInsideBorders=function(e,r){var i,s,a=r.getElementsByTagName("w:insideH").item(0);a&&(i=t.parseBorder(e,a));var n=r.getElementsByTagName("w:insideV").item(0);return n&&(s=t.parseBorder(e,n)),{H:i,V:s}}}));
  27. ;/*!node_modules/office-viewer/lib/parse/parseTcPr.js*/
  28. amis.define("354b058",(function(e,a,r,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var t=e("8701f02"),n=e("ddcc71b"),i=e("428d4e6"),s=e("f838841"),l=e("9c664ef"),o=e("8bd6045"),d=e("e956c2e"),b=e("31210bc");function p(e,a){switch(s.getVal(e)){case"bottom":a["vertical-align"]="bottom";break;case"center":a["vertical-align"]="middle";break;case"top":a["vertical-align"]="top"}}function g(e,a){var r=d.parseTblWidth(e);r&&(a.width=r)}a.parseTblCellSpacing=function(e,a){var r=d.parseTblWidth(e);r&&(a["cell-spacing"]=r)},a.parseTcPr=function(e,a){var r,c,d={},w={};d.cssStyle=w;try{for(var f=t.__values(a.children),k=f.next();!k.done;k=f.next()){var u=k.value,v=u.tagName;switch(v){case"w:tcMar":n.parseCellMargin(u,w);break;case"w:shd":w["background-color"]=i.parseShdColor(e,u);break;case"w:tcW":g(u,w);break;case"w:noWrap":s.getValBoolean(u)&&(w["white-space"]="nowrap");break;case"w:vAlign":p(u,w);break;case"w:tcBorders":l.parseBorders(e,u,w),d.insideBorder=b.parseInsideBorders(e,u);break;case"w:gridSpan":d.gridSpan=s.getValNumber(u);break;case"w:vMerge":d.vMerge=s.getVal(u)||"continue";break;case"w:textDirection":o.parseTextDirection(u,w);break;case"w:cnfStyle":break;case"w:hideMark":d.hideMark=s.getValBoolean(u,!0);break;default:console.warn("parseTcPr: ignore",v,u)}}}catch(e){r={error:e}}finally{try{k&&!k.done&&(c=f.return)&&c.call(f)}finally{if(r)throw r.error}}return d}}));
  29. ;/*!node_modules/office-viewer/lib/util/color.js*/
  30. amis.define("fb3dae1",(function(t,r,i,n){"use strict";function s(t,r,i){t/=255,r/=255,i/=255;var n,s=Math.max(t,r,i),a=Math.min(t,r,i),e=0,h=(s+a)/2;if(s==a)e=n=0;else{var o=s-a;switch(n=h>.5?o/(2-s-a):o/(s+a),s){case t:e=(r-i)/o+(r<i?6:0);break;case r:e=(i-t)/o+2;break;case i:e=(t-r)/o+4}e/=6}return{h:e,s:n,l:h}}function a(t,r,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(r-t)*i:i<.5?r:i<2/3?t+(r-t)*(2/3-i)*6:t}function e(t,r,i){var n,s,e;if(0==r)n=s=e=i;else{var h=i<.5?i*(1+r):i+r-i*r,o=2*i-h;n=a(o,h,t+1/3),s=a(o,h,t),e=a(o,h,t-1/3)}return{r:255*n,g:255*s,b:255*e}}function h(t){return 1==t.length?"0"+t:""+t}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function t(t){var r=t.match(/^#?([0-9a-f]{6})$/i);r&&(this.r=parseInt(r[1].substring(0,2),16),this.g=parseInt(r[1].substring(2,4),16),this.b=parseInt(r[1].substring(4,6),16),this.isValid=!0)}return t.prototype.lumMod=function(t){var r=s(this.r,this.g,this.b);r.l=r.l*t,r.l=Math.min(1,Math.max(0,r.l));var i=e(r.h,r.s,r.l);this.r=i.r,this.g=i.g,this.b=i.b},t.prototype.lumOff=function(t){var r=s(this.r,this.g,this.b);r.l+=r.l*t,r.l=Math.min(1,Math.max(0,r.l));var i=e(r.h,r.s,r.l);this.r=i.r,this.g=i.g,this.b=i.b},t.prototype.toHex=function(){return"#"+(t=this.r,r=this.g,i=this.b,[h(Math.round(t).toString(16)),h(Math.round(r).toString(16)),h(Math.round(i).toString(16))].join("").toUpperCase());var t,r,i},t}();r.Color=o}));
  31. ;/*!node_modules/office-viewer/lib/parse/parseChildColor.js*/
  32. amis.define("14cd5cc",(function(r,e,a,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("8701f02"),l=r("f838841"),o=r("fb3dae1");function c(r,e){var a,t,c=new o.Color(e);if(c.isValid){try{for(var i=n.__values(r.children),f=i.next();!f.done;f=i.next()){var u=f.value;switch(u.tagName){case"a:lumMod":c.lumMod(l.getAttrPercentage(u,"val"));break;case"a:lumOff":c.lumOff(l.getAttrPercentage(u,"val"))}}}catch(r){a={error:r}}finally{try{f&&!f.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return c.toHex()}return e}function i(r,e){var a,t,c=new o.Color(e);if(c.isValid){try{for(var i=n.__values(r.children),f=i.next();!f.done;f=i.next()){var u=f.value;if("w14:alpha"===u.tagName){var s=l.getVal(u);if(s)return"rgba(".concat(c.r,", ").concat(c.g,", ").concat(c.b,", ").concat(parseInt(s,10)/1e5,")")}}}catch(r){a={error:r}}finally{try{f&&!f.done&&(t=i.return)&&t.call(i)}finally{if(a)throw a.error}}return c.toHex()}return e}e.parseChildColor=function(r,e){var a=e.firstElementChild;if(a){var t=a.tagName;switch(t){case"a:prstClr":return c(a,l.getVal(a)||"");case"a:srgbClr":case"w14:srgbClr":var n=c(a,"#"+l.getVal(a));return n=i(a,n);case"a:schemeClr":var o=a.getAttribute("val")||"";if(o)return c(a,r.getThemeColor(o));default:console.warn("parseOutline: Unknown color type ",t,a)}}return""}}));
  33. ;/*!node_modules/office-viewer/lib/parse/parseInd.js*/
  34. amis.define("16061c9",(function(e,i,t,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("b8eb51e");i.parseInd=function(e,i){var t=r.parseSize(e,"w:firstLine"),n=r.parseSize(e,"w:hanging"),a=r.parseSize(e,"w:left"),s=r.parseSize(e,"w:start"),p=r.parseSize(e,"w:right"),c=r.parseSize(e,"w:end");t&&(i["text-indent"]=t),n&&(i["text-indent"]="-".concat(n)),(a||s)&&(i["margin-left"]=a||s),(p||c)&&(i["margin-right"]=p||c)}}));
  35. ;/*!node_modules/office-viewer/lib/parse/parseSpacing.js*/
  36. amis.define("3446e0a",(function(e,t,i,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=e("b8eb51e");t.parseSpacing=function(e,t,i){var a=r.parseSize(t,"w:before"),n=r.parseSize(t,"w:after"),o=t.getAttribute("w:lineRule");a&&(i["margin-top"]=a),n&&(i["margin-bottom"]=n);var s=t.getAttribute("w:line");if(s){if(e.renderOptions.forceLineHeight)return void(i["line-height"]=e.renderOptions.forceLineHeight);var c=parseInt(s,10),h=e.renderOptions.minLineHeight||1;switch(o){case"auto":var g=Math.max(h,c/240);i["line-height"]="".concat(g.toFixed(2));break;case"atLeast":break;default:var f=Math.max(h,c/20);i["line-height"]=i["min-height"]="".concat(f,"pt")}}}}));
  37. ;/*!node_modules/office-viewer/lib/parse/parseFont.js*/
  38. amis.define("f626135",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=e("8701f02");a.parseFont=function(e,a,r){var t,s,i=[],c=e.renderOptions.fontMapping;try{for(var o=n.__values(a.attributes),f=o.next();!f.done;f=o.next()){var l=f.value,u=l.name,h=l.value;switch(u){case"w:ascii":case"w:cs":case"w:eastAsia":c&&h in c&&(h=c[h]),-1===h.indexOf(" ")?i.push(h):i.push('"'+h+'"');break;case"w:asciiTheme":case"w:csTheme":case"w:eastAsiaTheme":i.push("var(--docx-theme-font-".concat(h,")"))}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(s=o.return)&&s.call(o)}finally{if(t)throw t.error}}i.length&&(r["font-family"]=Array.from(new Set(i)).join(", "))}}));
  39. ;/*!node_modules/office-viewer/lib/parse/parseTrHeight.js*/
  40. amis.define("fabde11",(function(e,t,i,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=e("b8eb51e");t.parseTrHeight=function(e,t){var i=r.parseSize(e,"w:val"),a=e.getAttribute("w:hRule");"exact"===a?t.height=i:"atLeast"===a&&(t.height=i,t["min-height"]=i)}}));
  41. ;/*!node_modules/office-viewer/lib/parse/jcToTextAlign.js*/
  42. amis.define("99eb4a0",(function(e,t,r,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.jcToTextAlign=function(e){switch(e){case"start":case"left":return"left";case"center":return"center";case"end":case"right":return"right";case"both":return"justify"}return e}}));
  43. ;/*!node_modules/office-viewer/lib/parse/parsePr.js*/
  44. amis.define("2807318",(function(e,a,r,s){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var t=e("8701f02"),o=e("b8eb51e"),c=e("f838841"),n=e("9c664ef"),l=e("428d4e6"),i=e("14cd5cc"),w=e("16061c9"),d=e("3446e0a"),p=e("f626135"),b=e("fabde11"),k=e("99eb4a0"),g=e("8bd6045");function u(e,a,r){var s=c.getVal(a);if(null!=s){switch(s){case"dash":case"dashDotDotHeavy":case"dashDotHeavy":case"dashedHeavy":case"dashLong":case"dashLongHeavy":case"dotDash":case"dotDotDash":r["text-decoration-style"]="dashed";break;case"dotted":case"dottedHeavy":r["text-decoration-style"]="dotted";break;case"double":r["text-decoration-style"]="double";break;case"single":case"thick":case"words":r["text-decoration"]="underline";break;case"wave":case"wavyDouble":case"wavyHeavy":r["text-decoration-style"]="wavy";break;case"none":r["text-decoration"]="none"}var t=l.parseColorAttr(e,a);t&&(r["text-decoration-color"]=t)}}function h(e,a){var r,s;try{for(var c=t.__values(e.attributes),n=c.next();!n.done;n=c.next()){var l=n.value,i=l.name,w=l.value;switch(i){case"w:dropCap":"drop"===w&&(a.float="left");break;case"w:h":"object"!=typeof w||Array.isArray(w)||(a.height=o.parseSize(w,"w:h"));break;case"w:w":"object"!=typeof w||Array.isArray(w)||(a.width=o.parseSize(w,"w:w"));break;case"w:hAnchor":case"w:vAnchor":case"w:lines":break;case"w:wrap":"around"!==w&&console.warn("parseFrame: w:wrap not support "+w);break;default:console.warn("parseFrame: unknown attribute "+i,l)}}}catch(e){r={error:e}}finally{try{n&&!n.done&&(s=c.return)&&s.call(c)}finally{if(r)throw r.error}}}function v(e,a){switch(e){case"dot":case"underDot":a["text-emphasis"]="filled",a["text-emphasis-position"]="under right";break;case"comma":a["text-emphasis"]="filled sesame";break;case"circle":a["text-emphasis"]="open"}}a.parsePr=function(e,a,r){var s,x,f={};try{for(var y=t.__values(a.children),m=y.next();!m.done;m=y.next()){var A=m.value,S=A.tagName;switch(S){case"w:sz":case"w:szCs":f["font-size"]=o.parseSize(A,"w:val",o.LengthUsage.FontSize);break;case"w:jc":f["text-align"]=k.jcToTextAlign(c.getVal(A));break;case"w:framePr":h(A,f);break;case"w:pBdr":n.parseBorders(e,A,f);break;case"w:ind":w.parseInd(A,f);break;case"w:color":f.color=l.parseColor(e,A);break;case"w:shd":"background-color"in f||(f["background-color"]=l.parseShdColor(e,A));break;case"w:spacing":d.parseSpacing(e,A,f);break;case"w:highlight":f["background-color"]=l.parseColorAttr(e,A,"w:val","yellow");break;case"w:vertAlign":var V=c.getVal(A);"superscript"===V?f["vertical-align"]="super":"subscript"===V&&(f["vertical-align"]="sub");break;case"w:position":f["vertical-align"]=o.parseSize(A,"w:val",o.LengthUsage.FontSize);break;case"w:trHeight":b.parseTrHeight(A,f);break;case"w:strike":case"w:dstrike":f["text-decoration"]=c.getValBoolean(A)?"line-through":"none";break;case"w:b":f["font-weight"]=c.getValBoolean(A)?"bold":"normal";break;case"w:adjustRightInd":case"w:bCs":case"w:iCs":case"w:kern":case"w:pStyle":case"w:lang":case"w:noProof":case"w:keepLines":case"w:keepNext":case"w:widowControl":case"w:pageBreakBefore":case"w:outlineLvl":case"w:contextualSpacing":case"w:numPr":case"w:rPr":case"w:rStyle":case"w:tabs":case"w:snapToGrid":case"w:cnfStyle":case"w:autoSpaceDE":case"w:autoSpaceDN":case"w:kinsoku":case"w:overflowPunct":break;case"w:i":f["font-style"]=c.getValBoolean(A)?"italic":"normal";break;case"w:caps":f["text-transform"]=c.getValBoolean(A)?"uppercase":"normal";break;case"w:smallCaps":f["text-transform"]=c.getValBoolean(A)?"lowercase":"normal";break;case"w:u":u(e,A,f);break;case"w:rFonts":p.parseFont(e,A,f);break;case"w:tblCellSpacing":f["border-spacing"]=o.parseSize(A,"w:w"),f["border-collapse"]="separate";break;case"w:bdr":f.border=n.parseBorder(e,A);break;case"w:vanish":c.getValBoolean(A)&&(f.display="none");break;case"w:webHidden":f.display="none";break;case"w:wordWrap":c.getValBoolean(A)&&(f["word-break"]="break-all");break;case"w:textAlignment":var B=c.getVal(A);"center"===B?f["vertical-align"]="middle":"auto"!==B&&(f["vertical-align"]=B);break;case"w:textDirection":g.parseTextDirection(A,f);break;case"w:bidi":c
  45. ;/*!node_modules/office-viewer/lib/openxml/word/Bookmark.js*/
  46. amis.define("fb3f8dd",(function(n,e,t,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function n(n){this.name=n}return n.fromXML=function(e,t){var o=t.getAttribute("w:name");return o?new n(o):(console.warn("Bookmark without name"),new n("unknown"))},n}();e.BookmarkStart=r}));
  47. ;/*!node_modules/office-viewer/lib/openxml/word/Break.js*/
  48. amis.define("1f15f0a",(function(e,n,t,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(){this.type="textWrapping"}return e.fromXML=function(n,t){return new e},e}();n.Break=i}));
  49. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/Blip.js*/
  50. amis.define("f08c035",(function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(){}return e.fromXML=function(t,n){var r=new e,u=n.getAttribute("r:embed")||"",i=t.getDocumentRels(u);return i&&(r.embled=i,r.src=t.loadImage(r.embled)),r},e}();t.Blip=u}));
  51. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/BlipFill.js*/
  52. amis.define("a2824a7",(function(e,i,n,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=e("f08c035"),r=function(){function e(){}return e.fromXML=function(i,n){var t=new e,r=null==n?void 0:n.getElementsByTagName("a:blip").item(0);return r&&(t.blip=l.Blip.fromXML(i,r)),t},e}();i.BlipFill=r}));
  53. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/Transform.js*/
  54. amis.define("a23c450",(function(e,t,a,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=e("b8eb51e"),i=function(){function e(){}return e.fromXML=function(t,a){var n=new e,i=a.getElementsByTagName("a:off").item(0);i&&(n.off={x:r.parseSize(i,"x",r.LengthUsage.Emu),y:r.parseSize(i,"y",r.LengthUsage.Emu)});var s=a.getElementsByTagName("a:ext").item(0);s&&(n.ext={cx:r.parseSize(s,"cx",r.LengthUsage.Emu),cy:r.parseSize(s,"cy",r.LengthUsage.Emu)});var g=a.getAttribute("rot");return g&&(n.rot=r.convertAngle(g)),n},e}();t.Transform=i}));
  55. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/Geom.js*/
  56. amis.define("ce016ed",(function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(){}return e.fromXML=function(t,n,r){var u=new e;return u.type=n.getAttribute("prst"),u},e}();t.Geom=u}));
  57. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/ShapeProperties.js*/
  58. amis.define("680b62d",(function(e,a,r,o){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var s=e("8701f02"),t=e("a23c450"),n=e("b8eb51e"),l=e("ce016ed"),c=e("14cd5cc");function d(e){var a="solid";switch(e){case"dash":case"dashDot":case"lgDash":case"lgDashDot":case"lgDashDotDot":case"sysDash":case"sysDashDot":case"sysDashDotDot":a="dashed";break;case"dot":case"sysDot":a="dotted"}return a}function i(e,a,r){var o,t,l=n.parseSize(a,"w",n.LengthUsage.Emu);r["border-width"]=l,r["border-style"]="solid";try{for(var i=s.__values(a.children),f=i.next();!f.done;f=i.next()){var u=f.value,h=u.tagName;switch(h){case"a:solidFill":r["border-color"]=c.parseChildColor(e,u);break;case"a:noFill":r.border="none";break;case"a:round":r["border-radius"]="8%";break;case"a:prstDash":r["border-style"]=d(u.getAttribute("val"));break;default:console.warn("parseOutline: Unknown tag ",h,u)}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}}var f=function(){function e(){}return e.fromXML=function(a,r){var o,n,d=new e,f={};if(d.style=f,r)try{for(var u=s.__values(r.children),h=u.next();!h.done;h=u.next()){var b=h.value,y=b.tagName;switch(y){case"a:xfrm":d.xfrm=t.Transform.fromXML(a,b);break;case"a:prstGeom":d.prstGeom=l.Geom.fromXML(a,b,f);break;case"a:ln":i(a,b,f);break;case"a:noFill":break;case"a:solidFill":f["background-color"]=c.parseChildColor(a,b);break;default:console.warn("ShapePr: Unknown tag ",y,b)}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return d},e}();a.ShapePr=f}));
  59. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/Pic.js*/
  60. amis.define("83a0146",(function(e,i,l,n){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=e("a2824a7"),r=e("680b62d"),a=function(){function e(){}return e.fromXML=function(i,l){var n=new e;return n.blipFill=t.BlipFill.fromXML(i,null==l?void 0:l.getElementsByTagName("pic:blipFill").item(0)),n.spPr=r.ShapePr.fromXML(i,null==l?void 0:l.getElementsByTagName("pic:spPr").item(0)),n},e}();i.Pic=a}));
  61. ;/*!node_modules/office-viewer/lib/openxml/word/Table.js*/
  62. amis.define("1f7df3d",(function(e,t,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){this.properties={},this.tblGrid=[],this.trs=[]};t.Table=r}));
  63. ;/*!node_modules/office-viewer/lib/openxml/word/table/Tr.js*/
  64. amis.define("7bdd7d2",(function(e,t,i,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){this.properties={},this.tcs=[]};t.Tr=r}));
  65. ;/*!node_modules/office-viewer/lib/openxml/word/table/Tc.js*/
  66. amis.define("c52967e",(function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.properties={},this.children=[]}return e.prototype.add=function(e){e&&this.children.push(e)},e}();t.Tc=r}));
  67. ;/*!node_modules/office-viewer/lib/parse/parseTc.js*/
  68. amis.define("5e4f6e1",(function(e,r,a,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8701f02"),i=e("c52967e"),o=e("354b058"),p=e("3e37c25"),s=e("dc5cbe5");r.parseTc=function(e,r,a,n){var c,d,l=new i.Tc;try{for(var f=t.__values(r.children),u=f.next();!u.done;u=f.next()){var v=u.value;switch(v.tagName){case"w:tcPr":l.properties=o.parseTcPr(e,v);break;case"w:p":l.add(p.Paragraph.fromXML(e,v));break;case"w:tbl":l.add(s.parseTable(e,v))}}}catch(e){c={error:e}}finally{try{u&&!u.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}var w=n[a.index];if(l.properties.vMerge){if("restart"===l.properties.vMerge)l.properties.rowSpan=1,n[a.index]=l;else if(w){if(w.properties&&w.properties.rowSpan){w.properties.rowSpan=w.properties.rowSpan+1;var b=l.properties.gridSpan||1;return a.index+=b,null}console.warn("Tc.fromXML: continue but not found lastCol",a.index,l,n)}}else delete n[a.index];var x=l.properties.gridSpan||1;return a.index+=x,l}}));
  69. ;/*!node_modules/office-viewer/lib/parse/parseTablePr.js*/
  70. amis.define("014c576",(function(e,a,t,r){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var l=e("8701f02"),o=e("f838841"),n=e("9c664ef"),s=e("31210bc"),c=e("e956c2e"),i=e("428d4e6"),b=e("b8eb51e"),d=e("354b058"),w=e("ddcc71b");function f(e,a){switch(o.getVal(e)){case"left":case"start":break;case"right":case"end":a.float="right"}}function u(e,a){var t=c.parseTblWidth(e);t&&(a["margin-left"]=t)}function p(e,a){var t=c.parseTblWidth(e);t&&(a.width=t)}function g(e){var a={},t=o.getValHex(e);return(o.getAttrBoolean(e,"firstRow",!1)||32&t)&&(a.firstRow=!0),(o.getAttrBoolean(e,"lastRow",!1)||64&t)&&(a.lastRow=!0),(o.getAttrBoolean(e,"firstColumn",!1)||128&t)&&(a.firstColumn=!0),(o.getAttrBoolean(e,"lastColumn",!1)||256&t)&&(a.lastColumn=!0),o.getAttrBoolean(e,"noHBand",!1)||512&t?a.noHBand=!0:a.noHBand=!1,o.getAttrBoolean(e,"noVBand",!1)||1024&t?a.noVBand=!0:a.noVBand=!1,a}function B(e,a,t){if(void 0===e.renderOptions.padding){var r=b.parseSize(a,"w:tblpX"),l=b.parseSize(a,"w:tblpY");t.top=l,t.left=r}}function k(e,a){"fixed"===e.getAttribute("w:type")&&(a["table-layout"]="fixed")}a.parseTablePr=function(e,a){var t,r,c={},b={},S={};c.tblLook={},c.cssStyle=b,c.tcCSSStyle=S;try{for(var y=l.__values(a.children),C=y.next();!C.done;C=y.next()){var h=C.value,v=h.tagName;switch(v){case"w:tblBorders":n.parseBorders(e,h,b),c.insideBorder=s.parseInsideBorders(e,h);break;case"w:tcBorders":n.parseBorders(e,h,b);break;case"w:tblInd":u(h,b);break;case"w:jc":f(h,b);break;case"w:tblCellMar":case"w:tcMar":w.parseCellMargin(h,S);break;case"w:tblStyle":c.pStyle=o.getVal(h);break;case"w:tblW":p(h,b);break;case"w:shd":b["background-color"]=i.parseShdColor(e,h);break;case"w:tblCaption":c.tblCaption=o.getVal(h);break;case"w:tblCellSpacing":d.parseTblCellSpacing(h,b);break;case"w:tblLayout":k(h,b);break;case"w:tblLook":c.tblLook=g(h);break;case"w:tblStyleRowBandSize":c.rowBandSize=o.getValNumber(h);break;case"w:tblStyleColBandSize":c.colBandSize=o.getValNumber(h);break;case"w:tblpPr":B(e,h,b);break;default:console.warn("parseTableProperties unknown tag",v,h)}}}catch(e){t={error:e}}finally{try{C&&!C.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}return c}}));
  71. ;/*!node_modules/office-viewer/lib/parse/parseTrPr.js*/
  72. amis.define("715786c",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var l=e("8701f02"),n=e("f838841"),c=e("99eb4a0"),s=e("014c576"),i=e("354b058"),o=e("fabde11");a.parseTrPr=function(e,a){var r,t,b={},f={};try{for(var d=l.__values(a.children),g=d.next();!g.done;g=d.next()){var w=g.value,u=w.tagName;switch(u){case"w:hidden":n.getValBoolean(w)&&(b.display="none");break;case"w:trHeight":o.parseTrHeight(w,b);break;case"w:jc":b["text-align"]=c.jcToTextAlign(n.getVal(w));break;case"w:cantSplit":case"w:cnfStyle":break;case"w:tblPrEx":var p=s.parseTablePr(e,w);Object.assign(b,p.cssStyle);break;case"w:tblCellSpacing":i.parseTblCellSpacing(w,f);break;default:console.warn("Tr: Unknown tag ",u,w)}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(t=d.return)&&t.call(d)}finally{if(r)throw r.error}}return{cssStyle:b}}}));
  73. ;/*!node_modules/office-viewer/lib/parse/parseSdt.js*/
  74. amis.define("9876859",(function(e,t,a,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=e("8701f02");t.parseSdt=function(e,t){var a=e.getElementsByTagName("w:sdtContent").item(0);a&&t.push.apply(t,n.__spreadArray([],n.__read([].slice.call(a.children)),!1))}}));
  75. ;/*!node_modules/office-viewer/lib/parse/parseTr.js*/
  76. amis.define("30f28f5",(function(e,r,a,s){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8701f02"),c=e("7bdd7d2"),l=e("5e4f6e1"),n=e("014c576"),i=e("715786c"),d=e("9876859");r.parseTr=function(e,r,a){var s,o,p=new c.Tr,f={index:0},u=[].slice.call(r.children);try{for(var b=t.__values(u),w=b.next();!w.done;w=b.next()){var v=w.value,y=v.tagName;switch(y){case"w:tc":var _=l.parseTc(e,v,f,a);_&&p.tcs.push(_);break;case"w:trPr":p.properties=i.parseTrPr(e,v);break;case"w:tblPrEx":var h=n.parseTablePr(e,v);Object.assign(p.properties.cssStyle||{},h.cssStyle);break;case"w:customXml":u.push.apply(u,t.__spreadArray([],t.__read([].slice.call(v.children)),!1));break;case"w:sdt":d.parseSdt(v,u);break;default:console.warn("Tr: Unknown tag ",y,v)}}}catch(e){s={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(s)throw s.error}}return p}}));
  77. ;/*!node_modules/office-viewer/lib/parse/parseTable.js*/
  78. amis.define("dc5cbe5",(function(e,r,a,l){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8701f02"),n=e("1f7df3d"),c=e("30f28f5"),s=e("014c576"),i=e("b8eb51e"),o=e("9876859");function d(e){var r,a,l=[],n=e.getElementsByTagName("w:gridCol");try{for(var c=t.__values(n),s=c.next();!s.done;s=c.next()){var o=s.value,d=i.parseSize(o,"w:w");l.push({w:d})}}catch(e){r={error:e}}finally{try{s&&!s.done&&(a=c.return)&&a.call(c)}finally{if(r)throw r.error}}return l}r.parseTable=function(e,r){var a,l,i=new n.Table,f={},u=[].slice.call(r.children);try{for(var b=t.__values(r.children),w=b.next();!w.done;w=b.next()){var p=w.value,v=p.tagName;switch(v){case"w:tblPr":i.properties=s.parseTablePr(e,p);break;case"w:tr":i.trs.push(c.parseTr(e,p,f));break;case"w:tblGrid":i.tblGrid=d(p);break;case"w:customXml":u.push.apply(u,t.__spreadArray([],t.__read([].slice.call(p.children)),!1));break;case"w:sdt":o.parseSdt(p,u);break;default:console.warn("Table.fromXML unknown tag",v,p)}}}catch(e){a={error:e}}finally{try{w&&!w.done&&(l=b.return)&&l.call(b)}finally{if(a)throw a.error}}return i}}));
  79. ;/*!node_modules/office-viewer/lib/openxml/word/wps/WPS.js*/
  80. amis.define("a12f91f",(function(e,r,a,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02"),o=e("3e37c25"),l=e("680b62d"),c=e("dc5cbe5"),i=e("b8eb51e"),s=e("14cd5cc");function f(e,r){var a,t;try{for(var o=n.__values(e.attributes),l=o.next();!l.done;l=o.next()){var c=l.value,s=c.name,f=c.value;switch(s){case"numCol":r["column-count"]=f;break;case"vert":switch(f){case"vert":r["writing-mode"]="vertical-rl",r["text-orientation"]="sideways";break;case"vert270":case"eaVert":r["writing-mode"]="vertical-rl",r["text-orientation"]="mixed"}break;case"rot":var u=i.convertAngle(f);u&&(r.transform="rotate(".concat(u,"deg)"))}}}catch(e){a={error:e}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}}function u(e,r,a){var t,o;try{for(var l=n.__values(r.children),c=l.next();!c.done;c=l.next()){var i=c.value;if("a:fillRef"===i.tagName)a["background-color"]=s.parseChildColor(e,i)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(t)throw t.error}}}var v=function(){function e(){this.style={}}return e.fromXML=function(r,a){var t,i,s,v,d=new e;d.txbxContent=[];try{for(var b=n.__values(a.children),w=b.next();!w.done;w=b.next()){var y=w.value,h=y.tagName;switch(h){case"wps:cNvSpPr":break;case"wps:spPr":d.spPr=l.ShapePr.fromXML(r,y);break;case"wps:txbx":var x=y.firstElementChild;if(x)try{for(var p=(s=void 0,n.__values(x.children)),m=p.next();!m.done;m=p.next()){var k=m.value;switch(k.tagName){case"w:p":d.txbxContent.push(o.Paragraph.fromXML(r,k));break;case"w:tbl":d.txbxContent.push(c.parseTable(r,k))}}}catch(e){s={error:e}}finally{try{m&&!m.done&&(v=p.return)&&v.call(p)}finally{if(s)throw s.error}}else console.warn("unknown wps:txbx",y);break;case"wps:style":u(r,y,d.style);break;case"wps:bodyPr":f(y,d.style);break;default:console.warn("WPS: Unknown tag ",h,y)}}}catch(e){t={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(t)throw t.error}}return d},e}();r.WPS=v}));
  81. ;/*!node_modules/office-viewer/lib/openxml/word/drawing/Drawing.js*/
  82. amis.define("dc63411",(function(e,t,a,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=e("8701f02"),o=e("b8eb51e"),s=e("f838841"),p=e("83a0146"),l=e("a12f91f");t.Position=void 0,(n=t.Position||(t.Position={})).inline="inline",n.anchor="anchor";var c=function(){function e(){this.position=t.Position.inline}return e.fromXML=function(a,i){var n,c,u,h=new e,f={};h.containerStyle=f;var g=i.firstElementChild;if(g){if("wp:anchor"===g.tagName){h.position=t.Position.anchor,h.anchor=function(e){return{simplePos:s.getAttrBoolean(e,"simplePos",!1),hidden:s.getAttrBoolean(e,"hidden",!1),behindDoc:s.getAttrBoolean(e,"behindDoc",!1)}}(g);var m=s.getAttrNumber(g,"relativeHeight",1);f["z-index"]=m}try{for(var w=r.__values(g.children),d=w.next();!d.done;d=w.next()){var v=d.value,b=v.tagName;switch(b){case"wp:simplePos":(null===(u=h.anchor)||void 0===u?void 0:u.simplePos)&&(f.position="absolute",f.x=o.parseSize(v,"x",o.LengthUsage.Emu),f.y=o.parseSize(v,"y",o.LengthUsage.Emu));break;case"wp:positionH":var P=v.getAttribute("relativeFrom");if("column"===P||"page"===P){if(L=v.firstElementChild)"wp:posOffset"===(E=L.tagName)?(f.position="absolute",f.left=o.convertLength(L.innerHTML,o.LengthUsage.Emu)):console.warn("unsupport positionType",E)}else console.warn("unsupport relativeFrom",P);break;case"wp:positionV":var L,E,y=v.getAttribute("relativeFrom");if("paragraph"===y||"page"===y){if("paragraph"===y&&(h.relativeFromParagraph=!0),L=v.firstElementChild)"wp:posOffset"===(E=L.tagName)?(f.position="absolute",f.top=o.convertLength(L.innerHTML,o.LengthUsage.Emu)):console.warn("unsupport positionType",E)}else console.warn("unsupport relativeFrom",y);break;case"wp:docPr":case"wp:cNvGraphicFramePr":case"wp:effectExtent":case"wp:wrapNone":case"wp14:sizeRelH":case"wp14:sizeRelV":break;case"a:graphic":var k=v.firstElementChild,x=null==k?void 0:k.firstElementChild;if(x)switch(x.tagName){case"pic:pic":h.pic=p.Pic.fromXML(a,x);break;case"wps:wsp":h.wps=l.WPS.fromXML(a,x);break;default:console.warn("unknown graphicData child tag",x)}break;case"wp:extent":f.width=o.parseSize(v,"cx",o.LengthUsage.Emu),f.height=o.parseSize(v,"cy",o.LengthUsage.Emu);break;default:console.warn("drawing unknown tag",b)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(c=w.return)&&c.call(w)}finally{if(n)throw n.error}}}return h},e}();t.Drawing=c}));
  83. ;/*!node_modules/office-viewer/lib/openxml/word/InstrText.js*/
  84. amis.define("da0e9b2",(function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){this.text=e};t.InstrText=s}));
  85. ;/*!node_modules/office-viewer/lib/openxml/word/NoBreakHyphen.js*/
  86. amis.define("db15eab",(function(e,n,i,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=function(){};n.NoBreakHyphen=a}));
  87. ;/*!node_modules/office-viewer/lib/openxml/word/Pict.js*/
  88. amis.define("ac43ed0",(function(e,t,n,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.fromXML=function(t,n){var i=new e,r=n.getElementsByTagName("v:imagedata").item(0);if(r){var a=r.getAttribute("r:id")||"",u=t.getDocumentRels(a);u&&(i.src=t.loadImage(u))}return i},e}();t.Pict=r}));
  89. ;/*!node_modules/office-viewer/lib/openxml/word/Ruby.js*/
  90. amis.define("4b98400",(function(r,e,n,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=r("8701f02"),o=r("1050750"),u=function(){function r(){}return r.fromXML=function(e,n){var a,u,l=new r;l.children=[];try{for(var c=t.__values(n.children),f=c.next();!f.done;f=c.next()){var i=f.value,s=i.tagName;if("w:r"===s){var y=o.Run.fromXML(e,i);y&&l.children.push(y)}else console.warn("parse Ruby: Unknown key",s,i)}}catch(r){a={error:r}}finally{try{f&&!f.done&&(u=c.return)&&u.call(c)}finally{if(a)throw a.error}}return l},r}();!function(r){function e(){return null!==r&&r.apply(this,arguments)||this}t.__extends(e,r)}(u);var l=function(){function r(){}return r.fromXML=function(e,n){var a,o,l=new r;try{for(var c=t.__values(n.children),f=c.next();!f.done;f=c.next()){var i=f.value,s=i.tagName;switch(s){case"w:rubyPr":break;case"w:rt":l.rt=u.fromXML(e,i);break;case"w:rubyBase":l.rubyBase=u.fromXML(e,i);break;default:console.warn("parse Ruby: Unknown key",s,i)}}}catch(r){a={error:r}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(a)throw a.error}}return l},r}();e.Ruby=l}));
  91. ;/*!node_modules/office-viewer/lib/openxml/word/SoftHyphen.js*/
  92. amis.define("6cc74f5",(function(e,n,t,c){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var f=function(){};n.SoftHyphen=f}));
  93. ;/*!node_modules/office-viewer/lib/openxml/word/Sym.js*/
  94. amis.define("cca189c",(function(t,e,n,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var c=function(){function t(){}return t.parseXML=function(e){var n=new t;return n.font=e.getAttribute("w:font")||"",n.char=e.getAttribute("w:char")||"",n},t}();e.Sym=c}));
  95. ;/*!node_modules/office-viewer/lib/openxml/word/Tab.js*/
  96. amis.define("5cc64d3",(function(e,t,r,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("f838841"),u=e("b8eb51e"),a=function(){function e(){}return e.fromXML=function(t,r){var n=new e;return n.pos=u.parseSize(r,"w:pos"),n.type=i.getVal(r),n.leader=r.getAttribute("w:leader"),n},e}();t.Tab=a}));
  97. ;/*!node_modules/office-viewer/lib/openxml/word/Run.js*/
  98. amis.define("1050750",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=e("8701f02"),d=e("f838841"),i=e("2807318"),c=e("1f15f0a"),s=e("dc63411"),l=e("da0e9b2"),o=e("db15eab"),f=e("ac43ed0"),h=e("4b98400"),w=e("6cc74f5"),b=e("cca189c"),u=e("5cc64d3"),p=function(e){this.preserveSpace=!1,this.text=String(e)},y=function(){function e(){this.properties={},this.children=[]}return e.prototype.addChild=function(e){e&&this.children.push(e)},e.parseRunPr=function(e,a){var r,t=i.parsePr(e,a),n=a.getElementsByTagName("w:rStyle").item(0);return n&&(r=d.getVal(n)),{cssStyle:t,rStyle:r}},e.fromXML=function(a,r){var t,d,i=new e;try{for(var y=n.__values(r.children),k=y.next();!k.done;k=y.next()){var m=k.value,C=m.tagName;switch(C){case"w:t":var g=m.textContent||"",v=new p(g);i.addChild(v);break;case"w:rPr":i.properties=e.parseRunPr(a,m);break;case"w:br":case"w:cr":i.addChild(c.Break.fromXML(a,m));break;case"w:drawing":i.addChild(s.Drawing.fromXML(a,m));break;case"w:tab":i.addChild(u.Tab.fromXML(a,m));break;case"w:fldChar":i.fldChar=m.getAttribute("w:fldCharType");break;case"w:instrText":i.addChild(new l.InstrText(m.textContent||""));break;case"w:lastRenderedPageBreak":break;case"w:pict":i.addChild(f.Pict.fromXML(a,m));break;case"w:ruby":i.addChild(h.Ruby.fromXML(a,m));break;case"w:sym":i.addChild(b.Sym.parseXML(m));break;case"mc:AlternateContent":var M=m.getElementsByTagName("w:drawing").item(0);M&&i.addChild(s.Drawing.fromXML(a,M));break;case"w:softHyphen":i.addChild(new w.SoftHyphen);break;case"w:noBreakHyphen":i.addChild(new o.NoBreakHyphen);break;default:console.warn("parse Run: Unknown key",C,m)}}}catch(e){t={error:e}}finally{try{k&&!k.done&&(d=y.return)&&d.call(y)}finally{if(t)throw t.error}}return i},e}();a.Run=y,a.Text=p}));
  99. ;/*!node_modules/office-viewer/lib/openxml/word/Hyperlink.js*/
  100. amis.define("7d2ef84",(function(e,r,t,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("8701f02"),o=e("1050750"),a=function(){function e(){this.children=[]}return e.prototype.addChild=function(e){this.children.push(e)},e.fromXML=function(r,t){var n,a,l=new e,u=t.getAttribute("r:id");if(u){var c=r.getDocumentRels(u);c&&(l.relation=c)}var f=t.getAttribute("w:anchor");f&&(l.anchor=f);var d=t.getAttribute("w:tooltip");d&&(l.tooltip=d);try{for(var h=i.__values(t.children),s=h.next();!s.done;s=h.next()){var v=s.value,p=v.tagName;if("w:r"===p)l.addChild(o.Run.fromXML(r,v));else console.warn("parse Hyperlink: Unknown key",p,v)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}return l},e}();r.Hyperlink=a}));
  101. ;/*!node_modules/office-viewer/lib/openxml/word/numbering/NumberProperties.js*/
  102. amis.define("452b003",(function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("f838841"),u=function(){function e(){}return e.fromXML=function(t,n){var r=new e,u=n.getElementsByTagName("w:ilvl").item(0);u&&(r.ilvl=i.getVal(u));var a=n.getElementsByTagName("w:numId").item(0);return a&&(r.numId=i.getVal(a)),r},e}();t.NumberPr=u}));
  103. ;/*!node_modules/office-viewer/lib/openxml/word/InlineText.js*/
  104. amis.define("50c1571",(function(r,e,a,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=r("8701f02"),t=r("fb3f8dd"),d=r("7d2ef84"),i=r("1050750"),c=function(){function r(){this.children=[]}return r.prototype.addChild=function(r){this.children.push(r)},r.fromXML=function(e,a){var n,c,l=new r;try{for(var f=o.__values(a.children),s=f.next();!s.done;s=f.next()){var u=s.value,h=u.tagName;switch(h){case"w:r":l.addChild(i.Run.fromXML(e,u));break;case"w:hyperlink":l.addChild(d.Hyperlink.fromXML(e,u));break;case"w:bookmarkStart":l.addChild(t.BookmarkStart.fromXML(e,u));case"w:bookmarkEnd":case"w:proofErr":case"w:noProof":case"w:smartTagPr":case"w:del":break;default:console.warn("parse Inline: Unknown key",h,u)}}}catch(r){n={error:r}}finally{try{s&&!s.done&&(c=f.return)&&c.call(f)}finally{if(n)throw n.error}}return l},r}();e.InlineText=c}));
  105. ;/*!node_modules/office-viewer/lib/openxml/word/FldSimple.js*/
  106. amis.define("636b505",(function(e,n,t,i){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("50c1571"),u=function(){function e(){}return e.fromXML=function(n,t){var i=new e;return i.inlineText=r.InlineText.fromXML(n,t),i.instr=t.getAttribute("w:instr")||"",i},e}();n.FldSimple=u}));
  107. ;/*!node_modules/office-viewer/lib/openxml/math/OMath.js*/
  108. amis.define("51af8f7",(function(e,n,t,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(){}return e.fromXML=function(n,t){var r=new e;return r.element=t,r},e}();n.OMath=f}));
  109. ;/*!node_modules/office-viewer/lib/openxml/word/Paragraph.js*/
  110. amis.define("3e37c25",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var l=e("8701f02"),o=e("f838841"),n=e("2807318"),s=e("fb3f8dd"),c=e("7d2ef84"),i=e("452b003"),d=e("1050750"),m=e("5cc64d3"),f=e("636b505"),p=e("51af8f7"),u=e("9876859");var h=function(){function e(){this.properties={},this.children=[],this.fldSimples=[]}return e.prototype.addChild=function(e){this.children.push(e)},e.parseParagraphPr=function(e,a){var r,t,s,c,d=n.parsePr(e,a),f=a.getElementsByTagName("w:pStyle").item(0);f&&(s=o.getVal(f));var p=a.getElementsByTagName("w:numPr").item(0);p&&(c=i.NumberPr.fromXML(e,p));var u=[],h=a.getElementsByTagName("w:tab");try{for(var w=l.__values(h),y=w.next();!y.done;y=w.next()){var v=y.value;u.push(m.Tab.fromXML(e,v))}}catch(e){r={error:e}}finally{try{y&&!y.done&&(t=w.return)&&t.call(w)}finally{if(r)throw r.error}}var b=function(e){var a=e.getElementsByTagName("w:autoSpaceDE").item(0),r=e.getElementsByTagName("w:autoSpaceDN").item(0);return!!a||!!r}(a);return{cssStyle:d,pStyle:s,numPr:c,tabs:u,autoSpace:b}},e.fromXML=function(a,r){var t,o,n=new e;n.fldSimples=[],n.paraId=r.getAttribute("w14:paraId")||"";var i=[].slice.call(r.children);try{for(var m=l.__values(i),h=m.next();!h.done;h=m.next()){var w=h.value,y=w.tagName;switch(y){case"w:pPr":n.properties=e.parseParagraphPr(a,w);break;case"w:r":n.addChild(d.Run.fromXML(a,w));break;case"w:smartTag":case"w:customXml":i.push.apply(i,l.__spreadArray([],l.__read([].slice.call(w.children)),!1));break;case"w:hyperlink":n.addChild(c.Hyperlink.fromXML(a,w));break;case"w:bookmarkStart":n.addChild(s.BookmarkStart.fromXML(a,w));case"w:bookmarkEnd":case"w:proofErr":case"w:noProof":case"w:del":case"w:moveTo":case"w:moveFrom":break;case"w:fldSimple":n.fldSimples.push(f.FldSimple.fromXML(a,w));break;case"m:oMathPara":case"m:oMath":n.addChild(p.OMath.fromXML(a,w));break;case"w:sdt":u.parseSdt(w,i);break;default:console.warn("parse Paragraph: Unknown key",y,w)}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(o=m.return)&&o.call(m)}finally{if(t)throw t.error}}return n},e}();a.Paragraph=h}));
  111. ;/*!node_modules/office-viewer/lib/openxml/Style.js*/
  112. amis.define("975b67c",(function(e,r,a,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02"),l=e("354b058"),s=e("f838841"),c=e("3e37c25"),i=e("1050750"),u=e("014c576"),w=e("715786c");function P(e,r){var a,t,s={};try{for(var P=n.__values(r.children),y=P.next();!y.done;y=P.next()){var o=y.value;switch(o.tagName){case"w:rPr":s.rPr=i.Run.parseRunPr(e,o);break;case"w:pPr":s.pPr=c.Paragraph.parseParagraphPr(e,o);break;case"w:tblPr":s.tblPr=u.parseTablePr(e,o);break;case"w:tcPr":s.tcPr=l.parseTcPr(e,o);break;case"w:trPr":s.trPr=w.parseTrPr(e,o)}}}catch(e){a={error:e}}finally{try{y&&!y.done&&(t=P.return)&&t.call(P)}finally{if(a)throw a.error}}return s}function y(e,r){var a,t,l={};l.id=r.getAttribute("w:styleId")||"",l.type=r.getAttribute("w:type"),l.tblStylePr={},Object.assign(l,P(e,r));try{for(var c=n.__values(r.children),i=c.next();!i.done;i=c.next()){var u=i.value,w=u.tagName;switch(w){case"w:name":l.name=s.getVal(u);break;case"w:basedOn":l.basedOn=s.getVal(u);break;case"w:rPr":case"w:pPr":case"w:tblPr":case"w:tcPr":case"w:trPr":case"w:next":case"w:link":case"w:unhideWhenUsed":case"w:qFormat":case"w:rsid":case"w:uiPriority":case"w:semiHidden":case"w:autoRedefine":break;case"w:tblStylePr":var y=u.getAttribute("w:type");l.tblStylePr[y]=P(e,u);break;default:console.warn("parseStyle Unknown tag",w,u)}}}catch(e){a={error:e}}finally{try{i&&!i.done&&(t=c.return)&&t.call(c)}finally{if(a)throw a.error}}return l}r.parseStyles=function(e,r){var a,t,l={styleMap:{}},s=Array.from(r.getElementsByTagName("w:style"));try{for(var u=n.__values(s),w=u.next();!w.done;w=u.next()){var P=y(e,w.value);P.id&&(l.styleMap[P.id]=P)}}catch(e){a={error:e}}finally{try{w&&!w.done&&(t=u.return)&&t.call(u)}finally{if(a)throw a.error}}return l.defaultStyle=function(e,r){var a={};if(!r)return a;var t=r.getElementsByTagName("w:rPrDefault").item(0);if(t){var n=t.getElementsByTagName("w:rPr").item(0);n&&(a.rPr=i.Run.parseRunPr(e,n))}var l=r.getElementsByTagName("w:pPrDefault").item(0);if(l){var s=l.getElementsByTagName("w:pPr").item(0);s&&(a.pPr=c.Paragraph.parseParagraphPr(e,s))}return a}(e,r.getElementsByTagName("w:docDefaults").item(0)),l}}));
  113. ;/*!node_modules/office-viewer/lib/openxml/Theme.js*/
  114. amis.define("08d6bdd",(function(e,t,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=e("8701f02"),c=e("b8eb51e"),l=e("f838841"),o=function(){this.colors={}};function s(e){var t={};return e&&(t.clrScheme=function(e){var t,r,a=new o;if(!e)return a;a.name=e.getAttribute("name")||"";try{for(var s=n.__values(e.children),m=s.next();!m.done;m=s.next()){var i=m.value,g=i.tagName.replace("a:",""),f=i.firstElementChild;if(f){var u=f.nodeName.replace("a:","");if("sysClr"===u)a.colors[g]=f.getAttribute("lastClr")||"";else if("srgbClr"===u)a.colors[g]="#"+f.getAttribute("val")||"";else if("scrgbClr"===u){var h=256*l.getAttrPercentage(i,"r"),v=256*l.getAttrPercentage(i,"g"),b=256*l.getAttrPercentage(i,"b");a.colors[g]="rgb(".concat(h,", ").concat(v,", ").concat(b,")")}else if("hslClr"===u){var d=c.convertAngle(i.getAttribute("hue")),y=100*l.getAttrPercentage(i,"sat"),A=100*l.getAttrPercentage(i,"lum");a.colors[g]="hsl(".concat(d,", ").concat(y,"%, ").concat(A,"%)")}else"prstClr"===u?a.colors[g]=l.getVal(i):console.error("unknown clr name",u)}}}catch(e){t={error:e}}finally{try{m&&!m.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return a}(e.getElementsByTagName("a:clrScheme").item(0)),t.fontScheme=(e.getElementsByTagName("a:fontScheme").item(0),{}),t.fmtScheme=(e.getElementsByTagName("a:fmtScheme").item(0),{})),t}t.parseTheme=function(e){var t={};return t.themeElements=s(e.getElementsByTagName("a:themeElements").item(0)),t}}));
  115. ;/*!node_modules/office-viewer/lib/util/dom.js*/
  116. amis.define("8d43ec5",(function(e,n,a,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("8701f02");n.addClassName=function(e,n){e&&n&&e.classList.add(n)},n.addClassNames=function(e,n){var a;e&&n&&(a=e.classList).add.apply(a,r.__spreadArray([],r.__read(n),!1))},n.appendChild=function(e,n){e&&n&&e.appendChild(n)},n.applyStyle=function(e,n){if(n)for(var a in n){var t=n[a];null!=t&&""!==t&&e.style.setProperty(a,String(t))}},n.createElement=function(e){return document.createElement(e)},n.styleToText=function(e){void 0===e&&(e={});var n="";for(var a in e){var t=e[a];null!=t&&""!==t&&(n+="".concat(a,": ").concat(t,";\n"))}return n}}));
  117. ;/*!node_modules/office-viewer/lib/render/renderBr.js*/
  118. amis.define("99de4a3",(function(e,r,n,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var c=e("8d43ec5");r.renderBr=function(e){return c.createElement("br")}}));
  119. ;/*!node_modules/office-viewer/lib/render/renderStyle.js*/
  120. amis.define("43be307",(function(n,t,c,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=n("8701f02"),o=n("8d43ec5");function r(n,t,c){var a="",e=c.tblPr,r=c.tcPr;if(e){var l=o.styleToText(e.cssStyle),s=o.styleToText(e.tcCSSStyle);if(a+="\n .".concat(n," .").concat(t," {\n border-collapse: collapse;\n ").concat(l,"\n }\n\n .").concat(n," .").concat(t," > tbody > tr > td {\n ").concat(s,"\n }\n "),e.insideBorder){var d=e.insideBorder;d.H&&(a+="\n .".concat(n," .").concat(t," > tbody > tr > td {\n border-top: ").concat(d.H,";\n }")),d.V&&(a+="\n .".concat(n," .").concat(t," > tbody > tr > td {\n border-left: ").concat(d.V,";\n }"))}}if(r){var i=o.styleToText(r.cssStyle);a+="\n .".concat(n," .").concat(t," > tbody > tr > td {\n ").concat(i,"\n }\n ")}return a}function l(n,t,c,a){var e,r,l,s,d,i,y="",b=o.styleToText(null===(e=a.trPr)||void 0===e?void 0:e.cssStyle),v="";switch(c){case"firstCol":v="enable-firstColumn";break;case"lastCol":v="enable-lastColumn";break;case"firstRow":v="enable-firstRow";break;case"lastRow":v="enable-lastRow";break;case"band1Horz":case"band2Horz":v="enable-hBand";break;case"band1Vert":case"band2Vert":v="enable-vBand"}b&&(y+="\n ".concat(n,".").concat(v," > tbody > tr.").concat(c,"{\n ").concat(b,"\n }\n "));var f=o.styleToText(null===(r=a.tcPr)||void 0===r?void 0:r.cssStyle);if(f&&(y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," {\n ").concat(f,"\n }\n "),null===(l=a.tcPr)||void 0===l?void 0:l.insideBorder)){var u=null===(s=a.tcPr)||void 0===s?void 0:s.insideBorder;u.H&&(y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," {\n border-top: ").concat(u.H,";\n }")),u.V&&("none"===u.V?y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," {\n border-left: none;\n border-right: none;\n }"):y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," {\n border-left: ").concat(u.V,";\n }"))}var T=o.styleToText(null===(d=a.pPr)||void 0===d?void 0:d.cssStyle);T&&(y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," > .").concat(t,"-p {\n ").concat(T,"\n }\n "));var p=o.styleToText(null===(i=a.rPr)||void 0===i?void 0:i.cssStyle);return p&&(y+="\n ".concat(n,".").concat(v," > tbody > tr > td.").concat(c," > .").concat(t,"-p > .").concat(t,"-r {\n ").concat(p,"\n }\n ")),y}var s=new Set(["wholeTable","band1Horz","band2Horz","band1Vert","band2Vert","firstCol","firstRow","lastCol","lastRow","neCell","nwCell","seCell","swCell"]);function d(n,t,c){var a,o;if(!c)return"";var r="",d=".".concat(n," .").concat(t);try{for(var i=e.__values(s),y=i.next();!y.done;y=i.next()){var b=y.value;if(b in c)r+=l(d,n,b,c[b])}}catch(n){a={error:n}}finally{try{y&&!y.done&&(o=i.return)&&o.call(i)}finally{if(a)throw a.error}}return r}t.generateTableStyle=r,t.renderStyle=function(n){var t=o.createElement("style"),c=function(n){var t=n.styles.defaultStyle,c="";(null==t?void 0:t.pPr)&&(c=o.styleToText(t.pPr.cssStyle));var a="";(null==t?void 0:t.rPr)&&(a=o.styleToText(t.rPr.cssStyle));var e=n.getClassPrefix();return"\n .".concat(n.wrapClassName," {\n\n }\n\n .").concat(n.wrapClassName," > article > section {\n background: white;\n }\n\n /** docDefaults **/\n\n .").concat(e," p {\n margin: 0;\n padding: 0;\n line-height: 1.5;\n }\n\n .").concat(e," table {\n border-spacing: 0;\n }\n\n .").concat(e," .").concat(e,"-p {\n ").concat(c,"\n }\n\n .").concat(e," .").concat(e,"-r {\n white-space: pre-wrap;\n overflow-wrap: break-word;\n ").concat(a,"\n }\n ")}(n),a=function(n){var t=n.styles.styleMap,c=n.getClassPrefix(),a="";for(var e in t){var l=n.getStyleIdDisplayName(e),s=t[e],i=s.pPr,y="";if(i){var b=o.styleToText(i.cssStyle);y="\n .".concat(c," .").concat(l," {\n ").concat(b,"\n }\n ")}var v="";if(s.rPr){var f=o.styleToText(s.rPr.cssStyle);v="\n .".concat(c," .").concat(l," > .").concat(c,"
  121. ;/*!node_modules/office-viewer/lib/render/setElementStyle.js*/
  122. amis.define("3ce3f91",(function(e,t,s,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=e("8d43ec5");t.setElementStyle=function(e,t,s){s&&(s.cssStyle&&a.applyStyle(t,s.cssStyle),s.pStyle&&a.addClassNames(t,e.getStyleClassName(s.pStyle)),s.rStyle&&a.addClassNames(t,e.getStyleClassName(s.rStyle)))}}));
  123. ;/*!node_modules/office-viewer/lib/render/renderTable.js*/
  124. amis.define("a31f93c",(function(e,a,t,l){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r=e("8701f02"),n=e("3e37c25"),d=e("1f7df3d"),s=e("8d43ec5"),o=e("a4504ab"),i=e("43be307"),c=e("3ce3f91");function p(e,a,t,l,r,n,d){0===e&&0===a&&r.classList.add("nwCell"),0===e&&a===l-1&&r.classList.add("neCell"),e===t-1&&0===a&&r.classList.add("swCell"),e===t-1&&a===l-1&&r.classList.add("seCell"),0===e&&r.classList.add("firstRow"),e===t-1&&r.classList.add("lastRow"),0===a&&r.classList.add("firstCol"),a===l-1&&r.classList.add("lastCol"),f(e+1)&&r.classList.add("band1Horz"),f(e+1)||r.classList.add("band2Horz"),f(a+1)&&r.classList.add("band1Vert"),f(a+1)||r.classList.add("band2Vert")}function f(e,a){return!(e%2)}a.default=function e(a,t){var l,f,v,u,y,b,C=document.createElement("table"),h=t.properties;if(h.tblCaption){var L=document.createElement("caption");L.textContent=h.tblCaption,C.appendChild(L)}if(h.tblLook)for(var m in h.tblLook)"noHBand"===m?h.tblLook[m]||s.addClassName(C,"enable-hBand"):"noVBand"===m?h.tblLook[m]||s.addClassName(C,"enable-vBand"):h.tblLook[m]&&s.addClassName(C,"enable-"+m);c.setElementStyle(a,C,h);var S=a.genClassName();C.classList.add(S),a.appendStyle(i.generateTableStyle(a.getClassPrefix(),S,{tblPr:h}));var w=document.createElement("tbody");C.appendChild(w);var g=0;try{for(var x=r.__values(t.trs),_=x.next();!_.done;_=x.next()){var k=_.value,E=document.createElement("tr");w.appendChild(E);var B=0;try{for(var z=(v=void 0,r.__values(k.tcs)),N=z.next();!N.done;N=z.next()){var P=N.value,H=document.createElement("td");E.appendChild(H),p(g,B,t.trs.length,k.tcs.length,H,h.rowBandSize,h.colBandSize),k.properties.tcStyle&&s.applyStyle(H,k.properties.tcStyle);var V=P.properties;c.setElementStyle(a,H,V),V.gridSpan&&(H.colSpan=V.gridSpan),V.rowSpan&&(H.rowSpan=V.rowSpan);var M=!0;V.hideMark&&(M=!1);try{for(var R=(y=void 0,r.__values(P.children)),T=R.next();!T.done;T=R.next()){var j=T.value;if(j instanceof n.Paragraph){var O=o.default(a,j,M);s.appendChild(H,O)}else j instanceof d.Table?(M=!1,s.appendChild(H,e(a,j))):console.warn("unknown child type: "+j)}}catch(e){y={error:e}}finally{try{T&&!T.done&&(b=R.return)&&b.call(R)}finally{if(y)throw y.error}}V.rowSpan?B+=V.rowSpan:B++}}catch(e){v={error:e}}finally{try{N&&!N.done&&(u=z.return)&&u.call(z)}finally{if(v)throw v.error}}g++}}catch(e){l={error:e}}finally{try{_&&!_.done&&(f=x.return)&&f.call(x)}finally{if(l)throw l.error}}return C}}));
  125. ;/*!node_modules/office-viewer/lib/render/renderDrawing.js*/
  126. amis.define("a72af5f",(function(e,t,r,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=e("8701f02"),n=e("3e37c25"),i=e("8d43ec5"),o=e("a4504ab"),f=e("a31f93c"),c=e("1f7df3d");t.renderDrawing=function(e,t){var r,l,s=document.createElement("div");if("inline"===t.position?s.style.display="inline-block":t.position,t.pic&&i.appendChild(s,function(e,t,r){var l,a,n=null===(l=e.blipFill)||void 0===l?void 0:l.blip;if(n&&n.src){var i=document.createElement("img");i.style.position="relative",i.src=n.src;var o=null===(a=e.spPr)||void 0===a?void 0:a.xfrm;if(o){var f=o.off;f&&(i.style.left=f.x,i.style.top=f.y);var c=o.ext;c&&(i.style.width=c.cx,i.style.height=c.cy),o.rot&&(i.style.transform="rotate(".concat(o.rot,"deg)"))}return i}return null}(t.pic)),i.applyStyle(s,t.containerStyle),t.wps){var d=t.wps,y=d.spPr;if(i.applyStyle(s,d.style),i.applyStyle(s,null==y?void 0:y.style),null==y?void 0:y.xfrm){var p=y.xfrm.ext;p&&(s.style.width=p.cx,s.style.height=p.cy),y.xfrm.rot&&(s.style.transform="rotate(".concat(y.xfrm.rot,"deg)"))}var v=d.txbxContent;try{for(var u=a.__values(v),x=u.next();!x.done;x=u.next()){var m=x.value;m instanceof n.Paragraph?i.appendChild(s,o.default(e,m)):m instanceof c.Table&&i.appendChild(s,f.default(e,m))}}catch(e){r={error:e}}finally{try{x&&!x.done&&(l=u.return)&&l.call(u)}finally{if(r)throw r.error}}}return s}}));
  127. ;/*!node_modules/office-viewer/lib/render/renderTab.js*/
  128. amis.define("3598160",(function(e,t,n,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var d=e("8d43ec5");t.renderTab=function(e,t){var n=d.createElement("span");return n.style.display="inline-block",n.style.width=t.pos,n.innerHTML="&nbsp;","dot"===t.leader&&(n.style.borderBottom="1px dotted"),n}}));
  129. ;/*!node_modules/office-viewer/lib/render/renderPict.js*/
  130. amis.define("3869e2c",(function(e,r,t,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.renderPict=function(e,r){if(r.src){var t=document.createElement("img");return t.style.position="relative",t.src=r.src,t}return null}}));
  131. ;/*!node_modules/office-viewer/lib/render/renderRuby.js*/
  132. amis.define("99a9ecd",(function(e,r,n,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8701f02"),l=e("8d43ec5"),d=e("1bf9315");r.renderRuby=function(e,r){var n,a,i,c,f=l.createElement("ruby");if(r.rubyBase){try{for(var u=t.__values(r.rubyBase.children),o=u.next();!o.done;o=u.next()){var p=o.value;f.appendChild(d.default(e,p))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}if(r.rt){var v=l.createElement("rp");v.innerText="(",f.appendChild(v);var y=l.createElement("rt");try{for(var h=t.__values(r.rt.children),s=h.next();!s.done;s=h.next()){p=s.value;y.appendChild(d.default(e,p))}}catch(e){i={error:e}}finally{try{s&&!s.done&&(c=h.return)&&c.call(h)}finally{if(i)throw i.error}}f.appendChild(y);var b=l.createElement("rp");b.innerText=")",f.appendChild(b)}}return f}}));
  133. ;/*!node_modules/office-viewer/lib/render/renderHyperLink.js*/
  134. amis.define("c81446a",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02"),l=e("8d43ec5"),i=e("1050750"),o=e("1bf9315");r.renderHyperLink=function(e,r,t){var a,f,c=l.createElement("a");if(r.relation){var d=r.relation;d&&"External"===d.targetMode&&(c.href=d.target,c.target="_blank")}r.anchor&&(c.href="#"+r.anchor),r.tooltip&&(c.title=r.tooltip);try{for(var u=n.__values(r.children),v=u.next();!v.done;v=u.next()){var h=v.value;if(h instanceof i.Run){var p=o.default(e,h,t);l.appendChild(c,p)}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(f=u.return)&&f.call(u)}finally{if(a)throw a.error}}return c}}));
  135. ;/*!node_modules/office-viewer/lib/render/renderBookmark.js*/
  136. amis.define("277aa0a",(function(e,r,a,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8d43ec5");r.renderBookmarkStart=function(e,r){var a=r.name;if(a){var n=t.createElement("a");return n.name=a,n.id=a,n}return null}}));
  137. ;/*!node_modules/office-viewer/lib/render/renderInlineText.js*/
  138. amis.define("813afa6",(function(e,a,r,n){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var f=e("8701f02"),t=e("8d43ec5"),i=e("1050750"),d=e("fb3f8dd"),l=e("7d2ef84"),o=e("1bf9315"),c=e("c81446a"),u=e("277aa0a");a.default=function(e,a,r){var n,s;try{for(var p=f.__values(a.children),v=p.next();!v.done;v=p.next()){var y=v.value;if(y instanceof i.Run)t.appendChild(r,o.default(e,y));else if(y instanceof d.BookmarkStart)t.appendChild(r,u.renderBookmarkStart(e,y));else if(y instanceof l.Hyperlink){var h=c.renderHyperLink(e,y);t.appendChild(r,h)}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(s=p.return)&&s.call(p)}finally{if(n)throw n.error}}}}));
  139. ;/*!node_modules/office-viewer/lib/render/renderInstrText.js*/
  140. amis.define("7f8e977",(function(e,r,t,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("8701f02"),i=e("8d43ec5"),l=e("813afa6");r.renderInstrText=function(e,r){var t,n,f,o=r.text,s=i.createElement("span"),u=null===(f=e.currentParagraph)||void 0===f?void 0:f.fldSimples;if(u)try{for(var d=a.__values(u),c=d.next();!c.done;c=d.next()){var v=c.value;if(v.instr===o.trim()||o.startsWith(v.instr+" ")){l.default(e,v.inlineText,s);break}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}return s}}));
  141. ;/*!node_modules/office-viewer/lib/render/renderSym.js*/
  142. amis.define("a3ee4bb",(function(e,n,t,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=e("8d43ec5");n.renderSym=function(e,n){var t=a.createElement("span");return t.style.fontFamily=n.font,t.innerHTML="&#x".concat(n.char,";"),t}}));
  143. ;/*!node_modules/office-viewer/lib/util/autoSpace.js*/
  144. amis.define("3238a9e",(function(t,e,n,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var u=/\p{Punctuation}/u,a=/\p{Separator}/u,i=/\p{Script=Han}|\p{Script=Katakana}|\p{Script=Hiragana}|\p{Script=Hangul}/u;e.cjkspace=function(t){var e,n,r=t.filter((function(t){return void 0!==t&&""!==t}));return n=function(t,e){return function(t,e){return i.test(t)?!(u.test(e)||a.test(e)||i.test(e)):i.test(e)&&!u.test(t)&&!a.test(t)}(t,e)?" ":""},(e=r).reduce((function(t,r,u){return t+(0!==u?n(r,e[u-1]):"")+r}),"")}}));
  145. ;/*!node_modules/office-viewer/lib/render/renderSoftHyphen.js*/
  146. amis.define("e6cfc5a",(function(e,n,r,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=e("8d43ec5");n.renderSoftHyphen=function(){var e=c.createElement("span");return e.innerHTML="&shy;",e}}));
  147. ;/*!node_modules/office-viewer/lib/render/renderNoBreakHyphen.js*/
  148. amis.define("0da9263",(function(e,n,r,a){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=e("8d43ec5");n.renderNoBreakHyphen=function(){var e=t.createElement("span");return e.innerHTML="&ndash;",e}}));
  149. ;/*!node_modules/office-viewer/lib/render/renderRun.js*/
  150. amis.define("1bf9315",(function(e,n,t,a){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("8701f02"),d=e("99de4a3"),i=e("8d43ec5"),c=e("1050750"),l=e("1f15f0a"),o=e("dc63411"),f=e("a72af5f"),p=e("3ce3f91"),s=e("5cc64d3"),h=e("3598160"),u=e("3869e2c"),x=e("ac43ed0"),v=e("4b98400"),y=e("99a9ecd"),C=e("da0e9b2"),b=e("7f8e977"),T=e("cca189c"),m=e("a3ee4bb"),S=e("3238a9e"),g=e("e6cfc5a"),k=e("6cc74f5"),w=e("db15eab"),B=e("0da9263"),E="variable";function H(e,n,t,a){var r;-1===t.indexOf("{{")?(null===(r=null==a?void 0:a.properties)||void 0===r?void 0:r.autoSpace)?e.textContent=S.cjkspace(t.split("")):e.textContent=t:(e.dataset.originText=t,e.classList.add(E),e.textContent=n.replaceText(t))}n.default=function(e,n,t,a){var S,E,_=i.createElement("span");if(e.addClass(_,"r"),p.setElementStyle(e,_,n.properties),1===n.children.length&&n.children[0]instanceof c.Text)H(_,e,n.children[0].text,t);else try{for(var P=r.__values(n.children),j=P.next();!j.done;j=P.next()){var D=j.value;if(D instanceof c.Text){var I=i.createElement("span");H(I,e,D.text,t),i.appendChild(_,I)}else if(D instanceof l.Break){var N=d.renderBr(D);i.appendChild(_,N)}else D instanceof o.Drawing?i.appendChild(_,f.renderDrawing(e,D)):D instanceof s.Tab?i.appendChild(_,h.renderTab(e,D)):D instanceof x.Pict?i.appendChild(_,u.renderPict(e,D)):D instanceof v.Ruby?i.appendChild(_,y.renderRuby(e,D)):D instanceof C.InstrText?i.appendChild(_,b.renderInstrText(e,D)):D instanceof T.Sym?i.appendChild(_,m.renderSym(e,D)):D instanceof k.SoftHyphen?i.appendChild(_,g.renderSoftHyphen()):D instanceof w.NoBreakHyphen?i.appendChild(_,B.renderNoBreakHyphen()):console.warn("unknown child",D)}}catch(e){S={error:e}}finally{try{j&&!j.done&&(E=P.return)&&E.call(P)}finally{if(S)throw S.error}}return _},n.updateVariableText=function(e){for(var n=e.rootElement.querySelectorAll(".".concat(E)),t=0;t<n.length;t++){var a=n[t],r=a.dataset.originText||"";a.textContent=e.replaceText(r)}}}));
  151. ;/*!node_modules/office-viewer/lib/render/renderNumbering.js*/
  152. amis.define("f4a3418",(function(e,r,n,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("8701f02"),l=e("8d43ec5"),u=e("3ce3f91");function s(e){var r={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},n="";for(var t in r)for(;e>=r[t];)n+=t,e-=r[t];return n}function i(e,r){switch(e){case"decimal":default:return r.toString();case"lowerLetter":return String.fromCharCode(96+r);case"upperLetter":return String.fromCharCode(64+r);case"lowerRoman":return s(r).toLowerCase();case"upperRoman":return s(r).toUpperCase();case"bullet":return"&bull;"}}r.renderNumbering=function(e,r,n){var t=r.numbering,s=n.numId;if(!s)return console.warn("renderNumbering: numId is empty"),null;if(!t)return console.warn("renderNumbering: numbering is empty"),null;var o=t.nums[s];if(!o)return console.warn("renderNumbering: num is empty"),null;var m=t.abstractNums[o.abstractNumId].lvls;o.lvlOverride&&(m=a.__assign(a.__assign({},m),o.lvlOverride.lvls));var f=m[n.ilvl];if(!f)return console.warn("renderNumbering: lvl is empty"),null;var c=n.ilvl,v=t.numData[s];if(v[c])for(var d in v[c]+=1,v)parseInt(d)>parseInt(c)&&(v[d]=0);else v[c]=f.start;for(var p=l.createElement("span"),b=f.lvlText,g=parseInt(c),C=[],I=0;I<=g;I++){var L=v[I];if(L){var w=i(m[I].numFmt,L);f.isLgl&&(w=String(L)),C.push(w)}}for(I=0;I<C.length;I++){var S=C[I];b=b.replace("%".concat(I+1),S)}if(u.setElementStyle(r,e,f.pPr),u.setElementStyle(r,p,f.rPr),"bullet"!==f.numFmt||r.renderOptions.bulletUseFont)p.innerText=b;else{var y="&bull;",N=b.charCodeAt(0).toString(16).padStart(4,"0");"f06e"===N?y="&#9632;":"f075"===N?y="&#9670;":"f0d8"===N&&(y="&#9658;"),p.innerHTML=y}return"space"===f.suff?p.innerHTML+=" ":"tab"===f.suff&&(p.innerHTML+="&emsp;"),p}}));
  153. ;/*!node_modules/office-viewer/lib/util/xml.js*/
  154. amis.define("ae95200",(function(e,r,i,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.buildXML=function(e){return(new XMLSerializer).serializeToString(e)},r.parseXML=function(e){return(new DOMParser).parseFromString(e,"application/xml")}}));
  155. ;/*!node_modules/office-viewer/lib/openxml/math/xsl.js*/
  156. amis.define("c82928d",(function(e,t,n,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=e("ae95200").parseXML('\n<?xml version="1.0" encoding="UTF-8" ?>\n<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML"\n\txmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">\n <xsl:output method="xml" encoding="UTF-16" />\n\n \x3c!-- %% Global Definitions --\x3e\n\n \x3c!-- Every single unicode character that is recognized by OMML as an operator --\x3e\n <xsl:variable name="sOperators"\n\t\tselect="concat(\n \'&#x00A8;&#x0021;&#x0022;&#x0023;&#x0026;&#x0028;&#x0029;&#x002B;&#x002C;&#x002D;&#x002E;&#x002F;&#x003A;\',\n \'&#x003B;&#x003C;&#x003D;&#x003E;&#x003F;&#x0040;&#x005B;&#x005C;&#x005D;&#x005E;&#x005F;&#x0060;&#x007B;\',\n \'&#x007C;&#x007D;&#x007E;&#x00A1;&#x00A6;&#x00AC;&#x00AF;&#x00B0;&#x00B1;&#x00B2;&#x00B3;&#x00B4;&#x00B7;&#x00B9;&#x00BF;\',\n \'&#x00D7;&#x007E;&#x00F7;&#x02C7;&#x02D8;&#x02D9;&#x02DC;&#x02DD;&#x0300;&#x0301;&#x0302;&#x0303;&#x0304;&#x0305;&#x0306;&#x0307;&#x0308;&#x0309;\',\n \'&#x030A;&#x030B;&#x030C;&#x030D;&#x030E;&#x030F;&#x0310;&#x0311;&#x0312;&#x0313;&#x0314;&#x0315;\',\n \'&#x0316;&#x0317;&#x0318;&#x0319;&#x031A;&#x031B;&#x031C;&#x031D;&#x031E;&#x031F;&#x0320;&#x0321;\',\n \'&#x0322;&#x0323;&#x0324;&#x0325;&#x0326;&#x0327;&#x0328;&#x0329;&#x032A;&#x032B;&#x032C;&#x032D;\',\n \'&#x032E;&#x032F;&#x0330;&#x0331;&#x0332;&#x0333;&#x0334;&#x0335;&#x0336;&#x0337;&#x0338;&#x033F;\',\n \'&#x2000;&#x2001;&#x2002;&#x2003;&#x2004;&#x2005;&#x2006;&#x2009;&#x200A;&#x2010;&#x2012;&#x2013;\',\n \'&#x2014;&#x2016;&#x2020;&#x2021;&#x2022;&#x2024;&#x2025;&#x2026;&#x2032;&#x2033;&#x2034;&#x203C;\',\n \'&#x2040;&#x2044;&#x204E;&#x204F;&#x2050;&#x2057;&#x2061;&#x2062;&#x2063;&#x2070;&#x2074;&#x2075;\',\n \'&#x2076;&#x2077;&#x2078;&#x2079;&#x207A;&#x207B;&#x207C;&#x207D;&#x207E;&#x2080;&#x2081;&#x2082;\',\n \'&#x2083;&#x2084;&#x2085;&#x2086;&#x2087;&#x2088;&#x2089;&#x208A;&#x208B;&#x208C;&#x208D;&#x208E;\',\n \'&#x20D0;&#x20D1;&#x20D2;&#x20D3;&#x20D4;&#x20D5;&#x20D6;&#x20D7;&#x20D8;&#x20D9;&#x20DA;&#x20DB;\',\n \'&#x20DC;&#x20DD;&#x20DE;&#x20DF;&#x20E0;&#x20E1;&#x20E4;&#x20E5;&#x20E6;&#x20E7;&#x20E8;&#x20E9;\',\n \'&#x20EA;&#x2140;&#x2146;&#x2190;&#x2191;&#x2192;&#x2193;&#x2194;&#x2195;&#x2196;&#x2197;&#x2198;&#x2199;\',\n \'&#x219A;&#x219B;&#x219C;&#x219D;&#x219E;&#x219F;&#x21A0;&#x21A1;&#x21A2;&#x21A3;&#x21A4;&#x21A5;\',\n \'&#x21A6;&#x21A7;&#x21A8;&#x21A9;&#x21AA;&#x21AB;&#x21AC;&#x21AD;&#x21AE;&#x21AF;&#x21B0;&#x21B1;\',\n \'&#x21B2;&#x21B3;&#x21B6;&#x21B7;&#x21BA;&#x21BB;&#x21BC;&#x21BD;&#x21BE;&#x21BF;&#x21C0;&#x21C1;\',\n \'&#x21C2;&#x21C3;&#x21C4;&#x21C5;&#x21C6;&#x21C7;&#x21C8;&#x21C9;&#x21CA;&#x21CB;&#x21CC;&#x21CD;\',\n \'&#x21CE;&#x21CF;&#x21D0;&#x21D1;&#x21D2;&#x21D3;&#x21D4;&#x21D5;&#x21D6;&#x21D7;&#x21D8;&#x21D9;\',\n \'&#x21DA;&#x21DB;&#x21DC;&#x21DD;&#x21DE;&#x21DF;&#x21E0;&#x21E1;&#x21E2;&#x21E3;&#x21E4;&#x21E5;\',\n \'&#x21E6;&#x21E7;&#x21E8;&#x21E9;&#x21F3;&#x21F4;&#x21F5;&#x21F6;&#x21F7;&#x21F8;&#x21F9;&#x21FA;\',\n \'&#x21FB;&#x21FC;&#x21FD;&#x21FE;&#x21FF;&#x2200;&#x2201;&#x2202;&#x2203;&#x2204;&#x2206;&#x2207;\',\n \'&#x2208;&#x2209;&#x220A;&#x220B;&#x220C;&#x220D;&#x220F;&#x2210;&#x2211;&#x2212;&#x2213;&#x2214;\',\n \'&#x2215;&#x2216;&#x2217;&#x2218;&#x2219;&#x221A;&#x221B;&#x221C;&#x221D;&#x2223;&#x2224;&#x2225;\',\n \'&#x2226;&#x2227;&#x2228;&#x2229;&#x222A;&#x222B;&#x222C;&#x222D;&#x222E;&#x222F;&#x2230;&#x2231;\',\n \'&#x2232;&#x2233;&#x2234;&#x2235;&#x2236;&#x2237;&#x2238;&#x2239;&#x223A;&#x223B;&#x223C;&#x223D;\',\n \'&#x223E;&#x2240;&#x2241;&#x2242;&#x2243;&#x2244;&#x2245;&#x2246;&#x2247;&#x2248;&#x2249;&#x224A;\',\n \'&#x224B;&#x224C;&#x224D;&#x224E;&#x224F;&#x2250;&#x2251;&#x2252;&#x2253;&#x2254;&#x2255;&#x2256
  157. ;/*!node_modules/office-viewer/lib/openxml/math/convertOOML.js*/
  158. amis.define("2a0f22e",(function(e,r,t,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("c82928d");r.convertOOXML=function(e){var r=new XSLTProcessor;return r.importStylesheet(o.xsl),r.transformToFragment(e,document)}}));
  159. ;/*!node_modules/office-viewer/lib/render/renderMath.js*/
  160. amis.define("3c75237",(function(e,n,t,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var c=e("2a0f22e");n.renderOMath=function(e,n){return c.convertOOXML(n.element)}}));
  161. ;/*!node_modules/office-viewer/lib/render/renderParagraph.js*/
  162. amis.define("a4504ab",(function(e,r,a,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t=e("8701f02"),l=e("8d43ec5"),d=e("1050750"),i=e("fb3f8dd"),f=e("7d2ef84"),o=e("1bf9315"),p=e("c81446a"),c=e("277aa0a"),s=e("f4a3418"),u=e("3ce3f91"),h=e("3598160"),v=e("51af8f7"),y=e("3c75237");r.default=function(e,r,a){var n,b,m,C;void 0===a&&(a=!0),e.currentParagraph=r;var k=l.createElement("p");e.addClass(k,"p");var _=r.properties;if(u.setElementStyle(e,k,_),_.numPr&&l.appendChild(k,s.renderNumbering(k,e,_.numPr)),_.tabs)try{for(var M=t.__values(_.tabs),g=M.next();!g.done;g=M.next()){var w=g.value;l.appendChild(k,h.renderTab(e,w))}}catch(e){n={error:e}}finally{try{g&&!g.done&&(b=M.return)&&b.call(M)}finally{if(n)throw n.error}}var x=!1;try{for(var H=t.__values(r.children),P=H.next();!P.done;P=H.next()){var L=P.value;if(L instanceof d.Run)"begin"===L.fldChar?x=!0:L&&(x=!1),l.appendChild(k,o.default(e,L,r,x));else if(L instanceof i.BookmarkStart)l.appendChild(k,c.renderBookmarkStart(e,L));else if(L instanceof f.Hyperlink){var O=p.renderHyperLink(e,L,r);l.appendChild(k,O)}else L instanceof v.OMath?l.appendChild(k,y.renderOMath(e,L)):console.warn("unknow pargraph type",L)}}catch(e){m={error:e}}finally{try{P&&!P.done&&(C=H.return)&&C.call(H)}finally{if(m)throw m.error}}return""===k.innerHTML&&a&&(k.innerHTML="&nbsp;"),k}}));
  163. ;/*!node_modules/office-viewer/lib/render/renderSection.js*/
  164. amis.define("260dd27",(function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var d=e("8d43ec5");t.renderSection=function(e,t){var i=d.createElement("section");i.style.position="relative";var n=t.properties,r=n.pageSize;if(r&&(e.renderOptions.ignoreWidth||(i.style.width=r.width),e.renderOptions.ignoreHeight||(i.style.height=r.height)),e.renderOptions.padding)i.style.padding=e.renderOptions.padding;else{var o=n.pageMargin;o&&(i.style.paddingLeft=o.left||"0",i.style.paddingRight=o.right||"0",i.style.paddingTop=o.top||"0",i.style.paddingBottom=o.bottom||"0")}return i}}));
  165. ;/*!node_modules/office-viewer/lib/render/renderBody.js*/
  166. amis.define("984efdc",(function(e,r,a,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var l=e("8701f02"),d=e("8d43ec5"),t=e("3e37c25"),f=e("1f7df3d"),i=e("7d2ef84"),o=e("a4504ab"),c=e("260dd27"),u=e("a31f93c");r.default=function(e,r,a){var n,v,p,s;try{for(var h=l.__values(a.sections),y=h.next();!y.done;y=h.next()){var _=y.value,x=c.renderSection(e,_);d.appendChild(r,x);try{for(var C=(p=void 0,l.__values(_.children)),b=C.next();!b.done;b=C.next()){var w=b.value;if(w instanceof t.Paragraph){var P=o.default(e,w);d.appendChild(x,P)}else w instanceof f.Table?d.appendChild(x,u.default(e,w)):i.Hyperlink}}catch(e){p={error:e}}finally{try{b&&!b.done&&(s=C.return)&&s.call(C)}finally{if(p)throw p.error}}d.appendChild(r,x)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(v=h.return)&&v.call(h)}finally{if(n)throw n.error}}}}));
  167. ;/*!node_modules/office-viewer/lib/render/renderDocument.js*/
  168. amis.define("1b805fe",(function(e,t,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var c=e("8d43ec5"),d=e("984efdc");t.default=function(e,t){var r=c.createElement("article");return d.default(e,r,t.body),r}}));
  169. ;/*!node_modules/office-viewer/lib/util/blob.js*/
  170. amis.define("5c71425",(function(e,d,n,o){"use strict";Object.defineProperty(d,"__esModule",{value:!0}),d.downloadBlob=function(e,d){void 0===d&&(d="file.txt");var n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=d,document.body.appendChild(o),o.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),document.body.removeChild(o)}}));
  171. ;/*!node_modules/office-viewer/lib/openxml/word/numbering/Lvl.js*/
  172. amis.define("eb681b5",(function(e,a,r,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var l=e("8701f02"),s=e("1050750"),n=e("f838841"),c=e("3e37c25"),i=function(){function e(){this.start=1,this.lvlText="%1.",this.isLgl=!1,this.lvlJc="start",this.suff="space"}return e.fromXML=function(a,r){var t,i,u=new e;u.ilvl=r.getAttribute("w:ilvl");try{for(var o=l.__values(r.children),v=o.next();!v.done;v=o.next()){var f=v.value,w=f.tagName;switch(w){case"w:start":u.start=n.getValNumber(f);break;case"w:numFmt":u.numFmt=n.getVal(f);break;case"w:lvlText":u.lvlText=n.getVal(f);break;case"w:lvlJc":u.lvlJc=n.getVal(f);break;case"w:legacy":case"w:pStyle":break;case"w:pPr":u.pPr=c.Paragraph.parseParagraphPr(a,f);break;case"w:rPr":u.rPr=s.Run.parseRunPr(a,f);break;case"w:isLgl":u.isLgl=n.getValBoolean(f);break;default:console.warn("Lvl: Unknown tag ",w,f)}}}catch(e){t={error:e}}finally{try{v&&!v.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}return u},e}();a.Lvl=i}));
  173. ;/*!node_modules/office-viewer/lib/openxml/word/numbering/AbstractNum.js*/
  174. amis.define("f4d7208",(function(e,t,r,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=e("8701f02"),n=e("eb681b5"),u=e("f838841"),i=function(){function e(){this.lvls={}}return e.fromXML=function(t,r){var l,i,v=new e;v.abstractNumId=r.getAttribute("w:abstractNumId")||"",v.multiLevelType=r.getAttribute("w:multiLevelType");var f=r.getElementsByTagName("w:lvl");try{for(var m=a.__values(f),o=m.next();!o.done;o=m.next()){var s=o.value,c=s.getAttribute("w:ilvl")||"";v.lvls[c]=n.Lvl.fromXML(t,s)}}catch(e){l={error:e}}finally{try{o&&!o.done&&(i=m.return)&&i.call(m)}finally{if(l)throw l.error}}var y=r.getElementsByTagName("w:multiLevelType").item(0);return y&&(v.multiLevelType=u.getVal(y)),v},e}();t.AbstractNum=i}));
  175. ;/*!node_modules/office-viewer/lib/openxml/word/numbering/Num.js*/
  176. amis.define("8faf628",(function(e,r,t,l){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("8701f02"),n=e("f838841"),v=e("eb681b5"),i=function(){function e(){this.lvlOverride={lvls:{}}}return e.fromXML=function(r,t){var l,i,u=new e;u.numId=t.getAttribute("w:numId")||"";var s=t.getElementsByTagName("w:abstractNumId").item(0);s&&(u.abstractNumId=n.getVal(s));var d=t.getElementsByTagName("w:lvlOverride").item(0);if(d)try{for(var f=a.__values(d.children),m=f.next();!m.done;m=f.next()){var o=m.value,c=o.tagName;switch(c){case"w:lvl":var w=o.getAttribute("w:lvlId")||"";u.lvlOverride.lvls[w]=v.Lvl.fromXML(r,o);break;case"w:startOverride":var b=o.getAttribute("w:lvlId")||"";u.lvlOverride.lvls[b]&&(u.lvlOverride.lvls[b].start=n.getValNumber(o));break;default:console.warn("Num: Unknown tag ",c,o)}}}catch(e){l={error:e}}finally{try{m&&!m.done&&(i=f.return)&&i.call(f)}finally{if(l)throw l.error}}return u},e}();r.Num=i}));
  177. ;/*!node_modules/office-viewer/lib/openxml/word/numbering/Numbering.js*/
  178. amis.define("b712a63",(function(r,t,e,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r("8701f02"),u=r("f4d7208"),m=r("8faf628"),f=function(){function r(){this.abstractNums={},this.nums={},this.numData={}}return r.fromXML=function(t,e){var a,f,o,l,s=new r;try{for(var i=n.__values(e.getElementsByTagName("w:abstractNum")),c=i.next();!c.done;c=i.next()){var d=c.value,v=u.AbstractNum.fromXML(t,d);s.abstractNums[v.abstractNumId]=v}}catch(r){a={error:r}}finally{try{c&&!c.done&&(f=i.return)&&f.call(i)}finally{if(a)throw a.error}}try{for(var y=n.__values(e.getElementsByTagName("w:num")),N=y.next();!N.done;N=y.next()){var b=N.value,h=m.Num.fromXML(t,b);s.nums[h.numId]=h,s.numData[h.numId]={}}}catch(r){o={error:r}}finally{try{N&&!N.done&&(l=y.return)&&l.call(y)}finally{if(o)throw o.error}}return s},r}();t.Numbering=f}));
  179. ;/*!node_modules/office-viewer/lib/util/mergeRun.js*/
  180. amis.define("239415c",(function(e,r,t,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("8701f02"),l=e("2807318");function o(e,r,t){var n=r?l.parsePr(e,r):{},a=t?l.parsePr(e,t):{};return JSON.stringify(n)===JSON.stringify(a)}function i(e,r){var t=e.getElementsByTagName("w:t")[0],n=r.getElementsByTagName("w:t")[0];if(t&&n){var a=n.textContent||"";t.textContent+=a||""}}function f(e){var r,t,n=e.tagName,l=e.children,o=!1,i=!1;try{for(var f=a.__values(l),u=f.next();!u.done;u=f.next()){var c=u.value;if("w:t"===c.tagName){o=!0,i="preserve"===c.getAttribute("xml:space");break}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(t=f.return)&&t.call(f)}finally{if(r)throw r.error}}return"w:r"===n&&o&&!i}function u(e,r){var t,n,l,u,c=[],s=null;try{for(var v=a.__values(r.children),y=v.next();!y.done;y=v.next()){var g=y.value,m=g.tagName;if(f(g))if(s)o(e,s.getElementsByTagName("w:rPr")[0],g.getElementsByTagName("w:rPr")[0])?i(s,g):(s=g,c.push(g));else s=g,c.push(g);else"w:proofErr"!==m&&(s=null,c.push(g))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}r.innerHTML="";try{for(var d=a.__values(c),h=d.next();!h.done;h=d.next()){var p=h.value;r.appendChild(p)}}catch(e){l={error:e}}finally{try{h&&!h.done&&(u=d.return)&&u.call(d)}finally{if(l)throw l.error}}}r.canMerge=f,r.mergeRun=function(e,r){var t,n,l=r.getElementsByTagName("w:p");try{for(var o=a.__values(l),i=o.next();!i.done;i=o.next()){u(e,i.value)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}},r.mergeRunInP=u}));
  181. ;/*!node_modules/office-viewer/lib/openxml/word/Section.js*/
  182. amis.define("4c3b66a",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=e("8701f02"),o=e("b8eb51e"),n=e("3e37c25"),s=function(){function e(){this.properties={},this.children=[]}return e.prototype.addChild=function(e){this.children.push(e)},e.parsePr=function(e,r,t){var a,s,p={};try{for(var c=i.__values(r.children),f=c.next();!f.done;f=c.next()){var h=f.value;switch(h.tagName){case"w:pgSz":p.pageSize={width:o.parseSize(h,"w:w"),height:o.parseSize(h,"w:h")};break;case"w:pgMar":p.pageMargin={left:o.parseSize(h,"w:left"),right:o.parseSize(h,"w:right"),top:o.parseSize(h,"w:top"),bottom:o.parseSize(h,"w:bottom"),header:o.parseSize(h,"w:header"),footer:o.parseSize(h,"w:footer"),gutter:o.parseSize(h,"w:gutter")};break;case"w:headerReference":var d=h.getAttribute("w:type"),l=h.getAttribute("r:id");if("default"===d&&l){var u=e.getDocumentRels(l);if(u){var g=e.getXML("/word/"+u.target).getElementsByTagName("w:p").item(0);if(g){var w=n.Paragraph.fromXML(e,g);t.addChild(w)}}}}}}catch(e){a={error:e}}finally{try{f&&!f.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}return p},e}();r.Section=s}));
  183. ;/*!node_modules/office-viewer/lib/openxml/word/Body.js*/
  184. amis.define("268c068",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02"),c=e("9876859"),i=e("dc5cbe5"),o=e("3e37c25"),s=e("4c3b66a"),d=function(){function e(){this.sections=[],this.currentSection=new s.Section,this.sections.push(this.currentSection)}return e.prototype.addChild=function(e){this.currentSection.addChild(e)},e.prototype.addSection=function(e){this.currentSection.properties=e,this.currentSection=new s.Section,this.sections.push(this.currentSection)},e.fromXML=function(r,t){var a,d,l=new e,u=[].slice.call(t.children);try{for(var h=n.__values(u),p=h.next();!p.done;p=h.next()){var f=p.value,w=f.tagName;switch(w){case"w:p":var b=o.Paragraph.fromXML(r,f);l.addChild(b);break;case"w:sectPr":l.addSection(s.Section.parsePr(r,f,l));break;case"w:tbl":var S=i.parseTable(r,f);l.addChild(S);break;case"w:bookmarkStart":case"w:bookmarkEnd":break;case"w:sdt":c.parseSdt(f,u);break;case"w:customXml":u.push.apply(u,n.__spreadArray([],n.__read([].slice.call(f.children)),!1));break;default:console.warn("Body.fromXML Unknown key",w,f)}}}catch(e){a={error:e}}finally{try{p&&!p.done&&(d=h.return)&&d.call(h)}finally{if(a)throw a.error}}return l},e}();r.Body=d}));
  185. ;/*!node_modules/office-viewer/lib/openxml/word/WDocument.js*/
  186. amis.define("e23579e",(function(e,r,t,o){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a=e("8701f02"),n=e("428d4e6"),l=e("268c068"),c=function(){function e(){}return e.fromXML=function(r,t){var o,c,m=new e,i=t.getElementsByTagName("w:body").item(0);i&&(m.body=l.Body.fromXML(r,i));var s=t.getElementsByTagName("w:background").item(0);if(s){var h={};try{for(var u=a.__values(s.attributes),f=u.next();!f.done;f=u.next()){switch(f.value.name){case"w:color":h.color=n.parseColorAttr(r,s,"w:color");break;case"w:themeColor":h.themeColor=n.parseColorAttr(r,s,"w:themeColor");break;case"w:themeShade":h.themeShade=n.parseColorAttr(r,s,"w:themeShade");break;case"w:themeTint":h.themeTint=n.parseColorAttr(r,s,"w:themeTint")}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(c=u.return)&&c.call(u)}finally{if(o)throw o.error}}}return m},e}();r.WDocument=c}));
  187. ;/*!node_modules/fflate/lib/worker.cjs*/
  188. amis.define('node_modules/fflate/lib/worker.cjs', function(require, exports, module, define) {
  189. "use strict";
  190. var ch2 = {};
  191. exports["default"] = (function (c, id, msg, transfer, cb) {
  192. var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([
  193. c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'
  194. ], { type: 'text/javascript' }))));
  195. w.onmessage = function (e) {
  196. var d = e.data, ed = d.$e$;
  197. if (ed) {
  198. var err = new Error(ed[0]);
  199. err['code'] = ed[1];
  200. err.stack = ed[2];
  201. cb(err, null);
  202. }
  203. else
  204. cb(null, d);
  205. };
  206. w.postMessage(msg, transfer);
  207. return w;
  208. });
  209. });
  210. ;/*!node_modules/fflate/lib/index.cjs*/
  211. amis.define('node_modules/fflate/lib/index.cjs', function(require, exports, module, define) {
  212. "use strict";
  213. // DEFLATE is a complex format; to read this code, you should probably check the RFC first:
  214. // https://tools.ietf.org/html/rfc1951
  215. // You may also wish to take a look at the guide I made about this program:
  216. // https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad
  217. // Some of the following code is similar to that of UZIP.js:
  218. // https://github.com/photopea/UZIP.js
  219. // However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.
  220. // Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint
  221. // is better for memory in most engines (I *think*).
  222. var node_worker_1 = require("node_modules/fflate/lib/worker.cjs");
  223. // aliases for shorter compressed code (most minifers don't do this)
  224. var u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;
  225. // fixed length extra bits
  226. var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);
  227. // fixed distance extra bits
  228. // see fleb note
  229. var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);
  230. // code length index map
  231. var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  232. // get base, reverse index map from extra bits
  233. var freb = function (eb, start) {
  234. var b = new u16(31);
  235. for (var i = 0; i < 31; ++i) {
  236. b[i] = start += 1 << eb[i - 1];
  237. }
  238. // numbers here are at max 18 bits
  239. var r = new u32(b[30]);
  240. for (var i = 1; i < 30; ++i) {
  241. for (var j = b[i]; j < b[i + 1]; ++j) {
  242. r[j] = ((j - b[i]) << 5) | i;
  243. }
  244. }
  245. return [b, r];
  246. };
  247. var _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];
  248. // we can ignore the fact that the other numbers are wrong; they never happen anyway
  249. fl[28] = 258, revfl[258] = 28;
  250. var _b = freb(fdeb, 0), fd = _b[0], revfd = _b[1];
  251. // map of value to reverse (assuming 16 bits)
  252. var rev = new u16(32768);
  253. for (var i = 0; i < 32768; ++i) {
  254. // reverse table algorithm from SO
  255. var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);
  256. x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);
  257. x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);
  258. rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;
  259. }
  260. // create huffman tree from u8 "map": index -> code length for code index
  261. // mb (max bits) must be at most 15
  262. // TODO: optimize/split up?
  263. var hMap = (function (cd, mb, r) {
  264. var s = cd.length;
  265. // index
  266. var i = 0;
  267. // u16 "map": index -> # of codes with bit length = index
  268. var l = new u16(mb);
  269. // length of cd must be 288 (total # of codes)
  270. for (; i < s; ++i) {
  271. if (cd[i])
  272. ++l[cd[i] - 1];
  273. }
  274. // u16 "map": index -> minimum code for bit length = index
  275. var le = new u16(mb);
  276. for (i = 0; i < mb; ++i) {
  277. le[i] = (le[i - 1] + l[i - 1]) << 1;
  278. }
  279. var co;
  280. if (r) {
  281. // u16 "map": index -> number of actual bits, symbol for code
  282. co = new u16(1 << mb);
  283. // bits to remove for reverser
  284. var rvb = 15 - mb;
  285. for (i = 0; i < s; ++i) {
  286. // ignore 0 lengths
  287. if (cd[i]) {
  288. // num encoding both symbol and bits read
  289. var sv = (i << 4) | cd[i];
  290. // free bits
  291. var r_1 = mb - cd[i];
  292. // start value
  293. var v = le[cd[i] - 1]++ << r_1;
  294. // m is end value
  295. for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {
  296. // every 16 bit value starting with the code yields the same result
  297. co[rev[v] >>> rvb] = sv;
  298. }
  299. }
  300. }
  301. }
  302. else {
  303. co = new u16(s);
  304. for (i = 0; i < s; ++i) {
  305. if (cd[i]) {
  306. co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);
  307. }
  308. }
  309. }
  310. return co;
  311. });
  312. // fixed length tree
  313. var flt = new u8(288);
  314. for (var i = 0; i < 144; ++i)
  315. flt[i] = 8;
  316. for (var i = 144; i < 256; ++i)
  317. flt[i] = 9;
  318. for (var i = 256; i < 280; ++i)
  319. flt[i] = 7;
  320. for (var i = 280; i < 288; ++i)
  321. flt[i] = 8;
  322. // fixed distance tree
  323. var fdt = new u8(32);
  324. for (var i = 0; i < 32; ++i)
  325. fdt[i] = 5;
  326. // fixed length map
  327. var flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);
  328. // fixed distance map
  329. var fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);
  330. // find max of array
  331. var max = function (a) {
  332. var m = a[0];
  333. for (var i = 1; i < a.length; ++i) {
  334. if (a[i] > m)
  335. m = a[i];
  336. }
  337. return m;
  338. };
  339. // read d, starting at bit p and mask with m
  340. var bits = function (d, p, m) {
  341. var o = (p / 8) | 0;
  342. return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;
  343. };
  344. // read d, starting at bit p continuing for at least 16 bits
  345. var bits16 = function (d, p) {
  346. var o = (p / 8) | 0;
  347. return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));
  348. };
  349. // get end of byte
  350. var shft = function (p) { return ((p + 7) / 8) | 0; };
  351. // typed array slice - allows garbage collector to free original reference,
  352. // while being more compatible than .slice
  353. var slc = function (v, s, e) {
  354. if (s == null || s < 0)
  355. s = 0;
  356. if (e == null || e > v.length)
  357. e = v.length;
  358. // can't use .constructor in case user-supplied
  359. var n = new (v.BYTES_PER_ELEMENT == 2 ? u16 : v.BYTES_PER_ELEMENT == 4 ? u32 : u8)(e - s);
  360. n.set(v.subarray(s, e));
  361. return n;
  362. };
  363. /**
  364. * Codes for errors generated within this library
  365. */
  366. exports.FlateErrorCode = {
  367. UnexpectedEOF: 0,
  368. InvalidBlockType: 1,
  369. InvalidLengthLiteral: 2,
  370. InvalidDistance: 3,
  371. StreamFinished: 4,
  372. NoStreamHandler: 5,
  373. InvalidHeader: 6,
  374. NoCallback: 7,
  375. InvalidUTF8: 8,
  376. ExtraFieldTooLong: 9,
  377. InvalidDate: 10,
  378. FilenameTooLong: 11,
  379. StreamFinishing: 12,
  380. InvalidZipData: 13,
  381. UnknownCompressionMethod: 14
  382. };
  383. // error codes
  384. var ec = [
  385. 'unexpected EOF',
  386. 'invalid block type',
  387. 'invalid length/literal',
  388. 'invalid distance',
  389. 'stream finished',
  390. 'no stream handler',
  391. ,
  392. 'no callback',
  393. 'invalid UTF-8 data',
  394. 'extra field too long',
  395. 'date not in range 1980-2099',
  396. 'filename too long',
  397. 'stream finishing',
  398. 'invalid zip data'
  399. // determined by unknown compression method
  400. ];
  401. ;
  402. var err = function (ind, msg, nt) {
  403. var e = new Error(msg || ec[ind]);
  404. e.code = ind;
  405. if (Error.captureStackTrace)
  406. Error.captureStackTrace(e, err);
  407. if (!nt)
  408. throw e;
  409. return e;
  410. };
  411. // expands raw DEFLATE data
  412. var inflt = function (dat, buf, st) {
  413. // source length
  414. var sl = dat.length;
  415. if (!sl || (st && st.f && !st.l))
  416. return buf || new u8(0);
  417. // have to estimate size
  418. var noBuf = !buf || st;
  419. // no state
  420. var noSt = !st || st.i;
  421. if (!st)
  422. st = {};
  423. // Assumes roughly 33% compression ratio average
  424. if (!buf)
  425. buf = new u8(sl * 3);
  426. // ensure buffer can fit at least l elements
  427. var cbuf = function (l) {
  428. var bl = buf.length;
  429. // need to increase size to fit
  430. if (l > bl) {
  431. // Double or set to necessary, whichever is greater
  432. var nbuf = new u8(Math.max(bl * 2, l));
  433. nbuf.set(buf);
  434. buf = nbuf;
  435. }
  436. };
  437. // last chunk bitpos bytes
  438. var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
  439. // total bits
  440. var tbts = sl * 8;
  441. do {
  442. if (!lm) {
  443. // BFINAL - this is only 1 when last chunk is next
  444. final = bits(dat, pos, 1);
  445. // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman
  446. var type = bits(dat, pos + 1, 3);
  447. pos += 3;
  448. if (!type) {
  449. // go to end of byte boundary
  450. var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;
  451. if (t > sl) {
  452. if (noSt)
  453. err(0);
  454. break;
  455. }
  456. // ensure size
  457. if (noBuf)
  458. cbuf(bt + l);
  459. // Copy over uncompressed data
  460. buf.set(dat.subarray(s, t), bt);
  461. // Get new bitpos, update byte count
  462. st.b = bt += l, st.p = pos = t * 8, st.f = final;
  463. continue;
  464. }
  465. else if (type == 1)
  466. lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
  467. else if (type == 2) {
  468. // literal lengths
  469. var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
  470. var tl = hLit + bits(dat, pos + 5, 31) + 1;
  471. pos += 14;
  472. // length+distance tree
  473. var ldt = new u8(tl);
  474. // code length tree
  475. var clt = new u8(19);
  476. for (var i = 0; i < hcLen; ++i) {
  477. // use index map to get real code
  478. clt[clim[i]] = bits(dat, pos + i * 3, 7);
  479. }
  480. pos += hcLen * 3;
  481. // code lengths bits
  482. var clb = max(clt), clbmsk = (1 << clb) - 1;
  483. // code lengths map
  484. var clm = hMap(clt, clb, 1);
  485. for (var i = 0; i < tl;) {
  486. var r = clm[bits(dat, pos, clbmsk)];
  487. // bits read
  488. pos += r & 15;
  489. // symbol
  490. var s = r >>> 4;
  491. // code length to copy
  492. if (s < 16) {
  493. ldt[i++] = s;
  494. }
  495. else {
  496. // copy count
  497. var c = 0, n = 0;
  498. if (s == 16)
  499. n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
  500. else if (s == 17)
  501. n = 3 + bits(dat, pos, 7), pos += 3;
  502. else if (s == 18)
  503. n = 11 + bits(dat, pos, 127), pos += 7;
  504. while (n--)
  505. ldt[i++] = c;
  506. }
  507. }
  508. // length tree distance tree
  509. var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
  510. // max length bits
  511. lbt = max(lt);
  512. // max dist bits
  513. dbt = max(dt);
  514. lm = hMap(lt, lbt, 1);
  515. dm = hMap(dt, dbt, 1);
  516. }
  517. else
  518. err(1);
  519. if (pos > tbts) {
  520. if (noSt)
  521. err(0);
  522. break;
  523. }
  524. }
  525. // Make sure the buffer can hold this + the largest possible addition
  526. // Maximum chunk size (practically, theoretically infinite) is 2^17;
  527. if (noBuf)
  528. cbuf(bt + 131072);
  529. var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
  530. var lpos = pos;
  531. for (;; lpos = pos) {
  532. // bits read, code
  533. var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;
  534. pos += c & 15;
  535. if (pos > tbts) {
  536. if (noSt)
  537. err(0);
  538. break;
  539. }
  540. if (!c)
  541. err(2);
  542. if (sym < 256)
  543. buf[bt++] = sym;
  544. else if (sym == 256) {
  545. lpos = pos, lm = null;
  546. break;
  547. }
  548. else {
  549. var add = sym - 254;
  550. // no extra bits needed if less
  551. if (sym > 264) {
  552. // index
  553. var i = sym - 257, b = fleb[i];
  554. add = bits(dat, pos, (1 << b) - 1) + fl[i];
  555. pos += b;
  556. }
  557. // dist
  558. var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;
  559. if (!d)
  560. err(3);
  561. pos += d & 15;
  562. var dt = fd[dsym];
  563. if (dsym > 3) {
  564. var b = fdeb[dsym];
  565. dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;
  566. }
  567. if (pos > tbts) {
  568. if (noSt)
  569. err(0);
  570. break;
  571. }
  572. if (noBuf)
  573. cbuf(bt + 131072);
  574. var end = bt + add;
  575. for (; bt < end; bt += 4) {
  576. buf[bt] = buf[bt - dt];
  577. buf[bt + 1] = buf[bt + 1 - dt];
  578. buf[bt + 2] = buf[bt + 2 - dt];
  579. buf[bt + 3] = buf[bt + 3 - dt];
  580. }
  581. bt = end;
  582. }
  583. }
  584. st.l = lm, st.p = lpos, st.b = bt, st.f = final;
  585. if (lm)
  586. final = 1, st.m = lbt, st.d = dm, st.n = dbt;
  587. } while (!final);
  588. return bt == buf.length ? buf : slc(buf, 0, bt);
  589. };
  590. // starting at p, write the minimum number of bits that can hold v to d
  591. var wbits = function (d, p, v) {
  592. v <<= p & 7;
  593. var o = (p / 8) | 0;
  594. d[o] |= v;
  595. d[o + 1] |= v >>> 8;
  596. };
  597. // starting at p, write the minimum number of bits (>8) that can hold v to d
  598. var wbits16 = function (d, p, v) {
  599. v <<= p & 7;
  600. var o = (p / 8) | 0;
  601. d[o] |= v;
  602. d[o + 1] |= v >>> 8;
  603. d[o + 2] |= v >>> 16;
  604. };
  605. // creates code lengths from a frequency table
  606. var hTree = function (d, mb) {
  607. // Need extra info to make a tree
  608. var t = [];
  609. for (var i = 0; i < d.length; ++i) {
  610. if (d[i])
  611. t.push({ s: i, f: d[i] });
  612. }
  613. var s = t.length;
  614. var t2 = t.slice();
  615. if (!s)
  616. return [et, 0];
  617. if (s == 1) {
  618. var v = new u8(t[0].s + 1);
  619. v[t[0].s] = 1;
  620. return [v, 1];
  621. }
  622. t.sort(function (a, b) { return a.f - b.f; });
  623. // after i2 reaches last ind, will be stopped
  624. // freq must be greater than largest possible number of symbols
  625. t.push({ s: -1, f: 25001 });
  626. var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
  627. t[0] = { s: -1, f: l.f + r.f, l: l, r: r };
  628. // efficient algorithm from UZIP.js
  629. // i0 is lookbehind, i2 is lookahead - after processing two low-freq
  630. // symbols that combined have high freq, will start processing i2 (high-freq,
  631. // non-composite) symbols instead
  632. // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/
  633. while (i1 != s - 1) {
  634. l = t[t[i0].f < t[i2].f ? i0++ : i2++];
  635. r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
  636. t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };
  637. }
  638. var maxSym = t2[0].s;
  639. for (var i = 1; i < s; ++i) {
  640. if (t2[i].s > maxSym)
  641. maxSym = t2[i].s;
  642. }
  643. // code lengths
  644. var tr = new u16(maxSym + 1);
  645. // max bits in tree
  646. var mbt = ln(t[i1 - 1], tr, 0);
  647. if (mbt > mb) {
  648. // more algorithms from UZIP.js
  649. // TODO: find out how this code works (debt)
  650. // ind debt
  651. var i = 0, dt = 0;
  652. // left cost
  653. var lft = mbt - mb, cst = 1 << lft;
  654. t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });
  655. for (; i < s; ++i) {
  656. var i2_1 = t2[i].s;
  657. if (tr[i2_1] > mb) {
  658. dt += cst - (1 << (mbt - tr[i2_1]));
  659. tr[i2_1] = mb;
  660. }
  661. else
  662. break;
  663. }
  664. dt >>>= lft;
  665. while (dt > 0) {
  666. var i2_2 = t2[i].s;
  667. if (tr[i2_2] < mb)
  668. dt -= 1 << (mb - tr[i2_2]++ - 1);
  669. else
  670. ++i;
  671. }
  672. for (; i >= 0 && dt; --i) {
  673. var i2_3 = t2[i].s;
  674. if (tr[i2_3] == mb) {
  675. --tr[i2_3];
  676. ++dt;
  677. }
  678. }
  679. mbt = mb;
  680. }
  681. return [new u8(tr), mbt];
  682. };
  683. // get the max length and assign length codes
  684. var ln = function (n, l, d) {
  685. return n.s == -1
  686. ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))
  687. : (l[n.s] = d);
  688. };
  689. // length codes generation
  690. var lc = function (c) {
  691. var s = c.length;
  692. // Note that the semicolon was intentional
  693. while (s && !c[--s])
  694. ;
  695. var cl = new u16(++s);
  696. // ind num streak
  697. var cli = 0, cln = c[0], cls = 1;
  698. var w = function (v) { cl[cli++] = v; };
  699. for (var i = 1; i <= s; ++i) {
  700. if (c[i] == cln && i != s)
  701. ++cls;
  702. else {
  703. if (!cln && cls > 2) {
  704. for (; cls > 138; cls -= 138)
  705. w(32754);
  706. if (cls > 2) {
  707. w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);
  708. cls = 0;
  709. }
  710. }
  711. else if (cls > 3) {
  712. w(cln), --cls;
  713. for (; cls > 6; cls -= 6)
  714. w(8304);
  715. if (cls > 2)
  716. w(((cls - 3) << 5) | 8208), cls = 0;
  717. }
  718. while (cls--)
  719. w(cln);
  720. cls = 1;
  721. cln = c[i];
  722. }
  723. }
  724. return [cl.subarray(0, cli), s];
  725. };
  726. // calculate the length of output from tree, code lengths
  727. var clen = function (cf, cl) {
  728. var l = 0;
  729. for (var i = 0; i < cl.length; ++i)
  730. l += cf[i] * cl[i];
  731. return l;
  732. };
  733. // writes a fixed block
  734. // returns the new bit pos
  735. var wfblk = function (out, pos, dat) {
  736. // no need to write 00 as type: TypedArray defaults to 0
  737. var s = dat.length;
  738. var o = shft(pos + 2);
  739. out[o] = s & 255;
  740. out[o + 1] = s >>> 8;
  741. out[o + 2] = out[o] ^ 255;
  742. out[o + 3] = out[o + 1] ^ 255;
  743. for (var i = 0; i < s; ++i)
  744. out[o + i + 4] = dat[i];
  745. return (o + 4 + s) * 8;
  746. };
  747. // writes a block
  748. var wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
  749. wbits(out, p++, final);
  750. ++lf[256];
  751. var _a = hTree(lf, 15), dlt = _a[0], mlb = _a[1];
  752. var _b = hTree(df, 15), ddt = _b[0], mdb = _b[1];
  753. var _c = lc(dlt), lclt = _c[0], nlc = _c[1];
  754. var _d = lc(ddt), lcdt = _d[0], ndc = _d[1];
  755. var lcfreq = new u16(19);
  756. for (var i = 0; i < lclt.length; ++i)
  757. lcfreq[lclt[i] & 31]++;
  758. for (var i = 0; i < lcdt.length; ++i)
  759. lcfreq[lcdt[i] & 31]++;
  760. var _e = hTree(lcfreq, 7), lct = _e[0], mlcb = _e[1];
  761. var nlcc = 19;
  762. for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
  763. ;
  764. var flen = (bl + 5) << 3;
  765. var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
  766. var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + (2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]);
  767. if (flen <= ftlen && flen <= dtlen)
  768. return wfblk(out, p, dat.subarray(bs, bs + bl));
  769. var lm, ll, dm, dl;
  770. wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
  771. if (dtlen < ftlen) {
  772. lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
  773. var llm = hMap(lct, mlcb, 0);
  774. wbits(out, p, nlc - 257);
  775. wbits(out, p + 5, ndc - 1);
  776. wbits(out, p + 10, nlcc - 4);
  777. p += 14;
  778. for (var i = 0; i < nlcc; ++i)
  779. wbits(out, p + 3 * i, lct[clim[i]]);
  780. p += 3 * nlcc;
  781. var lcts = [lclt, lcdt];
  782. for (var it = 0; it < 2; ++it) {
  783. var clct = lcts[it];
  784. for (var i = 0; i < clct.length; ++i) {
  785. var len = clct[i] & 31;
  786. wbits(out, p, llm[len]), p += lct[len];
  787. if (len > 15)
  788. wbits(out, p, (clct[i] >>> 5) & 127), p += clct[i] >>> 12;
  789. }
  790. }
  791. }
  792. else {
  793. lm = flm, ll = flt, dm = fdm, dl = fdt;
  794. }
  795. for (var i = 0; i < li; ++i) {
  796. if (syms[i] > 255) {
  797. var len = (syms[i] >>> 18) & 31;
  798. wbits16(out, p, lm[len + 257]), p += ll[len + 257];
  799. if (len > 7)
  800. wbits(out, p, (syms[i] >>> 23) & 31), p += fleb[len];
  801. var dst = syms[i] & 31;
  802. wbits16(out, p, dm[dst]), p += dl[dst];
  803. if (dst > 3)
  804. wbits16(out, p, (syms[i] >>> 5) & 8191), p += fdeb[dst];
  805. }
  806. else {
  807. wbits16(out, p, lm[syms[i]]), p += ll[syms[i]];
  808. }
  809. }
  810. wbits16(out, p, lm[256]);
  811. return p + ll[256];
  812. };
  813. // deflate options (nice << 13) | chain
  814. var deo = /*#__PURE__*/ new u32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
  815. // empty
  816. var et = /*#__PURE__*/ new u8(0);
  817. // compresses data into a raw DEFLATE buffer
  818. var dflt = function (dat, lvl, plvl, pre, post, lst) {
  819. var s = dat.length;
  820. var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);
  821. // writing to this writes to the output buffer
  822. var w = o.subarray(pre, o.length - post);
  823. var pos = 0;
  824. if (!lvl || s < 8) {
  825. for (var i = 0; i <= s; i += 65535) {
  826. // end
  827. var e = i + 65535;
  828. if (e >= s) {
  829. // write final block
  830. w[pos >> 3] = lst;
  831. }
  832. pos = wfblk(w, pos + 1, dat.subarray(i, e));
  833. }
  834. }
  835. else {
  836. var opt = deo[lvl - 1];
  837. var n = opt >>> 13, c = opt & 8191;
  838. var msk_1 = (1 << plvl) - 1;
  839. // prev 2-byte val map curr 2-byte val map
  840. var prev = new u16(32768), head = new u16(msk_1 + 1);
  841. var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
  842. var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };
  843. // 24576 is an arbitrary number of maximum symbols per block
  844. // 424 buffer for last block
  845. var syms = new u32(25000);
  846. // length/literal freq distance freq
  847. var lf = new u16(288), df = new u16(32);
  848. // l/lcnt exbits index l/lind waitdx bitpos
  849. var lc_1 = 0, eb = 0, i = 0, li = 0, wi = 0, bs = 0;
  850. for (; i < s; ++i) {
  851. // hash value
  852. // deopt when i > s - 3 - at end, deopt acceptable
  853. var hv = hsh(i);
  854. // index mod 32768 previous index mod
  855. var imod = i & 32767, pimod = head[hv];
  856. prev[imod] = pimod;
  857. head[hv] = imod;
  858. // We always should modify head and prev, but only add symbols if
  859. // this data is not yet processed ("wait" for wait index)
  860. if (wi <= i) {
  861. // bytes remaining
  862. var rem = s - i;
  863. if ((lc_1 > 7000 || li > 24576) && rem > 423) {
  864. pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
  865. li = lc_1 = eb = 0, bs = i;
  866. for (var j = 0; j < 286; ++j)
  867. lf[j] = 0;
  868. for (var j = 0; j < 30; ++j)
  869. df[j] = 0;
  870. }
  871. // len dist chain
  872. var l = 2, d = 0, ch_1 = c, dif = (imod - pimod) & 32767;
  873. if (rem > 2 && hv == hsh(i - dif)) {
  874. var maxn = Math.min(n, rem) - 1;
  875. var maxd = Math.min(32767, i);
  876. // max possible length
  877. // not capped at dif because decompressors implement "rolling" index population
  878. var ml = Math.min(258, rem);
  879. while (dif <= maxd && --ch_1 && imod != pimod) {
  880. if (dat[i + l] == dat[i + l - dif]) {
  881. var nl = 0;
  882. for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)
  883. ;
  884. if (nl > l) {
  885. l = nl, d = dif;
  886. // break out early when we reach "nice" (we are satisfied enough)
  887. if (nl > maxn)
  888. break;
  889. // now, find the rarest 2-byte sequence within this
  890. // length of literals and search for that instead.
  891. // Much faster than just using the start
  892. var mmd = Math.min(dif, nl - 2);
  893. var md = 0;
  894. for (var j = 0; j < mmd; ++j) {
  895. var ti = (i - dif + j + 32768) & 32767;
  896. var pti = prev[ti];
  897. var cd = (ti - pti + 32768) & 32767;
  898. if (cd > md)
  899. md = cd, pimod = ti;
  900. }
  901. }
  902. }
  903. // check the previous match
  904. imod = pimod, pimod = prev[imod];
  905. dif += (imod - pimod + 32768) & 32767;
  906. }
  907. }
  908. // d will be nonzero only when a match was found
  909. if (d) {
  910. // store both dist and len data in one Uint32
  911. // Make sure this is recognized as a len/dist with 28th bit (2^28)
  912. syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];
  913. var lin = revfl[l] & 31, din = revfd[d] & 31;
  914. eb += fleb[lin] + fdeb[din];
  915. ++lf[257 + lin];
  916. ++df[din];
  917. wi = i + l;
  918. ++lc_1;
  919. }
  920. else {
  921. syms[li++] = dat[i];
  922. ++lf[dat[i]];
  923. }
  924. }
  925. }
  926. pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
  927. // this is the easiest way to avoid needing to maintain state
  928. if (!lst && pos & 7)
  929. pos = wfblk(w, pos + 1, et);
  930. }
  931. return slc(o, 0, pre + shft(pos) + post);
  932. };
  933. // CRC32 table
  934. var crct = /*#__PURE__*/ (function () {
  935. var t = new Int32Array(256);
  936. for (var i = 0; i < 256; ++i) {
  937. var c = i, k = 9;
  938. while (--k)
  939. c = ((c & 1) && -306674912) ^ (c >>> 1);
  940. t[i] = c;
  941. }
  942. return t;
  943. })();
  944. // CRC32
  945. var crc = function () {
  946. var c = -1;
  947. return {
  948. p: function (d) {
  949. // closures have awful performance
  950. var cr = c;
  951. for (var i = 0; i < d.length; ++i)
  952. cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);
  953. c = cr;
  954. },
  955. d: function () { return ~c; }
  956. };
  957. };
  958. // Alder32
  959. var adler = function () {
  960. var a = 1, b = 0;
  961. return {
  962. p: function (d) {
  963. // closures have awful performance
  964. var n = a, m = b;
  965. var l = d.length | 0;
  966. for (var i = 0; i != l;) {
  967. var e = Math.min(i + 2655, l);
  968. for (; i < e; ++i)
  969. m += n += d[i];
  970. n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);
  971. }
  972. a = n, b = m;
  973. },
  974. d: function () {
  975. a %= 65521, b %= 65521;
  976. return (a & 255) << 24 | (a >>> 8) << 16 | (b & 255) << 8 | (b >>> 8);
  977. }
  978. };
  979. };
  980. ;
  981. // deflate with opts
  982. var dopt = function (dat, opt, pre, post, st) {
  983. return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : (12 + opt.mem), pre, post, !st);
  984. };
  985. // Walmart object spread
  986. var mrg = function (a, b) {
  987. var o = {};
  988. for (var k in a)
  989. o[k] = a[k];
  990. for (var k in b)
  991. o[k] = b[k];
  992. return o;
  993. };
  994. // worker clone
  995. // This is possibly the craziest part of the entire codebase, despite how simple it may seem.
  996. // The only parameter to this function is a closure that returns an array of variables outside of the function scope.
  997. // We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.
  998. // We will return an object mapping of true variable name to value (basically, the current scope as a JS object).
  999. // The reason we can't just use the original variable names is minifiers mangling the toplevel scope.
  1000. // This took me three weeks to figure out how to do.
  1001. var wcln = function (fn, fnStr, td) {
  1002. var dt = fn();
  1003. var st = fn.toString();
  1004. var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\s+/g, '').split(',');
  1005. for (var i = 0; i < dt.length; ++i) {
  1006. var v = dt[i], k = ks[i];
  1007. if (typeof v == 'function') {
  1008. fnStr += ';' + k + '=';
  1009. var st_1 = v.toString();
  1010. if (v.prototype) {
  1011. // for global objects
  1012. if (st_1.indexOf('[native code]') != -1) {
  1013. var spInd = st_1.indexOf(' ', 8) + 1;
  1014. fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));
  1015. }
  1016. else {
  1017. fnStr += st_1;
  1018. for (var t in v.prototype)
  1019. fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();
  1020. }
  1021. }
  1022. else
  1023. fnStr += st_1;
  1024. }
  1025. else
  1026. td[k] = v;
  1027. }
  1028. return [fnStr, td];
  1029. };
  1030. var ch = [];
  1031. // clone bufs
  1032. var cbfs = function (v) {
  1033. var tl = [];
  1034. for (var k in v) {
  1035. if (v[k].buffer) {
  1036. tl.push((v[k] = new v[k].constructor(v[k])).buffer);
  1037. }
  1038. }
  1039. return tl;
  1040. };
  1041. // use a worker to execute code
  1042. var wrkr = function (fns, init, id, cb) {
  1043. var _a;
  1044. if (!ch[id]) {
  1045. var fnStr = '', td_1 = {}, m = fns.length - 1;
  1046. for (var i = 0; i < m; ++i)
  1047. _a = wcln(fns[i], fnStr, td_1), fnStr = _a[0], td_1 = _a[1];
  1048. ch[id] = wcln(fns[m], fnStr, td_1);
  1049. }
  1050. var td = mrg({}, ch[id][1]);
  1051. return node_worker_1["default"](ch[id][0] + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);
  1052. };
  1053. // base async inflate fn
  1054. var bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gu8]; };
  1055. var bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };
  1056. // gzip extra
  1057. var gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };
  1058. // gunzip extra
  1059. var guze = function () { return [gzs, gzl]; };
  1060. // zlib extra
  1061. var zle = function () { return [zlh, wbytes, adler]; };
  1062. // unzlib extra
  1063. var zule = function () { return [zlv]; };
  1064. // post buf
  1065. var pbf = function (msg) { return postMessage(msg, [msg.buffer]); };
  1066. // get u8
  1067. var gu8 = function (o) { return o && o.size && new u8(o.size); };
  1068. // async helper
  1069. var cbify = function (dat, opts, fns, init, id, cb) {
  1070. var w = wrkr(fns, init, id, function (err, dat) {
  1071. w.terminate();
  1072. cb(err, dat);
  1073. });
  1074. w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);
  1075. return function () { w.terminate(); };
  1076. };
  1077. // auto stream
  1078. var astrm = function (strm) {
  1079. strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };
  1080. return function (ev) { return strm.push(ev.data[0], ev.data[1]); };
  1081. };
  1082. // async stream attach
  1083. var astrmify = function (fns, strm, opts, init, id) {
  1084. var t;
  1085. var w = wrkr(fns, init, id, function (err, dat) {
  1086. if (err)
  1087. w.terminate(), strm.ondata.call(strm, err);
  1088. else {
  1089. if (dat[1])
  1090. w.terminate();
  1091. strm.ondata.call(strm, err, dat[0], dat[1]);
  1092. }
  1093. });
  1094. w.postMessage(opts);
  1095. strm.push = function (d, f) {
  1096. if (!strm.ondata)
  1097. err(5);
  1098. if (t)
  1099. strm.ondata(err(4, 0, 1), null, !!f);
  1100. w.postMessage([d, t = f], [d.buffer]);
  1101. };
  1102. strm.terminate = function () { w.terminate(); };
  1103. };
  1104. // read 2 bytes
  1105. var b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };
  1106. // read 4 bytes
  1107. var b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };
  1108. var b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };
  1109. // write bytes
  1110. var wbytes = function (d, b, v) {
  1111. for (; v; ++b)
  1112. d[b] = v, v >>>= 8;
  1113. };
  1114. // gzip header
  1115. var gzh = function (c, o) {
  1116. var fn = o.filename;
  1117. c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix
  1118. if (o.mtime != 0)
  1119. wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));
  1120. if (fn) {
  1121. c[3] = 8;
  1122. for (var i = 0; i <= fn.length; ++i)
  1123. c[i + 10] = fn.charCodeAt(i);
  1124. }
  1125. };
  1126. // gzip footer: -8 to -4 = CRC, -4 to -0 is length
  1127. // gzip start
  1128. var gzs = function (d) {
  1129. if (d[0] != 31 || d[1] != 139 || d[2] != 8)
  1130. err(6, 'invalid gzip data');
  1131. var flg = d[3];
  1132. var st = 10;
  1133. if (flg & 4)
  1134. st += d[10] | (d[11] << 8) + 2;
  1135. for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])
  1136. ;
  1137. return st + (flg & 2);
  1138. };
  1139. // gzip length
  1140. var gzl = function (d) {
  1141. var l = d.length;
  1142. return ((d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16) | (d[l - 1] << 24)) >>> 0;
  1143. };
  1144. // gzip header length
  1145. var gzhl = function (o) { return 10 + ((o.filename && (o.filename.length + 1)) || 0); };
  1146. // zlib header
  1147. var zlh = function (c, o) {
  1148. var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;
  1149. c[0] = 120, c[1] = (fl << 6) | (fl ? (32 - 2 * fl) : 1);
  1150. };
  1151. // zlib valid
  1152. var zlv = function (d) {
  1153. if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))
  1154. err(6, 'invalid zlib data');
  1155. if (d[1] & 32)
  1156. err(6, 'invalid zlib data: preset dictionaries not supported');
  1157. };
  1158. function AsyncCmpStrm(opts, cb) {
  1159. if (!cb && typeof opts == 'function')
  1160. cb = opts, opts = {};
  1161. this.ondata = cb;
  1162. return opts;
  1163. }
  1164. // zlib footer: -4 to -0 is Adler32
  1165. /**
  1166. * Streaming DEFLATE compression
  1167. */
  1168. var Deflate = /*#__PURE__*/ (function () {
  1169. function Deflate(opts, cb) {
  1170. if (!cb && typeof opts == 'function')
  1171. cb = opts, opts = {};
  1172. this.ondata = cb;
  1173. this.o = opts || {};
  1174. }
  1175. Deflate.prototype.p = function (c, f) {
  1176. this.ondata(dopt(c, this.o, 0, 0, !f), f);
  1177. };
  1178. /**
  1179. * Pushes a chunk to be deflated
  1180. * @param chunk The chunk to push
  1181. * @param final Whether this is the last chunk
  1182. */
  1183. Deflate.prototype.push = function (chunk, final) {
  1184. if (!this.ondata)
  1185. err(5);
  1186. if (this.d)
  1187. err(4);
  1188. this.d = final;
  1189. this.p(chunk, final || false);
  1190. };
  1191. return Deflate;
  1192. }());
  1193. exports.Deflate = Deflate;
  1194. /**
  1195. * Asynchronous streaming DEFLATE compression
  1196. */
  1197. var AsyncDeflate = /*#__PURE__*/ (function () {
  1198. function AsyncDeflate(opts, cb) {
  1199. astrmify([
  1200. bDflt,
  1201. function () { return [astrm, Deflate]; }
  1202. ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {
  1203. var strm = new Deflate(ev.data);
  1204. onmessage = astrm(strm);
  1205. }, 6);
  1206. }
  1207. return AsyncDeflate;
  1208. }());
  1209. exports.AsyncDeflate = AsyncDeflate;
  1210. function deflate(data, opts, cb) {
  1211. if (!cb)
  1212. cb = opts, opts = {};
  1213. if (typeof cb != 'function')
  1214. err(7);
  1215. return cbify(data, opts, [
  1216. bDflt,
  1217. ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);
  1218. }
  1219. exports.deflate = deflate;
  1220. /**
  1221. * Compresses data with DEFLATE without any wrapper
  1222. * @param data The data to compress
  1223. * @param opts The compression options
  1224. * @returns The deflated version of the data
  1225. */
  1226. function deflateSync(data, opts) {
  1227. return dopt(data, opts || {}, 0, 0);
  1228. }
  1229. exports.deflateSync = deflateSync;
  1230. /**
  1231. * Streaming DEFLATE decompression
  1232. */
  1233. var Inflate = /*#__PURE__*/ (function () {
  1234. /**
  1235. * Creates an inflation stream
  1236. * @param cb The callback to call whenever data is inflated
  1237. */
  1238. function Inflate(cb) {
  1239. this.s = {};
  1240. this.p = new u8(0);
  1241. this.ondata = cb;
  1242. }
  1243. Inflate.prototype.e = function (c) {
  1244. if (!this.ondata)
  1245. err(5);
  1246. if (this.d)
  1247. err(4);
  1248. var l = this.p.length;
  1249. var n = new u8(l + c.length);
  1250. n.set(this.p), n.set(c, l), this.p = n;
  1251. };
  1252. Inflate.prototype.c = function (final) {
  1253. this.d = this.s.i = final || false;
  1254. var bts = this.s.b;
  1255. var dt = inflt(this.p, this.o, this.s);
  1256. this.ondata(slc(dt, bts, this.s.b), this.d);
  1257. this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
  1258. this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;
  1259. };
  1260. /**
  1261. * Pushes a chunk to be inflated
  1262. * @param chunk The chunk to push
  1263. * @param final Whether this is the final chunk
  1264. */
  1265. Inflate.prototype.push = function (chunk, final) {
  1266. this.e(chunk), this.c(final);
  1267. };
  1268. return Inflate;
  1269. }());
  1270. exports.Inflate = Inflate;
  1271. /**
  1272. * Asynchronous streaming DEFLATE decompression
  1273. */
  1274. var AsyncInflate = /*#__PURE__*/ (function () {
  1275. /**
  1276. * Creates an asynchronous inflation stream
  1277. * @param cb The callback to call whenever data is deflated
  1278. */
  1279. function AsyncInflate(cb) {
  1280. this.ondata = cb;
  1281. astrmify([
  1282. bInflt,
  1283. function () { return [astrm, Inflate]; }
  1284. ], this, 0, function () {
  1285. var strm = new Inflate();
  1286. onmessage = astrm(strm);
  1287. }, 7);
  1288. }
  1289. return AsyncInflate;
  1290. }());
  1291. exports.AsyncInflate = AsyncInflate;
  1292. function inflate(data, opts, cb) {
  1293. if (!cb)
  1294. cb = opts, opts = {};
  1295. if (typeof cb != 'function')
  1296. err(7);
  1297. return cbify(data, opts, [
  1298. bInflt
  1299. ], function (ev) { return pbf(inflateSync(ev.data[0], gu8(ev.data[1]))); }, 1, cb);
  1300. }
  1301. exports.inflate = inflate;
  1302. /**
  1303. * Expands DEFLATE data with no wrapper
  1304. * @param data The data to decompress
  1305. * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
  1306. * @returns The decompressed version of the data
  1307. */
  1308. function inflateSync(data, out) {
  1309. return inflt(data, out);
  1310. }
  1311. exports.inflateSync = inflateSync;
  1312. // before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.
  1313. /**
  1314. * Streaming GZIP compression
  1315. */
  1316. var Gzip = /*#__PURE__*/ (function () {
  1317. function Gzip(opts, cb) {
  1318. this.c = crc();
  1319. this.l = 0;
  1320. this.v = 1;
  1321. Deflate.call(this, opts, cb);
  1322. }
  1323. /**
  1324. * Pushes a chunk to be GZIPped
  1325. * @param chunk The chunk to push
  1326. * @param final Whether this is the last chunk
  1327. */
  1328. Gzip.prototype.push = function (chunk, final) {
  1329. Deflate.prototype.push.call(this, chunk, final);
  1330. };
  1331. Gzip.prototype.p = function (c, f) {
  1332. this.c.p(c);
  1333. this.l += c.length;
  1334. var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, !f);
  1335. if (this.v)
  1336. gzh(raw, this.o), this.v = 0;
  1337. if (f)
  1338. wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);
  1339. this.ondata(raw, f);
  1340. };
  1341. return Gzip;
  1342. }());
  1343. exports.Gzip = Gzip;
  1344. exports.Compress = Gzip;
  1345. /**
  1346. * Asynchronous streaming GZIP compression
  1347. */
  1348. var AsyncGzip = /*#__PURE__*/ (function () {
  1349. function AsyncGzip(opts, cb) {
  1350. astrmify([
  1351. bDflt,
  1352. gze,
  1353. function () { return [astrm, Deflate, Gzip]; }
  1354. ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {
  1355. var strm = new Gzip(ev.data);
  1356. onmessage = astrm(strm);
  1357. }, 8);
  1358. }
  1359. return AsyncGzip;
  1360. }());
  1361. exports.AsyncGzip = AsyncGzip;
  1362. exports.AsyncCompress = AsyncGzip;
  1363. function gzip(data, opts, cb) {
  1364. if (!cb)
  1365. cb = opts, opts = {};
  1366. if (typeof cb != 'function')
  1367. err(7);
  1368. return cbify(data, opts, [
  1369. bDflt,
  1370. gze,
  1371. function () { return [gzipSync]; }
  1372. ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);
  1373. }
  1374. exports.gzip = gzip;
  1375. exports.compress = gzip;
  1376. /**
  1377. * Compresses data with GZIP
  1378. * @param data The data to compress
  1379. * @param opts The compression options
  1380. * @returns The gzipped version of the data
  1381. */
  1382. function gzipSync(data, opts) {
  1383. if (!opts)
  1384. opts = {};
  1385. var c = crc(), l = data.length;
  1386. c.p(data);
  1387. var d = dopt(data, opts, gzhl(opts), 8), s = d.length;
  1388. return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;
  1389. }
  1390. exports.gzipSync = gzipSync;
  1391. exports.compressSync = gzipSync;
  1392. /**
  1393. * Streaming GZIP decompression
  1394. */
  1395. var Gunzip = /*#__PURE__*/ (function () {
  1396. /**
  1397. * Creates a GUNZIP stream
  1398. * @param cb The callback to call whenever data is inflated
  1399. */
  1400. function Gunzip(cb) {
  1401. this.v = 1;
  1402. Inflate.call(this, cb);
  1403. }
  1404. /**
  1405. * Pushes a chunk to be GUNZIPped
  1406. * @param chunk The chunk to push
  1407. * @param final Whether this is the last chunk
  1408. */
  1409. Gunzip.prototype.push = function (chunk, final) {
  1410. Inflate.prototype.e.call(this, chunk);
  1411. if (this.v) {
  1412. var s = this.p.length > 3 ? gzs(this.p) : 4;
  1413. if (s >= this.p.length && !final)
  1414. return;
  1415. this.p = this.p.subarray(s), this.v = 0;
  1416. }
  1417. if (final) {
  1418. if (this.p.length < 8)
  1419. err(6, 'invalid gzip data');
  1420. this.p = this.p.subarray(0, -8);
  1421. }
  1422. // necessary to prevent TS from using the closure value
  1423. // This allows for workerization to function correctly
  1424. Inflate.prototype.c.call(this, final);
  1425. };
  1426. return Gunzip;
  1427. }());
  1428. exports.Gunzip = Gunzip;
  1429. /**
  1430. * Asynchronous streaming GZIP decompression
  1431. */
  1432. var AsyncGunzip = /*#__PURE__*/ (function () {
  1433. /**
  1434. * Creates an asynchronous GUNZIP stream
  1435. * @param cb The callback to call whenever data is deflated
  1436. */
  1437. function AsyncGunzip(cb) {
  1438. this.ondata = cb;
  1439. astrmify([
  1440. bInflt,
  1441. guze,
  1442. function () { return [astrm, Inflate, Gunzip]; }
  1443. ], this, 0, function () {
  1444. var strm = new Gunzip();
  1445. onmessage = astrm(strm);
  1446. }, 9);
  1447. }
  1448. return AsyncGunzip;
  1449. }());
  1450. exports.AsyncGunzip = AsyncGunzip;
  1451. function gunzip(data, opts, cb) {
  1452. if (!cb)
  1453. cb = opts, opts = {};
  1454. if (typeof cb != 'function')
  1455. err(7);
  1456. return cbify(data, opts, [
  1457. bInflt,
  1458. guze,
  1459. function () { return [gunzipSync]; }
  1460. ], function (ev) { return pbf(gunzipSync(ev.data[0])); }, 3, cb);
  1461. }
  1462. exports.gunzip = gunzip;
  1463. /**
  1464. * Expands GZIP data
  1465. * @param data The data to decompress
  1466. * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.
  1467. * @returns The decompressed version of the data
  1468. */
  1469. function gunzipSync(data, out) {
  1470. return inflt(data.subarray(gzs(data), -8), out || new u8(gzl(data)));
  1471. }
  1472. exports.gunzipSync = gunzipSync;
  1473. /**
  1474. * Streaming Zlib compression
  1475. */
  1476. var Zlib = /*#__PURE__*/ (function () {
  1477. function Zlib(opts, cb) {
  1478. this.c = adler();
  1479. this.v = 1;
  1480. Deflate.call(this, opts, cb);
  1481. }
  1482. /**
  1483. * Pushes a chunk to be zlibbed
  1484. * @param chunk The chunk to push
  1485. * @param final Whether this is the last chunk
  1486. */
  1487. Zlib.prototype.push = function (chunk, final) {
  1488. Deflate.prototype.push.call(this, chunk, final);
  1489. };
  1490. Zlib.prototype.p = function (c, f) {
  1491. this.c.p(c);
  1492. var raw = dopt(c, this.o, this.v && 2, f && 4, !f);
  1493. if (this.v)
  1494. zlh(raw, this.o), this.v = 0;
  1495. if (f)
  1496. wbytes(raw, raw.length - 4, this.c.d());
  1497. this.ondata(raw, f);
  1498. };
  1499. return Zlib;
  1500. }());
  1501. exports.Zlib = Zlib;
  1502. /**
  1503. * Asynchronous streaming Zlib compression
  1504. */
  1505. var AsyncZlib = /*#__PURE__*/ (function () {
  1506. function AsyncZlib(opts, cb) {
  1507. astrmify([
  1508. bDflt,
  1509. zle,
  1510. function () { return [astrm, Deflate, Zlib]; }
  1511. ], this, AsyncCmpStrm.call(this, opts, cb), function (ev) {
  1512. var strm = new Zlib(ev.data);
  1513. onmessage = astrm(strm);
  1514. }, 10);
  1515. }
  1516. return AsyncZlib;
  1517. }());
  1518. exports.AsyncZlib = AsyncZlib;
  1519. function zlib(data, opts, cb) {
  1520. if (!cb)
  1521. cb = opts, opts = {};
  1522. if (typeof cb != 'function')
  1523. err(7);
  1524. return cbify(data, opts, [
  1525. bDflt,
  1526. zle,
  1527. function () { return [zlibSync]; }
  1528. ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);
  1529. }
  1530. exports.zlib = zlib;
  1531. /**
  1532. * Compress data with Zlib
  1533. * @param data The data to compress
  1534. * @param opts The compression options
  1535. * @returns The zlib-compressed version of the data
  1536. */
  1537. function zlibSync(data, opts) {
  1538. if (!opts)
  1539. opts = {};
  1540. var a = adler();
  1541. a.p(data);
  1542. var d = dopt(data, opts, 2, 4);
  1543. return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;
  1544. }
  1545. exports.zlibSync = zlibSync;
  1546. /**
  1547. * Streaming Zlib decompression
  1548. */
  1549. var Unzlib = /*#__PURE__*/ (function () {
  1550. /**
  1551. * Creates a Zlib decompression stream
  1552. * @param cb The callback to call whenever data is inflated
  1553. */
  1554. function Unzlib(cb) {
  1555. this.v = 1;
  1556. Inflate.call(this, cb);
  1557. }
  1558. /**
  1559. * Pushes a chunk to be unzlibbed
  1560. * @param chunk The chunk to push
  1561. * @param final Whether this is the last chunk
  1562. */
  1563. Unzlib.prototype.push = function (chunk, final) {
  1564. Inflate.prototype.e.call(this, chunk);
  1565. if (this.v) {
  1566. if (this.p.length < 2 && !final)
  1567. return;
  1568. this.p = this.p.subarray(2), this.v = 0;
  1569. }
  1570. if (final) {
  1571. if (this.p.length < 4)
  1572. err(6, 'invalid zlib data');
  1573. this.p = this.p.subarray(0, -4);
  1574. }
  1575. // necessary to prevent TS from using the closure value
  1576. // This allows for workerization to function correctly
  1577. Inflate.prototype.c.call(this, final);
  1578. };
  1579. return Unzlib;
  1580. }());
  1581. exports.Unzlib = Unzlib;
  1582. /**
  1583. * Asynchronous streaming Zlib decompression
  1584. */
  1585. var AsyncUnzlib = /*#__PURE__*/ (function () {
  1586. /**
  1587. * Creates an asynchronous Zlib decompression stream
  1588. * @param cb The callback to call whenever data is deflated
  1589. */
  1590. function AsyncUnzlib(cb) {
  1591. this.ondata = cb;
  1592. astrmify([
  1593. bInflt,
  1594. zule,
  1595. function () { return [astrm, Inflate, Unzlib]; }
  1596. ], this, 0, function () {
  1597. var strm = new Unzlib();
  1598. onmessage = astrm(strm);
  1599. }, 11);
  1600. }
  1601. return AsyncUnzlib;
  1602. }());
  1603. exports.AsyncUnzlib = AsyncUnzlib;
  1604. function unzlib(data, opts, cb) {
  1605. if (!cb)
  1606. cb = opts, opts = {};
  1607. if (typeof cb != 'function')
  1608. err(7);
  1609. return cbify(data, opts, [
  1610. bInflt,
  1611. zule,
  1612. function () { return [unzlibSync]; }
  1613. ], function (ev) { return pbf(unzlibSync(ev.data[0], gu8(ev.data[1]))); }, 5, cb);
  1614. }
  1615. exports.unzlib = unzlib;
  1616. /**
  1617. * Expands Zlib data
  1618. * @param data The data to decompress
  1619. * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
  1620. * @returns The decompressed version of the data
  1621. */
  1622. function unzlibSync(data, out) {
  1623. return inflt((zlv(data), data.subarray(2, -4)), out);
  1624. }
  1625. exports.unzlibSync = unzlibSync;
  1626. /**
  1627. * Streaming GZIP, Zlib, or raw DEFLATE decompression
  1628. */
  1629. var Decompress = /*#__PURE__*/ (function () {
  1630. /**
  1631. * Creates a decompression stream
  1632. * @param cb The callback to call whenever data is decompressed
  1633. */
  1634. function Decompress(cb) {
  1635. this.G = Gunzip;
  1636. this.I = Inflate;
  1637. this.Z = Unzlib;
  1638. this.ondata = cb;
  1639. }
  1640. /**
  1641. * Pushes a chunk to be decompressed
  1642. * @param chunk The chunk to push
  1643. * @param final Whether this is the last chunk
  1644. */
  1645. Decompress.prototype.push = function (chunk, final) {
  1646. if (!this.ondata)
  1647. err(5);
  1648. if (!this.s) {
  1649. if (this.p && this.p.length) {
  1650. var n = new u8(this.p.length + chunk.length);
  1651. n.set(this.p), n.set(chunk, this.p.length);
  1652. }
  1653. else
  1654. this.p = chunk;
  1655. if (this.p.length > 2) {
  1656. var _this_1 = this;
  1657. var cb = function () { _this_1.ondata.apply(_this_1, arguments); };
  1658. this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)
  1659. ? new this.G(cb)
  1660. : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))
  1661. ? new this.I(cb)
  1662. : new this.Z(cb);
  1663. this.s.push(this.p, final);
  1664. this.p = null;
  1665. }
  1666. }
  1667. else
  1668. this.s.push(chunk, final);
  1669. };
  1670. return Decompress;
  1671. }());
  1672. exports.Decompress = Decompress;
  1673. /**
  1674. * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression
  1675. */
  1676. var AsyncDecompress = /*#__PURE__*/ (function () {
  1677. /**
  1678. * Creates an asynchronous decompression stream
  1679. * @param cb The callback to call whenever data is decompressed
  1680. */
  1681. function AsyncDecompress(cb) {
  1682. this.G = AsyncGunzip;
  1683. this.I = AsyncInflate;
  1684. this.Z = AsyncUnzlib;
  1685. this.ondata = cb;
  1686. }
  1687. /**
  1688. * Pushes a chunk to be decompressed
  1689. * @param chunk The chunk to push
  1690. * @param final Whether this is the last chunk
  1691. */
  1692. AsyncDecompress.prototype.push = function (chunk, final) {
  1693. Decompress.prototype.push.call(this, chunk, final);
  1694. };
  1695. return AsyncDecompress;
  1696. }());
  1697. exports.AsyncDecompress = AsyncDecompress;
  1698. function decompress(data, opts, cb) {
  1699. if (!cb)
  1700. cb = opts, opts = {};
  1701. if (typeof cb != 'function')
  1702. err(7);
  1703. return (data[0] == 31 && data[1] == 139 && data[2] == 8)
  1704. ? gunzip(data, opts, cb)
  1705. : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))
  1706. ? inflate(data, opts, cb)
  1707. : unzlib(data, opts, cb);
  1708. }
  1709. exports.decompress = decompress;
  1710. /**
  1711. * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format
  1712. * @param data The data to decompress
  1713. * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
  1714. * @returns The decompressed version of the data
  1715. */
  1716. function decompressSync(data, out) {
  1717. return (data[0] == 31 && data[1] == 139 && data[2] == 8)
  1718. ? gunzipSync(data, out)
  1719. : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))
  1720. ? inflateSync(data, out)
  1721. : unzlibSync(data, out);
  1722. }
  1723. exports.decompressSync = decompressSync;
  1724. // flatten a directory structure
  1725. var fltn = function (d, p, t, o) {
  1726. for (var k in d) {
  1727. var val = d[k], n = p + k, op = o;
  1728. if (Array.isArray(val))
  1729. op = mrg(o, val[1]), val = val[0];
  1730. if (val instanceof u8)
  1731. t[n] = [val, op];
  1732. else {
  1733. t[n += '/'] = [new u8(0), op];
  1734. fltn(val, n, t, o);
  1735. }
  1736. }
  1737. };
  1738. // text encoder
  1739. var te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();
  1740. // text decoder
  1741. var td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();
  1742. // text decoder stream
  1743. var tds = 0;
  1744. try {
  1745. td.decode(et, { stream: true });
  1746. tds = 1;
  1747. }
  1748. catch (e) { }
  1749. // decode UTF8
  1750. var dutf8 = function (d) {
  1751. for (var r = '', i = 0;;) {
  1752. var c = d[i++];
  1753. var eb = (c > 127) + (c > 223) + (c > 239);
  1754. if (i + eb > d.length)
  1755. return [r, slc(d, i - 1)];
  1756. if (!eb)
  1757. r += String.fromCharCode(c);
  1758. else if (eb == 3) {
  1759. c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,
  1760. r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));
  1761. }
  1762. else if (eb & 1)
  1763. r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));
  1764. else
  1765. r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));
  1766. }
  1767. };
  1768. /**
  1769. * Streaming UTF-8 decoding
  1770. */
  1771. var DecodeUTF8 = /*#__PURE__*/ (function () {
  1772. /**
  1773. * Creates a UTF-8 decoding stream
  1774. * @param cb The callback to call whenever data is decoded
  1775. */
  1776. function DecodeUTF8(cb) {
  1777. this.ondata = cb;
  1778. if (tds)
  1779. this.t = new TextDecoder();
  1780. else
  1781. this.p = et;
  1782. }
  1783. /**
  1784. * Pushes a chunk to be decoded from UTF-8 binary
  1785. * @param chunk The chunk to push
  1786. * @param final Whether this is the last chunk
  1787. */
  1788. DecodeUTF8.prototype.push = function (chunk, final) {
  1789. if (!this.ondata)
  1790. err(5);
  1791. final = !!final;
  1792. if (this.t) {
  1793. this.ondata(this.t.decode(chunk, { stream: true }), final);
  1794. if (final) {
  1795. if (this.t.decode().length)
  1796. err(8);
  1797. this.t = null;
  1798. }
  1799. return;
  1800. }
  1801. if (!this.p)
  1802. err(4);
  1803. var dat = new u8(this.p.length + chunk.length);
  1804. dat.set(this.p);
  1805. dat.set(chunk, this.p.length);
  1806. var _a = dutf8(dat), ch = _a[0], np = _a[1];
  1807. if (final) {
  1808. if (np.length)
  1809. err(8);
  1810. this.p = null;
  1811. }
  1812. else
  1813. this.p = np;
  1814. this.ondata(ch, final);
  1815. };
  1816. return DecodeUTF8;
  1817. }());
  1818. exports.DecodeUTF8 = DecodeUTF8;
  1819. /**
  1820. * Streaming UTF-8 encoding
  1821. */
  1822. var EncodeUTF8 = /*#__PURE__*/ (function () {
  1823. /**
  1824. * Creates a UTF-8 decoding stream
  1825. * @param cb The callback to call whenever data is encoded
  1826. */
  1827. function EncodeUTF8(cb) {
  1828. this.ondata = cb;
  1829. }
  1830. /**
  1831. * Pushes a chunk to be encoded to UTF-8
  1832. * @param chunk The string data to push
  1833. * @param final Whether this is the last chunk
  1834. */
  1835. EncodeUTF8.prototype.push = function (chunk, final) {
  1836. if (!this.ondata)
  1837. err(5);
  1838. if (this.d)
  1839. err(4);
  1840. this.ondata(strToU8(chunk), this.d = final || false);
  1841. };
  1842. return EncodeUTF8;
  1843. }());
  1844. exports.EncodeUTF8 = EncodeUTF8;
  1845. /**
  1846. * Converts a string into a Uint8Array for use with compression/decompression methods
  1847. * @param str The string to encode
  1848. * @param latin1 Whether or not to interpret the data as Latin-1. This should
  1849. * not need to be true unless decoding a binary string.
  1850. * @returns The string encoded in UTF-8/Latin-1 binary
  1851. */
  1852. function strToU8(str, latin1) {
  1853. if (latin1) {
  1854. var ar_1 = new u8(str.length);
  1855. for (var i = 0; i < str.length; ++i)
  1856. ar_1[i] = str.charCodeAt(i);
  1857. return ar_1;
  1858. }
  1859. if (te)
  1860. return te.encode(str);
  1861. var l = str.length;
  1862. var ar = new u8(str.length + (str.length >> 1));
  1863. var ai = 0;
  1864. var w = function (v) { ar[ai++] = v; };
  1865. for (var i = 0; i < l; ++i) {
  1866. if (ai + 5 > ar.length) {
  1867. var n = new u8(ai + 8 + ((l - i) << 1));
  1868. n.set(ar);
  1869. ar = n;
  1870. }
  1871. var c = str.charCodeAt(i);
  1872. if (c < 128 || latin1)
  1873. w(c);
  1874. else if (c < 2048)
  1875. w(192 | (c >> 6)), w(128 | (c & 63));
  1876. else if (c > 55295 && c < 57344)
  1877. c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),
  1878. w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));
  1879. else
  1880. w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));
  1881. }
  1882. return slc(ar, 0, ai);
  1883. }
  1884. exports.strToU8 = strToU8;
  1885. /**
  1886. * Converts a Uint8Array to a string
  1887. * @param dat The data to decode to string
  1888. * @param latin1 Whether or not to interpret the data as Latin-1. This should
  1889. * not need to be true unless encoding to binary string.
  1890. * @returns The original UTF-8/Latin-1 string
  1891. */
  1892. function strFromU8(dat, latin1) {
  1893. if (latin1) {
  1894. var r = '';
  1895. for (var i = 0; i < dat.length; i += 16384)
  1896. r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
  1897. return r;
  1898. }
  1899. else if (td)
  1900. return td.decode(dat);
  1901. else {
  1902. var _a = dutf8(dat), out = _a[0], ext = _a[1];
  1903. if (ext.length)
  1904. err(8);
  1905. return out;
  1906. }
  1907. }
  1908. exports.strFromU8 = strFromU8;
  1909. ;
  1910. // deflate bit flag
  1911. var dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };
  1912. // skip local zip header
  1913. var slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };
  1914. // read zip header
  1915. var zh = function (d, b, z) {
  1916. var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);
  1917. var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2];
  1918. return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];
  1919. };
  1920. // read zip64 extra field
  1921. var z64e = function (d, b) {
  1922. for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))
  1923. ;
  1924. return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];
  1925. };
  1926. // extra field length
  1927. var exfl = function (ex) {
  1928. var le = 0;
  1929. if (ex) {
  1930. for (var k in ex) {
  1931. var l = ex[k].length;
  1932. if (l > 65535)
  1933. err(9);
  1934. le += l + 4;
  1935. }
  1936. }
  1937. return le;
  1938. };
  1939. // write zip header
  1940. var wzh = function (d, b, f, fn, u, c, ce, co) {
  1941. var fl = fn.length, ex = f.extra, col = co && co.length;
  1942. var exl = exfl(ex);
  1943. wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;
  1944. if (ce != null)
  1945. d[b++] = 20, d[b++] = f.os;
  1946. d[b] = 20, b += 2; // spec compliance? what's that?
  1947. d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;
  1948. d[b++] = f.compression & 255, d[b++] = f.compression >> 8;
  1949. var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;
  1950. if (y < 0 || y > 119)
  1951. err(10);
  1952. wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >>> 1)), b += 4;
  1953. if (c != -1) {
  1954. wbytes(d, b, f.crc);
  1955. wbytes(d, b + 4, c < 0 ? -c - 2 : c);
  1956. wbytes(d, b + 8, f.size);
  1957. }
  1958. wbytes(d, b + 12, fl);
  1959. wbytes(d, b + 14, exl), b += 16;
  1960. if (ce != null) {
  1961. wbytes(d, b, col);
  1962. wbytes(d, b + 6, f.attrs);
  1963. wbytes(d, b + 10, ce), b += 14;
  1964. }
  1965. d.set(fn, b);
  1966. b += fl;
  1967. if (exl) {
  1968. for (var k in ex) {
  1969. var exf = ex[k], l = exf.length;
  1970. wbytes(d, b, +k);
  1971. wbytes(d, b + 2, l);
  1972. d.set(exf, b + 4), b += 4 + l;
  1973. }
  1974. }
  1975. if (col)
  1976. d.set(co, b), b += col;
  1977. return b;
  1978. };
  1979. // write zip footer (end of central directory)
  1980. var wzf = function (o, b, c, d, e) {
  1981. wbytes(o, b, 0x6054B50); // skip disk
  1982. wbytes(o, b + 8, c);
  1983. wbytes(o, b + 10, c);
  1984. wbytes(o, b + 12, d);
  1985. wbytes(o, b + 16, e);
  1986. };
  1987. /**
  1988. * A pass-through stream to keep data uncompressed in a ZIP archive.
  1989. */
  1990. var ZipPassThrough = /*#__PURE__*/ (function () {
  1991. /**
  1992. * Creates a pass-through stream that can be added to ZIP archives
  1993. * @param filename The filename to associate with this data stream
  1994. */
  1995. function ZipPassThrough(filename) {
  1996. this.filename = filename;
  1997. this.c = crc();
  1998. this.size = 0;
  1999. this.compression = 0;
  2000. }
  2001. /**
  2002. * Processes a chunk and pushes to the output stream. You can override this
  2003. * method in a subclass for custom behavior, but by default this passes
  2004. * the data through. You must call this.ondata(err, chunk, final) at some
  2005. * point in this method.
  2006. * @param chunk The chunk to process
  2007. * @param final Whether this is the last chunk
  2008. */
  2009. ZipPassThrough.prototype.process = function (chunk, final) {
  2010. this.ondata(null, chunk, final);
  2011. };
  2012. /**
  2013. * Pushes a chunk to be added. If you are subclassing this with a custom
  2014. * compression algorithm, note that you must push data from the source
  2015. * file only, pre-compression.
  2016. * @param chunk The chunk to push
  2017. * @param final Whether this is the last chunk
  2018. */
  2019. ZipPassThrough.prototype.push = function (chunk, final) {
  2020. if (!this.ondata)
  2021. err(5);
  2022. this.c.p(chunk);
  2023. this.size += chunk.length;
  2024. if (final)
  2025. this.crc = this.c.d();
  2026. this.process(chunk, final || false);
  2027. };
  2028. return ZipPassThrough;
  2029. }());
  2030. exports.ZipPassThrough = ZipPassThrough;
  2031. // I don't extend because TypeScript extension adds 1kB of runtime bloat
  2032. /**
  2033. * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate
  2034. * for better performance
  2035. */
  2036. var ZipDeflate = /*#__PURE__*/ (function () {
  2037. /**
  2038. * Creates a DEFLATE stream that can be added to ZIP archives
  2039. * @param filename The filename to associate with this data stream
  2040. * @param opts The compression options
  2041. */
  2042. function ZipDeflate(filename, opts) {
  2043. var _this_1 = this;
  2044. if (!opts)
  2045. opts = {};
  2046. ZipPassThrough.call(this, filename);
  2047. this.d = new Deflate(opts, function (dat, final) {
  2048. _this_1.ondata(null, dat, final);
  2049. });
  2050. this.compression = 8;
  2051. this.flag = dbf(opts.level);
  2052. }
  2053. ZipDeflate.prototype.process = function (chunk, final) {
  2054. try {
  2055. this.d.push(chunk, final);
  2056. }
  2057. catch (e) {
  2058. this.ondata(e, null, final);
  2059. }
  2060. };
  2061. /**
  2062. * Pushes a chunk to be deflated
  2063. * @param chunk The chunk to push
  2064. * @param final Whether this is the last chunk
  2065. */
  2066. ZipDeflate.prototype.push = function (chunk, final) {
  2067. ZipPassThrough.prototype.push.call(this, chunk, final);
  2068. };
  2069. return ZipDeflate;
  2070. }());
  2071. exports.ZipDeflate = ZipDeflate;
  2072. /**
  2073. * Asynchronous streaming DEFLATE compression for ZIP archives
  2074. */
  2075. var AsyncZipDeflate = /*#__PURE__*/ (function () {
  2076. /**
  2077. * Creates a DEFLATE stream that can be added to ZIP archives
  2078. * @param filename The filename to associate with this data stream
  2079. * @param opts The compression options
  2080. */
  2081. function AsyncZipDeflate(filename, opts) {
  2082. var _this_1 = this;
  2083. if (!opts)
  2084. opts = {};
  2085. ZipPassThrough.call(this, filename);
  2086. this.d = new AsyncDeflate(opts, function (err, dat, final) {
  2087. _this_1.ondata(err, dat, final);
  2088. });
  2089. this.compression = 8;
  2090. this.flag = dbf(opts.level);
  2091. this.terminate = this.d.terminate;
  2092. }
  2093. AsyncZipDeflate.prototype.process = function (chunk, final) {
  2094. this.d.push(chunk, final);
  2095. };
  2096. /**
  2097. * Pushes a chunk to be deflated
  2098. * @param chunk The chunk to push
  2099. * @param final Whether this is the last chunk
  2100. */
  2101. AsyncZipDeflate.prototype.push = function (chunk, final) {
  2102. ZipPassThrough.prototype.push.call(this, chunk, final);
  2103. };
  2104. return AsyncZipDeflate;
  2105. }());
  2106. exports.AsyncZipDeflate = AsyncZipDeflate;
  2107. // TODO: Better tree shaking
  2108. /**
  2109. * A zippable archive to which files can incrementally be added
  2110. */
  2111. var Zip = /*#__PURE__*/ (function () {
  2112. /**
  2113. * Creates an empty ZIP archive to which files can be added
  2114. * @param cb The callback to call whenever data for the generated ZIP archive
  2115. * is available
  2116. */
  2117. function Zip(cb) {
  2118. this.ondata = cb;
  2119. this.u = [];
  2120. this.d = 1;
  2121. }
  2122. /**
  2123. * Adds a file to the ZIP archive
  2124. * @param file The file stream to add
  2125. */
  2126. Zip.prototype.add = function (file) {
  2127. var _this_1 = this;
  2128. if (!this.ondata)
  2129. err(5);
  2130. // finishing or finished
  2131. if (this.d & 2)
  2132. this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);
  2133. else {
  2134. var f = strToU8(file.filename), fl_1 = f.length;
  2135. var com = file.comment, o = com && strToU8(com);
  2136. var u = fl_1 != file.filename.length || (o && (com.length != o.length));
  2137. var hl_1 = fl_1 + exfl(file.extra) + 30;
  2138. if (fl_1 > 65535)
  2139. this.ondata(err(11, 0, 1), null, false);
  2140. var header = new u8(hl_1);
  2141. wzh(header, 0, file, f, u, -1);
  2142. var chks_1 = [header];
  2143. var pAll_1 = function () {
  2144. for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {
  2145. var chk = chks_2[_i];
  2146. _this_1.ondata(null, chk, false);
  2147. }
  2148. chks_1 = [];
  2149. };
  2150. var tr_1 = this.d;
  2151. this.d = 0;
  2152. var ind_1 = this.u.length;
  2153. var uf_1 = mrg(file, {
  2154. f: f,
  2155. u: u,
  2156. o: o,
  2157. t: function () {
  2158. if (file.terminate)
  2159. file.terminate();
  2160. },
  2161. r: function () {
  2162. pAll_1();
  2163. if (tr_1) {
  2164. var nxt = _this_1.u[ind_1 + 1];
  2165. if (nxt)
  2166. nxt.r();
  2167. else
  2168. _this_1.d = 1;
  2169. }
  2170. tr_1 = 1;
  2171. }
  2172. });
  2173. var cl_1 = 0;
  2174. file.ondata = function (err, dat, final) {
  2175. if (err) {
  2176. _this_1.ondata(err, dat, final);
  2177. _this_1.terminate();
  2178. }
  2179. else {
  2180. cl_1 += dat.length;
  2181. chks_1.push(dat);
  2182. if (final) {
  2183. var dd = new u8(16);
  2184. wbytes(dd, 0, 0x8074B50);
  2185. wbytes(dd, 4, file.crc);
  2186. wbytes(dd, 8, cl_1);
  2187. wbytes(dd, 12, file.size);
  2188. chks_1.push(dd);
  2189. uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;
  2190. if (tr_1)
  2191. uf_1.r();
  2192. tr_1 = 1;
  2193. }
  2194. else if (tr_1)
  2195. pAll_1();
  2196. }
  2197. };
  2198. this.u.push(uf_1);
  2199. }
  2200. };
  2201. /**
  2202. * Ends the process of adding files and prepares to emit the final chunks.
  2203. * This *must* be called after adding all desired files for the resulting
  2204. * ZIP file to work properly.
  2205. */
  2206. Zip.prototype.end = function () {
  2207. var _this_1 = this;
  2208. if (this.d & 2) {
  2209. this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);
  2210. return;
  2211. }
  2212. if (this.d)
  2213. this.e();
  2214. else
  2215. this.u.push({
  2216. r: function () {
  2217. if (!(_this_1.d & 1))
  2218. return;
  2219. _this_1.u.splice(-1, 1);
  2220. _this_1.e();
  2221. },
  2222. t: function () { }
  2223. });
  2224. this.d = 3;
  2225. };
  2226. Zip.prototype.e = function () {
  2227. var bt = 0, l = 0, tl = 0;
  2228. for (var _i = 0, _a = this.u; _i < _a.length; _i++) {
  2229. var f = _a[_i];
  2230. tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);
  2231. }
  2232. var out = new u8(tl + 22);
  2233. for (var _b = 0, _c = this.u; _b < _c.length; _b++) {
  2234. var f = _c[_b];
  2235. wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);
  2236. bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;
  2237. }
  2238. wzf(out, bt, this.u.length, tl, l);
  2239. this.ondata(null, out, true);
  2240. this.d = 2;
  2241. };
  2242. /**
  2243. * A method to terminate any internal workers used by the stream. Subsequent
  2244. * calls to add() will fail.
  2245. */
  2246. Zip.prototype.terminate = function () {
  2247. for (var _i = 0, _a = this.u; _i < _a.length; _i++) {
  2248. var f = _a[_i];
  2249. f.t();
  2250. }
  2251. this.d = 2;
  2252. };
  2253. return Zip;
  2254. }());
  2255. exports.Zip = Zip;
  2256. function zip(data, opts, cb) {
  2257. if (!cb)
  2258. cb = opts, opts = {};
  2259. if (typeof cb != 'function')
  2260. err(7);
  2261. var r = {};
  2262. fltn(data, '', r, opts);
  2263. var k = Object.keys(r);
  2264. var lft = k.length, o = 0, tot = 0;
  2265. var slft = lft, files = new Array(lft);
  2266. var term = [];
  2267. var tAll = function () {
  2268. for (var i = 0; i < term.length; ++i)
  2269. term[i]();
  2270. };
  2271. var cbd = function (a, b) {
  2272. mt(function () { cb(a, b); });
  2273. };
  2274. mt(function () { cbd = cb; });
  2275. var cbf = function () {
  2276. var out = new u8(tot + 22), oe = o, cdl = tot - o;
  2277. tot = 0;
  2278. for (var i = 0; i < slft; ++i) {
  2279. var f = files[i];
  2280. try {
  2281. var l = f.c.length;
  2282. wzh(out, tot, f, f.f, f.u, l);
  2283. var badd = 30 + f.f.length + exfl(f.extra);
  2284. var loc = tot + badd;
  2285. out.set(f.c, loc);
  2286. wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;
  2287. }
  2288. catch (e) {
  2289. return cbd(e, null);
  2290. }
  2291. }
  2292. wzf(out, o, files.length, cdl, oe);
  2293. cbd(null, out);
  2294. };
  2295. if (!lft)
  2296. cbf();
  2297. var _loop_1 = function (i) {
  2298. var fn = k[i];
  2299. var _a = r[fn], file = _a[0], p = _a[1];
  2300. var c = crc(), size = file.length;
  2301. c.p(file);
  2302. var f = strToU8(fn), s = f.length;
  2303. var com = p.comment, m = com && strToU8(com), ms = m && m.length;
  2304. var exl = exfl(p.extra);
  2305. var compression = p.level == 0 ? 0 : 8;
  2306. var cbl = function (e, d) {
  2307. if (e) {
  2308. tAll();
  2309. cbd(e, null);
  2310. }
  2311. else {
  2312. var l = d.length;
  2313. files[i] = mrg(p, {
  2314. size: size,
  2315. crc: c.d(),
  2316. c: d,
  2317. f: f,
  2318. m: m,
  2319. u: s != fn.length || (m && (com.length != ms)),
  2320. compression: compression
  2321. });
  2322. o += 30 + s + exl + l;
  2323. tot += 76 + 2 * (s + exl) + (ms || 0) + l;
  2324. if (!--lft)
  2325. cbf();
  2326. }
  2327. };
  2328. if (s > 65535)
  2329. cbl(err(11, 0, 1), null);
  2330. if (!compression)
  2331. cbl(null, file);
  2332. else if (size < 160000) {
  2333. try {
  2334. cbl(null, deflateSync(file, p));
  2335. }
  2336. catch (e) {
  2337. cbl(e, null);
  2338. }
  2339. }
  2340. else
  2341. term.push(deflate(file, p, cbl));
  2342. };
  2343. // Cannot use lft because it can decrease
  2344. for (var i = 0; i < slft; ++i) {
  2345. _loop_1(i);
  2346. }
  2347. return tAll;
  2348. }
  2349. exports.zip = zip;
  2350. /**
  2351. * Synchronously creates a ZIP file. Prefer using `zip` for better performance
  2352. * with more than one file.
  2353. * @param data The directory structure for the ZIP archive
  2354. * @param opts The main options, merged with per-file options
  2355. * @returns The generated ZIP archive
  2356. */
  2357. function zipSync(data, opts) {
  2358. if (!opts)
  2359. opts = {};
  2360. var r = {};
  2361. var files = [];
  2362. fltn(data, '', r, opts);
  2363. var o = 0;
  2364. var tot = 0;
  2365. for (var fn in r) {
  2366. var _a = r[fn], file = _a[0], p = _a[1];
  2367. var compression = p.level == 0 ? 0 : 8;
  2368. var f = strToU8(fn), s = f.length;
  2369. var com = p.comment, m = com && strToU8(com), ms = m && m.length;
  2370. var exl = exfl(p.extra);
  2371. if (s > 65535)
  2372. err(11);
  2373. var d = compression ? deflateSync(file, p) : file, l = d.length;
  2374. var c = crc();
  2375. c.p(file);
  2376. files.push(mrg(p, {
  2377. size: file.length,
  2378. crc: c.d(),
  2379. c: d,
  2380. f: f,
  2381. m: m,
  2382. u: s != fn.length || (m && (com.length != ms)),
  2383. o: o,
  2384. compression: compression
  2385. }));
  2386. o += 30 + s + exl + l;
  2387. tot += 76 + 2 * (s + exl) + (ms || 0) + l;
  2388. }
  2389. var out = new u8(tot + 22), oe = o, cdl = tot - o;
  2390. for (var i = 0; i < files.length; ++i) {
  2391. var f = files[i];
  2392. wzh(out, f.o, f, f.f, f.u, f.c.length);
  2393. var badd = 30 + f.f.length + exfl(f.extra);
  2394. out.set(f.c, f.o + badd);
  2395. wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
  2396. }
  2397. wzf(out, o, files.length, cdl, oe);
  2398. return out;
  2399. }
  2400. exports.zipSync = zipSync;
  2401. /**
  2402. * Streaming pass-through decompression for ZIP archives
  2403. */
  2404. var UnzipPassThrough = /*#__PURE__*/ (function () {
  2405. function UnzipPassThrough() {
  2406. }
  2407. UnzipPassThrough.prototype.push = function (data, final) {
  2408. this.ondata(null, data, final);
  2409. };
  2410. UnzipPassThrough.compression = 0;
  2411. return UnzipPassThrough;
  2412. }());
  2413. exports.UnzipPassThrough = UnzipPassThrough;
  2414. /**
  2415. * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for
  2416. * better performance.
  2417. */
  2418. var UnzipInflate = /*#__PURE__*/ (function () {
  2419. /**
  2420. * Creates a DEFLATE decompression that can be used in ZIP archives
  2421. */
  2422. function UnzipInflate() {
  2423. var _this_1 = this;
  2424. this.i = new Inflate(function (dat, final) {
  2425. _this_1.ondata(null, dat, final);
  2426. });
  2427. }
  2428. UnzipInflate.prototype.push = function (data, final) {
  2429. try {
  2430. this.i.push(data, final);
  2431. }
  2432. catch (e) {
  2433. this.ondata(e, null, final);
  2434. }
  2435. };
  2436. UnzipInflate.compression = 8;
  2437. return UnzipInflate;
  2438. }());
  2439. exports.UnzipInflate = UnzipInflate;
  2440. /**
  2441. * Asynchronous streaming DEFLATE decompression for ZIP archives
  2442. */
  2443. var AsyncUnzipInflate = /*#__PURE__*/ (function () {
  2444. /**
  2445. * Creates a DEFLATE decompression that can be used in ZIP archives
  2446. */
  2447. function AsyncUnzipInflate(_, sz) {
  2448. var _this_1 = this;
  2449. if (sz < 320000) {
  2450. this.i = new Inflate(function (dat, final) {
  2451. _this_1.ondata(null, dat, final);
  2452. });
  2453. }
  2454. else {
  2455. this.i = new AsyncInflate(function (err, dat, final) {
  2456. _this_1.ondata(err, dat, final);
  2457. });
  2458. this.terminate = this.i.terminate;
  2459. }
  2460. }
  2461. AsyncUnzipInflate.prototype.push = function (data, final) {
  2462. if (this.i.terminate)
  2463. data = slc(data, 0);
  2464. this.i.push(data, final);
  2465. };
  2466. AsyncUnzipInflate.compression = 8;
  2467. return AsyncUnzipInflate;
  2468. }());
  2469. exports.AsyncUnzipInflate = AsyncUnzipInflate;
  2470. /**
  2471. * A ZIP archive decompression stream that emits files as they are discovered
  2472. */
  2473. var Unzip = /*#__PURE__*/ (function () {
  2474. /**
  2475. * Creates a ZIP decompression stream
  2476. * @param cb The callback to call whenever a file in the ZIP archive is found
  2477. */
  2478. function Unzip(cb) {
  2479. this.onfile = cb;
  2480. this.k = [];
  2481. this.o = {
  2482. 0: UnzipPassThrough
  2483. };
  2484. this.p = et;
  2485. }
  2486. /**
  2487. * Pushes a chunk to be unzipped
  2488. * @param chunk The chunk to push
  2489. * @param final Whether this is the last chunk
  2490. */
  2491. Unzip.prototype.push = function (chunk, final) {
  2492. var _this_1 = this;
  2493. if (!this.onfile)
  2494. err(5);
  2495. if (!this.p)
  2496. err(4);
  2497. if (this.c > 0) {
  2498. var len = Math.min(this.c, chunk.length);
  2499. var toAdd = chunk.subarray(0, len);
  2500. this.c -= len;
  2501. if (this.d)
  2502. this.d.push(toAdd, !this.c);
  2503. else
  2504. this.k[0].push(toAdd);
  2505. chunk = chunk.subarray(len);
  2506. if (chunk.length)
  2507. return this.push(chunk, final);
  2508. }
  2509. else {
  2510. var f = 0, i = 0, is = void 0, buf = void 0;
  2511. if (!this.p.length)
  2512. buf = chunk;
  2513. else if (!chunk.length)
  2514. buf = this.p;
  2515. else {
  2516. buf = new u8(this.p.length + chunk.length);
  2517. buf.set(this.p), buf.set(chunk, this.p.length);
  2518. }
  2519. var l = buf.length, oc = this.c, add = oc && this.d;
  2520. var _loop_2 = function () {
  2521. var _a;
  2522. var sig = b4(buf, i);
  2523. if (sig == 0x4034B50) {
  2524. f = 1, is = i;
  2525. this_1.d = null;
  2526. this_1.c = 0;
  2527. var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);
  2528. if (l > i + 30 + fnl + es) {
  2529. var chks_3 = [];
  2530. this_1.k.unshift(chks_3);
  2531. f = 2;
  2532. var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22);
  2533. var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);
  2534. if (sc_1 == 4294967295) {
  2535. _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1];
  2536. }
  2537. else if (dd)
  2538. sc_1 = -1;
  2539. i += es;
  2540. this_1.c = sc_1;
  2541. var d_1;
  2542. var file_1 = {
  2543. name: fn_1,
  2544. compression: cmp_1,
  2545. start: function () {
  2546. if (!file_1.ondata)
  2547. err(5);
  2548. if (!sc_1)
  2549. file_1.ondata(null, et, true);
  2550. else {
  2551. var ctr = _this_1.o[cmp_1];
  2552. if (!ctr)
  2553. file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);
  2554. d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);
  2555. d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };
  2556. for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {
  2557. var dat = chks_4[_i];
  2558. d_1.push(dat, false);
  2559. }
  2560. if (_this_1.k[0] == chks_3 && _this_1.c)
  2561. _this_1.d = d_1;
  2562. else
  2563. d_1.push(et, true);
  2564. }
  2565. },
  2566. terminate: function () {
  2567. if (d_1 && d_1.terminate)
  2568. d_1.terminate();
  2569. }
  2570. };
  2571. if (sc_1 >= 0)
  2572. file_1.size = sc_1, file_1.originalSize = su_1;
  2573. this_1.onfile(file_1);
  2574. }
  2575. return "break";
  2576. }
  2577. else if (oc) {
  2578. if (sig == 0x8074B50) {
  2579. is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;
  2580. return "break";
  2581. }
  2582. else if (sig == 0x2014B50) {
  2583. is = i -= 4, f = 3, this_1.c = 0;
  2584. return "break";
  2585. }
  2586. }
  2587. };
  2588. var this_1 = this;
  2589. for (; i < l - 4; ++i) {
  2590. var state_1 = _loop_2();
  2591. if (state_1 === "break")
  2592. break;
  2593. }
  2594. this.p = et;
  2595. if (oc < 0) {
  2596. var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);
  2597. if (add)
  2598. add.push(dat, !!f);
  2599. else
  2600. this.k[+(f == 2)].push(dat);
  2601. }
  2602. if (f & 2)
  2603. return this.push(buf.subarray(i), final);
  2604. this.p = buf.subarray(i);
  2605. }
  2606. if (final) {
  2607. if (this.c)
  2608. err(13);
  2609. this.p = null;
  2610. }
  2611. };
  2612. /**
  2613. * Registers a decoder with the stream, allowing for files compressed with
  2614. * the compression type provided to be expanded correctly
  2615. * @param decoder The decoder constructor
  2616. */
  2617. Unzip.prototype.register = function (decoder) {
  2618. this.o[decoder.compression] = decoder;
  2619. };
  2620. return Unzip;
  2621. }());
  2622. exports.Unzip = Unzip;
  2623. var mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };
  2624. function unzip(data, opts, cb) {
  2625. if (!cb)
  2626. cb = opts, opts = {};
  2627. if (typeof cb != 'function')
  2628. err(7);
  2629. var term = [];
  2630. var tAll = function () {
  2631. for (var i = 0; i < term.length; ++i)
  2632. term[i]();
  2633. };
  2634. var files = {};
  2635. var cbd = function (a, b) {
  2636. mt(function () { cb(a, b); });
  2637. };
  2638. mt(function () { cbd = cb; });
  2639. var e = data.length - 22;
  2640. for (; b4(data, e) != 0x6054B50; --e) {
  2641. if (!e || data.length - e > 65558) {
  2642. cbd(err(13, 0, 1), null);
  2643. return tAll;
  2644. }
  2645. }
  2646. ;
  2647. var lft = b2(data, e + 8);
  2648. if (lft) {
  2649. var c = lft;
  2650. var o = b4(data, e + 16);
  2651. var z = o == 4294967295 || c == 65535;
  2652. if (z) {
  2653. var ze = b4(data, e - 12);
  2654. z = b4(data, ze) == 0x6064B50;
  2655. if (z) {
  2656. c = lft = b4(data, ze + 32);
  2657. o = b4(data, ze + 48);
  2658. }
  2659. }
  2660. var fltr = opts && opts.filter;
  2661. var _loop_3 = function (i) {
  2662. var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);
  2663. o = no;
  2664. var cbl = function (e, d) {
  2665. if (e) {
  2666. tAll();
  2667. cbd(e, null);
  2668. }
  2669. else {
  2670. if (d)
  2671. files[fn] = d;
  2672. if (!--lft)
  2673. cbd(null, files);
  2674. }
  2675. };
  2676. if (!fltr || fltr({
  2677. name: fn,
  2678. size: sc,
  2679. originalSize: su,
  2680. compression: c_1
  2681. })) {
  2682. if (!c_1)
  2683. cbl(null, slc(data, b, b + sc));
  2684. else if (c_1 == 8) {
  2685. var infl = data.subarray(b, b + sc);
  2686. if (sc < 320000) {
  2687. try {
  2688. cbl(null, inflateSync(infl, new u8(su)));
  2689. }
  2690. catch (e) {
  2691. cbl(e, null);
  2692. }
  2693. }
  2694. else
  2695. term.push(inflate(infl, { size: su }, cbl));
  2696. }
  2697. else
  2698. cbl(err(14, 'unknown compression type ' + c_1, 1), null);
  2699. }
  2700. else
  2701. cbl(null, null);
  2702. };
  2703. for (var i = 0; i < c; ++i) {
  2704. _loop_3(i);
  2705. }
  2706. }
  2707. else
  2708. cbd(null, {});
  2709. return tAll;
  2710. }
  2711. exports.unzip = unzip;
  2712. /**
  2713. * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
  2714. * performance with more than one file.
  2715. * @param data The raw compressed ZIP file
  2716. * @param opts The ZIP extraction options
  2717. * @returns The decompressed files
  2718. */
  2719. function unzipSync(data, opts) {
  2720. var files = {};
  2721. var e = data.length - 22;
  2722. for (; b4(data, e) != 0x6054B50; --e) {
  2723. if (!e || data.length - e > 65558)
  2724. err(13);
  2725. }
  2726. ;
  2727. var c = b2(data, e + 8);
  2728. if (!c)
  2729. return {};
  2730. var o = b4(data, e + 16);
  2731. var z = o == 4294967295 || c == 65535;
  2732. if (z) {
  2733. var ze = b4(data, e - 12);
  2734. z = b4(data, ze) == 0x6064B50;
  2735. if (z) {
  2736. c = b4(data, ze + 32);
  2737. o = b4(data, ze + 48);
  2738. }
  2739. }
  2740. var fltr = opts && opts.filter;
  2741. for (var i = 0; i < c; ++i) {
  2742. var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);
  2743. o = no;
  2744. if (!fltr || fltr({
  2745. name: fn,
  2746. size: sc,
  2747. originalSize: su,
  2748. compression: c_2
  2749. })) {
  2750. if (!c_2)
  2751. files[fn] = slc(data, b, b + sc);
  2752. else if (c_2 == 8)
  2753. files[fn] = inflateSync(data.subarray(b, b + sc), new u8(su));
  2754. else
  2755. err(14, 'unknown compression type ' + c_2);
  2756. }
  2757. }
  2758. return files;
  2759. }
  2760. exports.unzipSync = unzipSync;
  2761. });
  2762. ;/*!node_modules/office-viewer/lib/package/ZipPackageParser.js*/
  2763. amis.define("26a08cb",(function(t,e,r,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=t("node_modules/fflate/lib/index.cjs"),o=function(){function t(){}return t.prototype.load=function(t){this.zip=i.unzipSync(new Uint8Array(t))},t.prototype.getXML=function(t){var e=this.getFileByType(t,"string"),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.getElementsByTagName("parsererror").item(0);if(n)throw new Error(n.textContent||"can't parse xml");return r},t.prototype.getFileByType=function(t,e){t=t.startsWith("/")?t.slice(1):t;var r=this.zip[t];if(r){if("string"===e)return i.strFromU8(r);if("blob"===e)return new Blob([r]);if("uint8array"===e)return r}return console.warn("getFileByType",t,"not found"),null},t.prototype.fileExists=function(t){return(t=t.startsWith("/")?t.slice(1):t)in this.zip},t.prototype.generateZip=function(t){return this.zip["word/document.xml"]=i.strToU8(t),new Blob([i.zipSync(this.zip)])},t}();e.default=o}));
  2764. ;/*!node_modules/office-viewer/lib/render/renderFont.js*/
  2765. amis.define("d3e304e",(function(e,n,r,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var a=e("8701f02"),l=e("8d43ec5");n.renderFont=function(e){var n,r;if(!e)return null;var t=e.fonts;if(!t||!t.length)return null;var f=l.createElement("style"),o="/** embedded fonts **/";try{for(var c=a.__values(e.fonts),u=c.next();!u.done;u=c.next()){var i=u.value,d=i.name.replace(/['\\]/g,""),s=i.url;d&&s&&(o+="\n @font-face {\n font-family: '".concat(d,"';\n src: url('").concat(s,"');\n }\n "))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return f.innerHTML=o,f}}));
  2766. ;/*!node_modules/office-viewer/lib/util/createObject.js*/
  2767. amis.define("bc7c676",(function(e,r,t,c){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02");function u(e,r){void 0===r&&(r=!0);var t=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return r&&e&&Object.keys(e).forEach((function(r){return t[r]=e[r]})),t}function a(e){var r=typeof e;return e&&"string"!==r&&"number"!==r&&"boolean"!==r&&"function"!==r&&!Array.isArray(e)}r.cloneObject=u,r.createObject=function(e,r,t){e&&Object.isFrozen(e)&&(e=u(e));var c=e?Object.create(e,n.__assign(n.__assign({},t),{__super:{value:e,writable:!1,enumerable:!1}})):Object.create(Object.prototype,t);return r&&a(r)&&Object.keys(r).forEach((function(e){return c[e]=r[e]})),c},r.isObject=a}));
  2768. ;/*!node_modules/office-viewer/lib/util/replaceVar.js*/
  2769. amis.define("741e9df",(function(e,r,t,a){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("8701f02"),l=e("bc7c676");function o(e,r,t){var a=r.textContent||"",n=e.renderOptions.evalVar;if(a.startsWith("{{")){a=a.replace(/^{{/g,"").replace(/}}$/g,"");var l=String(n(a,t))||"";r.textContent=l}}function i(e,r){var t,a,i,v,f,y,u,d,s=e.renderOptions.evalVar,x=e.renderOptions.data,h=r.parentNode,g=r.getElementsByTagName("w:tc"),m=!1,p=[];try{for(var _=n.__values(g),w=_.next();!w.done;w=_.next()){var C=w.value.getElementsByTagName("w:t");try{for(var N=(i=void 0,n.__values(C)),E=N.next();!E.done;E=N.next()){var O=($=E.value).textContent||"";if(O.startsWith("{{#")){var T=/{{#([^\}]+)}}/.exec(O);if(T&&T.length>0){m=!0;var b=T[1],B=s(b,x);Array.isArray(B)&&(p=B),$.textContent=$.textContent.replace("{{#".concat(b,"}}"),"")}}O.indexOf("{{/}}")&&($.textContent=$.textContent.replace("{{/}}",""))}}catch(e){i={error:e}}finally{try{E&&!E.done&&(v=N.return)&&v.call(N)}finally{if(i)throw i.error}}}}catch(e){t={error:e}}finally{try{w&&!w.done&&(a=_.return)&&a.call(_)}finally{if(t)throw t.error}}if(m){try{for(var V=n.__values(p),A=V.next();!A.done;A=V.next()){var j=A.value,S=c(r),W=(C=S.getElementsByTagName("w:t"),l.createObject(x,j));try{for(var M=(u=void 0,n.__values(C)),P=M.next();!P.done;P=M.next()){var $;o(e,$=P.value,W)}}catch(e){u={error:e}}finally{try{P&&!P.done&&(d=M.return)&&d.call(M)}finally{if(u)throw u.error}}h.appendChild(S)}}catch(e){f={error:e}}finally{try{A&&!A.done&&(y=V.return)&&y.call(V)}finally{if(f)throw f.error}}h.removeChild(r)}}function c(e){var r,t,a,l,o,i=e.cloneNode(!0);v(i);var c=[].slice.call(i.getElementsByTagName("w:p"));try{for(var f=n.__values(c),y=f.next();!y.done;y=f.next()){v(y.value)}}catch(e){r={error:e}}finally{try{y&&!y.done&&(t=f.return)&&t.call(f)}finally{if(r)throw r.error}}var u=[].slice.call(i.getElementsByTagName("w:cnfStyle"));try{for(var d=n.__values(u),s=d.next();!s.done;s=d.next()){var x=s.value;null===(o=x.parentElement)||void 0===o||o.removeChild(x)}}catch(e){a={error:e}}finally{try{s&&!s.done&&(l=d.return)&&l.call(d)}finally{if(a)throw a.error}}return i}function v(e){for(;e.attributes.length>0;)e.removeAttributeNode(e.attributes[0])}r.replaceT=o,r.replaceVar=function(e,r){!function(e,r){var t,a;e.renderOptions.evalVar;var l=[].slice.call(r.getElementsByTagName("w:tr"));try{for(var o=n.__values(l),c=o.next();!c.done;c=o.next())i(e,c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}}(e,r)}}));
  2770. ;/*!node_modules/office-viewer/lib/Word.js*/
  2771. amis.define("f7af913",(function(t,e,r,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t("8701f02"),s=t("23e79ad"),o=t("06bce7a"),a=t("fa6ad08"),l=t("975b67c"),d=t("08d6bdd"),p=t("1b805fe"),h=t("5c71425"),u=t("b712a63"),c=t("8d43ec5"),f=t("43be307"),m=t("239415c"),y=t("e23579e"),v=t("1bf9315"),g=t("26a08cb"),b=t("ae95200"),w=t("8b96ab3"),x=t("d3e304e"),T=t("741e9df"),_={classPrefix:"docx-viewer",inWrap:!0,bulletUseFont:!0,ignoreHeight:!0,ignoreWidth:!1,minLineHeight:1,enableVar:!1,debug:!1,printWaitTime:100,data:{},evalVar:function(t){return t}},L=function(){function t(e,r,i){void 0===i&&(i=new g.default),this.themes=[],this.styleIdMap={},this.styleIdNum=0,this.wrapClassName="docx-viewer-wrapper",this.inited=!1,i.load(e),this.id=t.globalId++,this.parser=i,this.renderOptions=n.__assign(n.__assign({},_),r)}return t.prototype.init=function(){this.inited||(this.initContentType(),this.initRelation(),this.initTheme(),this.initFontTable(),this.initStyle(),this.initNumbering(),this.inited=!0)},t.prototype.initTheme=function(){var t,e;try{for(var r=n.__values(this.conentTypes.overrides),i=r.next();!i.done;i=r.next()){var s=i.value;if(s.partName.startsWith("/word/theme")){var o=this.parser.getXML(s.partName);this.themes.push(d.parseTheme(o))}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.initStyle=function(){var t,e;try{for(var r=n.__values(this.conentTypes.overrides),i=r.next();!i.done;i=r.next()){i.value.partName.startsWith("/word/styles.xml")&&(this.styles=l.parseStyles(this,this.parser.getXML("/word/styles.xml")))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.initFontTable=function(){var t,e;try{for(var r=n.__values(this.conentTypes.overrides),i=r.next();!i.done;i=r.next()){i.value.partName.startsWith("/word/fontTable.xml")&&(this.fontTable=s.FontTable.fromXML(this,this.parser.getXML("/word/fontTable.xml")))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.initRelation=function(){var t={};this.parser.fileExists("/_rels/.rels")&&(t=o.parseRelationships(this.parser.getXML("/_rels/.rels"),"root")),this.relationships=t;var e={};this.parser.fileExists("/word/_rels/document.xml.rels")&&(e=o.parseRelationships(this.parser.getXML("/word/_rels/document.xml.rels"),"word")),this.documentRels=e;var r={};this.parser.fileExists("/word/_rels/fontTable.xml.rels")&&(r=o.parseRelationships(this.parser.getXML("/word/_rels/fontTable.xml.rels"),"word")),this.fontTableRels=r},t.prototype.initContentType=function(){var t=this.parser.getXML("[Content_Types].xml");this.conentTypes=a.parseContentType(t)},t.prototype.initNumbering=function(){var t,e;try{for(var r=n.__values(this.conentTypes.overrides),i=r.next();!i.done;i=r.next()){var s=i.value;if(s.partName.startsWith("/word/numbering")){var o=this.parser.getXML(s.partName);this.numbering=u.Numbering.fromXML(this,o)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.getRelationship=function(t){return t&&this.relationships?this.relationships[t]:null},t.prototype.getDocumentRels=function(t){return t&&this.documentRels?this.documentRels[t]:null},t.prototype.getFontTableRels=function(t){return t&&this.fontTableRels?this.fontTableRels[t]:null},t.prototype.replaceText=function(t){if(!1===this.renderOptions.enableVar)return t;var e=this.renderOptions.data;if(-1!==t.indexOf("{{")){t=t.replace(/^{{/g,"").replace(/}}$/g,"");var r=this.renderOptions.evalVar(t,e);return void 0===r?"":String(r)}return t},t.prototype.loadImage=function(t){var e=t.target;"word"===t.part&&(e="word/"+e);var r=this.parser.getFileByType(e,"blob");return r?URL.createObjectURL(r):null},t.prototype.loadFont=function(t,e){var r=this.getFontTableRels(t);if(!r)return null;var i=r.target;"word"===r.part&&(i="word/"+i);var n=this.parser.getFileByType(i,"uint8array");return n?URL.createObjectURL(new Blob([w.deobfuscate(n,e)])):null},t.prototype.getXML=function(t){return
  2772. ;/*!node_modules/office-viewer/lib/index.js*/
  2773. amis.define("472c691",(function(e,d,f,t){"use strict";Object.defineProperty(d,"__esModule",{value:!0});var a=e("f7af913"),u={Word:a.default};d.Word=a.default,d.default=u}));