hibp 14.0.2 → 14.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 14.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#438](https://github.com/wKovacs64/hibp/pull/438) [`3da8b89`](https://github.com/wKovacs64/hibp/commit/3da8b89dd835be1a059c7e51d41dbe6e542db184) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Restore missing TypeScript declarations that were forgotten in v14.0.2 (PR #436).
8
+
3
9
  ## 14.0.2
4
10
 
5
11
  ### Patch Changes
@@ -1,2 +1,2 @@
1
- var t="undefined"!=typeof window?window.fetch:async function(t,e){return(await Promise.resolve().then((function(){return _}))).fetch(t,e)};const e="hibp",n="14.0.2",r=new Map,s={headers:r,status:400,statusText:"Bad request — the account does not comply with an acceptable format."},o={headers:r,status:401,body:{statusCode:401,message:"Access denied due to missing hibp-api-key."}},i={headers:r,status:403,statusText:"Forbidden - access denied."},u={headers:r,status:404},a={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}};class h extends Error{retryAfterSeconds;constructor(t,e,n){super(e,n),this.name=this.constructor.name,this.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0}}async function c(r,c={}){const{apiKey:f,baseUrl:l="https://haveibeenpwned.com/api/v3",userAgent:d}=c,p={};f&&(p["HIBP-API-Key"]=f),d&&(p["User-Agent"]=d),d||"undefined"!=typeof navigator||(p["User-Agent"]=`${e} ${n}`);const g={headers:p},m=`${l.replace(/\/$/g,"")}${r}`,A=await t(m,g);if(A.ok)return A.json();switch(A.status){case s.status:throw Error(s.statusText);case o.status:{const t=await A.json();throw Error(t.message)}case i.status:{const t=A.headers.get("cf-ray");if(t)throw Error(function(t){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${t})`}(t));throw Error(i.statusText)}case u.status:return null;case a.status:{const t=await A.json(),e=A.headers.get("retry-after");throw new h(e,t.message)}default:throw Error(A.statusText)}}function f(t,e={}){return c("/breach/"+encodeURIComponent(t),e)}function l(t,e={}){const{apiKey:n,domain:r,includeUnverified:s=!0,truncate:o=!0,baseUrl:i,userAgent:u}=e,a=`/breachedaccount/${encodeURIComponent(t)}?`,h=[];return r&&h.push("domain="+encodeURIComponent(r)),s||h.push("includeUnverified=false"),o||h.push("truncateResponse=false"),c(`${a}${h.join("&")}`,{apiKey:n,baseUrl:i,userAgent:u})}function d(t={}){const{domain:e,baseUrl:n,userAgent:r}=t,s=[];return e&&s.push("domain="+encodeURIComponent(e)),c("/breaches?"+s.join("&"),{baseUrl:n,userAgent:r})}function p(t={}){return c("/dataclasses",t)}function g(t,e={}){return c("/pasteaccount/"+encodeURIComponent(t),e)}const m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="ARRAYBUFFER not supported by this environment",b="UINT8ARRAY not supported by this environment";function w(t,e,n,r){let s,o,i;const u=e||[0],a=(n=n||0)>>>3,h=-1===r?3:0;for(s=0;t.length>s;s+=1)i=s+a,o=i>>>2,o>=u.length&&u.push(0),u[o]|=t[s]<<8*(h+r*(i%4));return{value:u,binLen:8*t.length+n}}function U(t,e,n){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");const a=e||[0],h=(n=n||0)>>>3,c=-1===r?3:0;for(s=0;t.length>s;s+=2){if(o=parseInt(t.substr(s,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(s>>>1)+h,i=u>>>2;i>=a.length;)a.push(0);a[i]|=o<<8*(c+r*(u%4))}return{value:a,binLen:4*t.length+n}}(t,e,r,n)};case"TEXT":return function(t,r,s){return function(t,e,n,r,s){let o,i,u,a,h,c,f,l,d=0;const p=n||[0],g=(r=r||0)>>>3;if("UTF8"===e)for(f=-1===s?3:0,u=0;t.length>u;u+=1)for(o=t.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||o>=57344?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;i.length>a;a+=1){for(c=d+g,h=c>>>2;h>=p.length;)p.push(0);p[h]|=i[a]<<8*(f+s*(c%4)),d+=1}else for(f=-1===s?2:0,l="UTF16LE"===e&&1!==s||"UTF16LE"!==e&&1===s,u=0;t.length>u;u+=1){for(o=t.charCodeAt(u),!0===l&&(a=255&o,o=a<<8|o>>>8),c=d+g,h=c>>>2;h>=p.length;)p.push(0);p[h]|=o<<8*(f+s*(c%4)),d+=2}return{value:p,binLen:8*d+r}}(t,e,r,s,n)};case"B64":return function(t,e,r){return function(t,e,n,r){let s,o,i,u,a,h,c,f=0;const l=e||[0],d=(n=n||0)>>>3,p=-1===r?3:0,g=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==g&&t.length>g)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(a=t.substr(o,4),u=0,i=0;a.length>i;i+=1)s=m.indexOf(a.charAt(i)),u|=s<<18-6*i;for(i=0;a.length-1>i;i+=1){for(c=f+d,h=c>>>2;h>=l.length;)l.push(0);l[h]|=(u>>>16-8*i&255)<<8*(p+r*(c%4)),f+=1}}return{value:l,binLen:8*f+n}}(t,e,r,n)};case"BYTES":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;const a=e||[0],h=(n=n||0)>>>3,c=-1===r?3:0;for(o=0;t.length>o;o+=1)s=t.charCodeAt(o),u=o+h,i=u>>>2,i>=a.length&&a.push(0),a[i]|=s<<8*(c+r*(u%4));return{value:a,binLen:8*t.length+n}}(t,e,r,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(A)}return function(t,e,r){return function(t,e,n,r){return w(new Uint8Array(t),e,n,r)}(t,e,r,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(b)}return function(t,e,r){return w(t,e,r,n)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function E(t,e,n,r){switch(t){case"HEX":return function(t){return function(t,e,n,r){const s="0123456789abcdef";let o,i,u="";const a=e/8,h=-1===n?3:0;for(o=0;a>o;o+=1)i=t[o>>>2]>>>8*(h+n*(o%4)),u+=s.charAt(i>>>4&15)+s.charAt(15&i);return r.outputUpper?u.toUpperCase():u}(t,e,n,r)};case"B64":return function(t){return function(t,e,n,r){let s,o,i,u,a,h="";const c=e/8,f=-1===n?3:0;for(s=0;c>s;s+=3)for(u=c>s+1?t[s+1>>>2]:0,a=c>s+2?t[s+2>>>2]:0,i=(t[s>>>2]>>>8*(f+n*(s%4))&255)<<16|(u>>>8*(f+n*((s+1)%4))&255)<<8|a>>>8*(f+n*((s+2)%4))&255,o=0;4>o;o+=1)h+=8*s+6*o>e?r.b64Pad:m.charAt(i>>>6*(3-o)&63);return h}(t,e,n,r)};case"BYTES":return function(t){return function(t,e,n){let r,s,o="";const i=e/8,u=-1===n?3:0;for(r=0;i>r;r+=1)s=t[r>>>2]>>>8*(u+n*(r%4))&255,o+=String.fromCharCode(s);return o}(t,e,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(A)}return function(t){return function(t,e,n){let r;const s=e/8,o=new ArrayBuffer(s),i=new Uint8Array(o),u=-1===n?3:0;for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(u+n*(r%4))&255;return o}(t,e,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(b)}return function(t){return function(t,e,n){let r;const s=e/8,o=-1===n?3:0,i=new Uint8Array(s);for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(o+n*(r%4))&255;return i}(t,e,n)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function y(t){const e={outputUpper:!1,b64Pad:"=",outputLen:-1},n=t||{},r="Output length must be a multiple of 8";if(e.outputUpper=n.outputUpper||!1,n.b64Pad&&(e.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw Error(r);e.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw Error(r);e.outputLen=n.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}class R{constructor(t,e,n){const r=n||{};if(this.t=e,this.i=r.encoding||"UTF8",this.numRounds=r.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.o=t,this.h=[],this.u=0,this.l=!1,this.A=0,this.p=!1,this.U=[],this.R=[]}update(t){let e,n=0;const r=this.T>>>5,s=this.F(t,this.h,this.u),o=s.binLen,i=s.value,u=o>>>5;for(e=0;u>e;e+=r)o>=n+this.T&&(this.m=this.g(i.slice(e,e+r),this.m),n+=this.T);return this.A+=n,this.h=i.slice(n>>>5),this.u=o%this.T,this.l=!0,this}getHash(t,e){let n,r,s=this.B;const o=y(e);if(this.v){if(-1===o.outputLen)throw Error("Output length must be specified in options");s=o.outputLen}const i=E(t,s,this.H,o);if(this.p&&this.C)return i(this.C(o));for(r=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),s),n=1;this.numRounds>n;n+=1)this.v&&s%32!=0&&(r[r.length-1]&=16777215>>>24-s%32),r=this.Y(r,s,0,this.L(this.o),s);return i(r)}setHMACKey(t,e,n){if(!this.M)throw Error("Variant does not support HMAC");if(this.l)throw Error("Cannot set MAC key after calling update");const r=U(e,(n||{}).encoding||"UTF8",this.H);this.N(r(t))}N(t){const e=this.T>>>3,n=e/4-1;let r;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.p)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.Y(t.value,t.binLen,0,this.L(this.o),this.B));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.U[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.m=this.g(this.U,this.m),this.A=this.T,this.p=!0}getHMAC(t,e){const n=y(e);return E(t,this.B,this.H,n)(this.S())}S(){let t;if(!this.p)throw Error("Cannot call getHMAC without first setting MAC key");const e=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),this.B);return t=this.g(this.R,this.L(this.o)),t=this.Y(e,this.B,this.T,t,this.B),t}}function T(t,e){return t<<e|t>>>32-e}function v(t,e,n){return t^e^n}function B(t,e,n){return t&e^t&n^e&n}function C(t,e){const n=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(n>>>16))<<16|65535&n}function F(t,e,n,r,s){const o=(65535&t)+(65535&e)+(65535&n)+(65535&r)+(65535&s);return(65535&(t>>>16)+(e>>>16)+(n>>>16)+(r>>>16)+(s>>>16)+(o>>>16))<<16|65535&o}function L(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function H(t,e){let n,r,s,o,i,u,a;const h=[];for(n=e[0],r=e[1],s=e[2],o=e[3],i=e[4],a=0;80>a;a+=1)h[a]=16>a?t[a]:T(h[a-3]^h[a-8]^h[a-14]^h[a-16],1),u=20>a?F(T(n,5),(c=r)&s^~c&o,i,1518500249,h[a]):40>a?F(T(n,5),v(r,s,o),i,1859775393,h[a]):60>a?F(T(n,5),B(r,s,o),i,2400959708,h[a]):F(T(n,5),v(r,s,o),i,3395469782,h[a]),i=o,o=s,s=T(r,30),r=n,n=u;var c;return e[0]=C(n,e[0]),e[1]=C(r,e[1]),e[2]=C(s,e[2]),e[3]=C(o,e[3]),e[4]=C(i,e[4]),e}function I(t,e,n,r){let s;const o=15+(e+65>>>9<<4),i=e+n;for(;o>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[o]=4294967295&i,t[o-1]=i/4294967296|0,s=0;t.length>s;s+=16)r=H(t.slice(s,s+16),r);return r}class Y extends R{constructor(t,e,n){if("SHA-1"!==t)throw Error("Chosen SHA variant is not supported");super(t,e,n);const r=n||{};this.M=!0,this.C=this.S,this.H=-1,this.F=U(this.t,this.i,this.H),this.g=H,this.I=function(t){return t.slice()},this.L=L,this.Y=I,this.m=[1732584193,4023233417,2562383102,271733878,3285377520],this.T=512,this.B=160,this.v=!1,r.hmacKey&&this.N(function(t,e,n,r){const s="hmacKey must include a value and format";if(!e)throw Error(s);if(void 0===e.value||!e.format)throw Error(s);return U(e.format,e.encoding||"UTF8",n)(e.value)}(0,r.hmacKey,this.H))}}const S={status:400,body:"The hash prefix was not in a valid format"};async function x(e,n={}){const{baseUrl:r,userAgent:s,addPadding:o=!1,mode:i="sha1"}=n,u=await async function(e,n={}){const{baseUrl:r="https://api.pwnedpasswords.com",userAgent:s,addPadding:o=!1,mode:i="sha1"}=n,u=Object.assign({},s?{headers:{"User-Agent":s}}:{},o?{headers:{"Add-Padding":"true"}}:{}),a=`${r.replace(/\/$/g,"")}${e}?mode=${i}`,h=await t(a,u);if(h.ok)return h.text();if(h.status===S.status){const t=await h.text();throw Error(t)}throw Error(h.statusText)}("/range/"+encodeURIComponent(e),{baseUrl:r,userAgent:s,addPadding:o,mode:i});return u.split("\n").filter(Boolean).reduce(((t,e)=>{const[n,r]=e.split(":");return t[n]=Number.parseInt(r,10),t}),{})}async function P(t,e={}){const n=new Y("SHA-1","TEXT");n.update(t);const r=n.getHash("HEX",{outputUpper:!0}),s=r.slice(0,5),o=r.slice(5);return(await x(s,e))[o]||0}async function N(t,e={}){const{apiKey:n,domain:r,truncate:s=!0,baseUrl:o,userAgent:i}=e,[u,a]=await Promise.all([l(t,{apiKey:n,domain:r,truncate:s,baseUrl:o,userAgent:i}),/^.+@.+$/.test(t)?g(t,{apiKey:n,baseUrl:o,userAgent:i}):null]);return{breaches:u,pastes:a}}async function $(t={}){return c("/subscription/status",t)}const{ReadableStream:M}=globalThis,{FormData:k,Blob:K,File:X}=globalThis,{Headers:j,Request:O,Response:q}=globalThis;var D=globalThis.fetch.bind(globalThis),_=Object.freeze({__proto__:null,Blob:K,File:X,FormData:k,Headers:j,ReadableStream:M,Request:O,Response:q,default:D});export{h as RateLimitError,f as breach,l as breachedAccount,d as breaches,p as dataClasses,g as pasteAccount,P as pwnedPassword,x as pwnedPasswordRange,N as search,$ as subscriptionStatus};
1
+ var t="undefined"!=typeof window?window.fetch:async function(t,e){return(await Promise.resolve().then((function(){return _}))).fetch(t,e)};const e="hibp",n="14.0.3",r=new Map,s={headers:r,status:400,statusText:"Bad request — the account does not comply with an acceptable format."},o={headers:r,status:401,body:{statusCode:401,message:"Access denied due to missing hibp-api-key."}},i={headers:r,status:403,statusText:"Forbidden - access denied."},u={headers:r,status:404},a={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}};class h extends Error{retryAfterSeconds;constructor(t,e,n){super(e,n),this.name=this.constructor.name,this.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0}}async function c(r,c={}){const{apiKey:f,baseUrl:l="https://haveibeenpwned.com/api/v3",userAgent:d}=c,p={};f&&(p["HIBP-API-Key"]=f),d&&(p["User-Agent"]=d),d||"undefined"!=typeof navigator||(p["User-Agent"]=`${e} ${n}`);const g={headers:p},m=`${l.replace(/\/$/g,"")}${r}`,A=await t(m,g);if(A.ok)return A.json();switch(A.status){case s.status:throw Error(s.statusText);case o.status:{const t=await A.json();throw Error(t.message)}case i.status:{const t=A.headers.get("cf-ray");if(t)throw Error(function(t){return`Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ${t})`}(t));throw Error(i.statusText)}case u.status:return null;case a.status:{const t=await A.json(),e=A.headers.get("retry-after");throw new h(e,t.message)}default:throw Error(A.statusText)}}function f(t,e={}){return c("/breach/"+encodeURIComponent(t),e)}function l(t,e={}){const{apiKey:n,domain:r,includeUnverified:s=!0,truncate:o=!0,baseUrl:i,userAgent:u}=e,a=`/breachedaccount/${encodeURIComponent(t)}?`,h=[];return r&&h.push("domain="+encodeURIComponent(r)),s||h.push("includeUnverified=false"),o||h.push("truncateResponse=false"),c(`${a}${h.join("&")}`,{apiKey:n,baseUrl:i,userAgent:u})}function d(t={}){const{domain:e,baseUrl:n,userAgent:r}=t,s=[];return e&&s.push("domain="+encodeURIComponent(e)),c("/breaches?"+s.join("&"),{baseUrl:n,userAgent:r})}function p(t={}){return c("/dataclasses",t)}function g(t,e={}){return c("/pasteaccount/"+encodeURIComponent(t),e)}const m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="ARRAYBUFFER not supported by this environment",b="UINT8ARRAY not supported by this environment";function w(t,e,n,r){let s,o,i;const u=e||[0],a=(n=n||0)>>>3,h=-1===r?3:0;for(s=0;t.length>s;s+=1)i=s+a,o=i>>>2,o>=u.length&&u.push(0),u[o]|=t[s]<<8*(h+r*(i%4));return{value:u,binLen:8*t.length+n}}function U(t,e,n){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");const a=e||[0],h=(n=n||0)>>>3,c=-1===r?3:0;for(s=0;t.length>s;s+=2){if(o=parseInt(t.substr(s,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(u=(s>>>1)+h,i=u>>>2;i>=a.length;)a.push(0);a[i]|=o<<8*(c+r*(u%4))}return{value:a,binLen:4*t.length+n}}(t,e,r,n)};case"TEXT":return function(t,r,s){return function(t,e,n,r,s){let o,i,u,a,h,c,f,l,d=0;const p=n||[0],g=(r=r||0)>>>3;if("UTF8"===e)for(f=-1===s?3:0,u=0;t.length>u;u+=1)for(o=t.charCodeAt(u),i=[],128>o?i.push(o):2048>o?(i.push(192|o>>>6),i.push(128|63&o)):55296>o||o>=57344?i.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(u)),i.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),a=0;i.length>a;a+=1){for(c=d+g,h=c>>>2;h>=p.length;)p.push(0);p[h]|=i[a]<<8*(f+s*(c%4)),d+=1}else for(f=-1===s?2:0,l="UTF16LE"===e&&1!==s||"UTF16LE"!==e&&1===s,u=0;t.length>u;u+=1){for(o=t.charCodeAt(u),!0===l&&(a=255&o,o=a<<8|o>>>8),c=d+g,h=c>>>2;h>=p.length;)p.push(0);p[h]|=o<<8*(f+s*(c%4)),d+=2}return{value:p,binLen:8*d+r}}(t,e,r,s,n)};case"B64":return function(t,e,r){return function(t,e,n,r){let s,o,i,u,a,h,c,f=0;const l=e||[0],d=(n=n||0)>>>3,p=-1===r?3:0,g=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==g&&t.length>g)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(a=t.substr(o,4),u=0,i=0;a.length>i;i+=1)s=m.indexOf(a.charAt(i)),u|=s<<18-6*i;for(i=0;a.length-1>i;i+=1){for(c=f+d,h=c>>>2;h>=l.length;)l.push(0);l[h]|=(u>>>16-8*i&255)<<8*(p+r*(c%4)),f+=1}}return{value:l,binLen:8*f+n}}(t,e,r,n)};case"BYTES":return function(t,e,r){return function(t,e,n,r){let s,o,i,u;const a=e||[0],h=(n=n||0)>>>3,c=-1===r?3:0;for(o=0;t.length>o;o+=1)s=t.charCodeAt(o),u=o+h,i=u>>>2,i>=a.length&&a.push(0),a[i]|=s<<8*(c+r*(u%4));return{value:a,binLen:8*t.length+n}}(t,e,r,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(A)}return function(t,e,r){return function(t,e,n,r){return w(new Uint8Array(t),e,n,r)}(t,e,r,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(b)}return function(t,e,r){return w(t,e,r,n)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function E(t,e,n,r){switch(t){case"HEX":return function(t){return function(t,e,n,r){const s="0123456789abcdef";let o,i,u="";const a=e/8,h=-1===n?3:0;for(o=0;a>o;o+=1)i=t[o>>>2]>>>8*(h+n*(o%4)),u+=s.charAt(i>>>4&15)+s.charAt(15&i);return r.outputUpper?u.toUpperCase():u}(t,e,n,r)};case"B64":return function(t){return function(t,e,n,r){let s,o,i,u,a,h="";const c=e/8,f=-1===n?3:0;for(s=0;c>s;s+=3)for(u=c>s+1?t[s+1>>>2]:0,a=c>s+2?t[s+2>>>2]:0,i=(t[s>>>2]>>>8*(f+n*(s%4))&255)<<16|(u>>>8*(f+n*((s+1)%4))&255)<<8|a>>>8*(f+n*((s+2)%4))&255,o=0;4>o;o+=1)h+=8*s+6*o>e?r.b64Pad:m.charAt(i>>>6*(3-o)&63);return h}(t,e,n,r)};case"BYTES":return function(t){return function(t,e,n){let r,s,o="";const i=e/8,u=-1===n?3:0;for(r=0;i>r;r+=1)s=t[r>>>2]>>>8*(u+n*(r%4))&255,o+=String.fromCharCode(s);return o}(t,e,n)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(A)}return function(t){return function(t,e,n){let r;const s=e/8,o=new ArrayBuffer(s),i=new Uint8Array(o),u=-1===n?3:0;for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(u+n*(r%4))&255;return o}(t,e,n)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(b)}return function(t){return function(t,e,n){let r;const s=e/8,o=-1===n?3:0,i=new Uint8Array(s);for(r=0;s>r;r+=1)i[r]=t[r>>>2]>>>8*(o+n*(r%4))&255;return i}(t,e,n)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function y(t){const e={outputUpper:!1,b64Pad:"=",outputLen:-1},n=t||{},r="Output length must be a multiple of 8";if(e.outputUpper=n.outputUpper||!1,n.b64Pad&&(e.b64Pad=n.b64Pad),n.outputLen){if(n.outputLen%8!=0)throw Error(r);e.outputLen=n.outputLen}else if(n.shakeLen){if(n.shakeLen%8!=0)throw Error(r);e.outputLen=n.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}class R{constructor(t,e,n){const r=n||{};if(this.t=e,this.i=r.encoding||"UTF8",this.numRounds=r.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.o=t,this.h=[],this.u=0,this.l=!1,this.A=0,this.p=!1,this.U=[],this.R=[]}update(t){let e,n=0;const r=this.T>>>5,s=this.F(t,this.h,this.u),o=s.binLen,i=s.value,u=o>>>5;for(e=0;u>e;e+=r)o>=n+this.T&&(this.m=this.g(i.slice(e,e+r),this.m),n+=this.T);return this.A+=n,this.h=i.slice(n>>>5),this.u=o%this.T,this.l=!0,this}getHash(t,e){let n,r,s=this.B;const o=y(e);if(this.v){if(-1===o.outputLen)throw Error("Output length must be specified in options");s=o.outputLen}const i=E(t,s,this.H,o);if(this.p&&this.C)return i(this.C(o));for(r=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),s),n=1;this.numRounds>n;n+=1)this.v&&s%32!=0&&(r[r.length-1]&=16777215>>>24-s%32),r=this.Y(r,s,0,this.L(this.o),s);return i(r)}setHMACKey(t,e,n){if(!this.M)throw Error("Variant does not support HMAC");if(this.l)throw Error("Cannot set MAC key after calling update");const r=U(e,(n||{}).encoding||"UTF8",this.H);this.N(r(t))}N(t){const e=this.T>>>3,n=e/4-1;let r;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.p)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.Y(t.value,t.binLen,0,this.L(this.o),this.B));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.U[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.m=this.g(this.U,this.m),this.A=this.T,this.p=!0}getHMAC(t,e){const n=y(e);return E(t,this.B,this.H,n)(this.S())}S(){let t;if(!this.p)throw Error("Cannot call getHMAC without first setting MAC key");const e=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),this.B);return t=this.g(this.R,this.L(this.o)),t=this.Y(e,this.B,this.T,t,this.B),t}}function T(t,e){return t<<e|t>>>32-e}function v(t,e,n){return t^e^n}function B(t,e,n){return t&e^t&n^e&n}function C(t,e){const n=(65535&t)+(65535&e);return(65535&(t>>>16)+(e>>>16)+(n>>>16))<<16|65535&n}function F(t,e,n,r,s){const o=(65535&t)+(65535&e)+(65535&n)+(65535&r)+(65535&s);return(65535&(t>>>16)+(e>>>16)+(n>>>16)+(r>>>16)+(s>>>16)+(o>>>16))<<16|65535&o}function L(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function H(t,e){let n,r,s,o,i,u,a;const h=[];for(n=e[0],r=e[1],s=e[2],o=e[3],i=e[4],a=0;80>a;a+=1)h[a]=16>a?t[a]:T(h[a-3]^h[a-8]^h[a-14]^h[a-16],1),u=20>a?F(T(n,5),(c=r)&s^~c&o,i,1518500249,h[a]):40>a?F(T(n,5),v(r,s,o),i,1859775393,h[a]):60>a?F(T(n,5),B(r,s,o),i,2400959708,h[a]):F(T(n,5),v(r,s,o),i,3395469782,h[a]),i=o,o=s,s=T(r,30),r=n,n=u;var c;return e[0]=C(n,e[0]),e[1]=C(r,e[1]),e[2]=C(s,e[2]),e[3]=C(o,e[3]),e[4]=C(i,e[4]),e}function I(t,e,n,r){let s;const o=15+(e+65>>>9<<4),i=e+n;for(;o>=t.length;)t.push(0);for(t[e>>>5]|=128<<24-e%32,t[o]=4294967295&i,t[o-1]=i/4294967296|0,s=0;t.length>s;s+=16)r=H(t.slice(s,s+16),r);return r}class Y extends R{constructor(t,e,n){if("SHA-1"!==t)throw Error("Chosen SHA variant is not supported");super(t,e,n);const r=n||{};this.M=!0,this.C=this.S,this.H=-1,this.F=U(this.t,this.i,this.H),this.g=H,this.I=function(t){return t.slice()},this.L=L,this.Y=I,this.m=[1732584193,4023233417,2562383102,271733878,3285377520],this.T=512,this.B=160,this.v=!1,r.hmacKey&&this.N(function(t,e,n,r){const s="hmacKey must include a value and format";if(!e)throw Error(s);if(void 0===e.value||!e.format)throw Error(s);return U(e.format,e.encoding||"UTF8",n)(e.value)}(0,r.hmacKey,this.H))}}const S={status:400,body:"The hash prefix was not in a valid format"};async function x(e,n={}){const{baseUrl:r,userAgent:s,addPadding:o=!1,mode:i="sha1"}=n,u=await async function(e,n={}){const{baseUrl:r="https://api.pwnedpasswords.com",userAgent:s,addPadding:o=!1,mode:i="sha1"}=n,u=Object.assign({},s?{headers:{"User-Agent":s}}:{},o?{headers:{"Add-Padding":"true"}}:{}),a=`${r.replace(/\/$/g,"")}${e}?mode=${i}`,h=await t(a,u);if(h.ok)return h.text();if(h.status===S.status){const t=await h.text();throw Error(t)}throw Error(h.statusText)}("/range/"+encodeURIComponent(e),{baseUrl:r,userAgent:s,addPadding:o,mode:i});return u.split("\n").filter(Boolean).reduce(((t,e)=>{const[n,r]=e.split(":");return t[n]=Number.parseInt(r,10),t}),{})}async function P(t,e={}){const n=new Y("SHA-1","TEXT");n.update(t);const r=n.getHash("HEX",{outputUpper:!0}),s=r.slice(0,5),o=r.slice(5);return(await x(s,e))[o]||0}async function N(t,e={}){const{apiKey:n,domain:r,truncate:s=!0,baseUrl:o,userAgent:i}=e,[u,a]=await Promise.all([l(t,{apiKey:n,domain:r,truncate:s,baseUrl:o,userAgent:i}),/^.+@.+$/.test(t)?g(t,{apiKey:n,baseUrl:o,userAgent:i}):null]);return{breaches:u,pastes:a}}async function $(t={}){return c("/subscription/status",t)}const{ReadableStream:M}=globalThis,{FormData:k,Blob:K,File:X}=globalThis,{Headers:j,Request:O,Response:q}=globalThis;var D=globalThis.fetch.bind(globalThis),_=Object.freeze({__proto__:null,Blob:K,File:X,FormData:k,Headers:j,ReadableStream:M,Request:O,Response:q,default:D});export{h as RateLimitError,f as breach,l as breachedAccount,d as breaches,p as dataClasses,g as pasteAccount,P as pwnedPassword,x as pwnedPasswordRange,N as search,$ as subscriptionStatus};
2
2
  //# sourceMappingURL=hibp.module.js.map
@@ -1,2 +1,2 @@
1
- function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}!function(t,r){if("function"==typeof define&&define.amd)define("hibp",["exports"],r);else if("undefined"!=typeof exports)r(exports);else{var e={exports:{}};r(e.exports),t.hibp=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(r){function e(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],s=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;s=!1}else for(;!(s=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,r)||function(t,r){if(!t)return;if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(t,r)}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);r>e;e++)n[e]=t[e];return n}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var r,e={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=Object.create((r&&r.prototype instanceof m?r:m).prototype),i=new k(n||[]);return a(o,"_invoke",{value:O(t,e,i)}),o}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",g="completed",b={};function m(){}function w(){}function E(){}var A={};f(A,s,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(F([])));x&&x!==n&&i.call(x,s)&&(A=x);var R=E.prototype=m.prototype=Object.create(A);function U(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function L(r,e){function n(o,a,u,s){var c=p(r[o],r,a);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"==t(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(f).then((function(t){h.value=t,u(h)}),(function(t){return n("throw",t,u,s)}))}s(c.arg)}var o;a(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}})}function O(t,e,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=j(u,n);if(s){if(s===b)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=p(t,e,n);if("normal"===c.type){if(o=n.done?g:v,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=g,n.method="throw",n.arg=c.arg)}}}function j(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=p(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,b;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,b):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function S(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function F(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function t(){for(;++o<e.length;)if(i.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=E,a(R,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:w,configurable:!0}),w.displayName=f(E,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,f(t,h,"GeneratorFunction")),t.prototype=Object.create(R),t},e.awrap=function(t){return{__await:t}},U(L.prototype),f(L.prototype,c,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},U(R),f(R,h,"Generator"),f(R,s,(function(){return this})),f(R,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=F,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(this.prev>=a.tryLoc){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(a.catchLoc>this.prev)return n(a.catchLoc,!0);if(a.finallyLoc>this.prev)return n(a.finallyLoc)}else if(s){if(a.catchLoc>this.prev)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(this.prev>=n.tryLoc&&i.call(n,"finallyLoc")&&n.finallyLoc>this.prev){var o=n;break}}o&&("break"===t||"continue"===t)&&r>=o.tryLoc&&o.finallyLoc>=r&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),b},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),b}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:F(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),b}},e}function i(t,r){for(var e=0;r.length>e;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function a(t,r,e){return r&&i(t.prototype,r),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&d(t,r)}function c(r){var e=p();return function(){var n,o=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(r,e){if(e&&("object"===t(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(r)}(this,n)}}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){var r="function"==typeof Map?new Map:void 0;return f=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(r){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return l(t,arguments,v(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),d(e,t)},f(t)}function l(t,r,e){return l=p()?Reflect.construct.bind():function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&d(o,e.prototype),o},l.apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,r){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},d(t,r)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function y(r){var e=function(r,e){if("object"!=t(r)||!r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,e||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==t(e)?e:e+""}function g(t,r,e,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void e(t)}u.done?r(s):Promise.resolve(s).then(n,o)}function b(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){g(i,n,o,a,u,"next",t)}function u(t){g(i,n,o,a,u,"throw",t)}a(void 0)}))}}Object.defineProperty(r,"__esModule",{value:!0}),r.RateLimitError=void 0,r.breach=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S("/breach/".concat(encodeURIComponent(t)),r)},r.breachedAccount=F,r.breaches=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.domain,e=t.baseUrl,n=t.userAgent,o=[];r&&o.push("domain=".concat(encodeURIComponent(r)));return S("".concat("/breaches?").concat(o.join("&")),{baseUrl:e,userAgent:n})},r.dataClasses=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return S("/dataclasses",t)},r.pasteAccount=C,r.pwnedPassword=function(t){return nt.apply(this,arguments)},r.pwnedPasswordRange=rt,r.search=function(t){return ot.apply(this,arguments)},r.subscriptionStatus=function(){return it.apply(this,arguments)};var m="undefined"!=typeof window?window.fetch:function(t,r){return w.apply(this,arguments)};function w(){return(w=b(o().mark((function t(r,e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.resolve().then((function(){return dt}));case 2:return t.abrupt("return",t.sent.fetch(r,e));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var E="hibp",A="14.0.2",T=new Map,x={headers:T,status:400,statusText:"Bad request — the account does not comply with an acceptable format."},R={headers:T,status:401,body:{statusCode:401,message:"Access denied due to missing hibp-api-key."}},U={headers:T,status:403,statusText:"Forbidden - access denied."},L={headers:T,status:404},O={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}},j=r.RateLimitError=function(t){s(e,t);var r=c(e);function e(t,n,o){var i,a,s,c;return u(this,e),i=r.call(this,n,o),a=h(i),c=void 0,(s=y(s="retryAfterSeconds"))in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,i.name=i.constructor.name,i.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0,i}return a(e)}(f(Error));function P(t){return"Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ".concat(t,")")}function S(t){return k.apply(this,arguments)}function k(){return k=b(o().mark((function t(r){var e,n,i,a,u,s,c,h,f,l,p,d,v=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=void 0===(i=(e=v.length>1&&void 0!==v[1]?v[1]:{}).baseUrl)?"https://haveibeenpwned.com/api/v3":i,u=e.userAgent,s={},(n=e.apiKey)&&(s["HIBP-API-Key"]=n),u&&(s["User-Agent"]=u),u||"undefined"!=typeof navigator||(s["User-Agent"]="".concat(E," ").concat(A)),c={headers:s},h="".concat(a.replace(/\/$/g,"")).concat(r),t.next=10,m(h,c);case 10:if(!(f=t.sent).ok){t.next=13;break}return t.abrupt("return",f.json());case 13:t.t0=f.status,t.next=t.t0===x.status?16:t.t0===R.status?17:t.t0===U.status?21:t.t0===L.status?25:t.t0===O.status?26:31;break;case 16:throw Error(x.statusText);case 17:return t.next=19,f.json();case 19:throw Error(t.sent.message);case 21:if(!(l=f.headers.get("cf-ray"))){t.next=24;break}throw Error(P(l));case 24:throw Error(U.statusText);case 25:return t.abrupt("return",null);case 26:return t.next=28,f.json();case 28:throw p=t.sent,d=f.headers.get("retry-after"),new j(d,p.message);case 31:throw Error(f.statusText);case 32:case"end":return t.stop()}}),t)}))),k.apply(this,arguments)}function F(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=r.apiKey,n=r.domain,o=r.includeUnverified,i=void 0===o||o,a=r.truncate,u=void 0===a||a,s=r.baseUrl,c=r.userAgent,h="/breachedaccount/".concat(encodeURIComponent(t),"?"),f=[];return n&&f.push("domain=".concat(encodeURIComponent(n))),i||f.push("includeUnverified=false"),u||f.push("truncateResponse=false"),S("".concat(h).concat(f.join("&")),{apiKey:e,baseUrl:s,userAgent:c})}function C(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S("/pasteaccount/".concat(encodeURIComponent(t)),r)}var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I="ARRAYBUFFER not supported by this environment",_="UINT8ARRAY not supported by this environment";function H(t,r,e,n){var o,i,a,u=r||[0],s=(e=e||0)>>>3,c=-1===n?3:0;for(o=0;t.length>o;o+=1)(i=(a=o+s)>>>2)>=u.length&&u.push(0),u[i]|=t[o]<<8*(c+n*(a%4));return{value:u,binLen:8*t.length+e}}function N(t,r,e){switch(r){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,r,n){return function(t,r,e,n){var o,i,a,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");var s=r||[0],c=(e=e||0)>>>3,h=-1===n?3:0;for(o=0;t.length>o;o+=2){if(i=parseInt(t.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(a=(u=(o>>>1)+c)>>>2;a>=s.length;)s.push(0);s[a]|=i<<8*(h+n*(u%4))}return{value:s,binLen:4*t.length+e}}(t,r,n,e)};case"TEXT":return function(t,n,o){return function(t,r,e,n,o){var i,a,u,s,c,h,f,l,p=0,d=e||[0],v=(n=n||0)>>>3;if("UTF8"===r)for(f=-1===o?3:0,u=0;t.length>u;u+=1)for(a=[],128>(i=t.charCodeAt(u))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||i>=57344?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(u+=1)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),s=0;a.length>s;s+=1){for(c=(h=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=a[s]<<8*(f+o*(h%4)),p+=1}else for(f=-1===o?2:0,l="UTF16LE"===r&&1!==o||"UTF16LE"!==r&&1===o,u=0;t.length>u;u+=1){for(i=t.charCodeAt(u),!0===l&&(i=(s=255&i)<<8|i>>>8),c=(h=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=i<<8*(f+o*(h%4)),p+=2}return{value:d,binLen:8*p+n}}(t,r,n,o,e)};case"B64":return function(t,r,n){return function(t,r,e,n){var o,i,a,u,s,c,h=0,f=r||[0],l=(e=e||0)>>>3,p=-1===n?3:0,d=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==d&&t.length>d)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(u=t.substr(o,4),a=0,i=0;u.length>i;i+=1)a|=B.indexOf(u.charAt(i))<<18-6*i;for(i=0;u.length-1>i;i+=1){for(s=(c=h+l)>>>2;s>=f.length;)f.push(0);f[s]|=(a>>>16-8*i&255)<<8*(p+n*(c%4)),h+=1}}return{value:f,binLen:8*h+e}}(t,r,n,e)};case"BYTES":return function(t,r,n){return function(t,r,e,n){var o,i,a,u,s=r||[0],c=(e=e||0)>>>3,h=-1===n?3:0;for(i=0;t.length>i;i+=1)o=t.charCodeAt(i),(a=(u=i+c)>>>2)>=s.length&&s.push(0),s[a]|=o<<8*(h+n*(u%4));return{value:s,binLen:8*t.length+e}}(t,r,n,e)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(I)}return function(t,r,n){return function(t,r,e,n){return H(new Uint8Array(t),r,e,n)}(t,r,n,e)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(_)}return function(t,r,n){return H(t,r,n,e)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function Y(t,r,e,n){switch(t){case"HEX":return function(t){return function(t,r,e,n){var o,i,a="0123456789abcdef",u="",s=r/8,c=-1===e?3:0;for(o=0;s>o;o+=1)u+=a.charAt((i=t[o>>>2]>>>8*(c+e*(o%4)))>>>4&15)+a.charAt(15&i);return n.outputUpper?u.toUpperCase():u}(t,r,e,n)};case"B64":return function(t){return function(t,r,e,n){var o,i,a,u="",s=r/8,c=-1===e?3:0;for(o=0;s>o;o+=3)for(a=(t[o>>>2]>>>8*(c+e*(o%4))&255)<<16|((s>o+1?t[o+1>>>2]:0)>>>8*(c+e*((o+1)%4))&255)<<8|(s>o+2?t[o+2>>>2]:0)>>>8*(c+e*((o+2)%4))&255,i=0;4>i;i+=1)u+=8*o+6*i>r?n.b64Pad:B.charAt(a>>>6*(3-i)&63);return u}(t,r,e,n)};case"BYTES":return function(t){return function(t,r,e){var n,o="",i=r/8,a=-1===e?3:0;for(n=0;i>n;n+=1)o+=String.fromCharCode(t[n>>>2]>>>8*(a+e*(n%4))&255);return o}(t,r,e)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(I)}return function(t){return function(t,r,e){var n,o=r/8,i=new ArrayBuffer(o),a=new Uint8Array(i),u=-1===e?3:0;for(n=0;o>n;n+=1)a[n]=t[n>>>2]>>>8*(u+e*(n%4))&255;return i}(t,r,e)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(_)}return function(t){return function(t,r,e){var n,o=r/8,i=-1===e?3:0,a=new Uint8Array(o);for(n=0;o>n;n+=1)a[n]=t[n>>>2]>>>8*(i+e*(n%4))&255;return a}(t,r,e)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function M(t){var r={outputUpper:!1,b64Pad:"=",outputLen:-1},e=t||{},n="Output length must be a multiple of 8";if(r.outputUpper=e.outputUpper||!1,e.b64Pad&&(r.b64Pad=e.b64Pad),e.outputLen){if(e.outputLen%8!=0)throw Error(n);r.outputLen=e.outputLen}else if(e.shakeLen){if(e.shakeLen%8!=0)throw Error(n);r.outputLen=e.shakeLen}if("boolean"!=typeof r.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof r.b64Pad)throw Error("Invalid b64Pad formatting option");return r}var K=function(){function t(r,e,n){u(this,t);var o=n||{};if(this.t=e,this.i=o.encoding||"UTF8",this.numRounds=o.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.o=r,this.h=[],this.u=0,this.l=!1,this.A=0,this.p=!1,this.U=[],this.R=[]}return a(t,[{key:"update",value:function(t){var r,e=0,n=this.T>>>5,o=this.F(t,this.h,this.u),i=o.binLen,a=o.value,u=i>>>5;for(r=0;u>r;r+=n)i>=e+this.T&&(this.m=this.g(a.slice(r,r+n),this.m),e+=this.T);return this.A+=e,this.h=a.slice(e>>>5),this.u=i%this.T,this.l=!0,this}},{key:"getHash",value:function(t,r){var e,n,o=this.B,i=M(r);if(this.v){if(-1===i.outputLen)throw Error("Output length must be specified in options");o=i.outputLen}var a=Y(t,o,this.H,i);if(this.p&&this.C)return a(this.C(i));for(n=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),o),e=1;this.numRounds>e;e+=1)this.v&&o%32!=0&&(n[n.length-1]&=16777215>>>24-o%32),n=this.Y(n,o,0,this.L(this.o),o);return a(n)}},{key:"setHMACKey",value:function(t,r,e){if(!this.M)throw Error("Variant does not support HMAC");if(this.l)throw Error("Cannot set MAC key after calling update");var n=N(r,(e||{}).encoding||"UTF8",this.H);this.N(n(t))}},{key:"N",value:function(t){var r,e=this.T>>>3,n=e/4-1;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.p)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.Y(t.value,t.binLen,0,this.L(this.o),this.B));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.U[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.m=this.g(this.U,this.m),this.A=this.T,this.p=!0}},{key:"getHMAC",value:function(t,r){var e=M(r);return Y(t,this.B,this.H,e)(this.S())}},{key:"S",value:function(){var t;if(!this.p)throw Error("Cannot call getHMAC without first setting MAC key");var r=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),this.B);return t=this.g(this.R,this.L(this.o)),t=this.Y(r,this.B,this.T,t,this.B)}}]),t}();function X(t,r){return t<<r|t>>>32-r}function G(t,r,e){return t^r^e}function q(t,r,e){return t&r^t&e^r&e}function D(t,r){var e=(65535&t)+(65535&r);return(65535&(t>>>16)+(r>>>16)+(e>>>16))<<16|65535&e}function $(t,r,e,n,o){var i=(65535&t)+(65535&r)+(65535&e)+(65535&n)+(65535&o);return(65535&(t>>>16)+(r>>>16)+(e>>>16)+(n>>>16)+(o>>>16)+(i>>>16))<<16|65535&i}function z(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function V(t,r){var e,n,o,i,a,u,s,c,h=[];for(e=r[0],n=r[1],o=r[2],i=r[3],a=r[4],s=0;80>s;s+=1)h[s]=16>s?t[s]:X(h[s-3]^h[s-8]^h[s-14]^h[s-16],1),u=20>s?$(X(e,5),(c=n)&o^~c&i,a,1518500249,h[s]):40>s?$(X(e,5),G(n,o,i),a,1859775393,h[s]):60>s?$(X(e,5),q(n,o,i),a,2400959708,h[s]):$(X(e,5),G(n,o,i),a,3395469782,h[s]),a=i,i=o,o=X(n,30),n=e,e=u;return r[0]=D(e,r[0]),r[1]=D(n,r[1]),r[2]=D(o,r[2]),r[3]=D(i,r[3]),r[4]=D(a,r[4]),r}function Z(t,r,e,n){for(var o,i=15+(r+65>>>9<<4),a=r+e;i>=t.length;)t.push(0);for(t[r>>>5]|=128<<24-r%32,t[i]=4294967295&a,t[i-1]=a/4294967296|0,o=0;t.length>o;o+=16)n=V(t.slice(o,o+16),n);return n}var J=function(t){s(e,t);var r=c(e);function e(t,n,o){var i;if(u(this,e),"SHA-1"!==t)throw Error("Chosen SHA variant is not supported");var a=o||{};return(i=r.call(this,t,n,o)).M=!0,i.C=i.S,i.H=-1,i.F=N(i.t,i.i,i.H),i.g=V,i.I=function(t){return t.slice()},i.L=z,i.Y=Z,i.m=[1732584193,4023233417,2562383102,271733878,3285377520],i.T=512,i.B=160,i.v=!1,a.hmacKey&&i.N(function(t,r,e,n){var o="hmacKey must include a value and format";if(!r)throw Error(o);if(void 0===r.value||!r.format)throw Error(o);return N(r.format,r.encoding||"UTF8",e)(r.value)}(0,a.hmacKey,i.H)),i}return a(e)}(K),Q={status:400,body:"The hash prefix was not in a valid format"};function W(t){return tt.apply(this,arguments)}function tt(){return tt=b(o().mark((function t(r){var e,n,i,a,u,s,c,h,f,l,p=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=void 0===(n=(e=p.length>1&&void 0!==p[1]?p[1]:{}).baseUrl)?"https://api.pwnedpasswords.com":n,c=void 0===(s=e.mode)?"sha1":s,h=Object.assign({},(a=e.userAgent)?{headers:{"User-Agent":a}}:{},void 0!==(u=e.addPadding)&&u?{headers:{"Add-Padding":"true"}}:{}),f="".concat(i.replace(/\/$/g,"")).concat(r,"?mode=").concat(c),t.next=6,m(f,h);case 6:if(!(l=t.sent).ok){t.next=9;break}return t.abrupt("return",l.text());case 9:if(l.status!==Q.status){t.next=14;break}return t.next=12,l.text();case 12:throw Error(t.sent);case 14:throw Error(l.statusText);case 15:case"end":return t.stop()}}),t)}))),tt.apply(this,arguments)}function rt(t){return et.apply(this,arguments)}function et(){return et=b(o().mark((function t(r){var n,i,a,u,s,c,h,f,l=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=l.length>1&&void 0!==l[1]?l[1]:{}).baseUrl,a=n.userAgent,s=void 0!==(u=n.addPadding)&&u,h=void 0===(c=n.mode)?"sha1":c,t.next=4,W("/range/".concat(encodeURIComponent(r)),{baseUrl:i,userAgent:a,addPadding:s,mode:h});case 4:return f=t.sent.split("\n").filter(Boolean),t.abrupt("return",f.reduce((function(t,r){var n=e(r.split(":"),2);return t[n[0]]=Number.parseInt(n[1],10),t}),{}));case 7:case"end":return t.stop()}}),t)}))),et.apply(this,arguments)}function nt(){return nt=b(o().mark((function t(r){var e,n,i,a,u,s=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=s.length>1&&void 0!==s[1]?s[1]:{},(n=new J("SHA-1","TEXT")).update(r),i=n.getHash("HEX",{outputUpper:!0}),a=i.slice(0,5),u=i.slice(5),t.next=8,rt(a,e);case 8:return t.abrupt("return",t.sent[u]||0);case 10:case"end":return t.stop()}}),t)}))),nt.apply(this,arguments)}function ot(){return ot=b(o().mark((function t(r){var n,i,a,u,s,c,h,f,l=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=l.length>1&&void 0!==l[1]?l[1]:{}).apiKey,a=n.domain,s=void 0===(u=n.truncate)||u,c=n.baseUrl,h=n.userAgent,t.next=4,Promise.all([F(r,{apiKey:i,domain:a,truncate:s,baseUrl:c,userAgent:h}),/^.+@.+$/.test(r)?C(r,{apiKey:i,baseUrl:c,userAgent:h}):null]);case 4:return f=e(t.sent,2),t.abrupt("return",{breaches:f[0],pastes:f[1]});case 9:case"end":return t.stop()}}),t)}))),ot.apply(this,arguments)}function it(){return it=b(o().mark((function t(){var r=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"/subscription/status",t.abrupt("return",S("/subscription/status",r.length>0&&void 0!==r[0]?r[0]:{}));case 3:case"end":return t.stop()}}),t)}))),it.apply(this,arguments)}var at=globalThis.ReadableStream,ut=(globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis.FormData),st=globalThis.Blob,ct=globalThis.File,ht=globalThis.Headers,ft=globalThis.Request,lt=globalThis.Response,pt=globalThis.fetch.bind(globalThis),dt=Object.freeze({__proto__:null,Blob:st,File:ct,FormData:ut,Headers:ht,ReadableStream:at,Request:ft,Response:lt,default:pt})}));
1
+ function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}!function(t,r){if("function"==typeof define&&define.amd)define("hibp",["exports"],r);else if("undefined"!=typeof exports)r(exports);else{var e={exports:{}};r(e.exports),t.hibp=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(r){function e(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],s=!0,c=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;s=!1}else for(;!(s=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,r)||function(t,r){if(!t)return;if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return n(t,r)}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);r>e;e++)n[e]=t[e];return n}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var r,e={},n=Object.prototype,i=n.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function l(t,r,e,n){var o=Object.create((r&&r.prototype instanceof m?r:m).prototype),i=new k(n||[]);return a(o,"_invoke",{value:O(t,e,i)}),o}function p(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",v="suspendedYield",y="executing",g="completed",b={};function m(){}function w(){}function E(){}var A={};f(A,s,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(F([])));x&&x!==n&&i.call(x,s)&&(A=x);var R=E.prototype=m.prototype=Object.create(A);function U(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function L(r,e){function n(o,a,u,s){var c=p(r[o],r,a);if("throw"!==c.type){var h=c.arg,f=h.value;return f&&"object"==t(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,u,s)}),(function(t){n("throw",t,u,s)})):e.resolve(f).then((function(t){h.value=t,u(h)}),(function(t){return n("throw",t,u,s)}))}s(c.arg)}var o;a(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}})}function O(t,e,n){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=j(u,n);if(s){if(s===b)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var c=p(t,e,n);if("normal"===c.type){if(o=n.done?g:v,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=g,n.method="throw",n.arg=c.arg)}}}function j(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,j(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var i=p(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,b;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,b):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function S(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function F(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function t(){for(;++o<e.length;)if(i.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=E,a(R,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:w,configurable:!0}),w.displayName=f(E,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,f(t,h,"GeneratorFunction")),t.prototype=Object.create(R),t},e.awrap=function(t){return{__await:t}},U(L.prototype),f(L.prototype,c,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},U(R),f(R,h,"Generator"),f(R,s,(function(){return this})),f(R,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=F,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(this.prev>=a.tryLoc){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(a.catchLoc>this.prev)return n(a.catchLoc,!0);if(a.finallyLoc>this.prev)return n(a.finallyLoc)}else if(s){if(a.catchLoc>this.prev)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(this.prev>=n.tryLoc&&i.call(n,"finallyLoc")&&n.finallyLoc>this.prev){var o=n;break}}o&&("break"===t||"continue"===t)&&r>=o.tryLoc&&o.finallyLoc>=r&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),b},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),b}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:F(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),b}},e}function i(t,r){for(var e=0;r.length>e;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function a(t,r,e){return r&&i(t.prototype,r),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&d(t,r)}function c(r){var e=p();return function(){var n,o=v(r);if(e){var i=v(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(r,e){if(e&&("object"===t(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(r)}(this,n)}}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){var r="function"==typeof Map?new Map:void 0;return f=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(r){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return l(t,arguments,v(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),d(e,t)},f(t)}function l(t,r,e){return l=p()?Reflect.construct.bind():function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&d(o,e.prototype),o},l.apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,r){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},d(t,r)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function y(r){var e=function(r,e){if("object"!=t(r)||!r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,e||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==t(e)?e:e+""}function g(t,r,e,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void e(t)}u.done?r(s):Promise.resolve(s).then(n,o)}function b(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){g(i,n,o,a,u,"next",t)}function u(t){g(i,n,o,a,u,"throw",t)}a(void 0)}))}}Object.defineProperty(r,"__esModule",{value:!0}),r.RateLimitError=void 0,r.breach=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S("/breach/".concat(encodeURIComponent(t)),r)},r.breachedAccount=F,r.breaches=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.domain,e=t.baseUrl,n=t.userAgent,o=[];r&&o.push("domain=".concat(encodeURIComponent(r)));return S("".concat("/breaches?").concat(o.join("&")),{baseUrl:e,userAgent:n})},r.dataClasses=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return S("/dataclasses",t)},r.pasteAccount=C,r.pwnedPassword=function(t){return nt.apply(this,arguments)},r.pwnedPasswordRange=rt,r.search=function(t){return ot.apply(this,arguments)},r.subscriptionStatus=function(){return it.apply(this,arguments)};var m="undefined"!=typeof window?window.fetch:function(t,r){return w.apply(this,arguments)};function w(){return(w=b(o().mark((function t(r,e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.resolve().then((function(){return dt}));case 2:return t.abrupt("return",t.sent.fetch(r,e));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var E="hibp",A="14.0.3",T=new Map,x={headers:T,status:400,statusText:"Bad request — the account does not comply with an acceptable format."},R={headers:T,status:401,body:{statusCode:401,message:"Access denied due to missing hibp-api-key."}},U={headers:T,status:403,statusText:"Forbidden - access denied."},L={headers:T,status:404},O={headers:new Map([["retry-after","2"]]),status:429,body:{statusCode:429,message:"Rate limit is exceeded. Try again in 2 seconds."}},j=r.RateLimitError=function(t){s(e,t);var r=c(e);function e(t,n,o){var i,a,s,c;return u(this,e),i=r.call(this,n,o),a=h(i),c=void 0,(s=y(s="retryAfterSeconds"))in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,i.name=i.constructor.name,i.retryAfterSeconds="string"==typeof t?Number.parseInt(t,10):void 0,i}return a(e)}(f(Error));function P(t){return"Request blocked, contact haveibeenpwned.com if this continues (Ray ID: ".concat(t,")")}function S(t){return k.apply(this,arguments)}function k(){return k=b(o().mark((function t(r){var e,n,i,a,u,s,c,h,f,l,p,d,v=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=void 0===(i=(e=v.length>1&&void 0!==v[1]?v[1]:{}).baseUrl)?"https://haveibeenpwned.com/api/v3":i,u=e.userAgent,s={},(n=e.apiKey)&&(s["HIBP-API-Key"]=n),u&&(s["User-Agent"]=u),u||"undefined"!=typeof navigator||(s["User-Agent"]="".concat(E," ").concat(A)),c={headers:s},h="".concat(a.replace(/\/$/g,"")).concat(r),t.next=10,m(h,c);case 10:if(!(f=t.sent).ok){t.next=13;break}return t.abrupt("return",f.json());case 13:t.t0=f.status,t.next=t.t0===x.status?16:t.t0===R.status?17:t.t0===U.status?21:t.t0===L.status?25:t.t0===O.status?26:31;break;case 16:throw Error(x.statusText);case 17:return t.next=19,f.json();case 19:throw Error(t.sent.message);case 21:if(!(l=f.headers.get("cf-ray"))){t.next=24;break}throw Error(P(l));case 24:throw Error(U.statusText);case 25:return t.abrupt("return",null);case 26:return t.next=28,f.json();case 28:throw p=t.sent,d=f.headers.get("retry-after"),new j(d,p.message);case 31:throw Error(f.statusText);case 32:case"end":return t.stop()}}),t)}))),k.apply(this,arguments)}function F(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=r.apiKey,n=r.domain,o=r.includeUnverified,i=void 0===o||o,a=r.truncate,u=void 0===a||a,s=r.baseUrl,c=r.userAgent,h="/breachedaccount/".concat(encodeURIComponent(t),"?"),f=[];return n&&f.push("domain=".concat(encodeURIComponent(n))),i||f.push("includeUnverified=false"),u||f.push("truncateResponse=false"),S("".concat(h).concat(f.join("&")),{apiKey:e,baseUrl:s,userAgent:c})}function C(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return S("/pasteaccount/".concat(encodeURIComponent(t)),r)}var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I="ARRAYBUFFER not supported by this environment",_="UINT8ARRAY not supported by this environment";function H(t,r,e,n){var o,i,a,u=r||[0],s=(e=e||0)>>>3,c=-1===n?3:0;for(o=0;t.length>o;o+=1)(i=(a=o+s)>>>2)>=u.length&&u.push(0),u[i]|=t[o]<<8*(c+n*(a%4));return{value:u,binLen:8*t.length+e}}function N(t,r,e){switch(r){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":return function(t,r,n){return function(t,r,e,n){var o,i,a,u;if(0!=t.length%2)throw Error("String of HEX type must be in byte increments");var s=r||[0],c=(e=e||0)>>>3,h=-1===n?3:0;for(o=0;t.length>o;o+=2){if(i=parseInt(t.substr(o,2),16),isNaN(i))throw Error("String of HEX type contains invalid characters");for(a=(u=(o>>>1)+c)>>>2;a>=s.length;)s.push(0);s[a]|=i<<8*(h+n*(u%4))}return{value:s,binLen:4*t.length+e}}(t,r,n,e)};case"TEXT":return function(t,n,o){return function(t,r,e,n,o){var i,a,u,s,c,h,f,l,p=0,d=e||[0],v=(n=n||0)>>>3;if("UTF8"===r)for(f=-1===o?3:0,u=0;t.length>u;u+=1)for(a=[],128>(i=t.charCodeAt(u))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||i>=57344?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(i=65536+((1023&i)<<10|1023&t.charCodeAt(u+=1)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),s=0;a.length>s;s+=1){for(c=(h=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=a[s]<<8*(f+o*(h%4)),p+=1}else for(f=-1===o?2:0,l="UTF16LE"===r&&1!==o||"UTF16LE"!==r&&1===o,u=0;t.length>u;u+=1){for(i=t.charCodeAt(u),!0===l&&(i=(s=255&i)<<8|i>>>8),c=(h=p+v)>>>2;c>=d.length;)d.push(0);d[c]|=i<<8*(f+o*(h%4)),p+=2}return{value:d,binLen:8*p+n}}(t,r,n,o,e)};case"B64":return function(t,r,n){return function(t,r,e,n){var o,i,a,u,s,c,h=0,f=r||[0],l=(e=e||0)>>>3,p=-1===n?3:0,d=t.indexOf("=");if(-1===t.search(/^[a-zA-Z0-9=+/]+$/))throw Error("Invalid character in base-64 string");if(t=t.replace(/=/g,""),-1!==d&&t.length>d)throw Error("Invalid '=' found in base-64 string");for(o=0;t.length>o;o+=4){for(u=t.substr(o,4),a=0,i=0;u.length>i;i+=1)a|=B.indexOf(u.charAt(i))<<18-6*i;for(i=0;u.length-1>i;i+=1){for(s=(c=h+l)>>>2;s>=f.length;)f.push(0);f[s]|=(a>>>16-8*i&255)<<8*(p+n*(c%4)),h+=1}}return{value:f,binLen:8*h+e}}(t,r,n,e)};case"BYTES":return function(t,r,n){return function(t,r,e,n){var o,i,a,u,s=r||[0],c=(e=e||0)>>>3,h=-1===n?3:0;for(i=0;t.length>i;i+=1)o=t.charCodeAt(i),(a=(u=i+c)>>>2)>=s.length&&s.push(0),s[a]|=o<<8*(h+n*(u%4));return{value:s,binLen:8*t.length+e}}(t,r,n,e)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(I)}return function(t,r,n){return function(t,r,e,n){return H(new Uint8Array(t),r,e,n)}(t,r,n,e)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(_)}return function(t,r,n){return H(t,r,n,e)};default:throw Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function Y(t,r,e,n){switch(t){case"HEX":return function(t){return function(t,r,e,n){var o,i,a="0123456789abcdef",u="",s=r/8,c=-1===e?3:0;for(o=0;s>o;o+=1)u+=a.charAt((i=t[o>>>2]>>>8*(c+e*(o%4)))>>>4&15)+a.charAt(15&i);return n.outputUpper?u.toUpperCase():u}(t,r,e,n)};case"B64":return function(t){return function(t,r,e,n){var o,i,a,u="",s=r/8,c=-1===e?3:0;for(o=0;s>o;o+=3)for(a=(t[o>>>2]>>>8*(c+e*(o%4))&255)<<16|((s>o+1?t[o+1>>>2]:0)>>>8*(c+e*((o+1)%4))&255)<<8|(s>o+2?t[o+2>>>2]:0)>>>8*(c+e*((o+2)%4))&255,i=0;4>i;i+=1)u+=8*o+6*i>r?n.b64Pad:B.charAt(a>>>6*(3-i)&63);return u}(t,r,e,n)};case"BYTES":return function(t){return function(t,r,e){var n,o="",i=r/8,a=-1===e?3:0;for(n=0;i>n;n+=1)o+=String.fromCharCode(t[n>>>2]>>>8*(a+e*(n%4))&255);return o}(t,r,e)};case"ARRAYBUFFER":try{new ArrayBuffer(0)}catch(t){throw Error(I)}return function(t){return function(t,r,e){var n,o=r/8,i=new ArrayBuffer(o),a=new Uint8Array(i),u=-1===e?3:0;for(n=0;o>n;n+=1)a[n]=t[n>>>2]>>>8*(u+e*(n%4))&255;return i}(t,r,e)};case"UINT8ARRAY":try{new Uint8Array(0)}catch(t){throw Error(_)}return function(t){return function(t,r,e){var n,o=r/8,i=-1===e?3:0,a=new Uint8Array(o);for(n=0;o>n;n+=1)a[n]=t[n>>>2]>>>8*(i+e*(n%4))&255;return a}(t,r,e)};default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}}function M(t){var r={outputUpper:!1,b64Pad:"=",outputLen:-1},e=t||{},n="Output length must be a multiple of 8";if(r.outputUpper=e.outputUpper||!1,e.b64Pad&&(r.b64Pad=e.b64Pad),e.outputLen){if(e.outputLen%8!=0)throw Error(n);r.outputLen=e.outputLen}else if(e.shakeLen){if(e.shakeLen%8!=0)throw Error(n);r.outputLen=e.shakeLen}if("boolean"!=typeof r.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof r.b64Pad)throw Error("Invalid b64Pad formatting option");return r}var K=function(){function t(r,e,n){u(this,t);var o=n||{};if(this.t=e,this.i=o.encoding||"UTF8",this.numRounds=o.numRounds||1,isNaN(this.numRounds)||this.numRounds!==parseInt(this.numRounds,10)||1>this.numRounds)throw Error("numRounds must a integer >= 1");this.o=r,this.h=[],this.u=0,this.l=!1,this.A=0,this.p=!1,this.U=[],this.R=[]}return a(t,[{key:"update",value:function(t){var r,e=0,n=this.T>>>5,o=this.F(t,this.h,this.u),i=o.binLen,a=o.value,u=i>>>5;for(r=0;u>r;r+=n)i>=e+this.T&&(this.m=this.g(a.slice(r,r+n),this.m),e+=this.T);return this.A+=e,this.h=a.slice(e>>>5),this.u=i%this.T,this.l=!0,this}},{key:"getHash",value:function(t,r){var e,n,o=this.B,i=M(r);if(this.v){if(-1===i.outputLen)throw Error("Output length must be specified in options");o=i.outputLen}var a=Y(t,o,this.H,i);if(this.p&&this.C)return a(this.C(i));for(n=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),o),e=1;this.numRounds>e;e+=1)this.v&&o%32!=0&&(n[n.length-1]&=16777215>>>24-o%32),n=this.Y(n,o,0,this.L(this.o),o);return a(n)}},{key:"setHMACKey",value:function(t,r,e){if(!this.M)throw Error("Variant does not support HMAC");if(this.l)throw Error("Cannot set MAC key after calling update");var n=N(r,(e||{}).encoding||"UTF8",this.H);this.N(n(t))}},{key:"N",value:function(t){var r,e=this.T>>>3,n=e/4-1;if(1!==this.numRounds)throw Error("Cannot set numRounds with MAC");if(this.p)throw Error("MAC key already set");for(t.binLen/8>e&&(t.value=this.Y(t.value,t.binLen,0,this.L(this.o),this.B));n>=t.value.length;)t.value.push(0);for(r=0;n>=r;r+=1)this.U[r]=909522486^t.value[r],this.R[r]=1549556828^t.value[r];this.m=this.g(this.U,this.m),this.A=this.T,this.p=!0}},{key:"getHMAC",value:function(t,r){var e=M(r);return Y(t,this.B,this.H,e)(this.S())}},{key:"S",value:function(){var t;if(!this.p)throw Error("Cannot call getHMAC without first setting MAC key");var r=this.Y(this.h.slice(),this.u,this.A,this.I(this.m),this.B);return t=this.g(this.R,this.L(this.o)),t=this.Y(r,this.B,this.T,t,this.B)}}]),t}();function X(t,r){return t<<r|t>>>32-r}function G(t,r,e){return t^r^e}function q(t,r,e){return t&r^t&e^r&e}function D(t,r){var e=(65535&t)+(65535&r);return(65535&(t>>>16)+(r>>>16)+(e>>>16))<<16|65535&e}function $(t,r,e,n,o){var i=(65535&t)+(65535&r)+(65535&e)+(65535&n)+(65535&o);return(65535&(t>>>16)+(r>>>16)+(e>>>16)+(n>>>16)+(o>>>16)+(i>>>16))<<16|65535&i}function z(t){return[1732584193,4023233417,2562383102,271733878,3285377520]}function V(t,r){var e,n,o,i,a,u,s,c,h=[];for(e=r[0],n=r[1],o=r[2],i=r[3],a=r[4],s=0;80>s;s+=1)h[s]=16>s?t[s]:X(h[s-3]^h[s-8]^h[s-14]^h[s-16],1),u=20>s?$(X(e,5),(c=n)&o^~c&i,a,1518500249,h[s]):40>s?$(X(e,5),G(n,o,i),a,1859775393,h[s]):60>s?$(X(e,5),q(n,o,i),a,2400959708,h[s]):$(X(e,5),G(n,o,i),a,3395469782,h[s]),a=i,i=o,o=X(n,30),n=e,e=u;return r[0]=D(e,r[0]),r[1]=D(n,r[1]),r[2]=D(o,r[2]),r[3]=D(i,r[3]),r[4]=D(a,r[4]),r}function Z(t,r,e,n){for(var o,i=15+(r+65>>>9<<4),a=r+e;i>=t.length;)t.push(0);for(t[r>>>5]|=128<<24-r%32,t[i]=4294967295&a,t[i-1]=a/4294967296|0,o=0;t.length>o;o+=16)n=V(t.slice(o,o+16),n);return n}var J=function(t){s(e,t);var r=c(e);function e(t,n,o){var i;if(u(this,e),"SHA-1"!==t)throw Error("Chosen SHA variant is not supported");var a=o||{};return(i=r.call(this,t,n,o)).M=!0,i.C=i.S,i.H=-1,i.F=N(i.t,i.i,i.H),i.g=V,i.I=function(t){return t.slice()},i.L=z,i.Y=Z,i.m=[1732584193,4023233417,2562383102,271733878,3285377520],i.T=512,i.B=160,i.v=!1,a.hmacKey&&i.N(function(t,r,e,n){var o="hmacKey must include a value and format";if(!r)throw Error(o);if(void 0===r.value||!r.format)throw Error(o);return N(r.format,r.encoding||"UTF8",e)(r.value)}(0,a.hmacKey,i.H)),i}return a(e)}(K),Q={status:400,body:"The hash prefix was not in a valid format"};function W(t){return tt.apply(this,arguments)}function tt(){return tt=b(o().mark((function t(r){var e,n,i,a,u,s,c,h,f,l,p=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=void 0===(n=(e=p.length>1&&void 0!==p[1]?p[1]:{}).baseUrl)?"https://api.pwnedpasswords.com":n,c=void 0===(s=e.mode)?"sha1":s,h=Object.assign({},(a=e.userAgent)?{headers:{"User-Agent":a}}:{},void 0!==(u=e.addPadding)&&u?{headers:{"Add-Padding":"true"}}:{}),f="".concat(i.replace(/\/$/g,"")).concat(r,"?mode=").concat(c),t.next=6,m(f,h);case 6:if(!(l=t.sent).ok){t.next=9;break}return t.abrupt("return",l.text());case 9:if(l.status!==Q.status){t.next=14;break}return t.next=12,l.text();case 12:throw Error(t.sent);case 14:throw Error(l.statusText);case 15:case"end":return t.stop()}}),t)}))),tt.apply(this,arguments)}function rt(t){return et.apply(this,arguments)}function et(){return et=b(o().mark((function t(r){var n,i,a,u,s,c,h,f,l=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=l.length>1&&void 0!==l[1]?l[1]:{}).baseUrl,a=n.userAgent,s=void 0!==(u=n.addPadding)&&u,h=void 0===(c=n.mode)?"sha1":c,t.next=4,W("/range/".concat(encodeURIComponent(r)),{baseUrl:i,userAgent:a,addPadding:s,mode:h});case 4:return f=t.sent.split("\n").filter(Boolean),t.abrupt("return",f.reduce((function(t,r){var n=e(r.split(":"),2);return t[n[0]]=Number.parseInt(n[1],10),t}),{}));case 7:case"end":return t.stop()}}),t)}))),et.apply(this,arguments)}function nt(){return nt=b(o().mark((function t(r){var e,n,i,a,u,s=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=s.length>1&&void 0!==s[1]?s[1]:{},(n=new J("SHA-1","TEXT")).update(r),i=n.getHash("HEX",{outputUpper:!0}),a=i.slice(0,5),u=i.slice(5),t.next=8,rt(a,e);case 8:return t.abrupt("return",t.sent[u]||0);case 10:case"end":return t.stop()}}),t)}))),nt.apply(this,arguments)}function ot(){return ot=b(o().mark((function t(r){var n,i,a,u,s,c,h,f,l=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(n=l.length>1&&void 0!==l[1]?l[1]:{}).apiKey,a=n.domain,s=void 0===(u=n.truncate)||u,c=n.baseUrl,h=n.userAgent,t.next=4,Promise.all([F(r,{apiKey:i,domain:a,truncate:s,baseUrl:c,userAgent:h}),/^.+@.+$/.test(r)?C(r,{apiKey:i,baseUrl:c,userAgent:h}):null]);case 4:return f=e(t.sent,2),t.abrupt("return",{breaches:f[0],pastes:f[1]});case 9:case"end":return t.stop()}}),t)}))),ot.apply(this,arguments)}function it(){return it=b(o().mark((function t(){var r=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"/subscription/status",t.abrupt("return",S("/subscription/status",r.length>0&&void 0!==r[0]?r[0]:{}));case 3:case"end":return t.stop()}}),t)}))),it.apply(this,arguments)}var at=globalThis.ReadableStream,ut=(globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis,globalThis.FormData),st=globalThis.Blob,ct=globalThis.File,ht=globalThis.Headers,ft=globalThis.Request,lt=globalThis.Response,pt=globalThis.fetch.bind(globalThis),dt=Object.freeze({__proto__:null,Blob:st,File:ct,FormData:ut,Headers:ht,ReadableStream:at,Request:ft,Response:lt,default:pt})}));
2
2
  //# sourceMappingURL=hibp.umd.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const name = "hibp";
4
- const version = "14.0.2";
4
+ const version = "14.0.3";
5
5
  exports.name = name;
6
6
  exports.version = version;
7
7
  //# sourceMappingURL=package.json.cjs.map
@@ -1,4 +1,4 @@
1
1
  const name = "hibp";
2
- const version = "14.0.2";
2
+ const version = "14.0.3";
3
3
  export { name, version };
4
4
  //# sourceMappingURL=package.json.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hibp",
3
- "version": "14.0.2",
3
+ "version": "14.0.3",
4
4
  "description": "An unofficial TypeScript SDK for the 'Have I been pwned?' service.",
5
5
  "keywords": [
6
6
  "haveibeenpwned",
@@ -45,7 +45,7 @@
45
45
  "build": "run-s --silent build:lib build:types build:docs",
46
46
  "build:lib": "rollup --config",
47
47
  "build:docs": "jsdoc2md --no-cache --files src/*.ts --configure jsdoc2md.json > API.md && node scripts/fix-api-docs.js",
48
- "build:types": "dts-bundle-generator --project tsconfig.dts.json --silent --umd-module-name hibp --out-file dist/cjs/hibp.d.ts src/hibp.ts && prettier --log-level silent --write dist/cjs/hibp.d.ts && cpy dist/cjs/hibp.d.ts dist/esm --flat --rename=hibp.d.mts",
48
+ "build:types": "dts-bundle-generator --project tsconfig.dts.json --silent --umd-module-name hibp --out-file dist/cjs/hibp.d.cts src/hibp.ts && prettier --log-level silent --write dist/cjs/hibp.d.cts && cpy dist/cjs/hibp.d.cts dist/esm --flat --rename=hibp.d.ts",
49
49
  "changeset": "changeset",
50
50
  "changeset:version": "changeset version && npm install --package-lock-only",
51
51
  "changeset:publish": "changeset publish",
File without changes
File without changes