From 3fab3886b74de3ebcbff8fd4d9d1c5727c7a1d24 Mon Sep 17 00:00:00 2001 From: Rick Weyrauch Date: Fri, 23 Feb 2024 19:32:10 -0800 Subject: [PATCH] Fix HH2 regression. --- dist/prettyscribe.js | 2 +- src/app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/prettyscribe.js b/dist/prettyscribe.js index a7659fe..3b3011f 100644 --- a/dist/prettyscribe.js +++ b/dist/prettyscribe.js @@ -1,2 +1,2 @@ /*! For license information please see prettyscribe.js.LICENSE.txt */ -(()=>{var e={733:(e,t,n)=>{e.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,(function(e){return i(t[s][1][e]||e)}),c,c.exports,e,t,n,r)}return n[s].exports}for(var o=void 0,s=0;s>2,a=(3&t)<<4|n>>4,l=1>6:64,c=2>4,n=(15&s)<<4|(a=o.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(l=o.indexOf(e.charAt(c++))),h[u++]=t,64!==a&&(h[u++]=n),64!==l&&(h[u++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var r=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(e){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var o=i,s=0+n;e^=-1;for(var a=0;a>>8^o[255&(e^t[a])];return-1^e}(0|t,e,e.length):function(e,t,n,r){var o=i,s=0+n;e^=-1;for(var a=0;a>>8^o[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function r(e,t){var n,r="";for(n=0;n>>=8;return r}function i(e,t,n,i,s,u){var d,h,f=e.file,p=e.compression,_=u!==a.utf8encode,m=o.transformTo("string",u(f.name)),g=o.transformTo("string",a.utf8encode(f.name)),v=f.comment,b=o.transformTo("string",u(v)),y=o.transformTo("string",a.utf8encode(v)),w=g.length!==f.name.length,C=y.length!==v.length,S="",E="",x="",k=f.dir,A=f.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var N=0;t&&(N|=8),_||!w&&!C||(N|=2048);var L=0,R=0;k&&(L|=16),"UNIX"===s?(R=798,L|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(R=20,L|=function(e){return 63&(e||0)}(f.dosPermissions)),d=A.getUTCHours(),d<<=6,d|=A.getUTCMinutes(),d<<=5,d|=A.getUTCSeconds()/2,h=A.getUTCFullYear()-1980,h<<=4,h|=A.getUTCMonth()+1,h<<=5,h|=A.getUTCDate(),w&&(E=r(1,1)+r(l(m),4)+g,S+="up"+r(E.length,2)+E),C&&(x=r(1,1)+r(l(b),4)+y,S+="uc"+r(x.length,2)+x);var O="";return O+="\n\0",O+=r(N,2),O+=p.magic,O+=r(d,2),O+=r(h,2),O+=r(T.crc32,4),O+=r(T.compressedSize,4),O+=r(T.uncompressedSize,4),O+=r(m.length,2),O+=r(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+O+m+S,dirRecord:c.CENTRAL_FILE_HEADER+r(R,2)+O+r(b.length,2)+"\0\0\0\0"+r(L,4)+r(i,4)+m+S+b}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),c=e("../signature");function u(e,t,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(u,s),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){"use strict";var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){"use strict";var r=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new o(r.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../utils");function o(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,r),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=r},{}],29:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),l=e("../external"),c=null;if(a.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function u(e,t,n){var s=t;switch(t){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=t,this._mimeType=n,r.checkSupport(s),this._worker=e.pipe(new i(s)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return function(e,t){return new l.Promise((function(n,i){var o=[],a=e._internalType,l=e._outputType,c=e._mimeType;e.on("data",(function(e,n){o.push(e),t&&t(n)})).on("error",(function(e){o=[],i(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return s.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var n,r=0,i=null,o=0;for(n=0;n>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,o,s=e.length,l=new Array(2*s);for(t=n=0;t>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(c,s),c.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;s!==t.length&&(i.uint8array?(l=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(l=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(u,s),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){"use strict";var r=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(e){return e}function l(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,c[r++]=56320|1023&i)}return l(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var o=r,s=i+n;e^=-1;for(var a=i;a>>8^o[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){"use strict";var r,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),l=e("./messages"),c=-2,u=258,d=262,h=113;function f(e,t){return e.msg=l[t],t}function p(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function g(e,t){o._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,m(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function y(e,t){var n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,c=e.window,h=e.w_mask,f=e.prev,p=e.strstart+u,_=c[o+s-1],m=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+s]===m&&c[n+s-1]===_&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function w(e){var t,n,r,o,l,c,u,h,f,p,_=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=_+(_-d)){for(i.arraySet(e.window,e.window,_,_,0),e.match_start-=_,e.strstart-=_,e.block_start-=_,t=n=e.hash_size;r=e.head[--t],e.head[t]=_<=r?r-_:0,--n;);for(t=n=_;r=e.prev[--t],e.prev[t]=_<=r?r-_:0,--n;);o+=_}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,h=e.strstart+e.lookahead,p=void 0,(f=o)<(p=c.avail_in)&&(p=f),n=0===p?0:(c.avail_in-=p,i.arraySet(u,c.input,c.next_in,p,h),1===c.state.wrap?c.adler=s(c.adler,u,p,h):2===c.state.wrap&&(c.adler=a(c.adler,u,p,h)),c.next_in+=p,c.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-3,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(w(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,g(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(g(e,!1),e.strm.avail_out),1)})),new E(4,4,8,4,C),new E(4,5,16,8,C),new E(4,6,32,32,C),new E(4,4,16,16,S),new E(8,16,32,32,S),new E(8,16,128,128,S),new E(8,32,128,256,S),new E(32,128,258,1024,S),new E(32,258,258,4096,S)],n.deflateInit=function(e,t){return T(e,t,8,15,8,0)},n.deflateInit2=T,n.deflateReset=A,n.deflateResetKeep=k,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?c:(e.state.gzhead=t,0):c},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5>8&255),v(i,i.gzhead.time>>16&255),v(i,i.gzhead.time>>24&255),v(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),v(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(v(i,255&i.gzhead.extra.length),v(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(v(i,0),v(i,0),v(i,0),v(i,0),v(i,0),v(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),v(i,3),i.status=h);else{var d=8+(i.w_bits-8<<4)<<8;d|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(d|=32),d+=31-d%31,i.status=h,b(i,d),0!==i.strstart&&(b(i,e.adler>>>16),b(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending!==i.pending_buf_size));)v(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),m(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&m(e),i.pending+2<=i.pending_buf_size&&(v(i,255&e.adler),v(i,e.adler>>8&255),e.adler=0,i.status=h)):i.status=h),0!==i.pending){if(m(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(n)&&4!==t)return f(e,-5);if(666===i.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var y=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=u){if(w(e),e.lookahead<=u&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=o._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(g(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(g(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(g(e,!1),0===e.strm.avail_out)?1:2}(i,t):r[i.level].func(i,t);if(3!==y&&4!==y||(i.status=666),1===y||3===y)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===y&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(_(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),m(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(v(i,255&e.adler),v(i,e.adler>>8&255),v(i,e.adler>>16&255),v(i,e.adler>>24&255),v(i,255&e.total_in),v(i,e.total_in>>8&255),v(i,e.total_in>>16&255),v(i,e.total_in>>24&255)):(b(i,e.adler>>>16),b(i,65535&e.adler)),m(e),0=n.w_size&&(0===a&&(_(n.head),n.strstart=0,n.block_start=0,n.insert=0),h=new i.Buf8(n.w_size),i.arraySet(h,t,f-n.w_size,n.w_size,0),t=h,f=n.w_size),l=e.avail_in,u=e.next_in,d=e.input,e.avail_in=f,e.next_in=0,e.input=t,w(n);n.lookahead>=3;){for(r=n.strstart,o=n.lookahead-2;n.ins_h=(n.ins_h<>>=y=b>>>24,p-=y,0==(y=b>>>16&255))k[o++]=65535&b;else{if(!(16&y)){if(0==(64&y)){b=_[(65535&b)+(f&(1<>>=y,p-=y),p<15&&(f+=x[r++]<>>=y=b>>>24,p-=y,!(16&(y=b>>>16&255))){if(0==(64&y)){b=m[(65535&b)+(f&(1<>>=y,p-=y,(y=o-s)>3,f&=(1<<(p-=w<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(852),t.distcode=t.distdyn=new r.Buf32(592),t.sane=1,t.back=-1,0):l}function h(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):l}function f(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(r.arraySet(s.window,t,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,t,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,t,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,n.check=o(n.check,B,2,0),g=m=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",n.mode=30;break}if(g-=4,R=8+(15&(m>>>=4)),0===n.wbits)n.wbits=R;else if(R>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(B[0]=255&m,B[1]=m>>>8&255,n.check=o(n.check,B,2,0)),g=m=0,n.mode=3;case 3:for(;g<32;){if(0===p)break e;p--,m+=u[h++]<>>8&255,B[2]=m>>>16&255,B[3]=m>>>24&255,n.check=o(n.check,B,4,0)),g=m=0,n.mode=4;case 4:for(;g<16;){if(0===p)break e;p--,m+=u[h++]<>8),512&n.flags&&(B[0]=255&m,B[1]=m>>>8&255,n.check=o(n.check,B,2,0)),g=m=0,n.mode=5;case 5:if(1024&n.flags){for(;g<16;){if(0===p)break e;p--,m+=u[h++]<>>8&255,n.check=o(n.check,B,2,0)),g=m=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(p<(C=n.length)&&(C=p),C&&(n.head&&(R=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,u,h,C,R)),512&n.flags&&(n.check=o(n.check,u,C,h)),p-=C,h+=C,n.length-=C),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===p)break e;for(C=0;R=u[h+C++],n.head&&R&&n.length<65536&&(n.head.name+=String.fromCharCode(R)),R&&C>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;g<32;){if(0===p)break e;p--,m+=u[h++]<>>=7&g,g-=7&g,n.mode=27;break}for(;g<3;){if(0===p)break e;p--,m+=u[h++]<>>=1)){case 0:n.mode=14;break;case 1:if(v(n),n.mode=20,6!==t)break;m>>>=2,g-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}m>>>=2,g-=2;break;case 14:for(m>>>=7&g,g-=7&g;g<32;){if(0===p)break e;p--,m+=u[h++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&m,g=m=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(C=n.length){if(p>>=5,g-=5,n.ndist=1+(31&m),m>>>=5,g-=5,n.ncode=4+(15&m),m>>>=4,g-=4,286>>=3,g-=3}for(;n.have<19;)n.lens[P[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,W={bits:n.lenbits},O=a(0,n.lens,0,19,n.lencode,0,n.work,W),n.lenbits=W.bits,O){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,A=65535&I,!((x=I>>>24)<=g);){if(0===p)break e;p--,m+=u[h++]<>>=x,g-=x,n.lens[n.have++]=A;else{if(16===A){for(z=x+2;g>>=x,g-=x,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}R=n.lens[n.have-1],C=3+(3&m),m>>>=2,g-=2}else if(17===A){for(z=x+3;g>>=x)),m>>>=3,g-=3}else{for(z=x+7;g>>=x)),m>>>=7,g-=7}if(n.have+C>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;C--;)n.lens[n.have++]=R}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,W={bits:n.lenbits},O=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,W),n.lenbits=W.bits,O){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,W={bits:n.distbits},O=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,W),n.distbits=W.bits,O){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=p&&258<=_){e.next_out=f,e.avail_out=_,e.next_in=h,e.avail_in=p,n.hold=m,n.bits=g,s(e,w),f=e.next_out,d=e.output,_=e.avail_out,h=e.next_in,u=e.input,p=e.avail_in,m=n.hold,g=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;k=(I=n.lencode[m&(1<>>16&255,A=65535&I,!((x=I>>>24)<=g);){if(0===p)break e;p--,m+=u[h++]<>T)])>>>16&255,A=65535&I,!(T+(x=I>>>24)<=g);){if(0===p)break e;p--,m+=u[h++]<>>=T,g-=T,n.back+=T}if(m>>>=x,g-=x,n.back+=x,n.length=A,0===k){n.mode=26;break}if(32&k){n.back=-1,n.mode=12;break}if(64&k){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&k,n.mode=22;case 22:if(n.extra){for(z=n.extra;g>>=n.extra,g-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;k=(I=n.distcode[m&(1<>>16&255,A=65535&I,!((x=I>>>24)<=g);){if(0===p)break e;p--,m+=u[h++]<>T)])>>>16&255,A=65535&I,!(T+(x=I>>>24)<=g);){if(0===p)break e;p--,m+=u[h++]<>>=T,g-=T,n.back+=T}if(m>>>=x,g-=x,n.back+=x,64&k){e.msg="invalid distance code",n.mode=30;break}n.offset=A,n.extra=15&k,n.mode=24;case 24:if(n.extra){for(z=n.extra;g>>=n.extra,g-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===_)break e;if(C=w-_,n.offset>C){if((C=n.offset-C)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}S=C>n.wnext?(C-=n.wnext,n.wsize-C):n.wnext-C,C>n.length&&(C=n.length),E=n.window}else E=d,S=f-n.offset,C=n.length;for(_v?(y=P[M+d[E]],W[z+d[E]]):(y=96,0),f=1<>N)+(p-=f)]=b<<24|y<<16|w|0,0!==p;);for(f=1<>=1;if(0!==f?(O&=f-1,O+=f):O=0,E++,0==--I[S]){if(S===k)break;S=t[n+d[E]]}if(A>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function N(e,t,n){var r,i,o=new Array(16),s=0;for(r=1;r<=l;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=T(o[a]++,a))}}function L(e){var t;for(t=0;t>1;1<=n;n--)W(e,o,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,o[2*i]=o[2*n]+o[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,o[2*n+1]=o[2*r+1]=i,e.heap[1]=i++,W(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,o,s,a,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,m=0;for(o=0;o<=l;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)_<(o=c[2*c[2*(r=e.heap[n])+1]+1]+1)&&(o=_,m++),c[2*r+1]=o,u>=7;r>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==t?U(e,t,n,r):4===e.strategy||s===i?(k(e,2+(r?1:0),3),z(e,f,p)):(k(e,4+(r?1:0),3),function(e,t,n,r){var i;for(k(e,t-257,5),k(e,n-1,5),k(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(m[n]+o+1)]++,e.dyn_dtree[2*E(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){k(e,2,3),A(e,256,f),function(e){16===e.bi_valid?(x(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,r,i,o,s=1,a={},l=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){h(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){i.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r"']/g,$=RegExp(V.source),X=RegExp(Y.source),G=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,_e=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,ye=/['\n\r\u2028\u2029\\]/g,we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ee="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="["+Ee+"]",ke="["+we+"]",Ae="\\d+",Te="["+Ce+"]",Ne="[^\\ud800-\\udfff"+Ee+Ae+"\\u2700-\\u27bf"+Ce+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",Re="[^\\ud800-\\udfff]",Oe="(?:\\ud83c[\\udde6-\\uddff]){2}",We="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Ie="(?:"+Te+"|"+Ne+")",Be="(?:"+ze+"|"+Ne+")",Pe="(?:['’](?:d|ll|m|re|s|t|ve))?",Me="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ue="(?:"+ke+"|"+Le+")?",De="[\\ufe0e\\ufe0f]?",Fe=De+Ue+"(?:\\u200d(?:"+[Re,Oe,We].join("|")+")"+De+Ue+")*",qe="(?:"+["[\\u2700-\\u27bf]",Oe,We].join("|")+")"+Fe,He="(?:"+[Re+ke+"?",ke,Oe,We,"[\\ud800-\\udfff]"].join("|")+")",je=RegExp("['’]","g"),Ve=RegExp(ke,"g"),Ye=RegExp(Le+"(?="+Le+")|"+He+Fe,"g"),$e=RegExp([ze+"?"+Te+"+"+Pe+"(?="+[xe,ze,"$"].join("|")+")",Be+"+"+Me+"(?="+[xe,ze+Ie,"$"].join("|")+")",ze+"?"+Ie+"+"+Pe,ze+"+"+Me,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ae,qe].join("|"),"g"),Xe=RegExp("[\\u200d\\ud800-\\udfff"+we+"\\ufe0e\\ufe0f]"),Ge=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Je=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ze=-1,Ke={};Ke[W]=Ke[z]=Ke[I]=Ke[B]=Ke[P]=Ke[M]=Ke[U]=Ke[D]=Ke[F]=!0,Ke[_]=Ke[m]=Ke[R]=Ke[g]=Ke[O]=Ke[v]=Ke[b]=Ke[y]=Ke[C]=Ke[S]=Ke[E]=Ke[k]=Ke[A]=Ke[T]=Ke[L]=!1;var Qe={};Qe[_]=Qe[m]=Qe[R]=Qe[O]=Qe[g]=Qe[v]=Qe[W]=Qe[z]=Qe[I]=Qe[B]=Qe[P]=Qe[C]=Qe[S]=Qe[E]=Qe[k]=Qe[A]=Qe[T]=Qe[N]=Qe[M]=Qe[U]=Qe[D]=Qe[F]=!0,Qe[b]=Qe[y]=Qe[L]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,nt=parseInt,rt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,it="object"==typeof self&&self&&self.Object===Object&&self,ot=rt||it||Function("return this")(),st=t&&!t.nodeType&&t,at=st&&e&&!e.nodeType&&e,lt=at&&at.exports===st,ct=lt&&rt.process,ut=function(){try{return at&&at.require&&at.require("util").types||ct&&ct.binding&&ct.binding("util")}catch(e){}}(),dt=ut&&ut.isArrayBuffer,ht=ut&&ut.isDate,ft=ut&&ut.isMap,pt=ut&&ut.isRegExp,_t=ut&&ut.isSet,mt=ut&&ut.isTypedArray;function gt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Et(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function $t(e,t){for(var n=e.length;n--&&Wt(t,e[n],0)>-1;);return n}function Xt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Gt=Mt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Jt=Mt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Zt(e){return"\\"+et[e]}function Kt(e){return Xe.test(e)}function Qt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function en(e,t){return function(n){return e(t(n))}}function tn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),cn=function e(t){var n,r=(t=null==t?ot:cn.defaults(ot.Object(),t,cn.pick(ot,Je))).Array,ie=t.Date,we=t.Error,Ce=t.Function,Se=t.Math,Ee=t.Object,xe=t.RegExp,ke=t.String,Ae=t.TypeError,Te=r.prototype,Ne=Ce.prototype,Le=Ee.prototype,Re=t["__core-js_shared__"],Oe=Ne.toString,We=Le.hasOwnProperty,ze=0,Ie=(n=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Be=Le.toString,Pe=Oe.call(Ee),Me=ot._,Ue=xe("^"+Oe.call(We).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=lt?t.Buffer:i,Fe=t.Symbol,qe=t.Uint8Array,He=De?De.allocUnsafe:i,Ye=en(Ee.getPrototypeOf,Ee),Xe=Ee.create,et=Le.propertyIsEnumerable,rt=Te.splice,it=Fe?Fe.isConcatSpreadable:i,st=Fe?Fe.iterator:i,at=Fe?Fe.toStringTag:i,ct=function(){try{var e=co(Ee,"defineProperty");return e({},"",{}),e}catch(e){}}(),ut=t.clearTimeout!==ot.clearTimeout&&t.clearTimeout,Lt=ie&&ie.now!==ot.Date.now&&ie.now,Mt=t.setTimeout!==ot.setTimeout&&t.setTimeout,un=Se.ceil,dn=Se.floor,hn=Ee.getOwnPropertySymbols,fn=De?De.isBuffer:i,pn=t.isFinite,_n=Te.join,mn=en(Ee.keys,Ee),gn=Se.max,vn=Se.min,bn=ie.now,yn=t.parseInt,wn=Se.random,Cn=Te.reverse,Sn=co(t,"DataView"),En=co(t,"Map"),xn=co(t,"Promise"),kn=co(t,"Set"),An=co(t,"WeakMap"),Tn=co(Ee,"create"),Nn=An&&new An,Ln={},Rn=Uo(Sn),On=Uo(En),Wn=Uo(xn),zn=Uo(kn),In=Uo(An),Bn=Fe?Fe.prototype:i,Pn=Bn?Bn.valueOf:i,Mn=Bn?Bn.toString:i;function Un(e){if(na(e)&&!Vs(e)&&!(e instanceof Hn)){if(e instanceof qn)return e;if(We.call(e,"__wrapped__"))return Do(e)}return new qn(e)}var Dn=function(){function e(){}return function(t){if(!ta(t))return{};if(Xe)return Xe(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Fn(){}function qn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,s){var a,l=1&t,c=2&t,u=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!ta(e))return e;var d=Vs(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&We.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,a)}else{var h=fo(e),f=h==y||h==w;if(Gs(e))return wi(e,l);if(h==E||h==_||f&&!o){if(a=c||f?{}:_o(e),!l)return c?function(e,t){return Ti(e,ho(e),t)}(e,function(e,t){return e&&Ti(t,Wa(t),e)}(a,e)):function(e,t){return Ti(e,uo(e),t)}(e,rr(a,e))}else{if(!Qe[h])return o?e:{};a=function(e,t,n){var r,i=e.constructor;switch(t){case R:return Ci(e);case g:case v:return new i(+e);case O:return function(e,t){var n=t?Ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case W:case z:case I:case B:case P:case M:case U:case D:case F:return Si(e,n);case C:return new i;case S:case T:return new i(e);case k:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case N:return r=e,Pn?Ee(Pn.call(r)):{}}}(e,h,l)}}s||(s=new Xn);var p=s.get(e);if(p)return p;s.set(e,a),aa(e)?e.forEach((function(r){a.add(ar(r,t,n,r,e,s))})):ra(e)&&e.forEach((function(r,i){a.set(i,ar(r,t,n,i,e,s))}));var m=d?i:(u?c?no:to:c?Wa:Oa)(e);return bt(m||e,(function(r,i){m&&(r=e[i=r]),er(a,i,ar(r,t,n,i,e,s))})),a}function lr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ee(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function cr(e,t,n){if("function"!=typeof e)throw new Ae(o);return Lo((function(){e.apply(i,n)}),t)}function ur(e,t,n,r){var i=-1,o=St,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=xt(t,Ht(n))),r?(o=Et,s=!1):t.length>=200&&(o=Vt,s=!1,t=new $n(t));e:for(;++i-1},Vn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Yn.prototype.clear=function(){this.size=0,this.__data__={hash:new jn,map:new(En||Vn),string:new jn}},Yn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Yn.prototype.get=function(e){return ao(this,e).get(e)},Yn.prototype.has=function(e){return ao(this,e).has(e)},Yn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},$n.prototype.add=$n.prototype.push=function(e){return this.__data__.set(e,s),this},$n.prototype.has=function(e){return this.__data__.has(e)},Xn.prototype.clear=function(){this.__data__=new Vn,this.size=0},Xn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Xn.prototype.get=function(e){return this.__data__.get(e)},Xn.prototype.has=function(e){return this.__data__.has(e)},Xn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Vn){var r=n.__data__;if(!En||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Yn(r)}return n.set(e,t),this.size=n.size,this};var dr=Ri(br),hr=Ri(yr,!0);function fr(e,t){var n=!0;return dr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function pr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?mr(a,t-1,n,r,i):kt(i,a):r||(i[i.length]=a)}return i}var gr=Oi(),vr=Oi(!0);function br(e,t){return e&&gr(e,t,Oa)}function yr(e,t){return e&&vr(e,t,Oa)}function wr(e,t){return Ct(t,(function(t){return Ks(e[t])}))}function Cr(e,t){for(var n=0,r=(t=gi(t,e)).length;null!=e&&nt}function kr(e,t){return null!=e&&We.call(e,t)}function Ar(e,t){return null!=e&&t in Ee(e)}function Tr(e,t,n){for(var o=n?Et:St,s=e[0].length,a=e.length,l=a,c=r(a),u=1/0,d=[];l--;){var h=e[l];l&&t&&(h=xt(h,Ht(t))),u=vn(h.length,u),c[l]=!n&&(t||s>=120&&h.length>=120)?new $n(l&&h):i}h=e[0];var f=-1,p=c[0];e:for(;++f=a?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Hr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&rt.call(a,l,1),rt.call(e,l,1);return e}function Vr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;go(i)?rt.call(e,i,1):ci(e,i)}}return e}function Yr(e,t){return e+dn(wn()*(t-e+1))}function $r(e,t){var n="";if(!e||t<1||t>d)return n;do{t%2&&(n+=e),(t=dn(t/2))&&(e+=e)}while(t);return n}function Xr(e,t){return Ro(xo(e,t,il),e+"")}function Gr(e){return Jn(Fa(e))}function Jr(e,t){var n=Fa(e);return zo(n,sr(t,0,n.length))}function Zr(e,t,n,r){if(!ta(e))return e;for(var o=-1,s=(t=gi(t,e)).length,a=s-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i>>1,s=e[o];null!==s&&!ca(s)&&(n?s<=t:s=200){var c=t?null:$i(e);if(c)return nn(c);s=!1,i=Vt,l=new $n}else l=t?[]:a;e:for(;++r=r?e:ti(e,t,n)}var yi=ut||function(e){return ot.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=He?He(n):new e.constructor(n);return e.copy(r),r}function Ci(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function Si(e,t){var n=t?Ci(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ei(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,s=ca(e),a=t!==i,l=null===t,c=t==t,u=ca(t);if(!l&&!u&&!s&&e>t||s&&a&&c&&!l&&!u||r&&a&&c||!n&&c||!o)return 1;if(!r&&!s&&!u&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&vo(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Ee(t);++r-1?o[s?t[a]:a]:i}}function Pi(e){return eo((function(t){var n=t.length,r=n,s=qn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Ae(o);if(s&&!l&&"wrapper"==io(a))var l=new qn([],!0)}for(r=l?r:n;++r1&&b.reverse(),f&&dl))return!1;var u=s.get(e),d=s.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&n?new $n:i;for(s.set(e,t),s.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return bt(p,(function(n){var r="_."+n[0];t&n[1]&&!St(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(r),n)))}function Wo(e){var t=0,n=0;return function(){var r=bn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function zo(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ss(e,n)}));function fs(e){var t=Un(e);return t.__chain__=!0,t}function ps(e,t){return t(e)}var _s=eo((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Hn&&go(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:ps,args:[o],thisArg:i}),new qn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ms=Ni((function(e,t,n){We.call(e,n)?++e[n]:ir(e,n,1)})),gs=Bi(jo),vs=Bi(Vo);function bs(e,t){return(Vs(e)?bt:dr)(e,so(t,3))}function ys(e,t){return(Vs(e)?yt:hr)(e,so(t,3))}var ws=Ni((function(e,t,n){We.call(e,n)?e[n].push(t):ir(e,n,[t])})),Cs=Xr((function(e,t,n){var i=-1,o="function"==typeof t,s=$s(e)?r(e.length):[];return dr(e,(function(e){s[++i]=o?gt(t,e,n):Nr(e,t,n)})),s})),Ss=Ni((function(e,t,n){ir(e,n,t)}));function Es(e,t){return(Vs(e)?xt:Pr)(e,so(t,3))}var xs=Ni((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ks=Xr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&vo(e,t[0],t[1])?t=[]:n>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),qr(e,mr(t,1),[])})),As=Lt||function(){return ot.Date.now()};function Ts(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Gi(e,c,i,i,i,i,t)}function Ns(e,t){var n;if("function"!=typeof t)throw new Ae(o);return e=_a(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ls=Xr((function(e,t,n){var r=1;if(n.length){var i=tn(n,oo(Ls));r|=l}return Gi(e,r,t,n,i)})),Rs=Xr((function(e,t,n){var r=3;if(n.length){var i=tn(n,oo(Rs));r|=l}return Gi(t,r,e,n,i)}));function Os(e,t,n){var r,s,a,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ae(o);function _(t){var n=r,o=s;return r=s=i,d=t,l=e.apply(o,n)}function m(e){return d=e,c=Lo(v,t),h?_(e):l}function g(e){var n=e-u;return u===i||n>=t||n<0||f&&e-d>=a}function v(){var e=As();if(g(e))return b(e);c=Lo(v,function(e){var n=t-(e-u);return f?vn(n,a-(e-d)):n}(e))}function b(e){return c=i,p&&r?_(e):(r=s=i,l)}function y(){var e=As(),n=g(e);if(r=arguments,s=this,u=e,n){if(c===i)return m(u);if(f)return yi(c),c=Lo(v,t),_(u)}return c===i&&(c=Lo(v,t)),l}return t=ga(t)||0,ta(n)&&(h=!!n.leading,a=(f="maxWait"in n)?gn(ga(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),y.cancel=function(){c!==i&&yi(c),d=0,r=u=s=c=i},y.flush=function(){return c===i?l:b(As())},y}var Ws=Xr((function(e,t){return cr(e,1,t)})),zs=Xr((function(e,t,n){return cr(e,ga(t)||0,n)}));function Is(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Is.Cache||Yn),n}function Bs(e){if("function"!=typeof e)throw new Ae(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Is.Cache=Yn;var Ps=vi((function(e,t){var n=(t=1==t.length&&Vs(t[0])?xt(t[0],Ht(so())):xt(mr(t,1),Ht(so()))).length;return Xr((function(r){for(var i=-1,o=vn(r.length,n);++i=t})),js=Lr(function(){return arguments}())?Lr:function(e){return na(e)&&We.call(e,"callee")&&!et.call(e,"callee")},Vs=r.isArray,Ys=dt?Ht(dt):function(e){return na(e)&&Er(e)==R};function $s(e){return null!=e&&ea(e.length)&&!Ks(e)}function Xs(e){return na(e)&&$s(e)}var Gs=fn||gl,Js=ht?Ht(ht):function(e){return na(e)&&Er(e)==v};function Zs(e){if(!na(e))return!1;var t=Er(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!oa(e)}function Ks(e){if(!ta(e))return!1;var t=Er(e);return t==y||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Qs(e){return"number"==typeof e&&e==_a(e)}function ea(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function ta(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ra=ft?Ht(ft):function(e){return na(e)&&fo(e)==C};function ia(e){return"number"==typeof e||na(e)&&Er(e)==S}function oa(e){if(!na(e)||Er(e)!=E)return!1;var t=Ye(e);if(null===t)return!0;var n=We.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==Pe}var sa=pt?Ht(pt):function(e){return na(e)&&Er(e)==k},aa=_t?Ht(_t):function(e){return na(e)&&fo(e)==A};function la(e){return"string"==typeof e||!Vs(e)&&na(e)&&Er(e)==T}function ca(e){return"symbol"==typeof e||na(e)&&Er(e)==N}var ua=mt?Ht(mt):function(e){return na(e)&&ea(e.length)&&!!Ke[Er(e)]},da=ji(Br),ha=ji((function(e,t){return e<=t}));function fa(e){if(!e)return[];if($s(e))return la(e)?sn(e):Ai(e);if(st&&e[st])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[st]());var t=fo(e);return(t==C?Qt:t==A?nn:Fa)(e)}function pa(e){return e?(e=ga(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function _a(e){var t=pa(e),n=t%1;return t==t?n?t-n:t:0}function ma(e){return e?sr(_a(e),0,f):0}function ga(e){if("number"==typeof e)return e;if(ca(e))return h;if(ta(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ta(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=pe.test(e);return n||me.test(e)?nt(e.slice(2),n?2:8):fe.test(e)?h:+e}function va(e){return Ti(e,Wa(e))}function ba(e){return null==e?"":ai(e)}var ya=Li((function(e,t){if(Co(t)||$s(t))Ti(t,Oa(t),e);else for(var n in t)We.call(t,n)&&er(e,n,t[n])})),wa=Li((function(e,t){Ti(t,Wa(t),e)})),Ca=Li((function(e,t,n,r){Ti(t,Wa(t),e,r)})),Sa=Li((function(e,t,n,r){Ti(t,Oa(t),e,r)})),Ea=eo(or),xa=Xr((function(e,t){e=Ee(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&vo(t[0],t[1],o)&&(r=1);++n1),t})),Ti(e,no(e),n),r&&(n=ar(n,7,Ki));for(var i=t.length;i--;)ci(n,t[i]);return n})),Pa=eo((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return Ta(e,n)}))}(e,t)}));function Ma(e,t){if(null==e)return{};var n=xt(no(e),(function(e){return[e]}));return t=so(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Ua=Xi(Oa),Da=Xi(Wa);function Fa(e){return null==e?[]:jt(e,Oa(e))}var qa=zi((function(e,t,n){return t=t.toLowerCase(),e+(n?Ha(t):t)}));function Ha(e){return Za(ba(e).toLowerCase())}function ja(e){return(e=ba(e))&&e.replace(ve,Gt).replace(Ve,"")}var Va=zi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ya=zi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),$a=Wi("toLowerCase"),Xa=zi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ga=zi((function(e,t,n){return e+(n?" ":"")+Za(t)})),Ja=zi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Za=Wi("toUpperCase");function Ka(e,t,n){return e=ba(e),(t=n?i:t)===i?function(e){return Ge.test(e)}(e)?function(e){return e.match($e)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Qa=Xr((function(e,t){try{return gt(e,i,t)}catch(e){return Zs(e)?e:new we(e)}})),el=eo((function(e,t){return bt(t,(function(t){t=Mo(t),ir(e,t,Ls(e[t],e))})),e}));function tl(e){return function(){return e}}var nl=Pi(),rl=Pi(!0);function il(e){return e}function ol(e){return zr("function"==typeof e?e:ar(e,1))}var sl=Xr((function(e,t){return function(n){return Nr(n,e,t)}})),al=Xr((function(e,t){return function(n){return Nr(e,n,t)}}));function ll(e,t,n){var r=Oa(t),i=wr(t,r);null!=n||ta(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=wr(t,Oa(t)));var o=!(ta(n)&&"chain"in n&&!n.chain),s=Ks(e);return bt(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=Ai(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function cl(){}var ul=Fi(xt),dl=Fi(wt),hl=Fi(Nt);function fl(e){return bo(e)?Pt(Mo(e)):function(e){return function(t){return Cr(t,e)}}(e)}var pl=Hi(),_l=Hi(!0);function ml(){return[]}function gl(){return!1}var vl,bl=Di((function(e,t){return e+t}),0),yl=Yi("ceil"),wl=Di((function(e,t){return e/t}),1),Cl=Yi("floor"),Sl=Di((function(e,t){return e*t}),1),El=Yi("round"),xl=Di((function(e,t){return e-t}),0);return Un.after=function(e,t){if("function"!=typeof t)throw new Ae(o);return e=_a(e),function(){if(--e<1)return t.apply(this,arguments)}},Un.ary=Ts,Un.assign=ya,Un.assignIn=wa,Un.assignInWith=Ca,Un.assignWith=Sa,Un.at=Ea,Un.before=Ns,Un.bind=Ls,Un.bindAll=el,Un.bindKey=Rs,Un.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Vs(e)?e:[e]},Un.chain=fs,Un.chunk=function(e,t,n){t=(n?vo(e,t,n):t===i)?1:gn(_a(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,l=r(un(o/t));so?0:o+n),(r=r===i||r>o?o:_a(r))<0&&(r+=o),r=n>r?0:ma(r);n>>0)?(e=ba(e))&&("string"==typeof t||null!=t&&!sa(t))&&!(t=ai(t))&&Kt(e)?bi(sn(e),0,n):e.split(t,n):[]},Un.spread=function(e,t){if("function"!=typeof e)throw new Ae(o);return t=null==t?0:gn(_a(t),0),Xr((function(n){var r=n[t],i=bi(n,0,t);return r&&kt(i,r),gt(e,this,i)}))},Un.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Un.take=function(e,t,n){return e&&e.length?ti(e,0,(t=n||t===i?1:_a(t))<0?0:t):[]},Un.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ti(e,(t=r-(t=n||t===i?1:_a(t)))<0?0:t,r):[]},Un.takeRightWhile=function(e,t){return e&&e.length?di(e,so(t,3),!1,!0):[]},Un.takeWhile=function(e,t){return e&&e.length?di(e,so(t,3)):[]},Un.tap=function(e,t){return t(e),e},Un.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ae(o);return ta(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Os(e,t,{leading:r,maxWait:t,trailing:i})},Un.thru=ps,Un.toArray=fa,Un.toPairs=Ua,Un.toPairsIn=Da,Un.toPath=function(e){return Vs(e)?xt(e,Mo):ca(e)?[e]:Ai(Po(ba(e)))},Un.toPlainObject=va,Un.transform=function(e,t,n){var r=Vs(e),i=r||Gs(e)||ua(e);if(t=so(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ta(e)&&Ks(o)?Dn(Ye(e)):{}}return(i?bt:br)(e,(function(e,r,i){return t(n,e,r,i)})),n},Un.unary=function(e){return Ts(e,1)},Un.union=ns,Un.unionBy=rs,Un.unionWith=is,Un.uniq=function(e){return e&&e.length?li(e):[]},Un.uniqBy=function(e,t){return e&&e.length?li(e,so(t,2)):[]},Un.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?li(e,i,t):[]},Un.unset=function(e,t){return null==e||ci(e,t)},Un.unzip=os,Un.unzipWith=ss,Un.update=function(e,t,n){return null==e?e:ui(e,t,mi(n))},Un.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:ui(e,t,mi(n),r)},Un.values=Fa,Un.valuesIn=function(e){return null==e?[]:jt(e,Wa(e))},Un.without=as,Un.words=Ka,Un.wrap=function(e,t){return Ms(mi(t),e)},Un.xor=ls,Un.xorBy=cs,Un.xorWith=us,Un.zip=ds,Un.zipObject=function(e,t){return pi(e||[],t||[],er)},Un.zipObjectDeep=function(e,t){return pi(e||[],t||[],Zr)},Un.zipWith=hs,Un.entries=Ua,Un.entriesIn=Da,Un.extend=wa,Un.extendWith=Ca,ll(Un,Un),Un.add=bl,Un.attempt=Qa,Un.camelCase=qa,Un.capitalize=Ha,Un.ceil=yl,Un.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ga(n))==n?n:0),t!==i&&(t=(t=ga(t))==t?t:0),sr(ga(e),t,n)},Un.clone=function(e){return ar(e,4)},Un.cloneDeep=function(e){return ar(e,5)},Un.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Un.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Un.conformsTo=function(e,t){return null==t||lr(e,t,Oa(t))},Un.deburr=ja,Un.defaultTo=function(e,t){return null==e||e!=e?t:e},Un.divide=wl,Un.endsWith=function(e,t,n){e=ba(e),t=ai(t);var r=e.length,o=n=n===i?r:sr(_a(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Un.eq=Fs,Un.escape=function(e){return(e=ba(e))&&X.test(e)?e.replace(Y,Jt):e},Un.escapeRegExp=function(e){return(e=ba(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Un.every=function(e,t,n){var r=Vs(e)?wt:fr;return n&&vo(e,t,n)&&(t=i),r(e,so(t,3))},Un.find=gs,Un.findIndex=jo,Un.findKey=function(e,t){return Rt(e,so(t,3),br)},Un.findLast=vs,Un.findLastIndex=Vo,Un.findLastKey=function(e,t){return Rt(e,so(t,3),yr)},Un.floor=Cl,Un.forEach=bs,Un.forEachRight=ys,Un.forIn=function(e,t){return null==e?e:gr(e,so(t,3),Wa)},Un.forInRight=function(e,t){return null==e?e:vr(e,so(t,3),Wa)},Un.forOwn=function(e,t){return e&&br(e,so(t,3))},Un.forOwnRight=function(e,t){return e&&yr(e,so(t,3))},Un.get=Aa,Un.gt=qs,Un.gte=Hs,Un.has=function(e,t){return null!=e&&po(e,t,kr)},Un.hasIn=Ta,Un.head=$o,Un.identity=il,Un.includes=function(e,t,n,r){e=$s(e)?e:Fa(e),n=n&&!r?_a(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),la(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Wt(e,t,n)>-1},Un.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:_a(n);return i<0&&(i=gn(r+i,0)),Wt(e,t,i)},Un.inRange=function(e,t,n){return t=pa(t),n===i?(n=t,t=0):n=pa(n),function(e,t,n){return e>=vn(t,n)&&e=-9007199254740991&&e<=d},Un.isSet=aa,Un.isString=la,Un.isSymbol=ca,Un.isTypedArray=ua,Un.isUndefined=function(e){return e===i},Un.isWeakMap=function(e){return na(e)&&fo(e)==L},Un.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Er(e)},Un.join=function(e,t){return null==e?"":_n.call(e,t)},Un.kebabCase=Va,Un.last=Zo,Un.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=_a(n))<0?gn(r+o,0):vn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Ot(e,It,o,!0)},Un.lowerCase=Ya,Un.lowerFirst=$a,Un.lt=da,Un.lte=ha,Un.max=function(e){return e&&e.length?pr(e,il,xr):i},Un.maxBy=function(e,t){return e&&e.length?pr(e,so(t,2),xr):i},Un.mean=function(e){return Bt(e,il)},Un.meanBy=function(e,t){return Bt(e,so(t,2))},Un.min=function(e){return e&&e.length?pr(e,il,Br):i},Un.minBy=function(e,t){return e&&e.length?pr(e,so(t,2),Br):i},Un.stubArray=ml,Un.stubFalse=gl,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=Sl,Un.nth=function(e,t){return e&&e.length?Fr(e,_a(t)):i},Un.noConflict=function(){return ot._===this&&(ot._=Me),this},Un.noop=cl,Un.now=As,Un.pad=function(e,t,n){e=ba(e);var r=(t=_a(t))?on(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return qi(dn(i),n)+e+qi(un(i),n)},Un.padEnd=function(e,t,n){e=ba(e);var r=(t=_a(t))?on(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=wn();return vn(e+o*(t-e+tt("1e-"+((o+"").length-1))),t)}return Yr(e,t)},Un.reduce=function(e,t,n){var r=Vs(e)?At:Ut,i=arguments.length<3;return r(e,so(t,4),n,i,dr)},Un.reduceRight=function(e,t,n){var r=Vs(e)?Tt:Ut,i=arguments.length<3;return r(e,so(t,4),n,i,hr)},Un.repeat=function(e,t,n){return t=(n?vo(e,t,n):t===i)?1:_a(t),$r(ba(e),t)},Un.replace=function(){var e=arguments,t=ba(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Un.result=function(e,t,n){var r=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=i);++rd)return[];var n=f,r=vn(e,f);t=so(t),e-=f;for(var i=Ft(r,t);++n=s)return e;var l=n-on(r);if(l<1)return r;var c=a?bi(a,0,l).join(""):e.slice(0,l);if(o===i)return c+r;if(a&&(l+=c.length-l),sa(o)){if(e.slice(l).search(o)){var u,d=c;for(o.global||(o=xe(o.source,ba(he.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===i?l:h)}}else if(e.indexOf(ai(o),l)!=l){var f=c.lastIndexOf(o);f>-1&&(c=c.slice(0,f))}return c+r},Un.unescape=function(e){return(e=ba(e))&&$.test(e)?e.replace(V,ln):e},Un.uniqueId=function(e){var t=++ze;return ba(e)+t},Un.upperCase=Ja,Un.upperFirst=Za,Un.each=bs,Un.eachRight=ys,Un.first=$o,ll(Un,(vl={},br(Un,(function(e,t){We.call(Un.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Un.VERSION="4.17.21",bt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Un[e].placeholder=Un})),bt(["drop","take"],(function(e,t){Hn.prototype[e]=function(n){n=n===i?1:gn(_a(n),0);var r=this.__filtered__&&!t?new Hn(this):this.clone();return r.__filtered__?r.__takeCount__=vn(n,r.__takeCount__):r.__views__.push({size:vn(n,f),type:e+(r.__dir__<0?"Right":"")}),r},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),bt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),bt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}})),bt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(il)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Xr((function(e,t){return"function"==typeof e?new Hn(this):this.map((function(n){return Nr(n,e,t)}))})),Hn.prototype.reject=function(e){return this.filter(Bs(so(e)))},Hn.prototype.slice=function(e,t){e=_a(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Hn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=_a(t))<0?n.dropRight(-t):n.take(t-e)),n)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(f)},br(Hn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Un[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&(Un.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,l=t instanceof Hn,c=a[0],u=l||Vs(t),d=function(e){var t=o.apply(Un,kt([e],a));return r&&h?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=s&&!h,_=l&&!f;if(!s&&u){t=_?t:new Hn(this);var m=e.apply(t,a);return m.__actions__.push({func:ps,args:[d],thisArg:i}),new qn(m,h)}return p&&_?e.apply(this,a):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),bt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Un.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Vs(i)?i:[],e)}return this[n]((function(n){return t.apply(Vs(n)?n:[],e)}))}})),br(Hn.prototype,(function(e,t){var n=Un[t];if(n){var r=n.name+"";We.call(Ln,r)||(Ln[r]=[]),Ln[r].push({name:t,func:n})}})),Ln[Mi(i,2).name]=[{name:"wrapper",func:i}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Vs(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Un.prototype.plant=function(e){for(var t,n=this;n instanceof Fn;){var r=Do(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Un.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hn){var t=e;return this.__actions__.length&&(t=new Hn(this)),(t=t.reverse()).__actions__.push({func:ps,args:[ts],thisArg:i}),new qn(t,this.__chain__)}return this.thru(ts)},Un.prototype.toJSON=Un.prototype.valueOf=Un.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Un.prototype.first=Un.prototype.head,st&&(Un.prototype[st]=function(){return this}),Un}();ot._=cn,(r=function(){return cn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},752:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(249),s=n(96),a=n(288),l=n(208),c=n(467),u=n(391),d=n(544),h=n(980),f=n(66),p=n(774),_=n(964),m=n(320),g=n(717),v=n(485),b=n(452),y=n(77),w=i(n(733)),C=n(486);let S=null;$("#roster-file").on("change",(function(e){let t,n;if(t="resize"===(null==e?void 0:e.type)?null==S?void 0:S.target:null==e?void 0:e.target,n=null==t?void 0:t.files,$("#roster-title").empty(),$("#roster-lists").empty(),$("#force-units").empty(),n){"resize"!==(null==e?void 0:e.type)&&(S=e);const t=new FileReader;t.onerror=()=>{t.abort(),(0,C.reject)(new DOMException("Failed to read roster file."))},t.onloadend=()=>r(this,void 0,void 0,(function*(){const e=t.result;var n;!function(e){const t=(new DOMParser).parseFromString(e,"text/xml");if(!t)return;const n=t.querySelector("roster");if(!n)return;const r=n.getAttribute("gameSystemName");if(!r)return;const i=n.getAttribute("name");i&&(document.title=`PrettyScribe ${i}`);const w=$("#roster-title")[0],C=$("#roster-lists")[0],S=$("#force-units")[0];if("Warhammer 40,000 8th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000 9th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000: Kill Team (2018)"==r){const e=(0,a.Create40kRoster)(t,!1);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000: Kill Team (2021)"==r){const e=(0,o.CreateKT21Roster)(t);e&&e._forces.length>0&&new s.RendererKT21(e).render(w,C,S)}else if("Age of Sigmar"==r){const e=(0,p.CreateAoSRoster)(t);e&&new _.RendererAoS(e).render(w,C,S)}else if("Warhammer Age of Sigmar: Warcry"==r){const e=(0,m.CreateWarcryRoster)(t);e&&new g.RendererWarcry(e).render(w,C,S)}else if("Warhammer 30,000 - The Horus Heresy"==r){const e=(0,u.Create30kRoster)(t);e&&e._forces.length>0&&new d.Renderer30k(e).render(w,C,S)}else if("(HH V2) Horus Heresy (2022)"==r){const e=h.HorusHeresy.CreateRoster(t);e&&e._forces.length>0&&new f.RendererHH2(e).render(w,C,S)}else if("Warhammer 40,000 10th Edition"==r){const e=l.Wh40k.CreateRoster(t);e&&e._forces.length>0&&new v.Wh40kRenderer(e).render(w,C,S)}else if("Middle-Earth Strategy Battle Game"===r){const e=(0,b.CreateMESBGRoster)(t);null!==e&&(console.log(e),(0,y.renderMESBG)(e,w,C,S))}else $("#errorText").html("PrettyScribe does not support game type '"+r+"'."),$("#errorDialog").modal("show")}(yield(n=e,r(void 0,void 0,void 0,(function*(){if("P"!==n.charAt(0))return n;{const e=new w.default;return(yield e.loadAsync(n)).file(/[^/]+\.ros/)[0].async("string")}}))))})),t.readAsBinaryString(n[0])}})),document.addEventListener("DOMContentLoaded",(()=>{if(navigator.userAgent.match(/AppleWebKit.*Safari/)&&!navigator.userAgent.includes("Chrome")){const e=document.querySelector('input[type="file"');null==e||e.removeAttribute("accept")}}))},419:(e,t)=>{"use strict";var n,r;function i(e,t,i,o,s,a,l,c){if(e&&t.length){e.textBaseline="top";let u=e.measureText(t);const d=u.width,h=u.actualBoundingBoxDescent-u.actualBoundingBoxAscent;let f=o;c==r.Top?f=o:c==r.Bottom?f=o+a-h:c==r.Center&&(f=o+(a-h)/2),l==n.Center?e.fillText(t,i+Math.max((s-d)/2,0),f,s):l==n.Left?e.fillText(t,i,f,s):l==n.Right&&e.fillText(t,i+s-d,f,s)}}Object.defineProperty(t,"__esModule",{value:!0}),t.FixDPI=t.RenderParagraph=t.RenderText=t.RenderTextFull=t.VertAlign=t.Justification=void 0,function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Center=2]="Center"}(n=t.Justification||(t.Justification={})),function(e){e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e[e.Center=2]="Center"}(r=t.VertAlign||(t.VertAlign={})),t.RenderTextFull=i,t.RenderText=function(e,t,n,o,s,a,l){i(e,t,n,o,s,a,l,r.Center)},t.RenderParagraph=function(e,t,n,r,i,o){let s=r;if(e&&t.length){let r=[],a=[];e.textBaseline="top";let l=0;const c=e.measureText(" ").width,u=e.measureText(t),d=1.2*(u.actualBoundingBoxDescent-u.actualBoundingBoxAscent);let h=i-o;t.split(" ").forEach((function(t){const n=e.measureText(t);l+n.width>h&&(r.push(a.join(" ")),h=i,a.length=0,l=0),l+=n.width+c,a.push(t)})),a.length>0&&r.push(a.join(" "));let f=n+o;for(let t of r)e.fillText(t,f,s),f=n,s+=d}return s},t.FixDPI=function(e){let t=window.devicePixelRatio,n=+getComputedStyle(e).getPropertyValue("height").slice(0,-2),r=+getComputedStyle(e).getPropertyValue("width").slice(0,-2);0==n&&(n=e.height),0==r&&(r=e.width),e.setAttribute("height",(n*t).toString()),e.setAttribute("width",(r*t).toString())}},544:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer30k=void 0;const r=n(391),i=n(419);class o{constructor(e){this._descriptionStartX=190,this._descriptionWidth=600,this._showWoundBoxes=!1,this._roster=null,this._currentX=0,this._currentY=0,this._maxWidth=0,this._octagon=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.3,.077,.077,.077,.077,.077,.077,.077,.077,.077],this._vehicleLabelWidthsNormalized=[.3,.1,.1,.1,.1,.1,.2],this._walkerLabelWidthsNormalized=[.3,.06,.06,.06,.06,.06,.06,.06,.06,.06,.15],this._flyerLabelWidthsNormalized=[.3,.077,.077,.077,.077,.077,.077,.077,.077,.077],this._weaponLabelWidthNormalized=[.3,.1,.1,.1,.4],this._spellLabelWidthNormalized=[.3,.1,.1,.5],this._roster=e,this._octagon=document.getElementById("octagon"),this._roles.set(r.UnitRole30k.HQ,document.getElementById("role_hq")),this._roles.set(r.UnitRole30k.TR,document.getElementById("role_tr")),this._roles.set(r.UnitRole30k.EL,document.getElementById("role_el")),this._roles.set(r.UnitRole30k.FA,document.getElementById("role_fa")),this._roles.set(r.UnitRole30k.HS,document.getElementById("role_hs")),this._roles.set(r.UnitRole30k.FL,document.getElementById("role_fl")),this._roles.set(r.UnitRole30k.DT,document.getElementById("role_dt")),this._roles.set(r.UnitRole30k.FT,document.getElementById("role_ft")),this._roles.set(r.UnitRole30k.LW,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){e&&(e.innerHTML="

"+this._roster._name+" ("+this._roster._points+" pts)

");for(let e of this._roster._forces){const s=document.createElement("div");s&&(s.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(s);const a=document.createElement("table");a.classList.add("table"),a.classList.add("table-sm"),a.classList.add("table-striped");const l=document.createElement("thead");a.appendChild(l),l.classList.add("thead-light");const c=document.createElement("tr");l.appendChild(c),[{name:"NAME",w:"25%"},{name:"ROLE",w:"20%"},{name:"MODELS",w:"40%"},{name:"POINTS",w:"15%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,c.appendChild(t)})),s.appendChild(a);let u=document.createElement("tbody");a.appendChild(u);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name;let i=document.createElement("td");i.innerHTML=r.UnitRoleToString30k[t._role];let o=document.createElement("td");o.innerHTML="";let s=0;for(const e of t._models)e._count>1?o.innerHTML+=e._count+" "+e._name:o.innerHTML+=e._name,s++,s!=t._models.length&&(o.innerHTML+=", ");let a=document.createElement("td");a.innerHTML=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),e.appendChild(a),u.appendChild(e)}if(e._rules.size>0){let t=document.createElement("div"),r=document.createElement("h3");t.appendChild(r),r.textContent=e._catalog+" Allegiance Rules";for(let n of e._rules){let e=document.createElement("div"),r=document.createElement("h4");r.textContent=n[0];let i=document.createElement("p");i.textContent=n[1],e.appendChild(r),e.appendChild(i),t.appendChild(e)}n&&n.appendChild(t)}for(let t of e._units){let e=document.createElement("canvas");e.width=7.5*o._res,e.height=20*o._res,this._descriptionWidth=e.width-this._descriptionStartX-10,(0,i.FixDPI)(e);const r=this.renderUnit(t,e,0,0),s=25;let a=document.createElement("canvas");a.width=r[0]+2*s,a.height=r[1]+2*s;let l=a.getContext("2d");if(null==l||l.drawImage(e,s,s),n){let e=document.createElement("div");e.appendChild(a),n.appendChild(e)}}}}}renderBorder(e,t,n,r,i){e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.stroke(),e.save(),e.fillStyle=o._fillColor,e.globalCompositeOperation="destination-over",e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.fill(),e.restore()}renderWatermark(e){}renderLine(e){e.lineWidth=2,e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(this._currentX,this._currentY),e.lineTo(this._currentX+this._maxWidth,this._currentY),e.stroke(),this._currentY+=1}renderTableHeader(e,t,n){let r=this._currentX;const s=this._maxWidth;e.fillStyle=o._grey1,e.fillRect(this._currentX,this._currentY,s,22),e.fillStyle=o._blackColor,e.font=o._titleFont;var a=50;if(t){e.font=o._headerFont;for(let o=0;o1?n+=e._count+" "+e._name:n+=e._name,r++,r!=t.length&&(n+=", ");this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,n,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2}renderWoundBoxes(e,t){e.font=o._titleFont,(0,i.RenderText)(e,"WOUNDS",this._currentX+20,this._currentY,100,16,i.Justification.Left);const n=this._currentX+this._descriptionStartX,r=n+195;e.save();for(let s of t)if(s._wounds>1){let t=this._currentY;e.font=o._font,e.fillStyle=o._blackColor,this._currentY=(0,i.RenderParagraph)(e,s._name,n,this._currentY+3,195,0);let a=this._currentX+r;e.strokeStyle=o._blackColor,e.fillStyle="#ffffff";for(let n=0;n{u.push(e*this._maxWidth)}));const d=[];this._vehicleLabelWidthsNormalized.forEach((e=>{d.push(e*this._maxWidth)}));const h=[];this._walkerLabelWidthsNormalized.forEach((e=>{h.push(e*this._maxWidth)}));const f=[];for(var p of(this._flyerLabelWidthsNormalized.forEach((e=>{f.push(e*this._maxWidth)})),e._models)){c.push(p);for(let e of p._weapons)s.push(e);for(let e of p._psychicPowers)a.push(e);p._psyker&&l.push(p._psyker)}const _=[],m=new Map;for(const e of c)m.has(e._name)||(m.set(e._name,e),_.push(e));if(_.length>0){this.renderTableHeader(i,o._unitLabels,u);let e=0;for(var p of _)this.renderModel(i,p,u,e%2),e++}if(e._vehicles.length>0){this.renderTableHeader(i,o._vehicleLabels,d);let t=0;for(var g of e._vehicles)this.renderVehicle(i,g,d,t%2),t++}if(e._walkers.length>0){this.renderTableHeader(i,o._walkerLabels,h);let t=0;for(var v of e._walkers)this.renderWalker(i,v,h,t%2),t++}if(e._flyers.length>0){this.renderTableHeader(i,o._flyerLabels,f);let t=0;for(var b of e._flyers)this.renderFlyer(i,b,f,t%2),t++}const y=[],w=new Map;for(const e of s)w.has(e._name)||(w.set(e._name,e),y.push(e));if(y.length>0){const e=[];this._weaponLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._weaponLabels,e),this.renderWeapons(i,y,e)}if(a.length>0){const e=[];this._spellLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._spellLabels,e),this.renderPowers(i,a,e)}if(e._abilities.size>0&&(this.renderLine(i),this._currentY+=2,this.renderAbilities(i,e)),l.length>0&&(this.renderLine(i),this._currentY+=2,this.renderPsykers(i,l)),e._rules.size>0&&(this.renderLine(i),this._currentY+=2,this.renderRules(i,e)),e._factions.size>0&&(this.renderLine(i),this._currentY+=2,this.renderFactions(i,e)),e._keywords.size>0&&(this.renderLine(i),this._currentY+=2,this.renderKeywords(i,e)),e._models.length>0&&(this.renderLine(i),this._currentY+=2,this.renderModelList(i,_)),this._showWoundBoxes){let t=!1;for(let n of e._models)n._wounds>2&&(t=!0);t&&(this.renderLine(i),this._currentY+=5,this.renderWoundBoxes(i,e._models))}this._currentY+=2;const C=this._currentY-(r+o._margin),S=this._maxWidth;return this.renderBorder(i,this._currentX,r+o._margin,S,C),this.renderWatermark(i),[this._maxWidth,this._currentY]}renderHeader(e,t){t.globalAlpha=1,t.fillStyle=o._blackColor;const n=this._currentX,r=this._currentX+this._maxWidth,s=this._currentY,a=s+36;t.beginPath(),t.moveTo(n,s+o._bevelSize),t.lineTo(n,a),t.lineTo(r,a),t.lineTo(r,s+o._bevelSize),t.lineTo(r-o._bevelSize,s),t.lineTo(n+o._bevelSize,s),t.closePath(),t.fill();let l=n+6;if(this._octagon){t.drawImage(this._octagon,l,s+2,32,32);const n=this._roles.get(e._role);n&&t.drawImage(n,l+4,s+2+4,24,24),t.fillStyle="white",t.font="18px serif",l+=34,t.drawImage(this._octagon,l,s+2,32,32),(0,i.RenderText)(t,e._points.toString(),l,s+2,32,32,i.Justification.Center)}let c=0,u=28;const d=l+6;t.font=u+"px bold serif";const h=e._name.toLocaleUpperCase();let f=t.measureText(h);const p=this._maxWidth-d;for(;c<6&&f.width>p;)c+=1,u-=2,t.font=u+"px bold serif",f=t.measureText(h);t.fillStyle="white",t.textBaseline="top",(0,i.RenderText)(t,h,d,s,p,36,i.Justification.Center),this._currentY+=36}renderPsykers(e,t){e.font=o._titleFont,(0,i.RenderText)(e,"PSYKERS",this._currentX+20,this._currentY,100,16,i.Justification.Left),e.font=o._font,this._currentY+=2;for(let n of t)this._currentY=(0,i.RenderParagraph)(e,"MASTERY LEVEL: "+n._masteryLevel,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,"DISCIPLINES: "+n._disciplines,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2}}t.Renderer30k=o,o._res=144,o._margin=0,o._bevelSize=15,o._blackColor="#1d272a",o._grey1="#b3bbb5",o._greyLight="#dde1df",o._fillColor="#f6f6f6",o._titleFont="bold 14px sans-serif",o._headerFont="bold 14px sans-serif",o._font="14px sans-serif",o._boldFont="bold 14px sans-serif",o._unitLabels=["MODEL","WS","BS","S","T","W","I","A","LD","SAVE"],o._vehicleLabels=["MODEL","BS","FRONT","SIDE","REAR","HP","TYPE"],o._walkerLabels=["MODEL","WS","BS","S","FRONT","SIDE","REAR","I","A","HP","TYPE"],o._flyerLabels=["MODEL","BS","FRONT","SIDE","REAR","HP","TYPE","ROLE","PURSUIT","AGILITY"],o._weaponLabels=["WEAPONS","RANGE","S","AP","TYPE"],o._spellLabels=["PSYCHIC POWER","WARP CHARGE","RANGE","DETAILS"]},467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer40k=void 0;const r=n(288);class i{constructor(e){this._roster=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.25,.05,.05,.05,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.25,.05,.1,.05,.05,.05,.45],this._spellLabelWidthNormalized=[.25,.05,.1,.6],this._explosionLabelWidthNormalized=[.2,.1,.1,.15],this._trackerLabelWidth=[.2,.15,.1,.1,.1],this._roster=e,this._roles.set(r.UnitRole.HQ,document.getElementById("role_hq")),this._roles.set(r.UnitRole.TR,document.getElementById("role_tr")),this._roles.set(r.UnitRole.EL,document.getElementById("role_el")),this._roles.set(r.UnitRole.FA,document.getElementById("role_fa")),this._roles.set(r.UnitRole.HS,document.getElementById("role_hs")),this._roles.set(r.UnitRole.FL,document.getElementById("role_fl")),this._roles.set(r.UnitRole.DT,document.getElementById("role_dt")),this._roles.set(r.UnitRole.FT,document.getElementById("role_ft")),this._roles.set(r.UnitRole.LW,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`,`${this._roster._cost._powerLevel} PL`,`${this._roster._cost._commandPoints} CP`];for(const e in this._roster._cost._freeformValues)t.push(`${this._roster._cost._freeformValues[e]}${e}`);const n=`${this._roster.name()} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n)),this._roster._customNotes&&e.appendChild(document.createElement("p")).appendChild(document.createTextNode(this._roster._customNotes))}t&&(this.renderRosterSummary(t),this.renderAbilitiesByPhase(t)),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(!this._roster)return;const t=this._roster._forces.some((e=>e._units.some((e=>0!==e._cost._commandPoints))));for(const n of this._roster._forces){const i=document.createElement("div");if(n._faction?i.appendChild(document.createTextNode(`${n._catalog} ${n.name()} (${n._faction})`)):i.appendChild(document.createTextNode(`${n._catalog} ${n.name()}`)),n._configurations.length>0){const e=i.appendChild(document.createElement("ul"));for(const t of n._configurations)e.appendChild(document.createElement("li")).appendChild(document.createElement("i")).appendChild(document.createTextNode(t))}e.appendChild(i);const o=document.createElement("table");o.classList.add("table","table-sm","table-striped");const s=document.createElement("thead");o.appendChild(s),s.classList.add("thead-light");const a=document.createElement("tr");s.appendChild(a);const l=[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"},{name:"POWER",w:"5%"}];t&&l.push({name:"CP",w:"5%"}),l.forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,a.appendChild(t)})),i.appendChild(o);let c=document.createElement("tbody");o.appendChild(c);for(let e of n._units){const n=document.createElement("tr");n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e.nameWithExtraCosts())),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.UnitRoleToString[e._role]));const i=n.appendChild(document.createElement("td"));if(this.renderModelList(i,e),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._points.toString())),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._powerLevel.toString())),t){const t=(e._cost._commandPoints||"")+"";n.appendChild(document.createElement("td")).appendChild(document.createTextNode(t))}c.appendChild(n)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showPhaseAbilities","Show abilities by phase",(e=>{const t=document.getElementById("wh40k_abilities_list");t&&(e.target.checked?t.classList.remove("d-none"):t.classList.add("d-none"))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",c)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",c))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;t0&&s.appendChild(document.createTextNode(a.substring(0,c)));const u=t[l]=t[l]||[],d=n[l]=n[l]||[];d.includes(i)||(d.push(i),u.push(s)),s.appendChild(document.createElement("u")).appendChild(document.createTextNode(r[0]));const h=c+e.length;a=a.substring(h)}a.length>0&&s.appendChild(document.createTextNode(a))}const r=e.appendChild(document.createElement("div"));r.setAttribute("id","wh40k_abilities_list"),r.classList.add("d-none"),r.appendChild(document.createElement("h3")).appendChild(document.createTextNode("Abilities by Phase"));const i=["pre-game phase","command phase","movement phase","psychic phase","shooting phase","charge phase","fight phase","morale phase"].filter((e=>!!t[e]));if(0===i.length)r.appendChild(document.createTextNode("No phase-specific abilities in roster"));else for(const e of i){r.appendChild(document.createElement("h4")).appendChild(document.createTextNode(e));for(const n of t[e])r.appendChild(n.parentElement?n.cloneNode(!0):n)}}renderRosterDetails(e){if(!this._roster)return;const t=new Map,n=new Map,i=e.appendChild(document.createElement("div"));i.id="detachment_sheets";const s=e.appendChild(document.createElement("div"));s.id="collated_sheets",s.style.pageBreakBefore="always",s.classList.add("d-none");const a=[];for(const e of this._roster._forces){const r=document.createElement("div");if(r.style.pageBreakBefore="always",r){const t=document.createElement("p");t.appendChild(document.createTextNode(e._catalog)),e._faction&&t.appendChild(document.createTextNode(" ("+e._faction+")")),r.appendChild(t)}let s=document.createElement("h3");s.appendChild(r),i.appendChild(s),this.renderDatasheets(i,e._units),a.push(...e._units),o(t,e._catalog,e._rules),o(n,e._faction,e._factionRules)}a.sort(((e,t)=>e._role!=t._role?e._role-t._role:e._name!=t._name?(0,r.Compare)(e._name,t._name):e._cost._points-t._cost._points)),this.renderDatasheets(s,a);let l=document.createElement("div");l.style.pageBreakBefore="always",this.printRules(t,l),this.printRules(n,l),e.appendChild(l)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),h],[.1,.8,.1]));const f=c.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=f.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let p=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(s(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);p&&l.appendChild(p),c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._unitLabels,this._unitLabelWidthsNormalized,!0));let _=l.appendChild(document.createElement("tbody"));_.append(document.createElement("tr"));for(const e of t._modelStats)_.append(s([e._name,e._move,e._ws,e._bs,e._str.toString(),e._toughness.toString(),e._wounds.toString(),e._attacks.toString(),e._leadership.toString(),e._save],this._unitLabelWidthsNormalized));if(p=a("Model notes",t._modelStats),p&&l.appendChild(p),t._woundTracker.length>0){const e=Array.from(i._trackerLabels);if(4==t._woundTracker.length){const n=Array.from(t._woundTracker[0]._table.values());e.splice(1,n.length,...n)}else if(3==t._woundTracker.length){const n=Array.from(t._woundTracker[0]._table.keys());e.splice(1,n.length,...n)}c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(e,this._trackerLabelWidth,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._woundTracker)_.appendChild(s([""].concat(Array.from(e._table.values())),this._trackerLabelWidth))}if(t._weapons.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._weaponLabels,this._weaponLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._weapons)_.append(s([e.name().toString(),e._range,e._type,e._str.toString(),e._ap,e._damage,e._abilities],this._weaponLabelWidthNormalized))}if(p=a("Weapon notes",t._weapons),p&&l.appendChild(p),t._spells.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._spellLabels,this._spellLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._spells)_.append(s([e.name(),e._manifest.toString(),e._range,e._details],this._spellLabelWidthNormalized))}if(p=a("Spell notes",t._spells),p&&l.appendChild(p),t._psykers.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const e=document.createElement("div");for(const n of t._psykers){let t=`CAST: ${n._cast}, DENY: ${n._deny}, POWERS KNOWN: ${n._powers}`;n._other&&(t+=`, OTHER: ${n._other}`),e.appendChild(document.createElement("div")).appendChild(document.createTextNode(t))}c.appendChild(s(["Psykers",e],[.1,.9],!1))}p=a("Psyker notes",t._psykers),p&&l.appendChild(p),!t._abilities.Abilities&&t._rules.size>0&&this.renderUnitAbilitiesAndRules(l,"Abilities",new Map,t._rules);for(const e of Object.keys(t._abilities).sort()){const n=t._abilities[e],r="Abilities"===e?t._rules:void 0;this.renderUnitAbilitiesAndRules(l,e,n,r)}c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const m=Array.from(t._factions).sort(r.Compare).join(", ").toLocaleUpperCase();c.appendChild(s(["Factions",m],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const g=Array.from(t._keywords).sort(r.Compare).join(", ").toLocaleUpperCase();c.appendChild(s(["Keywords",g],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const v=document.createElement("div");if(this.renderModelList(v,t),c.appendChild(s(["MODELS",v],[.1,.9],!1)),t._explosions.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._explosionLabels,this._explosionLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._explosions)_.append(s([e.name(),e._diceRoll,e._distance,e._mortalWounds],this._explosionLabelWidthNormalized))}p=a("Explosion notes",t._explosions),p&&l.appendChild(p)}renderUnitAbilitiesAndRules(e,t,n,i){const o=e.appendChild(document.createElement("thead"));o.classList.add("info_row");const a=document.createElement("div");if(i&&i.size>0){const e=Array.from(i.keys()).sort(r.Compare).join(", ");a.appendChild(document.createElement("div")).appendChild(document.createElement("b")).appendChild(document.createTextNode(e))}const c=Array.from(n.keys()).sort(r.Compare);for(const e of c){const t=l(a.appendChild(document.createElement("div")));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.toUpperCase()}: `)),t.appendChild(document.createTextNode(n.get(e)||"??"))}o.appendChild(s([t,a],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n.name()));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=l(document.createElement("div")),r=document.createElement("b");r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n){0!==n.size&&e.set(t,new Map([...e.get(t)||[],...n]))}function s(e,t,n=!1){const r=l(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;ie._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(s([e,r],[.1,.9],!1)),n}function l(e){return e.classList.add("hide_able"),e}function c(e){let t=e.target;t&&(t=t.closest(".hide_able")),t&&(t.classList.contains("hidden")?t.classList.remove("hidden"):t.classList.add("hidden"))}t.Renderer40k=i,i._unitLabels=["MODEL","M","WS","BS","S","T","W","A","LD","SAVE"],i._weaponLabels=["WEAPONS","RANGE","TYPE","S","AP","D","ABILITIES"],i._spellLabels=["PSYCHIC POWER","MANIFEST","RANGE","DETAILS"],i._explosionLabels=["EXPLOSION","DICE ROLL","DISTANCE","MORTAL WOUNDS"],i._trackerLabels=["WOUND TRACK","REMAINING W","ATTRIBUTE","ATTRIBUTE","ATTRIBUTE"]},485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Wh40kRenderer=void 0;const r=n(208);class i{constructor(e){this._roster=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.4,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.3,.1,.1,.05,.05,.05,.05,.3],this._roster=e,this._roles.set(r.Wh40k.UnitRole.EpicHero,document.getElementById("role_hq")),this._roles.set(r.Wh40k.UnitRole.Character,document.getElementById("role_hq")),this._roles.set(r.Wh40k.UnitRole.Battleline,document.getElementById("role_tr")),this._roles.set(r.Wh40k.UnitRole.Infantry,document.getElementById("role_el")),this._roles.set(r.Wh40k.UnitRole.Vehicle,document.getElementById("role_hs")),this._roles.set(r.Wh40k.UnitRole.Mounted,document.getElementById("role_fa")),this._roles.set(r.Wh40k.UnitRole.Transport,document.getElementById("role_dt")),this._roles.set(r.Wh40k.UnitRole.Fortification,document.getElementById("role_ft"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`];for(const e in this._roster._cost._freeformValues)t.push(`${this._roster._cost._freeformValues[e]}${e}`);const n=`${this._roster.name()} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n)),this._roster._customNotes&&e.appendChild(document.createElement("p")).appendChild(document.createTextNode(this._roster._customNotes))}t&&(this.renderRosterSummary(t),this.renderAbilitiesByPhase(t)),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(this._roster)for(const t of this._roster._forces){const n=document.createElement("div");if(t._faction?n.appendChild(document.createTextNode(`${t._catalog} ${t.name()} (${t._faction})`)):n.appendChild(document.createTextNode(`${t._catalog} ${t.name()}`)),t._configurations.length>0){const e=n.appendChild(document.createElement("ul"));for(const n of t._configurations)e.appendChild(document.createElement("li")).appendChild(document.createElement("i")).appendChild(document.createTextNode(n))}e.appendChild(n);const i=document.createElement("table");i.classList.add("table","table-sm","table-striped");const o=document.createElement("thead");i.appendChild(o),o.classList.add("thead-light");const s=document.createElement("tr");o.appendChild(s),[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,s.appendChild(t)})),n.appendChild(i);let a=document.createElement("tbody");i.appendChild(a);for(let e of t._units){const t=document.createElement("tr");t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e.nameWithExtraCosts())),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.Wh40k.UnitRoleToString[e._role]));const n=t.appendChild(document.createElement("td"));this.renderModelList(n,e),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._points.toString())),a.appendChild(t)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showPhaseAbilities","Show abilities by phase",(e=>{const t=document.getElementById("wh40k_abilities_list");t&&(e.target.checked?t.classList.remove("d-none"):t.classList.add("d-none"))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",l)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",l))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;t0&&s.appendChild(document.createTextNode(l.substring(0,c)));const u=t[a]=t[a]||[],d=n[a]=n[a]||[];d.includes(i)||(d.push(i),u.push(s)),s.appendChild(document.createElement("u")).appendChild(document.createTextNode(r[0]));const h=c+e.length;l=l.substring(h)}l.length>0&&s.appendChild(document.createTextNode(l))}const r=e.appendChild(document.createElement("div"));r.setAttribute("id","wh40k_abilities_list"),r.classList.add("d-none"),r.appendChild(document.createElement("h3")).appendChild(document.createTextNode("Abilities by Phase"));const i=["pre-game phase","command phase","movement phase","psychic phase","shooting phase","charge phase","fight phase","morale phase"].filter((e=>!!t[e]));if(0===i.length)r.appendChild(document.createTextNode("No phase-specific abilities in roster"));else for(const e of i){r.appendChild(document.createElement("h4")).appendChild(document.createTextNode(e));for(const n of t[e])r.appendChild(n.parentElement?n.cloneNode(!0):n)}}renderRosterDetails(e){if(!this._roster)return;const t=new Map,n=new Map,i=e.appendChild(document.createElement("div"));i.id="detachment_sheets";const s=e.appendChild(document.createElement("div"));s.id="collated_sheets",s.style.pageBreakBefore="always",s.classList.add("d-none");const a=[];for(const e of this._roster._forces){const r=document.createElement("div");if(r.style.pageBreakBefore="always",r){const t=document.createElement("p");t.appendChild(document.createTextNode(e._catalog)),e._faction&&t.appendChild(document.createTextNode(" ("+e._faction+")")),r.appendChild(t)}let s=document.createElement("h3");s.appendChild(r),i.appendChild(s),this.renderDatasheets(i,e._units),a.push(...e._units),o(t,e._catalog,e._rules),o(n,e._faction,e._factionRules)}a.sort(((e,t)=>e._role!=t._role?e._role-t._role:e._name!=t._name?r.Wh40k.Compare(e._name,t._name):e._cost._points-t._cost._points)),this.renderDatasheets(s,a);let l=document.createElement("div");l.style.pageBreakBefore="always",this.printRules(t,l),this.printRules(n,l),e.appendChild(l)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),""],[.1,.8,.1]));const u=a.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=u.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let d=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(s(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);d&&o.appendChild(d);const h=Object.keys(t._profileTables).sort(r.Wh40k.CompareProfileTableName);for(const e of h){const n=t._profileTables[e],r="Unit"===e?this._unitLabelWidthsNormalized:this._weaponLabelWidthNormalized;this.renderSubTable(o,n._headers,n._contents,r,"Notes",[n])}!t._abilities.Abilities&&t._rules.size>0&&this.renderUnitAbilitiesAndRules(o,"Abilities",new Map,t._rules);for(const e of Object.keys(t._abilities).sort()){const n=t._abilities[e],r="Abilities"===e?t._rules:void 0;this.renderUnitAbilitiesAndRules(o,e,n,r)}a=o.appendChild(document.createElement("thead")),a.classList.add("info_row","keywords_row");const f=Array.from(t._keywords).sort(r.Wh40k.Compare).join(", ").toLocaleUpperCase(),p=Array.from(t._factions).sort(r.Wh40k.Compare).join(", ").toLocaleUpperCase();a.appendChild(s(["Keywords",f,"Factions",p],[.1,.6,.1,.2],!1)),a=o.appendChild(document.createElement("thead")),a.classList.add("info_row");const _=document.createElement("div");this.renderModelList(_,t),a.appendChild(s(["MODELS",_],[.1,.9],!1))}renderSubTable(e,t,n,r,i,o){const a=e.appendChild(document.createElement("thead"));a.classList.add("table-active"),a.appendChild(s(t,r,!0));let l=e.appendChild(document.createElement("tbody"));l.append(document.createElement("tr"));for(const e of n)l.append(s(e,r));const c=function(e,t){if(!t.some((e=>e._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(s([e,r],[.1,.9],!1)),n}(i,o);c&&e.appendChild(c)}renderUnitAbilitiesAndRules(e,t,n,i){const o=e.appendChild(document.createElement("thead"));o.classList.add("info_row");const l=document.createElement("div");if(i&&i.size>0){const e=Array.from(i.keys()).sort(r.Wh40k.Compare).join(", ");l.appendChild(document.createElement("div")).appendChild(document.createElement("b")).appendChild(document.createTextNode(e))}const c=Array.from(n.keys()).sort(r.Wh40k.Compare);for(const e of c){const t=a(l.appendChild(document.createElement("div")));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.toUpperCase()}: `)),t.appendChild(document.createTextNode(n.get(e)||"??"))}o.appendChild(s([t,l],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n.name()));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=a(document.createElement("div")),r=document.createElement("b");r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n){0!==n.size&&e.set(t,new Map([...e.get(t)||[],...n]))}function s(e,t,n=!1){const r=a(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererAoS=void 0;const r=n(774);t.RendererAoS=class{constructor(e){this._roster=null,this._roster=e}render(e,t,n){if(null!=this._roster){if(e){e.innerHTML="

"+this._roster._name.toUpperCase()+" ("+this._roster._points+" pts, "+this._roster._commandPoints+" CP)

";let t=document.createElement("h3");t.textContent="ROSTER",e.appendChild(t)}for(let e of this._roster._forces){const i=document.createElement("div");i&&(i.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(i);const o=[{name:"NAME",width:"35%"},{name:"ROLE",width:"15%"},{name:"SELECTIONS",width:"40%"},{name:"POINTS",width:"10%"}],s=this.createTable(o);s.classList.add("table","table-sm","aos_font"),i.appendChild(s);let a=document.createElement("tbody");s.appendChild(a);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=`${t._name}`;let i=document.createElement("td");i.innerHTML=r.AoSUnitRoleToString[t._role];let o=document.createElement("td");o.innerHTML="";for(const e of t._selections)o.innerHTML+=e+"
";let s=document.createElement("td");s.textContent=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),e.appendChild(s),a.appendChild(e)}let l=document.createElement("div"),c=document.createElement("h3");if(c.textContent=e._allegiance._name.toUpperCase(),l.appendChild(c),e._allegiance._commandAbilities.size>0&&this.renderAbilityMap(l,"ABILITIES",e._allegiance._commandAbilities),e._allegiance._battleTraits.size>0&&this.renderAbilityMap(l,"BATTLE TRAITS",e._allegiance._battleTraits),e._allegiance._spells.length>0){let t=document.createElement("h4");t.textContent="ALLEGIANCE SPELLS",l.append(t),this.renderSpells(l,e._allegiance._spells)}if(e._allegiance._extraProfiles.length>0){let t="";for(let n of e._allegiance._extraProfiles)if(1==n._value._fields.size){if(t!=n._value._typeName){let e=document.createElement("h4");l.appendChild(e),e.textContent=n._value._typeName.toUpperCase(),t=n._value._typeName}const e=n._value._fields.values();let r=document.createElement("p");r.classList.add("aos_font"),r.innerHTML=`${n._name}: ${e.next().value}`,l.appendChild(r)}else console.log("Table profiles not implemented. "+n._value._typeName)}if(e._grandStrategy&&""!=e._grandStrategy._name){let t=document.createElement("h3");l.appendChild(t),t.textContent="GRAND STRATEGY";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=e._grandStrategy._name;let i=document.createElement("p");i.textContent=e._grandStrategy._description,n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._triumph&&""!=e._triumph._name){let t=document.createElement("h3");l.appendChild(t),t.textContent="TRIUMPH";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=e._triumph._name;let i=document.createElement("p");i.textContent=e._triumph._description,n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._realmOfBattle&&e._realmOfBattle._name.length>0){let t=document.createElement("h3");if(l.appendChild(t),t.textContent="REALM OF BATTLE ("+e._realmOfBattle._name+")",e._realmOfBattle._spells.length>0){let t=document.createElement("h4");t.textContent="SPELLS",l.append(t),this.renderSpells(l,e._realmOfBattle._spells)}if(e._realmOfBattle._commandAbilities.size>0&&this.renderAbilityMap(l,"COMMAND ABILITIES",e._realmOfBattle._commandAbilities),e._realmOfBattle._rules.length>0){let t=document.createElement("h4");t.textContent="SPECIAL RULES",l.append(t);for(let t of e._realmOfBattle._rules){let e=document.createElement("div"),n=document.createElement("p");n.textContent=t._name+": "+t._description,e.appendChild(n),l.appendChild(e)}}}for(let t of e._rules){let e=document.createElement("h3");l.appendChild(e),e.textContent="RULES";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=t[0];let i=document.createElement("p");i.textContent=t[1],n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._battleTactics.size>0){let t=document.createElement("h3");t.textContent="BATTLE TACTICS",l.appendChild(t);const n=[{name:"NAME",width:"20%"},{name:"DESCRIPTION",width:"80%"}],r=this.createTable(n);r.classList.add("table","table-sm","aos_table","aos_font");let i=document.createElement("tbody");r.appendChild(i);for(let t of e._battleTactics){let e=document.createElement("tr"),n=document.createElement("td");n.textContent=t[0];let r=document.createElement("td");r.textContent=t[1],e.appendChild(n),e.appendChild(r),i.appendChild(e)}l.appendChild(r)}for(let t of e._battalions){let e=document.createElement("h3");l.appendChild(e),e.textContent=t._name.toUpperCase();for(let e of t._abilities){let t=document.createElement("div"),n=document.createElement("h4");n.textContent=e[0];let r=document.createElement("p");r.textContent=e[1],t.appendChild(n),t.appendChild(r),l.appendChild(t)}}if(!n)continue;n.appendChild(l);let u=document.createElement("hr");u.classList.add("aos_dark"),n.appendChild(u);for(let t of e._units){n.appendChild(this.renderUnitHtml(t));let e=document.createElement("hr");e.classList.add("aos_dark"),n.appendChild(e)}}}}createTable(e){const t=document.createElement("table"),n=document.createElement("thead");t.appendChild(n),n.classList.add("aos_light");const r=document.createElement("tr");return n.appendChild(r),e.forEach((e=>{let t=document.createElement("th");t.scope="col",t.textContent=e.name,t.style.width=e.width,r.appendChild(t)})),t}internalKeyword(e){return e.toUpperCase()!=e}renderUnitHtml(e){let t=document.createElement("div");t.classList.add("container-fluid","aos_unit");let n=document.createElement("div");n.classList.add("p-2","mb-2","aos_medium","text-center","text-uppercase","text-black"),n.innerHTML=`${e._name}`,t.append(n);let r=document.createElement("div");if(r.classList.add("row"),t.append(r),e.isNormalUnit()){let t=document.createElement("div");t.classList.add("col-3"),t.innerHTML=`
\n

${e._move}

\n

${e._wounds}

\n

${e._bravery}

\n

${e._save}

\n
`,r.append(t)}let i=document.createElement("div");i.classList.add("col"),r.appendChild(i);let o=document.createElement("table");o.classList.add("table","table-sm","aos_table","aos_font","text-center");let s=document.createElement("thead");o.appendChild(s),o.innerHTML='\n Missile Weapons\n Range\n Attacks\n To Hit\n To Wound\n Rend\n Damage\n ';let a=document.createElement("tbody");o.appendChild(a);let l=document.createElement("table");l.classList.add("table","table-sm","aos_table","aos_font","text-center"),s=document.createElement("thead"),l.appendChild(s),l.innerHTML='\n Melee Weapons\n Range\n Attacks\n To Hit\n To Wound\n Rend\n Damage\n ';let c=document.createElement("tbody");l.appendChild(c);let u=!1,d=!1;for(let t of e._weapons)if("Missile"===t._type){let e=document.createElement("tr");e.innerHTML=`${t._name}${t._range}${t._attacks}\n ${t._toHit}${t._toWound}${t._rend}${t._damage}`,a.appendChild(e),u=!0}else if("Melee"===t._type){let e=document.createElement("tr");e.innerHTML=`${t._name}${t._range}${t._attacks}\n ${t._toHit}${t._toWound}${t._rend}${t._damage}`,c.appendChild(e),d=!0}if(u&&i.appendChild(o),d&&i.appendChild(l),e._woundTracker&&e._woundTracker._labels.length>0){let t=[];const n=(1/e._woundTracker._labels.length*100).toString()+"%";for(let r of e._woundTracker._labels)t.push({name:r,width:n});const r=this.createTable(t);r.classList.add("table","table-sm","aos_table","aos_font","text-center"),i.appendChild(r);let o=document.createElement("tbody");r.appendChild(o);for(let t of e._woundTracker._table){let e=document.createElement("tr");for(let n of t){let t=document.createElement("td");t.textContent=n,e.appendChild(t)}o.appendChild(e)}}if(e._abilities.size>0&&this.renderAbilityMap(i,"ABILITIES",e._abilities),e._commandAbilities.size>0&&this.renderAbilityMap(i,"COMMAND ABILITIES",e._commandAbilities),e._commandTraits.size>0&&this.renderAbilityMap(i,"COMMAND TRAITS",e._commandTraits),e._magic.size>0&&this.renderAbilityMap(i,"MAGIC",e._magic),e._spells.length>0){let t=document.createElement("h4");t.textContent="SPELLS",i.appendChild(t),this.renderSpells(i,e._spells)}if(e._prayers.length>0){let t=document.createElement("h4");t.textContent="PRAYERS",i.appendChild(t);const n=[{name:"NAME",width:"20%"},{name:"ANSWER VALUE",width:"10%"},{name:"RANGE",width:"10%"},{name:"DESCRIPTION",width:"60%"}],r=this.createTable(n);r.classList.add("table","table-sm","aos_table","aos_font");let o=document.createElement("tbody");r.appendChild(o);for(let t of e._prayers){let e=document.createElement("tr"),n=document.createElement("td");n.textContent=t._name;let r=document.createElement("td");r.textContent=t._answerValue.toString();let i=document.createElement("td");i.textContent=t._range.toString();let s=document.createElement("td");s.textContent=t._description,e.appendChild(n),e.appendChild(r),e.appendChild(i),e.appendChild(s),o.appendChild(e)}i.appendChild(r)}e._artefacts.size>0&&this.renderAbilityMap(i,"ARTEFACTS",e._artefacts);let h="";for(let t of e._extraProfiles)if(1==t._value._fields.size){if(h!=t._value._typeName){let e=document.createElement("h4");i.appendChild(e),e.textContent=t._value._typeName.toUpperCase(),h=t._value._typeName}const e=t._value._fields.values();let n=document.createElement("p");n.classList.add("aos_font"),n.innerHTML=`${t._name}: ${e.next().value}`,i.appendChild(n)}else console.log("Table profiles not implemented. "+t._value._typeName);if(e._keywords.size>0){let n=document.createElement("div");n.classList.add("container-fluid");let r=document.createElement("div");r.classList.add("row"),n.appendChild(r);let i=document.createElement("div");i.classList.add("col-5","border","aos_dark","text-center"),i.innerHTML="KEYWORDS",r.appendChild(i);let o="",s="";for(let t of e._keywords)this.internalKeyword(t)||(s+=o,s+=t,o=", ");let a=document.createElement("div");a.classList.add("col","border","text-left","text-uppercase"),a.innerText=s,r.appendChild(a),t.appendChild(n)}return t}renderAbilityMap(e,t,n){let r=document.createElement("h4");r.textContent=t,e.appendChild(r);for(let e of n){let t=document.createElement("p");t.classList.add("aos_font"),t.innerHTML=`${e[0]}: ${e[1]}`,r.appendChild(t)}}renderSpells(e,t){const n=this.createTable([{name:"NAME",width:"25%"},{name:"CASTING VALUE",width:"15%"},{name:"RANGE",width:"10%"},{name:"DESCRIPTION",width:"50%"}]);n.classList.add("table","table-sm","aos_font");let r=document.createElement("tbody");n.appendChild(r);for(let e of t){let t=document.createElement("tr"),n=document.createElement("td");n.textContent=e._name;let i=document.createElement("td");i.textContent=e._castingValue.toString();let o=document.createElement("td");o.textContent=e._range.toString();let s=document.createElement("td");s.textContent=e._description,t.appendChild(n),t.appendChild(i),t.appendChild(o),t.appendChild(s),r.appendChild(t)}e.appendChild(n)}}},66:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererHH2=void 0;const r=n(980);class i{constructor(e){this._roster=null,this._roles=new Map,this._infantryLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.05,.05,.05,.05,.1],this._vehicleLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.2,.1],this._knightLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.05,.05,.05,.05,.1],this._fortificationLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.2,.15],this._weaponLabelWidthNormalized=[.25,.05,.05,.05,.15,.35],this._psychicWeaponLabelWidthNormalized=[.25,.05,.05,.05,.15,.35],this._psychicPowerLabelWidthNormalized=[.25,.75],this._wargearLabelWidthNormalized=[.25,.75],this._roster=e,this._roles.set(r.HorusHeresy.UnitRole.HQ,document.getElementById("role_hq")),this._roles.set(r.HorusHeresy.UnitRole.TR,document.getElementById("role_tr")),this._roles.set(r.HorusHeresy.UnitRole.EL,document.getElementById("role_el")),this._roles.set(r.HorusHeresy.UnitRole.FA,document.getElementById("role_fa")),this._roles.set(r.HorusHeresy.UnitRole.HS,document.getElementById("role_hs")),this._roles.set(r.HorusHeresy.UnitRole.FL,document.getElementById("role_fl")),this._roles.set(r.HorusHeresy.UnitRole.DT,document.getElementById("role_dt")),this._roles.set(r.HorusHeresy.UnitRole.FT,document.getElementById("role_ft")),this._roles.set(r.HorusHeresy.UnitRole.LW,document.getElementById("role_lw")),this._roles.set(r.HorusHeresy.UnitRole.PR,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`],n=`${this._roster._name} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n))}t&&this.renderRosterSummary(t),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(this._roster)for(const t of this._roster._forces){const n=document.createElement("div");t._faction?n.appendChild(document.createTextNode(`${t._catalog} ${t._name} (${t._faction})`)):n.appendChild(document.createTextNode(`${t._catalog} ${t._name}`)),e.appendChild(n);const i=document.createElement("table");i.classList.add("table","table-sm","table-striped");const o=document.createElement("thead");i.appendChild(o),o.classList.add("thead-light");const s=document.createElement("tr");o.appendChild(s),[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,s.appendChild(t)})),n.appendChild(i);let a=document.createElement("tbody");i.appendChild(a);for(let e of t._units){const t=document.createElement("tr");t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._name)),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.HorusHeresy.UnitRoleToString[e._role]));const n=t.appendChild(document.createElement("td"));this.renderModelList(n,e),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._points.toString())),a.appendChild(t)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",l)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",l))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;te._role!=t._role?e._role-t._role:e._name!=t._name?r.HorusHeresy.Compare(e._name,t._name):e._points-t._points)),this.renderDatasheets(o,s);let u=document.createElement("div");u.style.pageBreakBefore="always",this.printRules(t,u),this.printRules(n,u),e.appendChild(u)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),""],[.1,.8,.1]));const h=c.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=h.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let f=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(o(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);if(f&&l.appendChild(f),t._modelStats.length>0){const e=function(e){let t=new Map;const n=e.filter((e=>e instanceof r.HorusHeresy.Vehicle));t.set("Vehicles",n);const i=e.filter((e=>e instanceof r.HorusHeresy.Knight));t.set("Knights",i);const o=e.filter((e=>e instanceof r.HorusHeresy.Fortification));t.set("Fortifications",o);const s=e.filter((e=>e instanceof r.HorusHeresy.Model));return t.set("Models",s),t}(t._modelStats),n=e.get("Models");if(null!=n&&n.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._infantryLabels,this._infantryLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of n){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._ws.toString(),n._bs.toString(),n._str.toString(),n._toughness.toString(),n._wounds.toString(),n._initiative.toString(),n._attacks.toString(),n._leadership.toString(),n._save],this._infantryLabelWidthsNormalized))}}const s=e.get("Vehicles");if(null!=s&&s.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._vehicleLabels,this._vehicleLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of s){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._bs.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._capacity.toString()],this._vehicleLabelWidthsNormalized))}}const a=e.get("Knights");if(null!=a&&a.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._knightLabels,this._knightLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of a){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._ws.toString(),n._bs.toString(),n._str.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._initiative.toString(),n._attacks.toString(),n._hp.toString()],this._knightLabelWidthsNormalized))}}const u=e.get("Fortifications");if(null!=u&&u.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._fortificationLabels,this._fortificationLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of u){let n=t;e.append(o([n._name,n._type,n._bs.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._capacity.toString()],this._fortificationLabelWidthsNormalized))}}}f=s("Model notes",t._models),f&&l.appendChild(f);const p=t.weapons();if(p.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._weaponLabels,this._weaponLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of p){let n=t._type.split(","),r=n[0].trim(),i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),e.append(o([t.name().toString(),t._range,t._str.toString(),t._ap,r,i],this._weaponLabelWidthNormalized))}}f=s("Weapon notes",p),f&&l.appendChild(f);const _=t.wargear();if(_.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._wargearLabels,this._wargearLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of _)e.append(o([t.name(),t._description],this._wargearLabelWidthNormalized))}f=s("Wargear Item notes",_),f&&l.appendChild(f);const m=t.psychicWeapons();if(m.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._psychicWeaponLabels,this._psychicWeaponLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of m){let n=t._type.split(","),r=n[0].trim(),i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),e.append(o([t.name().toString(),t._range,t._str.toString(),t._ap,r,i],this._psychicWeaponLabelWidthNormalized))}}f=s("Psychic Weapon notes",m),f&&l.appendChild(f);const g=t.psychicPowers();if(g.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._psychicPowerLabels,this._psychicPowerLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of g)e.append(o([t.name(),t._description],this._psychicPowerLabelWidthNormalized))}f=s("Psychic Power notes",g),f&&l.appendChild(f);const v=t.warlordTraits();if(v.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(["Warlord Trait","Description"],[.25,.75],!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of v)e.append(o([t.name(),t._description],[.25,.75]))}f=s("Warlord Trait notes",v),f&&l.appendChild(f);const b=t.reactions();if(b.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(["Reaction","Description"],[.25,.75],!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of b)e.append(o([t.name(),t._description],[.25,.75]))}if(t._rules.size>0){const e=Array.from(t._rules.keys()).sort(r.HorusHeresy.Compare),n=t.weaponRules();let i=[];for(const t of e)n.includes(t)||i.push(t);this.renderUnitRules(l,"Rules",i)}c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const y=Array.from(t._keywords).sort(r.HorusHeresy.Compare).join(", ").toLocaleUpperCase();c.appendChild(o(["Keywords",y],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const w=document.createElement("div");this.renderModelList(w,t),c.appendChild(o(["MODELS",w],[.1,.9],!1))}renderUnitRules(e,t,n){const r=e.appendChild(document.createElement("thead"));r.classList.add("info_row");const i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),r.appendChild(o([t,i],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n._name));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=a(document.createElement("div")),r=document.createElement("b");r.id=t[0],r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n=!1){const r=a(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;ie._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(o([e,r],[.1,.9],!1)),n}function a(e){return e.classList.add("hide_able"),e}function l(e){let t=e.target;t&&(t=t.closest(".hide_able")),t&&(t.classList.contains("hidden")?t.classList.remove("hidden"):t.classList.add("hidden"))}t.RendererHH2=i,i._infantryLabels=["Model","Type","M","WS","BS","S","T","W","I","A","Ld","Sv",""],i._vehicleLabels=["Model","Type","M","BS","Front","Side","Rear","HP","Capacity",""],i._knightLabels=["Model","Type","M","WS","BS","S","Front","Side","Rear","I","A","HP",""],i._fortificationLabels=["Model","Type","BS","Front","Side","Rear","HP","Capacity",""],i._weaponLabels=["Weapon","Range","Str","AP","Type","Rules"],i._psychicWeaponLabels=["Psychic Weapon","Range","Str","AP","Type","Rules"],i._psychicPowerLabels=["Psychic Power","Description"],i._wargearLabels=["Wargear Item","Description"]},96:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererKT21=void 0;const r=n(249),i=n(419);class o{constructor(e){this._descriptionStartX=140,this._descriptionWidth=600,this._roster=null,this._octagon=null,this._specialisms=new Map,this._currentX=0,this._currentY=0,this._maxWidth=0,this._maxHeight=0,this._unitLabelWidthsNormalized=[.25,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.25,.05,.05,.05,.2,.2],this._spellLabelWidthNormalized=[.25,.75],this._roster=e,this._octagon=document.getElementById("octagon"),this._specialisms.set(r.Specialism.NONE,document.getElementById("role_hq")),this._specialisms.set(r.Specialism.COMBAT,document.getElementById("role_hs")),this._specialisms.set(r.Specialism.STAUNCH,document.getElementById("role_fa")),this._specialisms.set(r.Specialism.MARKSMAN,document.getElementById("role_el")),this._specialisms.set(r.Specialism.SCOUT,document.getElementById("role_tr"))}render(e,t,n){if(null==this._roster)return void console.log("Roster is NULL");e&&(e.innerHTML="

"+this._roster.name()+" ("+this._roster._equipmentPoints+" EP)

");let r=new Map,i=new Map;for(let s of this._roster._forces){let a=r.get(s._catalog);a||(a=new Map,r.set(s._catalog,a));let l=i.get(s._catalog);l||(l=new Map,i.set(s._faction,l));const c=document.createElement("div");c&&(s._faction?c.innerHTML="

"+s._faction+" - "+s.name()+"

":c.innerHTML="

"+s.name()+"

"),t&&t.appendChild(c);const u=document.createElement("table");u.classList.add("table"),u.classList.add("table-sm"),u.classList.add("table-striped");const d=document.createElement("thead");u.appendChild(d),d.classList.add("thead-light");const h=document.createElement("tr");d.appendChild(h),[{name:"MODELS",w:"55%"},{name:"EP",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,h.appendChild(t)})),c.appendChild(u);let f=document.createElement("tbody");if(u.appendChild(f),s._leader){let m=document.createElement("tr"),g=document.createElement("td");g.innerHTML=s._leader.nameAndGear();let v=document.createElement("td");v.innerHTML=s._leader.costs().toString(),m.appendChild(g),m.appendChild(v),f.appendChild(m)}for(let b of s._operatives){let y=document.createElement("tr"),w=document.createElement("td");w.innerHTML=b.nameAndGear();let C=document.createElement("td");C.innerHTML=b.costs().toString(),y.appendChild(w),y.appendChild(C),f.appendChild(y)}if(n){const S=document.createElement("div");if(S){const x=document.createElement("p");x.appendChild(document.createTextNode(s.name())),s._faction&&x.appendChild(document.createTextNode(" ("+s._faction+")")),S.appendChild(x)}let E=document.createElement("h3");E.appendChild(S),n.appendChild(E)}s._leader&&this.printOperative(s._leader,null,n);let p=null;for(let k of s._operatives)this.printOperative(k,p,n),p=k;function _(e,t){for(const n of t)e.set(n[0],n[1])}if(s._rules.size>0&&_(a,s._rules),s._factionRules.size>0&&_(l,s._factionRules),s._leader&&s._leader._rules.size>0&&_(a,s._leader._rules),s._operatives&&s._operatives.length>0)for(const A of s._operatives)A._rules&&A._rules.size>0&&_(a,A._rules)}let o=document.createElement("div");o.style.pageBreakBefore="always",this.printRules(r,o),this.printRules(i,o),n&&n.appendChild(o)}printOperative(e,t,n){let r=document.createElement("canvas");if(r.width=7.5*o._res,r.height=12*o._res,r.style.width=r.width.toString(),r.style.height=r.height.toString(),this._descriptionWidth=r.width-this._descriptionStartX-10,e.equal(t))return;const i=this.renderOperative(e,r,0,0);let s=document.createElement("canvas");s.width=i[0]+30,s.height=i[1]+30,s.style.width=s.width.toString(),s.style.height=s.height.toString();let a=s.getContext("2d");if(null==a||a.drawImage(r,15,15),n){let e=document.createElement("div");e.appendChild(s),n.appendChild(e)}}printRules(e,t){if(e.size>0)for(let[n,r]of e.entries()){if(0==r.size)continue;let e=document.createElement("div"),i=document.createElement("h3");e.appendChild(i),i.textContent=n;for(let t of r){let n=document.createElement("div"),r=document.createElement("b");r.textContent=t[0];let i=document.createElement("p");i.setAttribute("style","white-space: pre-wrap;"),i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t&&t.appendChild(e)}}renderBorder(e,t,n,r,i){e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.stroke(),e.save(),e.fillStyle=o._fillColor,e.globalCompositeOperation="destination-over",e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.fill(),e.restore()}renderNotes(e,t,n){n._customNotes&&(this.renderLine(e),e.font=o._headerFont,(0,i.RenderText)(e,t.toLocaleUpperCase(),this._currentX+o._offset,this._currentY,100,16,i.Justification.Left),e.font=o._font,this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,n._customNotes,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth-o._offset,0),this._currentY+=2)}renderNotesArray(e,t,n){let r=0;for(const e of n)e._customNotes&&r++;if(0!=r){this.renderLine(e),e.font=o._headerFont,(0,i.RenderText)(e,t.toLocaleUpperCase(),this._currentX+o._offset,this._currentY,100,16,i.Justification.Left);for(const t of n){const n=t.name()+":",r=t._customNotes;if(!r)continue;e.font=o._headerFont,this._currentY+=2,(0,i.RenderTextFull)(e,n,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,16,i.Justification.Left,i.VertAlign.Top);let s=e.measureText(n).width;e.font=o._font,this._currentY=(0,i.RenderParagraph)(e," "+r,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth-o._offset,s),this._currentY+=2}}}renderLine(e){e.lineWidth=2,e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(this._currentX,this._currentY),e.lineTo(this._currentX+this._maxWidth,this._currentY),e.stroke(),this._currentY+=1}renderTableHeader(e,t,n,r){let s=this._currentX;const a=this._maxWidth;e.fillStyle=o._grey1,e.fillRect(this._currentX,this._currentY,a,22),e.fillStyle=o._blackColor,e.font=o._titleFont;var l=50;if(t){e.font=o._headerFont;for(let a=0;a{l.push(e*this._maxWidth)}));for(let t of e._weapons)s.push(t);for(let t of e._psychicPowers)a.push(t);const c=[],u=new Map;u.has(e.name())||(u.set(e.name(),e),c.push(e)),this.renderNotes(i,"Operative notes",e),this.renderTableHeader(i,o._unitLabels,l,null);let d=0;for(var h of c)this.renderModel(i,h,l,d%2),d++;this.renderNotes(i,"Model notes",e);const f=[],p=new Map;for(const e of s)p.has(e.name())||(p.set(e.name(),e),f.push(e));if(f.length>0){const e=[];this._weaponLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._weaponLabels,e,o._weaponJustifications),this.renderWeapons(i,f,e)}if(this.renderNotesArray(i,"Weapons notes",s),a.length>0){const e=[];this._spellLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._spellLabels,e,null),this.renderSpells(i,a,e)}this.renderNotesArray(i,"Spell notes",a),(e._abilities.size>0||e._rules.size>0)&&(this.renderLine(i),this._currentY+=2,this.renderAbilities(i,e)),e._factions.size>0&&(this.renderLine(i),this._currentY+=2,this.renderFactions(i,e)),e._keywords.size>0&&(this.renderLine(i),this._currentY+=2,this.renderKeywords(i,e)),this.renderLine(i),this._currentY+=2,this.renderModelList(i,[e]),this._currentY+=2;const _=this._currentY-(r+o._margin),m=this._maxWidth;return this.renderBorder(i,this._currentX,r+o._margin,m,_),[this._maxWidth,this._currentY]}renderHeader(e,t){t.globalAlpha=1,t.fillStyle=o._blackColor;const n=this._currentX,r=this._currentX+this._maxWidth,s=this._currentY,a=s+36;t.beginPath(),t.moveTo(n,s+o._bevelSize),t.lineTo(n,a),t.lineTo(r,a),t.lineTo(r,s+o._bevelSize),t.lineTo(r-o._bevelSize,s),t.lineTo(n+o._bevelSize,s),t.closePath(),t.fill();let l=n+6;if(this._octagon){t.drawImage(this._octagon,l,s+2,32,32);const n=this._specialisms.get(e._role);n&&t.drawImage(n,l+4,s+2+4,24,24),t.fillStyle="white",t.font="18px serif",l+=34,t.drawImage(this._octagon,l,s+2,32,32),(0,i.RenderText)(t,e.costs().toString(),l,s+2,32,32,i.Justification.Center)}let c=0,u=28;const d=l+6;t.font=u+"px bold serif";const h=e.name().toLocaleUpperCase();let f=t.measureText(h);const p=this._maxWidth-d;for(;c<6&&f.width>p;)c+=1,u-=2,t.font=u+"px bold serif",f=t.measureText(h);t.fillStyle="white",t.textBaseline="top",(0,i.RenderText)(t,h,d,s,p,36,i.Justification.Center),this._currentY+=36}}t.RendererKT21=o,o._res=144,o._margin=0,o._bevelSize=15,o._blackColor="#1d272a",o._grey1="#b3bbb5",o._greyLight="#dde1df",o._fillColor="#f6f6f6",o._offset=20,o._titleFont="bold 14px sans-serif",o._headerFont="bold 14px sans-serif",o._font="14px sans-serif",o._boldFont="bold 14px sans-serif",o._unitLabels=["Operative","M","APL","GA","DF","Save","W"],o._weaponLabels=["WEAPONS","A","WS/BS","D","SR","!"],o._weaponJustifications=[i.Justification.Left,i.Justification.Center,i.Justification.Center,i.Justification.Center,i.Justification.Left,i.Justification.Left],o._spellLabels=["PSYCHIC POWER","DETAILS"]},77:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderMESBG=void 0;const n=/\s+/g,r=(e,t="")=>{const n=document.createElement(e);return n.className=t,n},i=(e,t="",n="")=>{const i=r(e,t);return i.appendChild(document.createTextNode(n)),i},o=()=>r("div","mesbg_noBreak mesbg_bumpDown"),s=()=>r("table","mesbg_profileTable mesbg_noBreak mesbg_bumpDown"),a=(e,t)=>{const n=s();return n.appendChild((e=>{const t=r("tr");return e.forEach((e=>{t.appendChild(i("th","",e))})),t})(e)),n.appendChild((e=>{const t=r("tr");return e.forEach((e=>{t.appendChild(i("td","",e))})),t})(t)),n},l=e=>[e.movement,e.fight,e.strength,e.defense,e.attack,e.wounds,e.courage].join("-"),c=e=>i("h2","mesbg_h2",e),u=e=>i("h2","mesbg_h2",e),d={showTracker:!0,showRules:!0,woundChart:!0},h=(e,t)=>{const n=document.createElement("input");n.setAttribute("type","checkbox"),n.setAttribute("name",e),n.setAttribute("id",e),d[e]&&n.setAttribute("checked","checked"),n.addEventListener("change",(e=>()=>{const t=!d[e];d[e]=t;const n=document.querySelector(`.mesbg_${e}`);null!==n&&(t?n.classList.remove("mesbg_hideMe"):n.classList.add("mesbg_hideMe"))})(e));const r=document.createElement("label");return r.setAttribute("for",e),r.appendChild(document.createTextNode(` ${t} `)),r.prepend(n),r},f=["Mv","F","S","D","A","W","C"];t.renderMESBG=(e,t,d,p)=>{if(null!==t){const n=r("div","mesbg_noPrint mesbg_toggleHolder");n.appendChild(h("showRules","show rules text")),n.appendChild(h("showTracker","include hero points tracker")),n.appendChild(h("woundChart","include To Wound Chart")),t.appendChild(n),t.appendChild((_=e.name,i("h1","mesbg_h1",_))),t.appendChild(i("h4","mesbg_rosterInfo",`${e.points} points | ${e.warriors} warriors `))}var _;if(null!==d){const t=r("div","mesbg_container");d.appendChild(t),e.forces.forEach((n=>{t.appendChild(i("h2","mesbg_forceName",n.name)),t.appendChild(i("h4","mesbg_h4 mesbg_bumpDown",`${n.breakpoints.modelCount} models\n | broken at ${n.breakpoints.half} casualties\n | quartered at ${n.breakpoints.quarter} models remaining\n `)),i("p","mesbg_rosterInfo",`${e.points} points | ${e.warriors} warriors `);const o=r("div","mesbg_flexGrid");t.appendChild(o),n.units.forEach((e=>{var t,n;const s=r("div","mesbg_card");s.appendChild(c(`${e.leader.name} - ${e.leader.points}pts ${(null===(t=e.leader.heroStuff)||void 0===t?void 0:t.isLeader)?" (Leader)":""}`)),s.appendChild((e=>i("p","mesbg_equipmentList",e))(`${e.leader.wargear.map((e=>e.name)).join(", ")}${e.leader.mount?", "+(null===(n=e.leader.mount)||void 0===n?void 0:n.name):""}`)),s.appendChild(r("hr","mesbg_bumpDown")),e.warband.forEach((e=>{var t;const n=u(`${e.count} ${e.model.name} - ${e.points}pts`);s.appendChild(n),s.appendChild(i("p","mesbg_equipmentList",`${e.model.wargear.map((e=>e.name)).join(", ")}${e.model.mount?", "+(null===(t=e.model.mount)||void 0===t?void 0:t.name):""}`))})),o.appendChild(s)}))}))}if(null!=p){const t=r("div","mesbg_container");p.appendChild(t),e.forces.forEach((e=>{const d=new Map;e.units.forEach((e=>{var h,p,_,m,g,v,b,y,w,C,S,E;const x=r("div","mesbg_card"),k=r("div","mesbg_twoColumn");x.appendChild(c(`${e.leader.name} - ${e.leader.points}pts`)),x.appendChild(i("h3","mesbg_h3 mesbg_bumpDown",e.leader.keywords.join(", ")));const A=r("div","mesbg_flex mesbg_noBreak");A.appendChild(a(f,[e.leader.profile.movement,e.leader.profile.fight,e.leader.profile.strength,e.leader.profile.defense,e.leader.profile.attack,e.leader.profile.wounds,e.leader.profile.courage])),A.appendChild(a(["M","W","F"],[null!==(p=null===(h=e.leader.heroStuff)||void 0===h?void 0:h.might)&&void 0!==p?p:"-",null!==(m=null===(_=e.leader.heroStuff)||void 0===_?void 0:_.will)&&void 0!==m?m:"-",null!==(v=null===(g=e.leader.heroStuff)||void 0===g?void 0:g.fate)&&void 0!==v?v:"-"])),k.appendChild(A);const T=o();if(T.appendChild(i("h3","mesbg_h3","Wargear")),0===e.leader.wargear.length?T.appendChild(i("i","","none")):T.appendChild(i("p","mesbg_cardWargear",e.leader.wargear.map((e=>e.name)).join(", "))),k.appendChild(T),null!==(y=null===(b=e.leader.heroStuff)||void 0===b?void 0:b.actions.length)&&void 0!==y&&y){const t=o();t.appendChild(i("h3","mesbg_h3","Heroic Actions"));const n=r("ul","mesbg_list mesbg_noBreak mesbg_bumpDown");null===(w=e.leader.heroStuff)||void 0===w||w.actions.forEach((e=>{n.appendChild(r("li")).appendChild(document.createTextNode(e))})),t.appendChild(n),k.appendChild(t)}if(k.appendChild(i("h3","mesbg_h3","Special Rules")),k.appendChild(i("p","mesbg_bumpDown",e.leader.rules.map((e=>e.name)).join(", "))),null!==(S=null===(C=e.leader.heroStuff)||void 0===C?void 0:C.magicalPowers.length)&&void 0!==S&&S){const t=s();t.className="mesbg_powerTable mesbg_noBreak";const n=r("tr");n.appendChild(r("th")).appendChild(i("h3","mesbg_h3","Magical Powers")),n.appendChild(r("th")).appendChild(i("span","","Range")),n.appendChild(r("th")).appendChild(i("span","","Casting")),t.appendChild(n),null===(E=e.leader.heroStuff)||void 0===E||E.magicalPowers.forEach((e=>{const n=r("tr");n.appendChild(r("td")).appendChild(i("span","",e.name)),n.appendChild(r("td")).appendChild(i("span","",e.range)),n.appendChild(r("td")).appendChild(i("span","",e.casting)),t.appendChild(n)})),k.appendChild(t)}if(void 0!==e.leader.mount){const t=o();t.appendChild(u(`Mount: ${e.leader.mount.name}`));const n=r("div","mesbg_flex mesbg_noBreak");n.appendChild(a(f,[e.leader.mount.profile.movement,e.leader.mount.profile.fight,e.leader.mount.profile.strength,e.leader.mount.profile.defense,e.leader.mount.profile.attack,e.leader.mount.profile.wounds,e.leader.mount.profile.courage])),t.append(n),k.append(t)}x.appendChild(k),t.appendChild(x),e.warband.forEach((e=>{const t=e.model,r=(e=>{var t,r;return e.name.trim().replace(n,"-")+(null!==(r=null===(t=e.mount)||void 0===t?void 0:t.name.trim().replace(n,"-"))&&void 0!==r?r:"")})(t);if(d.has(r)){const e=d.get(r),n=l(t.profile),i=null==e?void 0:e.statLines.get(n),o=t.wargear.map((e=>e.name.trim())).join(", ");void 0===i?null==e||e.statLines.set(n,{profile:t.profile,equipments:new Set([o])}):i.equipments.add(o)}else{const e={name:t.name,keywords:t.keywords.join(", "),mount:t.mount,ruleNames:t.rules.map((e=>e.name)).join(", "),statLines:new Map([[l(t.profile),{profile:t.profile,equipments:new Set([t.wargear.map((e=>e.name.trim())).join(", ")])}]])};d.set(r,e)}}))}));const h=r("div","mesbg_twoColumnGrid");d.forEach(((e,t)=>{const n=r("div","mesbg_card"),s=r("div","mesbg_twoColumn");if(n.appendChild(u(e.name)),n.appendChild(i("p","mesbg_cardWargear mesbg_bumpDown",e.keywords)),e.statLines.forEach(((e,t)=>{const n=r("div","mesbg_noBreak");n.appendChild(i("h3","mesbg_h3","Wargear")),e.equipments.forEach((e=>{n.appendChild(i("p","mesbg_cardWargear",e))})),n.appendChild(a(f,[e.profile.movement,e.profile.fight,e.profile.strength,e.profile.defense,e.profile.attack,e.profile.wounds,e.profile.courage])),s.appendChild(n)})),e.ruleNames.length>0&&(s.appendChild(i("h3","mesbg_h3","Special Rules")),s.appendChild(i("p","mesbg_bumpDown",e.ruleNames))),void 0!==e.mount){const t=o();t.appendChild(u(`Mount: ${e.mount.name}`));const n=r("div","mesbg_flex mesbg_noBreak");n.appendChild(a(f,[e.mount.profile.movement,e.mount.profile.fight,e.mount.profile.strength,e.mount.profile.defense,e.mount.profile.attack,e.mount.profile.wounds,e.mount.profile.courage])),t.append(n),s.append(t)}n.appendChild(s),h.appendChild(n)})),t.appendChild(h)}));const d=new Set,h=r("div","mesbg_pageBreak mesbg_showRules");h.appendChild(i("h1","mesbg_h1","Rules"));const _=r("div","mesbg_twoColumn");e.forces.forEach((n=>{n.armyBonus.forEach((e=>{_.appendChild(i("h3","mesbg_h3",`"${e.name}" (Army Bonus)`)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText))})),n.units.forEach((e=>{e.leader.rules.forEach((e=>{!1===d.has(e.name)&&(_.appendChild(i("h3","mesbg_h3",e.name)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText)),d.add(e.name))})),e.warband.forEach((e=>{e.model.rules.forEach((e=>{!1===d.has(e.name)&&(_.appendChild(i("h3","mesbg_h3",e.name)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText)),d.add(e.name))}))}))})),h.appendChild(_),t.appendChild(h);const o=r("table","mesbg_pageBreak mesbg_trackerTable mesbg_showTracker");o.innerHTML="MWF",e.forces.forEach((e=>{e.units.forEach((e=>{const t=r("tr");t.innerHTML=`

${e.leader.name}

`,o.appendChild(t)}))})),t.appendChild(o);const s=r("table","mesbg_pageBreak mesbg_woundChart");s.innerHTML='\n \n \n  Defence\n \n \n \n \n Strength\n   1 2 3 4 5 6 7 8 9 10\n \n \n 1 4 5 5 6 6 6/4 6/5 6/6 - -\n \n \n 2 4 4 5 5 6 6 6/4 6/5 6/6 -\n \n \n 3 3 4 4 5 5 6 6 6/4 6/5 6/6\n \n \n 4 3 3 4 4 5 5 6 6 6/4 6/5\n \n \n 5 3 3 3 4 4 5 5 6 6 6/4 \n \n 6 3 3 3 3 4 4 5 5 6 6\n \n \n 7 3 3 3 3 3 4 4 5 5 6\n \n \n 8 3 3 3 3 3 3 4 4 5 5\n \n \n 9 3 3 3 3 3 3 3 4 4 5\n \n \n 10 3 3 3 3 3 3 3 3 4 4\n \n \n ',t.appendChild(s)}))}}},717:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererWarcry=void 0;const r=n(320);t.RendererWarcry=class{constructor(e){this._roster=null,this._roster=e}render(e,t,n){if(null!=this._roster){e&&(e.innerHTML="

"+this._roster._name+" ("+this._roster._points+" pts

");for(let e of this._roster._forces){const i=document.createElement("div");i&&(i.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(i);const o=document.createElement("table");o.classList.add("table"),o.classList.add("table-sm"),o.classList.add("table-striped");const s=document.createElement("thead");o.appendChild(s),s.classList.add("thead-light");const a=document.createElement("tr");s.appendChild(a),[{name:"NAME",w:"35%"},{name:"ROLE",w:"25%"},{name:"POINTS",w:"15%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,a.appendChild(t)})),i.appendChild(o);let l=document.createElement("tbody");o.appendChild(l);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name;let i=document.createElement("td");i.innerHTML=r.WarcryUnitRoleToString[t._role];let o=document.createElement("td");o.innerHTML=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),l.appendChild(e)}let c=document.createElement("div");if(e._allegiance._rules.size>0){let t=document.createElement("h3");c.appendChild(t),t.textContent=e._allegiance._name+" Abilities";for(let t of e._allegiance._rules){let e=document.createElement("div"),n=document.createElement("h4");n.textContent=t[0];let r=document.createElement("p");r.textContent=t[1],e.appendChild(n),e.appendChild(r),c.appendChild(e)}}if(!n)return;n.appendChild(c);let u=document.createElement("div");for(let t of e._units){u.appendChild(this.renderUnitHtml(t));let e=document.createElement("hr");e.className="aos_dark",u.appendChild(e)}n.appendChild(u)}}}createCharacteristicCard(e,t){let n=document.createElement("div");return n.className="col",n.innerHTML=`\n
\n \n
\n

${t}

\n
\n
`,n}createWeapon(e,t){let n=document.createElement("p");n.className="card-title warcry_font",n.innerHTML=e._name,t.appendChild(n);let r=document.createElement("div");r.className="row",t.appendChild(r);let i=this.getWeaponTypeRunemark(e._name),o=document.createElement("div");o.className="col",o.innerHTML=`\n
\n \n
`,r.appendChild(o);let s=this.createCharacteristicCard("range",e._range);r.appendChild(s);let a=this.createCharacteristicCard("attacks",e._attacks);r.appendChild(a);let l=this.createCharacteristicCard("strength",e._strength);r.appendChild(l);let c=this.createCharacteristicCard("damage",e._damage);r.appendChild(c)}renderUnitHtml(e){let t=document.createElement("div");t.className="container-fluid warcry_unit border bg-light";let n=document.createElement("div");n.className="row align-items-center",t.append(n);let r=document.createElement("div");r.className="col-1",r.innerHTML=``,n.appendChild(r);let i=document.createElement("div");i.className="col",i.innerHTML=`${e._name}`,n.appendChild(i);let o=document.createElement("div");o.className="col-4",n.appendChild(o);for(let t of e._keywords){const e=this.getAbilityRunemark(t);if(""!=e){let t=new Image;t.className="border border-dark rounded-circle warcry_card",t.src=`./assets/warcry/runemarks/black/fighters-${e}.svg`,o.appendChild(t)}}let s=document.createElement("div");s.className="col-1",s.innerHTML=`
${e._points}
`,n.appendChild(s);let a=document.createElement("div");a.className="row align-items-center",t.append(a);let l=document.createElement("div");l.className="col-7",a.appendChild(l),2==e._weapons.length&&this.createWeapon(e._weapons[1],l);let c=document.createElement("div");c.className="col",a.appendChild(c);let u=document.createElement("div");u.className="row align-items-center",t.append(u);let d=document.createElement("div");d.className="col-7",u.appendChild(d),e._weapons.length>=1&&this.createWeapon(e._weapons[0],d);let h=document.createElement("div");h.className="col",u.appendChild(h);let f=document.createElement("div");f.className="row",h.appendChild(f);let p=document.createElement("div");p.className="col",f.appendChild(p);let _=this.createCharacteristicCard("move",e._move.toString());f.appendChild(_);let m=this.createCharacteristicCard("toughness",e._toughness.toString());f.appendChild(m);let g=this.createCharacteristicCard("wounds",e._wounds.toString());if(f.appendChild(g),e._damageTable.length>0){let n=document.createElement("div");n.className="row w-75 align-items-center",t.append(n);let r=document.createElement("div");r.className="p-2 mb-2 text-center text-uppercase text-black",r.innerHTML='Damage Table',n.appendChild(r);let i=[{name:"Damage Points Allocated",width:"50%"},{name:"Move",width:"25%"},{name:"Damage ",width:"25%"}],o=1;for(let t of e._damageTable[0]._table)i[o++].name=t[0];const s=this.createTable(i);n.appendChild(s);let a=document.createElement("tbody");s.appendChild(a);for(let t of e._damageTable){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name,e.appendChild(n);for(let n of t._table){let t=document.createElement("td");t.innerHTML=n[1],e.appendChild(t)}a.appendChild(e)}}return t}createTable(e){const t=document.createElement("table");t.className="table table-bordered table-sm text-center";const n=document.createElement("thead");t.appendChild(n),n.classList.add("warcry_light");const r=document.createElement("tr");return n.appendChild(r),e.forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.width,r.appendChild(t)})),t}getAbilityRunemark(e){const t=e.toLowerCase();return t.includes("agile")?"agile":t.includes("ally")?"ally":t.includes("beast")?"beast":t.includes("berserker")?"berserker":t.includes("brute")?"brute":t.includes("bulwark")?"bulwark":t.includes("champion")?"champion":t.includes("destroyer")?"destroyer":t.includes("elite")?"elite":t.includes("ferocious")?"ferocious":t.includes("fly")?"fly":t.includes("frenzied")?"frenzied":t.includes("gargantuan")?"gargantuan":t.includes("icon")?"icon-bearer":t.includes("leader")?"leader":t.includes("minion")?"minion":t.includes("mount")?"mount":t.includes("mystic")?"mystic":t.includes("priest")?"priest":t.includes("scout")?"scout":t.includes("sentience")?"sentience":t.includes("terrifying")?"terrifying":t.includes("thrall")?"thrall":t.includes("trapper")?"trapper":t.includes("warrior")?"warrior":""}getWeaponTypeRunemark(e){const t=e.toLowerCase();return t.includes("axe")||t.includes("cleaver")?"axe":t.includes("claws")||t.includes("talon")||t.includes("grasping")||t.includes("pincher")?"claws":t.includes("club")?"club":t.includes("dagger")||t.includes("shank")?"dagger":t.includes("fangs")||t.includes("teeth")||t.includes("jaws")||t.includes("maw")?"fangs":t.includes("hammer")||t.includes("anvil")?"hammer":t.includes("mace")||t.includes("staff")||t.includes("stave")||t.includes("flail")?"mace":t.includes("scythe")?"scythe":t.includes("spear")||t.includes("glaive")||t.includes("halberd")||t.includes("lance")||t.includes("harpoon")||t.includes("polearm")?"spear":t.includes("sword")||t.includes("blade")||t.includes("sickles")?"sword":t.includes("arcane bolt")||t.includes("sorcerous bolt")?"blast":t.includes("bow")||t.includes("bolas")||t.includes("cannon")||t.includes("pistol")||t.includes("javelin")?"ranged-weapon":t.includes("whip")?"reach-weapon":"unarmed"}}},391:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Create30kRoster=t.Roster30k=t.Force30k=t.Unit30k=t.Fortification30k=t.Model30k=t.Flyer30k=t.Walker30k=t.Vehicle30k=t.UnitRoleToString30k=t.UnitRole30k=t.PsychicPower30k=t.Psyker30k=t.Weapon30k=void 0;class n{constructor(){this._name="",this._range="Melee",this._str="user",this._ap="",this._type="Melee"}}t.Weapon30k=n;class r{constructor(){this._name="",this._masteryLevel="",this._disciplines=""}}t.Psyker30k=r;class i{constructor(){this._name="",this._warpCharge=0,this._category="",this._range="",this._details=""}}var o;t.PsychicPower30k=i,function(e){e[e.NONE=0]="NONE",e[e.HQ=1]="HQ",e[e.TR=2]="TR",e[e.EL=3]="EL",e[e.FA=4]="FA",e[e.HS=5]="HS",e[e.FL=6]="FL",e[e.DT=7]="DT",e[e.FT=8]="FT",e[e.LW=9]="LW"}(o=t.UnitRole30k||(t.UnitRole30k={})),t.UnitRoleToString30k=["None","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War"];class s{constructor(){this._name="",this._bs="",this._front=4,this._side=4,this._rear=4,this._hp=1,this._type="",this._weapons=[]}}t.Vehicle30k=s;class a{constructor(){this._name="",this._ws="",this._bs="",this._str=4,this._front=4,this._side=4,this._rear=4,this._initiative=1,this._attacks="",this._hp=1,this._type="",this._weapons=[]}}t.Walker30k=a;class l{constructor(){this._name="",this._bs="",this._front=4,this._side=4,this._rear=4,this._hp=1,this._type="",this._role="",this._pursuit="",this._agility="",this._weapons=[]}}t.Flyer30k=l;class c{constructor(){this._name="",this._count=0,this._ws="",this._bs="",this._str=4,this._toughness=4,this._wounds=1,this._initiative=1,this._attacks="",this._leadership=7,this._save="",this._weapons=[],this._psyker=null,this._psychicPowers=[]}}t.Model30k=c,t.Fortification30k=class{constructor(){this._name="",this._composition="",this._type=""}};class u{constructor(){this._name="",this._role=o.NONE,this._factions=new Set,this._keywords=new Set,this._abilities=new Map,this._rules=new Map,this._models=[],this._walkers=[],this._vehicles=[],this._flyers=[],this._points=0}}t.Unit30k=u;class d{constructor(){this._catalog="",this._name="Unknown",this._faction="Unknown",this._rules=new Map,this._units=[]}}t.Force30k=d;class h{constructor(){this._commandPoints=0,this._points=0,this._name="",this._forces=[]}}function f(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function p(e,t){let n=e.querySelectorAll("force>selections>selection");for(let e of n){let n=m(e);n&&n._role!=o.NONE&&t._units.push(n)}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function _(e){switch(e){case"HQ":return o.HQ;case"Troops":return o.TR;case"Elites":return o.EL;case"Fast Attack":return o.FA;case"Heavy Support":return o.HS;case"Flyer":return o.FL;case"Dedicated Transport":return o.DT;case"Fortification":return o.FT;case"Lord of War":return o.LW}return o.NONE}function m(e){var t,d,h,f,p,m,g,v,b,y,w,C,S,E,x,k,A,T,N;let L=new u,R=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;R&&(L._name=R);let O=e.querySelectorAll(":scope categories>category");for(let e of O){let t=null===(d=e.getAttributeNode("name"))||void 0===d?void 0:d.nodeValue;if(t){const e="Faction: ",n=t.lastIndexOf(e);if(n>=0){const r=t.slice(n+e.length);L._factions.add(r)}else{const e=_(t.trim());e!=o.NONE?L._role=e:L._keywords.add(t)}}}let W=null,z=null,I=null,B=null,P=e.querySelectorAll(":scope profiles>profile");for(let e of P){let t=null===(h=e.getAttributeNode("name"))||void 0===h?void 0:h.nodeValue,n=null===(f=e.getAttributeNode("typeName"))||void 0===f?void 0:f.nodeValue;if(t&&n)if("Unit"===n){W=new c,W._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let t of n){let n=null===(p=t.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(n&&t.textContent)switch(n){case"WS":W._ws=t.textContent;break;case"BS":W._bs=t.textContent;break;case"S":W._str=+t.textContent;break;case"T":W._toughness=+t.textContent;break;case"W":W._wounds=+t.textContent;break;case"I":W._initiative=+t.textContent;break;case"A":W._attacks=t.textContent;break;case"LD":W._leadership=+t.textContent;break;case"Save":W._save=t.textContent}if(e.parentElement&&e.parentElement.parentElement){let t=null===(m=e.parentElement.parentElement.getAttributeNode("number"))||void 0===m?void 0:m.nodeValue;t&&(W._count=+t)}}L._models.push(W)}else if("Walker"===n){z=new a,z._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(g=e.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue;if(t&&e.textContent)switch(t){case"WS":z._ws=e.textContent;break;case"BS":z._bs=e.textContent;break;case"S":z._str=+e.textContent;break;case"Front":z._front=+e.textContent;break;case"Side":z._side=+e.textContent;break;case"Rear":z._rear=+e.textContent;break;case"I":z._initiative=+e.textContent;break;case"A":z._attacks=e.textContent;break;case"HP":z._hp=+e.textContent;break;case"Type":z._type=e.textContent}}L._walkers.push(z)}else if("Vehicle"===n){I=new s,I._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(v=e.getAttributeNode("name"))||void 0===v?void 0:v.nodeValue;if(t&&e.textContent)switch(t){case"BS":I._bs=e.textContent;break;case"Front":I._front=+e.textContent;break;case"Side":I._side=+e.textContent;break;case"Rear":I._rear=+e.textContent;break;case"HP":I._hp=+e.textContent;break;case"Type":I._type=e.textContent}}L._vehicles.push(I)}else if("Flyer"===n){B=new l,B._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(b=e.getAttributeNode("name"))||void 0===b?void 0:b.nodeValue;if(t&&e.textContent)switch(t){case"BS":B._bs=e.textContent;break;case"Front":B._front=+e.textContent;break;case"Side":B._side=+e.textContent;break;case"Rear":B._rear=+e.textContent;break;case"HP":B._hp=+e.textContent;break;case"Combat Role":B._role=e.textContent;break;case"Pursuit":B._pursuit=e.textContent;break;case"Agility":B._agility=e.textContent}}L._flyers.push(B)}}for(let e of P){let t=null===(y=e.getAttributeNode("name"))||void 0===y?void 0:y.nodeValue,o=null===(w=e.getAttributeNode("typeName"))||void 0===w?void 0:w.nodeValue;if(t&&o){if("Wargear Item"===o){let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(C=e.getAttributeNode("name"))||void 0===C?void 0:C.nodeValue;n&&e.textContent&&t&&"Description"===n&&L._abilities.set(t,e.textContent)}}else if("Weapon"===o){let r=new n;r._name=t;let i=e.querySelectorAll("characteristics>characteristic");for(let e of i){let t=null===(S=e.getAttributeNode("name"))||void 0===S?void 0:S.nodeValue;if(t&&e.textContent)switch(t){case"Range":r._range=e.textContent;break;case"Type":r._type=e.textContent;break;case"Strength":r._str=e.textContent;break;case"AP":r._ap=e.textContent}}W?W._weapons.push(r):z?z._weapons.push(r):I?I._weapons.push(r):B?B._weapons.push(r):console.log("Unexpected: Created a weapon without an active model. Unit: "+R)}else if("Transport"==o){let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(E=e.getAttributeNode("name"))||void 0===E?void 0:E.nodeValue;n&&e.textContent&&t&&"Capacity"===n&&L._abilities.set(t,e.textContent)}}else if("Psychic Power"==o){let n=new i;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(x=e.getAttributeNode("name"))||void 0===x?void 0:x.nodeValue;if(t&&e.textContent)switch(t){case"Warp Charge":n._warpCharge=+e.textContent;break;case"Power Category":n._category=e.textContent;break;case"Range":n._range=e.textContent;break;case"Details":n._details=e.textContent}}W?W._psychicPowers.push(n):console.log("Unexpected: Created a psychic power without an active model. Unit: "+R)}else if("Psyker"==o){let n=new r;n._name=t;let i=e.querySelectorAll("characteristics>characteristic");for(let e of i){let t=null===(k=e.getAttributeNode("name"))||void 0===k?void 0:k.nodeValue;if(t&&e.textContent)switch(t){case"Mastery Level":n._masteryLevel=e.textContent;break;case"Disciplines":n._disciplines=e.textContent}}W?W._psyker=n:console.log("Unexpected: Created a psyker without an active model. Unit: "+R)}}else"Unit"===o||"Walker"===o||"Vehicle"===o||console.log("Unknown property type: "+o)}let M=e.querySelectorAll(":scope costs>cost");for(let e of M)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(A=e.getAttributeNode("name"))||void 0===A?void 0:A.nodeValue,n=null===(T=e.getAttributeNode("value"))||void 0===T?void 0:T.nodeValue;n&&"pts"==t&&(L._points+=+n)}let U=e.querySelectorAll(":scope rules > rule");for(let e of U)if(e.hasAttribute("name")){let t=null===(N=e.getAttributeNode("name"))||void 0===N?void 0:N.nodeValue,n=e.querySelector("description");t&&n&&n.textContent&&L._rules.set(t,n.textContent)}return L}t.Roster30k=h,t.Create30kRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new h,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"30k Army Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&("pts"===i?t._points=+o:"CP"===i&&(t._commandPoints=+o))}}(e,r),function(e,t){var n,r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new d,s=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,a=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(s&&(o._name=s),a&&(o._catalog=a),!f(o,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)if(e.hasAttribute("name")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;const n=e.querySelector("rule>description");t&&n&&o._rules.set(t,n.textContent)}}p(e,o),t._forces.push(o)}}(e,r),r}}return null}},288:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Compare=t.CompareWeapon=t.Create40kRoster=t.Costs=t.Roster40k=t.Force=t.Unit=t.Model=t.UnitRoleToString=t.UnitRole=t.PsychicPower=t.Psyker=t.Explosion=t.WoundTracker=t.Weapon=t.Upgrade=t.BaseNotes=void 0;const s=o(n(486));class a{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}t.BaseNotes=a;class l extends a{constructor(){super(...arguments),this._cost=new b,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}t.Upgrade=l;class c extends l{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._type="Melee",this._str="user",this._ap="",this._damage="",this._abilities=""}selectionName(){return this._selectionName||this.name()}}t.Weapon=c;class u extends a{constructor(){super(...arguments),this._name="",this._table=new Map}}t.WoundTracker=u;class d extends a{constructor(){super(...arguments),this._name="",this._diceRoll="",this._distance="",this._mortalWounds=""}}t.Explosion=d;class h extends a{constructor(){super(...arguments),this._cast="",this._deny="",this._powers="",this._other=""}}t.Psyker=h;class f extends a{constructor(){super(...arguments),this._name="",this._manifest=0,this._range="",this._details=""}}var p;t.PsychicPower=f,function(e){e[e.NONE=0]="NONE",e[e.SCD=1]="SCD",e[e.HQ=2]="HQ",e[e.TR=3]="TR",e[e.EL=4]="EL",e[e.FA=5]="FA",e[e.HS=6]="HS",e[e.FL=7]="FL",e[e.DT=8]="DT",e[e.FT=9]="FT",e[e.LW=10]="LW",e[e.AGENTS=11]="AGENTS",e[e.NF=12]="NF",e[e.COMMANDER=13]="COMMANDER",e[e.LEADER=14]="LEADER",e[e.SPECIALIST=15]="SPECIALIST",e[e.NON_SPECIALIST=16]="NON_SPECIALIST"}(p=t.UnitRole||(t.UnitRole={})),t.UnitRoleToString=["None","Supreme Command Detachment","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War","Agent of the Imperium","No Force Org Slot","Commander","Leader","Specialist","Non-specialist"];class _ extends a{constructor(){super(...arguments),this._count=0,this._move='0"',this._ws="",this._bs="",this._str=4,this._toughness=4,this._wounds=1,this._attacks="",this._leadership=7,this._save="",this._weapons=[],this._upgrades=[],this._psyker=null,this._psychicPowers=[],this._explosions=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(q),this._upgrades.sort(D),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}normalizeUpgrades(e){for(let t=0;t(e._count>1?`${e._count}x `:"")+e.nameAndGear())),this._weapons=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]).sort(q).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())})),this._spells.push(...this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[])),this._psykers.push(...this._models.map((e=>e._psyker)).filter((e=>e))),this._explosions.push(...this._models.map((e=>e._explosions)).reduce(((e,t)=>e.concat(t)),[]))}}t.Unit=m;class g extends a{constructor(){super(...arguments),this._catalog="",this._faction="Unknown",this._factionRules=new Map,this._configurations=[],this._rules=new Map,this._units=[]}}t.Force=g;class v extends a{constructor(){super(...arguments),this._cost=new b,this._forces=[]}}t.Roster40k=v;class b{constructor(){this._powerLevel=0,this._commandPoints=0,this._points=0}hasValues(){return 0!==this._powerLevel||0!==this._commandPoints||0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),0!==this._powerLevel&&e.push(`${this._powerLevel} PL`),0!==this._commandPoints&&e.push(`${this._commandPoints} CP`),`[${e.join(" / ")}]`}add(e){this._powerLevel+=e._powerLevel,this._commandPoints+=e._commandPoints,this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function y(e,t,n){var r;let i=e.querySelectorAll("force>selections>selection");for(let e of i){let i=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(i)if(i.includes("Detachment Command Cost"));else if("Battle Size"===i||"Gametype"===i)w(e,t);else if(e.querySelector('profile[typeName="Unit"]')){const r=O(e,n);t._units.push(r);for(const e of r._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){S(e,t._rules),w(e,t);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),S(e,t._factionRules))}}else console.log("** UNEXPECTED SELECTION **",i,e)}for(const e of t._factionRules.keys())t._rules.delete(e);t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function w(e,t){var n;const r=e.getAttribute("name");if(!r)return;const i=null===(n=e.querySelector("category"))||void 0===n?void 0:n.getAttribute("name"),o=e.querySelectorAll("selections>selection"),s=[];let a=L(e);for(const e of o)s.push(e.getAttribute("name")),a.add(L(e));let l=i&&"Configuration"!==i?`${i} - ${r}`:r;s.length>0&&(l+=`: ${s.join(", ")}`),a.hasValues()&&(l+=` ${a.toString()}`),t._configurations.push(l)}function C(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function S(e,t){const n=e.querySelectorAll("profiles>profile");for(const e of n){const n=e.getAttribute("name");if(!n)continue;const r=e.getAttribute("typeName");"Abilities"!==r&&"Dynastic Code"!==r&&"Household Tradition"!==r||z(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)E(e,t)}function E(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function x(e){switch(e){case"HQ":return p.HQ;case"Troops":return p.TR;case"Elites":return p.EL;case"Fast Attack":return p.FA;case"Heavy Support":return p.HS;case"Flyer":return p.FL;case"Dedicated Transport":return p.DT;case"Fortification":return p.FT;case"Lord of War":return p.LW;case"Agent of the Imperium":return p.AGENTS;case"No Force Org Slot":return p.NF;case"Primarch | Daemon Primarch | Supreme Commander":return p.SCD}return p.NONE}function k(e){switch(e){case"Commander":return p.COMMANDER;case"Leader":return p.LEADER;case"Specialist":return p.SPECIALIST;case"Non-specialist":return p.NON_SPECIALIST}return p.NONE}function A(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;return o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}function T(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}function N(e,t){for(const n of e.children)if("profiles"===n.tagName)for(const e of n.children)if("profile"===e.tagName&&e.getAttribute("typeName")===t)return!0;return!1}function L(e){const t=new b;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(R(e));return t}function R(e){const t=new b,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&(" PL"===n?t._powerLevel+=+r:"pts"===n?t._points+=+r:"CP"===n?t._commandPoints+=+r:t.addFreeformValue(n,+r)),t}function O(e,t){var n;let r=new m;A(e,r);let i=e.querySelectorAll("categories>category");for(let e of i){const i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(i){const e="Faction: ",n=i.lastIndexOf(e);if(n>=0){const t=i.slice(n+e.length);r._factions.add(t)}else{const e=i.trim();let n=x(e);n!=p.NONE?r._role=n:t?r._keywords.add(i):(n=k(e),n!=p.NONE?r._role=n:r._keywords.add(i))}}}const o=[],s=Array.from(e.querySelectorAll('profile[typeName="Unit"],profile[typeName="Model"]'));!function(e,t,n){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(!e||!r)return;const i=new _;i._name=e,t._modelStats.push(i),A(n,i);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"M":i._move=e.textContent;break;case"WS":i._ws=e.textContent;break;case"BS":i._bs=e.textContent;break;case"S":i._str=+e.textContent;break;case"T":i._toughness=+e.textContent;break;case"W":i._wounds=+e.textContent;break;case"A":i._attacks=e.textContent;break;case"Ld":i._leadership=+e.textContent;break;case"Save":i._save=e.textContent}}}}(s,r),o.push(...s);const a=[];if("model"===e.getAttribute("type"))a.push(e);else{const t=T(e);for(const e of t)("model"===e.getAttribute("type")||N(e,"Unit"))&&a.push(e);0===a.length&&a.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),0===a.length&&N(e,"Unit")&&a.push(e)}for(const e of a){const t=Array.from(e.querySelectorAll("profiles>profile")),n=t.filter((e=>!o.includes(e)));o.push(...n);const i=new _;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),r._models.push(i),W(t,i,r);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!N(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const n=new l;n._name=e,n._cost=L(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let c=Array.from(e.querySelectorAll("profiles>profile")).filter((e=>!o.includes(e)));if(o.push(...c),c.length>0){const t=new _;if(t._name="Unit Upgrades",W(c,t,r),t._weapons.length>0&&r._models.length>0){for(const e of r._models)e._weapons.push(...t._weapons);t._weapons.length=0}t._psychicPowers.length>0&&(r._spells.push(...t._psychicPowers),t._psychicPowers.length=0),t._psyker&&(r._psykers.push(t._psyker),t._psyker=null),t._explosions.length>0&&(r._explosions.push(...t._explosions),t._explosions.length=0);for(const n of T(e)){if("upgrade"!==n.getAttribute("type"))continue;if(a.includes(n))continue;if(n.querySelector('profiles>profile[typeName="Weapon"]'))continue;let e=n.getAttribute("name");if(!e)continue;const r=new l;r._name=e,r._cost=L(n),r._count=Number(n.getAttribute("number")),t._upgrades.push(r)}(t._weapons.length>0||t._upgrades.length>0)&&r._models.push(t)}let u=e.querySelectorAll("costs>cost");for(let e of u)r._cost.add(R(e));let d=e.querySelectorAll("rules > rule");for(let e of d)E(e,r._rules);return r.normalize(),r}function W(e,t,n){for(const r of e){const e=r.getAttribute("name"),i=r.getAttribute("typeName");if(e&&i)if("Unit"===i||"Model"===i||"model"===r.getAttribute("type"));else if("Weapon"===i){const e=I(r);t._weapons.push(e)}else if(i.includes("Wound Track")||i.includes("Stat Damage")||i.includes(" Wounds")){const e=B(r);n._woundTracker.push(e)}else if("Psychic Power"==i){const e=P(r);t._psychicPowers.push(e)}else if(i.includes("Explosion")){const e=M(r);t._explosions.push(e)}else"Psyker"==i?t._psyker=U(r):(n._abilities[i]||(n._abilities[i]=new Map),z(r,e,0,n._abilities[i]))}}function z(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic");for(const e of i){if(!e.textContent)continue;const n=e.getAttribute("name");n&&i.length>1?r.set([t,n.toString()].join(" - "),e.textContent):r.set(t,e.textContent)}}function I(e){var t;const n=new c;A(e,n),n._count=function(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"S":n._str=e.textContent;break;case"AP":n._ap=e.textContent;break;case"D":n._damage=e.textContent;break;case"Abilities":n._abilities=e.textContent}}const i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,o=null==i?void 0:i.getAttribute("name");return"upgrade"===(null==i?void 0:i.getAttribute("type"))&&o&&(n._selectionName=o,n._cost=L(i)),n}function B(e){let t=new u;A(e,t);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){const n=e.getAttribute("name");n&&(e.textContent?t._table.set(n,e.textContent):t._table.set(n,"-"))}return t}function P(e){const t=new f;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(let e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Range":t._range=e.textContent;break;case"Warp Charge":t._manifest=+e.textContent;break;case"Details":t._details=e.textContent}}return t}function M(e){const t=new d;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(const e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Dice Roll":t._diceRoll=e.textContent;break;case"Distance":t._distance=e.textContent;break;case"Mortal Wounds":t._mortalWounds=e.textContent}}return t}function U(e){const t=new h;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(const e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Cast":t._cast=e.textContent;break;case"Deny":t._deny=e.textContent;break;case"Powers Known":t._powers=e.textContent;break;case"Other":t._other=e.textContent}}return t}function D(e,t){return H(e._name,t._name)}function F(e,t){return e._name===t._name?H(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:H(e._name,t._name)}function q(e,t){return(e._type.startsWith("Grenade")?2:e._type.startsWith("Melee")?1:0)-(t._type.startsWith("Grenade")?2:t._type.startsWith("Melee")?1:0)||e.name().localeCompare(t.name())}function H(e,t){return e>t?1:e==t?0:-1}t.Costs=b,t.Create40kRoster=function(e,t=!0){var n;if(e){let r=e.querySelector("roster");if(r){const i=new v,o=null===(n=r.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;i._name=o||"40k Army Roster";let s=r.querySelector("customNotes");return s&&(i._customNotes=s.textContent),function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(R(e))}(e,i),function(e,t,n){var r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new g,s=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,a=null===(i=e.getAttributeNode("catalogueName"))||void 0===i?void 0:i.nodeValue;if(s&&(o._name=s),a&&(o._catalog=a),!C(o,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)E(e,o._rules)}y(e,o,n),t._forces.push(o)}}(e,i,t),i}}return null},t.CompareWeapon=q,t.Compare=H},208:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Wh40k=void 0;const s=o(n(486));!function(e){class t{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}e.BaseNotes=t;class n extends t{constructor(){super(...arguments),this._cost=new u,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}let r;e.Upgrade=n,e.Weapon=class extends n{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._attacks="1",this._skill="",this._str="user",this._ap="",this._damage="",this._abilities=""}selectionName(){return this._selectionName||this.name()}},function(e){e[e.NONE=0]="NONE",e[e.EpicHero=1]="EpicHero",e[e.Character=2]="Character",e[e.Battleline=3]="Battleline",e[e.Infantry=4]="Infantry",e[e.Vehicle=5]="Vehicle",e[e.Mounted=6]="Mounted",e[e.Transport=7]="Transport",e[e.Fortification=8]="Fortification",e[e.Allied=9]="Allied"}(r=e.UnitRole||(e.UnitRole={})),e.UnitRoleToString=["None","Epic Hero","Character","Battleline","Infantry","Vehicle","Mounted","Dedicated Transport","Fortification","Allied Unit"];class i extends t{constructor(){super(...arguments),this._count=0,this._move='0"',this._toughness=4,this._save="4+",this._wounds=1,this._leadership="6+",this._objControl=1,this._weapons=[],this._upgrades=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(A),this._upgrades.sort(x),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}normalizeUpgrades(e){for(let t=0;te[0])).flat();this._profileTables[e]._contents=t.filter(((e,t)=>n.indexOf(e[0])===t))}for(let e=0;e(e._count>1?`${e._count}x `:"")+e.nameAndGear())),this._weapons=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]).sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}}e.Unit=a;class l extends t{constructor(){super(...arguments),this._catalog="",this._faction="Unknown",this._factionRules=new Map,this._configurations=[],this._rules=new Map,this._units=[]}}e.Force=l;class c extends t{constructor(){super(...arguments),this._cost=new u,this._forces=[]}}e.Roster40k=c;class u{constructor(){this._points=0}hasValues(){return 0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),`[${e.join(" / ")}]`}add(e){this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function d(e,t,n){var r;let i=e.querySelectorAll("force>selections>selection");for(let e of i){let n=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(n)if(n.includes("Detachment Command Cost"));else if("Battle Size"===n||"Gametype"===n)h(e,t);else if(e.querySelector('profile[typeName="Unit"]')){const n=w(e);t._units.push(n);for(const e of n._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){p(e,t._rules),h(e,t);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),p(e,t._factionRules))}}else console.log("** UNEXPECTED SELECTION **",n,e)}for(const e of t._factionRules.keys())t._rules.delete(e);t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function h(e,t){var n;const r=e.getAttribute("name");if(!r)return;const i=null===(n=e.querySelector("category"))||void 0===n?void 0:n.getAttribute("name"),o=e.querySelectorAll("selections>selection"),s=[];let a=b(e);for(const e of o)s.push(e.getAttribute("name")),a.add(b(e));let l=i&&"Configuration"!==i?`${i} - ${r}`:r;s.length>0&&(l+=`: ${s.join(", ")}`),a.hasValues()&&(l+=` ${a.toString()}`),t._configurations.push(l)}function f(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function p(e,t){const n=e.querySelectorAll("profiles>profile");for(const e of n){const n=e.getAttribute("name");if(!n)continue;const r=e.getAttribute("typeName");"Abilities"!==r&&"Dynastic Code"!==r&&"Household Tradition"!==r||E(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)_(e,t)}function _(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function m(e){switch(e){case"Epic Hero":return r.EpicHero;case"Character":return r.Character;case"Battleline":return r.Battleline;case"Infantry":return r.Infantry;case"Mounted":return r.Mounted;case"Vehicle":return r.Vehicle;case"Dedicated Transport":return r.Transport;case"Fortification":return r.Fortification;case"Allied Units":return r.Allied}return r.NONE}function g(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}function v(e,t){for(const n of e.children)if("profiles"===n.tagName)for(const e of n.children)if("profile"===e.tagName&&e.getAttribute("typeName")===t)return!0;return!1}function b(e){const t=new u;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(y(e));return t}function y(e){const t=new u,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function w(e,t){var s;let l=new a;!function(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}(e,l);let c=e.querySelectorAll("categories>category");for(let e of c){const t=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(t){const e="Faction: ",n=t.lastIndexOf(e);if(n>=0){const r=t.slice(n+e.length);l._factions.add(r)}else{let e=m(t.trim());e!=r.NONE&&(l._role=e),l._keywords.add(t)}}}const u=[],d=Array.from(e.querySelectorAll('profile[typeName="Unit"],profile[typeName="Model"]'));for(const e of d){const t=e.getAttribute("name"),n=e.getAttribute("typeName");t&&n&&(l._profileTables[n]||(l._profileTables[n]=new o),S(e,t,n,l._profileTables[n]))}u.push(...d);const h=[];if("model"===e.getAttribute("type"))h.push(e);else{const t=g(e);for(const e of t)("model"===e.getAttribute("type")||v(e,"Unit"))&&h.push(e);0===h.length&&h.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),0===h.length&&v(e,"Unit")&&h.push(e)}for(const e of h){const t=Array.from(e.querySelectorAll("profiles>profile")),r=t.filter((e=>!u.includes(e)));u.push(...r);const o=new i;o._name=e.getAttribute("name")||"Unknown Model",o._count=Number(e.getAttribute("number")||1),l._models.push(o),C(t,0,l);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!v(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const r=new n;r._name=e,r._cost=b(t),r._count=Number(t.getAttribute("number")),o._upgrades.push(r)}}}let f=Array.from(e.querySelectorAll("profiles>profile")).filter((e=>!u.includes(e)));if(u.push(...f),f.length>0){const t=new i;if(t._name="Unit Upgrades",C(f,0,l),t._weapons.length>0&&l._models.length>0){for(const e of l._models)e._weapons.push(...t._weapons);t._weapons.length=0}for(const r of g(e)){if("upgrade"!==r.getAttribute("type"))continue;if(h.includes(r))continue;if(r.querySelector('profiles>profile[typeName="Weapon"]'))continue;let e=r.getAttribute("name");if(!e)continue;const i=new n;i._name=e,i._cost=b(r),i._count=Number(r.getAttribute("number")),t._upgrades.push(i)}(t._weapons.length>0||t._upgrades.length>0)&&l._models.push(t)}let p=e.querySelectorAll("costs>cost");for(let e of p)l._cost.add(y(e));let w=e.querySelectorAll("rules > rule");for(let e of w)_(e,l._rules);return l.normalize(),l}function C(e,t,n){for(const t of e){const e=t.getAttribute("name"),r=t.getAttribute("typeName");e&&r&&(t.querySelectorAll("characteristics>characteristic").length>1?(n._profileTables[r]||(n._profileTables[r]=new o),S(t,e,r,n._profileTables[r])):(n._abilities[r]||(n._abilities[r]=new Map),E(t,e,0,n._abilities[r])))}}function S(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic"),o={[n]:t};for(const e of i){if(!e.textContent)continue;const t=e.getAttribute("name");t&&(o[t]=e.textContent)}r.addRow(o)}function E(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic");for(const e of i){if(!e.textContent)continue;const n=e.getAttribute("name");n&&i.length>1?r.set([t,n.toString()].join(" - "),e.textContent):r.set(t,e.textContent)}}function x(e,t){return T(e._name,t._name)}function k(e,t){return e._name===t._name?T(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:T(e._name,t._name)}function A(e,t){return e.name().localeCompare(t.name())}function T(e,t){return e>t?1:e==t?0:-1}e.Costs=u,e.CreateRoster=function(e,t=!0){var n;if(e){let t=e.querySelector("roster");if(t){const r=new c,i=null===(n=t.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;return r._name=i||"40k Army Roster",function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(y(e))}(e,r),function(e,t,n){var r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let n=new l,o=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,s=null===(i=e.getAttributeNode("catalogueName"))||void 0===i?void 0:i.nodeValue;if(o&&(n._name=o),s&&(n._catalog=s),!f(n,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)_(e,n._rules)}d(e,n),t._forces.push(n)}}(e,r),r}}return null},e.CompareWeapon=A,e.Compare=T,e.CompareProfileTableName=function(e,t){const n=["Unit","Ranged Weapons","Melee Weapons"];return(n.includes(e)?n.indexOf(e):n.length)-(n.includes(t)?n.indexOf(t):n.length)}}(t.Wh40k||(t.Wh40k={}))},774:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CreateAoSRoster=t.RosterAoS=t.AoSForce=t.AoSUnit=t.AoSUnitRoleToString=t.AoSUnitRole=t.AoSRealmOfBattle=t.AoSSpecialRules=t.AoSCoreBattalion=t.AoSTriumph=t.AoSGrandStrategy=t.AoSAllegiance=t.AoSPrayer=t.AoSSpell=t.AoSWoundTracker=t.AoSWeapon=t.AoSProfile=t.AoSProfileType=void 0;const s=o(n(486));class a{constructor(){this._typeName="anonymous",this._fields=new Map}}t.AoSProfileType=a;class l{constructor(){this._name="none",this._value=new a}}t.AoSProfile=l;class c{constructor(){this._name="",this._type="Melee",this._range="",this._attacks="",this._toHit="",this._toWound="",this._rend="",this._damage=""}}t.AoSWeapon=c;class u{constructor(){this._title="",this._labels=[],this._table=[[]]}}t.AoSWoundTracker=u;class d{constructor(){this._name="",this._castingValue=0,this._range="",this._description=""}}t.AoSSpell=d;class h{constructor(){this._name="",this._answerValue=0,this._range="",this._description=""}}t.AoSPrayer=h;class f{constructor(){this._name="",this._battleTraits=new Map,this._commandAbilities=new Map,this._spells=[],this._extraProfiles=[]}}t.AoSAllegiance=f;class p{constructor(){this._name="",this._description=""}}t.AoSGrandStrategy=p;class _{constructor(){this._name="",this._description=""}}t.AoSTriumph=_;class m{constructor(){this._name="",this._abilities=new Map}}t.AoSCoreBattalion=m;class g{constructor(){this._name="",this._description=""}}t.AoSSpecialRules=g;class v{constructor(){this._name="",this._spells=[],this._commandAbilities=new Map,this._rules=[]}}var b;t.AoSRealmOfBattle=v,function(e){e[e.NONE=0]="NONE",e[e.LEADER=1]="LEADER",e[e.BATTLELINE=2]="BATTLELINE",e[e.BEHEMOTH=3]="BEHEMOTH",e[e.ARTILLERY=4]="ARTILLERY",e[e.OTHER=5]="OTHER",e[e.SCENERY=6]="SCENERY",e[e.BATTALION=7]="BATTALION",e[e.MALIGN_SORCERY=8]="MALIGN_SORCERY",e[e.REALM=9]="REALM"}(b=t.AoSUnitRole||(t.AoSUnitRole={})),t.AoSUnitRoleToString=["None","Leader","Battleline","Behemoth","Artillery","Other","Scenery","Battalion","Malign Sorcery","Realm"];class y{constructor(){this._name="",this._id=0,this._role=b.NONE,this._keywords=new Set,this._abilities=new Map,this._commandAbilities=new Map,this._commandTraits=new Map,this._magic=new Map,this._artefacts=new Map,this._count=0,this._move='0"',this._wounds=1,this._bravery=7,this._save="",this._weapons=[],this._spells=[],this._prayers=[],this._points=0,this._woundTracker=null,this._extraProfiles=[],this._selections=new Set}equal(e){return null!=e&&e._name===this._name&&e._role===this._role&&!!s.isEqual(this._commandTraits,e._commandTraits)&&!!s.isEqual(this._artefacts,e._artefacts)&&!!s.isEqual(this._weapons,e._weapons)}isNormalUnit(){return this._role==b.ARTILLERY||this._role==b.BATTLELINE||this._role==b.BEHEMOTH||this._role==b.LEADER||this._role==b.OTHER}}t.AoSUnit=y;class w{constructor(){this._catalog="",this._name="Unknown",this._units=[],this._battalions=[],this._rules=new Map,this._battleTactics=new Map,this._allegiance=new f,this._grandStrategy=new p,this._triumph=new _,this._realmOfBattle=new v}}t.AoSForce=w;class C{constructor(){this._commandPoints=0,this._points=0,this._name="",this._forces=[]}}function S(e){switch(e){case"Leader":return b.LEADER;case"Battleline":return b.BATTLELINE;case"Other":return b.OTHER;case"Behemoth":return b.BEHEMOTH;case"Artillery":return b.ARTILLERY;case"Scenery":return b.SCENERY;case"Battalion":return b.BATTALION;case"Malign Sorcery":return b.MALIGN_SORCERY;case"Realm":return b.REALM}return b.NONE}function E(e,t){var n,r,i,o,s,a,l;let c=e.querySelectorAll("force>selections>selection"),u=0;for(let e of c){let c=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(c)if(c.includes("Allegiance")){let n=A(e);n&&(t._allegiance=n)}else if(c.includes("Grand Strategy")){let n=T(e);n&&(t._grandStrategy=n)}else if(c.includes("Game Type"));else if(c.includes("Core Battalion")){let n=new m;n._name=c;let s=e.querySelectorAll("profiles>profile");for(let e of s)for(let e of s){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,s=null===(i=e.getAttributeNode("typeName"))||void 0===i?void 0:i.nodeValue;if(t&&s){let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue;t&&e.textContent&&n._abilities.set(t,e.textContent)}}}t._battalions.push(n)}else if(c.includes("Realm of Battle")){let n=L(e);n&&(t._realmOfBattle=n)}else if(c.includes("GHB 2023 Rules")){let n=R(e);n&&(t._realmOfBattle=n)}else if(c.includes("Triumphs")){let n=N(e);n&&(t._triumph=n)}else if(c.includes("Battle Tactic")){let n=e.querySelectorAll("profiles>profile");for(let e of n)for(let e of n){let n=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue,r=null===(a=e.getAttributeNode("typeName"))||void 0===a?void 0:a.nodeValue;if(n&&r){let r=e.querySelectorAll("characteristics>characteristic");for(let e of r)(null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue)&&e.textContent&&t._battleTactics.set(n,e.textContent)}}}else{let n=k(e);n&&n._role!=b.NONE&&(n._id=u++,t._units.push(n))}}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function x(e,t){var n;let r=e.querySelectorAll("force>rules>rule");for(let e of r){let r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,i=e.querySelectorAll("description");if(r&&i)for(let e of i)e.textContent&&t._rules.set(r,e.textContent)}}function k(e){var t,n,r,i,o,s,a,l,f,p,_,m,g,v,w;let C=new y,E=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;E&&(C._name=E);let x=e.querySelectorAll("profiles>profile");for(let e of x){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,p=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&p)if("Unit"==p){C._name||(C._name=t);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Move":C._move=e.textContent;break;case"Wounds":C._wounds=+e.textContent;break;case"Bravery":C._bravery=+e.textContent;break;case"Save":C._save=e.textContent}}}else if("Unit Abilities"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._abilities.set(t,n.textContent)}else if("Command Abilities"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._commandAbilities.set(t,n.textContent)}else if("Magic"==p){let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue;t&&e.textContent&&C._magic.set(t,e.textContent)}}else if("Unit Leader"==p){let t=e.querySelector("characteristics>characteristic");t&&t.textContent&&C._abilities.set(p,t.textContent)}else if("Spell"==p){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}C._spells.push(n)}else if("Weapon"==p){let n=new c;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(a=e.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue;if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Attacks":n._attacks=e.textContent;break;case"Rend":n._rend=e.textContent;break;case"To Hit":n._toHit=e.textContent;break;case"To Wound":n._toWound=e.textContent;break;case"Damage":n._damage=e.textContent}}C._weapons.push(n)}else if("Command Trait"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._commandTraits.set(t,n.textContent)}else if("Artefact"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._artefacts.set(t,n.textContent)}else if("Prayer"==p){let n=new h;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue;if(t&&e.textContent)switch(t){case"Answer Value":n._answerValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}C._prayers.push(n)}else if(p.includes("Damage Table")||p.includes("Wounds")||p.includes("Wound Track")||p.includes("Wound Table")){let n=[];if(C._woundTracker){let r=e.querySelectorAll("characteristics>characteristic");if(r.length<=3){let e=t;e?n.push(e):n.push("Unknown");for(let e of r)e.textContent?n.push(e.textContent):n.push("Unknown")}else for(let e of r)e.textContent?n.push(e.textContent):n.push("Unknown");C._woundTracker._table.push(n),n=[]}else{C._woundTracker=new u,C._woundTracker._title=p;let r=e.querySelectorAll("characteristics>characteristic");if(r.length<=3){C._woundTracker._labels.push("Wounds Suffered"),n.push(t);for(let e of r){let t=null===(f=e.getAttributeNode("name"))||void 0===f?void 0:f.nodeValue;t?C._woundTracker._labels.push(t):C._woundTracker._labels.push("Unknown"),e.textContent?n.push(e.textContent):n.push("Unknown")}}else for(let e of r)e.textContent?C._woundTracker._labels.push(e.textContent):C._woundTracker._labels.push("Unknown");C._woundTracker._table.push(n),n=[]}}else{let t=O(e);t?C._extraProfiles.push(t):console.log("Unknown unit profile type: "+p)}}let k=e.querySelectorAll("selections>selection");for(let e of k){let t=null===(p=e.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(t&&(C._selections.add(t),t.includes("Wound Track"))){C._woundTracker=new u,C._woundTracker._title=t,C._woundTracker._labels=["Wounds Suffered"];let n=e.querySelectorAll("profiles>profile"),r=!0;for(let e of n){let t=null===(_=e.getAttributeNode("name"))||void 0===_?void 0:_.nodeValue,n=e.querySelectorAll("characteristics>characteristic"),i=[];t?i.push(t):i.push("--");for(let e of n){let t=null===(m=e.getAttributeNode("name"))||void 0===m?void 0:m.nodeValue,n=e.textContent;r&&(t?C._woundTracker._labels.push(t):C._woundTracker._labels.push("Unknown")),n?i.push(n):i.push("Unknown")}r=!1,C._woundTracker._table.push(i)}}}let A=e.querySelectorAll("costs>cost");for(let e of A)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(g=e.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue,n=null===(v=e.getAttributeNode("value"))||void 0===v?void 0:v.nodeValue;n&&"pts"===t&&(C._points+=+n)}let T=e.querySelectorAll(":scope categories>category");for(let e of T){let t=null===(w=e.getAttributeNode("name"))||void 0===w?void 0:w.nodeValue;if(t){var N=S(t.trim());N!=b.NONE?C._role=N:C._keywords.add(t)}}return C}function A(e){var t,n,r,i;let o=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(o){let t=new f;t._name=o;let s=e.querySelectorAll("profiles>profile");for(let e of s){let o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(o&&s)if("Battle Trait"==s){let n=e.querySelector("characteristics>characteristic");if(n){let e=n.textContent;e&&(null==t||t._battleTraits.set(o,e))}}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");if(n){let e=n.textContent;e&&(null==t||t._commandAbilities.set(o,e))}}else if("Spell"==s){let n=new d;n._name=o;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}null==t||t._spells.push(n)}else{let n=O(e);n?null==t||t._extraProfiles.push(n):console.log("Unexpected allegiance profile type: "+s)}}return t}return null}function T(e){var t,n,r;let i=null,o=e.querySelector("selections>selection");if(o){let e=null===(t=o.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;e&&(i=new p,i._name=e);let s=o.querySelectorAll("profiles>profile");for(let e of s){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&o)if("Grand Strategy"==o){let t=e.querySelector("characteristics>characteristic");if(t){let e=t.textContent;e&&i&&(i._description=e)}}else console.log("Unexpected Grand Strategy profile type: "+o)}}return i}function N(e){var t,n,r;let i=null,o=e.querySelector("selections>selection");if(o){let e=null===(t=o.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;e&&(i=new _,i._name=e);let s=o.querySelectorAll("profiles>profile");for(let e of s){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&o)if("Triumph"==o){let t=e.querySelector("characteristics>characteristic");if(t){let e=t.textContent;e&&i&&(i._description=e)}}else console.log("Unexpected Triumph profile type: "+o)}}return i}function L(e){var t,n,r,i;let o=null,s=e.querySelector("selections>selection");if(s){let e=null===(t=s.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(e){o=new v,o._name=e;let t=s.querySelectorAll("profiles>profile");for(let e of t){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&s)if("Spell"==s){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}o._spells.push(n)}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&o._commandAbilities.set(t,n.textContent)}else if("Special Rules"==s){let n=e.querySelector("characteristics>characteristic");if(n&&n.textContent){let e=new g;e._name=t,e._description=n.textContent,o._rules.push(e)}}else console.log("Unexpected Realm of Battle profile type: "+s)}}}return o}function R(e){var t,n,r,i;let o=null,s=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(s){o=new v,o._name=s;let t=e.querySelectorAll("profiles>profile");for(let e of t){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&s)if("Spell"==s){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}o._spells.push(n)}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&o._commandAbilities.set(t,n.textContent)}else if("Special Rules"==s||"Heroic Action"==s){let n=e.querySelector("characteristics>characteristic");if(n&&n.textContent){let e=new g;e._name=t,e._description=n.textContent,o._rules.push(e)}}else console.log("Unexpected Realm of Battle profile type: "+s)}}return o}function O(e){var t,n,r;if(!e)return null;let i=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue,o=null===(n=e.getAttributeNode("typeName"))||void 0===n?void 0:n.nodeValue;if(!i||!o)return null;let s=new l;s._name=i,s._value._typeName=o;let a=e.querySelectorAll("characteristics>characteristic");for(let e of a){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;t&&e.textContent&&s._value._fields.set(t,e.textContent)}return s}t.RosterAoS=C,t.CreateAoSRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new C,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Age of Sigmar Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&"pts"===i&&(t._points=+o)}}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new w,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;o&&(i._name=o),s&&(i._catalog=s),E(e,i),x(e,i),t._forces.push(i)}}(e,r),r}}return null}},980:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HorusHeresy=void 0;const s=o(n(486));!function(e){let t;!function(e){e[e.NONE=0]="NONE",e[e.HQ=1]="HQ",e[e.TR=2]="TR",e[e.EL=3]="EL",e[e.FA=4]="FA",e[e.HS=5]="HS",e[e.FL=6]="FL",e[e.DT=7]="DT",e[e.FT=8]="FT",e[e.LW=9]="LW",e[e.PR=10]="PR"}(t=e.UnitRole||(e.UnitRole={})),e.UnitRoleToString=["None","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War","Primarch"];class n{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}e.BaseNote=n;class r extends n{constructor(){super(...arguments),this._description="",this._cost=new p,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}e.Upgrade=r;class i extends r{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._str="user",this._ap="",this._type="Melee"}getRules(){let e=this._type.split(",");return e.length>0&&(e=e.slice(1).map((e=>e.trim()))),e}}e.Weapon=i;class o extends n{constructor(){super(...arguments),this._count=0,this._type="",this._weapons=[],this._upgrades=[],this._wargear=[],this._warlordTraits=[],this._reactions=[],this._psychicWeapons=[],this._psychicPowers=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length&&this._wargear.length===e._wargear.length&&this._psychicWeapons.length===e._psychicWeapons.length&&this._psychicPowers.length===e._psychicPowers.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(N),this._upgrades.sort(A),this._wargear.sort(A),this._psychicPowers.sort(A),this._psychicWeapons.sort(N),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades),this.normalizeUpgrades(this._wargear),this.normalizeUpgrades(this._psychicPowers),this.normalizeUpgrades(this._psychicWeapons)}normalizeUpgrades(e){for(let t=0;t(e._count>1?`${e._count}x `:"")+e.nameAndGear()))}weapons(){let e=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._weapons),e.sort(N).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicWeapons(){let e=this._models.map((e=>e._psychicWeapons)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._psychicWeapons),e.sort(N).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicPowers(){let e=this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._psychicPowers),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}wargear(){let e=this._models.map((e=>e._wargear)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._wargear),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}weaponRules(){let e=[];return e=this.weapons().map((e=>e.getRules())).reduce(((e,t)=>e.concat(t)),[]),e.sort().filter(((e,t,n)=>e!==n[t-1]))}warlordTraits(){let e=this._models.map((e=>e._warlordTraits)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._warlordTraits),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}upgrades(){let e=this._models.map((e=>e._upgrades)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._upgrades),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}reactions(){let e=this._models.map((e=>e._reactions)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._reactions),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}}e.Unit=d;class h extends n{constructor(){super(),this._catalog="",this._name="Unknown",this._faction="Unknown",this._factionRules=new Map,this._rules=new Map,this._units=[]}}e.Force=h;class f extends n{constructor(){super(),this._cost=new p,this._name="",this._forces=[]}}e.Roster=f;class p{constructor(){this._points=0}hasValues(){return 0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),`[${e.join(" / ")}]`}add(e){this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function _(e,t){return e>t?1:e==t?0:-1}function m(e,t){return typeof e>typeof t?1:typeof e==typeof t?0:-1}function g(e){const t=new p,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("Pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function v(e,n){var i,o;let s=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(!s)return;let h=null===(o=e.getAttributeNode("type"))||void 0===o?void 0:o.nodeValue;if(h)if(e.querySelector('profile[typeId="4bb2-cb95-e6c8-5a21"]')||e.querySelector('profile[typeId="2fae-b053-3f78-e7b2"]')||e.querySelector('profile[typeId="75b5-9f7a-156e-6889"]')||e.querySelector('profile[typeId="eeec-bde3-8ee4-35b0"]')){const i=function(e){var n,i,o;let s=new d;b(e,s);let h=e.querySelectorAll("categories>category");for(let e of h){const r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r){let e=x(r.trim());e!=t.NONE?s._role=e:r.endsWith(":")||s._keywords.add(r)}}const f=[],p=Array.from(e.querySelectorAll('profile[typeId="4bb2-cb95-e6c8-5a21"],profile[typeId="2fae-b053-3f78-e7b2"],profile[typeId="75b5-9f7a-156e-6889"],profile[typeId="eeec-bde3-8ee4-35b0"]'));(function(e,t,n){var r,i;for(const n of e){const e=n.getAttribute("name"),o=n.getAttribute("typeName");if(!e||!o)return;if("Unit"===o.trim()){const r=new l;r._name=e,t._modelStats.push(r),b(n,r);const i=n.querySelectorAll("characteristics>characteristic");for(const e of i){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"Move":r._move=k(e.textContent);break;case"WS":r._ws=+e.textContent;break;case"BS":r._bs=+e.textContent;break;case"S":r._str=+e.textContent;break;case"T":r._toughness=+e.textContent;break;case"W":r._wounds=+e.textContent;break;case"I":r._initiative=+e.textContent;break;case"A":r._attacks=+e.textContent;break;case"Ld":r._leadership=+e.textContent;break;case"Save":r._save=e.textContent}}}else if("Knights and Titans"===o.trim()){let r=new c;r._name=e,t._modelStats.push(r),b(n,r);const i=n.querySelectorAll("characteristics>characteristic");for(const e of i){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"Move":r._move=k(e.textContent);break;case"WS":r._ws=+e.textContent;break;case"BS":r._bs=+e.textContent;break;case"S":r._str=+e.textContent;break;case"Front":r._front=+e.textContent;break;case"Side":r._side=+e.textContent;break;case"Rear":r._rear=+e.textContent;break;case"I":r._initiative=+e.textContent;break;case"A":r._attacks=+e.textContent;break;case"HP":r._hp=+e.textContent}}}else if("Vehicle"===o.trim()){let i=new a;i._name=e,t._modelStats.push(i),b(n,i);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(t&&e.textContent)switch(t){case"Unit Type":i._type=e.textContent;break;case"Move":i._move=k(e.textContent);break;case"BS":i._bs=+e.textContent;break;case"Front":i._front=+e.textContent;break;case"Side":i._side=+e.textContent;break;case"Rear":i._rear=+e.textContent;break;case"HP":i._hp=+e.textContent;break;case"Transport Capacity":i._capacity=e.textContent;break;case"Access Points":i._accessPoints=e.textContent}}}else if("Fortification"===o.trim()){let r=new u;r._name=e,t._modelStats.push(r),b(n,r);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"BS":r._bs=e.textContent;break;case"Front":r._front=+e.textContent;break;case"Side":r._side=+e.textContent;break;case"Rear":r._rear=+e.textContent;break;case"HP":r._hp=+e.textContent;break;case"Transport Capacity":r._capacity=e.textContent;break;case"Fire Points":r._firePoints=e.textContent}}}}})(p,s),f.push(...p);const _=[];if("model"===e.getAttribute("type"))_.push(e);else{const t=function(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}(e);for(const e of t)("model"===e.getAttribute("type")||W(e,"Unit")||W(e,"Fortification")||W(e,"Vehicle")||W(e,"Knights and Titans"))&&_.push(e);0===_.length&&_.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),(0===_.length&&W(e,"Unit")||W(e,"Fortification")||W(e,"Vehicle")||W(e,"Knights and Titans"))&&_.push(e)}for(const e of _){const t=Array.from(e.querySelectorAll("profiles>profile")),n=t.filter((e=>!f.includes(e)));f.push(...n);const i=new l;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),s._models.push(i),R(t,i);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){let e=t.getAttribute("name");if(e){const n=new r;n._name=e,n._cost=L(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let m=e.querySelectorAll('selections>selection[type="upgrade"]');for(const e of m){R(Array.from(e.querySelectorAll("profiles>profile")),s);const t=e.getAttribute("name");if(t){const n=new r;n._name=t,n._cost=L(e),n._count=Number(e.getAttribute("number")),s._upgrades.push(n)}}let g=e.querySelectorAll("costs>cost");for(let e of g)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue,n=null===(o=e.getAttributeNode("value"))||void 0===o?void 0:o.nodeValue;n&&"Pts"==t&&(s._points+=+n)}let v=e.querySelectorAll("rules>rule");for(let e of v)O(e,s._rules);return s.normalize(),s}(e);if(i){n._units.push(i);for(const e of i._rules.entries())n._rules.set(e[0],e[1])}}else"upgrade"===h?function(e,t){const n=e.querySelectorAll("rules>rule");for(const e of n)O(e,t)}(e,n._rules):console.log("** UNEXPECTED SELECTION **",s,h,e)}function b(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;return o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}function y(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}function w(e){var t;const n=new i;b(e,n),n._count=y(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Strength":n._str=e.textContent;break;case"AP":n._ap=e.textContent}}const o=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,s=null==o?void 0:o.getAttribute("name");return"upgrade"===(null==o?void 0:o.getAttribute("type"))&&s&&(n._selectionName=s,n._cost=L(o)),n}function C(e){var t;const n=new i;b(e,n),n._count=y(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Strength":n._str=e.textContent;break;case"AP":n._ap=e.textContent}}const o=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,s=null==o?void 0:o.getAttribute("name");return"upgrade"===(null==o?void 0:o.getAttribute("type"))&&s&&(n._selectionName=s,n._cost=L(o)),n}function S(e){const t=new r;b(e,t),t._count=y(e);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n)if(e.textContent){let n=e.getAttribute("name");if(n)switch(n){case"Description":case"Text":t._description=e.textContent}}return t}function E(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function x(e){switch(e){case"HQ:":return t.HQ;case"Troops:":return t.TR;case"Elites:":return t.EL;case"Fast Attack:":return t.FA;case"Heavy Support:":return t.HS;case"Flyer":return t.FL;case"Transport Sub-type:":return t.DT;case"Fortification:":return t.FT;case"Lords of War:":return t.LW;case"Primarch:":return t.PR}return t.NONE}function k(e){return function(e){return null!=e&&""!==e&&!isNaN(Number(e.toString()))}(e)?e.toString()+'"':e.toString()}function A(e,t){return _(e._name,t._name)}function T(e,t){return e._name===t._name?_(e.nameAndGear(),t.nameAndGear()):_(e._name,t._name)}function N(e,t){return(e._type.startsWith("Grenade")?2:e._type.startsWith("Melee")?1:0)-(t._type.startsWith("Grenade")?2:t._type.startsWith("Melee")?1:0)||e.name().localeCompare(t.name())}function L(e){const t=new p;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(g(e));return t}function R(e,t){for(const n of e){const e=n.getAttribute("name");let r=n.getAttribute("typeName");if(e&&r)if(r=r.trim(),"Unit"===r||"Vehicle"===r||"Knights and Titans"===r||"Fortification"===r||"model"===n.getAttribute("type"));else if("Weapon"===r){const e=w(n);t._weapons.push(e)}else if("Psychic Weapon"===r){const e=C(n);t._psychicWeapons.push(e)}else if("Psychic Power"===r){const e=S(n);t._psychicPowers.push(e)}else if("Wargear Item"===r){const e=S(n);t._wargear.push(e)}else if("Warlord Trait"===r){const e=S(n);t._warlordTraits.push(e)}else if("Reactions"===r){const e=S(n);t._reactions.push(e)}else console.log("Unhandled model/unit profile "+e+" of type "+r+".")}}function O(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function W(e,t){var n;for(const r of e.children)if("profiles"===r.tagName)for(const e of r.children)if("profile"===e.tagName&&(null===(n=e.getAttribute("typeName"))||void 0===n?void 0:n.trim())===t)return!0;return!1}e.Costs=p,e.Compare=_,e.CompareModelTypes=m,e.CreateRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new f,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Horus Heresy Army Roster",function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(g(e))}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new h,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(o&&(i._name=o),s&&(i._catalog=s),!E(i,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)O(e,i._rules)}let a=e.querySelectorAll(":scope>selections>selection");for(let e of a)v(e,i);i._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1)),t._forces.push(i)}}(e,r),r}}return null},e.CompareWeapon=N}(t.HorusHeresy||(t.HorusHeresy={}))},249:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Compare=t.CreateKT21Roster=t.RosterKT21=t.Force=t.Operative=t.OperativeRoleToString=t.Specialism=t.PsychicPowerWeapon=t.PsychicPower=t.UniqueActions=t.Weapons=t.BaseNotes=void 0;const s=o(n(486));class a{constructor(){this._name="",this._customName="",this._customNotes="",this._costs="0"}name(){return this._customName?this._customName:this._name}nameAndCosts(){let e=this._name;return this._customName&&(e=this._customName),this.costs()>0&&(e+=" ("+this.costs()+" EP)"),e}notes(){return this._customNotes}costs(){return Math.floor(+this._costs)}equal(e){return null!=e&&this._name===e._name}}t.BaseNotes=a;class l extends a{constructor(){super(...arguments),this._count=0,this._attacks="0",this._skill="0+",this._damage="0/0",this._rules="",this._criticalEffects=""}}t.Weapons=l,t.UniqueActions=class extends a{constructor(){super(...arguments),this._description=""}};class c extends a{constructor(){super(...arguments),this._effect="",this._weapons=[]}}var u;t.PsychicPower=c,t.PsychicPowerWeapon=class extends l{},function(e){e[e.NONE=0]="NONE",e[e.COMBAT=1]="COMBAT",e[e.STAUNCH=2]="STAUNCH",e[e.MARKSMAN=3]="MARKSMAN",e[e.SCOUT=4]="SCOUT"}(u=t.Specialism||(t.Specialism={})),t.OperativeRoleToString=["None","Combat","Staunch","Marksman","Scout"];class d extends a{constructor(){super(...arguments),this._role=u.NONE,this._model="",this._factions=new Set,this._keywords=new Set,this._abilities=new Map,this._rules=new Map,this._move='0"',this._apl="0",this._groupActivations="0",this._defence=0,this._saves="0+",this._wounds=0,this._weapons=[],this._upgrades=[],this._psychicPowers=[],this._psychicPowersWeapon=[]}equal(e){if(null==e)return!1;if(e._name===this._name&&e._role===this._role&&e._weapons.length===this._weapons.length){for(let t=0;t0||this._upgrades.length>0){let t=0;e+=" (";for(const n of this._weapons)e+=n.name(),t++,t!=this._weapons.length&&(e+=", ");this._upgrades.length>0&&!e.endsWith("(")&&(e+=", "),e+=this._upgrades.join(", "),e+=")"}return e}normalize(){this._weapons.sort(S),this._upgrades.sort(E);for(let e=0;eselections>selection");for(let e of r){let r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r&&"Game Type"!==r)if(r.includes("Detachment Command Cost"))console.log("Found Detachment Command Cost");else{let n=w(e);if(n){n._keywords.has("Leader")?t._leader=n:t._operatives.push(n);for(const e of n._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){m(e,t._rules);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),m(e,t._factionRules))}}}}for(const e of t._factionRules.keys())t._rules.delete(e);t._operatives.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function _(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function m(e,t){var n,r,i,o,s;const a=e.querySelectorAll(":scope profiles>profile");for(const l of a){const a=null===(n=l.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,c=null===(r=l.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(console.log("Prop name:"+a+" Type: "+c),a&&c)if("Abilities"===c||"Dynastic Code"===c){const e=l.querySelectorAll("characteristics>characteristic");for(const n of e){const e=null===(i=n.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;e&&n.textContent&&a&&("Description"!==e&&"Ability"!==e&&"Effect"!=e||t.set(a,n.textContent))}}else if("Weapons"===c){const n=e.querySelectorAll("rules>rule");for(const e of n)e.getAttributeNode("name")&&t.set(null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue,null===(s=e.firstChild)||void 0===s?void 0:s.textContent)}}}function g(e){switch(e){case"Combat":return u.COMBAT;case"Staunch":return u.STAUNCH;case"Marksman":return u.MARKSMAN;case"Scout":return u.SCOUT}return u.NONE}function v(e,t){var n,r;let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;console.log("Unknown profile type: "+o+" with name: "+i+". Found in operative: "+t._name)}function b(e,t){var n,r,i;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let o=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(o=e.parentElement.parentElement),t._customName=null===(r=o.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let s=o.firstElementChild;if(s&&"customNotes"===s.tagName&&(t._customNotes=s.textContent),"selection"===o.tagName){let e=o.querySelector("costs>cost");e&&e.getAttributeNode("value")&&(t._costs=null===(i=e.getAttributeNode("value"))||void 0===i?void 0:i.nodeValue)}return t._name}function y(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}function w(e){var t,n,r,i,o;let s=new d;b(e,s);let a=e.querySelectorAll(":scope categories>category");for(let e of a){const n=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(n){const e="Faction: ",t=n.lastIndexOf(e);if(t>=0){const r=n.slice(t+e.length);s._factions.add(r)}else{let e=g(n.trim());e!=u.NONE?s._role=e:s._keywords.add(n)}}}let l=[],c=[];for(let t of e.querySelectorAll('profile[typeName="Operative"]')){let e=null===(n=t.parentElement)||void 0===n?void 0:n.parentElement;if(!e||c.includes(e))continue;c.push(e);let r=Array.from(e.querySelectorAll(":scope profiles>profile")||[]);C(r,s),l=l.concat(r)}C(Array.from(e.querySelectorAll(":scope profiles>profile")).filter((e=>!l.includes(e))),s,0,!0);let h=e.querySelectorAll(":scope costs>cost");for(let e of h)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,n=null===(i=e.getAttributeNode("value"))||void 0===i?void 0:i.nodeValue;" EP"==t&&n&&+n>0&&(s._costs=(s.costs()+parseInt(n)).toString())}let f=e.querySelectorAll("rules > rule");for(let e of f)if(e.hasAttribute("name")){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue,n=e.querySelector("description");t&&n&&n.textContent&&s._rules.set(t,n.textContent)}return s.normalize(),s}function C(e,t,n,r=!1){var i,o,s,a,u,d,h,f,p,_,g,w;for(let n of e){const e=null===(i=n.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue,r=null===(o=n.getAttributeNode("typeName"))||void 0===o?void 0:o.nodeValue;if(e&&r)if("Operative"===r){let e=t._name;b(n,t),t._model=t._name,t._name=e;let r=n.querySelectorAll("characteristics>characteristic");for(let e of r){let n=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(n&&e.textContent)switch(n){case"M":t._move=e.textContent;break;case"APL":t._apl=e.textContent;break;case"GA":t._groupActivations=e.textContent;break;case"DF":t._defence=+e.textContent;break;case"SV":t._saves=e.textContent;break;case"W":t._wounds=+e.textContent}}}else if("Abilities"===r||"Equipment"===r||"Ability"===r||"Unique Actions"===r){let r=n.querySelectorAll("characteristics>characteristic");for(let i of r)if((null===(a=i.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue)&&i.textContent&&e){let r=null===(d=null===(u=n.parentElement)||void 0===u?void 0:u.parentElement)||void 0===d?void 0:d.querySelector("costs>cost"),o=e;if(r&&(null===(h=r.getAttributeNode("value"))||void 0===h?void 0:h.nodeValue)){let e=null===(f=r.getAttributeNode("value"))||void 0===f?void 0:f.nodeValue;e&&+e>0&&(o+=" ("+Math.floor(+e)+" EP)")}t._abilities.set(o,i.textContent)}if(n.parentElement&&n.parentElement.parentElement){const r=n.parentElement.parentElement;"upgrade"===(null===(p=r.getAttributeNode("type"))||void 0===p?void 0:p.nodeValue)&&r.parentElement&&r.parentElement.parentElement&&"model"===(null===(_=r.parentElement.parentElement.getAttributeNode("type"))||void 0===_?void 0:_.nodeValue)&&t._upgrades.push(e)}}else if("Weapons"===r){let e=new l;b(n,e),n.parentElement&&n.parentElement.parentElement&&m(n.parentElement.parentElement,t._rules),e._count=y(n);let r=n.querySelectorAll("characteristics>characteristic");for(let t of r){let n=null===(g=t.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue;if(n&&t.textContent)switch(n){case"A":e._attacks=t.textContent;break;case"WS/BS":e._skill=t.textContent;break;case"D":e._damage=t.textContent;break;case"SR":e._rules=t.textContent;break;case"!":e._criticalEffects=t.textContent}}t._weapons.push(e)}else if("Psychic Power"==r){let e=new c;b(n,e);let r=n.querySelectorAll("characteristics>characteristic");for(let t of r)"Effect"===(null===(w=t.getAttributeNode("name"))||void 0===w?void 0:w.nodeValue)&&t.textContent&&(e._effect=t.textContent);t._psychicPowers.push(e)}else v(n,t)}}function S(e,t){return E(e._name,t._name)}function E(e,t){return e>t?1:e==t?0:-1}t.RosterKT21=f,t.CreateKT21Roster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new f,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Kill Team (2021) Army Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&" EP"==i&&(t._equipmentPoints=+o)}}(e,r),function(e,t){var n,r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new h,l=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,c=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(l&&(o._name=l),c&&(o._catalog=c,o._faction=c),!_(o,t)){var s=e.querySelectorAll("force>rules>rule");for(let e of s)if(e.hasAttribute("name")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;var a=e.querySelector("rule>description");t&&a&&o._rules.set(t,a.textContent)}}p(e,o),t._forces.push(o)}}(e,r),r}}return null},t.Compare=E},452:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateMESBGRoster=void 0;const n=/\r\n|\r|\n| /,r=e=>{var t;return null!==(t=e.getAttribute("catalogueName"))&&void 0!==t?t:"MESBG Force"},i=e=>{var t;const n={half:0,quarter:0,modelCount:0};for(let r of e.querySelectorAll("rules>rule")){const e=null!==(t=r.getAttribute("name"))&&void 0!==t?t:"";if(e.endsWith("is halfway. (model)")){const t=parseFloat(e);isNaN(t)||(n.half=Math.ceil(t))}if(e.endsWith("models remaining. (model)")){const t=parseFloat(e);isNaN(t)||(n.quarter=Math.ceil(t))}if(e.endsWith("total models in Army. (model)")){const t=parseFloat(e);isNaN(t)||(n.modelCount=t)}}return n},o=e=>{var t,r,i,o,s,a,l,c,u,d,h,f,p,_,m,g,v,b,y;let w="",C="",S="",E=[],x="",k=!1;const A=[];for(let u of e.querySelectorAll('profiles > profile[typeName="Hero"]'))for(let e of u.querySelectorAll("characteristics > characteristic"))switch(null!==(r=null===(t=e.getAttribute("name"))||void 0===t?void 0:t.trim())&&void 0!==r?r:""){case"Might":S=null!==(i=e.textContent)&&void 0!==i?i:"";break;case"Fate":w=null!==(o=e.textContent)&&void 0!==o?o:"";break;case"Will":C=null!==(s=e.textContent)&&void 0!==s?s:"";break;case"Heroic Actions":E=null!==(l=null===(a=e.textContent)||void 0===a?void 0:a.split(n))&&void 0!==l?l:[];break;case"Heroic Tier":x=null!==(c=e.textContent)&&void 0!==c?c:""}for(let t of e.querySelectorAll('profile[typeName="Magical Power"]')){const e=null!==(u=t.getAttribute("name"))&&void 0!==u?u:"Unnamed Magic Power",n=null!==(h=null===(d=t.querySelector(':scope characteristic[name~="Duration"]'))||void 0===d?void 0:d.textContent)&&void 0!==h?h:"",r=null!==(p=null===(f=t.querySelector(':scope characteristic[name~="Range"]'))||void 0===f?void 0:f.textContent)&&void 0!==p?p:"",i=null!==(m=null===(_=t.querySelector(':scope characteristic[name~="Casting"]'))||void 0===_?void 0:_.textContent)&&void 0!==m?m:"",o=null!==(v=null===(g=t.querySelector(':scope characteristic[name~="Rule"]'))||void 0===g?void 0:g.textContent)&&void 0!==v?v:"",s=null!==(y=null===(b=t.querySelector(':scope characteristic[name~="Channelled"]'))||void 0===b?void 0:b.textContent)&&void 0!==y?y:"";A.push({name:e,duration:n,range:r,casting:i,normalEffect:o,channelledEffect:s})}return k=!!e.querySelector('selections > selection[name$="Leader (Valour)"]'),{fate:w,will:C,might:S,heroicTier:x,actions:E,magicalPowers:A,isLeader:k}},s=e=>{var t,r,i,a,u,d,h,f,p,_,m,g,v,b,y,w,C,S,E,x,k,A,T,N,L;const R=(e=>{var t,n,r;const i=[];for(let o of e)if(o.hasAttribute("name")){const e=null!==(t=o.getAttribute("name"))&&void 0!==t?t:null,s=null!==(r=null===(n=o.querySelector("rule>description"))||void 0===n?void 0:n.textContent)&&void 0!==r?r:"";null!==e&&i.push({name:e,ruleText:s})}return i})(null!==(t=e.querySelectorAll("rules > rule"))&&void 0!==t?t:[]),O=null!==(i=null===(r=e.getAttribute("name"))||void 0===r?void 0:r.trim())&&void 0!==i?i:"Unknown Model Name";let W=[];const z=[];let I,B,P="",M="",U="",D="",F="",q="",H="";e.querySelectorAll("profiles > profile");for(let t of e.querySelectorAll(":scope profiles > profile")){const r=t.getAttribute("typeName"),i=null!==(u=null===(a=t.getAttribute("name"))||void 0===a?void 0:a.trim())&&void 0!==u?u:"wowza";if(("Hero"===r||"Warrior"===r)&&i.startsWith(O)){for(let e of t.querySelectorAll("characteristics > characteristic"))switch(null!==(h=null===(d=e.getAttribute("name"))||void 0===d?void 0:d.trim())&&void 0!==h?h:""){case"Wounds":q=null!==(f=e.textContent)&&void 0!==f?f:"";break;case"Courage":H=null!==(p=e.textContent)&&void 0!==p?p:"";break;case"Attack":F=null!==(_=e.textContent)&&void 0!==_?_:"";break;case"Defense":D=null!==(m=e.textContent)&&void 0!==m?m:"";break;case"Strength":U=null!==(g=e.textContent)&&void 0!==g?g:"";break;case"Fight":M=null!==(v=e.textContent)&&void 0!==v?v:"";break;case"Movement":P=null!==(b=e.textContent)&&void 0!==b?b:"";break;case"Keywords":W=null!==(w=null===(y=e.textContent)||void 0===y?void 0:y.split(n))&&void 0!==w?w:[]}for(let t of null!==(C=l(e))&&void 0!==C?C:[]){if("Shield"===t.getAttribute("name")||t.querySelector('profile[typeName$="Wargear"]')||t.querySelector('profile[typeName$="Shooting Weapon"]')){const e=null!==(S=t.getAttribute("name"))&&void 0!==S?S:"Equipment",n=parseInt(null!==(x=null===(E=t.querySelector('cost[name$="Points"]'))||void 0===E?void 0:E.getAttribute("value"))&&void 0!==x?x:"0"),r=[];for(let e of t.querySelectorAll("characteristics > characteristic"))null!==e.textContent&&r.push(e.textContent);z.push({name:e,points:n,rules:r})}t.querySelector('profile[typeName$="Warrior"]')&&(I=s(null===(A=null===(k=t.querySelector('profile[typeName$="Warrior"]'))||void 0===k?void 0:k.parentElement)||void 0===A?void 0:A.parentElement))}"Hero"===r&&(B=o(e))}}let j=0;for(let t of null!==(T=c(e))&&void 0!==T?T:[])"Points"===(null===(N=t.getAttribute("name"))||void 0===N?void 0:N.trim())&&(j=parseInt(null!==(L=t.getAttribute("value"))&&void 0!==L?L:"0"));return{name:O,points:j,keywords:W,rules:R,profile:{attack:F,courage:H,defense:D,fight:M,movement:P,strength:U,wounds:q},wargear:z,mount:I,heroStuff:B}},a=e=>{var t,n,r,i;const o=[];for(let a of null!==(t=l(e))&&void 0!==t?t:[]){const e=a.querySelector('selection[type~="model"]');if(null!==e){const t=s(a),l=parseInt(null!==(n=e.getAttribute("number"))&&void 0!==n?n:"0"),c=parseInt(null!==(i=null===(r=e.querySelector('cost[name~="Points"]'))||void 0===r?void 0:r.getAttribute("value"))&&void 0!==i?i:"0");o.push({model:t,count:l,points:c})}}return o},l=e=>{var t,n;return null!==(n=null===(t=e.querySelector("selections"))||void 0===t?void 0:t.querySelectorAll(":scope > selection"))&&void 0!==n?n:null},c=e=>{var t,n;return null!==(n=null===(t=e.querySelector("costs"))||void 0===t?void 0:t.querySelectorAll(":scope > cost"))&&void 0!==n?n:null},u=e=>{let t=null,n=[];const r=l(e);if(null===r)return r;for(let e of r)"model"===e.getAttribute("type")&&(t=s(e)),"Warband"===e.getAttribute("name")&&(n=a(e));return null!==t?{leader:t,warband:n}:null},d=e=>{var t;let n=!1;for(let r of null!==(t=l(e))&&void 0!==t?t:[])"model"===r.getAttribute("type")&&(n=!0);return n};t.CreateMESBGRoster=function(e){var t,n;if(e){const o=null!==(n=null===(t=e.querySelector("roster"))||void 0===t?void 0:t.getAttribute("name"))&&void 0!==n?n:"Middle-Earth Stratgegy Battle Game Roster",{points:s,warriors:a}=(e=>{var t,n,r,i;const o=e.querySelectorAll("roster>costs>cost");let s=0,a=0;for(let e of o)"Points"===(null===(t=e.getAttribute("name"))||void 0===t?void 0:t.trim())&&(s=parseInt(null!==(n=e.getAttribute("value"))&&void 0!==n?n:"0")),"Warriors"===(null===(r=e.getAttribute("name"))||void 0===r?void 0:r.trim())&&(a=parseInt(null!==(i=e.getAttribute("value"))&&void 0!==i?i:"0"));return{points:s,warriors:a}})(e),c=(e=>{var t,n,o;const s=e.querySelectorAll("roster>forces>force"),a=[];for(let e of s){const s=r(e);let c={half:0,quarter:0,modelCount:0};const h=[],f=[],p=l(e);if(null!==p){for(let e of p)if("Determine Breakpoint & 25%"===e.getAttribute("name"))c=i(e);else if(d(e)){const t=u(e);null!==t&&h.push(t)}else{const r=e.querySelectorAll("rules > rule");for(let e of r){const r=null!==(n=null===(t=e.querySelector("description"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:"";f.push({name:null!==(o=e.getAttribute("name"))&&void 0!==o?o:"",ruleText:r})}}a.push({name:s,breakpoints:c,units:h,armyBonus:f})}}return a})(e);return{name:o,forces:c,points:s,warriors:a}}return alert("Bad Input File"),null}},320:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateWarcryRoster=t.RosterWarcry=t.WarcryForce=t.WarcryUnit=t.WarcryDamageTable=t.WarcryUnitRoleToString=t.WarcryUnitRole=t.WarcryWeapon=t.WarcryAllegiance=void 0;class n{constructor(){this._name="",this._rules=new Map}}t.WarcryAllegiance=n;class r{constructor(){this._name="",this._range="",this._attacks="",this._strength="",this._damage=""}}var i;t.WarcryWeapon=r,function(e){e[e.NONE=0]="NONE",e[e.LEADER=1]="LEADER",e[e.FIGHTER=2]="FIGHTER",e[e.ALLY=3]="ALLY",e[e.MONSTER=4]="MONSTER",e[e.HERO=5]="HERO",e[e.THRALL=6]="THRALL"}(i=t.WarcryUnitRole||(t.WarcryUnitRole={})),t.WarcryUnitRoleToString=["None","Leader","Fighter","Ally","Monster","Hero","Thrall"];class o{constructor(){this._name="",this._table=new Map}}t.WarcryDamageTable=o;class s{constructor(){this._name="",this._role=i.NONE,this._faction="chaos-iron-golems",this._keywords=new Set,this._abilities=new Map,this._move="1",this._wounds="1",this._toughness="1",this._weapons=[],this._damageTable=[],this._points=0}}t.WarcryUnit=s;class a{constructor(){this._catalog="",this._name="Unknown",this._units=[],this._allegiance=new n}}t.WarcryForce=a;class l{constructor(){this._points=0,this._name="",this._forces=[]}}function c(e){const t=e.toLowerCase();return t.includes("chaotic beasts")?"monster-chaotic-beasts":t.includes("monster")?t.includes("order")?"monster-of-order":t.includes("destruction")?"monster-of-destruction":t.includes("death")?"monster-of-death":"monster-chaotic-beasts":t.includes("beasts of chaos")?"factions-chaos-beasts-of-chaos":t.includes("corvus")?"factions-chaos-corvus-cabal":t.includes("cypher")?"factions-chaos-cypher-lords":t.includes("everchosen")?"factions-chaos-everchosen":t.includes("golems")?"factions-chaos-iron-golems":t.includes("khorne")&&t.includes("bloodbound")?"factions-chaos-khorne-bloodbound":t.includes("khorne")&&t.includes("daemon")?"factions-chaos-khorne-daemons":t.includes("nurgle")&&t.includes("rotbringer")?"factions-chaos-nurgle-rotbringers":t.includes("nurgle")&&t.includes("daemon")?"factions-chaos-nurgle-daemons":t.includes("scions")?"factions-chaos-scions-of-the-flame":t.includes("skaven")?"factions-chaos-skaven":t.includes("slaanesh")&&t.includes("sybariteI g")?"factions-chaos-slaanesh-syberites":t.includes("slaanesh")&&t.includes("daemon")?"factions-chaos-slaanesh-daemons":t.includes("slaves")?"factions-chaos-slaves-to-darkness":t.includes("spire")?"factions-chaos-spire-tyrants":t.includes("splintered")?"factions-chaos-splintered-fang":t.includes("unmade")?"factions-chaos-the-unmade":t.includes("tzeentch")&&t.includes("arcanite")?"factions-chaos-tzeentch-arcanites":t.includes("tzeentch")&&t.includes("daemon")?"factions-chaos-tzeentch-daemons":t.includes("untamed")?"factions-chaos-untamed-beasts":t.includes("flesh")?"factions-death-flesh-eater-courts":t.includes("nagash")?"factions-death-legions-of-nagash":t.includes("nighthaunt")?"factions-death-nighthaunt":t.includes("ossiarch")?"factions-death-ossiarch-bonereapers":t.includes("soulblight")?"factions-death-soulblight-gravelords":t.includes("bonesplitterz")?"factions-destruction-bonesplitterz":t.includes("fimirach")?"factions-destruction-fimirach":t.includes("gloomspite")?"factions-destruction-gloomspite-gitz":t.includes("ironjawz")?"factions-destruction-ironjawz":t.includes("kruleboyz")?"factions-destruction-kruleboyz":t.includes("ogor")?"factions-destruction-ogor-mawtribes":t.includes("cities of sigmar")?"factions-order-cities-of-sigmar":t.includes("khaine")?"factions-order-daughters-of-khaine":t.includes("fyreslayers")?"factions-order-fyreslayers":t.includes("idoneth")?"factions-order-idoneth-deepkin":t.includes("shadowstalkers")?"factions-order-khainite-shadowstalkers":t.includes("kharadron")?"factions-order-kharadron-overlords":t.includes("lumineth")?"factions-order-lumineth-realmlords":t.includes("seraphon")?"factions-order-seraphon":t.includes("stormcast")?t.includes("sacrosanct")?"factions-order-stormcast-eternals-sacrosanct":t.includes("thunderstrike")?"factions-order-stormcast-eternals-thunderstrike":t.includes("vanguard")?"factions-order-stormcast-eternals-vanguard":"factions-order-stormcast-eternals-warrior":t.includes("sylvaneth")?"factions-order-sylvaneth":""}function u(e,t){var r;let i=new n,o=e.querySelectorAll("rules>rule");for(let e of o)if(e.hasAttribute("name")){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;var s=e.querySelector("rule>description");t&&s&&s.textContent&&i._rules.set(t,s.textContent)}t._allegiance=i}function d(e,t){var n,r;let o=e.querySelectorAll("force>selections>selection");for(let e of o){if(!(null===(n=e.getAttributeNode("type"))||void 0===n?void 0:n.nodeValue))continue;if(!(null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue))continue;let o=h(e);o&&o._role!=i.NONE&&t._units.push(o)}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function h(e){var t,n,a,l,u,d,h,f,p;let _=new s,m=e.querySelectorAll("profiles>profile");for(let e of m){let i=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue,s=null===(n=e.getAttributeNode("typeName"))||void 0===n?void 0:n.nodeValue;if(i&&s)if("Model"==s){_._name=i;let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(a=e.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue;if(t&&e.textContent)switch(t){case"Move":_._move=e.textContent;break;case"Wounds":_._wounds=e.textContent;break;case"Toughness":_._toughness=e.textContent}}}else if("Weapon"==s){let t=new r;t._name=i;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue;if(n&&e.textContent)switch(n){case"Range":t._range=e.textContent;break;case"Attacks":t._attacks=e.textContent;break;case"Strength":t._strength=e.textContent;break;case"Damage":t._damage=e.textContent}}_._weapons.push(t)}else if("Damage Points Allocated"==s){let t=new o;t._name=i;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(u=e.getAttributeNode("name"))||void 0===u?void 0:u.nodeValue;n&&i&&(e.textContent?t._table.set(n,e.textContent):t._table.set(n,"-"))}_._damageTable.push(t)}else console.log("Unknown unit profile type: "+s)}let g=e.querySelectorAll("costs>cost");for(let e of g)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(d=e.getAttributeNode("name"))||void 0===d?void 0:d.nodeValue,n=null===(h=e.getAttributeNode("value"))||void 0===h?void 0:h.nodeValue;n&&"pts"===t&&(_._points+=+n)}let v=e.querySelectorAll(":scope categories>category");for(let e of v){let t=null===(f=e.getAttributeNode("name"))||void 0===f?void 0:f.nodeValue;if(t){var b=(y=t.trim()).includes("Leader")?i.LEADER:y.includes("Fighter")?i.FIGHTER:y.includes("Allies")||y.includes("Ally")?i.ALLY:y.includes("Monster")?i.MONSTER:y.includes("Hero")?i.HERO:y.includes("Thrall")?i.THRALL:i.NONE;b!=i.NONE?_._role=b:_._keywords.add(t)}}var y;let w=e.querySelectorAll(":scope selections>selection");for(let e of w){let t=null===(p=e.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(t){let e=c(t);e.length>0?_._faction=e:_._keywords.add(t)}}return _}t.RosterWarcry=l,t.CreateWarcryRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new l,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Age of Sigmar Warcry Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&"pts"===i&&(t._points=+o)}}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new a,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;o&&(i._name=o),s&&(i._catalog=s),u(e,i),d(e,i),t._forces.push(i)}console.log(t)}(e,r),r}}return null}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n(752)})(); \ No newline at end of file +(()=>{var e={733:(e,t,n)=>{e.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,(function(e){return i(t[s][1][e]||e)}),c,c.exports,e,t,n,r)}return n[s].exports}for(var o=void 0,s=0;s>2,a=(3&t)<<4|n>>4,l=1>6:64,c=2>4,n=(15&s)<<4|(a=o.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(l=o.indexOf(e.charAt(c++))),h[u++]=t,64!==a&&(h[u++]=n),64!==l&&(h[u++]=r);return h}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var r=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new o).pipe(new s("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new s("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var o=i,s=0+n;e^=-1;for(var a=0;a>>8^o[255&(e^t[a])];return-1^e}(0|t,e,e.length):function(e,t,n,r){var o=i,s=0+n;e^=-1;for(var a=0;a>>8^o[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var r;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=r?"uint8array":"array";function l(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",o.inherits(l,s),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(a,e.data),!1)},l.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function r(e,t){var n,r="";for(n=0;n>>=8;return r}function i(e,t,n,i,s,u){var d,h,f=e.file,p=e.compression,_=u!==a.utf8encode,m=o.transformTo("string",u(f.name)),g=o.transformTo("string",a.utf8encode(f.name)),v=f.comment,b=o.transformTo("string",u(v)),y=o.transformTo("string",a.utf8encode(v)),w=g.length!==f.name.length,C=y.length!==v.length,S="",E="",x="",k=f.dir,A=f.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var N=0;t&&(N|=8),_||!w&&!C||(N|=2048);var L=0,R=0;k&&(L|=16),"UNIX"===s?(R=798,L|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(R=20,L|=function(e){return 63&(e||0)}(f.dosPermissions)),d=A.getUTCHours(),d<<=6,d|=A.getUTCMinutes(),d<<=5,d|=A.getUTCSeconds()/2,h=A.getUTCFullYear()-1980,h<<=4,h|=A.getUTCMonth()+1,h<<=5,h|=A.getUTCDate(),w&&(E=r(1,1)+r(l(m),4)+g,S+="up"+r(E.length,2)+E),C&&(x=r(1,1)+r(l(b),4)+y,S+="uc"+r(x.length,2)+x);var O="";return O+="\n\0",O+=r(N,2),O+=p.magic,O+=r(d,2),O+=r(h,2),O+=r(T.crc32,4),O+=r(T.compressedSize,4),O+=r(T.uncompressedSize,4),O+=r(m.length,2),O+=r(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+O+m+S,dirRecord:c.CENTRAL_FILE_HEADER+r(R,2)+O+r(b.length,2)+"\0\0\0\0"+r(L,4)+r(i,4)+m+S+b}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),c=e("../signature");function u(e,t,n,r){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(u,s),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){"use strict";var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){"use strict";var r=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new l(r.transformTo("uint8array",e)):new o(r.transformTo("array",e)):new s(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../utils");function o(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,r),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,r),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=r},{}],29:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),l=e("../external"),c=null;if(a.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function u(e,t,n){var s=t;switch(t){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string"}try{this._internalType=s,this._outputType=t,this._mimeType=n,r.checkSupport(s),this._worker=e.pipe(new i(s)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return function(e,t){return new l.Promise((function(n,i){var o=[],a=e._internalType,l=e._outputType,c=e._mimeType;e.on("data",(function(e,n){o.push(e),t&&t(n)})).on("error",(function(e){o=[],i(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return s.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var n,r=0,i=null,o=0;for(n=0;n>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,o,s=e.length,l=new Array(2*s);for(t=n=0;t>10&1023,l[n++]=56320|1023&i)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),r.applyFromCharCode(l)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(c,s),c.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var s=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;s!==t.length&&(i.uint8array?(l=t.subarray(0,s),this.leftOver=t.subarray(s,t.length)):(l=t.slice(0,s),this.leftOver=t.slice(s,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,r.inherits(u,s),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){"use strict";var r=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(e){return e}function l(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,c[r++]=56320|1023&i)}return l(c,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==n;){for(n-=s=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var o=r,s=i+n;e^=-1;for(var a=i;a>>8^o[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){"use strict";var r,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),l=e("./messages"),c=0,u=0,d=-2,h=2,f=8,p=286,_=30,m=19,g=2*p+1,v=15,b=3,y=258,w=y+b+1,C=42,S=113;function E(e,t){return e.msg=l[t],t}function x(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function T(e,t){o._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,A(e.strm)}function N(e,t){e.pending_buf[e.pending++]=t}function L(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function R(e,t){var n,r,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-w?e.strstart-(e.w_size-w):0,c=e.window,u=e.w_mask,d=e.prev,h=e.strstart+y,f=c[o+s-1],p=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+s]===p&&c[n+s-1]===f&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&ol&&0!=--i);return s<=e.lookahead?s:e.lookahead}function O(e){var t,n,r,o,l,c,u,d,h,f,p=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-w)){for(i.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=n=e.hash_size;r=e.head[--t],e.head[t]=p<=r?r-p:0,--n;);for(t=n=p;r=e.prev[--t],e.prev[t]=p<=r?r-p:0,--n;);o+=p}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,d=e.strstart+e.lookahead,f=void 0,(h=o)<(f=c.avail_in)&&(f=h),n=0===f?0:(c.avail_in-=f,i.arraySet(u,c.input,c.next_in,f,d),1===c.state.wrap?c.adler=s(c.adler,u,f,d):2===c.state.wrap&&(c.adler=a(c.adler,u,f,d)),c.next_in+=f,c.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=b)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(O(e),0===e.lookahead&&t===c)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,T(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-w&&(T(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(T(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(T(e,!1),e.strm.avail_out),1)})),new I(4,4,8,4,W),new I(4,5,16,8,W),new I(4,6,32,32,W),new I(4,4,16,16,z),new I(8,16,32,32,z),new I(8,16,128,128,z),new I(8,32,128,256,z),new I(32,128,258,1024,z),new I(32,258,258,4096,z)],n.deflateInit=function(e,t){return U(e,t,f,15,8,0)},n.deflateInit2=U,n.deflateReset=M,n.deflateResetKeep=P,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,u):d},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5>8&255),N(i,i.gzhead.time>>16&255),N(i,i.gzhead.time>>24&255),N(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),N(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(N(i,255&i.gzhead.extra.length),N(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(N(i,0),N(i,0),N(i,0),N(i,0),N(i,0),N(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),N(i,3),i.status=S);else{var h=f+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=S,L(i,h),0!==i.strstart&&(L(i,e.adler>>>16),L(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),A(e),s=i.pending,i.pending!==i.pending_buf_size));)N(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),A(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),A(e),s=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexs&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&A(e),i.pending+2<=i.pending_buf_size&&(N(i,255&e.adler),N(i,e.adler>>8&255),e.adler=0,i.status=S)):i.status=S),0!==i.pending){if(A(e),0===e.avail_out)return i.last_flush=-1,u}else if(0===e.avail_in&&x(t)<=x(n)&&4!==t)return E(e,-5);if(666===i.status&&0!==e.avail_in)return E(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var p=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(O(e),0===e.lookahead)){if(t===c)return 1;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(T(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(T(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(T(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=y){if(O(e),e.lookahead<=y&&t===c)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(n=o._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(T(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(T(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(T(e,!1),0===e.strm.avail_out)?1:2}(i,t):r[i.level].func(i,t);if(3!==p&&4!==p||(i.status=666),1===p||3===p)return 0===e.avail_out&&(i.last_flush=-1),u;if(2===p&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(k(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),A(e),0===e.avail_out))return i.last_flush=-1,u}return 4!==t?u:i.wrap<=0?1:(2===i.wrap?(N(i,255&e.adler),N(i,e.adler>>8&255),N(i,e.adler>>16&255),N(i,e.adler>>24&255),N(i,255&e.total_in),N(i,e.total_in>>8&255),N(i,e.total_in>>16&255),N(i,e.total_in>>24&255)):(L(i,e.adler>>>16),L(i,65535&e.adler)),A(e),0=n.w_size&&(0===a&&(k(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,p-n.w_size,n.w_size,0),t=f,p=n.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=p,e.next_in=0,e.input=t,O(n);n.lookahead>=b;){for(r=n.strstart,o=n.lookahead-(b-1);n.ins_h=(n.ins_h<>>=y=b>>>24,p-=y,0==(y=b>>>16&255))k[o++]=65535&b;else{if(!(16&y)){if(0==(64&y)){b=_[(65535&b)+(f&(1<>>=y,p-=y),p<15&&(f+=x[r++]<>>=y=b>>>24,p-=y,!(16&(y=b>>>16&255))){if(0==(64&y)){b=m[(65535&b)+(f&(1<>>=y,p-=y,(y=o-s)>3,f&=(1<<(p-=w<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=u,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(d),t.distcode=t.distdyn=new r.Buf32(h),t.sane=1,t.back=-1,l):c}function m(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):c}function g(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(r.arraySet(s.window,t,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i<(o=s.wsize-s.wnext)&&(o=i),r.arraySet(s.window,t,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,t,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,n.check=o(n.check,M,2,0),b=v=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&v)<<8)+(v>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&v)){e.msg="unknown compression method",n.mode=30;break}if(b-=4,W=8+(15&(v>>>=4)),0===n.wbits)n.wbits=W;else if(W>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(M[0]=255&v,M[1]=v>>>8&255,n.check=o(n.check,M,2,0)),b=v=0,n.mode=3;case 3:for(;b<32;){if(0===m)break e;m--,v+=d[p++]<>>8&255,M[2]=v>>>16&255,M[3]=v>>>24&255,n.check=o(n.check,M,4,0)),b=v=0,n.mode=4;case 4:for(;b<16;){if(0===m)break e;m--,v+=d[p++]<>8),512&n.flags&&(M[0]=255&v,M[1]=v>>>8&255,n.check=o(n.check,M,2,0)),b=v=0,n.mode=5;case 5:if(1024&n.flags){for(;b<16;){if(0===m)break e;m--,v+=d[p++]<>>8&255,n.check=o(n.check,M,2,0)),b=v=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(m<(E=n.length)&&(E=m),E&&(n.head&&(W=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,d,p,E,W)),512&n.flags&&(n.check=o(n.check,d,E,p)),m-=E,p+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===m)break e;for(E=0;W=d[p+E++],n.head&&W&&n.length<65536&&(n.head.name+=String.fromCharCode(W)),W&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;b<32;){if(0===m)break e;m--,v+=d[p++]<>>=7&b,b-=7&b,n.mode=27;break}for(;b<3;){if(0===m)break e;m--,v+=d[p++]<>>=1)){case 0:n.mode=14;break;case 1:if(C(n),n.mode=20,6!==t)break;v>>>=2,b-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}v>>>=2,b-=2;break;case 14:for(v>>>=7&b,b-=7&b;b<32;){if(0===m)break e;m--,v+=d[p++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&v,b=v=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(E=n.length){if(m>>=5,b-=5,n.ndist=1+(31&v),v>>>=5,b-=5,n.ncode=4+(15&v),v>>>=4,b-=4,286>>=3,b-=3}for(;n.have<19;)n.lens[U[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,I={bits:n.lenbits},z=a(0,n.lens,0,19,n.lencode,0,n.work,I),n.lenbits=I.bits,z){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,N=65535&P,!((A=P>>>24)<=b);){if(0===m)break e;m--,v+=d[p++]<>>=A,b-=A,n.lens[n.have++]=N;else{if(16===N){for(B=A+2;b>>=A,b-=A,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}W=n.lens[n.have-1],E=3+(3&v),v>>>=2,b-=2}else if(17===N){for(B=A+3;b>>=A)),v>>>=3,b-=3}else{for(B=A+7;b>>=A)),v>>>=7,b-=7}if(n.have+E>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;E--;)n.lens[n.have++]=W}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,I={bits:n.lenbits},z=a(1,n.lens,0,n.nlen,n.lencode,0,n.work,I),n.lenbits=I.bits,z){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,I={bits:n.distbits},z=a(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,I),n.distbits=I.bits,z){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=m&&258<=g){e.next_out=_,e.avail_out=g,e.next_in=p,e.avail_in=m,n.hold=v,n.bits=b,s(e,w),_=e.next_out,h=e.output,g=e.avail_out,p=e.next_in,d=e.input,m=e.avail_in,v=n.hold,b=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;T=(P=n.lencode[v&(1<>>16&255,N=65535&P,!((A=P>>>24)<=b);){if(0===m)break e;m--,v+=d[p++]<>L)])>>>16&255,N=65535&P,!(L+(A=P>>>24)<=b);){if(0===m)break e;m--,v+=d[p++]<>>=L,b-=L,n.back+=L}if(v>>>=A,b-=A,n.back+=A,n.length=N,0===T){n.mode=26;break}if(32&T){n.back=-1,n.mode=12;break}if(64&T){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&T,n.mode=22;case 22:if(n.extra){for(B=n.extra;b>>=n.extra,b-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;T=(P=n.distcode[v&(1<>>16&255,N=65535&P,!((A=P>>>24)<=b);){if(0===m)break e;m--,v+=d[p++]<>L)])>>>16&255,N=65535&P,!(L+(A=P>>>24)<=b);){if(0===m)break e;m--,v+=d[p++]<>>=L,b-=L,n.back+=L}if(v>>>=A,b-=A,n.back+=A,64&T){e.msg="invalid distance code",n.mode=30;break}n.offset=N,n.extra=15&T,n.mode=24;case 24:if(n.extra){for(B=n.extra;b>>=n.extra,b-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===g)break e;if(E=w-g,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}x=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),k=n.window}else k=h,x=_-n.offset,E=n.length;for(gv?(y=P[M+d[E]],W[z+d[E]]):(y=96,0),f=1<>N)+(p-=f)]=b<<24|y<<16|w|0,0!==p;);for(f=1<>=1;if(0!==f?(O&=f-1,O+=f):O=0,E++,0==--I[S]){if(S===k)break;S=t[n+d[E]]}if(A>>7)]}function k(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function A(e,t,n){e.bi_valid>c-n?(e.bi_buf|=t<>c-e.bi_valid,e.bi_valid+=n-c):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function L(e,t,n){var r,i,o=new Array(l+1),s=0;for(r=1;r<=l;r++)o[r]=s=s+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=N(o[a]++,a))}}function R(e){var t;for(t=0;t>1;1<=n;n--)z(e,o,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],z(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,o[2*i]=o[2*n]+o[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,o[2*n+1]=o[2*r+1]=i,e.heap[1]=i++,z(e,o,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,o,s,a,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,h=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,m=0;for(o=0;o<=l;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)_<(o=c[2*c[2*(r=e.heap[n])+1]+1]+1)&&(o=_,m++),c[2*r+1]=o,u>=7;r>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==t?D(e,t,n,r):4===e.strategy||s===i?(A(e,2+(r?1:0),3),I(e,p,_)):(A(e,4+(r?1:0),3),function(e,t,n,r){var i;for(A(e,t-257,5),A(e,n-1,5),A(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(g[n]+o+1)]++,e.dyn_dtree[2*x(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){A(e,2,3),T(e,256,p),function(e){16===e.bi_valid?(k(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,r,i,o,s=1,a={},l=!1,c=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){h(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){i.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(h,0,e)},u.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r"']/g,$=RegExp(V.source),X=RegExp(Y.source),G=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,_e=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,ye=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",ke="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Te="["+we+"]",Ne="["+Ae+"]",Le="["+Ce+"]",Re="\\d+",Oe="["+Se+"]",We="["+Ee+"]",ze="[^"+we+Ae+Re+Se+Ee+xe+"]",Ie="\\ud83c[\\udffb-\\udfff]",Be="[^"+we+"]",Pe="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+xe+"]",De="\\u200d",Fe="(?:"+We+"|"+ze+")",qe="(?:"+Ue+"|"+ze+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Le+"|"+Ie+")?",Ye="["+ke+"]?",$e=Ye+Ve+"(?:"+De+"(?:"+[Be,Pe,Me].join("|")+")"+Ye+Ve+")*",Xe="(?:"+[Oe,Pe,Me].join("|")+")"+$e,Ge="(?:"+[Be+Le+"?",Le,Pe,Me,Te].join("|")+")",Je=RegExp("['’]","g"),Ze=RegExp(Le,"g"),Ke=RegExp(Ie+"(?="+Ie+")|"+Ge+$e,"g"),Qe=RegExp([Ue+"?"+We+"+"+He+"(?="+[Ne,Ue,"$"].join("|")+")",qe+"+"+je+"(?="+[Ne,Ue+Fe,"$"].join("|")+")",Ue+"?"+Fe+"+"+He,Ue+"+"+je,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Re,Xe].join("|"),"g"),et=RegExp("["+De+we+Ce+ke+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[W]=it[z]=it[I]=it[B]=it[P]=it[M]=it[U]=it[D]=it[F]=!0,it[_]=it[m]=it[R]=it[g]=it[O]=it[v]=it[b]=it[y]=it[C]=it[S]=it[E]=it[k]=it[A]=it[T]=it[L]=!1;var ot={};ot[_]=ot[m]=ot[R]=ot[O]=ot[g]=ot[v]=ot[W]=ot[z]=ot[I]=ot[B]=ot[P]=ot[C]=ot[S]=ot[E]=ot[k]=ot[A]=ot[T]=ot[N]=ot[M]=ot[U]=ot[D]=ot[F]=!0,ot[b]=ot[y]=ot[L]=!1;var st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,lt=parseInt,ct="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=ct||ut||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,pt=ft&&ft.exports===ht,_t=pt&&ct.process,mt=function(){try{return ft&&ft.require&&ft.require("util").types||_t&&_t.binding&&_t.binding("util")}catch(e){}}(),gt=mt&&mt.isArrayBuffer,vt=mt&&mt.isDate,bt=mt&&mt.isMap,yt=mt&&mt.isRegExp,wt=mt&&mt.isSet,Ct=mt&&mt.isTypedArray;function St(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Et(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Lt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}var en=jt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=jt({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+st[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function sn(e,t){return function(n){return e(t(n))}}function an(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),pn=function e(t){var n,r=(t=null==t?dt:pn.defaults(dt.Object(),t,pn.pick(dt,nt))).Array,ie=t.Date,we=t.Error,Ce=t.Function,Se=t.Math,Ee=t.Object,xe=t.RegExp,ke=t.String,Ae=t.TypeError,Te=r.prototype,Ne=Ce.prototype,Le=Ee.prototype,Re=t["__core-js_shared__"],Oe=Ne.toString,We=Le.hasOwnProperty,ze=0,Ie=(n=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Be=Le.toString,Pe=Oe.call(Ee),Me=dt._,Ue=xe("^"+Oe.call(We).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=pt?t.Buffer:i,Fe=t.Symbol,qe=t.Uint8Array,He=De?De.allocUnsafe:i,je=sn(Ee.getPrototypeOf,Ee),Ve=Ee.create,Ye=Le.propertyIsEnumerable,$e=Te.splice,Xe=Fe?Fe.isConcatSpreadable:i,Ge=Fe?Fe.iterator:i,Ke=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Ee,"defineProperty");return e({},"",{}),e}catch(e){}}(),st=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ct=ie&&ie.now!==dt.Date.now&&ie.now,ut=t.setTimeout!==dt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,_t=Ee.getOwnPropertySymbols,mt=De?De.isBuffer:i,Bt=t.isFinite,jt=Te.join,_n=sn(Ee.keys,Ee),mn=Se.max,gn=Se.min,vn=ie.now,bn=t.parseInt,yn=Se.random,wn=Te.reverse,Cn=lo(t,"DataView"),Sn=lo(t,"Map"),En=lo(t,"Promise"),xn=lo(t,"Set"),kn=lo(t,"WeakMap"),An=lo(Ee,"create"),Tn=kn&&new kn,Nn={},Ln=Po(Cn),Rn=Po(Sn),On=Po(En),Wn=Po(xn),zn=Po(kn),In=Fe?Fe.prototype:i,Bn=In?In.valueOf:i,Pn=In?In.toString:i;function Mn(e){if(ea(e)&&!Hs(e)&&!(e instanceof qn)){if(e instanceof Fn)return e;if(We.call(e,"__wrapped__"))return Mo(e)}return new Fn(e)}var Un=function(){function e(){}return function(t){if(!Qs(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Dn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function qn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sr(e,t,n,r,o,s){var a,l=1&t,c=2&t,u=4&t;if(n&&(a=o?n(e,r,o,s):n(e)),a!==i)return a;if(!Qs(e))return e;var d=Hs(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&We.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return ki(e,a)}else{var h=ho(e),f=h==y||h==w;if($s(e))return yi(e,l);if(h==E||h==_||f&&!o){if(a=c||f?{}:po(e),!l)return c?function(e,t){return Ai(e,uo(e),t)}(e,function(e,t){return e&&Ai(t,Ra(t),e)}(a,e)):function(e,t){return Ai(e,co(e),t)}(e,nr(a,e))}else{if(!ot[h])return o?e:{};a=function(e,t,n){var r,i=e.constructor;switch(t){case R:return wi(e);case g:case v:return new i(+e);case O:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case W:case z:case I:case B:case P:case M:case U:case D:case F:return Ci(e,n);case C:return new i;case S:case T:return new i(e);case k:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case N:return r=e,Bn?Ee(Bn.call(r)):{}}}(e,h,l)}}s||(s=new $n);var p=s.get(e);if(p)return p;s.set(e,a),oa(e)?e.forEach((function(r){a.add(sr(r,t,n,r,e,s))})):ta(e)&&e.forEach((function(r,i){a.set(i,sr(r,t,n,i,e,s))}));var m=d?i:(u?c?to:eo:c?Ra:La)(e);return xt(m||e,(function(r,i){m&&(r=e[i=r]),Qn(a,i,sr(r,t,n,i,e,s))})),a}function ar(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ee(e);r--;){var o=n[r],s=t[o],a=e[o];if(a===i&&!(o in e)||!s(a))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new Ae(o);return To((function(){e.apply(i,n)}),t)}function cr(e,t,n,r){var i=-1,o=Nt,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=Rt(t,Gt(n))),r?(o=Lt,s=!1):t.length>=200&&(o=Zt,s=!1,t=new Yn(t));e:for(;++i-1},jn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new Hn,map:new(Sn||jn),string:new Hn}},Vn.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return so(this,e).get(e)},Vn.prototype.has=function(e){return so(this,e).has(e)},Vn.prototype.set=function(e,t){var n=so(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Yn.prototype.add=Yn.prototype.push=function(e){return this.__data__.set(e,s),this},Yn.prototype.has=function(e){return this.__data__.has(e)},$n.prototype.clear=function(){this.__data__=new jn,this.size=0},$n.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},$n.prototype.get=function(e){return this.__data__.get(e)},$n.prototype.has=function(e){return this.__data__.has(e)},$n.prototype.set=function(e,t){var n=this.__data__;if(n instanceof jn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var ur=Li(vr),dr=Li(br,!0);function hr(e,t){var n=!0;return ur(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function fr(e,t,n){for(var r=-1,o=e.length;++r0&&n(a)?t>1?_r(a,t-1,n,r,i):Ot(i,a):r||(i[i.length]=a)}return i}var mr=Ri(),gr=Ri(!0);function vr(e,t){return e&&mr(e,t,La)}function br(e,t){return e&&gr(e,t,La)}function yr(e,t){return Tt(t,(function(t){return Js(e[t])}))}function wr(e,t){for(var n=0,r=(t=mi(t,e)).length;null!=e&&nt}function xr(e,t){return null!=e&&We.call(e,t)}function kr(e,t){return null!=e&&t in Ee(e)}function Ar(e,t,n){for(var o=n?Lt:Nt,s=e[0].length,a=e.length,l=a,c=r(a),u=1/0,d=[];l--;){var h=e[l];l&&t&&(h=Rt(h,Gt(t))),u=gn(h.length,u),c[l]=!n&&(t||s>=120&&h.length>=120)?new Yn(l&&h):i}h=e[0];var f=-1,p=c[0];e:for(;++f=a?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function qr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)a!==e&&$e.call(a,l,1),$e.call(e,l,1);return e}function jr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;mo(i)?$e.call(e,i,1):li(e,i)}}return e}function Vr(e,t){return e+ft(yn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>d)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function $r(e,t){return No(Eo(e,t,nl),e+"")}function Xr(e){return Gn(Ua(e))}function Gr(e,t){var n=Ua(e);return Oo(n,or(t,0,n.length))}function Jr(e,t,n,r){if(!Qs(e))return e;for(var o=-1,s=(t=mi(t,e)).length,a=s-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i>>1,s=e[o];null!==s&&!aa(s)&&(n?s<=t:s=200){var c=t?null:Yi(e);if(c)return ln(c);s=!1,i=Zt,l=new Yn}else l=t?[]:a;e:for(;++r=r?e:ei(e,t,n)}var bi=st||function(e){return dt.clearTimeout(e)};function yi(e,t){if(t)return e.slice();var n=e.length,r=He?He(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function Ci(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,s=aa(e),a=t!==i,l=null===t,c=t==t,u=aa(t);if(!l&&!u&&!s&&e>t||s&&a&&c&&!l&&!u||r&&a&&c||!n&&c||!o)return 1;if(!r&&!s&&!u&&e1?n[o-1]:i,a=o>2?n[2]:i;for(s=e.length>3&&"function"==typeof s?(o--,s):i,a&&go(n[0],n[1],a)&&(s=o<3?i:s,o=1),t=Ee(t);++r-1?o[s?t[a]:a]:i}}function Bi(e){return Qi((function(t){var n=t.length,r=n,s=Fn.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new Ae(o);if(s&&!l&&"wrapper"==ro(a))var l=new Fn([],!0)}for(r=l?r:n;++r1&&y.reverse(),f&&dl))return!1;var u=s.get(e),d=s.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&n?new Yn:i;for(s.set(e,t),s.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return xt(p,(function(n){var r="_."+n[0];t&n[1]&&!Nt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(r),n)))}function Ro(e){var t=0,n=0;return function(){var r=vn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Oo(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,is(e,n)}));function ds(e){var t=Mn(e);return t.__chain__=!0,t}function hs(e,t){return t(e)}var fs=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof qn&&mo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:hs,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ps=Ti((function(e,t,n){We.call(e,n)?++e[n]:rr(e,n,1)})),_s=Ii(qo),ms=Ii(Ho);function gs(e,t){return(Hs(e)?xt:ur)(e,oo(t,3))}function vs(e,t){return(Hs(e)?kt:dr)(e,oo(t,3))}var bs=Ti((function(e,t,n){We.call(e,n)?e[n].push(t):rr(e,n,[t])})),ys=$r((function(e,t,n){var i=-1,o="function"==typeof t,s=Vs(e)?r(e.length):[];return ur(e,(function(e){s[++i]=o?St(t,e,n):Tr(e,t,n)})),s})),ws=Ti((function(e,t,n){rr(e,n,t)}));function Cs(e,t){return(Hs(e)?Rt:Br)(e,oo(t,3))}var Ss=Ti((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Es=$r((function(e,t){if(null==e)return[];var n=t.length;return n>1&&go(e,t[0],t[1])?t=[]:n>2&&go(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,_r(t,1),[])})),xs=ct||function(){return dt.Date.now()};function ks(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Xi(e,c,i,i,i,i,t)}function As(e,t){var n;if("function"!=typeof t)throw new Ae(o);return e=fa(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ts=$r((function(e,t,n){var r=1;if(n.length){var i=an(n,io(Ts));r|=l}return Xi(e,r,t,n,i)})),Ns=$r((function(e,t,n){var r=3;if(n.length){var i=an(n,io(Ns));r|=l}return Xi(t,r,e,n,i)}));function Ls(e,t,n){var r,s,a,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ae(o);function _(t){var n=r,o=s;return r=s=i,d=t,l=e.apply(o,n)}function m(e){var n=e-u;return u===i||n>=t||n<0||f&&e-d>=a}function g(){var e=xs();if(m(e))return v(e);c=To(g,function(e){var n=t-(e-u);return f?gn(n,a-(e-d)):n}(e))}function v(e){return c=i,p&&r?_(e):(r=s=i,l)}function b(){var e=xs(),n=m(e);if(r=arguments,s=this,u=e,n){if(c===i)return function(e){return d=e,c=To(g,t),h?_(e):l}(u);if(f)return bi(c),c=To(g,t),_(u)}return c===i&&(c=To(g,t)),l}return t=_a(t)||0,Qs(n)&&(h=!!n.leading,a=(f="maxWait"in n)?mn(_a(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),b.cancel=function(){c!==i&&bi(c),d=0,r=u=s=c=i},b.flush=function(){return c===i?l:v(xs())},b}var Rs=$r((function(e,t){return lr(e,1,t)})),Os=$r((function(e,t,n){return lr(e,_a(t)||0,n)}));function Ws(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ws.Cache||Vn),n}function zs(e){if("function"!=typeof e)throw new Ae(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ws.Cache=Vn;var Is=gi((function(e,t){var n=(t=1==t.length&&Hs(t[0])?Rt(t[0],Gt(oo())):Rt(_r(t,1),Gt(oo()))).length;return $r((function(r){for(var i=-1,o=gn(r.length,n);++i=t})),qs=Nr(function(){return arguments}())?Nr:function(e){return ea(e)&&We.call(e,"callee")&&!Ye.call(e,"callee")},Hs=r.isArray,js=gt?Gt(gt):function(e){return ea(e)&&Sr(e)==R};function Vs(e){return null!=e&&Ks(e.length)&&!Js(e)}function Ys(e){return ea(e)&&Vs(e)}var $s=mt||_l,Xs=vt?Gt(vt):function(e){return ea(e)&&Sr(e)==v};function Gs(e){if(!ea(e))return!1;var t=Sr(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ra(e)}function Js(e){if(!Qs(e))return!1;var t=Sr(e);return t==y||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zs(e){return"number"==typeof e&&e==fa(e)}function Ks(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=d}function Qs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ea(e){return null!=e&&"object"==typeof e}var ta=bt?Gt(bt):function(e){return ea(e)&&ho(e)==C};function na(e){return"number"==typeof e||ea(e)&&Sr(e)==S}function ra(e){if(!ea(e)||Sr(e)!=E)return!1;var t=je(e);if(null===t)return!0;var n=We.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==Pe}var ia=yt?Gt(yt):function(e){return ea(e)&&Sr(e)==k},oa=wt?Gt(wt):function(e){return ea(e)&&ho(e)==A};function sa(e){return"string"==typeof e||!Hs(e)&&ea(e)&&Sr(e)==T}function aa(e){return"symbol"==typeof e||ea(e)&&Sr(e)==N}var la=Ct?Gt(Ct):function(e){return ea(e)&&Ks(e.length)&&!!it[Sr(e)]},ca=Hi(Ir),ua=Hi((function(e,t){return e<=t}));function da(e){if(!e)return[];if(Vs(e))return sa(e)?dn(e):ki(e);if(Ge&&e[Ge])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ge]());var t=ho(e);return(t==C?on:t==A?ln:Ua)(e)}function ha(e){return e?(e=_a(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fa(e){var t=ha(e),n=t%1;return t==t?n?t-n:t:0}function pa(e){return e?or(fa(e),0,f):0}function _a(e){if("number"==typeof e)return e;if(aa(e))return h;if(Qs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Xt(e);var n=pe.test(e);return n||me.test(e)?lt(e.slice(2),n?2:8):fe.test(e)?h:+e}function ma(e){return Ai(e,Ra(e))}function ga(e){return null==e?"":si(e)}var va=Ni((function(e,t){if(wo(t)||Vs(t))Ai(t,La(t),e);else for(var n in t)We.call(t,n)&&Qn(e,n,t[n])})),ba=Ni((function(e,t){Ai(t,Ra(t),e)})),ya=Ni((function(e,t,n,r){Ai(t,Ra(t),e,r)})),wa=Ni((function(e,t,n,r){Ai(t,La(t),e,r)})),Ca=Qi(ir),Sa=$r((function(e,t){e=Ee(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&go(t[0],t[1],o)&&(r=1);++n1),t})),Ai(e,to(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Ia=Qi((function(e,t){return null==e?{}:function(e,t){return qr(e,t,(function(t,n){return ka(e,n)}))}(e,t)}));function Ba(e,t){if(null==e)return{};var n=Rt(to(e),(function(e){return[e]}));return t=oo(t),qr(e,n,(function(e,n){return t(e,n[0])}))}var Pa=$i(La),Ma=$i(Ra);function Ua(e){return null==e?[]:Jt(e,La(e))}var Da=Wi((function(e,t,n){return t=t.toLowerCase(),e+(n?Fa(t):t)}));function Fa(e){return Ga(ga(e).toLowerCase())}function qa(e){return(e=ga(e))&&e.replace(ve,en).replace(Ze,"")}var Ha=Wi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),ja=Wi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Va=Oi("toLowerCase"),Ya=Wi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),$a=Wi((function(e,t,n){return e+(n?" ":"")+Ga(t)})),Xa=Wi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ga=Oi("toUpperCase");function Ja(e,t,n){return e=ga(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Za=$r((function(e,t){try{return St(e,i,t)}catch(e){return Gs(e)?e:new we(e)}})),Ka=Qi((function(e,t){return xt(t,(function(t){t=Bo(t),rr(e,t,Ts(e[t],e))})),e}));function Qa(e){return function(){return e}}var el=Bi(),tl=Bi(!0);function nl(e){return e}function rl(e){return Wr("function"==typeof e?e:sr(e,1))}var il=$r((function(e,t){return function(n){return Tr(n,e,t)}})),ol=$r((function(e,t){return function(n){return Tr(e,n,t)}}));function sl(e,t,n){var r=La(t),i=yr(t,r);null!=n||Qs(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=yr(t,La(t)));var o=!(Qs(n)&&"chain"in n&&!n.chain),s=Js(e);return xt(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=ki(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ot([this.value()],arguments))})})),e}function al(){}var ll=Di(Rt),cl=Di(At),ul=Di(It);function dl(e){return vo(e)?Ht(Bo(e)):function(e){return function(t){return wr(t,e)}}(e)}var hl=qi(),fl=qi(!0);function pl(){return[]}function _l(){return!1}var ml,gl=Ui((function(e,t){return e+t}),0),vl=Vi("ceil"),bl=Ui((function(e,t){return e/t}),1),yl=Vi("floor"),wl=Ui((function(e,t){return e*t}),1),Cl=Vi("round"),Sl=Ui((function(e,t){return e-t}),0);return Mn.after=function(e,t){if("function"!=typeof t)throw new Ae(o);return e=fa(e),function(){if(--e<1)return t.apply(this,arguments)}},Mn.ary=ks,Mn.assign=va,Mn.assignIn=ba,Mn.assignInWith=ya,Mn.assignWith=wa,Mn.at=Ca,Mn.before=As,Mn.bind=Ts,Mn.bindAll=Ka,Mn.bindKey=Ns,Mn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Hs(e)?e:[e]},Mn.chain=ds,Mn.chunk=function(e,t,n){t=(n?go(e,t,n):t===i)?1:mn(fa(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,a=0,l=r(ht(o/t));so?0:o+n),(r=r===i||r>o?o:fa(r))<0&&(r+=o),r=n>r?0:pa(r);n>>0)?(e=ga(e))&&("string"==typeof t||null!=t&&!ia(t))&&!(t=si(t))&&rn(e)?vi(dn(e),0,n):e.split(t,n):[]},Mn.spread=function(e,t){if("function"!=typeof e)throw new Ae(o);return t=null==t?0:mn(fa(t),0),$r((function(n){var r=n[t],i=vi(n,0,t);return r&&Ot(i,r),St(e,this,i)}))},Mn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Mn.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:fa(t))<0?0:t):[]},Mn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:fa(t)))<0?0:t,r):[]},Mn.takeRightWhile=function(e,t){return e&&e.length?ui(e,oo(t,3),!1,!0):[]},Mn.takeWhile=function(e,t){return e&&e.length?ui(e,oo(t,3)):[]},Mn.tap=function(e,t){return t(e),e},Mn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ae(o);return Qs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ls(e,t,{leading:r,maxWait:t,trailing:i})},Mn.thru=hs,Mn.toArray=da,Mn.toPairs=Pa,Mn.toPairsIn=Ma,Mn.toPath=function(e){return Hs(e)?Rt(e,Bo):aa(e)?[e]:ki(Io(ga(e)))},Mn.toPlainObject=ma,Mn.transform=function(e,t,n){var r=Hs(e),i=r||$s(e)||la(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qs(e)&&Js(o)?Un(je(e)):{}}return(i?xt:vr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Mn.unary=function(e){return ks(e,1)},Mn.union=es,Mn.unionBy=ts,Mn.unionWith=ns,Mn.uniq=function(e){return e&&e.length?ai(e):[]},Mn.uniqBy=function(e,t){return e&&e.length?ai(e,oo(t,2)):[]},Mn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ai(e,i,t):[]},Mn.unset=function(e,t){return null==e||li(e,t)},Mn.unzip=rs,Mn.unzipWith=is,Mn.update=function(e,t,n){return null==e?e:ci(e,t,_i(n))},Mn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:ci(e,t,_i(n),r)},Mn.values=Ua,Mn.valuesIn=function(e){return null==e?[]:Jt(e,Ra(e))},Mn.without=os,Mn.words=Ja,Mn.wrap=function(e,t){return Bs(_i(t),e)},Mn.xor=ss,Mn.xorBy=as,Mn.xorWith=ls,Mn.zip=cs,Mn.zipObject=function(e,t){return fi(e||[],t||[],Qn)},Mn.zipObjectDeep=function(e,t){return fi(e||[],t||[],Jr)},Mn.zipWith=us,Mn.entries=Pa,Mn.entriesIn=Ma,Mn.extend=ba,Mn.extendWith=ya,sl(Mn,Mn),Mn.add=gl,Mn.attempt=Za,Mn.camelCase=Da,Mn.capitalize=Fa,Mn.ceil=vl,Mn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=_a(n))==n?n:0),t!==i&&(t=(t=_a(t))==t?t:0),or(_a(e),t,n)},Mn.clone=function(e){return sr(e,4)},Mn.cloneDeep=function(e){return sr(e,5)},Mn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:i)},Mn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:i)},Mn.conformsTo=function(e,t){return null==t||ar(e,t,La(t))},Mn.deburr=qa,Mn.defaultTo=function(e,t){return null==e||e!=e?t:e},Mn.divide=bl,Mn.endsWith=function(e,t,n){e=ga(e),t=si(t);var r=e.length,o=n=n===i?r:or(fa(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Mn.eq=Us,Mn.escape=function(e){return(e=ga(e))&&X.test(e)?e.replace(Y,tn):e},Mn.escapeRegExp=function(e){return(e=ga(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Mn.every=function(e,t,n){var r=Hs(e)?At:hr;return n&&go(e,t,n)&&(t=i),r(e,oo(t,3))},Mn.find=_s,Mn.findIndex=qo,Mn.findKey=function(e,t){return Pt(e,oo(t,3),vr)},Mn.findLast=ms,Mn.findLastIndex=Ho,Mn.findLastKey=function(e,t){return Pt(e,oo(t,3),br)},Mn.floor=yl,Mn.forEach=gs,Mn.forEachRight=vs,Mn.forIn=function(e,t){return null==e?e:mr(e,oo(t,3),Ra)},Mn.forInRight=function(e,t){return null==e?e:gr(e,oo(t,3),Ra)},Mn.forOwn=function(e,t){return e&&vr(e,oo(t,3))},Mn.forOwnRight=function(e,t){return e&&br(e,oo(t,3))},Mn.get=xa,Mn.gt=Ds,Mn.gte=Fs,Mn.has=function(e,t){return null!=e&&fo(e,t,xr)},Mn.hasIn=ka,Mn.head=Vo,Mn.identity=nl,Mn.includes=function(e,t,n,r){e=Vs(e)?e:Ua(e),n=n&&!r?fa(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),sa(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},Mn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fa(n);return i<0&&(i=mn(r+i,0)),Ut(e,t,i)},Mn.inRange=function(e,t,n){return t=ha(t),n===i?(n=t,t=0):n=ha(n),function(e,t,n){return e>=gn(t,n)&&e=-9007199254740991&&e<=d},Mn.isSet=oa,Mn.isString=sa,Mn.isSymbol=aa,Mn.isTypedArray=la,Mn.isUndefined=function(e){return e===i},Mn.isWeakMap=function(e){return ea(e)&&ho(e)==L},Mn.isWeakSet=function(e){return ea(e)&&"[object WeakSet]"==Sr(e)},Mn.join=function(e,t){return null==e?"":jt.call(e,t)},Mn.kebabCase=Ha,Mn.last=Go,Mn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=fa(n))<0?mn(r+o,0):gn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Mt(e,Ft,o,!0)},Mn.lowerCase=ja,Mn.lowerFirst=Va,Mn.lt=ca,Mn.lte=ua,Mn.max=function(e){return e&&e.length?fr(e,nl,Er):i},Mn.maxBy=function(e,t){return e&&e.length?fr(e,oo(t,2),Er):i},Mn.mean=function(e){return qt(e,nl)},Mn.meanBy=function(e,t){return qt(e,oo(t,2))},Mn.min=function(e){return e&&e.length?fr(e,nl,Ir):i},Mn.minBy=function(e,t){return e&&e.length?fr(e,oo(t,2),Ir):i},Mn.stubArray=pl,Mn.stubFalse=_l,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=wl,Mn.nth=function(e,t){return e&&e.length?Dr(e,fa(t)):i},Mn.noConflict=function(){return dt._===this&&(dt._=Me),this},Mn.noop=al,Mn.now=xs,Mn.pad=function(e,t,n){e=ga(e);var r=(t=fa(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ft(i),n)+e+Fi(ht(i),n)},Mn.padEnd=function(e,t,n){e=ga(e);var r=(t=fa(t))?un(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=yn();return gn(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return Vr(e,t)},Mn.reduce=function(e,t,n){var r=Hs(e)?Wt:Vt,i=arguments.length<3;return r(e,oo(t,4),n,i,ur)},Mn.reduceRight=function(e,t,n){var r=Hs(e)?zt:Vt,i=arguments.length<3;return r(e,oo(t,4),n,i,dr)},Mn.repeat=function(e,t,n){return t=(n?go(e,t,n):t===i)?1:fa(t),Yr(ga(e),t)},Mn.replace=function(){var e=arguments,t=ga(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mn.result=function(e,t,n){var r=-1,o=(t=mi(t,e)).length;for(o||(o=1,e=i);++rd)return[];var n=f,r=gn(e,f);t=oo(t),e-=f;for(var i=$t(r,t);++n=s)return e;var l=n-un(r);if(l<1)return r;var c=a?vi(a,0,l).join(""):e.slice(0,l);if(o===i)return c+r;if(a&&(l+=c.length-l),ia(o)){if(e.slice(l).search(o)){var u,d=c;for(o.global||(o=xe(o.source,ga(he.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===i?l:h)}}else if(e.indexOf(si(o),l)!=l){var f=c.lastIndexOf(o);f>-1&&(c=c.slice(0,f))}return c+r},Mn.unescape=function(e){return(e=ga(e))&&$.test(e)?e.replace(V,fn):e},Mn.uniqueId=function(e){var t=++ze;return ga(e)+t},Mn.upperCase=Xa,Mn.upperFirst=Ga,Mn.each=gs,Mn.eachRight=vs,Mn.first=Vo,sl(Mn,(ml={},vr(Mn,(function(e,t){We.call(Mn.prototype,t)||(ml[t]=e)})),ml),{chain:!1}),Mn.VERSION="4.17.21",xt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),xt(["drop","take"],(function(e,t){qn.prototype[e]=function(n){n=n===i?1:mn(fa(n),0);var r=this.__filtered__&&!t?new qn(this):this.clone();return r.__filtered__?r.__takeCount__=gn(n,r.__takeCount__):r.__views__.push({size:gn(n,f),type:e+(r.__dir__<0?"Right":"")}),r},qn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),xt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;qn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),xt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");qn.prototype[e]=function(){return this[n](1).value()[0]}})),xt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");qn.prototype[e]=function(){return this.__filtered__?new qn(this):this[n](1)}})),qn.prototype.compact=function(){return this.filter(nl)},qn.prototype.find=function(e){return this.filter(e).head()},qn.prototype.findLast=function(e){return this.reverse().find(e)},qn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new qn(this):this.map((function(n){return Tr(n,e,t)}))})),qn.prototype.reject=function(e){return this.filter(zs(oo(e)))},qn.prototype.slice=function(e,t){e=fa(e);var n=this;return n.__filtered__&&(e>0||t<0)?new qn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=fa(t))<0?n.dropRight(-t):n.take(t-e)),n)},qn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},qn.prototype.toArray=function(){return this.take(f)},vr(qn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Mn[r?"take"+("last"==t?"Right":""):t],s=r||/^find/.test(t);o&&(Mn.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,l=t instanceof qn,c=a[0],u=l||Hs(t),d=function(e){var t=o.apply(Mn,Ot([e],a));return r&&h?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=s&&!h,_=l&&!f;if(!s&&u){t=_?t:new qn(this);var m=e.apply(t,a);return m.__actions__.push({func:hs,args:[d],thisArg:i}),new Fn(m,h)}return p&&_?e.apply(this,a):(m=this.thru(d),p?r?m.value()[0]:m.value():m)})})),xt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Mn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Hs(i)?i:[],e)}return this[n]((function(n){return t.apply(Hs(n)?n:[],e)}))}})),vr(qn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";We.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[Pi(i,2).name]=[{name:"wrapper",func:i}],qn.prototype.clone=function(){var e=new qn(this.__wrapped__);return e.__actions__=ki(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ki(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ki(this.__views__),e},qn.prototype.reverse=function(){if(this.__filtered__){var e=new qn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},qn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Hs(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Mn.prototype.plant=function(e){for(var t,n=this;n instanceof Dn;){var r=Mo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Mn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof qn){var t=e;return this.__actions__.length&&(t=new qn(this)),(t=t.reverse()).__actions__.push({func:hs,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,Ge&&(Mn.prototype[Ge]=function(){return this}),Mn}();dt._=pn,(r=function(){return pn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},752:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=n(249),s=n(96),a=n(288),l=n(208),c=n(467),u=n(391),d=n(544),h=n(980),f=n(66),p=n(774),_=n(964),m=n(320),g=n(717),v=n(485),b=n(452),y=n(77),w=i(n(733)),C=n(486);let S=null;$("#roster-file").on("change",(function(e){let t,n;if(t="resize"===(null==e?void 0:e.type)?null==S?void 0:S.target:null==e?void 0:e.target,n=null==t?void 0:t.files,$("#roster-title").empty(),$("#roster-lists").empty(),$("#force-units").empty(),n){"resize"!==(null==e?void 0:e.type)&&(S=e);const t=new FileReader;t.onerror=()=>{t.abort(),(0,C.reject)(new DOMException("Failed to read roster file."))},t.onloadend=()=>r(this,void 0,void 0,(function*(){const e=t.result;var n;!function(e){const t=(new DOMParser).parseFromString(e,"text/xml");if(!t)return;const n=t.querySelector("roster");if(!n)return;const r=n.getAttribute("gameSystemName");if(!r)return;const i=n.getAttribute("name");i&&(document.title=`PrettyScribe ${i}`);const w=$("#roster-title")[0],C=$("#roster-lists")[0],S=$("#force-units")[0];if("Warhammer 40,000 8th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000 9th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000: Kill Team (2018)"==r){const e=(0,a.Create40kRoster)(t,!1);e&&e._forces.length>0&&new c.Renderer40k(e).render(w,C,S)}else if("Warhammer 40,000: Kill Team (2021)"==r){const e=(0,o.CreateKT21Roster)(t);e&&e._forces.length>0&&new s.RendererKT21(e).render(w,C,S)}else if("Age of Sigmar"==r){const e=(0,p.CreateAoSRoster)(t);e&&new _.RendererAoS(e).render(w,C,S)}else if("Warhammer Age of Sigmar: Warcry"==r){const e=(0,m.CreateWarcryRoster)(t);e&&new g.RendererWarcry(e).render(w,C,S)}else if("Warhammer 30,000 - The Horus Heresy"==r){const e=(0,u.Create30kRoster)(t);e&&e._forces.length>0&&new d.Renderer30k(e).render(w,C,S)}else if(r.includes("Horus Heresy (2022)")){const e=h.HorusHeresy.CreateRoster(t);e&&e._forces.length>0&&new f.RendererHH2(e).render(w,C,S)}else if("Warhammer 40,000 10th Edition"==r){const e=l.Wh40k.CreateRoster(t);e&&e._forces.length>0&&new v.Wh40kRenderer(e).render(w,C,S)}else if("Middle-Earth Strategy Battle Game"===r){const e=(0,b.CreateMESBGRoster)(t);null!==e&&(console.log(e),(0,y.renderMESBG)(e,w,C,S))}else $("#errorText").html("PrettyScribe does not support game type '"+r+"'."),$("#errorDialog").modal("show")}(yield(n=e,r(void 0,void 0,void 0,(function*(){if("P"!==n.charAt(0))return n;{const e=new w.default;return(yield e.loadAsync(n)).file(/[^/]+\.ros/)[0].async("string")}}))))})),t.readAsBinaryString(n[0])}})),document.addEventListener("DOMContentLoaded",(()=>{if(navigator.userAgent.match(/AppleWebKit.*Safari/)&&!navigator.userAgent.includes("Chrome")){const e=document.querySelector('input[type="file"');null==e||e.removeAttribute("accept")}}))},419:(e,t)=>{"use strict";var n,r;function i(e,t,i,o,s,a,l,c){if(e&&t.length){e.textBaseline="top";let u=e.measureText(t);const d=u.width,h=u.actualBoundingBoxDescent-u.actualBoundingBoxAscent;let f=o;c==r.Top?f=o:c==r.Bottom?f=o+a-h:c==r.Center&&(f=o+(a-h)/2),l==n.Center?e.fillText(t,i+Math.max((s-d)/2,0),f,s):l==n.Left?e.fillText(t,i,f,s):l==n.Right&&e.fillText(t,i+s-d,f,s)}}Object.defineProperty(t,"__esModule",{value:!0}),t.FixDPI=t.RenderParagraph=t.RenderText=t.RenderTextFull=t.VertAlign=t.Justification=void 0,function(e){e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Center=2]="Center"}(n=t.Justification||(t.Justification={})),function(e){e[e.Top=0]="Top",e[e.Bottom=1]="Bottom",e[e.Center=2]="Center"}(r=t.VertAlign||(t.VertAlign={})),t.RenderTextFull=i,t.RenderText=function(e,t,n,o,s,a,l){i(e,t,n,o,s,a,l,r.Center)},t.RenderParagraph=function(e,t,n,r,i,o){let s=r;if(e&&t.length){let r=[],a=[];e.textBaseline="top";let l=0;const c=e.measureText(" ").width,u=e.measureText(t),d=1.2*(u.actualBoundingBoxDescent-u.actualBoundingBoxAscent);let h=i-o;t.split(" ").forEach((function(t){const n=e.measureText(t);l+n.width>h&&(r.push(a.join(" ")),h=i,a.length=0,l=0),l+=n.width+c,a.push(t)})),a.length>0&&r.push(a.join(" "));let f=n+o;for(let t of r)e.fillText(t,f,s),f=n,s+=d}return s},t.FixDPI=function(e){let t=window.devicePixelRatio,n=+getComputedStyle(e).getPropertyValue("height").slice(0,-2),r=+getComputedStyle(e).getPropertyValue("width").slice(0,-2);0==n&&(n=e.height),0==r&&(r=e.width),e.setAttribute("height",(n*t).toString()),e.setAttribute("width",(r*t).toString())}},544:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer30k=void 0;const r=n(391),i=n(419);class o{constructor(e){this._descriptionStartX=190,this._descriptionWidth=600,this._showWoundBoxes=!1,this._roster=null,this._currentX=0,this._currentY=0,this._maxWidth=0,this._octagon=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.3,.077,.077,.077,.077,.077,.077,.077,.077,.077],this._vehicleLabelWidthsNormalized=[.3,.1,.1,.1,.1,.1,.2],this._walkerLabelWidthsNormalized=[.3,.06,.06,.06,.06,.06,.06,.06,.06,.06,.15],this._flyerLabelWidthsNormalized=[.3,.077,.077,.077,.077,.077,.077,.077,.077,.077],this._weaponLabelWidthNormalized=[.3,.1,.1,.1,.4],this._spellLabelWidthNormalized=[.3,.1,.1,.5],this._roster=e,this._octagon=document.getElementById("octagon"),this._roles.set(r.UnitRole30k.HQ,document.getElementById("role_hq")),this._roles.set(r.UnitRole30k.TR,document.getElementById("role_tr")),this._roles.set(r.UnitRole30k.EL,document.getElementById("role_el")),this._roles.set(r.UnitRole30k.FA,document.getElementById("role_fa")),this._roles.set(r.UnitRole30k.HS,document.getElementById("role_hs")),this._roles.set(r.UnitRole30k.FL,document.getElementById("role_fl")),this._roles.set(r.UnitRole30k.DT,document.getElementById("role_dt")),this._roles.set(r.UnitRole30k.FT,document.getElementById("role_ft")),this._roles.set(r.UnitRole30k.LW,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){e&&(e.innerHTML="

"+this._roster._name+" ("+this._roster._points+" pts)

");for(let e of this._roster._forces){const s=document.createElement("div");s&&(s.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(s);const a=document.createElement("table");a.classList.add("table"),a.classList.add("table-sm"),a.classList.add("table-striped");const l=document.createElement("thead");a.appendChild(l),l.classList.add("thead-light");const c=document.createElement("tr");l.appendChild(c),[{name:"NAME",w:"25%"},{name:"ROLE",w:"20%"},{name:"MODELS",w:"40%"},{name:"POINTS",w:"15%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,c.appendChild(t)})),s.appendChild(a);let u=document.createElement("tbody");a.appendChild(u);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name;let i=document.createElement("td");i.innerHTML=r.UnitRoleToString30k[t._role];let o=document.createElement("td");o.innerHTML="";let s=0;for(const e of t._models)e._count>1?o.innerHTML+=e._count+" "+e._name:o.innerHTML+=e._name,s++,s!=t._models.length&&(o.innerHTML+=", ");let a=document.createElement("td");a.innerHTML=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),e.appendChild(a),u.appendChild(e)}if(e._rules.size>0){let t=document.createElement("div"),r=document.createElement("h3");t.appendChild(r),r.textContent=e._catalog+" Allegiance Rules";for(let n of e._rules){let e=document.createElement("div"),r=document.createElement("h4");r.textContent=n[0];let i=document.createElement("p");i.textContent=n[1],e.appendChild(r),e.appendChild(i),t.appendChild(e)}n&&n.appendChild(t)}for(let t of e._units){let e=document.createElement("canvas");e.width=7.5*o._res,e.height=20*o._res,this._descriptionWidth=e.width-this._descriptionStartX-10,(0,i.FixDPI)(e);const r=this.renderUnit(t,e,0,0),s=25;let a=document.createElement("canvas");a.width=r[0]+2*s,a.height=r[1]+2*s;let l=a.getContext("2d");if(null==l||l.drawImage(e,s,s),n){let e=document.createElement("div");e.appendChild(a),n.appendChild(e)}}}}}renderBorder(e,t,n,r,i){e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.stroke(),e.save(),e.fillStyle=o._fillColor,e.globalCompositeOperation="destination-over",e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.fill(),e.restore()}renderWatermark(e){}renderLine(e){e.lineWidth=2,e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(this._currentX,this._currentY),e.lineTo(this._currentX+this._maxWidth,this._currentY),e.stroke(),this._currentY+=1}renderTableHeader(e,t,n){let r=this._currentX;const s=this._maxWidth;e.fillStyle=o._grey1,e.fillRect(this._currentX,this._currentY,s,22),e.fillStyle=o._blackColor,e.font=o._titleFont;var a=50;if(t){e.font=o._headerFont;for(let o=0;o1?n+=e._count+" "+e._name:n+=e._name,r++,r!=t.length&&(n+=", ");this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,n,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2}renderWoundBoxes(e,t){e.font=o._titleFont,(0,i.RenderText)(e,"WOUNDS",this._currentX+20,this._currentY,100,16,i.Justification.Left);const n=this._currentX+this._descriptionStartX,r=n+195;e.save();for(let s of t)if(s._wounds>1){let t=this._currentY;e.font=o._font,e.fillStyle=o._blackColor,this._currentY=(0,i.RenderParagraph)(e,s._name,n,this._currentY+3,195,0);let a=this._currentX+r;e.strokeStyle=o._blackColor,e.fillStyle="#ffffff";for(let n=0;n{u.push(e*this._maxWidth)}));const d=[];this._vehicleLabelWidthsNormalized.forEach((e=>{d.push(e*this._maxWidth)}));const h=[];this._walkerLabelWidthsNormalized.forEach((e=>{h.push(e*this._maxWidth)}));const f=[];for(var p of(this._flyerLabelWidthsNormalized.forEach((e=>{f.push(e*this._maxWidth)})),e._models)){c.push(p);for(let e of p._weapons)s.push(e);for(let e of p._psychicPowers)a.push(e);p._psyker&&l.push(p._psyker)}const _=[],m=new Map;for(const e of c)m.has(e._name)||(m.set(e._name,e),_.push(e));if(_.length>0){this.renderTableHeader(i,o._unitLabels,u);let e=0;for(var p of _)this.renderModel(i,p,u,e%2),e++}if(e._vehicles.length>0){this.renderTableHeader(i,o._vehicleLabels,d);let t=0;for(var g of e._vehicles)this.renderVehicle(i,g,d,t%2),t++}if(e._walkers.length>0){this.renderTableHeader(i,o._walkerLabels,h);let t=0;for(var v of e._walkers)this.renderWalker(i,v,h,t%2),t++}if(e._flyers.length>0){this.renderTableHeader(i,o._flyerLabels,f);let t=0;for(var b of e._flyers)this.renderFlyer(i,b,f,t%2),t++}const y=[],w=new Map;for(const e of s)w.has(e._name)||(w.set(e._name,e),y.push(e));if(y.length>0){const e=[];this._weaponLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._weaponLabels,e),this.renderWeapons(i,y,e)}if(a.length>0){const e=[];this._spellLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._spellLabels,e),this.renderPowers(i,a,e)}if(e._abilities.size>0&&(this.renderLine(i),this._currentY+=2,this.renderAbilities(i,e)),l.length>0&&(this.renderLine(i),this._currentY+=2,this.renderPsykers(i,l)),e._rules.size>0&&(this.renderLine(i),this._currentY+=2,this.renderRules(i,e)),e._factions.size>0&&(this.renderLine(i),this._currentY+=2,this.renderFactions(i,e)),e._keywords.size>0&&(this.renderLine(i),this._currentY+=2,this.renderKeywords(i,e)),e._models.length>0&&(this.renderLine(i),this._currentY+=2,this.renderModelList(i,_)),this._showWoundBoxes){let t=!1;for(let n of e._models)n._wounds>2&&(t=!0);t&&(this.renderLine(i),this._currentY+=5,this.renderWoundBoxes(i,e._models))}this._currentY+=2;const C=this._currentY-(r+o._margin),S=this._maxWidth;return this.renderBorder(i,this._currentX,r+o._margin,S,C),this.renderWatermark(i),[this._maxWidth,this._currentY]}renderHeader(e,t){t.globalAlpha=1,t.fillStyle=o._blackColor;const n=this._currentX,r=this._currentX+this._maxWidth,s=this._currentY,a=s+36;t.beginPath(),t.moveTo(n,s+o._bevelSize),t.lineTo(n,a),t.lineTo(r,a),t.lineTo(r,s+o._bevelSize),t.lineTo(r-o._bevelSize,s),t.lineTo(n+o._bevelSize,s),t.closePath(),t.fill();let l=n+6;if(this._octagon){t.drawImage(this._octagon,l,s+2,32,32);const n=this._roles.get(e._role);n&&t.drawImage(n,l+4,s+2+4,24,24),t.fillStyle="white",t.font="18px serif",l+=34,t.drawImage(this._octagon,l,s+2,32,32),(0,i.RenderText)(t,e._points.toString(),l,s+2,32,32,i.Justification.Center)}let c=0,u=28;const d=l+6;t.font=u+"px bold serif";const h=e._name.toLocaleUpperCase();let f=t.measureText(h);const p=this._maxWidth-d;for(;c<6&&f.width>p;)c+=1,u-=2,t.font=u+"px bold serif",f=t.measureText(h);t.fillStyle="white",t.textBaseline="top",(0,i.RenderText)(t,h,d,s,p,36,i.Justification.Center),this._currentY+=36}renderPsykers(e,t){e.font=o._titleFont,(0,i.RenderText)(e,"PSYKERS",this._currentX+20,this._currentY,100,16,i.Justification.Left),e.font=o._font,this._currentY+=2;for(let n of t)this._currentY=(0,i.RenderParagraph)(e,"MASTERY LEVEL: "+n._masteryLevel,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,"DISCIPLINES: "+n._disciplines,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,0),this._currentY+=2}}t.Renderer30k=o,o._res=144,o._margin=0,o._bevelSize=15,o._blackColor="#1d272a",o._grey1="#b3bbb5",o._greyLight="#dde1df",o._fillColor="#f6f6f6",o._titleFont="bold 14px sans-serif",o._headerFont="bold 14px sans-serif",o._font="14px sans-serif",o._boldFont="bold 14px sans-serif",o._unitLabels=["MODEL","WS","BS","S","T","W","I","A","LD","SAVE"],o._vehicleLabels=["MODEL","BS","FRONT","SIDE","REAR","HP","TYPE"],o._walkerLabels=["MODEL","WS","BS","S","FRONT","SIDE","REAR","I","A","HP","TYPE"],o._flyerLabels=["MODEL","BS","FRONT","SIDE","REAR","HP","TYPE","ROLE","PURSUIT","AGILITY"],o._weaponLabels=["WEAPONS","RANGE","S","AP","TYPE"],o._spellLabels=["PSYCHIC POWER","WARP CHARGE","RANGE","DETAILS"]},467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer40k=void 0;const r=n(288);class i{constructor(e){this._roster=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.25,.05,.05,.05,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.25,.05,.1,.05,.05,.05,.45],this._spellLabelWidthNormalized=[.25,.05,.1,.6],this._explosionLabelWidthNormalized=[.2,.1,.1,.15],this._trackerLabelWidth=[.2,.15,.1,.1,.1],this._roster=e,this._roles.set(r.UnitRole.HQ,document.getElementById("role_hq")),this._roles.set(r.UnitRole.TR,document.getElementById("role_tr")),this._roles.set(r.UnitRole.EL,document.getElementById("role_el")),this._roles.set(r.UnitRole.FA,document.getElementById("role_fa")),this._roles.set(r.UnitRole.HS,document.getElementById("role_hs")),this._roles.set(r.UnitRole.FL,document.getElementById("role_fl")),this._roles.set(r.UnitRole.DT,document.getElementById("role_dt")),this._roles.set(r.UnitRole.FT,document.getElementById("role_ft")),this._roles.set(r.UnitRole.LW,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`,`${this._roster._cost._powerLevel} PL`,`${this._roster._cost._commandPoints} CP`];for(const e in this._roster._cost._freeformValues)t.push(`${this._roster._cost._freeformValues[e]}${e}`);const n=`${this._roster.name()} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n)),this._roster._customNotes&&e.appendChild(document.createElement("p")).appendChild(document.createTextNode(this._roster._customNotes))}t&&(this.renderRosterSummary(t),this.renderAbilitiesByPhase(t)),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(!this._roster)return;const t=this._roster._forces.some((e=>e._units.some((e=>0!==e._cost._commandPoints))));for(const n of this._roster._forces){const i=document.createElement("div");if(n._faction?i.appendChild(document.createTextNode(`${n._catalog} ${n.name()} (${n._faction})`)):i.appendChild(document.createTextNode(`${n._catalog} ${n.name()}`)),n._configurations.length>0){const e=i.appendChild(document.createElement("ul"));for(const t of n._configurations)e.appendChild(document.createElement("li")).appendChild(document.createElement("i")).appendChild(document.createTextNode(t))}e.appendChild(i);const o=document.createElement("table");o.classList.add("table","table-sm","table-striped");const s=document.createElement("thead");o.appendChild(s),s.classList.add("thead-light");const a=document.createElement("tr");s.appendChild(a);const l=[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"},{name:"POWER",w:"5%"}];t&&l.push({name:"CP",w:"5%"}),l.forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,a.appendChild(t)})),i.appendChild(o);let c=document.createElement("tbody");o.appendChild(c);for(let e of n._units){const n=document.createElement("tr");n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e.nameWithExtraCosts())),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.UnitRoleToString[e._role]));const i=n.appendChild(document.createElement("td"));if(this.renderModelList(i,e),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._points.toString())),n.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._powerLevel.toString())),t){const t=(e._cost._commandPoints||"")+"";n.appendChild(document.createElement("td")).appendChild(document.createTextNode(t))}c.appendChild(n)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showPhaseAbilities","Show abilities by phase",(e=>{const t=document.getElementById("wh40k_abilities_list");t&&(e.target.checked?t.classList.remove("d-none"):t.classList.add("d-none"))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",c)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",c))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;t0&&s.appendChild(document.createTextNode(a.substring(0,c)));const u=t[l]=t[l]||[],d=n[l]=n[l]||[];d.includes(i)||(d.push(i),u.push(s)),s.appendChild(document.createElement("u")).appendChild(document.createTextNode(r[0]));const h=c+e.length;a=a.substring(h)}a.length>0&&s.appendChild(document.createTextNode(a))}const r=e.appendChild(document.createElement("div"));r.setAttribute("id","wh40k_abilities_list"),r.classList.add("d-none"),r.appendChild(document.createElement("h3")).appendChild(document.createTextNode("Abilities by Phase"));const i=["pre-game phase","command phase","movement phase","psychic phase","shooting phase","charge phase","fight phase","morale phase"].filter((e=>!!t[e]));if(0===i.length)r.appendChild(document.createTextNode("No phase-specific abilities in roster"));else for(const e of i){r.appendChild(document.createElement("h4")).appendChild(document.createTextNode(e));for(const n of t[e])r.appendChild(n.parentElement?n.cloneNode(!0):n)}}renderRosterDetails(e){if(!this._roster)return;const t=new Map,n=new Map,i=e.appendChild(document.createElement("div"));i.id="detachment_sheets";const s=e.appendChild(document.createElement("div"));s.id="collated_sheets",s.style.pageBreakBefore="always",s.classList.add("d-none");const a=[];for(const e of this._roster._forces){const r=document.createElement("div");if(r.style.pageBreakBefore="always",r){const t=document.createElement("p");t.appendChild(document.createTextNode(e._catalog)),e._faction&&t.appendChild(document.createTextNode(" ("+e._faction+")")),r.appendChild(t)}let s=document.createElement("h3");s.appendChild(r),i.appendChild(s),this.renderDatasheets(i,e._units),a.push(...e._units),o(t,e._catalog,e._rules),o(n,e._faction,e._factionRules)}a.sort(((e,t)=>e._role!=t._role?e._role-t._role:e._name!=t._name?(0,r.Compare)(e._name,t._name):e._cost._points-t._cost._points)),this.renderDatasheets(s,a);let l=document.createElement("div");l.style.pageBreakBefore="always",this.printRules(t,l),this.printRules(n,l),e.appendChild(l)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),h],[.1,.8,.1]));const f=c.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=f.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let p=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(s(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);p&&l.appendChild(p),c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._unitLabels,this._unitLabelWidthsNormalized,!0));let _=l.appendChild(document.createElement("tbody"));_.append(document.createElement("tr"));for(const e of t._modelStats)_.append(s([e._name,e._move,e._ws,e._bs,e._str.toString(),e._toughness.toString(),e._wounds.toString(),e._attacks.toString(),e._leadership.toString(),e._save],this._unitLabelWidthsNormalized));if(p=a("Model notes",t._modelStats),p&&l.appendChild(p),t._woundTracker.length>0){const e=Array.from(i._trackerLabels);if(4==t._woundTracker.length){const n=Array.from(t._woundTracker[0]._table.values());e.splice(1,n.length,...n)}else if(3==t._woundTracker.length){const n=Array.from(t._woundTracker[0]._table.keys());e.splice(1,n.length,...n)}c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(e,this._trackerLabelWidth,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._woundTracker)_.appendChild(s([""].concat(Array.from(e._table.values())),this._trackerLabelWidth))}if(t._weapons.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._weaponLabels,this._weaponLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._weapons)_.append(s([e.name().toString(),e._range,e._type,e._str.toString(),e._ap,e._damage,e._abilities],this._weaponLabelWidthNormalized))}if(p=a("Weapon notes",t._weapons),p&&l.appendChild(p),t._spells.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._spellLabels,this._spellLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._spells)_.append(s([e.name(),e._manifest.toString(),e._range,e._details],this._spellLabelWidthNormalized))}if(p=a("Spell notes",t._spells),p&&l.appendChild(p),t._psykers.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const e=document.createElement("div");for(const n of t._psykers){let t=`CAST: ${n._cast}, DENY: ${n._deny}, POWERS KNOWN: ${n._powers}`;n._other&&(t+=`, OTHER: ${n._other}`),e.appendChild(document.createElement("div")).appendChild(document.createTextNode(t))}c.appendChild(s(["Psykers",e],[.1,.9],!1))}p=a("Psyker notes",t._psykers),p&&l.appendChild(p),!t._abilities.Abilities&&t._rules.size>0&&this.renderUnitAbilitiesAndRules(l,"Abilities",new Map,t._rules);for(const e of Object.keys(t._abilities).sort()){const n=t._abilities[e],r="Abilities"===e?t._rules:void 0;this.renderUnitAbilitiesAndRules(l,e,n,r)}c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const m=Array.from(t._factions).sort(r.Compare).join(", ").toLocaleUpperCase();c.appendChild(s(["Factions",m],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const g=Array.from(t._keywords).sort(r.Compare).join(", ").toLocaleUpperCase();c.appendChild(s(["Keywords",g],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const v=document.createElement("div");if(this.renderModelList(v,t),c.appendChild(s(["MODELS",v],[.1,.9],!1)),t._explosions.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(s(i._explosionLabels,this._explosionLabelWidthNormalized,!0)),_=l.appendChild(document.createElement("tbody")),_.append(document.createElement("tr"));for(const e of t._explosions)_.append(s([e.name(),e._diceRoll,e._distance,e._mortalWounds],this._explosionLabelWidthNormalized))}p=a("Explosion notes",t._explosions),p&&l.appendChild(p)}renderUnitAbilitiesAndRules(e,t,n,i){const o=e.appendChild(document.createElement("thead"));o.classList.add("info_row");const a=document.createElement("div");if(i&&i.size>0){const e=Array.from(i.keys()).sort(r.Compare).join(", ");a.appendChild(document.createElement("div")).appendChild(document.createElement("b")).appendChild(document.createTextNode(e))}const c=Array.from(n.keys()).sort(r.Compare);for(const e of c){const t=l(a.appendChild(document.createElement("div")));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.toUpperCase()}: `)),t.appendChild(document.createTextNode(n.get(e)||"??"))}o.appendChild(s([t,a],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n.name()));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=l(document.createElement("div")),r=document.createElement("b");r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n){0!==n.size&&e.set(t,new Map([...e.get(t)||[],...n]))}function s(e,t,n=!1){const r=l(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;ie._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(s([e,r],[.1,.9],!1)),n}function l(e){return e.classList.add("hide_able"),e}function c(e){let t=e.target;t&&(t=t.closest(".hide_able")),t&&(t.classList.contains("hidden")?t.classList.remove("hidden"):t.classList.add("hidden"))}t.Renderer40k=i,i._unitLabels=["MODEL","M","WS","BS","S","T","W","A","LD","SAVE"],i._weaponLabels=["WEAPONS","RANGE","TYPE","S","AP","D","ABILITIES"],i._spellLabels=["PSYCHIC POWER","MANIFEST","RANGE","DETAILS"],i._explosionLabels=["EXPLOSION","DICE ROLL","DISTANCE","MORTAL WOUNDS"],i._trackerLabels=["WOUND TRACK","REMAINING W","ATTRIBUTE","ATTRIBUTE","ATTRIBUTE"]},485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Wh40kRenderer=void 0;const r=n(208);class i{constructor(e){this._roster=null,this._roles=new Map,this._unitLabelWidthsNormalized=[.4,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.3,.1,.1,.05,.05,.05,.05,.3],this._roster=e,this._roles.set(r.Wh40k.UnitRole.EpicHero,document.getElementById("role_hq")),this._roles.set(r.Wh40k.UnitRole.Character,document.getElementById("role_hq")),this._roles.set(r.Wh40k.UnitRole.Battleline,document.getElementById("role_tr")),this._roles.set(r.Wh40k.UnitRole.Infantry,document.getElementById("role_el")),this._roles.set(r.Wh40k.UnitRole.Vehicle,document.getElementById("role_hs")),this._roles.set(r.Wh40k.UnitRole.Mounted,document.getElementById("role_fa")),this._roles.set(r.Wh40k.UnitRole.Transport,document.getElementById("role_dt")),this._roles.set(r.Wh40k.UnitRole.Fortification,document.getElementById("role_ft"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`];for(const e in this._roster._cost._freeformValues)t.push(`${this._roster._cost._freeformValues[e]}${e}`);const n=`${this._roster.name()} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n)),this._roster._customNotes&&e.appendChild(document.createElement("p")).appendChild(document.createTextNode(this._roster._customNotes))}t&&(this.renderRosterSummary(t),this.renderAbilitiesByPhase(t)),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(this._roster)for(const t of this._roster._forces){const n=document.createElement("div");if(t._faction?n.appendChild(document.createTextNode(`${t._catalog} ${t.name()} (${t._faction})`)):n.appendChild(document.createTextNode(`${t._catalog} ${t.name()}`)),t._configurations.length>0){const e=n.appendChild(document.createElement("ul"));for(const n of t._configurations)e.appendChild(document.createElement("li")).appendChild(document.createElement("i")).appendChild(document.createTextNode(n))}e.appendChild(n);const i=document.createElement("table");i.classList.add("table","table-sm","table-striped");const o=document.createElement("thead");i.appendChild(o),o.classList.add("thead-light");const s=document.createElement("tr");o.appendChild(s),[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,s.appendChild(t)})),n.appendChild(i);let a=document.createElement("tbody");i.appendChild(a);for(let e of t._units){const t=document.createElement("tr");t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e.nameWithExtraCosts())),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.Wh40k.UnitRoleToString[e._role]));const n=t.appendChild(document.createElement("td"));this.renderModelList(n,e),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._cost._points.toString())),a.appendChild(t)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showPhaseAbilities","Show abilities by phase",(e=>{const t=document.getElementById("wh40k_abilities_list");t&&(e.target.checked?t.classList.remove("d-none"):t.classList.add("d-none"))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",l)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",l))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;t0&&s.appendChild(document.createTextNode(l.substring(0,c)));const u=t[a]=t[a]||[],d=n[a]=n[a]||[];d.includes(i)||(d.push(i),u.push(s)),s.appendChild(document.createElement("u")).appendChild(document.createTextNode(r[0]));const h=c+e.length;l=l.substring(h)}l.length>0&&s.appendChild(document.createTextNode(l))}const r=e.appendChild(document.createElement("div"));r.setAttribute("id","wh40k_abilities_list"),r.classList.add("d-none"),r.appendChild(document.createElement("h3")).appendChild(document.createTextNode("Abilities by Phase"));const i=["pre-game phase","command phase","movement phase","psychic phase","shooting phase","charge phase","fight phase","morale phase"].filter((e=>!!t[e]));if(0===i.length)r.appendChild(document.createTextNode("No phase-specific abilities in roster"));else for(const e of i){r.appendChild(document.createElement("h4")).appendChild(document.createTextNode(e));for(const n of t[e])r.appendChild(n.parentElement?n.cloneNode(!0):n)}}renderRosterDetails(e){if(!this._roster)return;const t=new Map,n=new Map,i=e.appendChild(document.createElement("div"));i.id="detachment_sheets";const s=e.appendChild(document.createElement("div"));s.id="collated_sheets",s.style.pageBreakBefore="always",s.classList.add("d-none");const a=[];for(const e of this._roster._forces){const r=document.createElement("div");if(r.style.pageBreakBefore="always",r){const t=document.createElement("p");t.appendChild(document.createTextNode(e._catalog)),e._faction&&t.appendChild(document.createTextNode(" ("+e._faction+")")),r.appendChild(t)}let s=document.createElement("h3");s.appendChild(r),i.appendChild(s),this.renderDatasheets(i,e._units),a.push(...e._units),o(t,e._catalog,e._rules),o(n,e._faction,e._factionRules)}a.sort(((e,t)=>e._role!=t._role?e._role-t._role:e._name!=t._name?r.Wh40k.Compare(e._name,t._name):e._cost._points-t._cost._points)),this.renderDatasheets(s,a);let l=document.createElement("div");l.style.pageBreakBefore="always",this.printRules(t,l),this.printRules(n,l),e.appendChild(l)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),""],[.1,.8,.1]));const u=a.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=u.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let d=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(s(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);d&&o.appendChild(d);const h=Object.keys(t._profileTables).sort(r.Wh40k.CompareProfileTableName);for(const e of h){const n=t._profileTables[e],r="Unit"===e?this._unitLabelWidthsNormalized:this._weaponLabelWidthNormalized;this.renderSubTable(o,n._headers,n._contents,r,"Notes",[n])}!t._abilities.Abilities&&t._rules.size>0&&this.renderUnitAbilitiesAndRules(o,"Abilities",new Map,t._rules);for(const e of Object.keys(t._abilities).sort()){const n=t._abilities[e],r="Abilities"===e?t._rules:void 0;this.renderUnitAbilitiesAndRules(o,e,n,r)}a=o.appendChild(document.createElement("thead")),a.classList.add("info_row","keywords_row");const f=Array.from(t._keywords).sort(r.Wh40k.Compare).join(", ").toLocaleUpperCase(),p=Array.from(t._factions).sort(r.Wh40k.Compare).join(", ").toLocaleUpperCase();a.appendChild(s(["Keywords",f,"Factions",p],[.1,.6,.1,.2],!1)),a=o.appendChild(document.createElement("thead")),a.classList.add("info_row");const _=document.createElement("div");this.renderModelList(_,t),a.appendChild(s(["MODELS",_],[.1,.9],!1))}renderSubTable(e,t,n,r,i,o){const a=e.appendChild(document.createElement("thead"));a.classList.add("table-active"),a.appendChild(s(t,r,!0));let l=e.appendChild(document.createElement("tbody"));l.append(document.createElement("tr"));for(const e of n)l.append(s(e,r));const c=function(e,t){if(!t.some((e=>e._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(s([e,r],[.1,.9],!1)),n}(i,o);c&&e.appendChild(c)}renderUnitAbilitiesAndRules(e,t,n,i){const o=e.appendChild(document.createElement("thead"));o.classList.add("info_row");const l=document.createElement("div");if(i&&i.size>0){const e=Array.from(i.keys()).sort(r.Wh40k.Compare).join(", ");l.appendChild(document.createElement("div")).appendChild(document.createElement("b")).appendChild(document.createTextNode(e))}const c=Array.from(n.keys()).sort(r.Wh40k.Compare);for(const e of c){const t=a(l.appendChild(document.createElement("div")));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.toUpperCase()}: `)),t.appendChild(document.createTextNode(n.get(e)||"??"))}o.appendChild(s([t,l],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n.name()));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=a(document.createElement("div")),r=document.createElement("b");r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n){0!==n.size&&e.set(t,new Map([...e.get(t)||[],...n]))}function s(e,t,n=!1){const r=a(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererAoS=void 0;const r=n(774);t.RendererAoS=class{constructor(e){this._roster=null,this._roster=e}render(e,t,n){if(null!=this._roster){if(e){e.innerHTML="

"+this._roster._name.toUpperCase()+" ("+this._roster._points+" pts, "+this._roster._commandPoints+" CP)

";let t=document.createElement("h3");t.textContent="ROSTER",e.appendChild(t)}for(let e of this._roster._forces){const i=document.createElement("div");i&&(i.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(i);const o=[{name:"NAME",width:"35%"},{name:"ROLE",width:"15%"},{name:"SELECTIONS",width:"40%"},{name:"POINTS",width:"10%"}],s=this.createTable(o);s.classList.add("table","table-sm","aos_font"),i.appendChild(s);let a=document.createElement("tbody");s.appendChild(a);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=`${t._name}`;let i=document.createElement("td");i.innerHTML=r.AoSUnitRoleToString[t._role];let o=document.createElement("td");o.innerHTML="";for(const e of t._selections)o.innerHTML+=e+"
";let s=document.createElement("td");s.textContent=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),e.appendChild(s),a.appendChild(e)}let l=document.createElement("div"),c=document.createElement("h3");if(c.textContent=e._allegiance._name.toUpperCase(),l.appendChild(c),e._allegiance._commandAbilities.size>0&&this.renderAbilityMap(l,"ABILITIES",e._allegiance._commandAbilities),e._allegiance._battleTraits.size>0&&this.renderAbilityMap(l,"BATTLE TRAITS",e._allegiance._battleTraits),e._allegiance._spells.length>0){let t=document.createElement("h4");t.textContent="ALLEGIANCE SPELLS",l.append(t),this.renderSpells(l,e._allegiance._spells)}if(e._allegiance._extraProfiles.length>0){let t="";for(let n of e._allegiance._extraProfiles)if(1==n._value._fields.size){if(t!=n._value._typeName){let e=document.createElement("h4");l.appendChild(e),e.textContent=n._value._typeName.toUpperCase(),t=n._value._typeName}const e=n._value._fields.values();let r=document.createElement("p");r.classList.add("aos_font"),r.innerHTML=`${n._name}: ${e.next().value}`,l.appendChild(r)}else console.log("Table profiles not implemented. "+n._value._typeName)}if(e._grandStrategy&&""!=e._grandStrategy._name){let t=document.createElement("h3");l.appendChild(t),t.textContent="GRAND STRATEGY";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=e._grandStrategy._name;let i=document.createElement("p");i.textContent=e._grandStrategy._description,n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._triumph&&""!=e._triumph._name){let t=document.createElement("h3");l.appendChild(t),t.textContent="TRIUMPH";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=e._triumph._name;let i=document.createElement("p");i.textContent=e._triumph._description,n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._realmOfBattle&&e._realmOfBattle._name.length>0){let t=document.createElement("h3");if(l.appendChild(t),t.textContent="REALM OF BATTLE ("+e._realmOfBattle._name+")",e._realmOfBattle._spells.length>0){let t=document.createElement("h4");t.textContent="SPELLS",l.append(t),this.renderSpells(l,e._realmOfBattle._spells)}if(e._realmOfBattle._commandAbilities.size>0&&this.renderAbilityMap(l,"COMMAND ABILITIES",e._realmOfBattle._commandAbilities),e._realmOfBattle._rules.length>0){let t=document.createElement("h4");t.textContent="SPECIAL RULES",l.append(t);for(let t of e._realmOfBattle._rules){let e=document.createElement("div"),n=document.createElement("p");n.textContent=t._name+": "+t._description,e.appendChild(n),l.appendChild(e)}}}for(let t of e._rules){let e=document.createElement("h3");l.appendChild(e),e.textContent="RULES";let n=document.createElement("div"),r=document.createElement("h4");r.textContent=t[0];let i=document.createElement("p");i.textContent=t[1],n.appendChild(r),n.appendChild(i),l.appendChild(n)}if(e._battleTactics.size>0){let t=document.createElement("h3");t.textContent="BATTLE TACTICS",l.appendChild(t);const n=[{name:"NAME",width:"20%"},{name:"DESCRIPTION",width:"80%"}],r=this.createTable(n);r.classList.add("table","table-sm","aos_table","aos_font");let i=document.createElement("tbody");r.appendChild(i);for(let t of e._battleTactics){let e=document.createElement("tr"),n=document.createElement("td");n.textContent=t[0];let r=document.createElement("td");r.textContent=t[1],e.appendChild(n),e.appendChild(r),i.appendChild(e)}l.appendChild(r)}for(let t of e._battalions){let e=document.createElement("h3");l.appendChild(e),e.textContent=t._name.toUpperCase();for(let e of t._abilities){let t=document.createElement("div"),n=document.createElement("h4");n.textContent=e[0];let r=document.createElement("p");r.textContent=e[1],t.appendChild(n),t.appendChild(r),l.appendChild(t)}}if(!n)continue;n.appendChild(l);let u=document.createElement("hr");u.classList.add("aos_dark"),n.appendChild(u);for(let t of e._units){n.appendChild(this.renderUnitHtml(t));let e=document.createElement("hr");e.classList.add("aos_dark"),n.appendChild(e)}}}}createTable(e){const t=document.createElement("table"),n=document.createElement("thead");t.appendChild(n),n.classList.add("aos_light");const r=document.createElement("tr");return n.appendChild(r),e.forEach((e=>{let t=document.createElement("th");t.scope="col",t.textContent=e.name,t.style.width=e.width,r.appendChild(t)})),t}internalKeyword(e){return e.toUpperCase()!=e}renderUnitHtml(e){let t=document.createElement("div");t.classList.add("container-fluid","aos_unit");let n=document.createElement("div");n.classList.add("p-2","mb-2","aos_medium","text-center","text-uppercase","text-black"),n.innerHTML=`${e._name}`,t.append(n);let r=document.createElement("div");if(r.classList.add("row"),t.append(r),e.isNormalUnit()){let t=document.createElement("div");t.classList.add("col-3"),t.innerHTML=`
\n

${e._move}

\n

${e._wounds}

\n

${e._bravery}

\n

${e._save}

\n
`,r.append(t)}let i=document.createElement("div");i.classList.add("col"),r.appendChild(i);let o=document.createElement("table");o.classList.add("table","table-sm","aos_table","aos_font","text-center");let s=document.createElement("thead");o.appendChild(s),o.innerHTML='\n Missile Weapons\n Range\n Attacks\n To Hit\n To Wound\n Rend\n Damage\n ';let a=document.createElement("tbody");o.appendChild(a);let l=document.createElement("table");l.classList.add("table","table-sm","aos_table","aos_font","text-center"),s=document.createElement("thead"),l.appendChild(s),l.innerHTML='\n Melee Weapons\n Range\n Attacks\n To Hit\n To Wound\n Rend\n Damage\n ';let c=document.createElement("tbody");l.appendChild(c);let u=!1,d=!1;for(let t of e._weapons)if("Missile"===t._type){let e=document.createElement("tr");e.innerHTML=`${t._name}${t._range}${t._attacks}\n ${t._toHit}${t._toWound}${t._rend}${t._damage}`,a.appendChild(e),u=!0}else if("Melee"===t._type){let e=document.createElement("tr");e.innerHTML=`${t._name}${t._range}${t._attacks}\n ${t._toHit}${t._toWound}${t._rend}${t._damage}`,c.appendChild(e),d=!0}if(u&&i.appendChild(o),d&&i.appendChild(l),e._woundTracker&&e._woundTracker._labels.length>0){let t=[];const n=(1/e._woundTracker._labels.length*100).toString()+"%";for(let r of e._woundTracker._labels)t.push({name:r,width:n});const r=this.createTable(t);r.classList.add("table","table-sm","aos_table","aos_font","text-center"),i.appendChild(r);let o=document.createElement("tbody");r.appendChild(o);for(let t of e._woundTracker._table){let e=document.createElement("tr");for(let n of t){let t=document.createElement("td");t.textContent=n,e.appendChild(t)}o.appendChild(e)}}if(e._abilities.size>0&&this.renderAbilityMap(i,"ABILITIES",e._abilities),e._commandAbilities.size>0&&this.renderAbilityMap(i,"COMMAND ABILITIES",e._commandAbilities),e._commandTraits.size>0&&this.renderAbilityMap(i,"COMMAND TRAITS",e._commandTraits),e._magic.size>0&&this.renderAbilityMap(i,"MAGIC",e._magic),e._spells.length>0){let t=document.createElement("h4");t.textContent="SPELLS",i.appendChild(t),this.renderSpells(i,e._spells)}if(e._prayers.length>0){let t=document.createElement("h4");t.textContent="PRAYERS",i.appendChild(t);const n=[{name:"NAME",width:"20%"},{name:"ANSWER VALUE",width:"10%"},{name:"RANGE",width:"10%"},{name:"DESCRIPTION",width:"60%"}],r=this.createTable(n);r.classList.add("table","table-sm","aos_table","aos_font");let o=document.createElement("tbody");r.appendChild(o);for(let t of e._prayers){let e=document.createElement("tr"),n=document.createElement("td");n.textContent=t._name;let r=document.createElement("td");r.textContent=t._answerValue.toString();let i=document.createElement("td");i.textContent=t._range.toString();let s=document.createElement("td");s.textContent=t._description,e.appendChild(n),e.appendChild(r),e.appendChild(i),e.appendChild(s),o.appendChild(e)}i.appendChild(r)}e._artefacts.size>0&&this.renderAbilityMap(i,"ARTEFACTS",e._artefacts);let h="";for(let t of e._extraProfiles)if(1==t._value._fields.size){if(h!=t._value._typeName){let e=document.createElement("h4");i.appendChild(e),e.textContent=t._value._typeName.toUpperCase(),h=t._value._typeName}const e=t._value._fields.values();let n=document.createElement("p");n.classList.add("aos_font"),n.innerHTML=`${t._name}: ${e.next().value}`,i.appendChild(n)}else console.log("Table profiles not implemented. "+t._value._typeName);if(e._keywords.size>0){let n=document.createElement("div");n.classList.add("container-fluid");let r=document.createElement("div");r.classList.add("row"),n.appendChild(r);let i=document.createElement("div");i.classList.add("col-5","border","aos_dark","text-center"),i.innerHTML="KEYWORDS",r.appendChild(i);let o="",s="";for(let t of e._keywords)this.internalKeyword(t)||(s+=o,s+=t,o=", ");let a=document.createElement("div");a.classList.add("col","border","text-left","text-uppercase"),a.innerText=s,r.appendChild(a),t.appendChild(n)}return t}renderAbilityMap(e,t,n){let r=document.createElement("h4");r.textContent=t,e.appendChild(r);for(let e of n){let t=document.createElement("p");t.classList.add("aos_font"),t.innerHTML=`${e[0]}: ${e[1]}`,r.appendChild(t)}}renderSpells(e,t){const n=this.createTable([{name:"NAME",width:"25%"},{name:"CASTING VALUE",width:"15%"},{name:"RANGE",width:"10%"},{name:"DESCRIPTION",width:"50%"}]);n.classList.add("table","table-sm","aos_font");let r=document.createElement("tbody");n.appendChild(r);for(let e of t){let t=document.createElement("tr"),n=document.createElement("td");n.textContent=e._name;let i=document.createElement("td");i.textContent=e._castingValue.toString();let o=document.createElement("td");o.textContent=e._range.toString();let s=document.createElement("td");s.textContent=e._description,t.appendChild(n),t.appendChild(i),t.appendChild(o),t.appendChild(s),r.appendChild(t)}e.appendChild(n)}}},66:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererHH2=void 0;const r=n(980);class i{constructor(e){this._roster=null,this._roles=new Map,this._infantryLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.05,.05,.05,.05,.1],this._vehicleLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.2,.1],this._knightLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.05,.05,.05,.05,.05,.1],this._fortificationLabelWidthsNormalized=[.2,.2,.05,.05,.05,.05,.05,.2,.15],this._weaponLabelWidthNormalized=[.25,.05,.05,.05,.15,.35],this._psychicWeaponLabelWidthNormalized=[.25,.05,.05,.05,.15,.35],this._psychicPowerLabelWidthNormalized=[.25,.75],this._wargearLabelWidthNormalized=[.25,.75],this._roster=e,this._roles.set(r.HorusHeresy.UnitRole.HQ,document.getElementById("role_hq")),this._roles.set(r.HorusHeresy.UnitRole.TR,document.getElementById("role_tr")),this._roles.set(r.HorusHeresy.UnitRole.EL,document.getElementById("role_el")),this._roles.set(r.HorusHeresy.UnitRole.FA,document.getElementById("role_fa")),this._roles.set(r.HorusHeresy.UnitRole.HS,document.getElementById("role_hs")),this._roles.set(r.HorusHeresy.UnitRole.FL,document.getElementById("role_fl")),this._roles.set(r.HorusHeresy.UnitRole.DT,document.getElementById("role_dt")),this._roles.set(r.HorusHeresy.UnitRole.FT,document.getElementById("role_ft")),this._roles.set(r.HorusHeresy.UnitRole.LW,document.getElementById("role_lw")),this._roles.set(r.HorusHeresy.UnitRole.PR,document.getElementById("role_lw"))}render(e,t,n){if(null!=this._roster){if(e){this.renderOptionsDiv(e);const t=[`${this._roster._cost._points} pts`],n=`${this._roster._name} (${t.join(", ")})`;e.appendChild(document.createElement("h3")).appendChild(document.createTextNode(n));const r=e.appendChild(document.createElement("div"));r.classList.add("footer"),r.appendChild(document.createElement("div")).appendChild(document.createTextNode("PrettyScribe")),r.appendChild(document.createElement("div")).appendChild(document.createTextNode(n))}t&&this.renderRosterSummary(t),n&&this.renderRosterDetails(n),this.loadOptionsFromLocalStorage()}}renderRosterSummary(e){if(this._roster)for(const t of this._roster._forces){const n=document.createElement("div");t._faction?n.appendChild(document.createTextNode(`${t._catalog} ${t._name} (${t._faction})`)):n.appendChild(document.createTextNode(`${t._catalog} ${t._name}`)),e.appendChild(n);const i=document.createElement("table");i.classList.add("table","table-sm","table-striped");const o=document.createElement("thead");i.appendChild(o),o.classList.add("thead-light");const s=document.createElement("tr");o.appendChild(s),[{name:"NAME",w:"20%"},{name:"ROLE",w:"15%"},{name:"MODELS",w:"55%"},{name:"POINTS",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.appendChild(document.createTextNode(e.name)),t.style.width=e.w,s.appendChild(t)})),n.appendChild(i);let a=document.createElement("tbody");i.appendChild(a);for(let e of t._units){const t=document.createElement("tr");t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._name)),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(r.HorusHeresy.UnitRoleToString[e._role]));const n=t.appendChild(document.createElement("td"));this.renderModelList(n,e),t.appendChild(document.createElement("td")).appendChild(document.createTextNode(e._points.toString())),a.appendChild(t)}}}renderOptionsDiv(e){const t=e.appendChild(document.createElement("div"));t.classList.add("wh40k_options_div","d-print-none"),t.id="wh40k_options_div";const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_options_toggle"),n.id="wh40k_options_toggle";const r="[−] Options:";n.appendChild(document.createTextNode(r)),n.addEventListener("click",(e=>{const t=document.getElementById("wh40k_options_div"),n=document.getElementById("wh40k_options_toggle");t&&n&&(t.classList.contains("hide_options")?(t.classList.remove("hide_options"),n.innerText=r,this.saveOptionToLocalStorage("option-toggle-hidden","false")):(t.classList.add("hide_options"),n.innerText="[+] Options",this.saveOptionToLocalStorage("option-toggle-hidden","true")))})),this.renderCheckboxOption(t,"showUpgradeCosts","Show upgrade costs",(e=>{const t=document.getElementsByClassName("wh40k_upgrade_cost");for(const n of t)e.target.checked?n.classList.remove("d-none"):n.classList.add("d-none")})),this.renderCheckboxOption(t,"collateDatasheets","Collate Detachment Datasheets",(e=>{const t=document.getElementById("collated_sheets"),n=document.getElementById("detachment_sheets");t&&n&&(e.target.checked?(t.classList.remove("d-none"),n.classList.add("d-none")):(t.classList.add("d-none"),n.classList.remove("d-none")))}));const i=t.appendChild(document.createElement("span"));i.classList.add("wh40k_options_print_subsection"),i.appendChild(document.createTextNode("Print:")),this.renderCheckboxOption(i,"printBigger","Larger Text",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("bigger"):n.classList.remove("bigger")})),this.renderCheckboxOption(i,"hideElements","Hide Elements",(e=>{const t=document.body;e.target.checked?(t.classList.add("hide_enabled"),t.addEventListener("click",l)):(t.classList.remove("hide_enabled"),t.removeEventListener("click",l))})),this.renderCheckboxOption(i,"datasheetPageBreaks","One Datasheet per Page",(e=>{const t=document.getElementsByClassName("wh40k_unit_sheet");for(const n of t)e.target.checked?n.classList.add("page_break"):n.classList.remove("page_break")}))}renderCheckboxOption(e,t,n,r){const i=e.appendChild(document.createElement("div"));i.classList.add("wh40k_option");const o=i.appendChild(document.createElement("input"));o.setAttribute("type","checkbox"),o.setAttribute("name",t),o.setAttribute("id",t),o.addEventListener("input",r),o.addEventListener("change",(e=>this.saveCheckboxToLocalStorage(t)));const s=i.appendChild(document.createElement("label"));s.setAttribute("for",t),s.appendChild(document.createTextNode(` ${n}`))}saveCheckboxToLocalStorage(e){const t=document.getElementById(e);t&&this.saveOptionToLocalStorage(`option-checkbox-${e}`,t.checked)}saveOptionToLocalStorage(e,t){try{window.localStorage[e]=t}catch(e){}}loadOptionsFromLocalStorage(){var e;try{for(let t=0;te._role!=t._role?e._role-t._role:e._name!=t._name?r.HorusHeresy.Compare(e._name,t._name):e._points-t._points)),this.renderDatasheets(o,s);let u=document.createElement("div");u.style.pageBreakBefore="always",this.printRules(t,u),this.printRules(n,u),e.appendChild(u)}renderDatasheets(e,t){let n=0;for(let r=0;r1?` (${n})`:""),""],[.1,.8,.1]));const h=c.appendChild(document.createElement("tr"));for(let e=0;e<20;e++){const e=h.appendChild(document.createElement("td"));e.colSpan=1,e.style.width="5%",e.style.padding="0"}let f=function(e,t){if(!t.notes())return null;const n=document.createElement("thead");return n.classList.add("info_row"),n.appendChild(o(["Unit notes",t._customNotes],[.1,.9],!1)),n}(0,t);if(f&&l.appendChild(f),t._modelStats.length>0){const e=function(e){let t=new Map;const n=e.filter((e=>e instanceof r.HorusHeresy.Vehicle));t.set("Vehicles",n);const i=e.filter((e=>e instanceof r.HorusHeresy.Knight));t.set("Knights",i);const o=e.filter((e=>e instanceof r.HorusHeresy.Fortification));t.set("Fortifications",o);const s=e.filter((e=>e instanceof r.HorusHeresy.Model));return t.set("Models",s),t}(t._modelStats),n=e.get("Models");if(null!=n&&n.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._infantryLabels,this._infantryLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of n){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._ws.toString(),n._bs.toString(),n._str.toString(),n._toughness.toString(),n._wounds.toString(),n._initiative.toString(),n._attacks.toString(),n._leadership.toString(),n._save],this._infantryLabelWidthsNormalized))}}const s=e.get("Vehicles");if(null!=s&&s.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._vehicleLabels,this._vehicleLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of s){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._bs.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._capacity.toString()],this._vehicleLabelWidthsNormalized))}}const a=e.get("Knights");if(null!=a&&a.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._knightLabels,this._knightLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of a){let n=t;e.append(o([n._name,n._type,n._move.toString(),n._ws.toString(),n._bs.toString(),n._str.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._initiative.toString(),n._attacks.toString(),n._hp.toString()],this._knightLabelWidthsNormalized))}}const u=e.get("Fortifications");if(null!=u&&u.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._fortificationLabels,this._fortificationLabelWidthsNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of u){let n=t;e.append(o([n._name,n._type,n._bs.toString(),n._front.toString(),n._side.toString(),n._rear.toString(),n._hp.toString(),n._capacity.toString()],this._fortificationLabelWidthsNormalized))}}}f=s("Model notes",t._models),f&&l.appendChild(f);const p=t.weapons();if(p.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._weaponLabels,this._weaponLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of p){let n=t._type.split(","),r=n[0].trim(),i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),e.append(o([t.name().toString(),t._range,t._str.toString(),t._ap,r,i],this._weaponLabelWidthNormalized))}}f=s("Weapon notes",p),f&&l.appendChild(f);const _=t.wargear();if(_.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._wargearLabels,this._wargearLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of _)e.append(o([t.name(),t._description],this._wargearLabelWidthNormalized))}f=s("Wargear Item notes",_),f&&l.appendChild(f);const m=t.psychicWeapons();if(m.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._psychicWeaponLabels,this._psychicWeaponLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of m){let n=t._type.split(","),r=n[0].trim(),i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),e.append(o([t.name().toString(),t._range,t._str.toString(),t._ap,r,i],this._psychicWeaponLabelWidthNormalized))}}f=s("Psychic Weapon notes",m),f&&l.appendChild(f);const g=t.psychicPowers();if(g.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(i._psychicPowerLabels,this._psychicPowerLabelWidthNormalized,!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of g)e.append(o([t.name(),t._description],this._psychicPowerLabelWidthNormalized))}f=s("Psychic Power notes",g),f&&l.appendChild(f);const v=t.warlordTraits();if(v.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(["Warlord Trait","Description"],[.25,.75],!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of v)e.append(o([t.name(),t._description],[.25,.75]))}f=s("Warlord Trait notes",v),f&&l.appendChild(f);const b=t.reactions();if(b.length>0){c=l.appendChild(document.createElement("thead")),c.classList.add("table-active"),c.appendChild(o(["Reaction","Description"],[.25,.75],!0));let e=l.appendChild(document.createElement("tbody"));e.append(document.createElement("tr"));for(const t of b)e.append(o([t.name(),t._description],[.25,.75]))}if(t._rules.size>0){const e=Array.from(t._rules.keys()).sort(r.HorusHeresy.Compare),n=t.weaponRules();let i=[];for(const t of e)n.includes(t)||i.push(t);this.renderUnitRules(l,"Rules",i)}c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const y=Array.from(t._keywords).sort(r.HorusHeresy.Compare).join(", ").toLocaleUpperCase();c.appendChild(o(["Keywords",y],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const w=document.createElement("div");this.renderModelList(w,t),c.appendChild(o(["MODELS",w],[.1,.9],!1))}renderUnitRules(e,t,n){const r=e.appendChild(document.createElement("thead"));r.classList.add("info_row");const i=document.createElement("div");n.forEach(((e,t)=>{let n=e.trim();if(t>1&&i.appendChild(document.createTextNode(", ")),0!=t){let e=document.createElement("a");e.classList.add("hh2-rule-link"),e.href="#"+n,e.text=n,i.appendChild(e)}})),r.appendChild(o([t,i],[.1,.9],!1))}renderModelList(e,t){for(const n of t._models){const t=e.appendChild(document.createElement("div"));t.appendChild(document.createTextNode((n._count>1?`${n._count}x `:"")+n._name));const r=n.getDedupedWeaponsAndUpgrades();if(0!==r.length){t.appendChild(document.createTextNode(" ("));for(const e of r)if(e!==r[0]&&t.appendChild(document.createTextNode(", ")),t.appendChild(document.createTextNode((e._count>1?`${e._count}x `:"")+e.selectionName())),e._cost.hasValues()){const n=t.appendChild(document.createElement("span"));n.classList.add("wh40k_upgrade_cost","d-none"),n.appendChild(document.createTextNode(` ${e._cost.toString()}`))}t.appendChild(document.createTextNode(")"))}}}printRules(e,t){if(0!==e.size&&t)for(let[n,r]of e.entries()){let e=document.createElement("div");e.classList.add("wh40k_rules");let i=document.createElement("h3");e.appendChild(i),i.appendChild(document.createTextNode(n));for(let t of r){let n=a(document.createElement("div")),r=document.createElement("b");r.id=t[0],r.appendChild(document.createTextNode(t[0]));let i=document.createElement("p");i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t.appendChild(e)}}}function o(e,t,n=!1){const r=a(document.createElement("tr"));n&&r.classList.add("header_row");for(let i=0,o=0;ie._customNotes)))return null;const n=document.createElement("thead");n.classList.add("info_row");const r=document.createElement("div");for(const e of t){if(!e.notes())continue;const t=r.appendChild(document.createElement("div"));t.appendChild(document.createElement("b")).appendChild(document.createTextNode(`${e.name()}: `)),t.appendChild(document.createTextNode(e._customNotes))}return n.appendChild(o([e,r],[.1,.9],!1)),n}function a(e){return e.classList.add("hide_able"),e}function l(e){let t=e.target;t&&(t=t.closest(".hide_able")),t&&(t.classList.contains("hidden")?t.classList.remove("hidden"):t.classList.add("hidden"))}t.RendererHH2=i,i._infantryLabels=["Model","Type","M","WS","BS","S","T","W","I","A","Ld","Sv",""],i._vehicleLabels=["Model","Type","M","BS","Front","Side","Rear","HP","Capacity",""],i._knightLabels=["Model","Type","M","WS","BS","S","Front","Side","Rear","I","A","HP",""],i._fortificationLabels=["Model","Type","BS","Front","Side","Rear","HP","Capacity",""],i._weaponLabels=["Weapon","Range","Str","AP","Type","Rules"],i._psychicWeaponLabels=["Psychic Weapon","Range","Str","AP","Type","Rules"],i._psychicPowerLabels=["Psychic Power","Description"],i._wargearLabels=["Wargear Item","Description"]},96:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererKT21=void 0;const r=n(249),i=n(419);class o{constructor(e){this._descriptionStartX=140,this._descriptionWidth=600,this._roster=null,this._octagon=null,this._specialisms=new Map,this._currentX=0,this._currentY=0,this._maxWidth=0,this._maxHeight=0,this._unitLabelWidthsNormalized=[.25,.05,.05,.05,.05,.05,.05],this._weaponLabelWidthNormalized=[.25,.05,.05,.05,.2,.2],this._spellLabelWidthNormalized=[.25,.75],this._roster=e,this._octagon=document.getElementById("octagon"),this._specialisms.set(r.Specialism.NONE,document.getElementById("role_hq")),this._specialisms.set(r.Specialism.COMBAT,document.getElementById("role_hs")),this._specialisms.set(r.Specialism.STAUNCH,document.getElementById("role_fa")),this._specialisms.set(r.Specialism.MARKSMAN,document.getElementById("role_el")),this._specialisms.set(r.Specialism.SCOUT,document.getElementById("role_tr"))}render(e,t,n){if(null==this._roster)return void console.log("Roster is NULL");e&&(e.innerHTML="

"+this._roster.name()+" ("+this._roster._equipmentPoints+" EP)

");let r=new Map,i=new Map;for(let s of this._roster._forces){let a=r.get(s._catalog);a||(a=new Map,r.set(s._catalog,a));let l=i.get(s._catalog);l||(l=new Map,i.set(s._faction,l));const c=document.createElement("div");c&&(s._faction?c.innerHTML="

"+s._faction+" - "+s.name()+"

":c.innerHTML="

"+s.name()+"

"),t&&t.appendChild(c);const u=document.createElement("table");u.classList.add("table"),u.classList.add("table-sm"),u.classList.add("table-striped");const d=document.createElement("thead");u.appendChild(d),d.classList.add("thead-light");const h=document.createElement("tr");d.appendChild(h),[{name:"MODELS",w:"55%"},{name:"EP",w:"5%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,h.appendChild(t)})),c.appendChild(u);let f=document.createElement("tbody");if(u.appendChild(f),s._leader){let m=document.createElement("tr"),g=document.createElement("td");g.innerHTML=s._leader.nameAndGear();let v=document.createElement("td");v.innerHTML=s._leader.costs().toString(),m.appendChild(g),m.appendChild(v),f.appendChild(m)}for(let b of s._operatives){let y=document.createElement("tr"),w=document.createElement("td");w.innerHTML=b.nameAndGear();let C=document.createElement("td");C.innerHTML=b.costs().toString(),y.appendChild(w),y.appendChild(C),f.appendChild(y)}if(n){const S=document.createElement("div");if(S){const x=document.createElement("p");x.appendChild(document.createTextNode(s.name())),s._faction&&x.appendChild(document.createTextNode(" ("+s._faction+")")),S.appendChild(x)}let E=document.createElement("h3");E.appendChild(S),n.appendChild(E)}s._leader&&this.printOperative(s._leader,null,n);let p=null;for(let k of s._operatives)this.printOperative(k,p,n),p=k;function _(e,t){for(const n of t)e.set(n[0],n[1])}if(s._rules.size>0&&_(a,s._rules),s._factionRules.size>0&&_(l,s._factionRules),s._leader&&s._leader._rules.size>0&&_(a,s._leader._rules),s._operatives&&s._operatives.length>0)for(const A of s._operatives)A._rules&&A._rules.size>0&&_(a,A._rules)}let o=document.createElement("div");o.style.pageBreakBefore="always",this.printRules(r,o),this.printRules(i,o),n&&n.appendChild(o)}printOperative(e,t,n){let r=document.createElement("canvas");if(r.width=7.5*o._res,r.height=12*o._res,r.style.width=r.width.toString(),r.style.height=r.height.toString(),this._descriptionWidth=r.width-this._descriptionStartX-10,e.equal(t))return;const i=this.renderOperative(e,r,0,0);let s=document.createElement("canvas");s.width=i[0]+30,s.height=i[1]+30,s.style.width=s.width.toString(),s.style.height=s.height.toString();let a=s.getContext("2d");if(null==a||a.drawImage(r,15,15),n){let e=document.createElement("div");e.appendChild(s),n.appendChild(e)}}printRules(e,t){if(e.size>0)for(let[n,r]of e.entries()){if(0==r.size)continue;let e=document.createElement("div"),i=document.createElement("h3");e.appendChild(i),i.textContent=n;for(let t of r){let n=document.createElement("div"),r=document.createElement("b");r.textContent=t[0];let i=document.createElement("p");i.setAttribute("style","white-space: pre-wrap;"),i.appendChild(document.createTextNode(t[1]||"")),n.appendChild(r),n.appendChild(i),e.appendChild(n)}t&&t.appendChild(e)}}renderBorder(e,t,n,r,i){e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.stroke(),e.save(),e.fillStyle=o._fillColor,e.globalCompositeOperation="destination-over",e.beginPath(),e.moveTo(t,n+o._bevelSize),e.lineTo(t,n+i-o._bevelSize),e.lineTo(t+o._bevelSize,n+i),e.lineTo(t+r-o._bevelSize,n+i),e.lineTo(t+r,n+i-o._bevelSize),e.lineTo(t+r,n+o._bevelSize),e.lineTo(t+r-o._bevelSize,n),e.lineTo(t+o._bevelSize,n),e.closePath(),e.fill(),e.restore()}renderNotes(e,t,n){n._customNotes&&(this.renderLine(e),e.font=o._headerFont,(0,i.RenderText)(e,t.toLocaleUpperCase(),this._currentX+o._offset,this._currentY,100,16,i.Justification.Left),e.font=o._font,this._currentY+=2,this._currentY=(0,i.RenderParagraph)(e,n._customNotes,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth-o._offset,0),this._currentY+=2)}renderNotesArray(e,t,n){let r=0;for(const e of n)e._customNotes&&r++;if(0!=r){this.renderLine(e),e.font=o._headerFont,(0,i.RenderText)(e,t.toLocaleUpperCase(),this._currentX+o._offset,this._currentY,100,16,i.Justification.Left);for(const t of n){const n=t.name()+":",r=t._customNotes;if(!r)continue;e.font=o._headerFont,this._currentY+=2,(0,i.RenderTextFull)(e,n,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth,16,i.Justification.Left,i.VertAlign.Top);let s=e.measureText(n).width;e.font=o._font,this._currentY=(0,i.RenderParagraph)(e," "+r,this._currentX+this._descriptionStartX,this._currentY,this._descriptionWidth-o._offset,s),this._currentY+=2}}}renderLine(e){e.lineWidth=2,e.strokeStyle=o._blackColor,e.beginPath(),e.moveTo(this._currentX,this._currentY),e.lineTo(this._currentX+this._maxWidth,this._currentY),e.stroke(),this._currentY+=1}renderTableHeader(e,t,n,r){let s=this._currentX;const a=this._maxWidth;e.fillStyle=o._grey1,e.fillRect(this._currentX,this._currentY,a,22),e.fillStyle=o._blackColor,e.font=o._titleFont;var l=50;if(t){e.font=o._headerFont;for(let a=0;a{l.push(e*this._maxWidth)}));for(let t of e._weapons)s.push(t);for(let t of e._psychicPowers)a.push(t);const c=[],u=new Map;u.has(e.name())||(u.set(e.name(),e),c.push(e)),this.renderNotes(i,"Operative notes",e),this.renderTableHeader(i,o._unitLabels,l,null);let d=0;for(var h of c)this.renderModel(i,h,l,d%2),d++;this.renderNotes(i,"Model notes",e);const f=[],p=new Map;for(const e of s)p.has(e.name())||(p.set(e.name(),e),f.push(e));if(f.length>0){const e=[];this._weaponLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._weaponLabels,e,o._weaponJustifications),this.renderWeapons(i,f,e)}if(this.renderNotesArray(i,"Weapons notes",s),a.length>0){const e=[];this._spellLabelWidthNormalized.forEach((t=>{e.push(t*this._maxWidth)})),this.renderLine(i),this.renderTableHeader(i,o._spellLabels,e,null),this.renderSpells(i,a,e)}this.renderNotesArray(i,"Spell notes",a),(e._abilities.size>0||e._rules.size>0)&&(this.renderLine(i),this._currentY+=2,this.renderAbilities(i,e)),e._factions.size>0&&(this.renderLine(i),this._currentY+=2,this.renderFactions(i,e)),e._keywords.size>0&&(this.renderLine(i),this._currentY+=2,this.renderKeywords(i,e)),this.renderLine(i),this._currentY+=2,this.renderModelList(i,[e]),this._currentY+=2;const _=this._currentY-(r+o._margin),m=this._maxWidth;return this.renderBorder(i,this._currentX,r+o._margin,m,_),[this._maxWidth,this._currentY]}renderHeader(e,t){t.globalAlpha=1,t.fillStyle=o._blackColor;const n=this._currentX,r=this._currentX+this._maxWidth,s=this._currentY,a=s+36;t.beginPath(),t.moveTo(n,s+o._bevelSize),t.lineTo(n,a),t.lineTo(r,a),t.lineTo(r,s+o._bevelSize),t.lineTo(r-o._bevelSize,s),t.lineTo(n+o._bevelSize,s),t.closePath(),t.fill();let l=n+6;if(this._octagon){t.drawImage(this._octagon,l,s+2,32,32);const n=this._specialisms.get(e._role);n&&t.drawImage(n,l+4,s+2+4,24,24),t.fillStyle="white",t.font="18px serif",l+=34,t.drawImage(this._octagon,l,s+2,32,32),(0,i.RenderText)(t,e.costs().toString(),l,s+2,32,32,i.Justification.Center)}let c=0,u=28;const d=l+6;t.font=u+"px bold serif";const h=e.name().toLocaleUpperCase();let f=t.measureText(h);const p=this._maxWidth-d;for(;c<6&&f.width>p;)c+=1,u-=2,t.font=u+"px bold serif",f=t.measureText(h);t.fillStyle="white",t.textBaseline="top",(0,i.RenderText)(t,h,d,s,p,36,i.Justification.Center),this._currentY+=36}}t.RendererKT21=o,o._res=144,o._margin=0,o._bevelSize=15,o._blackColor="#1d272a",o._grey1="#b3bbb5",o._greyLight="#dde1df",o._fillColor="#f6f6f6",o._offset=20,o._titleFont="bold 14px sans-serif",o._headerFont="bold 14px sans-serif",o._font="14px sans-serif",o._boldFont="bold 14px sans-serif",o._unitLabels=["Operative","M","APL","GA","DF","Save","W"],o._weaponLabels=["WEAPONS","A","WS/BS","D","SR","!"],o._weaponJustifications=[i.Justification.Left,i.Justification.Center,i.Justification.Center,i.Justification.Center,i.Justification.Left,i.Justification.Left],o._spellLabels=["PSYCHIC POWER","DETAILS"]},77:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderMESBG=void 0;const n=/\s+/g,r=(e,t="")=>{const n=document.createElement(e);return n.className=t,n},i=(e,t="",n="")=>{const i=r(e,t);return i.appendChild(document.createTextNode(n)),i},o=()=>r("div","mesbg_noBreak mesbg_bumpDown"),s=()=>r("table","mesbg_profileTable mesbg_noBreak mesbg_bumpDown"),a=(e,t)=>{const n=s();return n.appendChild((e=>{const t=r("tr");return e.forEach((e=>{t.appendChild(i("th","",e))})),t})(e)),n.appendChild((e=>{const t=r("tr");return e.forEach((e=>{t.appendChild(i("td","",e))})),t})(t)),n},l=e=>[e.movement,e.fight,e.strength,e.defense,e.attack,e.wounds,e.courage].join("-"),c=e=>i("h2","mesbg_h2",e),u=e=>i("h2","mesbg_h2",e),d={showTracker:!0,showRules:!0,woundChart:!0},h=(e,t)=>{const n=document.createElement("input");n.setAttribute("type","checkbox"),n.setAttribute("name",e),n.setAttribute("id",e),d[e]&&n.setAttribute("checked","checked"),n.addEventListener("change",(e=>()=>{const t=!d[e];d[e]=t;const n=document.querySelector(`.mesbg_${e}`);null!==n&&(t?n.classList.remove("mesbg_hideMe"):n.classList.add("mesbg_hideMe"))})(e));const r=document.createElement("label");return r.setAttribute("for",e),r.appendChild(document.createTextNode(` ${t} `)),r.prepend(n),r},f=["Mv","F","S","D","A","W","C"];t.renderMESBG=(e,t,d,p)=>{if(null!==t){const n=r("div","mesbg_noPrint mesbg_toggleHolder");n.appendChild(h("showRules","show rules text")),n.appendChild(h("showTracker","include hero points tracker")),n.appendChild(h("woundChart","include To Wound Chart")),t.appendChild(n),t.appendChild((_=e.name,i("h1","mesbg_h1",_))),t.appendChild(i("h4","mesbg_rosterInfo",`${e.points} points | ${e.warriors} warriors `))}var _;if(null!==d){const t=r("div","mesbg_container");d.appendChild(t),e.forces.forEach((n=>{t.appendChild(i("h2","mesbg_forceName",n.name)),t.appendChild(i("h4","mesbg_h4 mesbg_bumpDown",`${n.breakpoints.modelCount} models\n | broken at ${n.breakpoints.half} casualties\n | quartered at ${n.breakpoints.quarter} models remaining\n `)),i("p","mesbg_rosterInfo",`${e.points} points | ${e.warriors} warriors `);const o=r("div","mesbg_flexGrid");t.appendChild(o),n.units.forEach((e=>{var t,n;const s=r("div","mesbg_card");s.appendChild(c(`${e.leader.name} - ${e.leader.points}pts ${(null===(t=e.leader.heroStuff)||void 0===t?void 0:t.isLeader)?" (Leader)":""}`)),s.appendChild((e=>i("p","mesbg_equipmentList",e))(`${e.leader.wargear.map((e=>e.name)).join(", ")}${e.leader.mount?", "+(null===(n=e.leader.mount)||void 0===n?void 0:n.name):""}`)),s.appendChild(r("hr","mesbg_bumpDown")),e.warband.forEach((e=>{var t;const n=u(`${e.count} ${e.model.name} - ${e.points}pts`);s.appendChild(n),s.appendChild(i("p","mesbg_equipmentList",`${e.model.wargear.map((e=>e.name)).join(", ")}${e.model.mount?", "+(null===(t=e.model.mount)||void 0===t?void 0:t.name):""}`))})),o.appendChild(s)}))}))}if(null!=p){const t=r("div","mesbg_container");p.appendChild(t),e.forces.forEach((e=>{const d=new Map;e.units.forEach((e=>{var h,p,_,m,g,v,b,y,w,C,S,E;const x=r("div","mesbg_card"),k=r("div","mesbg_twoColumn");x.appendChild(c(`${e.leader.name} - ${e.leader.points}pts`)),x.appendChild(i("h3","mesbg_h3 mesbg_bumpDown",e.leader.keywords.join(", ")));const A=r("div","mesbg_flex mesbg_noBreak");A.appendChild(a(f,[e.leader.profile.movement,e.leader.profile.fight,e.leader.profile.strength,e.leader.profile.defense,e.leader.profile.attack,e.leader.profile.wounds,e.leader.profile.courage])),A.appendChild(a(["M","W","F"],[null!==(p=null===(h=e.leader.heroStuff)||void 0===h?void 0:h.might)&&void 0!==p?p:"-",null!==(m=null===(_=e.leader.heroStuff)||void 0===_?void 0:_.will)&&void 0!==m?m:"-",null!==(v=null===(g=e.leader.heroStuff)||void 0===g?void 0:g.fate)&&void 0!==v?v:"-"])),k.appendChild(A);const T=o();if(T.appendChild(i("h3","mesbg_h3","Wargear")),0===e.leader.wargear.length?T.appendChild(i("i","","none")):T.appendChild(i("p","mesbg_cardWargear",e.leader.wargear.map((e=>e.name)).join(", "))),k.appendChild(T),null!==(y=null===(b=e.leader.heroStuff)||void 0===b?void 0:b.actions.length)&&void 0!==y&&y){const t=o();t.appendChild(i("h3","mesbg_h3","Heroic Actions"));const n=r("ul","mesbg_list mesbg_noBreak mesbg_bumpDown");null===(w=e.leader.heroStuff)||void 0===w||w.actions.forEach((e=>{n.appendChild(r("li")).appendChild(document.createTextNode(e))})),t.appendChild(n),k.appendChild(t)}if(k.appendChild(i("h3","mesbg_h3","Special Rules")),k.appendChild(i("p","mesbg_bumpDown",e.leader.rules.map((e=>e.name)).join(", "))),null!==(S=null===(C=e.leader.heroStuff)||void 0===C?void 0:C.magicalPowers.length)&&void 0!==S&&S){const t=s();t.className="mesbg_powerTable mesbg_noBreak";const n=r("tr");n.appendChild(r("th")).appendChild(i("h3","mesbg_h3","Magical Powers")),n.appendChild(r("th")).appendChild(i("span","","Range")),n.appendChild(r("th")).appendChild(i("span","","Casting")),t.appendChild(n),null===(E=e.leader.heroStuff)||void 0===E||E.magicalPowers.forEach((e=>{const n=r("tr");n.appendChild(r("td")).appendChild(i("span","",e.name)),n.appendChild(r("td")).appendChild(i("span","",e.range)),n.appendChild(r("td")).appendChild(i("span","",e.casting)),t.appendChild(n)})),k.appendChild(t)}if(void 0!==e.leader.mount){const t=o();t.appendChild(u(`Mount: ${e.leader.mount.name}`));const n=r("div","mesbg_flex mesbg_noBreak");n.appendChild(a(f,[e.leader.mount.profile.movement,e.leader.mount.profile.fight,e.leader.mount.profile.strength,e.leader.mount.profile.defense,e.leader.mount.profile.attack,e.leader.mount.profile.wounds,e.leader.mount.profile.courage])),t.append(n),k.append(t)}x.appendChild(k),t.appendChild(x),e.warband.forEach((e=>{const t=e.model,r=(e=>{var t,r;return e.name.trim().replace(n,"-")+(null!==(r=null===(t=e.mount)||void 0===t?void 0:t.name.trim().replace(n,"-"))&&void 0!==r?r:"")})(t);if(d.has(r)){const e=d.get(r),n=l(t.profile),i=null==e?void 0:e.statLines.get(n),o=t.wargear.map((e=>e.name.trim())).join(", ");void 0===i?null==e||e.statLines.set(n,{profile:t.profile,equipments:new Set([o])}):i.equipments.add(o)}else{const e={name:t.name,keywords:t.keywords.join(", "),mount:t.mount,ruleNames:t.rules.map((e=>e.name)).join(", "),statLines:new Map([[l(t.profile),{profile:t.profile,equipments:new Set([t.wargear.map((e=>e.name.trim())).join(", ")])}]])};d.set(r,e)}}))}));const h=r("div","mesbg_twoColumnGrid");d.forEach(((e,t)=>{const n=r("div","mesbg_card"),s=r("div","mesbg_twoColumn");if(n.appendChild(u(e.name)),n.appendChild(i("p","mesbg_cardWargear mesbg_bumpDown",e.keywords)),e.statLines.forEach(((e,t)=>{const n=r("div","mesbg_noBreak");n.appendChild(i("h3","mesbg_h3","Wargear")),e.equipments.forEach((e=>{n.appendChild(i("p","mesbg_cardWargear",e))})),n.appendChild(a(f,[e.profile.movement,e.profile.fight,e.profile.strength,e.profile.defense,e.profile.attack,e.profile.wounds,e.profile.courage])),s.appendChild(n)})),e.ruleNames.length>0&&(s.appendChild(i("h3","mesbg_h3","Special Rules")),s.appendChild(i("p","mesbg_bumpDown",e.ruleNames))),void 0!==e.mount){const t=o();t.appendChild(u(`Mount: ${e.mount.name}`));const n=r("div","mesbg_flex mesbg_noBreak");n.appendChild(a(f,[e.mount.profile.movement,e.mount.profile.fight,e.mount.profile.strength,e.mount.profile.defense,e.mount.profile.attack,e.mount.profile.wounds,e.mount.profile.courage])),t.append(n),s.append(t)}n.appendChild(s),h.appendChild(n)})),t.appendChild(h)}));const d=new Set,h=r("div","mesbg_pageBreak mesbg_showRules");h.appendChild(i("h1","mesbg_h1","Rules"));const _=r("div","mesbg_twoColumn");e.forces.forEach((n=>{n.armyBonus.forEach((e=>{_.appendChild(i("h3","mesbg_h3",`"${e.name}" (Army Bonus)`)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText))})),n.units.forEach((e=>{e.leader.rules.forEach((e=>{!1===d.has(e.name)&&(_.appendChild(i("h3","mesbg_h3",e.name)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText)),d.add(e.name))})),e.warband.forEach((e=>{e.model.rules.forEach((e=>{!1===d.has(e.name)&&(_.appendChild(i("h3","mesbg_h3",e.name)),_.appendChild(i("p","mesbg_bumpDown",e.ruleText)),d.add(e.name))}))}))})),h.appendChild(_),t.appendChild(h);const o=r("table","mesbg_pageBreak mesbg_trackerTable mesbg_showTracker");o.innerHTML="MWF",e.forces.forEach((e=>{e.units.forEach((e=>{const t=r("tr");t.innerHTML=`

${e.leader.name}

`,o.appendChild(t)}))})),t.appendChild(o);const s=r("table","mesbg_pageBreak mesbg_woundChart");s.innerHTML='\n \n \n  Defence\n \n \n \n \n Strength\n   1 2 3 4 5 6 7 8 9 10\n \n \n 1 4 5 5 6 6 6/4 6/5 6/6 - -\n \n \n 2 4 4 5 5 6 6 6/4 6/5 6/6 -\n \n \n 3 3 4 4 5 5 6 6 6/4 6/5 6/6\n \n \n 4 3 3 4 4 5 5 6 6 6/4 6/5\n \n \n 5 3 3 3 4 4 5 5 6 6 6/4 \n \n 6 3 3 3 3 4 4 5 5 6 6\n \n \n 7 3 3 3 3 3 4 4 5 5 6\n \n \n 8 3 3 3 3 3 3 4 4 5 5\n \n \n 9 3 3 3 3 3 3 3 4 4 5\n \n \n 10 3 3 3 3 3 3 3 3 4 4\n \n \n ',t.appendChild(s)}))}}},717:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RendererWarcry=void 0;const r=n(320);t.RendererWarcry=class{constructor(e){this._roster=null,this._roster=e}render(e,t,n){if(null!=this._roster){e&&(e.innerHTML="

"+this._roster._name+" ("+this._roster._points+" pts

");for(let e of this._roster._forces){const i=document.createElement("div");i&&(i.innerHTML="

"+e._catalog+" "+e._name+"

"),t&&t.appendChild(i);const o=document.createElement("table");o.classList.add("table"),o.classList.add("table-sm"),o.classList.add("table-striped");const s=document.createElement("thead");o.appendChild(s),s.classList.add("thead-light");const a=document.createElement("tr");s.appendChild(a),[{name:"NAME",w:"35%"},{name:"ROLE",w:"25%"},{name:"POINTS",w:"15%"}].forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.w,a.appendChild(t)})),i.appendChild(o);let l=document.createElement("tbody");o.appendChild(l);for(let t of e._units){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name;let i=document.createElement("td");i.innerHTML=r.WarcryUnitRoleToString[t._role];let o=document.createElement("td");o.innerHTML=t._points.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(o),l.appendChild(e)}let c=document.createElement("div");if(e._allegiance._rules.size>0){let t=document.createElement("h3");c.appendChild(t),t.textContent=e._allegiance._name+" Abilities";for(let t of e._allegiance._rules){let e=document.createElement("div"),n=document.createElement("h4");n.textContent=t[0];let r=document.createElement("p");r.textContent=t[1],e.appendChild(n),e.appendChild(r),c.appendChild(e)}}if(!n)return;n.appendChild(c);let u=document.createElement("div");for(let t of e._units){u.appendChild(this.renderUnitHtml(t));let e=document.createElement("hr");e.className="aos_dark",u.appendChild(e)}n.appendChild(u)}}}createCharacteristicCard(e,t){let n=document.createElement("div");return n.className="col",n.innerHTML=`\n
\n \n
\n

${t}

\n
\n
`,n}createWeapon(e,t){let n=document.createElement("p");n.className="card-title warcry_font",n.innerHTML=e._name,t.appendChild(n);let r=document.createElement("div");r.className="row",t.appendChild(r);let i=this.getWeaponTypeRunemark(e._name),o=document.createElement("div");o.className="col",o.innerHTML=`\n
\n \n
`,r.appendChild(o);let s=this.createCharacteristicCard("range",e._range);r.appendChild(s);let a=this.createCharacteristicCard("attacks",e._attacks);r.appendChild(a);let l=this.createCharacteristicCard("strength",e._strength);r.appendChild(l);let c=this.createCharacteristicCard("damage",e._damage);r.appendChild(c)}renderUnitHtml(e){let t=document.createElement("div");t.className="container-fluid warcry_unit border bg-light";let n=document.createElement("div");n.className="row align-items-center",t.append(n);let r=document.createElement("div");r.className="col-1",r.innerHTML=``,n.appendChild(r);let i=document.createElement("div");i.className="col",i.innerHTML=`${e._name}`,n.appendChild(i);let o=document.createElement("div");o.className="col-4",n.appendChild(o);for(let t of e._keywords){const e=this.getAbilityRunemark(t);if(""!=e){let t=new Image;t.className="border border-dark rounded-circle warcry_card",t.src=`./assets/warcry/runemarks/black/fighters-${e}.svg`,o.appendChild(t)}}let s=document.createElement("div");s.className="col-1",s.innerHTML=`
${e._points}
`,n.appendChild(s);let a=document.createElement("div");a.className="row align-items-center",t.append(a);let l=document.createElement("div");l.className="col-7",a.appendChild(l),2==e._weapons.length&&this.createWeapon(e._weapons[1],l);let c=document.createElement("div");c.className="col",a.appendChild(c);let u=document.createElement("div");u.className="row align-items-center",t.append(u);let d=document.createElement("div");d.className="col-7",u.appendChild(d),e._weapons.length>=1&&this.createWeapon(e._weapons[0],d);let h=document.createElement("div");h.className="col",u.appendChild(h);let f=document.createElement("div");f.className="row",h.appendChild(f);let p=document.createElement("div");p.className="col",f.appendChild(p);let _=this.createCharacteristicCard("move",e._move.toString());f.appendChild(_);let m=this.createCharacteristicCard("toughness",e._toughness.toString());f.appendChild(m);let g=this.createCharacteristicCard("wounds",e._wounds.toString());if(f.appendChild(g),e._damageTable.length>0){let n=document.createElement("div");n.className="row w-75 align-items-center",t.append(n);let r=document.createElement("div");r.className="p-2 mb-2 text-center text-uppercase text-black",r.innerHTML='Damage Table',n.appendChild(r);let i=[{name:"Damage Points Allocated",width:"50%"},{name:"Move",width:"25%"},{name:"Damage ",width:"25%"}],o=1;for(let t of e._damageTable[0]._table)i[o++].name=t[0];const s=this.createTable(i);n.appendChild(s);let a=document.createElement("tbody");s.appendChild(a);for(let t of e._damageTable){let e=document.createElement("tr"),n=document.createElement("td");n.innerHTML=t._name,e.appendChild(n);for(let n of t._table){let t=document.createElement("td");t.innerHTML=n[1],e.appendChild(t)}a.appendChild(e)}}return t}createTable(e){const t=document.createElement("table");t.className="table table-bordered table-sm text-center";const n=document.createElement("thead");t.appendChild(n),n.classList.add("warcry_light");const r=document.createElement("tr");return n.appendChild(r),e.forEach((e=>{let t=document.createElement("th");t.scope="col",t.innerHTML=e.name,t.style.width=e.width,r.appendChild(t)})),t}getAbilityRunemark(e){const t=e.toLowerCase();return t.includes("agile")?"agile":t.includes("ally")?"ally":t.includes("beast")?"beast":t.includes("berserker")?"berserker":t.includes("brute")?"brute":t.includes("bulwark")?"bulwark":t.includes("champion")?"champion":t.includes("destroyer")?"destroyer":t.includes("elite")?"elite":t.includes("ferocious")?"ferocious":t.includes("fly")?"fly":t.includes("frenzied")?"frenzied":t.includes("gargantuan")?"gargantuan":t.includes("icon")?"icon-bearer":t.includes("leader")?"leader":t.includes("minion")?"minion":t.includes("mount")?"mount":t.includes("mystic")?"mystic":t.includes("priest")?"priest":t.includes("scout")?"scout":t.includes("sentience")?"sentience":t.includes("terrifying")?"terrifying":t.includes("thrall")?"thrall":t.includes("trapper")?"trapper":t.includes("warrior")?"warrior":""}getWeaponTypeRunemark(e){const t=e.toLowerCase();return t.includes("axe")||t.includes("cleaver")?"axe":t.includes("claws")||t.includes("talon")||t.includes("grasping")||t.includes("pincher")?"claws":t.includes("club")?"club":t.includes("dagger")||t.includes("shank")?"dagger":t.includes("fangs")||t.includes("teeth")||t.includes("jaws")||t.includes("maw")?"fangs":t.includes("hammer")||t.includes("anvil")?"hammer":t.includes("mace")||t.includes("staff")||t.includes("stave")||t.includes("flail")?"mace":t.includes("scythe")?"scythe":t.includes("spear")||t.includes("glaive")||t.includes("halberd")||t.includes("lance")||t.includes("harpoon")||t.includes("polearm")?"spear":t.includes("sword")||t.includes("blade")||t.includes("sickles")?"sword":t.includes("arcane bolt")||t.includes("sorcerous bolt")?"blast":t.includes("bow")||t.includes("bolas")||t.includes("cannon")||t.includes("pistol")||t.includes("javelin")?"ranged-weapon":t.includes("whip")?"reach-weapon":"unarmed"}}},391:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Create30kRoster=t.Roster30k=t.Force30k=t.Unit30k=t.Fortification30k=t.Model30k=t.Flyer30k=t.Walker30k=t.Vehicle30k=t.UnitRoleToString30k=t.UnitRole30k=t.PsychicPower30k=t.Psyker30k=t.Weapon30k=void 0;class n{constructor(){this._name="",this._range="Melee",this._str="user",this._ap="",this._type="Melee"}}t.Weapon30k=n;class r{constructor(){this._name="",this._masteryLevel="",this._disciplines=""}}t.Psyker30k=r;class i{constructor(){this._name="",this._warpCharge=0,this._category="",this._range="",this._details=""}}var o;t.PsychicPower30k=i,function(e){e[e.NONE=0]="NONE",e[e.HQ=1]="HQ",e[e.TR=2]="TR",e[e.EL=3]="EL",e[e.FA=4]="FA",e[e.HS=5]="HS",e[e.FL=6]="FL",e[e.DT=7]="DT",e[e.FT=8]="FT",e[e.LW=9]="LW"}(o=t.UnitRole30k||(t.UnitRole30k={})),t.UnitRoleToString30k=["None","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War"];class s{constructor(){this._name="",this._bs="",this._front=4,this._side=4,this._rear=4,this._hp=1,this._type="",this._weapons=[]}}t.Vehicle30k=s;class a{constructor(){this._name="",this._ws="",this._bs="",this._str=4,this._front=4,this._side=4,this._rear=4,this._initiative=1,this._attacks="",this._hp=1,this._type="",this._weapons=[]}}t.Walker30k=a;class l{constructor(){this._name="",this._bs="",this._front=4,this._side=4,this._rear=4,this._hp=1,this._type="",this._role="",this._pursuit="",this._agility="",this._weapons=[]}}t.Flyer30k=l;class c{constructor(){this._name="",this._count=0,this._ws="",this._bs="",this._str=4,this._toughness=4,this._wounds=1,this._initiative=1,this._attacks="",this._leadership=7,this._save="",this._weapons=[],this._psyker=null,this._psychicPowers=[]}}t.Model30k=c,t.Fortification30k=class{constructor(){this._name="",this._composition="",this._type=""}};class u{constructor(){this._name="",this._role=o.NONE,this._factions=new Set,this._keywords=new Set,this._abilities=new Map,this._rules=new Map,this._models=[],this._walkers=[],this._vehicles=[],this._flyers=[],this._points=0}}t.Unit30k=u;class d{constructor(){this._catalog="",this._name="Unknown",this._faction="Unknown",this._rules=new Map,this._units=[]}}t.Force30k=d;class h{constructor(){this._commandPoints=0,this._points=0,this._name="",this._forces=[]}}function f(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function p(e,t){let n=e.querySelectorAll("force>selections>selection");for(let e of n){let n=m(e);n&&n._role!=o.NONE&&t._units.push(n)}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function _(e){switch(e){case"HQ":return o.HQ;case"Troops":return o.TR;case"Elites":return o.EL;case"Fast Attack":return o.FA;case"Heavy Support":return o.HS;case"Flyer":return o.FL;case"Dedicated Transport":return o.DT;case"Fortification":return o.FT;case"Lord of War":return o.LW}return o.NONE}function m(e){var t,d,h,f,p,m,g,v,b,y,w,C,S,E,x,k,A,T,N;let L=new u,R=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;R&&(L._name=R);let O=e.querySelectorAll(":scope categories>category");for(let e of O){let t=null===(d=e.getAttributeNode("name"))||void 0===d?void 0:d.nodeValue;if(t){const e="Faction: ",n=t.lastIndexOf(e);if(n>=0){const r=t.slice(n+e.length);L._factions.add(r)}else{const e=_(t.trim());e!=o.NONE?L._role=e:L._keywords.add(t)}}}let W=null,z=null,I=null,B=null,P=e.querySelectorAll(":scope profiles>profile");for(let e of P){let t=null===(h=e.getAttributeNode("name"))||void 0===h?void 0:h.nodeValue,n=null===(f=e.getAttributeNode("typeName"))||void 0===f?void 0:f.nodeValue;if(t&&n)if("Unit"===n){W=new c,W._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let t of n){let n=null===(p=t.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(n&&t.textContent)switch(n){case"WS":W._ws=t.textContent;break;case"BS":W._bs=t.textContent;break;case"S":W._str=+t.textContent;break;case"T":W._toughness=+t.textContent;break;case"W":W._wounds=+t.textContent;break;case"I":W._initiative=+t.textContent;break;case"A":W._attacks=t.textContent;break;case"LD":W._leadership=+t.textContent;break;case"Save":W._save=t.textContent}if(e.parentElement&&e.parentElement.parentElement){let t=null===(m=e.parentElement.parentElement.getAttributeNode("number"))||void 0===m?void 0:m.nodeValue;t&&(W._count=+t)}}L._models.push(W)}else if("Walker"===n){z=new a,z._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(g=e.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue;if(t&&e.textContent)switch(t){case"WS":z._ws=e.textContent;break;case"BS":z._bs=e.textContent;break;case"S":z._str=+e.textContent;break;case"Front":z._front=+e.textContent;break;case"Side":z._side=+e.textContent;break;case"Rear":z._rear=+e.textContent;break;case"I":z._initiative=+e.textContent;break;case"A":z._attacks=e.textContent;break;case"HP":z._hp=+e.textContent;break;case"Type":z._type=e.textContent}}L._walkers.push(z)}else if("Vehicle"===n){I=new s,I._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(v=e.getAttributeNode("name"))||void 0===v?void 0:v.nodeValue;if(t&&e.textContent)switch(t){case"BS":I._bs=e.textContent;break;case"Front":I._front=+e.textContent;break;case"Side":I._side=+e.textContent;break;case"Rear":I._rear=+e.textContent;break;case"HP":I._hp=+e.textContent;break;case"Type":I._type=e.textContent}}L._vehicles.push(I)}else if("Flyer"===n){B=new l,B._name=t;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(b=e.getAttributeNode("name"))||void 0===b?void 0:b.nodeValue;if(t&&e.textContent)switch(t){case"BS":B._bs=e.textContent;break;case"Front":B._front=+e.textContent;break;case"Side":B._side=+e.textContent;break;case"Rear":B._rear=+e.textContent;break;case"HP":B._hp=+e.textContent;break;case"Combat Role":B._role=e.textContent;break;case"Pursuit":B._pursuit=e.textContent;break;case"Agility":B._agility=e.textContent}}L._flyers.push(B)}}for(let e of P){let t=null===(y=e.getAttributeNode("name"))||void 0===y?void 0:y.nodeValue,o=null===(w=e.getAttributeNode("typeName"))||void 0===w?void 0:w.nodeValue;if(t&&o){if("Wargear Item"===o){let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(C=e.getAttributeNode("name"))||void 0===C?void 0:C.nodeValue;n&&e.textContent&&t&&"Description"===n&&L._abilities.set(t,e.textContent)}}else if("Weapon"===o){let r=new n;r._name=t;let i=e.querySelectorAll("characteristics>characteristic");for(let e of i){let t=null===(S=e.getAttributeNode("name"))||void 0===S?void 0:S.nodeValue;if(t&&e.textContent)switch(t){case"Range":r._range=e.textContent;break;case"Type":r._type=e.textContent;break;case"Strength":r._str=e.textContent;break;case"AP":r._ap=e.textContent}}W?W._weapons.push(r):z?z._weapons.push(r):I?I._weapons.push(r):B?B._weapons.push(r):console.log("Unexpected: Created a weapon without an active model. Unit: "+R)}else if("Transport"==o){let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(E=e.getAttributeNode("name"))||void 0===E?void 0:E.nodeValue;n&&e.textContent&&t&&"Capacity"===n&&L._abilities.set(t,e.textContent)}}else if("Psychic Power"==o){let n=new i;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(x=e.getAttributeNode("name"))||void 0===x?void 0:x.nodeValue;if(t&&e.textContent)switch(t){case"Warp Charge":n._warpCharge=+e.textContent;break;case"Power Category":n._category=e.textContent;break;case"Range":n._range=e.textContent;break;case"Details":n._details=e.textContent}}W?W._psychicPowers.push(n):console.log("Unexpected: Created a psychic power without an active model. Unit: "+R)}else if("Psyker"==o){let n=new r;n._name=t;let i=e.querySelectorAll("characteristics>characteristic");for(let e of i){let t=null===(k=e.getAttributeNode("name"))||void 0===k?void 0:k.nodeValue;if(t&&e.textContent)switch(t){case"Mastery Level":n._masteryLevel=e.textContent;break;case"Disciplines":n._disciplines=e.textContent}}W?W._psyker=n:console.log("Unexpected: Created a psyker without an active model. Unit: "+R)}}else"Unit"===o||"Walker"===o||"Vehicle"===o||console.log("Unknown property type: "+o)}let M=e.querySelectorAll(":scope costs>cost");for(let e of M)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(A=e.getAttributeNode("name"))||void 0===A?void 0:A.nodeValue,n=null===(T=e.getAttributeNode("value"))||void 0===T?void 0:T.nodeValue;n&&"pts"==t&&(L._points+=+n)}let U=e.querySelectorAll(":scope rules > rule");for(let e of U)if(e.hasAttribute("name")){let t=null===(N=e.getAttributeNode("name"))||void 0===N?void 0:N.nodeValue,n=e.querySelector("description");t&&n&&n.textContent&&L._rules.set(t,n.textContent)}return L}t.Roster30k=h,t.Create30kRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new h,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"30k Army Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&("pts"===i?t._points=+o:"CP"===i&&(t._commandPoints=+o))}}(e,r),function(e,t){var n,r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new d,s=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,a=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(s&&(o._name=s),a&&(o._catalog=a),!f(o,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)if(e.hasAttribute("name")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;const n=e.querySelector("rule>description");t&&n&&o._rules.set(t,n.textContent)}}p(e,o),t._forces.push(o)}}(e,r),r}}return null}},288:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Compare=t.CompareWeapon=t.Create40kRoster=t.Costs=t.Roster40k=t.Force=t.Unit=t.Model=t.UnitRoleToString=t.UnitRole=t.PsychicPower=t.Psyker=t.Explosion=t.WoundTracker=t.Weapon=t.Upgrade=t.BaseNotes=void 0;const s=o(n(486));class a{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}t.BaseNotes=a;class l extends a{constructor(){super(...arguments),this._cost=new b,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}t.Upgrade=l;class c extends l{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._type="Melee",this._str="user",this._ap="",this._damage="",this._abilities=""}selectionName(){return this._selectionName||this.name()}}t.Weapon=c;class u extends a{constructor(){super(...arguments),this._name="",this._table=new Map}}t.WoundTracker=u;class d extends a{constructor(){super(...arguments),this._name="",this._diceRoll="",this._distance="",this._mortalWounds=""}}t.Explosion=d;class h extends a{constructor(){super(...arguments),this._cast="",this._deny="",this._powers="",this._other=""}}t.Psyker=h;class f extends a{constructor(){super(...arguments),this._name="",this._manifest=0,this._range="",this._details=""}}var p;t.PsychicPower=f,function(e){e[e.NONE=0]="NONE",e[e.SCD=1]="SCD",e[e.HQ=2]="HQ",e[e.TR=3]="TR",e[e.EL=4]="EL",e[e.FA=5]="FA",e[e.HS=6]="HS",e[e.FL=7]="FL",e[e.DT=8]="DT",e[e.FT=9]="FT",e[e.LW=10]="LW",e[e.AGENTS=11]="AGENTS",e[e.NF=12]="NF",e[e.COMMANDER=13]="COMMANDER",e[e.LEADER=14]="LEADER",e[e.SPECIALIST=15]="SPECIALIST",e[e.NON_SPECIALIST=16]="NON_SPECIALIST"}(p=t.UnitRole||(t.UnitRole={})),t.UnitRoleToString=["None","Supreme Command Detachment","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War","Agent of the Imperium","No Force Org Slot","Commander","Leader","Specialist","Non-specialist"];class _ extends a{constructor(){super(...arguments),this._count=0,this._move='0"',this._ws="",this._bs="",this._str=4,this._toughness=4,this._wounds=1,this._attacks="",this._leadership=7,this._save="",this._weapons=[],this._upgrades=[],this._psyker=null,this._psychicPowers=[],this._explosions=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(q),this._upgrades.sort(D),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}normalizeUpgrades(e){for(let t=0;t(e._count>1?`${e._count}x `:"")+e.nameAndGear())),this._weapons=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]).sort(q).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())})),this._spells.push(...this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[])),this._psykers.push(...this._models.map((e=>e._psyker)).filter((e=>e))),this._explosions.push(...this._models.map((e=>e._explosions)).reduce(((e,t)=>e.concat(t)),[]))}}t.Unit=m;class g extends a{constructor(){super(...arguments),this._catalog="",this._faction="Unknown",this._factionRules=new Map,this._configurations=[],this._rules=new Map,this._units=[]}}t.Force=g;class v extends a{constructor(){super(...arguments),this._cost=new b,this._forces=[]}}t.Roster40k=v;class b{constructor(){this._powerLevel=0,this._commandPoints=0,this._points=0}hasValues(){return 0!==this._powerLevel||0!==this._commandPoints||0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),0!==this._powerLevel&&e.push(`${this._powerLevel} PL`),0!==this._commandPoints&&e.push(`${this._commandPoints} CP`),`[${e.join(" / ")}]`}add(e){this._powerLevel+=e._powerLevel,this._commandPoints+=e._commandPoints,this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function y(e,t,n){var r;let i=e.querySelectorAll("force>selections>selection");for(let e of i){let i=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(i)if(i.includes("Detachment Command Cost"));else if("Battle Size"===i||"Gametype"===i)w(e,t);else if(e.querySelector('profile[typeName="Unit"]')){const r=O(e,n);t._units.push(r);for(const e of r._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){S(e,t._rules),w(e,t);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),S(e,t._factionRules))}}else console.log("** UNEXPECTED SELECTION **",i,e)}for(const e of t._factionRules.keys())t._rules.delete(e);t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function w(e,t){var n;const r=e.getAttribute("name");if(!r)return;const i=null===(n=e.querySelector("category"))||void 0===n?void 0:n.getAttribute("name"),o=e.querySelectorAll("selections>selection"),s=[];let a=L(e);for(const e of o)s.push(e.getAttribute("name")),a.add(L(e));let l=i&&"Configuration"!==i?`${i} - ${r}`:r;s.length>0&&(l+=`: ${s.join(", ")}`),a.hasValues()&&(l+=` ${a.toString()}`),t._configurations.push(l)}function C(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function S(e,t){const n=e.querySelectorAll("profiles>profile");for(const e of n){const n=e.getAttribute("name");if(!n)continue;const r=e.getAttribute("typeName");"Abilities"!==r&&"Dynastic Code"!==r&&"Household Tradition"!==r||z(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)E(e,t)}function E(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function x(e){switch(e){case"HQ":return p.HQ;case"Troops":return p.TR;case"Elites":return p.EL;case"Fast Attack":return p.FA;case"Heavy Support":return p.HS;case"Flyer":return p.FL;case"Dedicated Transport":return p.DT;case"Fortification":return p.FT;case"Lord of War":return p.LW;case"Agent of the Imperium":return p.AGENTS;case"No Force Org Slot":return p.NF;case"Primarch | Daemon Primarch | Supreme Commander":return p.SCD}return p.NONE}function k(e){switch(e){case"Commander":return p.COMMANDER;case"Leader":return p.LEADER;case"Specialist":return p.SPECIALIST;case"Non-specialist":return p.NON_SPECIALIST}return p.NONE}function A(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;return o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}function T(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}function N(e,t){for(const n of e.children)if("profiles"===n.tagName)for(const e of n.children)if("profile"===e.tagName&&e.getAttribute("typeName")===t)return!0;return!1}function L(e){const t=new b;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(R(e));return t}function R(e){const t=new b,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&(" PL"===n?t._powerLevel+=+r:"pts"===n?t._points+=+r:"CP"===n?t._commandPoints+=+r:t.addFreeformValue(n,+r)),t}function O(e,t){var n;let r=new m;A(e,r);let i=e.querySelectorAll("categories>category");for(let e of i){const i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(i){const e="Faction: ",n=i.lastIndexOf(e);if(n>=0){const t=i.slice(n+e.length);r._factions.add(t)}else{const e=i.trim();let n=x(e);n!=p.NONE?r._role=n:t?r._keywords.add(i):(n=k(e),n!=p.NONE?r._role=n:r._keywords.add(i))}}}const o=[],s=Array.from(e.querySelectorAll('profile[typeName="Unit"],profile[typeName="Model"]'));!function(e,t,n){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(!e||!r)return;const i=new _;i._name=e,t._modelStats.push(i),A(n,i);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"M":i._move=e.textContent;break;case"WS":i._ws=e.textContent;break;case"BS":i._bs=e.textContent;break;case"S":i._str=+e.textContent;break;case"T":i._toughness=+e.textContent;break;case"W":i._wounds=+e.textContent;break;case"A":i._attacks=e.textContent;break;case"Ld":i._leadership=+e.textContent;break;case"Save":i._save=e.textContent}}}}(s,r),o.push(...s);const a=[];if("model"===e.getAttribute("type"))a.push(e);else{const t=T(e);for(const e of t)("model"===e.getAttribute("type")||N(e,"Unit"))&&a.push(e);0===a.length&&a.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),0===a.length&&N(e,"Unit")&&a.push(e)}for(const e of a){const t=Array.from(e.querySelectorAll("profiles>profile")),n=t.filter((e=>!o.includes(e)));o.push(...n);const i=new _;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),r._models.push(i),W(t,i,r);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!N(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const n=new l;n._name=e,n._cost=L(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let c=Array.from(e.querySelectorAll("profiles>profile")).filter((e=>!o.includes(e)));if(o.push(...c),c.length>0){const t=new _;if(t._name="Unit Upgrades",W(c,t,r),t._weapons.length>0&&r._models.length>0){for(const e of r._models)e._weapons.push(...t._weapons);t._weapons.length=0}t._psychicPowers.length>0&&(r._spells.push(...t._psychicPowers),t._psychicPowers.length=0),t._psyker&&(r._psykers.push(t._psyker),t._psyker=null),t._explosions.length>0&&(r._explosions.push(...t._explosions),t._explosions.length=0);for(const n of T(e)){if("upgrade"!==n.getAttribute("type"))continue;if(a.includes(n))continue;if(n.querySelector('profiles>profile[typeName="Weapon"]'))continue;let e=n.getAttribute("name");if(!e)continue;const r=new l;r._name=e,r._cost=L(n),r._count=Number(n.getAttribute("number")),t._upgrades.push(r)}(t._weapons.length>0||t._upgrades.length>0)&&r._models.push(t)}let u=e.querySelectorAll("costs>cost");for(let e of u)r._cost.add(R(e));let d=e.querySelectorAll("rules > rule");for(let e of d)E(e,r._rules);return r.normalize(),r}function W(e,t,n){for(const r of e){const e=r.getAttribute("name"),i=r.getAttribute("typeName");if(e&&i)if("Unit"===i||"Model"===i||"model"===r.getAttribute("type"));else if("Weapon"===i){const e=I(r);t._weapons.push(e)}else if(i.includes("Wound Track")||i.includes("Stat Damage")||i.includes(" Wounds")){const e=B(r);n._woundTracker.push(e)}else if("Psychic Power"==i){const e=P(r);t._psychicPowers.push(e)}else if(i.includes("Explosion")){const e=M(r);t._explosions.push(e)}else"Psyker"==i?t._psyker=U(r):(n._abilities[i]||(n._abilities[i]=new Map),z(r,e,0,n._abilities[i]))}}function z(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic");for(const e of i){if(!e.textContent)continue;const n=e.getAttribute("name");n&&i.length>1?r.set([t,n.toString()].join(" - "),e.textContent):r.set(t,e.textContent)}}function I(e){var t;const n=new c;A(e,n),n._count=function(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"S":n._str=e.textContent;break;case"AP":n._ap=e.textContent;break;case"D":n._damage=e.textContent;break;case"Abilities":n._abilities=e.textContent}}const i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,o=null==i?void 0:i.getAttribute("name");return"upgrade"===(null==i?void 0:i.getAttribute("type"))&&o&&(n._selectionName=o,n._cost=L(i)),n}function B(e){let t=new u;A(e,t);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){const n=e.getAttribute("name");n&&(e.textContent?t._table.set(n,e.textContent):t._table.set(n,"-"))}return t}function P(e){const t=new f;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(let e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Range":t._range=e.textContent;break;case"Warp Charge":t._manifest=+e.textContent;break;case"Details":t._details=e.textContent}}return t}function M(e){const t=new d;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(const e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Dice Roll":t._diceRoll=e.textContent;break;case"Distance":t._distance=e.textContent;break;case"Mortal Wounds":t._mortalWounds=e.textContent}}return t}function U(e){const t=new h;A(e,t);const n=e.querySelectorAll("characteristics>characteristic");for(const e of n){const n=e.getAttribute("name");if(n&&e.textContent)switch(n){case"Cast":t._cast=e.textContent;break;case"Deny":t._deny=e.textContent;break;case"Powers Known":t._powers=e.textContent;break;case"Other":t._other=e.textContent}}return t}function D(e,t){return H(e._name,t._name)}function F(e,t){return e._name===t._name?H(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:H(e._name,t._name)}function q(e,t){return(e._type.startsWith("Grenade")?2:e._type.startsWith("Melee")?1:0)-(t._type.startsWith("Grenade")?2:t._type.startsWith("Melee")?1:0)||e.name().localeCompare(t.name())}function H(e,t){return e>t?1:e==t?0:-1}t.Costs=b,t.Create40kRoster=function(e,t=!0){var n;if(e){let r=e.querySelector("roster");if(r){const i=new v,o=null===(n=r.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;i._name=o||"40k Army Roster";let s=r.querySelector("customNotes");return s&&(i._customNotes=s.textContent),function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(R(e))}(e,i),function(e,t,n){var r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new g,s=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,a=null===(i=e.getAttributeNode("catalogueName"))||void 0===i?void 0:i.nodeValue;if(s&&(o._name=s),a&&(o._catalog=a),!C(o,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)E(e,o._rules)}y(e,o,n),t._forces.push(o)}}(e,i,t),i}}return null},t.CompareWeapon=q,t.Compare=H},208:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Wh40k=void 0;const s=o(n(486));!function(e){class t{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}e.BaseNotes=t;class n extends t{constructor(){super(...arguments),this._cost=new u,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}let r;e.Upgrade=n,e.Weapon=class extends n{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._attacks="1",this._skill="",this._str="user",this._ap="",this._damage="",this._abilities=""}selectionName(){return this._selectionName||this.name()}},function(e){e[e.NONE=0]="NONE",e[e.EpicHero=1]="EpicHero",e[e.Character=2]="Character",e[e.Battleline=3]="Battleline",e[e.Infantry=4]="Infantry",e[e.Vehicle=5]="Vehicle",e[e.Mounted=6]="Mounted",e[e.Transport=7]="Transport",e[e.Fortification=8]="Fortification",e[e.Allied=9]="Allied"}(r=e.UnitRole||(e.UnitRole={})),e.UnitRoleToString=["None","Epic Hero","Character","Battleline","Infantry","Vehicle","Mounted","Dedicated Transport","Fortification","Allied Unit"];class i extends t{constructor(){super(...arguments),this._count=0,this._move='0"',this._toughness=4,this._save="4+",this._wounds=1,this._leadership="6+",this._objControl=1,this._weapons=[],this._upgrades=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(A),this._upgrades.sort(x),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}normalizeUpgrades(e){for(let t=0;te[0])).flat();this._profileTables[e]._contents=t.filter(((e,t)=>n.indexOf(e[0])===t))}for(let e=0;e(e._count>1?`${e._count}x `:"")+e.nameAndGear())),this._weapons=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]).sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}}e.Unit=a;class l extends t{constructor(){super(...arguments),this._catalog="",this._faction="Unknown",this._factionRules=new Map,this._configurations=[],this._rules=new Map,this._units=[]}}e.Force=l;class c extends t{constructor(){super(...arguments),this._cost=new u,this._forces=[]}}e.Roster40k=c;class u{constructor(){this._points=0}hasValues(){return 0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),`[${e.join(" / ")}]`}add(e){this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function d(e,t,n){var r;let i=e.querySelectorAll("force>selections>selection");for(let e of i){let n=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(n)if(n.includes("Detachment Command Cost"));else if("Battle Size"===n||"Gametype"===n)h(e,t);else if(e.querySelector('profile[typeName="Unit"]')){const n=w(e);t._units.push(n);for(const e of n._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){p(e,t._rules),h(e,t);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),p(e,t._factionRules))}}else console.log("** UNEXPECTED SELECTION **",n,e)}for(const e of t._factionRules.keys())t._rules.delete(e);t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function h(e,t){var n;const r=e.getAttribute("name");if(!r)return;const i=null===(n=e.querySelector("category"))||void 0===n?void 0:n.getAttribute("name"),o=e.querySelectorAll("selections>selection"),s=[];let a=b(e);for(const e of o)s.push(e.getAttribute("name")),a.add(b(e));let l=i&&"Configuration"!==i?`${i} - ${r}`:r;s.length>0&&(l+=`: ${s.join(", ")}`),a.hasValues()&&(l+=` ${a.toString()}`),t._configurations.push(l)}function f(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function p(e,t){const n=e.querySelectorAll("profiles>profile");for(const e of n){const n=e.getAttribute("name");if(!n)continue;const r=e.getAttribute("typeName");"Abilities"!==r&&"Dynastic Code"!==r&&"Household Tradition"!==r||E(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)_(e,t)}function _(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function m(e){switch(e){case"Epic Hero":return r.EpicHero;case"Character":return r.Character;case"Battleline":return r.Battleline;case"Infantry":return r.Infantry;case"Mounted":return r.Mounted;case"Vehicle":return r.Vehicle;case"Dedicated Transport":return r.Transport;case"Fortification":return r.Fortification;case"Allied Units":return r.Allied}return r.NONE}function g(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}function v(e,t){for(const n of e.children)if("profiles"===n.tagName)for(const e of n.children)if("profile"===e.tagName&&e.getAttribute("typeName")===t)return!0;return!1}function b(e){const t=new u;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(y(e));return t}function y(e){const t=new u,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function w(e,t){var s;let l=new a;!function(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}(e,l);let c=e.querySelectorAll("categories>category");for(let e of c){const t=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(t){const e="Faction: ",n=t.lastIndexOf(e);if(n>=0){const r=t.slice(n+e.length);l._factions.add(r)}else{let e=m(t.trim());e!=r.NONE&&(l._role=e),l._keywords.add(t)}}}const u=[],d=Array.from(e.querySelectorAll('profile[typeName="Unit"],profile[typeName="Model"]'));for(const e of d){const t=e.getAttribute("name"),n=e.getAttribute("typeName");t&&n&&(l._profileTables[n]||(l._profileTables[n]=new o),S(e,t,n,l._profileTables[n]))}u.push(...d);const h=[];if("model"===e.getAttribute("type"))h.push(e);else{const t=g(e);for(const e of t)("model"===e.getAttribute("type")||v(e,"Unit"))&&h.push(e);0===h.length&&h.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),0===h.length&&v(e,"Unit")&&h.push(e)}for(const e of h){const t=Array.from(e.querySelectorAll("profiles>profile")),r=t.filter((e=>!u.includes(e)));u.push(...r);const o=new i;o._name=e.getAttribute("name")||"Unknown Model",o._count=Number(e.getAttribute("number")||1),l._models.push(o),C(t,0,l);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!v(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const r=new n;r._name=e,r._cost=b(t),r._count=Number(t.getAttribute("number")),o._upgrades.push(r)}}}let f=Array.from(e.querySelectorAll("profiles>profile")).filter((e=>!u.includes(e)));if(u.push(...f),f.length>0){const t=new i;if(t._name="Unit Upgrades",C(f,0,l),t._weapons.length>0&&l._models.length>0){for(const e of l._models)e._weapons.push(...t._weapons);t._weapons.length=0}for(const r of g(e)){if("upgrade"!==r.getAttribute("type"))continue;if(h.includes(r))continue;if(r.querySelector('profiles>profile[typeName="Weapon"]'))continue;let e=r.getAttribute("name");if(!e)continue;const i=new n;i._name=e,i._cost=b(r),i._count=Number(r.getAttribute("number")),t._upgrades.push(i)}(t._weapons.length>0||t._upgrades.length>0)&&l._models.push(t)}let p=e.querySelectorAll("costs>cost");for(let e of p)l._cost.add(y(e));let w=e.querySelectorAll("rules > rule");for(let e of w)_(e,l._rules);return l.normalize(),l}function C(e,t,n){for(const t of e){const e=t.getAttribute("name"),r=t.getAttribute("typeName");e&&r&&(t.querySelectorAll("characteristics>characteristic").length>1?(n._profileTables[r]||(n._profileTables[r]=new o),S(t,e,r,n._profileTables[r])):(n._abilities[r]||(n._abilities[r]=new Map),E(t,e,0,n._abilities[r])))}}function S(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic"),o={[n]:t};for(const e of i){if(!e.textContent)continue;const t=e.getAttribute("name");t&&(o[t]=e.textContent)}r.addRow(o)}function E(e,t,n,r){const i=e.querySelectorAll("characteristics>characteristic");for(const e of i){if(!e.textContent)continue;const n=e.getAttribute("name");n&&i.length>1?r.set([t,n.toString()].join(" - "),e.textContent):r.set(t,e.textContent)}}function x(e,t){return T(e._name,t._name)}function k(e,t){return e._name===t._name?T(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:T(e._name,t._name)}function A(e,t){return e.name().localeCompare(t.name())}function T(e,t){return e>t?1:e==t?0:-1}e.Costs=u,e.CreateRoster=function(e,t=!0){var n;if(e){let t=e.querySelector("roster");if(t){const r=new c,i=null===(n=t.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;return r._name=i||"40k Army Roster",function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(y(e))}(e,r),function(e,t,n){var r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let n=new l,o=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,s=null===(i=e.getAttributeNode("catalogueName"))||void 0===i?void 0:i.nodeValue;if(o&&(n._name=o),s&&(n._catalog=s),!f(n,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)_(e,n._rules)}d(e,n),t._forces.push(n)}}(e,r),r}}return null},e.CompareWeapon=A,e.Compare=T,e.CompareProfileTableName=function(e,t){const n=["Unit","Ranged Weapons","Melee Weapons"];return(n.includes(e)?n.indexOf(e):n.length)-(n.includes(t)?n.indexOf(t):n.length)}}(t.Wh40k||(t.Wh40k={}))},774:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CreateAoSRoster=t.RosterAoS=t.AoSForce=t.AoSUnit=t.AoSUnitRoleToString=t.AoSUnitRole=t.AoSRealmOfBattle=t.AoSSpecialRules=t.AoSCoreBattalion=t.AoSTriumph=t.AoSGrandStrategy=t.AoSAllegiance=t.AoSPrayer=t.AoSSpell=t.AoSWoundTracker=t.AoSWeapon=t.AoSProfile=t.AoSProfileType=void 0;const s=o(n(486));class a{constructor(){this._typeName="anonymous",this._fields=new Map}}t.AoSProfileType=a;class l{constructor(){this._name="none",this._value=new a}}t.AoSProfile=l;class c{constructor(){this._name="",this._type="Melee",this._range="",this._attacks="",this._toHit="",this._toWound="",this._rend="",this._damage=""}}t.AoSWeapon=c;class u{constructor(){this._title="",this._labels=[],this._table=[[]]}}t.AoSWoundTracker=u;class d{constructor(){this._name="",this._castingValue=0,this._range="",this._description=""}}t.AoSSpell=d;class h{constructor(){this._name="",this._answerValue=0,this._range="",this._description=""}}t.AoSPrayer=h;class f{constructor(){this._name="",this._battleTraits=new Map,this._commandAbilities=new Map,this._spells=[],this._extraProfiles=[]}}t.AoSAllegiance=f;class p{constructor(){this._name="",this._description=""}}t.AoSGrandStrategy=p;class _{constructor(){this._name="",this._description=""}}t.AoSTriumph=_;class m{constructor(){this._name="",this._abilities=new Map}}t.AoSCoreBattalion=m;class g{constructor(){this._name="",this._description=""}}t.AoSSpecialRules=g;class v{constructor(){this._name="",this._spells=[],this._commandAbilities=new Map,this._rules=[]}}var b;t.AoSRealmOfBattle=v,function(e){e[e.NONE=0]="NONE",e[e.LEADER=1]="LEADER",e[e.BATTLELINE=2]="BATTLELINE",e[e.BEHEMOTH=3]="BEHEMOTH",e[e.ARTILLERY=4]="ARTILLERY",e[e.OTHER=5]="OTHER",e[e.SCENERY=6]="SCENERY",e[e.BATTALION=7]="BATTALION",e[e.MALIGN_SORCERY=8]="MALIGN_SORCERY",e[e.REALM=9]="REALM"}(b=t.AoSUnitRole||(t.AoSUnitRole={})),t.AoSUnitRoleToString=["None","Leader","Battleline","Behemoth","Artillery","Other","Scenery","Battalion","Malign Sorcery","Realm"];class y{constructor(){this._name="",this._id=0,this._role=b.NONE,this._keywords=new Set,this._abilities=new Map,this._commandAbilities=new Map,this._commandTraits=new Map,this._magic=new Map,this._artefacts=new Map,this._count=0,this._move='0"',this._wounds=1,this._bravery=7,this._save="",this._weapons=[],this._spells=[],this._prayers=[],this._points=0,this._woundTracker=null,this._extraProfiles=[],this._selections=new Set}equal(e){return null!=e&&e._name===this._name&&e._role===this._role&&!!s.isEqual(this._commandTraits,e._commandTraits)&&!!s.isEqual(this._artefacts,e._artefacts)&&!!s.isEqual(this._weapons,e._weapons)}isNormalUnit(){return this._role==b.ARTILLERY||this._role==b.BATTLELINE||this._role==b.BEHEMOTH||this._role==b.LEADER||this._role==b.OTHER}}t.AoSUnit=y;class w{constructor(){this._catalog="",this._name="Unknown",this._units=[],this._battalions=[],this._rules=new Map,this._battleTactics=new Map,this._allegiance=new f,this._grandStrategy=new p,this._triumph=new _,this._realmOfBattle=new v}}t.AoSForce=w;class C{constructor(){this._commandPoints=0,this._points=0,this._name="",this._forces=[]}}function S(e){switch(e){case"Leader":return b.LEADER;case"Battleline":return b.BATTLELINE;case"Other":return b.OTHER;case"Behemoth":return b.BEHEMOTH;case"Artillery":return b.ARTILLERY;case"Scenery":return b.SCENERY;case"Battalion":return b.BATTALION;case"Malign Sorcery":return b.MALIGN_SORCERY;case"Realm":return b.REALM}return b.NONE}function E(e,t){var n,r,i,o,s,a,l;let c=e.querySelectorAll("force>selections>selection"),u=0;for(let e of c){let c=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(c)if(c.includes("Allegiance")){let n=A(e);n&&(t._allegiance=n)}else if(c.includes("Grand Strategy")){let n=T(e);n&&(t._grandStrategy=n)}else if(c.includes("Game Type"));else if(c.includes("Core Battalion")){let n=new m;n._name=c;let s=e.querySelectorAll("profiles>profile");for(let e of s)for(let e of s){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,s=null===(i=e.getAttributeNode("typeName"))||void 0===i?void 0:i.nodeValue;if(t&&s){let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue;t&&e.textContent&&n._abilities.set(t,e.textContent)}}}t._battalions.push(n)}else if(c.includes("Realm of Battle")){let n=L(e);n&&(t._realmOfBattle=n)}else if(c.includes("GHB 2023 Rules")){let n=R(e);n&&(t._realmOfBattle=n)}else if(c.includes("Triumphs")){let n=N(e);n&&(t._triumph=n)}else if(c.includes("Battle Tactic")){let n=e.querySelectorAll("profiles>profile");for(let e of n)for(let e of n){let n=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue,r=null===(a=e.getAttributeNode("typeName"))||void 0===a?void 0:a.nodeValue;if(n&&r){let r=e.querySelectorAll("characteristics>characteristic");for(let e of r)(null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue)&&e.textContent&&t._battleTactics.set(n,e.textContent)}}}else{let n=k(e);n&&n._role!=b.NONE&&(n._id=u++,t._units.push(n))}}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function x(e,t){var n;let r=e.querySelectorAll("force>rules>rule");for(let e of r){let r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,i=e.querySelectorAll("description");if(r&&i)for(let e of i)e.textContent&&t._rules.set(r,e.textContent)}}function k(e){var t,n,r,i,o,s,a,l,f,p,_,m,g,v,w;let C=new y,E=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;E&&(C._name=E);let x=e.querySelectorAll("profiles>profile");for(let e of x){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,p=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&p)if("Unit"==p){C._name||(C._name=t);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Move":C._move=e.textContent;break;case"Wounds":C._wounds=+e.textContent;break;case"Bravery":C._bravery=+e.textContent;break;case"Save":C._save=e.textContent}}}else if("Unit Abilities"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._abilities.set(t,n.textContent)}else if("Command Abilities"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._commandAbilities.set(t,n.textContent)}else if("Magic"==p){let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue;t&&e.textContent&&C._magic.set(t,e.textContent)}}else if("Unit Leader"==p){let t=e.querySelector("characteristics>characteristic");t&&t.textContent&&C._abilities.set(p,t.textContent)}else if("Spell"==p){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}C._spells.push(n)}else if("Weapon"==p){let n=new c;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(a=e.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue;if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Attacks":n._attacks=e.textContent;break;case"Rend":n._rend=e.textContent;break;case"To Hit":n._toHit=e.textContent;break;case"To Wound":n._toWound=e.textContent;break;case"Damage":n._damage=e.textContent}}C._weapons.push(n)}else if("Command Trait"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._commandTraits.set(t,n.textContent)}else if("Artefact"==p){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&C._artefacts.set(t,n.textContent)}else if("Prayer"==p){let n=new h;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue;if(t&&e.textContent)switch(t){case"Answer Value":n._answerValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}C._prayers.push(n)}else if(p.includes("Damage Table")||p.includes("Wounds")||p.includes("Wound Track")||p.includes("Wound Table")){let n=[];if(C._woundTracker){let r=e.querySelectorAll("characteristics>characteristic");if(r.length<=3){let e=t;e?n.push(e):n.push("Unknown");for(let e of r)e.textContent?n.push(e.textContent):n.push("Unknown")}else for(let e of r)e.textContent?n.push(e.textContent):n.push("Unknown");C._woundTracker._table.push(n),n=[]}else{C._woundTracker=new u,C._woundTracker._title=p;let r=e.querySelectorAll("characteristics>characteristic");if(r.length<=3){C._woundTracker._labels.push("Wounds Suffered"),n.push(t);for(let e of r){let t=null===(f=e.getAttributeNode("name"))||void 0===f?void 0:f.nodeValue;t?C._woundTracker._labels.push(t):C._woundTracker._labels.push("Unknown"),e.textContent?n.push(e.textContent):n.push("Unknown")}}else for(let e of r)e.textContent?C._woundTracker._labels.push(e.textContent):C._woundTracker._labels.push("Unknown");C._woundTracker._table.push(n),n=[]}}else{let t=O(e);t?C._extraProfiles.push(t):console.log("Unknown unit profile type: "+p)}}let k=e.querySelectorAll("selections>selection");for(let e of k){let t=null===(p=e.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(t&&(C._selections.add(t),t.includes("Wound Track"))){C._woundTracker=new u,C._woundTracker._title=t,C._woundTracker._labels=["Wounds Suffered"];let n=e.querySelectorAll("profiles>profile"),r=!0;for(let e of n){let t=null===(_=e.getAttributeNode("name"))||void 0===_?void 0:_.nodeValue,n=e.querySelectorAll("characteristics>characteristic"),i=[];t?i.push(t):i.push("--");for(let e of n){let t=null===(m=e.getAttributeNode("name"))||void 0===m?void 0:m.nodeValue,n=e.textContent;r&&(t?C._woundTracker._labels.push(t):C._woundTracker._labels.push("Unknown")),n?i.push(n):i.push("Unknown")}r=!1,C._woundTracker._table.push(i)}}}let A=e.querySelectorAll("costs>cost");for(let e of A)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(g=e.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue,n=null===(v=e.getAttributeNode("value"))||void 0===v?void 0:v.nodeValue;n&&"pts"===t&&(C._points+=+n)}let T=e.querySelectorAll(":scope categories>category");for(let e of T){let t=null===(w=e.getAttributeNode("name"))||void 0===w?void 0:w.nodeValue;if(t){var N=S(t.trim());N!=b.NONE?C._role=N:C._keywords.add(t)}}return C}function A(e){var t,n,r,i;let o=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(o){let t=new f;t._name=o;let s=e.querySelectorAll("profiles>profile");for(let e of s){let o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(o&&s)if("Battle Trait"==s){let n=e.querySelector("characteristics>characteristic");if(n){let e=n.textContent;e&&(null==t||t._battleTraits.set(o,e))}}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");if(n){let e=n.textContent;e&&(null==t||t._commandAbilities.set(o,e))}}else if("Spell"==s){let n=new d;n._name=o;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}null==t||t._spells.push(n)}else{let n=O(e);n?null==t||t._extraProfiles.push(n):console.log("Unexpected allegiance profile type: "+s)}}return t}return null}function T(e){var t,n,r;let i=null,o=e.querySelector("selections>selection");if(o){let e=null===(t=o.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;e&&(i=new p,i._name=e);let s=o.querySelectorAll("profiles>profile");for(let e of s){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&o)if("Grand Strategy"==o){let t=e.querySelector("characteristics>characteristic");if(t){let e=t.textContent;e&&i&&(i._description=e)}}else console.log("Unexpected Grand Strategy profile type: "+o)}}return i}function N(e){var t,n,r;let i=null,o=e.querySelector("selections>selection");if(o){let e=null===(t=o.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;e&&(i=new _,i._name=e);let s=o.querySelectorAll("profiles>profile");for(let e of s){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&o)if("Triumph"==o){let t=e.querySelector("characteristics>characteristic");if(t){let e=t.textContent;e&&i&&(i._description=e)}}else console.log("Unexpected Triumph profile type: "+o)}}return i}function L(e){var t,n,r,i;let o=null,s=e.querySelector("selections>selection");if(s){let e=null===(t=s.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(e){o=new v,o._name=e;let t=s.querySelectorAll("profiles>profile");for(let e of t){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&s)if("Spell"==s){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}o._spells.push(n)}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&o._commandAbilities.set(t,n.textContent)}else if("Special Rules"==s){let n=e.querySelector("characteristics>characteristic");if(n&&n.textContent){let e=new g;e._name=t,e._description=n.textContent,o._rules.push(e)}}else console.log("Unexpected Realm of Battle profile type: "+s)}}}return o}function R(e){var t,n,r,i;let o=null,s=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(s){o=new v,o._name=s;let t=e.querySelectorAll("profiles>profile");for(let e of t){let t=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(t&&s)if("Spell"==s){let n=new d;n._name=t;let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Casting Value":n._castingValue=+e.textContent;break;case"Range":n._range=e.textContent;break;case"Description":n._description=e.textContent}}o._spells.push(n)}else if("Command Abilities"==s){let n=e.querySelector("characteristics>characteristic");n&&n.textContent&&o._commandAbilities.set(t,n.textContent)}else if("Special Rules"==s||"Heroic Action"==s){let n=e.querySelector("characteristics>characteristic");if(n&&n.textContent){let e=new g;e._name=t,e._description=n.textContent,o._rules.push(e)}}else console.log("Unexpected Realm of Battle profile type: "+s)}}return o}function O(e){var t,n,r;if(!e)return null;let i=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue,o=null===(n=e.getAttributeNode("typeName"))||void 0===n?void 0:n.nodeValue;if(!i||!o)return null;let s=new l;s._name=i,s._value._typeName=o;let a=e.querySelectorAll("characteristics>characteristic");for(let e of a){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;t&&e.textContent&&s._value._fields.set(t,e.textContent)}return s}t.RosterAoS=C,t.CreateAoSRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new C,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Age of Sigmar Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&"pts"===i&&(t._points=+o)}}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new w,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;o&&(i._name=o),s&&(i._catalog=s),E(e,i),x(e,i),t._forces.push(i)}}(e,r),r}}return null}},980:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.HorusHeresy=void 0;const s=o(n(486));!function(e){let t;!function(e){e[e.NONE=0]="NONE",e[e.HQ=1]="HQ",e[e.TR=2]="TR",e[e.EL=3]="EL",e[e.FA=4]="FA",e[e.HS=5]="HS",e[e.FL=6]="FL",e[e.DT=7]="DT",e[e.FT=8]="FT",e[e.LW=9]="LW",e[e.PR=10]="PR"}(t=e.UnitRole||(e.UnitRole={})),e.UnitRoleToString=["None","HQ","Troops","Elites","Fast Attack","Heavy Support","Flyer","Dedicated Transport","Fortification","Lord of War","Primarch"];class n{constructor(){this._name="",this._customName="",this._customNotes=""}name(){return this._customName?this._customName:this._name}notes(){return this._customNotes}equal(e){return null!=e&&this._name===e._name}}e.BaseNote=n;class r extends n{constructor(){super(...arguments),this._description="",this._cost=new p,this._count=1}selectionName(){return this.name()}toString(){let e=this.selectionName();return this._count>1&&(e=`${this._count}x ${e}`),this._cost.hasValues()&&(e+=` ${this._cost.toString()}`),e}}e.Upgrade=r;class i extends r{constructor(){super(...arguments),this._selectionName="",this._range="Melee",this._str="user",this._ap="",this._type="Melee"}getRules(){let e=this._type.split(",");return e.length>0&&(e=e.slice(1).map((e=>e.trim()))),e}}e.Weapon=i;class o extends n{constructor(){super(...arguments),this._count=0,this._type="",this._weapons=[],this._upgrades=[],this._wargear=[],this._warlordTraits=[],this._reactions=[],this._psychicWeapons=[],this._psychicPowers=[]}equal(e){if(null==e)return!1;if(this._name===e._name&&this._count===e._count&&this._weapons.length===e._weapons.length&&this._upgrades.length===e._upgrades.length&&this._wargear.length===e._wargear.length&&this._psychicWeapons.length===e._psychicWeapons.length&&this._psychicPowers.length===e._psychicPowers.length){for(let t=0;t0||this._upgrades.length>0)&&(e+=` (${this.getDedupedWeaponsAndUpgrades().map((e=>e.toString())).join(", ")})`),e}getDedupedWeaponsAndUpgrades(){const e=[];for(const t of[...this._weapons,...this._upgrades])e.some((e=>t.selectionName()===e.selectionName()))||e.push(t);return e}normalize(){this._weapons.sort(N),this._upgrades.sort(A),this._wargear.sort(A),this._psychicPowers.sort(A),this._psychicWeapons.sort(N),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades),this.normalizeUpgrades(this._wargear),this.normalizeUpgrades(this._psychicPowers),this.normalizeUpgrades(this._psychicWeapons)}normalizeUpgrades(e){for(let t=0;t(e._count>1?`${e._count}x `:"")+e.nameAndGear()))}weapons(){let e=this._models.map((e=>e._weapons)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._weapons),e.sort(N).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicWeapons(){let e=this._models.map((e=>e._psychicWeapons)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._psychicWeapons),e.sort(N).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicPowers(){let e=this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._psychicPowers),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}wargear(){let e=this._models.map((e=>e._wargear)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._wargear),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}weaponRules(){let e=[];return e=this.weapons().map((e=>e.getRules())).reduce(((e,t)=>e.concat(t)),[]),e.sort().filter(((e,t,n)=>e!==n[t-1]))}warlordTraits(){let e=this._models.map((e=>e._warlordTraits)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._warlordTraits),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}upgrades(){let e=this._models.map((e=>e._upgrades)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._upgrades),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}reactions(){let e=this._models.map((e=>e._reactions)).reduce(((e,t)=>e.concat(t)),[]);return e.push(...this._reactions),e.sort(A).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}}e.Unit=d;class h extends n{constructor(){super(),this._catalog="",this._name="Unknown",this._faction="Unknown",this._factionRules=new Map,this._rules=new Map,this._units=[]}}e.Force=h;class f extends n{constructor(){super(),this._cost=new p,this._name="",this._forces=[]}}e.Roster=f;class p{constructor(){this._points=0}hasValues(){return 0!==this._points}toString(){const e=[];return 0!==this._points&&e.push(`${this._points} pts`),`[${e.join(" / ")}]`}add(e){this._points+=e._points;for(const t in e._freeformValues)this.addFreeformValue(t,e._freeformValues[t])}addFreeformValue(e,t){this._freeformValues||(this._freeformValues={});const n=this._freeformValues[e]||0;this._freeformValues[e]=n+t}}function _(e,t){return e>t?1:e==t?0:-1}function m(e,t){return typeof e>typeof t?1:typeof e==typeof t?0:-1}function g(e){const t=new p,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("Pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function v(e,n){var i,o;let s=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(!s)return;let h=null===(o=e.getAttributeNode("type"))||void 0===o?void 0:o.nodeValue;if(h)if(e.querySelector('profile[typeId="4bb2-cb95-e6c8-5a21"]')||e.querySelector('profile[typeId="2fae-b053-3f78-e7b2"]')||e.querySelector('profile[typeId="75b5-9f7a-156e-6889"]')||e.querySelector('profile[typeId="eeec-bde3-8ee4-35b0"]')){const i=function(e){var n,i,o;let s=new d;b(e,s);let h=e.querySelectorAll("categories>category");for(let e of h){const r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r){let e=x(r.trim());e!=t.NONE?s._role=e:r.endsWith(":")||s._keywords.add(r)}}const f=[],p=Array.from(e.querySelectorAll('profile[typeId="4bb2-cb95-e6c8-5a21"],profile[typeId="2fae-b053-3f78-e7b2"],profile[typeId="75b5-9f7a-156e-6889"],profile[typeId="eeec-bde3-8ee4-35b0"]'));(function(e,t,n){var r,i;for(const n of e){const e=n.getAttribute("name"),o=n.getAttribute("typeName");if(!e||!o)return;if("Unit"===o.trim()){const r=new l;r._name=e,t._modelStats.push(r),b(n,r);const i=n.querySelectorAll("characteristics>characteristic");for(const e of i){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"Move":r._move=k(e.textContent);break;case"WS":r._ws=+e.textContent;break;case"BS":r._bs=+e.textContent;break;case"S":r._str=+e.textContent;break;case"T":r._toughness=+e.textContent;break;case"W":r._wounds=+e.textContent;break;case"I":r._initiative=+e.textContent;break;case"A":r._attacks=+e.textContent;break;case"Ld":r._leadership=+e.textContent;break;case"Save":r._save=e.textContent}}}else if("Knights and Titans"===o.trim()){let r=new c;r._name=e,t._modelStats.push(r),b(n,r);const i=n.querySelectorAll("characteristics>characteristic");for(const e of i){const t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"Move":r._move=k(e.textContent);break;case"WS":r._ws=+e.textContent;break;case"BS":r._bs=+e.textContent;break;case"S":r._str=+e.textContent;break;case"Front":r._front=+e.textContent;break;case"Side":r._side=+e.textContent;break;case"Rear":r._rear=+e.textContent;break;case"I":r._initiative=+e.textContent;break;case"A":r._attacks=+e.textContent;break;case"HP":r._hp=+e.textContent}}}else if("Vehicle"===o.trim()){let i=new a;i._name=e,t._modelStats.push(i),b(n,i);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;if(t&&e.textContent)switch(t){case"Unit Type":i._type=e.textContent;break;case"Move":i._move=k(e.textContent);break;case"BS":i._bs=+e.textContent;break;case"Front":i._front=+e.textContent;break;case"Side":i._side=+e.textContent;break;case"Rear":i._rear=+e.textContent;break;case"HP":i._hp=+e.textContent;break;case"Transport Capacity":i._capacity=e.textContent;break;case"Access Points":i._accessPoints=e.textContent}}}else if("Fortification"===o.trim()){let r=new u;r._name=e,t._modelStats.push(r),b(n,r);const o=n.querySelectorAll("characteristics>characteristic");for(const e of o){const t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(t&&e.textContent)switch(t){case"Unit Type":r._type=e.textContent;break;case"BS":r._bs=e.textContent;break;case"Front":r._front=+e.textContent;break;case"Side":r._side=+e.textContent;break;case"Rear":r._rear=+e.textContent;break;case"HP":r._hp=+e.textContent;break;case"Transport Capacity":r._capacity=e.textContent;break;case"Fire Points":r._firePoints=e.textContent}}}}})(p,s),f.push(...p);const _=[];if("model"===e.getAttribute("type"))_.push(e);else{const t=function(e){const t=[];for(const n of e.children)if("selections"===n.tagName)for(const e of n.children)"selection"===e.tagName&&t.push(e);return t}(e);for(const e of t)("model"===e.getAttribute("type")||W(e,"Unit")||W(e,"Fortification")||W(e,"Vehicle")||W(e,"Knights and Titans"))&&_.push(e);0===_.length&&_.push(...Array.from(e.querySelectorAll('selection[type="model"]'))),(0===_.length&&W(e,"Unit")||W(e,"Fortification")||W(e,"Vehicle")||W(e,"Knights and Titans"))&&_.push(e)}for(const e of _){const t=Array.from(e.querySelectorAll("profiles>profile")),n=t.filter((e=>!f.includes(e)));f.push(...n);const i=new l;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),s._models.push(i),R(t,i);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){let e=t.getAttribute("name");if(e){const n=new r;n._name=e,n._cost=L(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let m=e.querySelectorAll('selections>selection[type="upgrade"]');for(const e of m){R(Array.from(e.querySelectorAll("profiles>profile")),s);const t=e.getAttribute("name");if(t){const n=new r;n._name=t,n._cost=L(e),n._count=Number(e.getAttribute("number")),s._upgrades.push(n)}}let g=e.querySelectorAll("costs>cost");for(let e of g)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue,n=null===(o=e.getAttributeNode("value"))||void 0===o?void 0:o.nodeValue;n&&"Pts"==t&&(s._points+=+n)}let v=e.querySelectorAll("rules>rule");for(let e of v)O(e,s._rules);return s.normalize(),s}(e);if(i){n._units.push(i);for(const e of i._rules.entries())n._rules.set(e[0],e[1])}}else"upgrade"===h?function(e,t){const n=e.querySelectorAll("rules>rule");for(const e of n)O(e,t)}(e,n._rules):console.log("** UNEXPECTED SELECTION **",s,h,e)}function b(e,t){var n,r;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let i=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(i=e.parentElement.parentElement),t._customName=null===(r=i.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let o=i.firstElementChild;return o&&"customNotes"===o.tagName&&(t._customNotes=o.textContent),t._name}function y(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}function w(e){var t;const n=new i;b(e,n),n._count=y(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Strength":n._str=e.textContent;break;case"AP":n._ap=e.textContent}}const o=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,s=null==o?void 0:o.getAttribute("name");return"upgrade"===(null==o?void 0:o.getAttribute("type"))&&s&&(n._selectionName=s,n._cost=L(o)),n}function C(e){var t;const n=new i;b(e,n),n._count=y(e);let r=e.querySelectorAll("characteristics>characteristic");for(let e of r){let t=e.getAttribute("name");if(t&&e.textContent)switch(t){case"Range":n._range=e.textContent;break;case"Type":n._type=e.textContent;break;case"Strength":n._str=e.textContent;break;case"AP":n._ap=e.textContent}}const o=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement,s=null==o?void 0:o.getAttribute("name");return"upgrade"===(null==o?void 0:o.getAttribute("type"))&&s&&(n._selectionName=s,n._cost=L(o)),n}function S(e){const t=new r;b(e,t),t._count=y(e);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n)if(e.textContent){let n=e.getAttribute("name");if(n)switch(n){case"Description":case"Text":t._description=e.textContent}}return t}function E(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function x(e){switch(e){case"HQ:":return t.HQ;case"Troops:":return t.TR;case"Elites:":return t.EL;case"Fast Attack:":return t.FA;case"Heavy Support:":return t.HS;case"Flyer":return t.FL;case"Transport Sub-type:":return t.DT;case"Fortification:":return t.FT;case"Lords of War:":return t.LW;case"Primarch:":return t.PR}return t.NONE}function k(e){return function(e){return null!=e&&""!==e&&!isNaN(Number(e.toString()))}(e)?e.toString()+'"':e.toString()}function A(e,t){return _(e._name,t._name)}function T(e,t){return e._name===t._name?_(e.nameAndGear(),t.nameAndGear()):_(e._name,t._name)}function N(e,t){return(e._type.startsWith("Grenade")?2:e._type.startsWith("Melee")?1:0)-(t._type.startsWith("Grenade")?2:t._type.startsWith("Melee")?1:0)||e.name().localeCompare(t.name())}function L(e){const t=new p;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(g(e));return t}function R(e,t){for(const n of e){const e=n.getAttribute("name");let r=n.getAttribute("typeName");if(e&&r)if(r=r.trim(),"Unit"===r||"Vehicle"===r||"Knights and Titans"===r||"Fortification"===r||"model"===n.getAttribute("type"));else if("Weapon"===r){const e=w(n);t._weapons.push(e)}else if("Psychic Weapon"===r){const e=C(n);t._psychicWeapons.push(e)}else if("Psychic Power"===r){const e=S(n);t._psychicPowers.push(e)}else if("Wargear Item"===r){const e=S(n);t._wargear.push(e)}else if("Warlord Trait"===r){const e=S(n);t._warlordTraits.push(e)}else if("Reactions"===r){const e=S(n);t._reactions.push(e)}else console.log("Unhandled model/unit profile "+e+" of type "+r+".")}}function O(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function W(e,t){var n;for(const r of e.children)if("profiles"===r.tagName)for(const e of r.children)if("profile"===e.tagName&&(null===(n=e.getAttribute("typeName"))||void 0===n?void 0:n.trim())===t)return!0;return!1}e.Costs=p,e.Compare=_,e.CompareModelTypes=m,e.CreateRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new f,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Horus Heresy Army Roster",function(e,t){let n=e.querySelectorAll("roster>costs>cost");for(let e of n)t._cost.add(g(e))}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new h,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(o&&(i._name=o),s&&(i._catalog=s),!E(i,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)O(e,i._rules)}let a=e.querySelectorAll(":scope>selections>selection");for(let e of a)v(e,i);i._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1)),t._forces.push(i)}}(e,r),r}}return null},e.CompareWeapon=N}(t.HorusHeresy||(t.HorusHeresy={}))},249:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Compare=t.CreateKT21Roster=t.RosterKT21=t.Force=t.Operative=t.OperativeRoleToString=t.Specialism=t.PsychicPowerWeapon=t.PsychicPower=t.UniqueActions=t.Weapons=t.BaseNotes=void 0;const s=o(n(486));class a{constructor(){this._name="",this._customName="",this._customNotes="",this._costs="0"}name(){return this._customName?this._customName:this._name}nameAndCosts(){let e=this._name;return this._customName&&(e=this._customName),this.costs()>0&&(e+=" ("+this.costs()+" EP)"),e}notes(){return this._customNotes}costs(){return Math.floor(+this._costs)}equal(e){return null!=e&&this._name===e._name}}t.BaseNotes=a;class l extends a{constructor(){super(...arguments),this._count=0,this._attacks="0",this._skill="0+",this._damage="0/0",this._rules="",this._criticalEffects=""}}t.Weapons=l,t.UniqueActions=class extends a{constructor(){super(...arguments),this._description=""}};class c extends a{constructor(){super(...arguments),this._effect="",this._weapons=[]}}var u;t.PsychicPower=c,t.PsychicPowerWeapon=class extends l{},function(e){e[e.NONE=0]="NONE",e[e.COMBAT=1]="COMBAT",e[e.STAUNCH=2]="STAUNCH",e[e.MARKSMAN=3]="MARKSMAN",e[e.SCOUT=4]="SCOUT"}(u=t.Specialism||(t.Specialism={})),t.OperativeRoleToString=["None","Combat","Staunch","Marksman","Scout"];class d extends a{constructor(){super(...arguments),this._role=u.NONE,this._model="",this._factions=new Set,this._keywords=new Set,this._abilities=new Map,this._rules=new Map,this._move='0"',this._apl="0",this._groupActivations="0",this._defence=0,this._saves="0+",this._wounds=0,this._weapons=[],this._upgrades=[],this._psychicPowers=[],this._psychicPowersWeapon=[]}equal(e){if(null==e)return!1;if(e._name===this._name&&e._role===this._role&&e._weapons.length===this._weapons.length){for(let t=0;t0||this._upgrades.length>0){let t=0;e+=" (";for(const n of this._weapons)e+=n.name(),t++,t!=this._weapons.length&&(e+=", ");this._upgrades.length>0&&!e.endsWith("(")&&(e+=", "),e+=this._upgrades.join(", "),e+=")"}return e}normalize(){this._weapons.sort(S),this._upgrades.sort(E);for(let e=0;eselections>selection");for(let e of r){let r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r&&"Game Type"!==r)if(r.includes("Detachment Command Cost"))console.log("Found Detachment Command Cost");else{let n=w(e);if(n){n._keywords.has("Leader")?t._leader=n:t._operatives.push(n);for(const e of n._rules.entries())t._rules.set(e[0],e[1])}else if("upgrade"===e.getAttribute("type")){m(e,t._rules);const n=e.querySelectorAll("selections>selection");for(let e of n){const n=e.getAttribute("name");n&&"upgrade"===e.getAttribute("type")&&("Unknown"===t._faction&&(t._faction=n),m(e,t._factionRules))}}}}for(const e of t._factionRules.keys())t._rules.delete(e);t._operatives.sort(((e,t)=>e._role>t._role?1:e._role==t._role?e._name>t._name?1:e._name==t._name?0:-1:-1))}function _(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function m(e,t){var n,r,i,o,s;const a=e.querySelectorAll(":scope profiles>profile");for(const l of a){const a=null===(n=l.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,c=null===(r=l.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;if(console.log("Prop name:"+a+" Type: "+c),a&&c)if("Abilities"===c||"Dynastic Code"===c){const e=l.querySelectorAll("characteristics>characteristic");for(const n of e){const e=null===(i=n.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;e&&n.textContent&&a&&("Description"!==e&&"Ability"!==e&&"Effect"!=e||t.set(a,n.textContent))}}else if("Weapons"===c){const n=e.querySelectorAll("rules>rule");for(const e of n)e.getAttributeNode("name")&&t.set(null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue,null===(s=e.firstChild)||void 0===s?void 0:s.textContent)}}}function g(e){switch(e){case"Combat":return u.COMBAT;case"Staunch":return u.STAUNCH;case"Marksman":return u.MARKSMAN;case"Scout":return u.SCOUT}return u.NONE}function v(e,t){var n,r;let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("typeName"))||void 0===r?void 0:r.nodeValue;console.log("Unknown profile type: "+o+" with name: "+i+". Found in operative: "+t._name)}function b(e,t){var n,r,i;t._name=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;let o=e;"profile"===e.tagName&&e.parentElement&&e.parentElement.parentElement&&(o=e.parentElement.parentElement),t._customName=null===(r=o.getAttributeNode("customName"))||void 0===r?void 0:r.nodeValue;let s=o.firstElementChild;if(s&&"customNotes"===s.tagName&&(t._customNotes=s.textContent),"selection"===o.tagName){let e=o.querySelector("costs>cost");e&&e.getAttributeNode("value")&&(t._costs=null===(i=e.getAttributeNode("value"))||void 0===i?void 0:i.nodeValue)}return t._name}function y(e){var t;if(e.parentElement&&e.parentElement.parentElement){const n=null===(t=e.parentElement.parentElement.getAttributeNode("number"))||void 0===t?void 0:t.nodeValue;if(n)return+n}return 0}function w(e){var t,n,r,i,o;let s=new d;b(e,s);let a=e.querySelectorAll(":scope categories>category");for(let e of a){const n=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;if(n){const e="Faction: ",t=n.lastIndexOf(e);if(t>=0){const r=n.slice(t+e.length);s._factions.add(r)}else{let e=g(n.trim());e!=u.NONE?s._role=e:s._keywords.add(n)}}}let l=[],c=[];for(let t of e.querySelectorAll('profile[typeName="Operative"]')){let e=null===(n=t.parentElement)||void 0===n?void 0:n.parentElement;if(!e||c.includes(e))continue;c.push(e);let r=Array.from(e.querySelectorAll(":scope profiles>profile")||[]);C(r,s),l=l.concat(r)}C(Array.from(e.querySelectorAll(":scope profiles>profile")).filter((e=>!l.includes(e))),s,0,!0);let h=e.querySelectorAll(":scope costs>cost");for(let e of h)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue,n=null===(i=e.getAttributeNode("value"))||void 0===i?void 0:i.nodeValue;" EP"==t&&n&&+n>0&&(s._costs=(s.costs()+parseInt(n)).toString())}let f=e.querySelectorAll("rules > rule");for(let e of f)if(e.hasAttribute("name")){let t=null===(o=e.getAttributeNode("name"))||void 0===o?void 0:o.nodeValue,n=e.querySelector("description");t&&n&&n.textContent&&s._rules.set(t,n.textContent)}return s.normalize(),s}function C(e,t,n,r=!1){var i,o,s,a,u,d,h,f,p,_,g,w;for(let n of e){const e=null===(i=n.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue,r=null===(o=n.getAttributeNode("typeName"))||void 0===o?void 0:o.nodeValue;if(e&&r)if("Operative"===r){let e=t._name;b(n,t),t._model=t._name,t._name=e;let r=n.querySelectorAll("characteristics>characteristic");for(let e of r){let n=null===(s=e.getAttributeNode("name"))||void 0===s?void 0:s.nodeValue;if(n&&e.textContent)switch(n){case"M":t._move=e.textContent;break;case"APL":t._apl=e.textContent;break;case"GA":t._groupActivations=e.textContent;break;case"DF":t._defence=+e.textContent;break;case"SV":t._saves=e.textContent;break;case"W":t._wounds=+e.textContent}}}else if("Abilities"===r||"Equipment"===r||"Ability"===r||"Unique Actions"===r){let r=n.querySelectorAll("characteristics>characteristic");for(let i of r)if((null===(a=i.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue)&&i.textContent&&e){let r=null===(d=null===(u=n.parentElement)||void 0===u?void 0:u.parentElement)||void 0===d?void 0:d.querySelector("costs>cost"),o=e;if(r&&(null===(h=r.getAttributeNode("value"))||void 0===h?void 0:h.nodeValue)){let e=null===(f=r.getAttributeNode("value"))||void 0===f?void 0:f.nodeValue;e&&+e>0&&(o+=" ("+Math.floor(+e)+" EP)")}t._abilities.set(o,i.textContent)}if(n.parentElement&&n.parentElement.parentElement){const r=n.parentElement.parentElement;"upgrade"===(null===(p=r.getAttributeNode("type"))||void 0===p?void 0:p.nodeValue)&&r.parentElement&&r.parentElement.parentElement&&"model"===(null===(_=r.parentElement.parentElement.getAttributeNode("type"))||void 0===_?void 0:_.nodeValue)&&t._upgrades.push(e)}}else if("Weapons"===r){let e=new l;b(n,e),n.parentElement&&n.parentElement.parentElement&&m(n.parentElement.parentElement,t._rules),e._count=y(n);let r=n.querySelectorAll("characteristics>characteristic");for(let t of r){let n=null===(g=t.getAttributeNode("name"))||void 0===g?void 0:g.nodeValue;if(n&&t.textContent)switch(n){case"A":e._attacks=t.textContent;break;case"WS/BS":e._skill=t.textContent;break;case"D":e._damage=t.textContent;break;case"SR":e._rules=t.textContent;break;case"!":e._criticalEffects=t.textContent}}t._weapons.push(e)}else if("Psychic Power"==r){let e=new c;b(n,e);let r=n.querySelectorAll("characteristics>characteristic");for(let t of r)"Effect"===(null===(w=t.getAttributeNode("name"))||void 0===w?void 0:w.nodeValue)&&t.textContent&&(e._effect=t.textContent);t._psychicPowers.push(e)}else v(n,t)}}function S(e,t){return E(e._name,t._name)}function E(e,t){return e>t?1:e==t?0:-1}t.RosterKT21=f,t.CreateKT21Roster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new f,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Kill Team (2021) Army Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&" EP"==i&&(t._equipmentPoints=+o)}}(e,r),function(e,t){var n,r,i;let o=e.querySelectorAll("roster>forces>force");for(let e of o)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let o=new h,l=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,c=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;if(l&&(o._name=l),c&&(o._catalog=c,o._faction=c),!_(o,t)){var s=e.querySelectorAll("force>rules>rule");for(let e of s)if(e.hasAttribute("name")){let t=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;var a=e.querySelector("rule>description");t&&a&&o._rules.set(t,a.textContent)}}p(e,o),t._forces.push(o)}}(e,r),r}}return null},t.Compare=E},452:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateMESBGRoster=void 0;const n=/\r\n|\r|\n| /,r=e=>{var t;return null!==(t=e.getAttribute("catalogueName"))&&void 0!==t?t:"MESBG Force"},i=e=>{var t;const n={half:0,quarter:0,modelCount:0};for(let r of e.querySelectorAll("rules>rule")){const e=null!==(t=r.getAttribute("name"))&&void 0!==t?t:"";if(e.endsWith("is halfway. (model)")){const t=parseFloat(e);isNaN(t)||(n.half=Math.ceil(t))}if(e.endsWith("models remaining. (model)")){const t=parseFloat(e);isNaN(t)||(n.quarter=Math.ceil(t))}if(e.endsWith("total models in Army. (model)")){const t=parseFloat(e);isNaN(t)||(n.modelCount=t)}}return n},o=e=>{var t,r,i,o,s,a,l,c,u,d,h,f,p,_,m,g,v,b,y;let w="",C="",S="",E=[],x="",k=!1;const A=[];for(let u of e.querySelectorAll('profiles > profile[typeName="Hero"]'))for(let e of u.querySelectorAll("characteristics > characteristic"))switch(null!==(r=null===(t=e.getAttribute("name"))||void 0===t?void 0:t.trim())&&void 0!==r?r:""){case"Might":S=null!==(i=e.textContent)&&void 0!==i?i:"";break;case"Fate":w=null!==(o=e.textContent)&&void 0!==o?o:"";break;case"Will":C=null!==(s=e.textContent)&&void 0!==s?s:"";break;case"Heroic Actions":E=null!==(l=null===(a=e.textContent)||void 0===a?void 0:a.split(n))&&void 0!==l?l:[];break;case"Heroic Tier":x=null!==(c=e.textContent)&&void 0!==c?c:""}for(let t of e.querySelectorAll('profile[typeName="Magical Power"]')){const e=null!==(u=t.getAttribute("name"))&&void 0!==u?u:"Unnamed Magic Power",n=null!==(h=null===(d=t.querySelector(':scope characteristic[name~="Duration"]'))||void 0===d?void 0:d.textContent)&&void 0!==h?h:"",r=null!==(p=null===(f=t.querySelector(':scope characteristic[name~="Range"]'))||void 0===f?void 0:f.textContent)&&void 0!==p?p:"",i=null!==(m=null===(_=t.querySelector(':scope characteristic[name~="Casting"]'))||void 0===_?void 0:_.textContent)&&void 0!==m?m:"",o=null!==(v=null===(g=t.querySelector(':scope characteristic[name~="Rule"]'))||void 0===g?void 0:g.textContent)&&void 0!==v?v:"",s=null!==(y=null===(b=t.querySelector(':scope characteristic[name~="Channelled"]'))||void 0===b?void 0:b.textContent)&&void 0!==y?y:"";A.push({name:e,duration:n,range:r,casting:i,normalEffect:o,channelledEffect:s})}return k=!!e.querySelector('selections > selection[name$="Leader (Valour)"]'),{fate:w,will:C,might:S,heroicTier:x,actions:E,magicalPowers:A,isLeader:k}},s=e=>{var t,r,i,a,u,d,h,f,p,_,m,g,v,b,y,w,C,S,E,x,k,A,T,N,L;const R=(e=>{var t,n,r;const i=[];for(let o of e)if(o.hasAttribute("name")){const e=null!==(t=o.getAttribute("name"))&&void 0!==t?t:null,s=null!==(r=null===(n=o.querySelector("rule>description"))||void 0===n?void 0:n.textContent)&&void 0!==r?r:"";null!==e&&i.push({name:e,ruleText:s})}return i})(null!==(t=e.querySelectorAll("rules > rule"))&&void 0!==t?t:[]),O=null!==(i=null===(r=e.getAttribute("name"))||void 0===r?void 0:r.trim())&&void 0!==i?i:"Unknown Model Name";let W=[];const z=[];let I,B,P="",M="",U="",D="",F="",q="",H="";e.querySelectorAll("profiles > profile");for(let t of e.querySelectorAll(":scope profiles > profile")){const r=t.getAttribute("typeName"),i=null!==(u=null===(a=t.getAttribute("name"))||void 0===a?void 0:a.trim())&&void 0!==u?u:"wowza";if(("Hero"===r||"Warrior"===r)&&i.startsWith(O)){for(let e of t.querySelectorAll("characteristics > characteristic"))switch(null!==(h=null===(d=e.getAttribute("name"))||void 0===d?void 0:d.trim())&&void 0!==h?h:""){case"Wounds":q=null!==(f=e.textContent)&&void 0!==f?f:"";break;case"Courage":H=null!==(p=e.textContent)&&void 0!==p?p:"";break;case"Attack":F=null!==(_=e.textContent)&&void 0!==_?_:"";break;case"Defense":D=null!==(m=e.textContent)&&void 0!==m?m:"";break;case"Strength":U=null!==(g=e.textContent)&&void 0!==g?g:"";break;case"Fight":M=null!==(v=e.textContent)&&void 0!==v?v:"";break;case"Movement":P=null!==(b=e.textContent)&&void 0!==b?b:"";break;case"Keywords":W=null!==(w=null===(y=e.textContent)||void 0===y?void 0:y.split(n))&&void 0!==w?w:[]}for(let t of null!==(C=l(e))&&void 0!==C?C:[]){if("Shield"===t.getAttribute("name")||t.querySelector('profile[typeName$="Wargear"]')||t.querySelector('profile[typeName$="Shooting Weapon"]')){const e=null!==(S=t.getAttribute("name"))&&void 0!==S?S:"Equipment",n=parseInt(null!==(x=null===(E=t.querySelector('cost[name$="Points"]'))||void 0===E?void 0:E.getAttribute("value"))&&void 0!==x?x:"0"),r=[];for(let e of t.querySelectorAll("characteristics > characteristic"))null!==e.textContent&&r.push(e.textContent);z.push({name:e,points:n,rules:r})}t.querySelector('profile[typeName$="Warrior"]')&&(I=s(null===(A=null===(k=t.querySelector('profile[typeName$="Warrior"]'))||void 0===k?void 0:k.parentElement)||void 0===A?void 0:A.parentElement))}"Hero"===r&&(B=o(e))}}let j=0;for(let t of null!==(T=c(e))&&void 0!==T?T:[])"Points"===(null===(N=t.getAttribute("name"))||void 0===N?void 0:N.trim())&&(j=parseInt(null!==(L=t.getAttribute("value"))&&void 0!==L?L:"0"));return{name:O,points:j,keywords:W,rules:R,profile:{attack:F,courage:H,defense:D,fight:M,movement:P,strength:U,wounds:q},wargear:z,mount:I,heroStuff:B}},a=e=>{var t,n,r,i;const o=[];for(let a of null!==(t=l(e))&&void 0!==t?t:[]){const e=a.querySelector('selection[type~="model"]');if(null!==e){const t=s(a),l=parseInt(null!==(n=e.getAttribute("number"))&&void 0!==n?n:"0"),c=parseInt(null!==(i=null===(r=e.querySelector('cost[name~="Points"]'))||void 0===r?void 0:r.getAttribute("value"))&&void 0!==i?i:"0");o.push({model:t,count:l,points:c})}}return o},l=e=>{var t,n;return null!==(n=null===(t=e.querySelector("selections"))||void 0===t?void 0:t.querySelectorAll(":scope > selection"))&&void 0!==n?n:null},c=e=>{var t,n;return null!==(n=null===(t=e.querySelector("costs"))||void 0===t?void 0:t.querySelectorAll(":scope > cost"))&&void 0!==n?n:null},u=e=>{let t=null,n=[];const r=l(e);if(null===r)return r;for(let e of r)"model"===e.getAttribute("type")&&(t=s(e)),"Warband"===e.getAttribute("name")&&(n=a(e));return null!==t?{leader:t,warband:n}:null},d=e=>{var t;let n=!1;for(let r of null!==(t=l(e))&&void 0!==t?t:[])"model"===r.getAttribute("type")&&(n=!0);return n};t.CreateMESBGRoster=function(e){var t,n;if(e){const o=null!==(n=null===(t=e.querySelector("roster"))||void 0===t?void 0:t.getAttribute("name"))&&void 0!==n?n:"Middle-Earth Stratgegy Battle Game Roster",{points:s,warriors:a}=(e=>{var t,n,r,i;const o=e.querySelectorAll("roster>costs>cost");let s=0,a=0;for(let e of o)"Points"===(null===(t=e.getAttribute("name"))||void 0===t?void 0:t.trim())&&(s=parseInt(null!==(n=e.getAttribute("value"))&&void 0!==n?n:"0")),"Warriors"===(null===(r=e.getAttribute("name"))||void 0===r?void 0:r.trim())&&(a=parseInt(null!==(i=e.getAttribute("value"))&&void 0!==i?i:"0"));return{points:s,warriors:a}})(e),c=(e=>{var t,n,o;const s=e.querySelectorAll("roster>forces>force"),a=[];for(let e of s){const s=r(e);let c={half:0,quarter:0,modelCount:0};const h=[],f=[],p=l(e);if(null!==p){for(let e of p)if("Determine Breakpoint & 25%"===e.getAttribute("name"))c=i(e);else if(d(e)){const t=u(e);null!==t&&h.push(t)}else{const r=e.querySelectorAll("rules > rule");for(let e of r){const r=null!==(n=null===(t=e.querySelector("description"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:"";f.push({name:null!==(o=e.getAttribute("name"))&&void 0!==o?o:"",ruleText:r})}}a.push({name:s,breakpoints:c,units:h,armyBonus:f})}}return a})(e);return{name:o,forces:c,points:s,warriors:a}}return alert("Bad Input File"),null}},320:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateWarcryRoster=t.RosterWarcry=t.WarcryForce=t.WarcryUnit=t.WarcryDamageTable=t.WarcryUnitRoleToString=t.WarcryUnitRole=t.WarcryWeapon=t.WarcryAllegiance=void 0;class n{constructor(){this._name="",this._rules=new Map}}t.WarcryAllegiance=n;class r{constructor(){this._name="",this._range="",this._attacks="",this._strength="",this._damage=""}}var i;t.WarcryWeapon=r,function(e){e[e.NONE=0]="NONE",e[e.LEADER=1]="LEADER",e[e.FIGHTER=2]="FIGHTER",e[e.ALLY=3]="ALLY",e[e.MONSTER=4]="MONSTER",e[e.HERO=5]="HERO",e[e.THRALL=6]="THRALL"}(i=t.WarcryUnitRole||(t.WarcryUnitRole={})),t.WarcryUnitRoleToString=["None","Leader","Fighter","Ally","Monster","Hero","Thrall"];class o{constructor(){this._name="",this._table=new Map}}t.WarcryDamageTable=o;class s{constructor(){this._name="",this._role=i.NONE,this._faction="chaos-iron-golems",this._keywords=new Set,this._abilities=new Map,this._move="1",this._wounds="1",this._toughness="1",this._weapons=[],this._damageTable=[],this._points=0}}t.WarcryUnit=s;class a{constructor(){this._catalog="",this._name="Unknown",this._units=[],this._allegiance=new n}}t.WarcryForce=a;class l{constructor(){this._points=0,this._name="",this._forces=[]}}function c(e){const t=e.toLowerCase();return t.includes("chaotic beasts")?"monster-chaotic-beasts":t.includes("monster")?t.includes("order")?"monster-of-order":t.includes("destruction")?"monster-of-destruction":t.includes("death")?"monster-of-death":"monster-chaotic-beasts":t.includes("beasts of chaos")?"factions-chaos-beasts-of-chaos":t.includes("corvus")?"factions-chaos-corvus-cabal":t.includes("cypher")?"factions-chaos-cypher-lords":t.includes("everchosen")?"factions-chaos-everchosen":t.includes("golems")?"factions-chaos-iron-golems":t.includes("khorne")&&t.includes("bloodbound")?"factions-chaos-khorne-bloodbound":t.includes("khorne")&&t.includes("daemon")?"factions-chaos-khorne-daemons":t.includes("nurgle")&&t.includes("rotbringer")?"factions-chaos-nurgle-rotbringers":t.includes("nurgle")&&t.includes("daemon")?"factions-chaos-nurgle-daemons":t.includes("scions")?"factions-chaos-scions-of-the-flame":t.includes("skaven")?"factions-chaos-skaven":t.includes("slaanesh")&&t.includes("sybariteI g")?"factions-chaos-slaanesh-syberites":t.includes("slaanesh")&&t.includes("daemon")?"factions-chaos-slaanesh-daemons":t.includes("slaves")?"factions-chaos-slaves-to-darkness":t.includes("spire")?"factions-chaos-spire-tyrants":t.includes("splintered")?"factions-chaos-splintered-fang":t.includes("unmade")?"factions-chaos-the-unmade":t.includes("tzeentch")&&t.includes("arcanite")?"factions-chaos-tzeentch-arcanites":t.includes("tzeentch")&&t.includes("daemon")?"factions-chaos-tzeentch-daemons":t.includes("untamed")?"factions-chaos-untamed-beasts":t.includes("flesh")?"factions-death-flesh-eater-courts":t.includes("nagash")?"factions-death-legions-of-nagash":t.includes("nighthaunt")?"factions-death-nighthaunt":t.includes("ossiarch")?"factions-death-ossiarch-bonereapers":t.includes("soulblight")?"factions-death-soulblight-gravelords":t.includes("bonesplitterz")?"factions-destruction-bonesplitterz":t.includes("fimirach")?"factions-destruction-fimirach":t.includes("gloomspite")?"factions-destruction-gloomspite-gitz":t.includes("ironjawz")?"factions-destruction-ironjawz":t.includes("kruleboyz")?"factions-destruction-kruleboyz":t.includes("ogor")?"factions-destruction-ogor-mawtribes":t.includes("cities of sigmar")?"factions-order-cities-of-sigmar":t.includes("khaine")?"factions-order-daughters-of-khaine":t.includes("fyreslayers")?"factions-order-fyreslayers":t.includes("idoneth")?"factions-order-idoneth-deepkin":t.includes("shadowstalkers")?"factions-order-khainite-shadowstalkers":t.includes("kharadron")?"factions-order-kharadron-overlords":t.includes("lumineth")?"factions-order-lumineth-realmlords":t.includes("seraphon")?"factions-order-seraphon":t.includes("stormcast")?t.includes("sacrosanct")?"factions-order-stormcast-eternals-sacrosanct":t.includes("thunderstrike")?"factions-order-stormcast-eternals-thunderstrike":t.includes("vanguard")?"factions-order-stormcast-eternals-vanguard":"factions-order-stormcast-eternals-warrior":t.includes("sylvaneth")?"factions-order-sylvaneth":""}function u(e,t){var r;let i=new n,o=e.querySelectorAll("rules>rule");for(let e of o)if(e.hasAttribute("name")){let t=null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue;var s=e.querySelector("rule>description");t&&s&&s.textContent&&i._rules.set(t,s.textContent)}t._allegiance=i}function d(e,t){var n,r;let o=e.querySelectorAll("force>selections>selection");for(let e of o){if(!(null===(n=e.getAttributeNode("type"))||void 0===n?void 0:n.nodeValue))continue;if(!(null===(r=e.getAttributeNode("name"))||void 0===r?void 0:r.nodeValue))continue;let o=h(e);o&&o._role!=i.NONE&&t._units.push(o)}t._units.sort(((e,t)=>e._role>t._role?1:e._role==t._role?0:-1))}function h(e){var t,n,a,l,u,d,h,f,p;let _=new s,m=e.querySelectorAll("profiles>profile");for(let e of m){let i=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue,s=null===(n=e.getAttributeNode("typeName"))||void 0===n?void 0:n.nodeValue;if(i&&s)if("Model"==s){_._name=i;let t=e.querySelectorAll("characteristics>characteristic");for(let e of t){let t=null===(a=e.getAttributeNode("name"))||void 0===a?void 0:a.nodeValue;if(t&&e.textContent)switch(t){case"Move":_._move=e.textContent;break;case"Wounds":_._wounds=e.textContent;break;case"Toughness":_._toughness=e.textContent}}}else if("Weapon"==s){let t=new r;t._name=i;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(l=e.getAttributeNode("name"))||void 0===l?void 0:l.nodeValue;if(n&&e.textContent)switch(n){case"Range":t._range=e.textContent;break;case"Attacks":t._attacks=e.textContent;break;case"Strength":t._strength=e.textContent;break;case"Damage":t._damage=e.textContent}}_._weapons.push(t)}else if("Damage Points Allocated"==s){let t=new o;t._name=i;let n=e.querySelectorAll("characteristics>characteristic");for(let e of n){let n=null===(u=e.getAttributeNode("name"))||void 0===u?void 0:u.nodeValue;n&&i&&(e.textContent?t._table.set(n,e.textContent):t._table.set(n,"-"))}_._damageTable.push(t)}else console.log("Unknown unit profile type: "+s)}let g=e.querySelectorAll("costs>cost");for(let e of g)if(e.hasAttribute("name")&&e.hasAttribute("value")){let t=null===(d=e.getAttributeNode("name"))||void 0===d?void 0:d.nodeValue,n=null===(h=e.getAttributeNode("value"))||void 0===h?void 0:h.nodeValue;n&&"pts"===t&&(_._points+=+n)}let v=e.querySelectorAll(":scope categories>category");for(let e of v){let t=null===(f=e.getAttributeNode("name"))||void 0===f?void 0:f.nodeValue;if(t){var b=(y=t.trim()).includes("Leader")?i.LEADER:y.includes("Fighter")?i.FIGHTER:y.includes("Allies")||y.includes("Ally")?i.ALLY:y.includes("Monster")?i.MONSTER:y.includes("Hero")?i.HERO:y.includes("Thrall")?i.THRALL:i.NONE;b!=i.NONE?_._role=b:_._keywords.add(t)}}var y;let w=e.querySelectorAll(":scope selections>selection");for(let e of w){let t=null===(p=e.getAttributeNode("name"))||void 0===p?void 0:p.nodeValue;if(t){let e=c(t);e.length>0?_._faction=e:_._keywords.add(t)}}return _}t.RosterWarcry=l,t.CreateWarcryRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new l,i=null===(t=n.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;return r._name=i||"Age of Sigmar Warcry Roster",function(e,t){var n,r;let i=e.querySelectorAll("roster>costs>cost");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("value")){let i=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,o=null===(r=e.getAttributeNode("value"))||void 0===r?void 0:r.nodeValue;o&&"pts"===i&&(t._points=+o)}}(e,r),function(e,t){var n,r;let i=e.querySelectorAll("roster>forces>force");for(let e of i)if(e.hasAttribute("name")&&e.hasAttribute("catalogueName")){let i=new a,o=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue,s=null===(r=e.getAttributeNode("catalogueName"))||void 0===r?void 0:r.nodeValue;o&&(i._name=o),s&&(i._catalog=s),u(e,i),d(e,i),t._forces.push(i)}console.log(t)}(e,r),r}}return null}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n(752)})(); \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 378da61..882dda6 100644 --- a/src/app.ts +++ b/src/app.ts @@ -111,7 +111,7 @@ function parseXML(xmldata: string) { const renderer: Renderer30k = new Renderer30k(roster); renderer.render(rosterTitle, rosterList, forceUnits); } - } else if (gameType == "(HH V2) Horus Heresy (2022)") { + } else if (gameType.includes("Horus Heresy (2022)")) { const roster = HorusHeresy.CreateRoster(doc); if (roster && roster._forces.length > 0) { const renderer: RendererHH2 = new RendererHH2(roster);