plevinjs 0.1.1 β†’ 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,12 +9,12 @@
9
9
  **Location, network and abuse information for any IP address in one offline file.**<br>
10
10
  No API, no rate limit, no lookup leaving the machine β€” or the browser tab.
11
11
 
12
- ![npm](https://img.shields.io/npm/v/plevinjs?color=1868f2)
13
- ![Types](https://img.shields.io/badge/types-included-1868f2)
14
- ![License](https://img.shields.io/badge/license-Apache--2.0-1868f2)
15
- ![Fields](https://img.shields.io/badge/fields-98-6f42c1)
16
- ![Boundaries](https://img.shields.io/badge/boundaries-2.6M-6f42c1)
17
- ![Warm](https://img.shields.io/badge/warm%20lookups-4M%2Fs-2ea043)
12
+ [![npm](https://img.shields.io/npm/v/plevinjs?color=1868f2)](https://www.npmjs.com/package/plevinjs)
13
+ [![Types](https://img.shields.io/badge/types-included-1868f2)](https://www.npmjs.com/package/plevinjs?activeTab=code)
14
+ [![License](https://img.shields.io/badge/license-Apache--2.0-1868f2)](https://github.com/tn3w/plevin/blob/master/LICENSE)
15
+ [![Fields](https://img.shields.io/badge/fields-98-6f42c1)](#every-field)
16
+ [![Boundaries](https://img.shields.io/badge/boundaries-2.6M-6f42c1)](https://github.com/tn3w/plevin/blob/master/README.md#data)
17
+ [![Warm](https://img.shields.io/badge/warm%20lookups-4M%2Fs-2ea043)](#speed)
18
18
 
19
19
  </div>
20
20
 
@@ -55,12 +55,14 @@ Cloudflare Workers, and any browser off a CDN.
55
55
  <script type="module">
56
56
  import { open } from "https://cdn.jsdelivr.net/npm/plevinjs";
57
57
 
58
- const db = await open("https://plevin.tn3w.dev/db/plevin.plv");
59
- document.title = db.lookup("8.8.8.8").place.country.flag;
58
+ const db = await open("https://plevin.tn3w.dev/db/plevin.place-country-code.plv");
59
+ const { flag, name } = db.lookup("8.8.8.8").place.country;
60
+ document.body.textContent = `${flag} ${name}`; // 'πŸ‡ΊπŸ‡Έ United States'
60
61
  </script>
61
62
  ```
62
63
 
63
- `https://esm.sh/plevinjs` serves the same thing. Every database is rehosted with open
64
+ That build is 423 KB, the country code and nothing else, and the name and flag are
65
+ derived in the reader. `https://esm.sh/plevinjs` serves the same thing. Every database is rehosted with open
64
66
  CORS at [plevin.tn3w.dev/db](https://plevin.tn3w.dev/db/), because GitHub release
65
67
  downloads send no CORS header.
66
68
 
@@ -197,22 +199,31 @@ CDN serves it as it is.
197
199
  <script type="module">
198
200
  import { open } from "https://cdn.jsdelivr.net/npm/plevinjs";
199
201
 
200
- const db = await open("https://plevin.tn3w.dev/db/plevin.plv");
201
- document.title = db.lookup("1.1.1.1").place.country.flag;
202
+ const db = await open(
203
+ "https://plevin.tn3w.dev/db/plevin.place-country-code.plv"
204
+ );
205
+ const { flag, name } = db.lookup("1.1.1.1").place.country;
206
+ document.body.textContent = `${flag} ${name}`; // 'πŸ‡ΊπŸ‡Έ United States'
202
207
  </script>
203
208
  ```
204
209
 
210
+ Open the smallest build a page actually needs: `plevin.place-country-code.plv` is
211
+ 423 KB against the 16.9 MB of `plevin.plv`, so the first lookup lands in a moment
212
+ rather than a download.
213
+
205
214
  | | |
206
215
  | --- | --- |
207
- | `https://cdn.jsdelivr.net/npm/plevinjs` | the published files, as they are |
208
- | `https://esm.sh/plevinjs` | the same, imports rewritten |
216
+ | `https://cdn.jsdelivr.net/npm/plevinjs` | `dist/plevin.min.js`, the whole reader in one file |
209
217
  | `https://unpkg.com/plevinjs` | the same as jsDelivr |
218
+ | `https://esm.sh/plevinjs` | the modules as published, imports rewritten |
210
219
  | `https://plevin.tn3w.dev/plevin/` | the reader beside the databases |
211
220
 
212
- Every module is fetched as published, `./reader.js` and all, so the browser loads the
213
- ten it needs and nothing more. Pin a version for anything that ships:
214
- `cdn.jsdelivr.net/npm/plevinjs@0.1.0`. `plevinjs/node` is the only entry that touches
215
- Node, so a CDN import never reaches for `node:fs`.
221
+ jsDelivr and unpkg serve the bundle named by the `jsdelivr`/`unpkg` fields, 44 kB of
222
+ JavaScript with no further requests. The bare `dist/index.js` is not usable from those
223
+ URLs: it imports `./reader.js` and neighbours, which resolve against `/npm/` there and
224
+ 404. Pin a version for anything that ships: `cdn.jsdelivr.net/npm/plevinjs@0.1.2`.
225
+ `plevinjs/node` is the only entry that touches Node, so a CDN import never reaches for
226
+ `node:fs`.
216
227
 
217
228
  18 MB crosses the wire once, so keep it out of the critical path and out of the next
218
229
  visit's way:
@@ -268,7 +279,8 @@ npm ci
268
279
  npm test # node --test, no database needed for most of it
269
280
  npm run lint # biome
270
281
  npm run typecheck # tsc, strict
271
- npm run build # dist/, ESM and .d.ts
282
+ npm run build # dist/, ESM and .d.ts, plus the CDN bundle
283
+ npm run bundle # dist/plevin.min.js only (esbuild)
272
284
 
273
285
  node test/compare.ts ../plevin.plv sample.json # field for field against Python
274
286
  node test/blocks.ts ../plevin.plv 100000 # every block against libzstd
@@ -0,0 +1,625 @@
1
+ var V="ipv4-mapped",W="6to4",z="teredo",nn="nat64";var tn=(1n<<128n)-1n,rn=[["0.0.0.0/8",8],["10.0.0.0/8",1],["100.64.0.0/10",129],["127.0.0.0/8",3],["169.254.0.0/16",17],["172.16.0.0/12",1],["192.0.0.0/24",8],["192.0.2.0/24",72],["192.88.99.0/24",8],["192.168.0.0/16",1],["198.18.0.0/15",264],["198.51.100.0/24",72],["203.0.113.0/24",72],["224.0.0.0/4",4],["240.0.0.0/4",8]],an=[["::/128",8],["::1/128",3],["::ffff:0:0/96",8],["64:ff9b::/96",8],["64:ff9b:1::/48",8],["100::/64",8],["2001::/23",8],["2001:db8::/32",72],["2002::/16",8],["3fff::/20",72],["fc00::/7",33],["fe80::/10",17],["ff00::/8",4]],on=/^(0|[1-9][0-9]{0,2})$/,sn=/^[0-9a-fA-F]{1,4}$/,ge=e=>{let n=e.split(".");if(n.length!==4)return null;let t=0;for(let r of n){if(!on.test(r))return null;let i=Number(r);if(i>255)return null;t=t*256+i}return t},Ae=(e,n)=>{if(e==="")return[];let t=e.split(":"),r=[];for(let i=0;i<t.length;i+=1){let o=t[i];if(i===t.length-1&&o.includes(".")){let a=ge(o);if(a===null)return null;r.push(a>>>16,a&65535);continue}if(!sn.test(o))return null;r.push(Number.parseInt(o,16))}return r.length<=n?r:null},ln=e=>{let n=e.split("::");if(n.length>2)return null;let t=Ae(n[0],8),r=n.length===2?Ae(n[1],8):[];if(t===null||r===null)return null;let i=t.length+r.length;if(n.length===1?i!==8:i>7)return null;let o=[...t,...Array(8-i).fill(0),...r],a=0n;for(let s of o)a=a<<16n|BigInt(s);return a},v=e=>{if(typeof e=="string"){if(e.includes(":")){let r=ln(e);if(r===null)throw new Error(`${e} is not an address`);return[r,!0]}let t=ge(e);if(t===null)throw new Error(`${e} is not an address`);return[t,!1]}if(e instanceof Uint8Array){if(e.length===4)return[(e[0]<<24>>>0)+(e[1]<<16)+(e[2]<<8)+e[3],!1];if(e.length!==16)throw new Error("packed addresses are 4 or 16 bytes");let t=0n;for(let r of e)t=t<<8n|BigInt(r);return[t,!0]}if(typeof e!="bigint"&&!Number.isInteger(e))throw new Error(`${String(e)} is not an address`);let n=typeof e=="bigint"?e:BigInt(e);if(n<0n||n>tn)throw new Error(`${e} is not an address`);return n>BigInt(4294967295)?[n,!0]:[Number(n),!1]},cn=e=>Array.from({length:8},(n,t)=>Number(e>>BigInt(112-t*16)&0xffffn)),N=e=>[24,16,8,0].map(n=>e>>>n&255).join("."),Se=(e,n)=>{let t=-1,r=1,i=-1;for(let s=0;s<=n.length;s+=1)n[s]===0&&i<0&&(i=s),(n[s]!==0||s===n.length)&&i>=0&&(s-i>r&&([t,r]=[i,s-i]),i=-1);if(t<0)return e.join(":");let o=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return`${o}::${a}`},Z=(e,n)=>{if(!n){let a=N(e),s=a.split(".");return[a,a,`${[...s].reverse().join(".")}.in-addr.arpa`]}let t=cn(e),i=`${[...e.toString(16).padStart(32,"0")].reverse().join(".")}.ip6.arpa`;if(t.slice(0,5).every(a=>a===0)&&t[5]===65535){let a=N(Number(e&0xffffffffn)),s=t.slice(0,6).map(c=>c.toString(16)),l=t.slice(0,6).map(c=>c.toString(16).padStart(4,"0"));return[`${Se(s,t.slice(0,6))}:${a}`,`${l.join(":")}:${a}`,i]}return[Se(t.map(a=>a.toString(16)),t),t.map(a=>a.toString(16).padStart(4,"0")).join(":"),i]},Ee=(e,n)=>Z(e,n)[0],he=(e,n)=>e.map(([t,r])=>{let[i,o]=t.split("/"),a=BigInt(v(i)[0]),s=BigInt((n?128:32)-Number(o));return[a,a+((1n<<s)-1n),r]}).sort((t,r)=>t[0]<r[0]?-1:1),un=[he(rn,!1),he(an,!0)],Ce=(e,n)=>{let t=un[n?1:0],r=BigInt(e),i=0,o=t.length;for(;i<o;){let s=i+o>>1;t[s][0]<=r?i=s+1:o=s}let a=t[i-1];return a&&r<=a[1]?a[2]:n&&r>>125n!==1n?8:0},ye=(e,n)=>{if(!n)return[null,null];let t=e,r=Number(t&0xffffffffn);return t>>32n===0xffffn?[V,N(r)]:t>>112n===0x2002n?[W,N(Number(t>>80n&0xffffffffn))]:t>>96n===0x20010000n?[z,N(~r>>>0)]:t>>32n===0x0064ff9bn<<64n?[nn,N(r)]:[null,null]},Re=(e,n,t)=>{let r=BigInt((n?128:32)-t),i=BigInt(e),o=i>>r<<r,a=i|(1n<<r)-1n,s=Ee(n?o:Number(o),n);return[`${s}/${t}`,s,Ee(n?a:Number(a),n)]};var $=e=>new Set(e.split(" ")),fn=$("inc incorporated llc ltd ltda limited gmbh mbh ag kgaa ohg ev eg sa sab saa sau sal saog sac sas sarl srl spa nv bv cv asa aps oyj kft zrt nyrt doo sro ooo zao pao pjsc jsc ojsc llp plc pte pteltd pty corp corporation company holding holdings group uab sia tov oao pt sdn bhd coltd coltda eireli ead ood eood sti ltdsti spzoo"),Tn=$("de me epp co as ab ad dd bt lc lp se sl slu sp z oo zoo oy ao esp kg network networks net telecom telecoms telecommunication telecommunications telecomunicaciones comunicaciones communication communications hosting solutions services service technologies technology tech systems system data datacenter datacentre cloud internet online isp international global enterprises enterprise backbone provider providers of and"),bn=$("the llc ltd gmbh sarl ooo zao pao ao oao jsc ojsc pjsc uab sia tov pt pp ps ip spolka"),mn=new Set([...fn,...Tn,""]),pn=[".com",".net",".org",".io"],dn=/^.*\b(?:trading as|d\/b\/a|dba)\b\s*/i,An=/\(.*?\)|,.*|\s+-\s+.*/g,Me=/[^0-9a-z]/g,Sn=/^AS\d+$/i,En=/-(AS|AP|US|UK|DE|FR|IN|CN|JP|EU|NET|COM|ORG)$/,hn=/(NET|COM|TEL|WEB|LINE)$/,gn=/[/?#]/,Cn=/^["']+|["']+$/g,De=new Set(["hosting","cdn","content"]),yn=new Set(["residential","cellular"]),Ie=new Set(["public_proxy","residential_proxy"]),Rn={"national capital":"country","regional capital":"region","district capital":"district"},Mn=8192,Be=e=>{let n=new Map;return t=>{let r=n.get(t);if(r!==void 0)return r;n.size>=Mn&&n.clear();let i=e(t);return n.set(t,i),i}},Dn=/^\p{L}+$/u,Ne=e=>{let n=e.indexOf(`
2
+ `);return[e.slice(0,n),e.slice(n+1)]},In=e=>e.length>4&&Dn.test(e)&&e===e.toUpperCase()&&e!==e.toLowerCase(),Bn=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Ue=e=>e.split(" ").map(n=>In(n)?Bn(n):n).join(" "),Nn=e=>{let t=e.replace(dn,"").replace(An,"").split(/\s+/).map(o=>o.replace(Cn,"")).filter(Boolean);for(;t.length>1&&mn.has(t[t.length-1].toLowerCase().replace(Me,""));)t.pop();for(;t.length&&bn.has(t[0].toLowerCase().replace(Me,""));)t.shift();let r=t.join(" "),i=pn.find(o=>r.toLowerCase().endsWith(o));return Ue(i?r.slice(0,r.length-i.length):r)},Un=e=>{let t=(e.split(/\s+/)[0]??"").replace(En,"");return Sn.test(t)?"":(t.length>4&&t===t.toUpperCase()&&(t=t.replace(hn,"")),Ue(t))},wn=Be(e=>{let[n,t]=Ne(e),r=Nn(t),i=Un(n);return!r||!i?r||i:r.toLowerCase()===i.toLowerCase()?i===i.toUpperCase()?r:i:r.toLowerCase().startsWith(`${i.toLowerCase()} `)?i:r}),we=(e,n)=>wn(`${e}
3
+ ${n}`),Gn=Be(e=>{let[n,t]=Ne(e),i=((n.split("//").pop()??"").split(gn)[0].split("@").pop()??"").split(":")[0],o=(t.split("@")[1]??"").toLowerCase(),a=(i||o).toLowerCase().replace(/^www\./,""),s=a.split(".").pop()??"";return s.length>2&&o.split(".")[0]===s&&a!==o?o:a}),Ge=(e,n)=>Gn(`${e}
4
+ ${n}`),ke=(e,n)=>e==="public_proxy"&&yn.has(n)?["residential_proxy","inferred"]:[e,""],Le=e=>Rn[e]??"";var j=`
5
+ ADAND020Andorra|Principality of Andorra|
6
+ AEARE784United Arab Emirates
7
+ AFAFG004Afghanistan|Islamic Republic of Afghanistan|
8
+ AGATG028Antigua and Barbuda
9
+ AIAIA660Anguilla
10
+ ALALB008Albania|Republic of Albania|
11
+ AMARM051Armenia|Republic of Armenia|
12
+ AOAGO024Angola|Republic of Angola|
13
+ AQATA010Antarctica
14
+ ARARG032Argentina|Argentine Republic|
15
+ ASASM016American Samoa
16
+ ATAUT040Austria|Republic of Austria|
17
+ AUAUS036Australia
18
+ AWABW533Aruba
19
+ AXALA248\xC5land Islands
20
+ AZAZE031Azerbaijan|Republic of Azerbaijan|
21
+ BABIH070Bosnia and Herzegovina|Republic of Bosnia and Herzegovina|
22
+ BBBRB052Barbados
23
+ BDBGD050Bangladesh|People's Republic of Bangladesh|
24
+ BEBEL056Belgium|Kingdom of Belgium|
25
+ BFBFA854Burkina Faso
26
+ BGBGR100Bulgaria|Republic of Bulgaria|
27
+ BHBHR048Bahrain|Kingdom of Bahrain|
28
+ BIBDI108Burundi|Republic of Burundi|
29
+ BJBEN204Benin|Republic of Benin|
30
+ BLBLM652Saint Barth\xE9lemy
31
+ BMBMU060Bermuda
32
+ BNBRN096Brunei Darussalam
33
+ BOBOL068Bolivia, Plurinational State of|Plurinational State of Bolivia|Bolivia
34
+ BQBES535Bonaire, Sint Eustatius and Saba|Bonaire, Sint Eustatius and Saba|
35
+ BRBRA076Brazil|Federative Republic of Brazil|
36
+ BSBHS044Bahamas|Commonwealth of the Bahamas|
37
+ BTBTN064Bhutan|Kingdom of Bhutan|
38
+ BVBVT074Bouvet Island
39
+ BWBWA072Botswana|Republic of Botswana|
40
+ BYBLR112Belarus|Republic of Belarus|
41
+ BZBLZ084Belize
42
+ CACAN124Canada
43
+ CCCCK166Cocos (Keeling) Islands
44
+ CDCOD180Congo, The Democratic Republic of the
45
+ CFCAF140Central African Republic
46
+ CGCOG178Congo|Republic of the Congo|
47
+ CHCHE756Switzerland|Swiss Confederation|
48
+ CICIV384C\xF4te d'Ivoire|Republic of C\xF4te d'Ivoire|
49
+ CKCOK184Cook Islands
50
+ CLCHL152Chile|Republic of Chile|
51
+ CMCMR120Cameroon|Republic of Cameroon|
52
+ CNCHN156China|People's Republic of China|
53
+ COCOL170Colombia|Republic of Colombia|
54
+ CRCRI188Costa Rica|Republic of Costa Rica|
55
+ CUCUB192Cuba|Republic of Cuba|
56
+ CVCPV132Cabo Verde|Republic of Cabo Verde|
57
+ CWCUW531Cura\xE7ao|Cura\xE7ao|
58
+ CXCXR162Christmas Island
59
+ CYCYP196Cyprus|Republic of Cyprus|
60
+ CZCZE203Czechia|Czech Republic|
61
+ DEDEU276Germany|Federal Republic of Germany|
62
+ DJDJI262Djibouti|Republic of Djibouti|
63
+ DKDNK208Denmark|Kingdom of Denmark|
64
+ DMDMA212Dominica|Commonwealth of Dominica|
65
+ DODOM214Dominican Republic
66
+ DZDZA012Algeria|People's Democratic Republic of Algeria|
67
+ ECECU218Ecuador|Republic of Ecuador|
68
+ EEEST233Estonia|Republic of Estonia|
69
+ EGEGY818Egypt|Arab Republic of Egypt|
70
+ EHESH732Western Sahara
71
+ ERERI232Eritrea|the State of Eritrea|
72
+ ESESP724Spain|Kingdom of Spain|
73
+ ETETH231Ethiopia|Federal Democratic Republic of Ethiopia|
74
+ FIFIN246Finland|Republic of Finland|
75
+ FJFJI242Fiji|Republic of Fiji|
76
+ FKFLK238Falkland Islands (Malvinas)
77
+ FMFSM583Micronesia, Federated States of|Federated States of Micronesia|
78
+ FOFRO234Faroe Islands
79
+ FRFRA250France|French Republic|
80
+ GAGAB266Gabon|Gabonese Republic|
81
+ GBGBR826United Kingdom|United Kingdom of Great Britain and Northern Ireland|
82
+ GDGRD308Grenada
83
+ GEGEO268Georgia
84
+ GFGUF254French Guiana
85
+ GGGGY831Guernsey
86
+ GHGHA288Ghana|Republic of Ghana|
87
+ GIGIB292Gibraltar
88
+ GLGRL304Greenland
89
+ GMGMB270Gambia|Republic of the Gambia|
90
+ GNGIN324Guinea|Republic of Guinea|
91
+ GPGLP312Guadeloupe
92
+ GQGNQ226Equatorial Guinea|Republic of Equatorial Guinea|
93
+ GRGRC300Greece|Hellenic Republic|
94
+ GSSGS239South Georgia and the South Sandwich Islands
95
+ GTGTM320Guatemala|Republic of Guatemala|
96
+ GUGUM316Guam
97
+ GWGNB624Guinea-Bissau|Republic of Guinea-Bissau|
98
+ GYGUY328Guyana|Republic of Guyana|
99
+ HKHKG344Hong Kong|Hong Kong Special Administrative Region of China|
100
+ HMHMD334Heard Island and McDonald Islands
101
+ HNHND340Honduras|Republic of Honduras|
102
+ HRHRV191Croatia|Republic of Croatia|
103
+ HTHTI332Haiti|Republic of Haiti|
104
+ HUHUN348Hungary|Hungary|
105
+ IDIDN360Indonesia|Republic of Indonesia|
106
+ IEIRL372Ireland
107
+ ILISR376Israel|State of Israel|
108
+ IMIMN833Isle of Man
109
+ ININD356India|Republic of India|
110
+ IOIOT086British Indian Ocean Territory
111
+ IQIRQ368Iraq|Republic of Iraq|
112
+ IRIRN364Iran, Islamic Republic of|Islamic Republic of Iran|Iran
113
+ ISISL352Iceland|Republic of Iceland|
114
+ ITITA380Italy|Italian Republic|
115
+ JEJEY832Jersey
116
+ JMJAM388Jamaica
117
+ JOJOR400Jordan|Hashemite Kingdom of Jordan|
118
+ JPJPN392Japan
119
+ KEKEN404Kenya|Republic of Kenya|
120
+ KGKGZ417Kyrgyzstan|Kyrgyz Republic|
121
+ KHKHM116Cambodia|Kingdom of Cambodia|
122
+ KIKIR296Kiribati|Republic of Kiribati|
123
+ KMCOM174Comoros|Union of the Comoros|
124
+ KNKNA659Saint Kitts and Nevis
125
+ KPPRK408Korea, Democratic People's Republic of|Democratic People's Republic of Korea|North Korea
126
+ KRKOR410Korea, Republic of||South Korea
127
+ KWKWT414Kuwait|State of Kuwait|
128
+ KYCYM136Cayman Islands
129
+ KZKAZ398Kazakhstan|Republic of Kazakhstan|
130
+ LALAO418Lao People's Democratic Republic||Laos
131
+ LBLBN422Lebanon|Lebanese Republic|
132
+ LCLCA662Saint Lucia
133
+ LILIE438Liechtenstein|Principality of Liechtenstein|
134
+ LKLKA144Sri Lanka|Democratic Socialist Republic of Sri Lanka|
135
+ LRLBR430Liberia|Republic of Liberia|
136
+ LSLSO426Lesotho|Kingdom of Lesotho|
137
+ LTLTU440Lithuania|Republic of Lithuania|
138
+ LULUX442Luxembourg|Grand Duchy of Luxembourg|
139
+ LVLVA428Latvia|Republic of Latvia|
140
+ LYLBY434Libya|Libya|
141
+ MAMAR504Morocco|Kingdom of Morocco|
142
+ MCMCO492Monaco|Principality of Monaco|
143
+ MDMDA498Moldova, Republic of|Republic of Moldova|Moldova
144
+ MEMNE499Montenegro|Montenegro|
145
+ MFMAF663Saint Martin (French part)
146
+ MGMDG450Madagascar|Republic of Madagascar|
147
+ MHMHL584Marshall Islands|Republic of the Marshall Islands|
148
+ MKMKD807North Macedonia|Republic of North Macedonia|
149
+ MLMLI466Mali|Republic of Mali|
150
+ MMMMR104Myanmar|Republic of Myanmar|
151
+ MNMNG496Mongolia
152
+ MOMAC446Macao|Macao Special Administrative Region of China|
153
+ MPMNP580Northern Mariana Islands|Commonwealth of the Northern Mariana Islands|
154
+ MQMTQ474Martinique
155
+ MRMRT478Mauritania|Islamic Republic of Mauritania|
156
+ MSMSR500Montserrat
157
+ MTMLT470Malta|Republic of Malta|
158
+ MUMUS480Mauritius|Republic of Mauritius|
159
+ MVMDV462Maldives|Republic of Maldives|
160
+ MWMWI454Malawi|Republic of Malawi|
161
+ MXMEX484Mexico|United Mexican States|
162
+ MYMYS458Malaysia
163
+ MZMOZ508Mozambique|Republic of Mozambique|
164
+ NANAM516Namibia|Republic of Namibia|
165
+ NCNCL540New Caledonia
166
+ NENER562Niger|Republic of the Niger|
167
+ NFNFK574Norfolk Island
168
+ NGNGA566Nigeria|Federal Republic of Nigeria|
169
+ NINIC558Nicaragua|Republic of Nicaragua|
170
+ NLNLD528Netherlands|Kingdom of the Netherlands|
171
+ NONOR578Norway|Kingdom of Norway|
172
+ NPNPL524Nepal|Federal Democratic Republic of Nepal|
173
+ NRNRU520Nauru|Republic of Nauru|
174
+ NUNIU570Niue|Niue|
175
+ NZNZL554New Zealand
176
+ OMOMN512Oman|Sultanate of Oman|
177
+ PAPAN591Panama|Republic of Panama|
178
+ PEPER604Peru|Republic of Peru|
179
+ PFPYF258French Polynesia
180
+ PGPNG598Papua New Guinea|Independent State of Papua New Guinea|
181
+ PHPHL608Philippines|Republic of the Philippines|
182
+ PKPAK586Pakistan|Islamic Republic of Pakistan|
183
+ PLPOL616Poland|Republic of Poland|
184
+ PMSPM666Saint Pierre and Miquelon
185
+ PNPCN612Pitcairn
186
+ PRPRI630Puerto Rico
187
+ PSPSE275Palestine, State of|the State of Palestine|
188
+ PTPRT620Portugal|Portuguese Republic|
189
+ PWPLW585Palau|Republic of Palau|
190
+ PYPRY600Paraguay|Republic of Paraguay|
191
+ QAQAT634Qatar|State of Qatar|
192
+ REREU638R\xE9union
193
+ ROROU642Romania
194
+ RSSRB688Serbia|Republic of Serbia|
195
+ RURUS643Russian Federation
196
+ RWRWA646Rwanda|Rwandese Republic|
197
+ SASAU682Saudi Arabia|Kingdom of Saudi Arabia|
198
+ SBSLB090Solomon Islands
199
+ SCSYC690Seychelles|Republic of Seychelles|
200
+ SDSDN729Sudan|Republic of the Sudan|
201
+ SESWE752Sweden|Kingdom of Sweden|
202
+ SGSGP702Singapore|Republic of Singapore|
203
+ SHSHN654Saint Helena, Ascension and Tristan da Cunha
204
+ SISVN705Slovenia|Republic of Slovenia|
205
+ SJSJM744Svalbard and Jan Mayen
206
+ SKSVK703Slovakia|Slovak Republic|
207
+ SLSLE694Sierra Leone|Republic of Sierra Leone|
208
+ SMSMR674San Marino|Republic of San Marino|
209
+ SNSEN686Senegal|Republic of Senegal|
210
+ SOSOM706Somalia|Federal Republic of Somalia|
211
+ SRSUR740Suriname|Republic of Suriname|
212
+ SSSSD728South Sudan|Republic of South Sudan|
213
+ STSTP678Sao Tome and Principe|Democratic Republic of Sao Tome and Principe|
214
+ SVSLV222El Salvador|Republic of El Salvador|
215
+ SXSXM534Sint Maarten (Dutch part)|Sint Maarten (Dutch part)|
216
+ SYSYR760Syrian Arab Republic||Syria
217
+ SZSWZ748Eswatini|Kingdom of Eswatini|
218
+ TCTCA796Turks and Caicos Islands
219
+ TDTCD148Chad|Republic of Chad|
220
+ TFATF260French Southern Territories
221
+ TGTGO768Togo|Togolese Republic|
222
+ THTHA764Thailand|Kingdom of Thailand|
223
+ TJTJK762Tajikistan|Republic of Tajikistan|
224
+ TKTKL772Tokelau
225
+ TLTLS626Timor-Leste|Democratic Republic of Timor-Leste|
226
+ TMTKM795Turkmenistan
227
+ TNTUN788Tunisia|Republic of Tunisia|
228
+ TOTON776Tonga|Kingdom of Tonga|
229
+ TRTUR792T\xFCrkiye|Republic of T\xFCrkiye|
230
+ TTTTO780Trinidad and Tobago|Republic of Trinidad and Tobago|
231
+ TVTUV798Tuvalu
232
+ TWTWN158Taiwan, Province of China|Taiwan, Province of China|Taiwan
233
+ TZTZA834Tanzania, United Republic of|United Republic of Tanzania|Tanzania
234
+ UAUKR804Ukraine
235
+ UGUGA800Uganda|Republic of Uganda|
236
+ UMUMI581United States Minor Outlying Islands
237
+ USUSA840United States|United States of America|
238
+ UYURY858Uruguay|Eastern Republic of Uruguay|
239
+ UZUZB860Uzbekistan|Republic of Uzbekistan|
240
+ VAVAT336Holy See (Vatican City State)
241
+ VCVCT670Saint Vincent and the Grenadines
242
+ VEVEN862Venezuela, Bolivarian Republic of|Bolivarian Republic of Venezuela|Venezuela
243
+ VGVGB092Virgin Islands, British|British Virgin Islands|
244
+ VIVIR850Virgin Islands, U.S.|Virgin Islands of the United States|
245
+ VNVNM704Viet Nam|Socialist Republic of Viet Nam|Vietnam
246
+ VUVUT548Vanuatu|Republic of Vanuatu|
247
+ WFWLF876Wallis and Futuna
248
+ WSWSM882Samoa|Independent State of Samoa|
249
+ YEYEM887Yemen|Republic of Yemen|
250
+ YTMYT175Mayotte
251
+ ZAZAF710South Africa|Republic of South Africa|
252
+ ZMZMB894Zambia|Republic of Zambia|
253
+ ZWZWE716Zimbabwe|Republic of Zimbabwe|
254
+ `.trim().split(`
255
+ `);var Pe=`
256
+ Africa/Abidjan|GMT
257
+ Africa/Accra|GMT
258
+ Africa/Addis_Ababa|EAT
259
+ Africa/Algiers|CET
260
+ Africa/Asmara|EAT
261
+ Africa/Asmera|EAT
262
+ Africa/Bamako|GMT
263
+ Africa/Bangui|WAT
264
+ Africa/Banjul|GMT
265
+ Africa/Bissau|GMT
266
+ Africa/Blantyre|CAT
267
+ Africa/Brazzaville|WAT
268
+ Africa/Bujumbura|CAT
269
+ Africa/Cairo|EET|EEST
270
+ Africa/Ceuta|CET|CEST
271
+ Africa/Conakry|GMT
272
+ Africa/Dakar|GMT
273
+ Africa/Dar_es_Salaam|EAT
274
+ Africa/Djibouti|EAT
275
+ Africa/Douala|WAT
276
+ Africa/Freetown|GMT
277
+ Africa/Gaborone|CAT
278
+ Africa/Harare|CAT
279
+ Africa/Johannesburg|SAST
280
+ Africa/Juba|CAT
281
+ Africa/Kampala|EAT
282
+ Africa/Khartoum|CAT
283
+ Africa/Kigali|CAT
284
+ Africa/Kinshasa|WAT
285
+ Africa/Lagos|WAT
286
+ Africa/Libreville|WAT
287
+ Africa/Lome|GMT
288
+ Africa/Luanda|WAT
289
+ Africa/Lubumbashi|CAT
290
+ Africa/Lusaka|CAT
291
+ Africa/Malabo|WAT
292
+ Africa/Maputo|CAT
293
+ Africa/Maseru|SAST
294
+ Africa/Mbabane|SAST
295
+ Africa/Mogadishu|EAT
296
+ Africa/Monrovia|GMT
297
+ Africa/Nairobi|EAT
298
+ Africa/Ndjamena|WAT
299
+ Africa/Niamey|WAT
300
+ Africa/Nouakchott|GMT
301
+ Africa/Ouagadougou|GMT
302
+ Africa/Porto-Novo|WAT
303
+ Africa/Sao_Tome|GMT
304
+ Africa/Timbuktu|GMT
305
+ Africa/Tripoli|EET
306
+ Africa/Tunis|CET
307
+ Africa/Windhoek|CAT
308
+ America/Adak|HST|HDT
309
+ America/Anchorage|AKST|AKDT
310
+ America/Anguilla|AST
311
+ America/Antigua|AST
312
+ America/Aruba|AST
313
+ America/Atikokan|EST
314
+ America/Atka|HST|HDT
315
+ America/Bahia_Banderas|CST
316
+ America/Barbados|AST
317
+ America/Belize|CST
318
+ America/Blanc-Sablon|AST
319
+ America/Boise|MST|MDT
320
+ America/Cambridge_Bay|MST|MDT
321
+ America/Cancun|EST
322
+ America/Cayman|EST
323
+ America/Chicago|CST|CDT
324
+ America/Chihuahua|CST
325
+ America/Ciudad_Juarez|MST|MDT
326
+ America/Coral_Harbour|EST
327
+ America/Costa_Rica|CST
328
+ America/Creston|MST
329
+ America/Curacao|AST
330
+ America/Danmarkshavn|GMT
331
+ America/Dawson|MST
332
+ America/Dawson_Creek|MST
333
+ America/Denver|MST|MDT
334
+ America/Detroit|EST|EDT
335
+ America/Dominica|AST
336
+ America/Edmonton|MST|MDT
337
+ America/El_Salvador|CST
338
+ America/Ensenada|PST|PDT
339
+ America/Fort_Nelson|MST
340
+ America/Fort_Wayne|EST|EDT
341
+ America/Glace_Bay|AST|ADT
342
+ America/Goose_Bay|AST|ADT
343
+ America/Grand_Turk|EST|EDT
344
+ America/Grenada|AST
345
+ America/Guadeloupe|AST
346
+ America/Guatemala|CST
347
+ America/Halifax|AST|ADT
348
+ America/Havana|CST|CDT
349
+ America/Hermosillo|MST
350
+ America/Indiana/Indianapolis|EST|EDT
351
+ America/Indiana/Knox|CST|CDT
352
+ America/Indiana/Marengo|EST|EDT
353
+ America/Indiana/Petersburg|EST|EDT
354
+ America/Indiana/Tell_City|CST|CDT
355
+ America/Indiana/Vevay|EST|EDT
356
+ America/Indiana/Vincennes|EST|EDT
357
+ America/Indiana/Winamac|EST|EDT
358
+ America/Indianapolis|EST|EDT
359
+ America/Inuvik|MST|MDT
360
+ America/Iqaluit|EST|EDT
361
+ America/Jamaica|EST
362
+ America/Juneau|AKST|AKDT
363
+ America/Kentucky/Louisville|EST|EDT
364
+ America/Kentucky/Monticello|EST|EDT
365
+ America/Knox_IN|CST|CDT
366
+ America/Kralendijk|AST
367
+ America/Los_Angeles|PST|PDT
368
+ America/Louisville|EST|EDT
369
+ America/Lower_Princes|AST
370
+ America/Managua|CST
371
+ America/Marigot|AST
372
+ America/Martinique|AST
373
+ America/Matamoros|CST|CDT
374
+ America/Mazatlan|MST
375
+ America/Menominee|CST|CDT
376
+ America/Merida|CST
377
+ America/Metlakatla|AKST|AKDT
378
+ America/Mexico_City|CST
379
+ America/Moncton|AST|ADT
380
+ America/Monterrey|CST
381
+ America/Montreal|EST|EDT
382
+ America/Montserrat|AST
383
+ America/Nassau|EST|EDT
384
+ America/New_York|EST|EDT
385
+ America/Nipigon|EST|EDT
386
+ America/Nome|AKST|AKDT
387
+ America/North_Dakota/Beulah|CST|CDT
388
+ America/North_Dakota/Center|CST|CDT
389
+ America/North_Dakota/New_Salem|CST|CDT
390
+ America/Ojinaga|CST|CDT
391
+ America/Panama|EST
392
+ America/Pangnirtung|EST|EDT
393
+ America/Phoenix|MST
394
+ America/Port-au-Prince|EST|EDT
395
+ America/Port_of_Spain|AST
396
+ America/Puerto_Rico|AST
397
+ America/Rainy_River|CST|CDT
398
+ America/Rankin_Inlet|CST|CDT
399
+ America/Regina|CST
400
+ America/Resolute|CST|CDT
401
+ America/Santa_Isabel|PST|PDT
402
+ America/Santo_Domingo|AST
403
+ America/Shiprock|MST|MDT
404
+ America/Sitka|AKST|AKDT
405
+ America/St_Barthelemy|AST
406
+ America/St_Johns|NST|NDT
407
+ America/St_Kitts|AST
408
+ America/St_Lucia|AST
409
+ America/St_Thomas|AST
410
+ America/St_Vincent|AST
411
+ America/Swift_Current|CST
412
+ America/Tegucigalpa|CST
413
+ America/Thule|AST|ADT
414
+ America/Thunder_Bay|EST|EDT
415
+ America/Tijuana|PST|PDT
416
+ America/Toronto|EST|EDT
417
+ America/Tortola|AST
418
+ America/Vancouver|PST|PDT
419
+ America/Virgin|AST
420
+ America/Whitehorse|MST
421
+ America/Winnipeg|CST|CDT
422
+ America/Yakutat|AKST|AKDT
423
+ America/Yellowknife|MST|MDT
424
+ Antarctica/Macquarie|AEST|AEDT
425
+ Antarctica/McMurdo|NZST|NZDT
426
+ Antarctica/South_Pole|NZST|NZDT
427
+ Arctic/Longyearbyen|CET|CEST
428
+ Asia/Beirut|EET|EEST
429
+ Asia/Calcutta|IST
430
+ Asia/Chongqing|CST
431
+ Asia/Chungking|CST
432
+ Asia/Famagusta|EET|EEST
433
+ Asia/Gaza|EET|EEST
434
+ Asia/Harbin|CST
435
+ Asia/Hebron|EET|EEST
436
+ Asia/Hong_Kong|HKT
437
+ Asia/Jakarta|WIB
438
+ Asia/Jayapura|WIT
439
+ Asia/Jerusalem|IST|IDT
440
+ Asia/Karachi|PKT
441
+ Asia/Kolkata|IST
442
+ Asia/Macao|CST
443
+ Asia/Macau|CST
444
+ Asia/Makassar|WITA
445
+ Asia/Manila|PST
446
+ Asia/Nicosia|EET|EEST
447
+ Asia/Pontianak|WIB
448
+ Asia/Pyongyang|KST
449
+ Asia/Seoul|KST
450
+ Asia/Shanghai|CST
451
+ Asia/Taipei|CST
452
+ Asia/Tel_Aviv|IST|IDT
453
+ Asia/Tokyo|JST
454
+ Asia/Ujung_Pandang|WITA
455
+ Atlantic/Bermuda|AST|ADT
456
+ Atlantic/Canary|WET|WEST
457
+ Atlantic/Faeroe|WET|WEST
458
+ Atlantic/Faroe|WET|WEST
459
+ Atlantic/Jan_Mayen|CET|CEST
460
+ Atlantic/Madeira|WET|WEST
461
+ Atlantic/Reykjavik|GMT
462
+ Atlantic/St_Helena|GMT
463
+ Australia/ACT|AEST|AEDT
464
+ Australia/Adelaide|ACST|ACDT
465
+ Australia/Brisbane|AEST
466
+ Australia/Broken_Hill|ACST|ACDT
467
+ Australia/Canberra|AEST|AEDT
468
+ Australia/Currie|AEST|AEDT
469
+ Australia/Darwin|ACST
470
+ Australia/Hobart|AEST|AEDT
471
+ Australia/Lindeman|AEST
472
+ Australia/Melbourne|AEST|AEDT
473
+ Australia/NSW|AEST|AEDT
474
+ Australia/North|ACST
475
+ Australia/Perth|AWST
476
+ Australia/Queensland|AEST
477
+ Australia/South|ACST|ACDT
478
+ Australia/Sydney|AEST|AEDT
479
+ Australia/Tasmania|AEST|AEDT
480
+ Australia/Victoria|AEST|AEDT
481
+ Australia/West|AWST
482
+ Australia/Yancowinna|ACST|ACDT
483
+ CET|CET|CEST
484
+ CST6CDT|CST|CDT
485
+ Canada/Atlantic|AST|ADT
486
+ Canada/Central|CST|CDT
487
+ Canada/Eastern|EST|EDT
488
+ Canada/Mountain|MST|MDT
489
+ Canada/Newfoundland|NST|NDT
490
+ Canada/Pacific|PST|PDT
491
+ Canada/Saskatchewan|CST
492
+ Canada/Yukon|MST
493
+ Cuba|CST|CDT
494
+ EET|EET|EEST
495
+ EST|EST
496
+ EST5EDT|EST|EDT
497
+ Egypt|EET|EEST
498
+ Eire|GMT|IST
499
+ Etc/GMT|GMT
500
+ Etc/GMT+0|GMT
501
+ Etc/GMT-0|GMT
502
+ Etc/GMT0|GMT
503
+ Etc/Greenwich|GMT
504
+ Etc/UCT|UTC
505
+ Etc/UTC|UTC
506
+ Etc/Universal|UTC
507
+ Etc/Zulu|UTC
508
+ Europe/Amsterdam|CET|CEST
509
+ Europe/Andorra|CET|CEST
510
+ Europe/Athens|EET|EEST
511
+ Europe/Belfast|GMT|BST
512
+ Europe/Belgrade|CET|CEST
513
+ Europe/Berlin|CET|CEST
514
+ Europe/Bratislava|CET|CEST
515
+ Europe/Brussels|CET|CEST
516
+ Europe/Bucharest|EET|EEST
517
+ Europe/Budapest|CET|CEST
518
+ Europe/Busingen|CET|CEST
519
+ Europe/Chisinau|EET|EEST
520
+ Europe/Copenhagen|CET|CEST
521
+ Europe/Dublin|GMT|IST
522
+ Europe/Gibraltar|CET|CEST
523
+ Europe/Guernsey|GMT|BST
524
+ Europe/Helsinki|EET|EEST
525
+ Europe/Isle_of_Man|GMT|BST
526
+ Europe/Jersey|GMT|BST
527
+ Europe/Kaliningrad|EET
528
+ Europe/Kiev|EET|EEST
529
+ Europe/Kirov|MSK
530
+ Europe/Kyiv|EET|EEST
531
+ Europe/Lisbon|WET|WEST
532
+ Europe/Ljubljana|CET|CEST
533
+ Europe/London|GMT|BST
534
+ Europe/Luxembourg|CET|CEST
535
+ Europe/Madrid|CET|CEST
536
+ Europe/Malta|CET|CEST
537
+ Europe/Mariehamn|EET|EEST
538
+ Europe/Monaco|CET|CEST
539
+ Europe/Moscow|MSK
540
+ Europe/Nicosia|EET|EEST
541
+ Europe/Oslo|CET|CEST
542
+ Europe/Paris|CET|CEST
543
+ Europe/Podgorica|CET|CEST
544
+ Europe/Prague|CET|CEST
545
+ Europe/Riga|EET|EEST
546
+ Europe/Rome|CET|CEST
547
+ Europe/San_Marino|CET|CEST
548
+ Europe/Sarajevo|CET|CEST
549
+ Europe/Simferopol|MSK
550
+ Europe/Skopje|CET|CEST
551
+ Europe/Sofia|EET|EEST
552
+ Europe/Stockholm|CET|CEST
553
+ Europe/Tallinn|EET|EEST
554
+ Europe/Tirane|CET|CEST
555
+ Europe/Tiraspol|EET|EEST
556
+ Europe/Uzhgorod|EET|EEST
557
+ Europe/Vaduz|CET|CEST
558
+ Europe/Vatican|CET|CEST
559
+ Europe/Vienna|CET|CEST
560
+ Europe/Vilnius|EET|EEST
561
+ Europe/Volgograd|MSK
562
+ Europe/Warsaw|CET|CEST
563
+ Europe/Zagreb|CET|CEST
564
+ Europe/Zaporozhye|EET|EEST
565
+ Europe/Zurich|CET|CEST
566
+ GB|GMT|BST
567
+ GB-Eire|GMT|BST
568
+ GMT|GMT
569
+ GMT+0|GMT
570
+ GMT-0|GMT
571
+ GMT0|GMT
572
+ Greenwich|GMT
573
+ HST|HST
574
+ Hongkong|HKT
575
+ Iceland|GMT
576
+ Indian/Antananarivo|EAT
577
+ Indian/Comoro|EAT
578
+ Indian/Mayotte|EAT
579
+ Israel|IST|IDT
580
+ Jamaica|EST
581
+ Japan|JST
582
+ Libya|EET
583
+ MET|CET|CEST
584
+ MST|MST
585
+ MST7MDT|MST|MDT
586
+ Mexico/BajaNorte|PST|PDT
587
+ Mexico/BajaSur|MST
588
+ Mexico/General|CST
589
+ NZ|NZST|NZDT
590
+ Navajo|MST|MDT
591
+ PRC|CST
592
+ PST8PDT|PST|PDT
593
+ Pacific/Auckland|NZST|NZDT
594
+ Pacific/Guam|ChST
595
+ Pacific/Honolulu|HST
596
+ Pacific/Johnston|HST
597
+ Pacific/Midway|SST
598
+ Pacific/Pago_Pago|SST
599
+ Pacific/Saipan|ChST
600
+ Pacific/Samoa|SST
601
+ Poland|CET|CEST
602
+ Portugal|WET|WEST
603
+ ROC|CST
604
+ ROK|KST
605
+ UCT|UTC
606
+ US/Alaska|AKST|AKDT
607
+ US/Aleutian|HST|HDT
608
+ US/Arizona|MST
609
+ US/Central|CST|CDT
610
+ US/East-Indiana|EST|EDT
611
+ US/Eastern|EST|EDT
612
+ US/Hawaii|HST
613
+ US/Indiana-Starke|CST|CDT
614
+ US/Michigan|EST|EDT
615
+ US/Mountain|MST|MDT
616
+ US/Pacific|PST|PDT
617
+ US/Samoa|SST
618
+ UTC|UTC
619
+ Universal|UTC
620
+ W-SU|MSK
621
+ WET|WET|WEST
622
+ Zulu|UTC
623
+ `.trim().split(`
624
+ `);var Ln=new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" ")),Pn=new Set("AG AI AU BB BD BM BN BS BT BW CC CK CX CY DM FJ FK GB GD GG GY HK ID IE IM IN JE JM JP KE KI KN KY LC LK LS MO MS MT MU MV MW MY MZ NA NF NP NR NU NZ PG PK PN SB SC SG SH SR SZ TC TH TL TO TT TV TZ UG VC VG WS ZA ZM ZW".split(" ")),R=864e5,_n=7*R,Y=400*R,U=6e4,Kn=new Map(j.map(e=>{let[n,t="",r=""]=e.slice(8).split("|");return[e.slice(0,2),[n,t,r,e.slice(2,5)]]})),xn=new Map(j.map(e=>[e.slice(0,2),e.slice(5,8)])),_e=e=>e||null,vn=e=>e.length!==2||!/^[a-zA-Z]{2}$/.test(e)?"":[...e.toUpperCase()].map(n=>String.fromCodePoint(127462+n.charCodeAt(0)-65)).join(""),Ke=new Map,Fe=e=>{if(!e)return null;let n=Ke.get(e);if(n!==void 0)return n;let t=Kn.get(e),r={code:e,name:t?t[0]:null,official:t?_e(t[1]):null,common:t?_e(t[2]):null,iso3:t?t[3]:null,numeric:xn.get(e)??null,flag:vn(e)||null,european_union:Ln.has(e),driving_side:Pn.has(e)?"left":"right"};return Ke.set(e,r),r},On=new Map(Pe.map(e=>{let[n,t,r=t]=e.split("|");return[n,[t,r]]})),xe=new Map,Fn=e=>{let n=xe.get(e);if(n!==void 0)return n;let t=null;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hour12:!1,era:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=null}return xe.set(e,t),t},He=(e,n)=>{let t={};for(let o of e.formatToParts(n))t[o.type]=o.value;let r=Number(t.year)*(t.era==="BC"?-1:1),i=t.hour==="24"?0:Number(t.hour);return Date.UTC(r,Number(t.month)-1,Number(t.day),i,Number(t.minute),Number(t.second))},J=(e,n)=>Math.round((He(e,n)-n)/U),M=(e,n)=>{let t=J(e,n-R),r=J(e,n+R);if(t===r)return t;let i=[t,r].filter(o=>J(e,n-o*U)===o);return i.length?Math.max(...i):Math.min(t,r)},q=e=>{let n=Math.abs(e),t=String(Math.floor(n/60)).padStart(2,"0");return`${e<0?"-":"+"}${t}:${String(n%60).padStart(2,"0")}`},ve=(e,n)=>new Date(n).toISOString().slice(0,19)+q(M(e,n)),Hn=(e,n,t,r)=>{for(;t-n>1e3;){let i=n+Math.floor((t-n)/2);M(e,i)===r?n=i:t=i}return Math.floor((t+3e4)/U)*U},Vn=(e,n)=>{let t=n+Y,r=[],i=n-Y,o=M(e,i);for(;i<t;){let a=i+_n,s=M(e,a);s!==o&&r.push(Hn(e,i,a,o)),o=s,i=a}return r},O=new Map,Wn=(e,n,t)=>{let r=Math.floor(t/R)*R+R/2,i=`${e}@${r}`,o=O.get(i);if(o!==void 0)return o;O.size>2048&&O.clear();let a=Vn(n,r),s=[M(n,r-Y),...a.map(f=>M(n,f))],l=Math.min(...s),c=Math.max(...s),u=[l,null,null];for(let f=0;l!==c&&f+1<a.length;f+=1){let[T,m]=[a[f],a[f+1]];if(M(n,T)===c&&m>=r){u=[l,T,m];break}}return O.set(i,u),u},zn=(e,n,t)=>{let r=On.get(e);if(r)return t?r[1]:r[0];let i=Math.abs(n),o=String(Math.floor(i/60)).padStart(2,"0"),a=i%60;return`${n<0?"-":"+"}${o}`+(a?String(a).padStart(2,"0"):"")},Oe=(e,n)=>{let t=Fn(e);if(t===null)return{timezone:e,abbreviation:null,local:null,utc_offset:null,is_dst:!1,dst_start:null,dst_end:null};let r=He(t,n),i=Math.round((r-n)/U),[o,a,s]=Wn(e,t,r);return{timezone:e,abbreviation:zn(e,i,i!==o),local:new Date(r).toISOString().slice(0,19)+q(i),utc_offset:q(i),is_dst:i!==o,dst_start:a===null?null:ve(t,a),dst_end:s===null?null:ve(t,s)}},F=new Map,Ve=(e,n)=>{if(!e)return null;if(n)return Oe(e,n.getTime());let t=Math.floor(Date.now()/1e3),r=`${e}@${t}`,i=F.get(r);if(i!==void 0)return i;F.size>1024&&F.clear();let o=Oe(e,t*1e3);return F.set(r,o),o};var Ze=(e,n)=>{let t=new Int32Array(e.length),r=n;for(let i=0;i<e.length;i+=1)t[i]=r,r+=1<<e[i];return t},X=new Uint8Array([...Array(16).fill(0),1,1,1,1,2,2,3,3,4,6,7,8,9,10,11,12,13,14,15,16]),ee=new Uint8Array([...Array(32).fill(0),1,1,1,1,2,2,3,3,4,4,5,7,8,9,10,11,12,13,14,15,16]),Zn=Ze(X,0),$n=Ze(ee,3),jn=[4,3,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,3,2,1,1,1,1,1,-1,-1,-1,-1],Jn=[1,4,3,2,2,2,2,2,2,...Array(37).fill(1),...Array(7).fill(-1)],Yn=[1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,-1,-1],E=e=>{throw new Error(`zstd: ${e}`)},D=e=>{let n=0;for(;1<<n<=e;)n+=1;return n-1},ne=(e,n,t)=>{let r=1<<t,i={log:t,symbols:new Uint8Array(r),bits:new Uint8Array(r),next:new Uint16Array(r)},o=new Uint16Array(256),a=r;for(let c=0;c<n;c+=1)e[c]<0?(o[c]=1,a-=1,i.symbols[a]=c):o[c]=e[c];let s=(r>>1)+(r>>3)+3,l=0;for(let c=0;c<n;c+=1)for(let u=0;u<e[c];u+=1){i.symbols[l]=c;do l=l+s&r-1;while(l>=a)}l!==0&&E("the symbols do not spread over the table");for(let c=0;c<r;c+=1){let u=o[i.symbols[c]]++,f=t-D(u);i.bits[c]=f,i.next[c]=(u<<f)-r}return i},w=(e,n,t)=>{let r=(e[n]&15)+5;r>t&&E("an entropy table is too accurate");let i=new Int16Array(256),o=(n<<3)+4,a=1<<r,s=-1;for(;s<255&&a>0;){let l=D(a+1),c=o>>3,u=(1<<l+1)-1,f=(e[c]|e[c+1]<<8|e[c+2]<<16)>>(o&7),T=f&(1<<l)-1,m=u-a-1,d=f&u;if(T<m?(o+=l,d=T):(o+=l+1,d>(1<<l)-1&&(d-=m)),d-=1,s+=1,i[s]=d,a-=d<0?-d:d,d!==0)continue;let p=3;for(;p===3;){let A=o>>3;p=(e[A]|e[A+1]<<8)>>(o&7)&3,o+=2,s+=p}}return(s>255||a!==0)&&E("the entropy counts do not add up"),[ne(i,s+1,r),o+7>>3]},We=(e,n)=>{let t=0;for(let c=0;c<n;c+=1){let u=e[c];u>11&&E("a huffman weight is out of range"),t+=u?1<<u-1:0}let r=D(t)+1,i=1<<r,o=i-t;o&o-1&&E("the huffman weights do not add up"),e[n]=D(o)+1;let a=new Uint32Array(13);for(let c=0;c<=n;c+=1)e[c]=e[c]&&r+1-e[c],a[e[c]]+=1;let s={maxBits:r,symbols:new Uint8Array(i),bits:new Uint8Array(i)},l=new Uint32Array(13);for(let c=r;c>0;c-=1){let u=l[c];l[c-1]=u+a[c]*(1<<r-c),s.bits.fill(c,u,l[c-1])}l[0]!==i&&E("the huffman codes do not fill the table");for(let c=0;c<=n;c+=1){let u=e[c];if(!u)continue;let f=l[u];l[u]=f+(1<<r-u),s.symbols.fill(c,f,l[u])}return s},$e=(e,n)=>{let t=e[n],r=new Uint8Array(256);if(t>=128){let p=t-127;for(let A=0;A<p;A+=2){let g=e[n+1+(A>>1)];r[A]=g>>4,r[A+1]=g&15}return[We(r,p),n+1+(p+1>>1)]}let[i,o]=w(e,n+1,6),a=n+1+t,s=e[a-1];s||E("a huffman bitstream ends on a zero byte");let l=o<<3,c=(a<<3)-8+D(s),u=0,f=0,T=0,m=i.log,d=i.log;for(;c-=m,!(c<l);){let p=c>>3;if(f+=(e[p]|e[p+1]<<8)>>(c&7)&(1<<m)-1,r[u]=i.symbols[f],u+=1,c-=d,c<l)break;p=c>>3,T+=(e[p]|e[p+1]<<8)>>(c&7)&(1<<d)-1,r[u]=i.symbols[T],u+=1,m=i.bits[f],f=i.next[f],d=i.bits[T],T=i.next[T]}return[We(r,u),a]},ze=(e,n,t)=>{let r=e[e.length-1];r||E("a literal bitstream ends on a zero byte");let i=(1<<n.maxBits)-1,o=-n.maxBits,a=n.maxBits,s=(e.length<<3)-8+D(r)-a,l=0,c=0;for(;s>o&&c<t.length;){let u=s>>3,f=(e[u]|e[u+1]<<8|e[u+2]<<16)>>(s&7);l=(l<<a|f)&i,t[c]=n.symbols[l],c+=1,a=n.bits[l],s-=a}(s!==o||c!==t.length)&&E("a literal bitstream is the wrong length")},qn=(e,n,t,r)=>{if(!r){ze(e,n,t);return}let i=t.length+3>>2,o=6;for(let a=0;a<4;a+=1){let s=e[a<<1]|e[(a<<1)+1]<<8,l=a===3?e.length:o+s,c=i*a;ze(e.subarray(o,l),n,t.subarray(c,c+i)),o=l}},Qn=()=>{let e=(n,t)=>{let r=new Int16Array(256);return r.set(n),ne(r,n.length,t)};return{literal:e(jn,6),match:e(Jn,6),offset:e(Yn,5)}},Q=Qn(),Xn=e=>ne(Int16Array.of(...Array(e).fill(0),1),e+1,0),et=(e,n,t)=>{let r=e[n],i=r&3,o=r>>2&3,a=r>>4,s=0,l=n;if(i<2)return o&1?(a|=e[l+1]<<4,l+=1,o&2&&(a|=e[l+1]<<12,l+=1)):a=r>>3,l+=1,i===0?[{data:e.subarray(l,l+a),size:a},l+a]:[{data:new Uint8Array(a).fill(e[l]),size:a},l+1];if(o<2?(a|=(e[n+1]&63)<<4,s=e[n+1]>>6|e[n+2]<<2,l=n+3):o===2?(a|=e[n+1]<<4|(e[n+2]&3)<<12,s=e[n+2]>>2|e[n+3]<<6,l=n+4):(a|=e[n+1]<<4|(e[n+2]&63)<<12,s=e[n+2]>>6|e[n+3]<<2|e[n+4]<<10,l=n+5),i===2){let[f,T]=$e(e,l);t.huffman=f,s-=T-l,l=T}let c=t.huffman??E("literals without a huffman table"),u=new Uint8Array(a);return qn(e.subarray(l,l+s),c,u,o!==0),[{data:u,size:a},l+s]},nt=(e,n,t)=>{let r=e[n];r&3&&E("a sequence header reserves bits that are set");let i=t.tables,o=[i?.match??null,i?.offset??null,i?.literal??null],s=[...[Q.match,Q.offset,Q.literal]],l=n+1;for(let u=2;u>-1;u-=1){let f=r>>(u<<1)+2&3;if(f===1)s[u]=Xn(e[l]),l+=1;else if(f===2){let[T,m]=w(e,l,9-(u&1));s[u]=T,l=m}else f===3&&(s[u]=o[u]??E("a repeated table was never sent"))}let c={match:s[0],offset:s[1],literal:s[2]};return t.tables=c,[c,l]},tt=(e,n)=>{let t=e[n];return t<128?[t,n+1]:t<255?[t-128<<8|e[n+1],n+2]:[(e[n+1]|e[n+2]<<8)+32512,n+3]},rt=(e,n,t)=>{if(e>3)return t[2]=t[1],t[1]=t[0],t[0]=e-3,t[0];let r=e-(n!==0?1:0);if(r===0)return t[0];let i=r===3?t[0]-1:t[r];return r>1&&(t[2]=t[1]),t[1]=t[0],t[0]=i,i},it=(e,n,t,r,i,o,a,s)=>{let[l]=nt(e,n,o),c=e[t-1];c||E("a sequence bitstream ends on a zero byte");let u=(g,I)=>{let y=g>>3,B=(e[y]|e[y+1]<<8|e[y+2]<<16|e[y+3]<<24)>>>(g&7);return I===32?B:B&(1<<I)-1},f=(t<<3)-8+D(c)-l.literal.log,T=u(f,l.literal.log);f-=l.offset.log;let m=u(f,l.offset.log);f-=l.match.log;let d=u(f,l.match.log),p=0,A=s;for(let g=0;g<r;g+=1){let I=l.literal.symbols[T],y=l.literal.bits[T],B=l.match.symbols[d],be=l.match.bits[d],H=l.offset.symbols[m],me=l.offset.bits[m];f-=H;let en=(1<<H)+u(f,H);f-=ee[B];let pe=$n[B]+u(f,ee[B]);f-=X[I];let K=Zn[I]+u(f,X[I]);f-=y,T=l.literal.next[T]+u(f,y),f-=be,d=l.match.next[d]+u(f,be),f-=me,m=l.offset.next[m]+u(f,me);let de=rt(en,K,o.offsets);a.set(i.data.subarray(p,p+K),A),p+=K,A+=K,de>A&&E("a match reaches before the window");for(let x=0;x<pe;x+=1)a[A+x]=a[A+x-de];A+=pe}return a.set(i.data.subarray(p,i.size),A),A+i.size-p},at=(e,n,t,r,i,o)=>{let[a,s]=et(e,n,r),[l,c]=tt(e,s);return l===0?(i.set(a.data.subarray(0,a.size),o),o+a.size):it(e,c,t,l,a,r,i,o)},ot=e=>{((e[0]|e[1]<<8|e[2]<<16)!==3126568||e[3]!==253)&&E("not a zstd frame");let t=e[4],r=t>>5&1,i=t>>6,o=6-r+(t&3?(t&3)===3?4:t&3:0),a=i?1<<i:r,s=0;for(let l=0;l<a;l+=1)s+=e[o+l]*256**l;return[o+a,a?s+(i===1?256:0):0]},st=(e,n)=>{if(n<=e.length)return e;let t=new Uint8Array(Math.max(n,e.length*2));return t.set(e),t},te=(e,n)=>{let[t,r]=ot(e),i=n?n.content:new Uint8Array(0),o={huffman:n?.huffman??null,tables:n?.tables??null,offsets:Int32Array.from(n?n.offsets:[1,4,8])},a=new Uint8Array(i.length+(r||65536));a.set(i);let s=i.length,l=t;for(;;){let c=e[l]|e[l+1]<<8|e[l+2]<<16,u=c>>1&3,f=c>>3;if(l+=3,a=st(a,s+f+(1<<17)),u===0?(a.set(e.subarray(l,l+f),s),s+=f,l+=f):u===1?(a.fill(e[l],s,s+f),s+=f,l+=1):u===2?(s=at(e,l,l+f,o,a,s),l+=f):E("a block has no known type"),c&1)break}return a.subarray(i.length,s)},re=e=>{let n=new DataView(e.buffer,e.byteOffset,e.byteLength);if(n.getUint32(0,!0)!==3962610743)return{id:0,content:e,huffman:null,tables:null,offsets:[1,4,8]};let[t,r]=$e(e,8),[i,o]=w(e,r,8),[a,s]=w(e,o,9),[l,c]=w(e,s,9);return{id:n.getUint32(4,!0),content:e.subarray(c+12),huffman:t,tables:{literal:l,match:a,offset:i},offsets:[0,1,2].map(u=>n.getUint32(c+u*4,!0))}};var G="PLEVIN\0",je=1,lt=16384,ct=1e4,ut=255,ie=16384,ft=["place","network","abuse","prefix","rpki","roas"],Tt=new Set(["place","network","abuse"]),Je="network",bt={rpki:"rpki","place.granularity":"granularity","city.timezone":"timezones","city.type":"place_types","operator.category":"categories","abuse.user_type":"categories","abuse.service":"services","abuse.evidence":"evidence"},mt=e=>e===ut?null:e/100,pt={"abuse.risk":mt,"abuse.is_anycast":Boolean,"abuse.is_satellite":Boolean},se=new TextDecoder,dt=new Uint8Array(Uint16Array.of(1).buffer)[0]===0,C=class{held=new Map;build;limit;constructor(n,t=lt){this.build=n,this.limit=t}get(n){let t=this.held.get(n);if(t!==void 0)return t;this.held.size>=this.limit&&this.held.clear();let r=this.build(n);return this.held.set(n,r),r}clear(){this.held.clear()}},Te=(e,n)=>{let t=0,r=1;for(;;){let i=e[n];if(n+=1,t+=(i&127)*r,i<128)return[t,n];r*=128}},le=(e,n,t)=>{let r=[];for(let i=0;i<t;i+=1){let[o,a]=Te(e,n);r.push(o),n=a}return[r,n]},ae=(e,n,t)=>{let r=[];for(let i=0;i<t;i+=1){let o=0n,a=0n;for(;;){let s=e[n];if(n+=1,o|=BigInt(s&127)<<a,s<128)break;a+=7n}r.push(o)}return[r,n]},k=class{count;read;perBlock;perGroup;fanout;width;blocks;keys;offsets;data;dictionary;cache;groups;constructor(n,t){let r=new DataView(n.buffer,n.byteOffset,n.byteLength);this.count=t.count,this.read=t.read,this.perBlock=t.block,this.perGroup=t.group,this.fanout=this.perBlock/this.perGroup,this.blocks=r.getUint32(0,!0),this.width=r.getUint32(4,!0);let i=r.getUint32(8,!0);this.offsets=new Uint32Array(this.blocks+1);for(let a=0;a<=this.blocks;a+=1)this.offsets[a]=r.getUint32(12+a*4,!0);let o=12+4*(this.blocks+1);this.keys=[];for(let a=0;a<this.blocks;a+=1){let s=0n;for(let l=0;l<this.width;l+=1)s=s<<8n|BigInt(n[o+a*this.width+l]);this.keys.push(s)}o+=this.width*this.blocks,this.dictionary=i?re(n.subarray(o,o+i)):null,this.data=n.subarray(o+i),this.cache=new C(a=>this.block(a)),this.groups=new C(a=>this.values(a))}raw(n){let t=this.data.subarray(this.offsets[n],this.offsets[n+1]);return te(t,this.dictionary)}held(n){return Math.min(this.perGroup,this.count-n*this.perGroup)}block(n){throw new Error(`no block ${n}`)}values(n){throw new Error(`no group ${n}`)}at(n){throw new Error(`no row ${n}`)}},At={1:[Uint8Array,Int8Array],2:[Uint16Array,Int16Array],4:[Uint32Array,Int32Array],8:[BigUint64Array,BigInt64Array]},ce=class extends k{signed;constructor(n,t){super(n,t),this.signed=t.encoding==="signed"}block(n){let t=this.raw(n),r=t[0],i=t.slice(1);if(dt&&r>1)for(let o=0;o+r<=i.length;o+=r)i.subarray(o,o+r).reverse();return new At[r][this.signed?1:0](i.buffer)}at(n){let t=Math.floor(n/this.perBlock),r=this.cache.get(t)[n%this.perBlock];return typeof r=="bigint"?Number(r):r}},ue=class extends k{block(n){let t=this.raw(n),r=this.count-n*this.perBlock,i=Math.min(this.fanout,Math.ceil(r/this.perGroup))-1,[o,a]=le(t,0,i),s=[a];for(let l of o)s.push(s[s.length-1]+l);return s.push(t.length),[t,s]}values(n){let t=Math.floor(n/this.fanout),[r,i]=this.cache.get(t),o=i[n%this.fanout],a=[],s=new Uint8Array(0);for(let l=0;l<this.held(n);l+=1){let c=r[o],u=r[o+1];o+=2,u>127&&([u,o]=Te(r,o-1));let f=new Uint8Array(c+u);f.set(s.subarray(0,c)),f.set(r.subarray(o,o+u),c),o+=u,s=f,a.push(se.decode(f))}return a}at(n){if(!n)return"";let t=Math.floor((n-1)/this.perGroup);return this.groups.get(t)[(n-1)%this.perGroup]}},fe=class extends k{hostBits;big;constructor(n,t){super(n,t),this.big=this.width!==4,this.hostBits=this.big?64:0}block(n){let t=this.raw(n),[r,i]=Te(t,0),o=Math.ceil(r/this.perGroup),[a,s]=ae(t,i,o-1),l=[this.keys[n]];for(let T of a)l.push(l[l.length-1]+T);let[c,u]=le(t,s,o-1),f=[u];for(let T of c)f.push(f[f.length-1]+T);return[l,f,t]}values(n){let t=Math.floor(n/this.fanout),[r,i,o]=this.cache.get(t),a=this.held(n),s=r[n%this.fanout],[l,c]=this.big?ae(o,i[n%this.fanout],a-1):le(o,i[n%this.fanout],a-1);if(!this.big){let T=[Number(s)];for(let m of l)T.push(T[T.length-1]+m);return T}let u=[s>>BigInt(this.hostBits)];for(let T of l)u.push(u[u.length-1]+T);let[f]=ae(o,c,a);return u.map((T,m)=>T<<BigInt(this.hostBits)|f[m])}at(n){let t=Math.floor(n/this.perGroup);return this.groups.get(t)[n%this.perGroup]}row(n){let t=(this.big,n),r=oe(this.keys,this.big?t:BigInt(t))-1;if(r<0)return null;let[i]=this.cache.get(r),o=r*this.fanout+oe(i,this.big?t:BigInt(t))-1,a=oe(this.groups.get(o),t)-1;return a<0?null:o*this.perGroup+a}holds(n){let t=this.row(n);return t!==null&&this.at(t)===n?t:null}},oe=(e,n)=>{let t=0,r=e.length;for(;t<r;){let i=t+r>>1;e[i]<=n?t=i+1:r=i}return t},St={plain:[],text:[],degrees:[],coded:[],links:[]},L=class{head;sections={};reads={};tables={};families;rows={};located;answers=new C(n=>this.answer(n));constructor(n){let t=new DataView(n.buffer,n.byteOffset,n.byteLength);if(se.decode(n.subarray(0,G.length))!==G||n[G.length]!==je)throw new Error(`not a plevin ${je} database`);let i=t.getUint32(G.length+1,!0),o=G.length+5;this.head=JSON.parse(se.decode(n.subarray(o,o+i)));let a=o+i;for(let[s,l]of Object.entries(this.head.sections)){let c=a+l.offset,u=n.subarray(c,c+l.bytes),f=l.encoding==="index"?fe:l.encoding==="front"?ue:ce;this.sections[s]=new f(u,l)}Object.assign(this.reads,pt);for(let[s,l]of Object.entries(bt)){let c=this.head.vocabularies[l];c&&(this.reads[s]=u=>c[u]??"")}this.plan(),this.families={4:this.family(4),6:this.family(6)},this.located={4:new C(s=>this.locateIn(4,s)),6:new C(s=>this.locateIn(6,s))}}linked(n,t){return this.rows[n]??=new C(r=>this.row(n,r)),this.rows[n].get(t)}get built(){return this.head.built}get selection(){return this.head.selection}get fields(){return this.head.fields}plan(){for(let[n,t]of Object.entries(this.sections)){let r=n.split(".");if(r.length!==3||r[0]!=="col"&&r[0]!=="link")continue;let[i,o,a]=r;this.tables[o]??={plain:[],text:[],degrees:[],coded:[],links:[]};let s=this.tables[o],l=this.reads[`${o}.${a}`];i==="link"?s.links.push([a,t]):l?s.coded.push([a,t,l]):t.read==="text"?s.text.push([a,t,this.sections.strings]):t.read?s.degrees.push([a,t]):s.plain.push([a,t])}}family(n){let t=`spine.v${n}`,r=`hosts.v${n}`;return{index:this.sections[t]??null,columns:ft.filter(i=>`${t}.${i}`in this.sections).map(i=>[i,this.sections[`${t}.${i}`],this.reads[i]??null]),hosts:this.sections[r]??null,records:this.sections[`${r}.abuse`]??null}}row(n,t){let r=this.tables[n]??St,i={};for(let[o,a]of r.plain)i[o]=a.at(t);for(let[o,a,s]of r.text)i[o]=s.at(a.at(t));for(let[o,a]of r.degrees)i[o]=a.at(t)/ct;for(let[o,a,s]of r.coded)i[o]=s(a.at(t));for(let[o,a]of r.links){let s=a.at(t);s&&(i[o]=this.linked(o,s-1))}return"postal_partial"in i&&(i.postal_partial=String(i.postal).slice(0,i.postal_partial)),i}answer(n){let t=n%2?6:4,r=(n-n%2)/2,i=r%ie,o=(r-i)/ie,a={};for(let[s,l,c]of this.families[t].columns){let u=i&&s==="abuse"?i:l.at(o);Tt.has(s)?u&&(a[s]=this.linked(s,u-1)):(a[Je]??={},a[Je][s]=c?c(u):u)}return a}locateIn(n,t){let{index:r,hosts:i,records:o}=this.families[n],a=r===null?null:r.row(t);if(a===null)return null;if(i===null||o===null)return[n,a,0];let s=i.holds(t);return[n,a,s===null?0:o.at(s)+1]}locate(n,t){return this.located[t?6:4].get(n)}rowFor(n,t){let r=this.locate(n,t);return r===null?null:this.answerFor(r)}answerFor(n){let[t,r,i]=n;return this.answers.get((r*ie+i)*2+(t===6?1:0))}};var Ye=1024,Bt=1n<<128n,b=e=>e?String(e):null,S=e=>e?Number(e):null,_=e=>e==null?null:Number(e),h=(e,n)=>e?.[n],Nt=e=>e?{code:S(e.code),label:b(e.label)}:null,Ut=e=>e?{id:S(e.id),code:b(e.code),name:b(e.name)}:null,wt=e=>e?{id:S(e.id),code:b(e.code),iso:b(e.iso),name:b(e.name),type:b(e.type)}:null,Qe=e=>{let n=new WeakMap;return(t,...r)=>{if(!t)return null;let i=r.join(`
625
+ `),o=n.get(t);o||(o=new Map,n.set(t,o));let a=o.get(i);if(a!==void 0)return a;let s=e(t,...r);return o.set(i,s),s}},Xe=Qe(e=>{let n=String(e.type??"");return{id:S(e.id),name:b(e.name),ascii:b(e.ascii),country:b(e.country),population:S(e.population),elevation:S(e.elevation),postal:b(e.postal),postal_partial:b(e.postal_partial),timezone:b(e.timezone),type:b(n),capital:b(Le(n)),region:wt(h(e,"region")),district:Ut(h(e,"district")),metro:Nt(h(e,"metro"))}}),Gt=Qe((e,n)=>{let t=String(e.company??""),r=String(e.website??""),i=String(e.abuse_email??"");return{company:b(t),brand:b(we(n,t)),domain:b(Ge(r,i)),website:b(r),category:b(e.category),tier:S(e.tier),peering:S(e.peering),scope:b(e.scope),rir:b(e.rir),since:S(e.since),street:b(e.street),state:b(e.state),postal:b(e.postal),country:b(e.country),abuse_email:b(i),city:Xe(h(e,"city"))}}),kt=(e,n)=>{if(!e&&!n)return null;let t=e??{};return{user_type:b(n),user_count:S(t.user_count),mcc:S(t.mcc),mnc:S(t.mnc),is_mobile:n==="cellular"}},Lt=(e,n,t)=>{if(!e&&!n)return null;let r=e??{},[i,o]=ke(String(r.service??""),t);return{name:b(r.name),service:b(i),evidence:b(String(r.evidence??"")||o),risk:_(r.risk),network_risk:n?_(n.risk):null,last_seen_days:S(r.last_seen_days),is_anycast:!!r.is_anycast,is_satellite:!!r.is_satellite,is_hosting_provider:De.has(t),is_proxy:Ie.has(i),is_public_proxy:i==="public_proxy",is_residential_proxy:i==="residential_proxy",is_anonymous_vpn:i==="anonymous_vpn",is_tor_exit_node:i==="tor_exit_node",is_private_relay:i==="private_relay",is_anonymous:!!i}},Pt=e=>{if(!e)return null;let n=Xe(h(e,"city")),t=n?.country??"",r=n?.timezone??"";return[{lat:_(e.lat),lon:_(e.lon),accuracy:S(e.accuracy),confidence:S(e.confidence),granularity:b(e.granularity),city:n,country:Fe(t)},r]},_t=(e,n)=>{if(!e)return null;let t=String(e.handle??"");return[{asn:S(e.asn),handle:b(t),rpki:b(e.rpki),roas:_(e.roas),operator:Gt(h(e,"operator"),t),carrier:kt(h(e,"carrier"),n)},S(e.prefix)]},Kt=(e,n)=>String(e?.user_type||n?.user_type||""),xt=e=>{let n=h(e,"network"),t=h(n,"abuse"),r=Kt(h(e,"abuse"),t);return[Pt(h(e,"place")),_t(n,r),Lt(h(e,"abuse"),t,r)]},vt=(e,n,t)=>{let[r,i]=e,[o,a,s]=i===null?[null,null,null]:Re(n,t,i);return{...r,prefix:i,cidr:o,start:a,end:s}},qe=(e,n,t,r)=>{let[i,o,a]=Z(e,n),s=Ce(e,n),[l,c]=ye(e,n),[u,f,T]=t??[null,null,null];return{ip:i,version:n?6:4,number:e,compressed:i,expanded:o,arpa:a,is_global:s===0,is_bogon:s!==0,is_private:(s&1)!==0,is_loopback:(s&2)!==0,is_multicast:(s&4)!==0,is_reserved:(s&8)!==0,is_link_local:(s&16)!==0,is_unique_local:(s&32)!==0,is_documentation:(s&64)!==0,is_shared:(s&128)!==0,is_benchmark:(s&256)!==0,is_ipv4_mapped:l===V,is_6to4:l===W,is_teredo:l===z,tunnel:l,embedded_ipv4:c,found:t!==null,place:u===null?null:{...u[0],time:Ve(u[1],r)},network:f===null?null:vt(f,e,n),abuse:T}},P=class{file;kept=new Map;results=new Map;second=0;constructor(n){this.file=new L(n)}get built(){return this.file.built}get selection(){return this.file.selection}get fields(){return this.file.fields}storedFor(n){let t=n.join(","),r=this.kept.get(t);if(r!==void 0)return r;this.kept.size>=Ye*16&&this.kept.clear();let i=xt(this.file.answerFor(n));return this.kept.set(t,i),i}lookup(n,t){let[r,i]=v(n);if(t){let u=this.file.locate(r,i);return qe(r,i,u&&this.storedFor(u),t)}let o=Math.floor(Date.now()/1e3);o!==this.second&&(this.second=o,this.results.clear());let a=i?r+Bt:BigInt(r),s=this.results.get(a);if(s!==void 0)return s;this.results.size>=Ye&&this.results.clear();let l=this.file.locate(r,i),c=qe(r,i,l&&this.storedFor(l));return this.results.set(a,c),c}row(n){let[t,r]=v(n);return this.file.rowFor(t,r)}},Qt=async e=>{if(e instanceof Uint8Array)return new P(e);if(e instanceof ArrayBuffer)return new P(new Uint8Array(e));let n=e instanceof Response?e:await fetch(e);if(!n.ok)throw new Error(`${n.status} reading the database`);return new P(new Uint8Array(await n.arrayBuffer()))};export{L as File,P as Plevin,te as decompress,re as loadDictionary,Qt as open};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plevinjs",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Location, network and abuse information for any IP address in one offline file.",
5
5
  "keywords": [
6
6
  "ip",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "Apache-2.0",
29
29
  "author": "tn3w",
30
- "homepage": "https://github.com/tn3w/plevin#readme",
30
+ "homepage": "https://plevin.tn3w.dev",
31
31
  "repository": {
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/tn3w/plevin.git",
@@ -45,6 +45,8 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "types": "./dist/index.d.ts",
48
+ "jsdelivr": "./dist/plevin.min.js",
49
+ "unpkg": "./dist/plevin.min.js",
48
50
  "files": [
49
51
  "dist",
50
52
  "README.md",
@@ -54,7 +56,8 @@
54
56
  "node": ">=20"
55
57
  },
56
58
  "scripts": {
57
- "build": "tsc",
59
+ "build": "tsc && npm run bundle",
60
+ "bundle": "esbuild src/index.ts --bundle --format=esm --minify --target=es2022 --outfile=dist/plevin.min.js",
58
61
  "typecheck": "tsc --noEmit",
59
62
  "lint": "biome check .",
60
63
  "format": "biome check --write .",
@@ -63,6 +66,7 @@
63
66
  "devDependencies": {
64
67
  "@biomejs/biome": "^2.5.8",
65
68
  "@types/node": "^26.2.0",
69
+ "esbuild": "^0.28.2",
66
70
  "typescript": "^7.0.2"
67
71
  }
68
72
  }