parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Ph2E":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.API_URI=void 0;const e="https://api.tribalwarshelp.com/graphql";exports.API_URI=e;var r=function(){let{query:r,variables:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return fetch(e,{method:"POST",body:JSON.stringify({query:r,variables:t}),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{let{data:r,errors:t}=e;if(t&&Array.isArray(t)&&t.length>0)throw new Error(t[0].message);return new Promise(e=>e(r))})};exports.default=r;
},{}],"LNef":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const o={pl_PL:{loaded:"Załadowano",pop:"Populacja",mySupport:"Moje wsparcie",allySupport:"Wsparcie plemienia",total:"Łącznie",possibleLoyalty:"Prawdopodobne poparcie",ennobledAt:"Podbita o",never:"Nigdy",action:{linkToTWHelp:"Akta wioski (TWHelp)",showEnnoblements:"Pokaż przejęcia",countIncomingSupport:"Policz nadchodzące wsparcie"}},en_DK:{loaded:"Loaded",pop:"Pop",mySupport:"My support",allySupport:"Ally support",total:"Total",possibleLoyalty:"Possible loyalty",never:"Never",ennobledAt:"Ennobled at",action:{linkToTWHelp:"Village file (TWHelp)",showEnnoblements:"Show ennoblements",countIncomingSupport:"Count incoming support"}}};var e=()=>o[window.game_data.locale]||o.en_DK;exports.default=e;
},{}],"fCHX":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.generatePaginationItems=exports.calcNumberOfPages=exports.getPage=exports.setPage=exports.getContainerStyles=void 0;const e="data-page",t=()=>"display: flex; flex-direction: row; flex-wrap: wrap;";exports.getContainerStyles=t;const r=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t instanceof HTMLElement)throw new Error("Expected HTMLElement as the first argument");if("number"!=typeof(r=parseInt(r))||isNaN(r))throw new Error("Expected number or string as the second argument");t.setAttribute(e,r+"")};exports.setPage=r;const n=t=>!t instanceof HTMLElement?0:parseInt(t.getAttribute(e));exports.getPage=n;const o=(e,t)=>{if("number"!=typeof e)throw new Error("Expected number as the first argument");if("number"!=typeof t)throw new Error("Expected number as the second argument");return e>0?Math.ceil(e/t):1};exports.calcNumberOfPages=o;const a=function(){let{total:t,limit:r,marginRight:n=3,currentPage:a=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=o(t,r),c=[];for(let o=1;o<=s;o++)o===a?c.push('<strong style="margin-right: '.concat(n,'px">>').concat(o,"<</strong>")):c.push('<a style="margin-right: '.concat(n,'px" href="#" ').concat(e,'="').concat(o,'">').concat(o,"</a>"));return c};exports.generatePaginationItems=a;
},{}],"DMkL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=()=>window.location.host.split(".")[0];exports.default=e;
},{}],"tQUs":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=e=>parseInt(new URLSearchParams(e).get("id"));exports.default=e;
},{}],"fHHP":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildImgURL=exports.calcAttackDuration=exports.buildVillageName=exports.buildVillageURL=exports.buildPlayerURL=exports.buildTribeURL=void 0;const i=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_ally",id:i});exports.buildTribeURL=i;const o=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_player",id:i});exports.buildPlayerURL=o;const e=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_village",id:i});exports.buildVillageURL=e;const t=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;const t="K"+String(e)[0]+String(o)[0];return"".concat(i," (").concat(o,"|").concat(e,") ").concat(t)};exports.buildVillageName=t;const l=(i,o)=>Math.round(i*o);exports.calcAttackDuration=l;const r=i=>image_base+i;exports.buildImgURL=r;
},{}],"KX6P":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./tribalwars"),t=t=>(0,e.buildImgURL)("unit/unit_".concat(t,".png"));exports.default=t;
},{"./tribalwars":"fHHP"}],"ZbyX":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=exports.inUTC=exports.inTZ=void 0;const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"UTC";return new Date(new Date(t).toLocaleString("en-US",{timeZone:e}))};exports.inTZ=t;const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return t(e)};exports.inUTC=e;const n=(t,e)=>new Date(t).toLocaleDateString(void 0,e||{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});exports.formatDate=n;
},{}],"oUdd":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=e=>new Promise(t=>setTimeout(t,e));exports.default=e;
},{}],"KWxH":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setItem=exports.getItem=void 0;const e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=localStorage.getItem(e);let s=t;return o&&(s=JSON.parse(o)),s};exports.getItem=e;const t=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))};exports.setItem=t;
},{}],"kK6Q":[function(require,module,exports) {
"use strict";function e(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"KYJg":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=t(require("../_lib/requiredArgs/index.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(t){(0,e.default)(1,arguments);var r=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===r?new Date(t.getTime()):"number"==typeof t||"[object Number]"===r?new Date(t):("string"!=typeof t&&"[object String]"!==r||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}
},{"../_lib/requiredArgs/index.js":"kK6Q"}],"H70G":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=u;var e=r(require("../toDate/index.js")),t=r(require("../_lib/requiredArgs/index.js"));function r(e){return e&&e.__esModule?e:{default:e}}function u(r,u){(0,t.default)(2,arguments);var i=(0,e.default)(r),d=(0,e.default)(u);return i.getTime()-d.getTime()}
},{"../toDate/index.js":"KYJg","../_lib/requiredArgs/index.js":"kK6Q"}],"oGJj":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=i;var e=t(require("../differenceInMilliseconds/index.js")),r=t(require("../_lib/requiredArgs/index.js"));function t(e){return e&&e.__esModule?e:{default:e}}var u=6e4;function i(t,i){(0,r.default)(2,arguments);var d=(0,e.default)(t,i)/u;return d>0?Math.floor(d):Math.ceil(d)}
},{"../differenceInMilliseconds/index.js":"H70G","../_lib/requiredArgs/index.js":"kK6Q"}],"kcC2":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("date-fns/differenceInMinutes"));function t(e){return e&&e.__esModule?e:{default:e}}const r=(t,r)=>{let u=25+Math.abs((0,e.default)(t,new Date))*(r/60);return u>100&&(u=100),Math.floor(u)};var u=r;exports.default=u;
},{"date-fns/differenceInMinutes":"oGJj"}],"J1Ly":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").substr(0,2)};exports.default=e;
},{}],"gvXE":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildVillageURL=exports.buildTribeURL=exports.buildPlayerURL=exports.buildURLToProfile=exports.buildURLToServerPage=exports.BASE_URL=void 0;const e="tribalwarshelp.com";exports.BASE_URL=e;const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"https://".concat(t,".").concat(e,"/server/").concat(o)};exports.buildURLToServerPage=t;const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return"".concat(t(e,o),"/").concat(n,"/").concat(l)};exports.buildURLToProfile=o;const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"player")};exports.buildPlayerURL=l;const n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"tribe")};exports.buildTribeURL=n;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"village")};exports.buildVillageURL=i;
},{}],"tKRp":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{date:"Data",newOwner:"Nowy właściciel",oldOwner:"Poprzedni właściciel",village:"Wioska",title:"Przejęcia"},en_DK:{date:"Date",newOwner:"New owner",oldOwner:"Old owner",village:"Village",title:"Ennoblements"}};var l=()=>e[window.game_data.locale]||e.en_DK;exports.default=l;
},{}],"chDM":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.POPUP_SELECTOR=void 0;const t=".popup_box";exports.POPUP_SELECTOR=".popup_box";const o=function(){let{html:t,id:o,title:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Dialog.show(o,"<h3>".concat(e,"</h3>")+t);const p=document.querySelector(".popup_box");p&&(p.style.width="auto",p.style.maxWidth="1000px")};var e=o;exports.default=e;
},{}],"vNT1":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("../i18n/showEnnoblementsPopup")),t=require("../utils/pagination"),n=l(require("../utils/showPopup")),r=require("../utils/date"),a=i(require("../utils/tribalwars"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=r?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(n,a,i):n[a]=e[a]}return n.default=e,t&&t.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const c="ennoblementsPagination",d=(0,e.default)(),u=(e,t)=>e?'<td><a href="'.concat(a.buildPlayerURL(e.id),'">').concat(e.name," (").concat(t?'<a href="'.concat(a.buildTribeURL(t.id),'">').concat(t.tag,"</a>"):"-",")</a></td>"):"<td>-</td>";var s=function(e,o){let{limit:i=0,currentPage:l=1,onPageChange:s=(()=>{})}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const f=(0,t.generatePaginationItems)({total:o.total,limit:i,currentPage:l}),p='\n    <div style="'.concat((0,t.getContainerStyles)(),'" id="').concat(c,'">\n      ').concat(f.join(""),'\n    </div>\n    <table class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">\n      <tbody>\n        <tr>\n          <th>\n            ').concat(d.date,"\n          </th>\n          <th>\n            ").concat(d.village,"\n          </th>\n          <th>\n            ").concat(d.newOwner,"\n          </th>\n          <th>\n            ").concat(d.oldOwner,"\n          </th>\n        </tr>\n        ").concat(o.items.map(e=>{let t="<tr>"+"<td>".concat((0,r.formatDate)(e.ennobledAt),"</td>");return e.village?t+='<td><a href="'.concat(a.buildVillageURL(e.village.id),'">').concat(a.buildVillageName(e.village.name,e.village.x,e.village.y),"</a></td>"):t+="<td>-</td>",t+=u(e.newOwner,e.newOwnerTribe),(t+=u(e.oldOwner,e.oldOwnerTribe))+"</tr>"}).join(""),"\n      </tbody>\n    </table>\n  ");(0,n.default)({e:e,title:d.title,id:"ennoblements",html:p}),document.querySelectorAll("#ennoblementsPagination a").forEach(e=>{e.addEventListener("click",s)})};exports.default=s;
},{"../i18n/showEnnoblementsPopup":"tKRp","../utils/pagination":"fCHX","../utils/showPopup":"chDM","../utils/date":"ZbyX","../utils/tribalwars":"fHHP"}],"UdfQ":[function(require,module,exports) {
"use strict";var e=g(require("./libs/requestCreator")),t=g(require("./i18n/extendedVillageProfile")),n=require("./utils/pagination"),r=g(require("./utils/getCurrentServer")),o=g(require("./utils/getIDFromURL")),i=g(require("./utils/buildUnitImgURL")),l=require("./utils/date"),a=g(require("./utils/wait")),c=require("./utils/localStorage"),s=g(require("./utils/calcLoyalty")),u=g(require("./utils/getServerVersionCode")),d=m(require("./utils/twhelp")),p=g(require("./common/showEnnoblementsPopup"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function m(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}return n.default=e,t&&t.set(e,n),n}function g(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const v=(0,r.default)(),w=(0,o.default)(window.location.search),O="\n    query ennoblements($server: String!, $limit: Int, $sort: [String!], $filter: EnnoblementFilter!) {\n        ennoblements(server: $server, limit: $limit, sort: $sort, filter: $filter) {\n            items {\n                ennobledAt\n                village {\n                    id\n                }\n            }\n        }\n    }\n",q="\n    query ennoblements($server: String!, $offset: Int, $limit: Int, $sort: [String!], $filter: EnnoblementFilter!) {\n      ennoblements(server: $server, offset: $offset, limit: $limit, sort: $sort, filter: $filter) {\n        total\n        items {\n          village {\n            id\n            name\n            x\n            y\n          }\n          oldOwner {\n            id\n            name\n          }\n          oldOwnerTribe {\n            id\n            tag\n          }\n          newOwner {\n            id\n            name\n          }\n          newOwnerTribe {\n            id\n            tag\n          }\n          ennobledAt\n        }\n      }\n    }\n",S=15,E="\n    query server($key: String!) {\n        server(key: $key) {\n            config {\n              speed\n            }\n            unitConfig {\n              spear {\n                pop\n              }\n              sword {\n                pop\n              }\n              axe {\n                pop\n              }\n              archer {\n                pop\n              }\n              spy {\n                pop\n              }\n              light {\n                pop\n              }\n              marcher {\n                pop\n              }\n              heavy {\n                pop\n              }\n              ram {\n                pop\n              }\n              catapult {\n                pop\n              }\n              knight {\n                pop\n              }\n              snob {\n                pop\n              }\n            }\n        }\n    }\n",j="kiszkowaty_extended_village_profile_server_cfg",D=document.querySelector("#content_value > table > tbody > tr > td:nth-child(1) > table:nth-child(2) > tbody"),P=document.querySelector("#content_value table.vis tbody");let $={};const A=(0,t.default)(),C=()=>(0,c.getItem)(j),L=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,c.setItem)(j,e)},_=e=>Math.abs(e.getTime()-(new Date).getTime())>864e5,k=async()=>{let t=C();return t.server&&!_(new Date(t.loadedAt))&&t.server.unitConfig&&t.server.config||((t=await(0,e.default)({query:E,variables:{key:v}})).loadedAt=new Date,L(t)),t.server},T=async()=>{return await(0,e.default)({query:O,variables:{server:v,filter:{villageID:[w]},sort:["ennobledAt DESC"],limit:1}})},I=async t=>{t.preventDefault();const r=(0,n.getPage)(t.target);if(!isNaN(r)){const n=await(0,e.default)({query:q,variables:{filter:{villageID:[w]},offset:15*(r-1),limit:15,sort:["ennobledAt DESC"],server:v}});(0,p.default)(t,n.ennoblements,{currentPage:r,limit:15,onPageChange:I})}},M=e=>{const t=[];let n=0;for(let r in e)n+=e[r]*$.unitConfig[r].pop,t.push("<td>".concat(e[r].toLocaleString(),"</td>"));return t.push("<td><strong>".concat(n.toLocaleString(),"</strong></td>")),t},x=async e=>{e.preventDefault();const t=[],n={};document.querySelectorAll('span.command_hover_details[data-command-type="support"]').forEach(e=>{const r=parseInt(e.getAttribute("data-command-id"));e.classList.contains("commandicon-ally")?n[r]=!0:n[r]=!1,t.push(r)});const r={spear:0,sword:0,axe:0,archer:0,spy:0,light:0,marcher:0,heavy:0,ram:0,catapult:0,knight:0,snob:0},o=y({},r),l=y({},r);for(let i=0;i<t.length;i++){Dialog.show("incomingSupport","".concat(A.loaded,": <strong>").concat(i," / ").concat(t.length,"</strong>"));const e=t[i],c=TribalWars.buildURL("",{screen:"info_command",ajax:"details",id:e});try{const t=await fetch(c),{units:i}=await t.json();if(i)for(let a in r){const t=parseInt(i[a].count);n[e]?o[a]+=t:r[a]+=t,l[a]+=t}await(0,a.default)(200)}catch(f){console.log("count incoming support",f)}}const c=["<th></th>"];for(let a in r)c.push('<th><img src="'.concat((0,i.default)(a),'" /></th>'));c.push("<th>".concat(A.pop,"</th>"));const s=["<th>".concat(A.mySupport,"</th>"),...M(r)],u=["<th>".concat(A.allySupport,"</th>"),...M(o)],d=["<th>".concat(A.total,"</th>"),...M(l)];Dialog.show("incomingSupport",'\n    <table class="vis" style="width: 100%;">\n      <tbody>\n          <tr>\n            '.concat(c.join(""),"\n          </tr>\n          <tr>\n            ").concat(s.join(""),"\n          </tr>\n          <tr>\n            ").concat(u.join(""),"\n          </tr>\n          <tr>\n            ").concat(d.join(""),"\n          </tr>\n      </tbody>\n    </table>\n  "));const p=document.querySelector(".popup_box");p&&(p.style.width="auto",p.style.maxWidth="900px")},H=e=>{const t=document.createElement("td");t.colSpan="2",t.append(e);const n=document.createElement("tr");return n.appendChild(t),n},W=()=>{const e=document.createElement("a");e.href=d.buildVillageURL((0,u.default)(v),v,w),e.innerHTML=A.action.linkToTWHelp,D.appendChild(H(e));const t=document.createElement("a");t.href="#",(0,n.setPage)(t,"1"),t.innerHTML=A.action.showEnnoblements,t.addEventListener("click",I),D.appendChild(H(t));const r=document.createElement("a");r.href="#",r.innerHTML=A.action.countIncomingSupport,r.addEventListener("click",x),D.appendChild(H(r))},U=e=>{let{title:t,data:n,id:r}=e,o=document.querySelector("#"+r);o||((o=document.createElement("tr")).id=r,o.appendChild(document.createElement("td")),o.appendChild(document.createElement("td")),P.append(o)),o.children[0].innerHTML=t,o.children[1].innerHTML=n},R=()=>{const e=document.querySelectorAll("#content_value > div tbody tr"),t=[];if(0===e.length)throw new Error;e[0].querySelectorAll(".unit_link").forEach(()=>{t.push(0)});for(let n=1;n<e.length;n++){e[n].querySelectorAll(".unit-item").forEach((e,n)=>{t[n]+=parseInt(e.innerHTML)})}return t},F=function(){let{config:e,ennoblements:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=t&&Array.isArray(t.items)&&t.items[0]?t.items[0]:void 0;U({id:"loyalty",title:"".concat(A.possibleLoyalty,":"),data:n?(0,s.default)(new Date(n.ennobledAt),e.speed):100}),U({id:"ennobledAt",title:"".concat(A.ennobledAt,":"),data:n?(0,l.formatDate)(n.ennobledAt):A.never});try{const e=R(),t=document.createElement("tr");t.style.textAlign="center",t.style.fontWeight="bold",t.appendChild(document.createElement("td")),e.forEach(e=>{const n=document.createElement("td");n.innerHTML=e,t.appendChild(n)}),document.querySelector("#content_value > div tbody").appendChild(t)}catch(r){}};!async function(){try{const t=await T();$=await k(),F({config:$.config,ennoblements:t.ennoblements}),W()}catch(e){console.log("extended village profile",e)}}();
},{"./libs/requestCreator":"Ph2E","./i18n/extendedVillageProfile":"LNef","./utils/pagination":"fCHX","./utils/getCurrentServer":"DMkL","./utils/getIDFromURL":"tQUs","./utils/buildUnitImgURL":"KX6P","./utils/date":"ZbyX","./utils/wait":"oUdd","./utils/localStorage":"KWxH","./utils/calcLoyalty":"kcC2","./utils/getServerVersionCode":"J1Ly","./utils/twhelp":"gvXE","./common/showEnnoblementsPopup":"vNT1"}]},{},["UdfQ"], null)