text: !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).WBK=e()}}(function(){return function s(o,a,u){function l(t,e){if(!a[t]){if(!o[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var n=a[t]={exports:{}};o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,s,o,a,u)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<u.length;e++)l(u[e]);return l}({1:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{!i&&a.return&&a.return()}finally{if(n)throw s}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=e("./wikibase_time_to_date_object"),s={isNumericId:function(e){return/^[1-9][0-9]*$/.test(e)},isEntityId:function(e){return/^((Q|P|L)[1-9][0-9]*|L[1-9][0-9]*-(F|S)[1-9][0-9]*)$/.test(e)},isEntitySchemaId:function(e){return/^E[1-9][0-9]*$/.test(e)},isItemId:function(e){return/^Q[1-9][0-9]*$/.test(e)},isPropertyId:function(e){return/^P[1-9][0-9]*$/.test(e)},isLexemeId:function(e){return/^L[1-9][0-9]*$/.test(e)},isFormId:function(e){return/^L[1-9][0-9]*-F[1-9][0-9]*$/.test(e)},isSenseId:function(e){return/^L[1-9][0-9]*-S[1-9][0-9]*$/.test(e)},isGuid:function(e){return/^((Q|P|L)[1-9][0-9]*|L[1-9][0-9]*-(F|S)[1-9][0-9]*)\$[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)},isHash:function(e){return/^[0-9a-f]{40}$/.test(e)},isPropertyClaimsId:function(e){var t=e.split("#"),r=a(t,2),i=r[0],n=r[1];return s.isEntityId(i)&&s.isPropertyId(n)},isRevisionId:function(e){return/^\d+$/.test(e)},isEntityPageTitle:function(e){if("string"!=typeof e)return!1;var t=e.split(":"),r=a(t,2),i=r[0],n=r[1];return i&&n?u(i)&&s["is"+i+"Id"](n):(n=i,s.isItemId(n))}},o=["Item","Property","Lexeme"],u=function(e){return o.includes(e)};s.getNumericId=function(e){if(!/^(Q|P|L)[1-9][0-9]*$/.test(e))throw new Error("invalid entity id: "+e);return e.replace(/^(Q|P|L)/,"")},s.wikibaseTimeToDateObject=i;var l=function(e){return function(t){try{return e(t)}catch(e){var r=(t=t.time||t)[0],i=t.slice(1).split("T"),n=a(i,2),s=n[0],o=n[1];return""+r+(s=s.replace(/-00/g,"-01"))+"T"+o}}};s.wikibaseTimeToEpochTime=l(function(e){return i(e).getTime()}),s.wikibaseTimeToISOString=l(function(e){return i(e).toISOString()}),s.wikibaseTimeToSimpleDay=l(function(e){if("object"===(void 0===e?"undefined":n(e))){var t=e,r=t.time,i=t.precision;e=9===i?r.replace("-01-01T","-00-00T"):10===i?r.replace("-01T","-00T"):r}return e.split("T")[0].replace(/^\+/,"").replace(/^(-?)0+/,"$1").replace(/-00$/,"").replace(/-00$/,"")}),s.getImageUrl=function(e,t){var r="https://commons.wikimedia.org/wiki/Special:FilePath/"+e;return"number"==typeof t&&(r+="?width="+t),r},s.getEntityIdFromGuid=function(e){var t=e.split(/[$-]/);if(6===t.length)return t[0].toUpperCase();if(7===t.length)return t.slice(0,2).join("-").toUpperCase();throw new Error("invalid guid: "+e)},t.exports=s},{"./wikibase_time_to_date_object":16}],2:[function(e,t,r){"use strict";var i=e("./helpers"),n=i.wikibaseTimeToISOString,s=i.wikibaseTimeToEpochTime,o=i.wikibaseTimeToSimpleDay,a=function(e){return e.value},u=function(e,t){return c(e,t.entityPrefix)},l={item:"Q",lexeme:"L",property:"P"},c=function(e,t){var r=e.value,i=r.id||l[r["entity-type"]]+r["numeric-id"];return"string"==typeof t?t+":"+i:i},f=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"iso",t=p[e];if(!t)throw new Error("invalid converter key: "+JSON.stringify(e).substring(0,100));return t},p={iso:n,epoch:s,"simple-day":o,none:function(e){return e.time||e}},m={commonsMedia:a,"external-id":a,"geo-shape":a,"globe-coordinate":function(e,t){return t.keepRichValues?e.value:[e.value.latitude,e.value.longitude]},math:a,monolingualtext:function(e,t){return t.keepRichValues?e.value:e.value.text},"musical-notation":a,quantity:function(e,t){var r=e.value,i=parseFloat(r.amount);if(t.keepRichValues){var n={amount:parseFloat(r.amount),unit:r.unit.replace(/^https?:\/\/.*\/entity\//,"")};return null!=r.upperBound&&(n.upperBound=parseFloat(r.upperBound)),null!=r.lowerBound&&(n.lowerBound=parseFloat(r.lowerBound)),n}return i},string:a,"tabular-data":a,time:function(e,t){var r=void 0;if(r="function"==typeof t.timeConverter?t.timeConverter(e.value):f(t.timeConverter)(e.value),t.keepRichValues){var i=e.value;return{time:r,timezone:i.timezone,before:i.before,after:i.after,precision:i.precision,calendarmodel:i.calendarmodel}}return r},url:a,"wikibase-entityid":u,"wikibase-form":u,"wikibase-item":u,"wikibase-lexeme":u,"wikibase-property":u,"wikibase-sense":u};t.exports={parsers:m,parse:function(t,e,r,i){t=(t=t||e.type).replace(" ","-");try{return m[t](e,r)}catch(e){throw"parsers[datatype] is not a function"===e.message&&(e.message=t+" claim parser isn't implemented\n        Claim id: "+i+"\n        Please report to https://github.com/maxlath/wikibase-sdk/issues"),e}}}},{"./helpers":1}],3:[function(e,t,r){"use strict";var i=e("./simplify_entity").simplifyEntity,n={entities:function(e){var t=(e=e.body||e).entities;return Object.keys(t).forEach(function(e){t[e]=i(t[e])}),t},pagesTitles:function(e){return(e=e.body||e).query.search.map(function(e){return e.title})}};t.exports={wb:n,wd:n}},{"./simplify_entity":7}],4:[function(e,t,r){"use strict";var i=function(e){var t=e.reduce(n,{});return t.preferred||t.normal||[]},n=function(e,t){var r=t.rank;return e[r]||(e[r]=[]),e[r].push(t),e};t.exports={truthyClaims:function(t){var r={};return Object.keys(t).forEach(function(e){r[e]=i(t[e])}),r},truthyPropertyClaims:i}},{}],5:[function(e,t,r){"use strict";var i=e("./simplify_text_attributes"),n=i.labels,s=i.descriptions,o=i.aliases,a=i.lemmas,u=i.glosses,l=e("./simplify_claims"),c=l.simplifyClaim,f=l.simplifyPropertyClaims,p=l.simplifyClaims,m=l.simplifyQualifier,y=l.simplifyPropertyQualifiers,d=l.simplifyQualifiers,v=l.simplifyReferences,h=e("./simplify_forms"),g=h.simplifyForm,b=h.simplifyForms,w=e("./simplify_senses"),k=w.simplifySense,_=w.simplifySenses,E=e("./simplify_sitelinks"),S=e("./simplify_sparql_results");t.exports={labels:n,descriptions:s,aliases:o,claim:c,propertyClaims:f,claims:p,qualifier:m,propertyQualifiers:y,qualifiers:d,references:v,sitelinks:E,snak:c,propertySnaks:f,snaks:p,lemmas:a,glosses:u,form:g,forms:b,sense:k,senses:_,sparqlResults:S}},{"./simplify_claims":6,"./simplify_forms":8,"./simplify_senses":9,"./simplify_sitelinks":10,"./simplify_sparql_results":11,"./simplify_text_attributes":12}],6:[function(e,t,r){"use strict";var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{!i&&a.return&&a.return()}finally{if(n)throw s}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=e("./parse_claim").parse,u=e("../utils/utils").uniq,l=e("./rank").truthyPropertyClaims,n=function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];var n=S(r).propertyPrefix,s={};for(var o in e){var a=e[o];n&&(o=n+":"+o),s[o]=c.apply(void 0,[a].concat(r))}return s},c=function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];if(null==e||0===e.length)return[];var n=S(r),s=n.keepNonTruthy,o=n.areSubSnaks;return s||o||(e=l(e)),(e=e.map(function(e){return p.apply(void 0,[e].concat(r))}).filter(f))[0]&&"object"!==a(e[0])?u(e):e},f=function(e){return void 0!==e},p=function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r=S(r);var n=q(r),s=n.keepQualifiers,o=n.keepReferences,a=n.keepIds,u=n.keepHashes,l=n.keepTypes,c=n.keepSnaktypes,f=n.keepRanks,p=e.mainsnak,m=e.rank,y=void 0,d=void 0,v=void 0,h=void 0,g=void 0,b=void 0;if(p?(d=p.datatype,v=p.datavalue,h=p.snaktype):(v=e.datavalue,d=e.datatype,h=e.snaktype,e.hash?g=!0:b=!0),v)y=E(d,v,r,e.id);else if("somevalue"===h)y=r.somevalueValue;else{if("novalue"!==h)throw new Error("no datavalue or special snaktype found");y=r.novalueValue}if(g){if(!(u||l||c))return y;var w={value:y};return u&&(w.hash=e.hash),l&&(w.type=d),c&&(w.snaktype=h),w}if(b)return l?{type:d,value:y}:y;if(!(s||o||a||l||c||f))return y;var k={value:y};l&&(k.type=d),c&&(k.snaktype=h),f&&(k.rank=m);var _=I(r);return _.keepHashes=u,s&&(k.qualifiers=x(e.qualifiers,_)),o&&(e.references=e.references||[],k.references=j(e.references,_)),a&&(k.id=e.id),k},S=function(e){if(null==e)return{};if(e[0]&&"object"===a(e[0]))return e[0];var t=i(e,3);return{entityPrefix:t[0],propertyPrefix:t[1],keepQualifiers:t[2]}},x=function(e,t){return n(e,I(t))},j=function(e,t){return e.map(function(e){return s(e,t)})},s=function(e,t){var r=I(t),i=n(e.snaks,r);return r.keepHashes?{snaks:i,hash:e.hash}:i},I=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return e.areSubSnaks?e:Object.assign({},e,{areSubSnaks:!0})},o=["keepQualifiers","keepReferences","keepIds","keepHashes","keepTypes","keepSnaktypes","keepRanks","keepRichValues"],q=function(t){return t.keepAll&&o.forEach(function(e){null==t[e]&&(t[e]=!0)}),t};t.exports={simplifyClaims:n,simplifyPropertyClaims:c,simplifyClaim:p,simplifyQualifiers:x,simplifyPropertyQualifiers:function(e,t){return c(e,I(t))},simplifyQualifier:p,simplifyReferences:j}},{"../utils/utils":27,"./parse_claim":2,"./rank":4}],7:[function(e,t,r){"use strict";var n=e("./simplify"),o=function(e,t){var r=e.type,i={id:e.id,type:r,modified:e.modified};return e.datatype&&(i.datatype=e.datatype),"item"===r?(s(e,i,"labels"),s(e,i,"descriptions"),s(e,i,"aliases"),s(e,i,"claims",t),s(e,i,"sitelinks",t)):"property"===r?(i.datatype=e.datatype,s(e,i,"labels"),s(e,i,"descriptions"),s(e,i,"aliases"),s(e,i,"claims",t)):"lexeme"===r&&(s(e,i,"lemmas"),i.lexicalCategory=e.lexicalCategory,i.language=e.language,s(e,i,"claims",t),s(e,i,"forms",t),s(e,i,"senses",t)),i},s=function(e,t,r,i){null!=e[r]&&(t[r]=n[r](e[r],i))},i=function(i){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};i.entities&&(i=i.entities);var s=n.entityPrefix;return Object.keys(i).reduce(function(e,t){var r=i[t];return s&&(t=s+":"+t),e[t]=o(r,n),e},{})};n.entity=o,n.entities=i,t.exports={simplifyEntity:o,simplifyEntities:i}},{"./simplify":5}],8:[function(e,t,r){"use strict";var o=e("./helpers").isFormId,a=e("./simplify_text_attributes").representations,u=e("./simplify_claims").simplifyClaims,i=function(e,t){var r=e.id,i=e.representations,n=e.grammaticalFeatures,s=e.claims;if(!o(r))throw new Error("invalid form object");return{id:r,representations:a(i),grammaticalFeatures:n,claims:u(s,t)}};t.exports={simplifyForm:i,simplifyForms:function(e,t){return e.map(function(e){return i(e,t)})}}},{"./helpers":1,"./simplify_claims":6,"./simplify_text_attributes":12}],9:[function(e,t,r){"use strict";var s=e("./helpers").isSenseId,o=e("./simplify_text_attributes").glosses,a=e("./simplify_claims").simplifyClaims,i=function(e,t){var r=e.id,i=e.glosses,n=e.claims;if(!s(r))throw new Error("invalid sense object");return{id:r,glosses:o(i),claims:a(n,t)}};t.exports={simplifySense:i,simplifySenses:function(e,t){return e.map(function(e){return i(e,t)})}}},{"./helpers":1,"./simplify_claims":6,"./simplify_text_attributes":12}],10:[function(e,t,r){"use strict";var s=e("./sitelinks").getSitelinkUrl;t.exports=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).addUrl;return Object.keys(e).reduce(i(e,t),{})};var i=function(i,n){return function(e,t){var r=i[t].title;return e[t]=n?{title:r,url:s(t,r)}:r,e}}},{"./sitelinks":13}],11:[function(e,t,r){"use strict";t.exports=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&(e=JSON.parse(e));var r=e.head.vars,i=e.results.bindings;if(1===r.length&&!0===t.minimize){var n=r[0];return i.map(function(e){return x(e[n])}).filter(function(e){return null!=e})}var s=c(r),o=s.richVars,a=s.associatedVars,u=s.standaloneVars;return i.map(p(o,a,u))};var x=function(e){if(e){var t=e.datatype;return t=t&&t.replace("http://www.w3.org/2001/XMLSchema#",""),(i[e.type]||s(t))(e)}},i={uri:function(e){return u(e.value)},bnode:function(){return null}},n=function(e){return parseFloat(e.value)},s=function(e){return e=e&&e.replace("http://www.w3.org/2001/XMLSchema#",""),o[e]||a},o={decimal:n,integer:n,float:n,double:n,boolean:function(e){return"true"===e.value}},a=function(e){return e.value},u=function(e){return e.match(/http.*\/entity\/statement\//)?l(e):e.replace(/^https?:\/\/.*\/entity\//,"").replace(/^https?:\/\/.*\/prop\/direct\//,"")},l=function(e){var t=(e=e.replace(/^https?:\/\/.*\/entity\/statement\//,"")).split("-");return t[0]+"$"+t.slice(1).join("-")},c=function(t){var r=t.filter(function(e){return t.some(f(e))}),i=new RegExp("^("+r.join("|")+")[A-Z]"),e=t.filter(function(e){return i.test(e)}),n=t.filter(function(e){return!r.includes(e)&&!i.test(e)});return{richVars:r,associatedVars:e,standaloneVars:n}},f=function(e){var t=new RegExp("^"+e+"[A-Z]\\w+");return t.test.bind(t)},p=function(_,E,S){return function(e){var t={},r=!0,i=!1,n=void 0;try{for(var s,o=_[Symbol.iterator]();!(r=(s=o.next()).done);r=!0){var a=s.value,u={},l=x(e[a]);null!=l&&(u.value=l);var c=!0,f=!1,p=void 0;try{for(var m,y=E[Symbol.iterator]();!(c=(m=y.next()).done);c=!0){var d=m.value;d.startsWith(a)&&j(e,a,d,u)}}catch(e){f=!0,p=e}finally{try{!c&&y.return&&y.return()}finally{if(f)throw p}}0<Object.keys(u).length&&(t[a]=u)}}catch(e){i=!0,n=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw n}}var v=!0,h=!1,g=void 0;try{for(var b,w=S[Symbol.iterator]();!(v=(b=w.next()).done);v=!0){var k=b.value;t[k]=x(e[k])}}catch(e){h=!0,g=e}finally{try{!v&&w.return&&w.return()}finally{if(h)throw g}}return t}},j=function(e,t,r,i){var n=r.split(t)[1];n=n[0].toLowerCase()+n.slice(1),n=m[n]||n;var s=e[r];null!=s&&(i[n]=s.value)},m={altLabel:"aliases"}},{}],12:[function(e,t,r){"use strict";var i=function(n){return function(r){var i={};return Object.keys(r).forEach(function(e){var t=r[e];i[e]=null!=t?n?t.map(s):t.value:n?[]:null}),i}},s=function(e){return e.value},n=i(!1);t.exports={labels:n,descriptions:n,aliases:i(!0),lemmas:n,representations:n,glosses:n}},{}],13:[function(e,t,r){"use strict";var v=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{!i&&a.return&&a.return()}finally{if(n)throw s}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=e("../utils/utils"),s=i.fixedEncodeURIComponent,o=i.replaceSpaceByUnderscores,a=i.isPlainObject,n=e("./helpers").isPropertyId,u="https://www.wikidata.org/wiki/",h=e("./sitelinks_languages"),l=function(t){return function(e){return"https://"+t+".wikimedia.org/wiki/"+e}},c={commons:l("commons"),mediawiki:function(e){return"https://www.mediawiki.org/wiki/"+e},meta:l("meta"),species:l("species"),wikidata:function(e){return n(e)?u+"Property:"+e:""+u+e},wikimania:l("wikimania")},g=/^https?:\/\/([\w-]{2,10})\.(\w+)\.org\/\w+\/(.*)/,f=function(e){if(e.startsWith("http")){var t=e,r=t.match(g);if(!r)throw new Error("invalid sitelink url: "+t);var i=r.slice(1),n=v(i,3),s=n[0],o=n[1],a=n[2];a=decodeURIComponent(a);var u=void 0;return"www"===s?(s="en",u=o):"commons"===s?(s="en",o=u="commons"):u=(""+s+o).replace("wikipedia","wiki"),{lang:s,project:o,key:u,title:a,url:t}}var l=e,c=b[l];if(c)return{lang:"en",project:c,key:l};var f=l.split("wik"),p=v(f,3),m=p[0],y=p[1];if(null!=p[2])throw new Error("invalid sitelink key: "+l);if(-1===h.indexOf(m))throw new Error("sitelink lang not found: "+m);var d=w[y];if(!d)throw new Error("sitelink project not found: "+d);return{lang:m,project:d,key:l}},b={commonswiki:"commons",mediawikiwiki:"mediawiki",metawiki:"meta",specieswiki:"specieswiki",wikidatawiki:"wikidata",wikimaniawiki:"wikimania"},w={i:"wikipedia",isource:"wikisource",iquote:"wikiquote",tionary:"wiktionary",ibooks:"wikibooks",iversity:"wikiversity",ivoyage:"wikivoyage",inews:"wikinews"};t.exports={getSitelinkUrl:function(e,t){if(a(e)&&(t=e.title,e=e.site),!e)throw new Error("missing a site");if(!t)throw new Error("missing a title");var r=e.replace(/wiki$/,""),i=c[r]||c[e];if(i)return i(t);var n=f(e);return"https://"+n.lang+"."+n.project+".org/wiki/"+(t=s(o(t)))},getSitelinkData:f,isSitelinkKey:function(e){try{return f(e),!0}catch(e){return!1}}}},{"../utils/utils":27,"./helpers":1,"./sitelinks_languages":14}],14:[function(e,t,r){"use strict";t.exports=["aa","ab","ace","ady","af","ak","als","alt","am","ang","an","arc","ar","ary","arz","ast","as","atj","avk","av","awa","ay","azb","az","ban","bar","bat_smg","ba","bcl","be_x_old","be","bg","bh","bi","bjn","bm","bn","bo","bpy","br","bs","bug","bxr","ca","cbk_zam","cdo","ceb","ce","cho","chr","ch","chy","ckb","co","crh","cr","csb","cs","cu","cv","cy","da","de","din","diq","dsb","dty","dv","dz","ee","el","eml","en","eo","es","et","eu","ext","fa","ff","fiu_vro","fi","fj","fo","frp","frr","fr","fur","fy","gag","gan","ga","gcr","gd","glk","gl","gn","gom","gor","got","gu","gv","hak","ha","haw","he","hif","hi","ho","hr","hsb","ht","hu","hy","hyw","hz","ia","id","ie","ig","ii","ik","ilo","inh","io","is","it","iu","jam","ja","jbo","jv","kaa","kab","ka","kbd","kbp","kg","ki","kj","kk","kl","km","kn","koi","ko","krc","kr","ksh","ks","ku","kv","kw","ky","lad","la","lbe","lb","lez","lfn","lg","lij","li","lld","lmo","ln","lo","lrc","ltg","lt","lv","mad","mai","map_bms","mdf","mg","mhr","mh","min","mi","mk","ml","mni","mn","mnw","mo","mrj","mr","ms","mt","mus","mwl","myv","my","mzn","nah","nap","na","nds_nl","nds","ne","new","ng","nia","nl","nn","nov","no","nqo","nrm","nso","nv","ny","oc","olo","om","or","os","pag","pam","pap","pa","pcd","pdc","pfl","pih","pi","pl","pms","pnb","pnt","ps","pt","qu","rm","rmy","rn","roa_rup","roa_tara","ro","rue","ru","rw","sah","sat","sa","scn","sco","sc","sd","se","sg","shn","sh","shy","simple","si","skr","sk","sl","smn","sm","sn","sources","so","sq","srn","sr","ss","stq","st","su","sv","sw","szl","szy","ta","tay","tcy","tet","te","tg","th","ti","tk","tl","tn","to","tpi","trv","tr","ts","tt","tum","tw","tyv","ty","udm","ug","uk","ur","uz","vec","vep","ve","vi","vls","vo","war","wa","wo","wuu","xal","xh","xmf","yi","yo","yue","za","zea","zh_classical","zh_min_nan","zh_yue","zh","zu"]},{}],15:[function(e,t,r){"use strict";var i=e("./helpers"),n=function(t,r){return function(e){if(!i[r](e))throw new Error("invalid "+t+": "+e)}};t.exports={entityId:n("entity id","isEntityId"),propertyId:n("property id","isPropertyId"),entityPageTitle:n("entity page title","isEntityPageTitle"),revisionId:n("revision id","isRevisionId")}},{"./helpers":1}],16:[function(e,t,r){"use strict";var o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,n=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);i=!0);}catch(e){n=!0,s=e}finally{try{!i&&a.return&&a.return()}finally{if(n)throw s}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e){"object"===(void 0===e?"undefined":a(e))&&(e=e.time);var t=e[0],r=e.slice(1).split("T"),i=o(r,2),n=i[0],s=i[1];return n=n.replace(/-00/g,"-01"),u(t,n+"T"+s)};var u=function(e,t){var r=t.split("-")[0];return"-"===e||4<r.length?i(e,t,r):new Date(t)},i=function(e,t,r){var i=void 0;return i=4===r.length?e+"00"+t:5===r.length?e+"0"+t:e+t,new Date(i)}},{}],17:[function(e,t,r){"use strict";var b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=e("../utils/utils").isPlainObject,k=/^\d+[|\d]*$/;t.exports=function(g){return function(e){if(!w(e))throw new Error("expected parameters to be passed as an object, got "+e+" ("+(void 0===e?"undefined":b(e))+")");var t=e.search,r=e.haswbstatement,i=e.format,n=void 0===i?"json":i,s=e.limit,o=e.offset,a=e.profile,u=e.sort,l=e.namespace;if(!t&&!r)throw new Error('missing "search" or "haswbstatement" parameter');var c="";if(t&&(c+=t),r){var f=r instanceof Array?r:[r],p=!0,m=!1,y=void 0;try{for(var d,v=f[Symbol.iterator]();!(p=(d=v.next()).done);p=!0){var h=d.value;"-"===h[0]?c+=" -haswbstatement:"+h.slice(1):c+=" haswbstatement:"+h}}catch(e){m=!0,y=e}finally{try{!p&&v.return&&v.return()}finally{if(m)throw y}}}if(null!=s&&("number"!=typeof s||s<1))throw new Error("invalid limit: "+s);if(null!=o&&("number"!=typeof o||o<0))throw new Error("invalid offset: "+o);if(l instanceof Array?l=l.join("|"):"number"==typeof l&&(l=l.toString()),l&&!k.test(l))throw new Error("invalid namespace: "+l);if(null!=a&&"string"!=typeof a)throw new Error("invalid profile: "+a+" ("+(void 0===a?"undefined":b(a))+", expected string)");if(null!=u&&"string"!=typeof u)throw new Error("invalid sort: "+u+" ("+(void 0===u?"undefined":b(u))+", expected string)");return g({action:"query",list:"search",srsearch:c.trim(),format:n,srnamespace:l,srlimit:s,sroffset:o,srqiprofile:a,srsort:u})}}},{"../utils/utils":27}],18:[function(e,t,r){"use strict";var i=e("../utils/utils"),u=i.isPlainObject,l=i.forceArray,c=i.shortLang,f=e("../helpers/validate");t.exports=function(a){return function(e,t,r,i,n){if(u(e)){var s=e;e=s.ids,t=s.languages,r=s.props,i=s.format,n=s.redirects}if(i=i||"json",!(e&&0<e.length))throw new Error("no id provided");(e=l(e)).forEach(f.entityId),50<e.length&&console.warn("getEntities accepts 50 ids max to match Wikidata API limitations:\n      this request won't get all the desired entities.\n      You can use getManyEntities instead to generate several request urls\n      to work around this limitation");var o={action:"wbgetentities",ids:e.join("|"),format:i};return!1===n&&(o.redirects="no"),t&&(t=l(t).map(c),o.languages=t.join("|")),r&&0<r.length&&(o.props=l(r).join("|")),a(o)}}},{"../helpers/validate":15,"../utils/utils":27}],19:[function(e,t,r){"use strict";var i=e("../utils/utils"),l=i.isPlainObject,c=i.forceArray,f=i.shortLang;t.exports=function(u){return function(e,t,r,i,n,s){if(l(e)){var o=e;e=o.titles,t=o.sites,r=o.languages,i=o.props,n=o.format,s=o.redirects}if(n=n||"json",!(e&&0<e.length))throw new Error("no titles provided");t&&0<t.length||(t=["enwiki"]),e=c(e),t=c(t).map(p),i=c(i);var a={action:"wbgetentities",titles:e.join("|"),sites:t.join("|"),format:n};return 1===t.length&&1===e.length&&(a.normalize=!0),r&&(r=c(r).map(f),a.languages=r.join("|")),i&&0<i.length&&(a.props=i.join("|")),!1===s&&(a.redirects="no"),u(a)}};var p=function(e){return 2===e.length?e+"wiki":e}},{"../utils/utils":27}],20:[function(e,t,r){"use strict";var n=e("../helpers/validate"),s=e("../utils/utils").isPlainObject;t.exports=function(r,i){return function(e,t){return s(e)&&(t=e.revision,e=e.id),n.entityId(e),n.revisionId(t),r+"/"+i+"/index.php?title=Special:EntityData/"+e+".json&revision="+t}}},{"../helpers/validate":15,"../utils/utils":27}],21:[function(t,e,r){"use strict";var a=t("../utils/utils").isPlainObject;e.exports=function(e){var o=t("./get_entities")(e);return function(e,t,r,i,n){if(a(e)){var s=e;e=s.ids,t=s.languages,r=s.props,i=s.format,n=s.redirects}if(!(e instanceof Array))throw new Error("getManyEntities expects an array of ids");return u(e).map(function(e){return o(e,t,r,i,n)})}};var u=function(e){for(var t=[];0<e.length;){var r=e.slice(0,50);e=e.slice(50),t.push(r)}return t}},{"../utils/utils":27,"./get_entities":18}],22:[function(t,e,r){"use strict";var f=t("../utils/utils").forceArray,i=t("../helpers/helpers").isItemId,p=t("../helpers/validate");e.exports=function(e){var c=t("./sparql_query")(e);return function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=r.limit,n=r.caseInsensitive,s=r.keepProperties,o=n?d:y,a=s?"":"FILTER NOT EXISTS { ?subject rdf:type wikibase:Property . } ",u=f(e);u.forEach(p.propertyId),u=u.map(v).join("|");var l="SELECT DISTINCT ?subject WHERE { "+m(t,o,u,a)+" }";return i&&(l+=" LIMIT "+i),c(l)}};var m=function(e,t,r,i){return e instanceof Array?"{ "+e.map(n).map(function(e){return t(r,e,i)}).join("} UNION {")+" }":t(r,n(e),i)},n=function(e){return i(e)?e="wd:"+e:"string"==typeof e&&(e="'"+e+"'"),e},y=function(e,t,r,i){return"?subject "+e+" "+t+" .\n    "+r},d=function(e,t,r,i){return"?subject "+e+" ?value .\n    FILTER (lcase(?value) = "+t.toLowerCase()+")\n    "+r},v=function(e){return"wdt:"+e}},{"../helpers/helpers":1,"../helpers/validate":15,"../utils/utils":27,"./sparql_query":25}],23:[function(e,t,r){"use strict";var l=e("../utils/utils").forceArray,c=e("../helpers/validate");t.exports=function(u){return function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};(e=l(e)).forEach(c.entityPageTitle);var r=1===e.length,i={action:"query",prop:"revisions"};i.titles=e.join("|"),i.format=t.format||"json",r&&(i.rvlimit=t.limit||"max"),r&&t.start&&(i.rvstart=f(t.start)),r&&t.end&&(i.rvend=f(t.end));var n=t.prop,s=t.user,o=t.excludeuser,a=t.tag;return n&&(i.rvprop=l(n).join("|")),s&&(i.rvuser=s),o&&(i.rvexcludeuser=o),a&&(i.rvtag=a),u(i)}};var f=function(e){return"number"==typeof e&&e<i?e:Math.trunc(new Date(e).getTime()/1e3)},i=new Date("2000-01-01").getTime()},{"../helpers/validate":15,"../utils/utils":27}],24:[function(e,t,r){"use strict";var l=e("../utils/utils").isPlainObject,c=["item","property","lexeme","form","sense"];t.exports=function(u){return function(e,t,r,i,n){var s=void 0,o=void 0;if(l(e)){var a=e;e=a.search,t=a.language,r=a.limit,o=a.continue,i=a.format,n=a.uselang,s=a.type}if(!(e&&0<e.length))throw new Error("search can't be empty");if(t=t||"en",n=n||t,r=r||"20",i=i||"json",s=s||"item",o=o||"0",!c.includes(s))throw new Error("invalid type: "+s);return u({action:"wbsearchentities",search:e,language:t,limit:r,continue:o,format:i,uselang:n,type:s})}}},{"../utils/utils":27}],25:[function(e,t,r){"use strict";var i=e("../utils/utils").fixedEncodeURIComponent;t.exports=function(r){return function(e){var t=i(e);return r+"?format=json&query="+t}}},{"../utils/utils":27}],26:[function(e,t,r){"use strict";var i="undefined"!=typeof location&&"undefined"!=typeof document,n=void 0;n=i?function(e){return new URLSearchParams(e).toString()}:e("querystring").stringify,t.exports=function(e){return function(t){return i&&(t.origin="*"),Object.keys(t).forEach(function(e){null==t[e]&&delete t[e]}),e+"?"+n(t)}}},{querystring:31}],27:[function(e,t,r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports={shortLang:function(e){return e.toLowerCase().split("_")[0]},forceArray:function(e){return"string"==typeof e&&(e=[e]),e||[]},isPlainObject:function(e){return!(!e||"object"!==(void 0===e?"undefined":i(e))||e instanceof Array)},fixedEncodeURIComponent:function(e){return encodeURIComponent(e).replace(/[!'()*]/g,n)},replaceSpaceByUnderscores:function(e){return e.replace(/\s/g,"_")},uniq:function(e){return Array.from(new Set(e))}};var n=function(e){return"%"+e.charCodeAt(0).toString(16)}},{}],28:[function(f,e,t){"use strict";var p=f("./utils/utils").isPlainObject,r=f("./helpers/simplify"),i=f("./helpers/parse_responses"),n=f("./helpers/helpers"),s=f("../lib/helpers/sitelinks"),o=f("../lib/helpers/rank"),m=Object.assign({simplify:r,parse:i},n,s,o),a=function(e){if(!p(e))throw new Error("invalid config");var t=e.instance,r=e.sparqlEndpoint,i=e.wgScriptPath,n=void 0===i?"w":i;if(n=n.replace(/^\//,""),!t&&!r)throw new Error("one of instance or sparqlEndpoint should be set at initialization.\nTip: if you just want to access functions that don't need an instance or a sparqlEndpoint,\nthose are also exposed directly on the module object. Exemple:\nconst { isItemId, simplify } = require('wikibase-sdk')");var s=void 0,o=void 0,a=void 0;if(t){y("instance",t),a=(o=t.replace(/\/$/,"").replace("/"+n+"/api.php",""))+"/"+n+"/api.php";var u=f("./utils/build_url")(a);s={searchEntities:f("./queries/search_entities")(u),cirrusSearchPages:f("./queries/cirrus_search")(u),getEntities:f("./queries/get_entities")(u),getManyEntities:f("./queries/get_many_entities")(u),getRevisions:f("./queries/get_revisions")(u),getEntityRevision:f("./queries/get_entity_revision")(t,n),getEntitiesFromSitelinks:f("./queries/get_entities_from_sitelinks")(u)}}else s={searchEntities:v("searchEntities"),cirrusSearchPages:v("cirrusSearchPages"),getEntities:v("getEntities"),getManyEntities:v("getManyEntities"),getRevisions:v("getRevisions"),getEntityRevision:v("getEntityRevision"),getEntitiesFromSitelinks:v("getEntitiesFromSitelinks")};var l=void 0;r?(y("sparqlEndpoint",r),l={sparqlQuery:f("./queries/sparql_query")(r),getReverseClaims:f("./queries/get_reverse_claims")(r)}):l={sparqlQuery:d("sparqlQuery"),getReverseClaims:d("getReverseClaims")};var c={instance:{root:o,apiEndpoint:a}};return Object.assign(c,m,s,l)};Object.assign(a,m);var y=function(e,t){if("string"!=typeof t||!t.startsWith("http"))throw new Error("invalid "+e+": "+t)},u=function(t){return function(e){return function(){throw new Error(e+" requires "+t+" to be set at initialization")}}},d=u("a sparqlEndpoint"),v=u("an instance");e.exports=a},{"../lib/helpers/rank":4,"../lib/helpers/sitelinks":13,"./helpers/helpers":1,"./helpers/parse_responses":3,"./helpers/simplify":5,"./queries/cirrus_search":17,"./queries/get_entities":18,"./queries/get_entities_from_sitelinks":19,"./queries/get_entity_revision":20,"./queries/get_many_entities":21,"./queries/get_reverse_claims":22,"./queries/get_revisions":23,"./queries/search_entities":24,"./queries/sparql_query":25,"./utils/build_url":26,"./utils/utils":27}],29:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var s=/\+/g;e=e.split(t);var o=1e3;i&&"number"==typeof i.maxKeys&&(o=i.maxKeys);var a,u,l=e.length;0<o&&o<l&&(l=o);for(var c=0;c<l;++c){var f,p,m,y,d=e[c].replace(s,"%20"),v=d.indexOf(r);0<=v?(f=d.substr(0,v),p=d.substr(v+1)):(f=d,p=""),m=decodeURIComponent(f),y=decodeURIComponent(p),a=n,u=m,Object.prototype.hasOwnProperty.call(a,u)?h(n[m])?n[m].push(y):n[m]=[n[m],y]:n[m]=y}return n};var h=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],30:[function(e,t,r){"use strict";var s=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(r,i,n,e){return i=i||"&",n=n||"=",null===r&&(r=void 0),"object"==typeof r?a(u(r),function(e){var t=encodeURIComponent(s(e))+n;return o(r[e])?a(r[e],function(e){return t+encodeURIComponent(s(e))}).join(i):t+encodeURIComponent(s(r[e]))}).join(i):e?encodeURIComponent(s(e))+n+encodeURIComponent(s(r)):""};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(e,t){if(e.map)return e.map(t);for(var r=[],i=0;i<e.length;i++)r.push(t(e[i],i));return r}var u=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],31:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":29,"./encode":30}]},{},[28])(28)});
  