diff --git a/css/prettyscribe.css b/css/prettyscribe.css index 373528a..7c75622 100644 --- a/css/prettyscribe.css +++ b/css/prettyscribe.css @@ -347,6 +347,10 @@ label { line-height: 1; } +.hh2-rule-link { + color: black; +} + .hide_enabled .hide_able:hover { background-color: rgba(128, 128, 128, .4); cursor: pointer; @@ -361,6 +365,7 @@ label { .hide_enabled .hidden { display: none; } + a, a:visited { color: black; text-decoration: none; } } .page_break { diff --git a/dist/prettyscribe.js b/dist/prettyscribe.js index 1836da6..68e3e0e 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(){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="",x="",E="",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&&(x=r(1,1)+r(l(m),4)+g,S+="up"+r(x.length,2)+x),C&&(E=r(1,1)+r(l(b),4)+y,S+="uc"+r(E.length,2)+E);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=4,d=0,h=-2,f=2,p=8,_=286,m=30,g=19,v=2*_+1,b=15,y=3,w=258,C=w+y+1,S=42,x=113,E=1,k=2,A=3,T=4;function N(e,t){return e.msg=l[t],t}function L(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 z(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,O(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function W(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function P(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-C?e.strstart-(e.w_size-C):0,c=e.window,u=e.w_mask,d=e.prev,h=e.strstart+w,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 B(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-C)){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>=y)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=y&&(e.ins_h=(e.ins_h<=y)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-y),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=y){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=y&&(e.ins_h=(e.ins_h<=y&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-y,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-y),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(B(e),0===e.lookahead&&t===c)return E;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,z(e,!1),0===e.strm.avail_out))return E;if(e.strstart-e.block_start>=e.w_size-C&&(z(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):(e.strstart>e.block_start&&(z(e,!1),e.strm.avail_out),E)})),new D(4,4,8,4,M),new D(4,5,16,8,M),new D(4,6,32,32,M),new D(4,4,16,16,U),new D(8,16,32,32,U),new D(8,16,128,128,U),new D(8,32,128,256,U),new D(32,128,258,1024,U),new D(32,258,258,4096,U)],n.deflateInit=function(e,t){return j(e,t,p,15,8,0)},n.deflateInit2=j,n.deflateReset=Y,n.deflateResetKeep=H,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?h:(e.state.gzhead=t,d):h},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5>8&255),I(i,i.gzhead.time>>16&255),I(i,i.gzhead.time>>24&255),I(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),I(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(I(i,255&i.gzhead.extra.length),I(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):(I(i,0),I(i,0),I(i,0),I(i,0),I(i,0),I(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),I(i,3),i.status=x);else{var f=p+(i.w_bits-8<<4)<<8;f|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(f|=32),f+=31-f%31,i.status=x,W(i,f),0!==i.strstart&&(W(i,e.adler>>>16),W(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)),O(e),s=i.pending,i.pending!==i.pending_buf_size));)I(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)),O(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)),O(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&&O(e),i.pending+2<=i.pending_buf_size&&(I(i,255&e.adler),I(i,e.adler>>8&255),e.adler=0,i.status=x)):i.status=x),0!==i.pending){if(O(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&L(t)<=L(n)&&t!==u)return N(e,-5);if(666===i.status&&0!==e.avail_in)return N(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var _=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(B(e),0===e.lookahead)){if(t===c)return E;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(z(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):e.last_lit&&(z(e,!1),0===e.strm.avail_out)?E:k}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===c)return E;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=y&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=y?(n=o._tr_tally(e,1,e.match_length-y),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&&(z(e,!1),0===e.strm.avail_out))return E}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):e.last_lit&&(z(e,!1),0===e.strm.avail_out)?E:k}(i,t):r[i.level].func(i,t);if(_!==A&&_!==T||(i.status=666),_===E||_===A)return 0===e.avail_out&&(i.last_flush=-1),d;if(_===k&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(R(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),O(e),0===e.avail_out))return i.last_flush=-1,d}return t!==u?d:i.wrap<=0?1:(2===i.wrap?(I(i,255&e.adler),I(i,e.adler>>8&255),I(i,e.adler>>16&255),I(i,e.adler>>24&255),I(i,255&e.total_in),I(i,e.total_in>>8&255),I(i,e.total_in>>16&255),I(i,e.total_in>>24&255)):(W(i,e.adler>>>16),W(i,65535&e.adler)),O(e),0=n.w_size&&(0===a&&(R(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,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,B(n);n.lookahead>=y;){for(r=n.strstart,o=n.lookahead-(y-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+=E[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 m(){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 g(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=h,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(f),t.distcode=t.distdyn=new r.Buf32(p),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):d}function b(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,D,2,0),w=y=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&y)<<8)+(y>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&y)){e.msg="unknown compression method",n.mode=30;break}if(w-=4,W=8+(15&(y>>>=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&&(D[0]=255&y,D[1]=y>>>8&255,n.check=o(n.check,D,2,0)),w=y=0,n.mode=3;case 3:for(;w<32;){if(0===v)break e;v--,y+=f[m++]<>>8&255,D[2]=y>>>16&255,D[3]=y>>>24&255,n.check=o(n.check,D,4,0)),w=y=0,n.mode=4;case 4:for(;w<16;){if(0===v)break e;v--,y+=f[m++]<>8),512&n.flags&&(D[0]=255&y,D[1]=y>>>8&255,n.check=o(n.check,D,2,0)),w=y=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===v)break e;v--,y+=f[m++]<>>8&255,n.check=o(n.check,D,2,0)),w=y=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(k=n.length)&&(k=v),k&&(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,f,m,k,W)),512&n.flags&&(n.check=o(n.check,f,k,m)),v-=k,m+=k,n.length-=k),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===v)break e;for(k=0;W=f[m+k++],n.head&&W&&n.length<65536&&(n.head.name+=String.fromCharCode(W)),W&&k>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;w<32;){if(0===v)break e;v--,y+=f[m++]<>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===v)break e;v--,y+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if(x(n),n.mode=20,6!==t)break;y>>>=2,w-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}y>>>=2,w-=2;break;case 14:for(y>>>=7&w,w-=7&w;w<32;){if(0===v)break e;v--,y+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&y,w=y=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(k=n.length){if(v>>=5,w-=5,n.ndist=1+(31&y),y>>>=5,w-=5,n.ncode=4+(15&y),y>>>=4,w-=4,286>>=3,w-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},P=a(0,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,P){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=N,w-=N,n.lens[n.have++]=R;else{if(16===R){for(M=N+2;w>>=N,w-=N,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}W=n.lens[n.have-1],k=3+(3&y),y>>>=2,w-=2}else if(17===R){for(M=N+3;w>>=N)),y>>>=3,w-=3}else{for(M=N+7;w>>=N)),y>>>=7,w-=7}if(n.have+k>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;k--;)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,B={bits:n.lenbits},P=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,P){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},P=a(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,P){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<=v&&258<=b){e.next_out=g,e.avail_out=b,e.next_in=m,e.avail_in=v,n.hold=y,n.bits=w,s(e,S),g=e.next_out,p=e.output,b=e.avail_out,m=e.next_in,f=e.input,v=e.avail_in,y=n.hold,w=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;L=(U=n.lencode[y&(1<>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>O)])>>>16&255,R=65535&U,!(O+(N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=O,w-=O,n.back+=O}if(y>>>=N,w-=N,n.back+=N,n.length=R,0===L){n.mode=26;break}if(32&L){n.back=-1,n.mode=12;break}if(64&L){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&L,n.mode=22;case 22:if(n.extra){for(M=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;L=(U=n.distcode[y&(1<>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>O)])>>>16&255,R=65535&U,!(O+(N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=O,w-=O,n.back+=O}if(y>>>=N,w-=N,n.back+=N,64&L){e.msg="invalid distance code",n.mode=30;break}n.offset=R,n.extra=15&L,n.mode=24;case 24:if(n.extra){for(M=n.extra;w>>=n.extra,w-=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===b)break e;if(k=S-b,n.offset>k){if((k=n.offset-k)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}A=k>n.wnext?(k-=n.wnext,n.wsize-k):n.wnext-k,k>n.length&&(k=n.length),T=n.window}else T=p,A=g-n.offset,k=n.length;for(bv?(y=B[M+d[x]],z[I+d[x]]):(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,x++,0==--W[S]){if(S===k)break;S=t[n+d[x]]}if(A>>7)]}function N(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function L(e,t,n){e.bi_valid>d-n?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=n-d):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function z(e,t,n){var r,i,o=new Array(u+1),s=0;for(r=1;r<=u;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]=O(o[a]++,a))}}function I(e){var t;for(t=0;t>1;1<=n;n--)B(e,o,n);for(i=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],B(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++,B(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,l=t.dyn_tree,d=t.max_code,h=t.stat_desc.static_tree,f=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,_=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(o=0;o<=u;o++)e.bl_count[o]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=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?Y(e,t,n,r):4===e.strategy||s===i?(L(e,2+(r?1:0),3),M(e,g,v)):(L(e,4+(r?1:0),3),function(e,t,n,r){var i;for(L(e,t-257,5),L(e,n-1,5),L(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*(y[n]+o+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){L(e,2,3),R(e,h,g),function(e){16===e.bi_valid?(N(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(q.source),J=/<%-([\s\S]+?)%>/g,G=/<%([\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",xe="a-z\\xdf-\\xf6\\xf8-\\xff",Ee="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+"]",ze="["+xe+"]",Ie="[^"+we+Ae+Re+Se+xe+Ee+"]",We="\\ud83c[\\udffb-\\udfff]",Pe="[^"+we+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Ee+"]",De="\\u200d",Fe="(?:"+ze+"|"+Ie+")",He="(?:"+Ue+"|"+Ie+")",Ye="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Le+"|"+We+")?",qe="["+ke+"]?",$e=qe+Ve+"(?:"+De+"(?:"+[Pe,Be,Me].join("|")+")"+qe+Ve+")*",Xe="(?:"+[Oe,Be,Me].join("|")+")"+$e,Je="(?:"+[Pe+Le+"?",Le,Be,Me,Te].join("|")+")",Ge=RegExp("['’]","g"),Ze=RegExp(Le,"g"),Ke=RegExp(We+"(?="+We+")|"+Je+$e,"g"),Qe=RegExp([Ue+"?"+ze+"+"+Ye+"(?="+[Ne,Ue,"$"].join("|")+")",He+"+"+je+"(?="+[Ne,Ue+Fe,"$"].join("|")+")",Ue+"?"+Fe+"+"+Ye,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[z]=it[I]=it[W]=it[P]=it[B]=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[x]=it[k]=it[A]=it[T]=it[L]=!1;var ot={};ot[_]=ot[m]=ot[R]=ot[O]=ot[g]=ot[v]=ot[z]=ot[I]=ot[W]=ot[P]=ot[B]=ot[C]=ot[S]=ot[x]=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 xt(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,xe=t.Object,Ee=t.RegExp,ke=t.String,Ae=t.TypeError,Te=r.prototype,Ne=Ce.prototype,Le=xe.prototype,Re=t["__core-js_shared__"],Oe=Ne.toString,ze=Le.hasOwnProperty,Ie=0,We=(n=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Pe=Le.toString,Be=Oe.call(xe),Me=dt._,Ue=Ee("^"+Oe.call(ze).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=pt?t.Buffer:i,Fe=t.Symbol,He=t.Uint8Array,Ye=De?De.allocUnsafe:i,je=sn(xe.getPrototypeOf,xe),Ve=xe.create,qe=Le.propertyIsEnumerable,$e=Te.splice,Xe=Fe?Fe.isConcatSpreadable:i,Je=Fe?Fe.iterator:i,Ke=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(xe,"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=xe.getOwnPropertySymbols,mt=De?De.isBuffer:i,Pt=t.isFinite,jt=Te.join,_n=sn(xe.keys,xe),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"),xn=lo(t,"Promise"),En=lo(t,"Set"),kn=lo(t,"WeakMap"),An=lo(xe,"create"),Tn=kn&&new kn,Nn={},Ln=Bo(Cn),Rn=Bo(Sn),On=Bo(xn),zn=Bo(En),In=Bo(kn),Wn=Fe?Fe.prototype:i,Pn=Wn?Wn.valueOf:i,Bn=Wn?Wn.toString:i;function Mn(e){if(ea(e)&&!Ys(e)&&!(e instanceof Hn)){if(e instanceof Fn)return e;if(ze.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 Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Yn(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=Ys(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ze.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==x||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 z:case I:case W:case P:case B: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,Pn?xe(Pn.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 Et(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=xe(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,Jt(n))),r?(o=Lt,s=!1):t.length>=200&&(o=Zt,s=!1,t=new qn(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 Yn,map:new(Sn||jn),string:new Yn}},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},qn.prototype.add=qn.prototype.push=function(e){return this.__data__.set(e,s),this},qn.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 Gs(e[t])}))}function wr(e,t){for(var n=0,r=(t=mi(t,e)).length;null!=e&&nt}function Er(e,t){return null!=e&&ze.call(e,t)}function kr(e,t){return null!=e&&t in xe(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,Jt(t))),u=gn(h.length,u),c[l]=!n&&(t||s>=120&&h.length>=120)?new qn(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&&$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 qr(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(xo(e,t,nl),e+"")}function Xr(e){return Jn(Ua(e))}function Jr(e,t){var n=Ua(e);return Oo(n,or(t,0,n.length))}function Gr(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:qi(e);if(c)return ln(c);s=!1,i=Zt,l=new qn}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=Ye?Ye(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(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=xe(t);++r-1?o[s?t[a]:a]:i}}function Pi(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 qn: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 Et(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 Hn&&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){ze.call(e,n)?++e[n]:rr(e,n,1)})),_s=Wi(Ho),ms=Wi(Yo);function gs(e,t){return(Ys(e)?Et:ur)(e,oo(t,3))}function vs(e,t){return(Ys(e)?kt:dr)(e,oo(t,3))}var bs=Ti((function(e,t,n){ze.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(Ys(e)?Rt:Pr)(e,oo(t,3))}var Ss=Ti((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),xs=$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),[])})),Es=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=Es();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=Es(),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(Es())},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 zs(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(zs.Cache||Vn),n}function Is(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)}}zs.Cache=Vn;var Ws=gi((function(e,t){var n=(t=1==t.length&&Ys(t[0])?Rt(t[0],Jt(oo())):Rt(_r(t,1),Jt(oo()))).length;return $r((function(r){for(var i=-1,o=gn(r.length,n);++i=t})),Hs=Nr(function(){return arguments}())?Nr:function(e){return ea(e)&&ze.call(e,"callee")&&!qe.call(e,"callee")},Ys=r.isArray,js=gt?Jt(gt):function(e){return ea(e)&&Sr(e)==R};function Vs(e){return null!=e&&Ks(e.length)&&!Gs(e)}function qs(e){return ea(e)&&Vs(e)}var $s=mt||_l,Xs=vt?Jt(vt):function(e){return ea(e)&&Sr(e)==v};function Js(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 Gs(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?Jt(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)!=x)return!1;var t=je(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==Be}var ia=yt?Jt(yt):function(e){return ea(e)&&Sr(e)==k},oa=wt?Jt(wt):function(e){return ea(e)&&ho(e)==A};function sa(e){return"string"==typeof e||!Ys(e)&&ea(e)&&Sr(e)==T}function aa(e){return"symbol"==typeof e||ea(e)&&Sr(e)==N}var la=Ct?Jt(Ct):function(e){return ea(e)&&Ks(e.length)&&!!it[Sr(e)]},ca=Yi(Wr),ua=Yi((function(e,t){return e<=t}));function da(e){if(!e)return[];if(Vs(e))return sa(e)?dn(e):ki(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());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)ze.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=xe(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})),Wa=Qi((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return ka(e,n)}))}(e,t)}));function Pa(e,t){if(null==e)return{};var n=Rt(to(e),(function(e){return[e]}));return t=oo(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Ba=$i(La),Ma=$i(Ra);function Ua(e){return null==e?[]:Gt(e,La(e))}var Da=zi((function(e,t,n){return t=t.toLowerCase(),e+(n?Fa(t):t)}));function Fa(e){return Ja(ga(e).toLowerCase())}function Ha(e){return(e=ga(e))&&e.replace(ve,en).replace(Ze,"")}var Ya=zi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),ja=zi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Va=Oi("toLowerCase"),qa=zi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),$a=zi((function(e,t,n){return e+(n?" ":"")+Ja(t)})),Xa=zi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ja=Oi("toUpperCase");function Ga(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 Js(e)?e:new we(e)}})),Ka=Qi((function(e,t){return Et(t,(function(t){t=Po(t),rr(e,t,Ts(e[t],e))})),e}));function Qa(e){return function(){return e}}var el=Pi(),tl=Pi(!0);function nl(e){return e}function rl(e){return zr("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=Gs(e);return Et(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(Wt);function dl(e){return vo(e)?Yt(Po(e)):function(e){return function(t){return wr(t,e)}}(e)}var hl=Hi(),fl=Hi(!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 Ys(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=Ba,Mn.toPairsIn=Ma,Mn.toPath=function(e){return Ys(e)?Rt(e,Po):aa(e)?[e]:ki(Wo(ga(e)))},Mn.toPlainObject=ma,Mn.transform=function(e,t,n){var r=Ys(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)&&Gs(o)?Un(je(e)):{}}return(i?Et: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?[]:Gt(e,Ra(e))},Mn.without=os,Mn.words=Ga,Mn.wrap=function(e,t){return Ps(_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||[],Gr)},Mn.zipWith=us,Mn.entries=Ba,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=Ha,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(q,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=Ys(e)?At:hr;return n&&go(e,t,n)&&(t=i),r(e,oo(t,3))},Mn.find=_s,Mn.findIndex=Ho,Mn.findKey=function(e,t){return Bt(e,oo(t,3),vr)},Mn.findLast=ms,Mn.findLastIndex=Yo,Mn.findLastKey=function(e,t){return Bt(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=Ea,Mn.gt=Ds,Mn.gte=Fs,Mn.has=function(e,t){return null!=e&&fo(e,t,Er)},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=Ya,Mn.last=Jo,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,xr):i},Mn.maxBy=function(e,t){return e&&e.length?fr(e,oo(t,2),xr):i},Mn.mean=function(e){return Ht(e,nl)},Mn.meanBy=function(e,t){return Ht(e,oo(t,2))},Mn.min=function(e){return e&&e.length?fr(e,nl,Wr):i},Mn.minBy=function(e,t){return e&&e.length?fr(e,oo(t,2),Wr):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=Es,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=Ys(e)?zt:Vt,i=arguments.length<3;return r(e,oo(t,4),n,i,ur)},Mn.reduceRight=function(e,t,n){var r=Ys(e)?It: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),qr(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=Ee(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=++Ie;return ga(e)+t},Mn.upperCase=Xa,Mn.upperFirst=Ja,Mn.each=gs,Mn.eachRight=vs,Mn.first=Vo,sl(Mn,(ml={},vr(Mn,(function(e,t){ze.call(Mn.prototype,t)||(ml[t]=e)})),ml),{chain:!1}),Mn.VERSION="4.17.21",Et(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),Et(["drop","take"],(function(e,t){Hn.prototype[e]=function(n){n=n===i?1:mn(fa(n),0);var r=this.__filtered__&&!t?new Hn(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},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Et(["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:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Et(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}})),Et(["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(nl)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new Hn(this):this.map((function(n){return Tr(n,e,t)}))})),Hn.prototype.reject=function(e){return this.filter(Is(oo(e)))},Hn.prototype.slice=function(e,t){e=fa(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=fa(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)},vr(Hn.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 Hn,c=a[0],u=l||Ys(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 Hn(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)})})),Et(["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(Ys(i)?i:[],e)}return this[n]((function(n){return t.apply(Ys(n)?n:[],e)}))}})),vr(Hn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[Bi(i,2).name]=[{name:"wrapper",func:i}],Hn.prototype.clone=function(){var e=new Hn(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},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=Ys(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 Hn){var t=e;return this.__actions__.length&&(t=new Hn(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,Je&&(Mn.prototype[Je]=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(467),c=n(391),u=n(544),d=n(980),h=n(66),f=n(774),p=n(964),_=n(320),m=n(717),g=i(n(733)),v=n(486);let b=null;$("#roster-file").on("change",(function(e){let t,n;if(t="resize"===(null==e?void 0:e.type)?null==b?void 0:b.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)&&(b=e);const t=new FileReader;t.onerror=()=>{t.abort(),(0,v.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 g=$("#roster-title")[0],v=$("#roster-lists")[0],b=$("#force-units")[0];if("Warhammer 40,000 8th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}else if("Warhammer 40,000 9th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}else if("Warhammer 40,000: Kill Team (2018)"==r){const e=(0,a.Create40kRoster)(t,!1);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}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(g,v,b)}else if("Age of Sigmar"==r){const e=(0,f.CreateAoSRoster)(t);e&&new p.RendererAoS(e).render(g,v,b)}else if("Warhammer Age of Sigmar: Warcry"==r){const e=(0,_.CreateWarcryRoster)(t);e&&new m.RendererWarcry(e).render(g,v,b)}else if("Warhammer 30,000 - The Horus Heresy"==r){const e=(0,c.Create30kRoster)(t);e&&e._forces.length>0&&new u.Renderer30k(e).render(g,v,b)}else if("(HH V2) Horus Heresy (2022)"==r){const e=d.HorusHeresy.CreateRoster(t);e&&e._forces.length>0&&new h.RendererHH2(e).render(g,v,b)}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 g.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))}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"]},964:(e,t,n)=>{"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._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),e.appendChild(document.createElement("h2")).appendChild(document.createTextNode("...Prerelease - not ready for primetime..."));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.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.psychicWeapons();if(_.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 _){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.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",_),f&&l.appendChild(f);const m=t.psychicPowers();if(m.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 m)e.append(o([t.name(),t._description],this._psychicPowerLabelWidthNormalized))}if(f=s("Psychic Power notes",m),f&&l.appendChild(f),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 g=Array.from(t._keywords).sort(r.HorusHeresy.Compare).join(", ").toLocaleUpperCase();c.appendChild(o(["Keywords",g],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const v=document.createElement("div");this.renderModelList(v,t),c.appendChild(o(["MODELS",v],[.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.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"]},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 E=document.createElement("p");E.appendChild(document.createTextNode(s.name())),s._faction&&E.appendChild(document.createTextNode(" ("+s._faction+")")),S.appendChild(E)}let x=document.createElement("h3");x.appendChild(S),n.appendChild(x)}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"]},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,x,E,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 z=null,I=null,W=null,P=null,B=e.querySelectorAll(":scope profiles>profile");for(let e of B){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){z=new c,z._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":z._ws=t.textContent;break;case"BS":z._bs=t.textContent;break;case"S":z._str=+t.textContent;break;case"T":z._toughness=+t.textContent;break;case"W":z._wounds=+t.textContent;break;case"I":z._initiative=+t.textContent;break;case"A":z._attacks=t.textContent;break;case"LD":z._leadership=+t.textContent;break;case"Save":z._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&&(z._count=+t)}}L._models.push(z)}else if("Walker"===n){I=new a,I._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":I._ws=e.textContent;break;case"BS":I._bs=e.textContent;break;case"S":I._str=+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"I":I._initiative=+e.textContent;break;case"A":I._attacks=e.textContent;break;case"HP":I._hp=+e.textContent;break;case"Type":I._type=e.textContent}}L._walkers.push(I)}else if("Vehicle"===n){W=new s,W._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":W._bs=e.textContent;break;case"Front":W._front=+e.textContent;break;case"Side":W._side=+e.textContent;break;case"Rear":W._rear=+e.textContent;break;case"HP":W._hp=+e.textContent;break;case"Type":W._type=e.textContent}}L._vehicles.push(W)}else if("Flyer"===n){P=new l,P._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":P._bs=e.textContent;break;case"Front":P._front=+e.textContent;break;case"Side":P._side=+e.textContent;break;case"Rear":P._rear=+e.textContent;break;case"HP":P._hp=+e.textContent;break;case"Combat Role":P._role=e.textContent;break;case"Pursuit":P._pursuit=e.textContent;break;case"Agility":P._agility=e.textContent}}L._flyers.push(P)}}for(let e of B){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}}z?z._weapons.push(r):I?I._weapons.push(r):W?W._weapons.push(r):P?P._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===(x=e.getAttributeNode("name"))||void 0===x?void 0:x.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===(E=e.getAttributeNode("name"))||void 0===E?void 0:E.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}}z?z._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}}z?z._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(H),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(H).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||I(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)x(e,t)}function x(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function E(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=E(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),z(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",z(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)x(e,r._rules);return r.normalize(),r}function z(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=W(r);t._weapons.push(e)}else if(i.includes("Wound Track")||i.includes("Stat Damage")||i.includes(" Wounds")){const e=P(r);n._woundTracker.push(e)}else if("Psychic Power"==i){const e=B(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),I(r,e,0,n._abilities[i]))}}function I(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 W(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 P(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 B(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 Y(e._name,t._name)}function F(e,t){return e._name===t._name?Y(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:Y(e._name,t._name)}function H(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 Y(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;return i._name=o||"40k Army Roster",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)x(e,o._rules)}y(e,o,n),t._forces.push(o)}}(e,i,t),i}}return null},t.CompareWeapon=H,t.Compare=Y},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 x(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 E(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,x=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;x&&(C._name=x);let E=e.querySelectorAll("profiles>profile");for(let e of E){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),x(e,i),E(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._cost=new _,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 r{constructor(){super(...arguments),this._description=""}}e.PsychicPower=o;class a extends n{constructor(){super(...arguments),this._count=0,this._type="",this._weapons=[],this._upgrades=[],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._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(L),this._upgrades.sort(T),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}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(L).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicWeapons(){return this._models.map((e=>e._psychicWeapons)).reduce(((e,t)=>e.concat(t)),[]).sort(L).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicPowers(){return this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[]).sort(T).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]))}}e.Unit=h;class f extends n{constructor(){super(),this._catalog="",this._name="Unknown",this._faction="Unknown",this._factionRules=new Map,this._rules=new Map,this._units=[]}}e.Force=f;class p extends n{constructor(){super(),this._cost=new _,this._name="",this._forces=[]}}e.Roster=p;class _{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 m(e,t){return e>t?1:e==t?0:-1}function g(e,t){return typeof e>typeof t?1:typeof e==typeof t?0:-1}function v(e){const t=new _,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("Pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function b(e,n){var i,o;let s=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(!s)return;let a=null===(o=e.getAttributeNode("type"))||void 0===o?void 0:o.nodeValue;if(a)if("unit"===a||"model"===a){const i=function(e){var n,i,o;let s=new h;y(e,s);let a=e.querySelectorAll("categories>category");for(let e of a){const r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r){let e=k(r.trim());e!=t.NONE?s._role=e: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){const r=new c;r._name=e,t._modelStats.push(r),y(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=A(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){let r=new u;r._name=e,t._modelStats.push(r),y(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=A(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){let i=new l;i._name=e,t._modelStats.push(i),y(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=A(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){let r=new d;r._name=e,t._modelStats.push(r),y(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 c;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),s._models.push(i),O(t,i);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!W(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const n=new r;n._name=e,n._cost=R(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let m=e.querySelectorAll('selections>selection[type="upgrade"]');for(const e of m){z(Array.from(e.querySelectorAll("profiles>profile")),s);const t=e.getAttribute("name");if(t){console.log("Found unit upgrade: ",t);const n=new r;n._name=t,n._cost=R(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)I(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"===a?function(e,t){const n=e.querySelectorAll("rules>rule");for(const e of n)I(e,t)}(e,n._rules):console.log("** UNEXPECTED SELECTION **",s,a,e)}function y(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 w(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 C(e){var t;const n=new i;y(e,n),n._count=w(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=R(o)),n}function S(e){var t;const n=new i;y(e,n),n._count=w(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=R(o)),n}function x(e){const t=new o;y(e,t),t._count=w(e);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n)if(e.textContent){let n=e.getAttribute("name");n&&"Description"===n&&(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 k(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 A(e){return function(e){return null!=e&&""!==e&&!isNaN(Number(e.toString()))}(e)?e.toString()+'"':e.toString()}function T(e,t){return m(e._name,t._name)}function N(e,t){return e._name===t._name?m(e.nameAndGear(),t.nameAndGear()):m(e._name,t._name)}function L(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 R(e){const t=new _;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(v(e));return t}function O(e,t,n){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(e&&r)if(" Unit"===r||"model"===n.getAttribute("type"));else if("Weapon"===r){const e=C(n);t._weapons.push(e)}else if("Psychic Weapon"===r){const e=S(n);t._psychicWeapons.push(e)}else if("Psychic Power"===r){const e=x(n);t._psychicPowers.push(e)}}}function z(e,t){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(e&&r&&"Weapon"===r){const e=C(n);t._weapons.push(e)}}}function I(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){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}e.Costs=_,e.Compare=m,e.CompareModelTypes=g,e.CreateRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new p,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(v(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 f,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)I(e,i._rules)}let a=e.querySelectorAll(":scope>selections>selection");for(let e of a)b(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=L}(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(x);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 x(e._name,t._name)}function x(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=x},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="",x="",k="",E=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;E&&(L|=16),"UNIX"===s?(R=798,L|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,E)):(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&&(x=r(1,1)+r(l(m),4)+g,S+="up"+r(x.length,2)+x),C&&(k=r(1,1)+r(l(b),4)+y,S+="uc"+r(k.length,2)+k);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=4,d=0,h=-2,f=2,p=8,_=286,m=30,g=19,v=2*_+1,b=15,y=3,w=258,C=w+y+1,S=42,x=113,k=1,E=2,A=3,T=4;function N(e,t){return e.msg=l[t],t}function L(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 z(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,O(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function W(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function P(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-C?e.strstart-(e.w_size-C):0,c=e.window,u=e.w_mask,d=e.prev,h=e.strstart+w,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 B(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-C)){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>=y)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=y&&(e.ins_h=(e.ins_h<=y)if(r=o._tr_tally(e,e.strstart-e.match_start,e.match_length-y),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=y){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=y&&(e.ins_h=(e.ins_h<=y&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-y,r=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-y),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(B(e),0===e.lookahead&&t===c)return k;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,z(e,!1),0===e.strm.avail_out))return k;if(e.strstart-e.block_start>=e.w_size-C&&(z(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):(e.strstart>e.block_start&&(z(e,!1),e.strm.avail_out),k)})),new D(4,4,8,4,M),new D(4,5,16,8,M),new D(4,6,32,32,M),new D(4,4,16,16,U),new D(8,16,32,32,U),new D(8,16,128,128,U),new D(8,32,128,256,U),new D(32,128,258,1024,U),new D(32,258,258,4096,U)],n.deflateInit=function(e,t){return j(e,t,p,15,8,0)},n.deflateInit2=j,n.deflateReset=Y,n.deflateResetKeep=H,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?h:(e.state.gzhead=t,d):h},n.deflate=function(e,t){var n,i,s,l;if(!e||!e.state||5>8&255),I(i,i.gzhead.time>>16&255),I(i,i.gzhead.time>>24&255),I(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),I(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(I(i,255&i.gzhead.extra.length),I(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):(I(i,0),I(i,0),I(i,0),I(i,0),I(i,0),I(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),I(i,3),i.status=x);else{var f=p+(i.w_bits-8<<4)<<8;f|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(f|=32),f+=31-f%31,i.status=x,W(i,f),0!==i.strstart&&(W(i,e.adler>>>16),W(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)),O(e),s=i.pending,i.pending!==i.pending_buf_size));)I(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)),O(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)),O(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&&O(e),i.pending+2<=i.pending_buf_size&&(I(i,255&e.adler),I(i,e.adler>>8&255),e.adler=0,i.status=x)):i.status=x),0!==i.pending){if(O(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&L(t)<=L(n)&&t!==u)return N(e,-5);if(666===i.status&&0!==e.avail_in)return N(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==c&&666!==i.status){var _=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(B(e),0===e.lookahead)){if(t===c)return k;break}if(e.match_length=0,n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(z(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):e.last_lit&&(z(e,!1),0===e.strm.avail_out)?k:E}(i,t):3===i.strategy?function(e,t){for(var n,r,i,s,a=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===c)return k;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=y&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=y?(n=o._tr_tally(e,1,e.match_length-y),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&&(z(e,!1),0===e.strm.avail_out))return k}return e.insert=0,t===u?(z(e,!0),0===e.strm.avail_out?A:T):e.last_lit&&(z(e,!1),0===e.strm.avail_out)?k:E}(i,t):r[i.level].func(i,t);if(_!==A&&_!==T||(i.status=666),_===k||_===A)return 0===e.avail_out&&(i.last_flush=-1),d;if(_===E&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(R(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),O(e),0===e.avail_out))return i.last_flush=-1,d}return t!==u?d:i.wrap<=0?1:(2===i.wrap?(I(i,255&e.adler),I(i,e.adler>>8&255),I(i,e.adler>>16&255),I(i,e.adler>>24&255),I(i,255&e.total_in),I(i,e.total_in>>8&255),I(i,e.total_in>>16&255),I(i,e.total_in>>24&255)):(W(i,e.adler>>>16),W(i,65535&e.adler)),O(e),0=n.w_size&&(0===a&&(R(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,u=e.input,e.avail_in=p,e.next_in=0,e.input=t,B(n);n.lookahead>=y;){for(r=n.strstart,o=n.lookahead-(y-1);n.ins_h=(n.ins_h<>>=y=b>>>24,p-=y,0==(y=b>>>16&255))E[o++]=65535&b;else{if(!(16&y)){if(0==(64&y)){b=_[(65535&b)+(f&(1<>>=y,p-=y),p<15&&(f+=k[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 m(){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 g(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=h,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(f),t.distcode=t.distdyn=new r.Buf32(p),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):d}function b(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,D,2,0),w=y=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&y)<<8)+(y>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&y)){e.msg="unknown compression method",n.mode=30;break}if(w-=4,W=8+(15&(y>>>=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&&(D[0]=255&y,D[1]=y>>>8&255,n.check=o(n.check,D,2,0)),w=y=0,n.mode=3;case 3:for(;w<32;){if(0===v)break e;v--,y+=f[m++]<>>8&255,D[2]=y>>>16&255,D[3]=y>>>24&255,n.check=o(n.check,D,4,0)),w=y=0,n.mode=4;case 4:for(;w<16;){if(0===v)break e;v--,y+=f[m++]<>8),512&n.flags&&(D[0]=255&y,D[1]=y>>>8&255,n.check=o(n.check,D,2,0)),w=y=0,n.mode=5;case 5:if(1024&n.flags){for(;w<16;){if(0===v)break e;v--,y+=f[m++]<>>8&255,n.check=o(n.check,D,2,0)),w=y=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),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,f,m,E,W)),512&n.flags&&(n.check=o(n.check,f,E,m)),v-=E,m+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===v)break e;for(E=0;W=f[m+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(;w<32;){if(0===v)break e;v--,y+=f[m++]<>>=7&w,w-=7&w,n.mode=27;break}for(;w<3;){if(0===v)break e;v--,y+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if(x(n),n.mode=20,6!==t)break;y>>>=2,w-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}y>>>=2,w-=2;break;case 14:for(y>>>=7&w,w-=7&w;w<32;){if(0===v)break e;v--,y+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&y,w=y=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,w-=5,n.ndist=1+(31&y),y>>>=5,w-=5,n.ncode=4+(15&y),y>>>=4,w-=4,286>>=3,w-=3}for(;n.have<19;)n.lens[F[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},P=a(0,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,P){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=N,w-=N,n.lens[n.have++]=R;else{if(16===R){for(M=N+2;w>>=N,w-=N,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}W=n.lens[n.have-1],E=3+(3&y),y>>>=2,w-=2}else if(17===R){for(M=N+3;w>>=N)),y>>>=3,w-=3}else{for(M=N+7;w>>=N)),y>>>=7,w-=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,B={bits:n.lenbits},P=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,P){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},P=a(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,P){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<=v&&258<=b){e.next_out=g,e.avail_out=b,e.next_in=m,e.avail_in=v,n.hold=y,n.bits=w,s(e,S),g=e.next_out,p=e.output,b=e.avail_out,m=e.next_in,f=e.input,v=e.avail_in,y=n.hold,w=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;L=(U=n.lencode[y&(1<>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>O)])>>>16&255,R=65535&U,!(O+(N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=O,w-=O,n.back+=O}if(y>>>=N,w-=N,n.back+=N,n.length=R,0===L){n.mode=26;break}if(32&L){n.back=-1,n.mode=12;break}if(64&L){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&L,n.mode=22;case 22:if(n.extra){for(M=n.extra;w>>=n.extra,w-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;L=(U=n.distcode[y&(1<>>16&255,R=65535&U,!((N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>O)])>>>16&255,R=65535&U,!(O+(N=U>>>24)<=w);){if(0===v)break e;v--,y+=f[m++]<>>=O,w-=O,n.back+=O}if(y>>>=N,w-=N,n.back+=N,64&L){e.msg="invalid distance code",n.mode=30;break}n.offset=R,n.extra=15&L,n.mode=24;case 24:if(n.extra){for(M=n.extra;w>>=n.extra,w-=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===b)break e;if(E=S-b,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}A=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),T=n.window}else T=p,A=g-n.offset,E=n.length;for(bv?(y=B[M+d[x]],z[I+d[x]]):(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,x++,0==--W[S]){if(S===E)break;S=t[n+d[x]]}if(A>>7)]}function N(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function L(e,t,n){e.bi_valid>d-n?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=n-d):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function z(e,t,n){var r,i,o=new Array(u+1),s=0;for(r=1;r<=u;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]=O(o[a]++,a))}}function I(e){var t;for(t=0;t>1;1<=n;n--)B(e,o,n);for(i=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],B(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++,B(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,l=t.dyn_tree,d=t.max_code,h=t.stat_desc.static_tree,f=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,_=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(o=0;o<=u;o++)e.bl_count[o]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=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?Y(e,t,n,r):4===e.strategy||s===i?(L(e,2+(r?1:0),3),M(e,g,v)):(L(e,4+(r?1:0),3),function(e,t,n,r){var i;for(L(e,t-257,5),L(e,n-1,5),L(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*(y[n]+o+1)]++,e.dyn_dtree[2*T(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){L(e,2,3),R(e,h,g),function(e){16===e.bi_valid?(N(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(q.source),J=/<%-([\s\S]+?)%>/g,G=/<%([\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",xe="a-z\\xdf-\\xf6\\xf8-\\xff",ke="A-Z\\xc0-\\xd6\\xd8-\\xde",Ee="\\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+"]",ze="["+xe+"]",Ie="[^"+we+Ae+Re+Se+xe+ke+"]",We="\\ud83c[\\udffb-\\udfff]",Pe="[^"+we+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+ke+"]",De="\\u200d",Fe="(?:"+ze+"|"+Ie+")",He="(?:"+Ue+"|"+Ie+")",Ye="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Le+"|"+We+")?",qe="["+Ee+"]?",$e=qe+Ve+"(?:"+De+"(?:"+[Pe,Be,Me].join("|")+")"+qe+Ve+")*",Xe="(?:"+[Oe,Be,Me].join("|")+")"+$e,Je="(?:"+[Pe+Le+"?",Le,Be,Me,Te].join("|")+")",Ge=RegExp("['’]","g"),Ze=RegExp(Le,"g"),Ke=RegExp(We+"(?="+We+")|"+Je+$e,"g"),Qe=RegExp([Ue+"?"+ze+"+"+Ye+"(?="+[Ne,Ue,"$"].join("|")+")",He+"+"+je+"(?="+[Ne,Ue+Fe,"$"].join("|")+")",Ue+"?"+Fe+"+"+Ye,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+Ee+"]"),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[z]=it[I]=it[W]=it[P]=it[B]=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[x]=it[E]=it[A]=it[T]=it[L]=!1;var ot={};ot[_]=ot[m]=ot[R]=ot[O]=ot[g]=ot[v]=ot[z]=ot[I]=ot[W]=ot[P]=ot[B]=ot[C]=ot[S]=ot[x]=ot[E]=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 xt(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,xe=t.Object,ke=t.RegExp,Ee=t.String,Ae=t.TypeError,Te=r.prototype,Ne=Ce.prototype,Le=xe.prototype,Re=t["__core-js_shared__"],Oe=Ne.toString,ze=Le.hasOwnProperty,Ie=0,We=(n=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Pe=Le.toString,Be=Oe.call(xe),Me=dt._,Ue=ke("^"+Oe.call(ze).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=pt?t.Buffer:i,Fe=t.Symbol,He=t.Uint8Array,Ye=De?De.allocUnsafe:i,je=sn(xe.getPrototypeOf,xe),Ve=xe.create,qe=Le.propertyIsEnumerable,$e=Te.splice,Xe=Fe?Fe.isConcatSpreadable:i,Je=Fe?Fe.iterator:i,Ke=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(xe,"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=xe.getOwnPropertySymbols,mt=De?De.isBuffer:i,Pt=t.isFinite,jt=Te.join,_n=sn(xe.keys,xe),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"),xn=lo(t,"Promise"),kn=lo(t,"Set"),En=lo(t,"WeakMap"),An=lo(xe,"create"),Tn=En&&new En,Nn={},Ln=Bo(Cn),Rn=Bo(Sn),On=Bo(xn),zn=Bo(kn),In=Bo(En),Wn=Fe?Fe.prototype:i,Pn=Wn?Wn.valueOf:i,Bn=Wn?Wn.toString:i;function Mn(e){if(ea(e)&&!Ys(e)&&!(e instanceof Hn)){if(e instanceof Fn)return e;if(ze.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 Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Yn(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=Ys(e);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ei(e,a)}else{var h=ho(e),f=h==y||h==w;if($s(e))return yi(e,l);if(h==x||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 z:case I:case W:case P:case B: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 E: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?xe(Pn.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 kt(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=xe(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,Jt(n))),r?(o=Lt,s=!1):t.length>=200&&(o=Zt,s=!1,t=new qn(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 Yn,map:new(Sn||jn),string:new Yn}},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},qn.prototype.add=qn.prototype.push=function(e){return this.__data__.set(e,s),this},qn.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 Gs(e[t])}))}function wr(e,t){for(var n=0,r=(t=mi(t,e)).length;null!=e&&nt}function kr(e,t){return null!=e&&ze.call(e,t)}function Er(e,t){return null!=e&&t in xe(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,Jt(t))),u=gn(h.length,u),c[l]=!n&&(t||s>=120&&h.length>=120)?new qn(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&&$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 qr(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(xo(e,t,nl),e+"")}function Xr(e){return Jn(Ua(e))}function Jr(e,t){var n=Ua(e);return Oo(n,or(t,0,n.length))}function Gr(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:qi(e);if(c)return ln(c);s=!1,i=Zt,l=new qn}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=Ye?Ye(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(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=xe(t);++r-1?o[s?t[a]:a]:i}}function Pi(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 qn: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 kt(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 Hn&&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){ze.call(e,n)?++e[n]:rr(e,n,1)})),_s=Wi(Ho),ms=Wi(Yo);function gs(e,t){return(Ys(e)?kt:ur)(e,oo(t,3))}function vs(e,t){return(Ys(e)?Et:dr)(e,oo(t,3))}var bs=Ti((function(e,t,n){ze.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(Ys(e)?Rt:Pr)(e,oo(t,3))}var Ss=Ti((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),xs=$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),[])})),ks=ct||function(){return dt.Date.now()};function Es(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=ks();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=ks(),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(ks())},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 zs(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(zs.Cache||Vn),n}function Is(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)}}zs.Cache=Vn;var Ws=gi((function(e,t){var n=(t=1==t.length&&Ys(t[0])?Rt(t[0],Jt(oo())):Rt(_r(t,1),Jt(oo()))).length;return $r((function(r){for(var i=-1,o=gn(r.length,n);++i=t})),Hs=Nr(function(){return arguments}())?Nr:function(e){return ea(e)&&ze.call(e,"callee")&&!qe.call(e,"callee")},Ys=r.isArray,js=gt?Jt(gt):function(e){return ea(e)&&Sr(e)==R};function Vs(e){return null!=e&&Ks(e.length)&&!Gs(e)}function qs(e){return ea(e)&&Vs(e)}var $s=mt||_l,Xs=vt?Jt(vt):function(e){return ea(e)&&Sr(e)==v};function Js(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 Gs(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?Jt(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)!=x)return!1;var t=je(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Oe.call(n)==Be}var ia=yt?Jt(yt):function(e){return ea(e)&&Sr(e)==E},oa=wt?Jt(wt):function(e){return ea(e)&&ho(e)==A};function sa(e){return"string"==typeof e||!Ys(e)&&ea(e)&&Sr(e)==T}function aa(e){return"symbol"==typeof e||ea(e)&&Sr(e)==N}var la=Ct?Jt(Ct):function(e){return ea(e)&&Ks(e.length)&&!!it[Sr(e)]},ca=Yi(Wr),ua=Yi((function(e,t){return e<=t}));function da(e){if(!e)return[];if(Vs(e))return sa(e)?dn(e):Ei(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());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)ze.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=xe(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})),Wa=Qi((function(e,t){return null==e?{}:function(e,t){return Hr(e,t,(function(t,n){return Ea(e,n)}))}(e,t)}));function Pa(e,t){if(null==e)return{};var n=Rt(to(e),(function(e){return[e]}));return t=oo(t),Hr(e,n,(function(e,n){return t(e,n[0])}))}var Ba=$i(La),Ma=$i(Ra);function Ua(e){return null==e?[]:Gt(e,La(e))}var Da=zi((function(e,t,n){return t=t.toLowerCase(),e+(n?Fa(t):t)}));function Fa(e){return Ja(ga(e).toLowerCase())}function Ha(e){return(e=ga(e))&&e.replace(ve,en).replace(Ze,"")}var Ya=zi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),ja=zi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Va=Oi("toLowerCase"),qa=zi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),$a=zi((function(e,t,n){return e+(n?" ":"")+Ja(t)})),Xa=zi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ja=Oi("toUpperCase");function Ga(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 Js(e)?e:new we(e)}})),Ka=Qi((function(e,t){return kt(t,(function(t){t=Po(t),rr(e,t,Ts(e[t],e))})),e}));function Qa(e){return function(){return e}}var el=Pi(),tl=Pi(!0);function nl(e){return e}function rl(e){return zr("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=Gs(e);return kt(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__=Ei(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(Wt);function dl(e){return vo(e)?Yt(Po(e)):function(e){return function(t){return wr(t,e)}}(e)}var hl=Hi(),fl=Hi(!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=Es,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 Ys(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=Ba,Mn.toPairsIn=Ma,Mn.toPath=function(e){return Ys(e)?Rt(e,Po):aa(e)?[e]:Ei(Wo(ga(e)))},Mn.toPlainObject=ma,Mn.transform=function(e,t,n){var r=Ys(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)&&Gs(o)?Un(je(e)):{}}return(i?kt:vr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Mn.unary=function(e){return Es(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?[]:Gt(e,Ra(e))},Mn.without=os,Mn.words=Ga,Mn.wrap=function(e,t){return Ps(_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||[],Gr)},Mn.zipWith=us,Mn.entries=Ba,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=Ha,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(q,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=Ys(e)?At:hr;return n&&go(e,t,n)&&(t=i),r(e,oo(t,3))},Mn.find=_s,Mn.findIndex=Ho,Mn.findKey=function(e,t){return Bt(e,oo(t,3),vr)},Mn.findLast=ms,Mn.findLastIndex=Yo,Mn.findLastKey=function(e,t){return Bt(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=ka,Mn.gt=Ds,Mn.gte=Fs,Mn.has=function(e,t){return null!=e&&fo(e,t,kr)},Mn.hasIn=Ea,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=Ya,Mn.last=Jo,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,xr):i},Mn.maxBy=function(e,t){return e&&e.length?fr(e,oo(t,2),xr):i},Mn.mean=function(e){return Ht(e,nl)},Mn.meanBy=function(e,t){return Ht(e,oo(t,2))},Mn.min=function(e){return e&&e.length?fr(e,nl,Wr):i},Mn.minBy=function(e,t){return e&&e.length?fr(e,oo(t,2),Wr):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=ks,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=Ys(e)?zt:Vt,i=arguments.length<3;return r(e,oo(t,4),n,i,ur)},Mn.reduceRight=function(e,t,n){var r=Ys(e)?It: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),qr(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=ke(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=++Ie;return ga(e)+t},Mn.upperCase=Xa,Mn.upperFirst=Ja,Mn.each=gs,Mn.eachRight=vs,Mn.first=Vo,sl(Mn,(ml={},vr(Mn,(function(e,t){ze.call(Mn.prototype,t)||(ml[t]=e)})),ml),{chain:!1}),Mn.VERSION="4.17.21",kt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),kt(["drop","take"],(function(e,t){Hn.prototype[e]=function(n){n=n===i?1:mn(fa(n),0);var r=this.__filtered__&&!t?new Hn(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},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),kt(["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:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),kt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}})),kt(["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(nl)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=$r((function(e,t){return"function"==typeof e?new Hn(this):this.map((function(n){return Tr(n,e,t)}))})),Hn.prototype.reject=function(e){return this.filter(Is(oo(e)))},Hn.prototype.slice=function(e,t){e=fa(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=fa(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)},vr(Hn.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 Hn,c=a[0],u=l||Ys(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 Hn(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)})})),kt(["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(Ys(i)?i:[],e)}return this[n]((function(n){return t.apply(Ys(n)?n:[],e)}))}})),vr(Hn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";ze.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[Bi(i,2).name]=[{name:"wrapper",func:i}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(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=Ys(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 Hn){var t=e;return this.__actions__.length&&(t=new Hn(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,Je&&(Mn.prototype[Je]=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(467),c=n(391),u=n(544),d=n(980),h=n(66),f=n(774),p=n(964),_=n(320),m=n(717),g=i(n(733)),v=n(486);let b=null;$("#roster-file").on("change",(function(e){let t,n;if(t="resize"===(null==e?void 0:e.type)?null==b?void 0:b.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)&&(b=e);const t=new FileReader;t.onerror=()=>{t.abort(),(0,v.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 g=$("#roster-title")[0],v=$("#roster-lists")[0],b=$("#force-units")[0];if("Warhammer 40,000 8th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}else if("Warhammer 40,000 9th Edition"==r){const e=(0,a.Create40kRoster)(t);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}else if("Warhammer 40,000: Kill Team (2018)"==r){const e=(0,a.Create40kRoster)(t,!1);e&&e._forces.length>0&&new l.Renderer40k(e).render(g,v,b)}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(g,v,b)}else if("Age of Sigmar"==r){const e=(0,f.CreateAoSRoster)(t);e&&new p.RendererAoS(e).render(g,v,b)}else if("Warhammer Age of Sigmar: Warcry"==r){const e=(0,_.CreateWarcryRoster)(t);e&&new m.RendererWarcry(e).render(g,v,b)}else if("Warhammer 30,000 - The Horus Heresy"==r){const e=(0,c.Create30kRoster)(t);e&&e._forces.length>0&&new u.Renderer30k(e).render(g,v,b)}else if("(HH V2) Horus Heresy (2022)"==r){const e=d.HorusHeresy.CreateRoster(t);e&&e._forces.length>0&&new h.RendererHH2(e).render(g,v,b)}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 g.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))}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"]},964:(e,t,n)=>{"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._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),e.appendChild(document.createElement("h2")).appendChild(document.createTextNode("...Prerelease - not ready for primetime..."));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.psychicWeapons();if(_.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 _){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",_),f&&l.appendChild(f);const m=t.psychicPowers();if(m.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 m)e.append(o([t.name(),t._description],this._psychicPowerLabelWidthNormalized))}if(f=s("Psychic Power notes",m),f&&l.appendChild(f),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 g=Array.from(t._keywords).sort(r.HorusHeresy.Compare).join(", ").toLocaleUpperCase();c.appendChild(o(["Keywords",g],[.1,.9],!1)),c=l.appendChild(document.createElement("thead")),c.classList.add("info_row");const v=document.createElement("div");this.renderModelList(v,t),c.appendChild(o(["MODELS",v],[.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"]},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 k=document.createElement("p");k.appendChild(document.createTextNode(s.name())),s._faction&&k.appendChild(document.createTextNode(" ("+s._faction+")")),S.appendChild(k)}let x=document.createElement("h3");x.appendChild(S),n.appendChild(x)}s._leader&&this.printOperative(s._leader,null,n);let p=null;for(let E of s._operatives)this.printOperative(E,p,n),p=E;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"]},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,x,k,E,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 z=null,I=null,W=null,P=null,B=e.querySelectorAll(":scope profiles>profile");for(let e of B){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){z=new c,z._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":z._ws=t.textContent;break;case"BS":z._bs=t.textContent;break;case"S":z._str=+t.textContent;break;case"T":z._toughness=+t.textContent;break;case"W":z._wounds=+t.textContent;break;case"I":z._initiative=+t.textContent;break;case"A":z._attacks=t.textContent;break;case"LD":z._leadership=+t.textContent;break;case"Save":z._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&&(z._count=+t)}}L._models.push(z)}else if("Walker"===n){I=new a,I._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":I._ws=e.textContent;break;case"BS":I._bs=e.textContent;break;case"S":I._str=+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"I":I._initiative=+e.textContent;break;case"A":I._attacks=e.textContent;break;case"HP":I._hp=+e.textContent;break;case"Type":I._type=e.textContent}}L._walkers.push(I)}else if("Vehicle"===n){W=new s,W._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":W._bs=e.textContent;break;case"Front":W._front=+e.textContent;break;case"Side":W._side=+e.textContent;break;case"Rear":W._rear=+e.textContent;break;case"HP":W._hp=+e.textContent;break;case"Type":W._type=e.textContent}}L._vehicles.push(W)}else if("Flyer"===n){P=new l,P._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":P._bs=e.textContent;break;case"Front":P._front=+e.textContent;break;case"Side":P._side=+e.textContent;break;case"Rear":P._rear=+e.textContent;break;case"HP":P._hp=+e.textContent;break;case"Combat Role":P._role=e.textContent;break;case"Pursuit":P._pursuit=e.textContent;break;case"Agility":P._agility=e.textContent}}L._flyers.push(P)}}for(let e of B){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}}z?z._weapons.push(r):I?I._weapons.push(r):W?W._weapons.push(r):P?P._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===(x=e.getAttributeNode("name"))||void 0===x?void 0:x.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===(k=e.getAttributeNode("name"))||void 0===k?void 0:k.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}}z?z._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===(E=e.getAttributeNode("name"))||void 0===E?void 0:E.nodeValue;if(t&&e.textContent)switch(t){case"Mastery Level":n._masteryLevel=e.textContent;break;case"Disciplines":n._disciplines=e.textContent}}z?z._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(H),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(H).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||I(e,n,0,t)}const r=e.querySelectorAll("rules>rule");for(const e of r)x(e,t)}function x(e,t){const n=e.getAttribute("name"),r=e.querySelector("description");n&&(null==r?void 0:r.textContent)&&t.set(n,r.textContent)}function k(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 E(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=k(e);n!=p.NONE?r._role=n:t?r._keywords.add(i):(n=E(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),z(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",z(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)x(e,r._rules);return r.normalize(),r}function z(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=W(r);t._weapons.push(e)}else if(i.includes("Wound Track")||i.includes("Stat Damage")||i.includes(" Wounds")){const e=P(r);n._woundTracker.push(e)}else if("Psychic Power"==i){const e=B(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),I(r,e,0,n._abilities[i]))}}function I(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 W(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 P(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 B(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 Y(e._name,t._name)}function F(e,t){return e._name===t._name?Y(e.nameAndGear(),t.nameAndGear()):"Unit Upgrades"===e._name?1:"Unit Upgrades"===t._name?-1:Y(e._name,t._name)}function H(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 Y(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;return i._name=o||"40k Army Roster",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)x(e,o._rules)}y(e,o,n),t._forces.push(o)}}(e,i,t),i}}return null},t.CompareWeapon=H,t.Compare=Y},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 x(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=E(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 k(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 E(e){var t,n,r,i,o,s,a,l,f,p,_,m,g,v,w;let C=new y,x=null===(t=e.getAttributeNode("name"))||void 0===t?void 0:t.nodeValue;x&&(C._name=x);let k=e.querySelectorAll("profiles>profile");for(let e of k){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 E=e.querySelectorAll("selections>selection");for(let e of E){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),x(e,i),k(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._cost=new _,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 r{constructor(){super(...arguments),this._description=""}}e.PsychicPower=o;class a extends n{constructor(){super(...arguments),this._count=0,this._type="",this._weapons=[],this._upgrades=[],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._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(L),this._upgrades.sort(T),this.normalizeUpgrades(this._weapons),this.normalizeUpgrades(this._upgrades)}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(L).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicWeapons(){return this._models.map((e=>e._psychicWeapons)).reduce(((e,t)=>e.concat(t)),[]).sort(L).filter(((e,t,n)=>{var r;return e.name()!==(null===(r=n[t-1])||void 0===r?void 0:r.name())}))}psychicPowers(){return this._models.map((e=>e._psychicPowers)).reduce(((e,t)=>e.concat(t)),[]).sort(T).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]))}}e.Unit=h;class f extends n{constructor(){super(),this._catalog="",this._name="Unknown",this._faction="Unknown",this._factionRules=new Map,this._rules=new Map,this._units=[]}}e.Force=f;class p extends n{constructor(){super(),this._cost=new _,this._name="",this._forces=[]}}e.Roster=p;class _{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 m(e,t){return e>t?1:e==t?0:-1}function g(e,t){return typeof e>typeof t?1:typeof e==typeof t?0:-1}function v(e){const t=new _,n=e.getAttribute("name"),r=e.getAttribute("value");return n&&r&&("Pts"===n?t._points+=+r:t.addFreeformValue(n,+r)),t}function b(e,n){var i,o;let s=null===(i=e.getAttributeNode("name"))||void 0===i?void 0:i.nodeValue;if(!s)return;let a=null===(o=e.getAttributeNode("type"))||void 0===o?void 0:o.nodeValue;if(a)if("unit"===a||"model"===a){const i=function(e){var n,i,o;let s=new h;y(e,s);let a=e.querySelectorAll("categories>category");for(let e of a){const r=null===(n=e.getAttributeNode("name"))||void 0===n?void 0:n.nodeValue;if(r){let e=E(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){const r=new c;r._name=e,t._modelStats.push(r),y(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=A(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){let r=new u;r._name=e,t._modelStats.push(r),y(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=A(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){let i=new l;i._name=e,t._modelStats.push(i),y(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=A(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){let r=new d;r._name=e,t._modelStats.push(r),y(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 c;i._name=e.getAttribute("name")||"Unknown Model",i._count=Number(e.getAttribute("number")||1),s._models.push(i),O(t,i);for(const t of e.querySelectorAll('selections>selection[type="upgrade"]')){if(t.querySelector('selections>selection[type="upgrade"]')&&!W(t,"Abilities"))continue;let e=t.getAttribute("name");if(e){const n=new r;n._name=e,n._cost=R(t),n._count=Number(t.getAttribute("number")),i._upgrades.push(n)}}}let m=e.querySelectorAll('selections>selection[type="upgrade"]');for(const e of m){z(Array.from(e.querySelectorAll("profiles>profile")),s);const t=e.getAttribute("name");if(t){console.log("Found unit upgrade: ",t);const n=new r;n._name=t,n._cost=R(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)I(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"===a?function(e,t){const n=e.querySelectorAll("rules>rule");for(const e of n)I(e,t)}(e,n._rules):console.log("** UNEXPECTED SELECTION **",s,a,e)}function y(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 w(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 C(e){var t;const n=new i;y(e,n),n._count=w(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=R(o)),n}function S(e){var t;const n=new i;y(e,n),n._count=w(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=R(o)),n}function x(e){const t=new o;y(e,t),t._count=w(e);let n=e.querySelectorAll("characteristics>characteristic");for(let e of n)if(e.textContent){let n=e.getAttribute("name");n&&"Description"===n&&(t._description=e.textContent)}return t}function k(e,t){if(!t||!e)return!1;for(let n of t._forces)if(n._catalog===e._catalog)return!0;return!1}function E(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 A(e){return function(e){return null!=e&&""!==e&&!isNaN(Number(e.toString()))}(e)?e.toString()+'"':e.toString()}function T(e,t){return m(e._name,t._name)}function N(e,t){return e._name===t._name?m(e.nameAndGear(),t.nameAndGear()):m(e._name,t._name)}function L(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 R(e){const t=new _;for(const n of e.children)if("costs"===n.tagName)for(const e of n.children)t.add(v(e));return t}function O(e,t,n){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(e&&r)if(" Unit"===r||"model"===n.getAttribute("type"));else if("Weapon"===r){const e=C(n);t._weapons.push(e)}else if("Psychic Weapon"===r){const e=S(n);t._psychicWeapons.push(e)}else if("Psychic Power"===r){const e=x(n);t._psychicPowers.push(e)}}}function z(e,t){for(const n of e){const e=n.getAttribute("name"),r=n.getAttribute("typeName");if(e&&r&&"Weapon"===r){const e=C(n);t._weapons.push(e)}}}function I(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){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}e.Costs=_,e.Compare=m,e.CompareModelTypes=g,e.CreateRoster=function(e){var t;if(e){let n=e.querySelector("roster");if(n){const r=new p,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(v(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 f,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),!k(i,t)){const t=e.querySelectorAll("force>rules>rule");for(let e of t)I(e,i._rules)}let a=e.querySelectorAll(":scope>selections>selection");for(let e of a)b(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=L}(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(x);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 x(e._name,t._name)}function x(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=x},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/rendererHH2.ts b/src/rendererHH2.ts index ac0b0e7..e72f2b4 100644 --- a/src/rendererHH2.ts +++ b/src/rendererHH2.ts @@ -489,6 +489,7 @@ export class RendererHH2 implements Renderer { } if (index != 0) { let anchor = document.createElement('a'); + anchor.classList.add('hh2-rule-link'); anchor.href = "#" + text; anchor.text = text; weaponRules.appendChild(anchor); @@ -529,6 +530,7 @@ export class RendererHH2 implements Renderer { } if (index != 0) { let anchor = document.createElement('a'); + anchor.classList.add('hh2-rule-link'); anchor.href = "#" + text; anchor.text = text; weaponRules.appendChild(anchor); @@ -607,6 +609,7 @@ export class RendererHH2 implements Renderer { } if (index != 0) { let anchor = document.createElement('a'); + anchor.classList.add('hh2-rule-link'); anchor.href = "#" + text; anchor.text = text; rulesDiv.appendChild(anchor); diff --git a/src/rosterHH2.ts b/src/rosterHH2.ts index 1677e84..cf4f891 100644 --- a/src/rosterHH2.ts +++ b/src/rosterHH2.ts @@ -687,6 +687,10 @@ function LookupRole(roleText: string): UnitRole { return UnitRole.NONE; } +function InternalKeyword(kw: string): boolean { + return kw.endsWith(':'); +} + function CreateUnit(root: Element): Unit | null { let unit: Unit = new Unit(); const unitName = ExpandBaseNotes(root, unit); @@ -704,8 +708,10 @@ function CreateUnit(root: Element): Unit | null { unit._role = unitRole; } else { - // Keyword - unit._keywords.add(catName); + if (!InternalKeyword(catName)) { + // Keyword + unit._keywords.add(catName); + } } } }