doipjs/dist/doip.core.min.js

7 lines
222 KiB
JavaScript
Raw Normal View History

2024-10-14 19:15:36 -06:00
var doip=function(e,t,r){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=i(doipFetchers);const n={ADAPTIVE:"adaptive",ALWAYS:"always",NEVER:"never"},A={ACTIVITYPUB:"activitypub",ASPE:"aspe",DNS:"dns",GRAPHQL:"graphql",HTTP:"http",IRC:"irc",MATRIX:"matrix",OPENPGP:"openpgp",TELEGRAM:"telegram",XMPP:"xmpp"},s={PLAIN:"plain",HTML:"html",XML:"xml"},a={NONE:"none",NOCORS:"nocors",GRANTED:"granted",SERVER:"server"},c={JSON:"json",TEXT:"text"},h={URI:"uri",FINGERPRINT:"fingerprint"},u={CONTAINS:"contains",EQUALS:"equals",ONEOF:"oneof"},l={INIT:100,MATCHED:101,VERIFIED:200,VERIFIED_VIA_PROXY:201,MATCHING_ERROR:300,NO_MATCHES:301,VERIFICATION_ERROR:400,NO_PROOF_FOUND:401},g={ASP:"asp",OPENPGP:"openpgp"},p={EDDSA:"eddsa",ES256:"es256",OPENPGP:"openpgp",UNKNOWN:"unknown",NONE:"none"},f={PEM:"pem",JWK:"jwk",ARMORED_PGP:"armored_pgp",NONE:"none"},I={ASPE:"aspe",HKP:"hkp",WKD:"wkd",HTTP:"http",NONE:"none"},d={HKP:"hkp",WKD:"wkd"};var B=Object.freeze({__proto__:null,ClaimFormat:h,ClaimRelation:u,ClaimStatus:l,EntityEncodingFormat:s,Fetcher:A,OpenPgpQueryProtocol:d,ProfileType:g,ProofAccessRestriction:a,ProofFormat:c,ProxyPolicy:n,PublicKeyEncoding:f,PublicKeyFetchMethod:I,PublicKeyType:p}),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Q(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),r}var E={},y={exports:{}};!function(e,t){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="string"==typeof e||e instanceof String;if(!t){var i=r(e);throw null===e?i="null":"object"===i&&(i=e.constructor.name),new TypeError("Expected a string but received a ".concat(i))}},e.exports=t.default,e.exports.default=t.default}(y,y.exports);var m=y.exports,b={};Object.defineProperty(b,"__esModule",{value:!0}),b.commaDecimal=b.dotDecimal=b.bengaliLocales=b.farsiLocales=b.arabicLocales=b.englishLocales=b.decimal=b.alphanumeric=b.alpha=void 0;var S={"en-US":/^[A-Z]+$/i,"az-AZ":/^[A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[А-Я]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"el-GR":/^[Α-ώ]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fa-IR":/^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,"fi-FI":/^[A-ZÅÄÖ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"ja-JP":/^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"kk-KZ":/^[А-ЯЁ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i,"sl-SI":/^[A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"th-TH":/^[ก-\s]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[АЬЮЯЄIЇҐі]+$/i,"vi-VN":/^[A-ZÀÁÃÂĂĐÈÉÊ
2023-07-08 00:36:57 -06:00
/*!
2023-07-09 04:05:21 -06:00
* hash-wasm (https://www.npmjs.com/package/hash-wasm)
* (c) Dani Biro
* @license MIT
2024-10-14 19:15:36 -06:00
*/function nt(e,t,r,i){return new(r||(r=Promise))((function(o,n){function A(e){try{a(i.next(e))}catch(e){n(e)}}function s(e){try{a(i.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(A,s)}a((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class At{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then((()=>new Promise(e))),new Promise((t=>{e=t}))}dispatch(e){return nt(this,void 0,void 0,(function*(){const t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}}))}}const st="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:ue,at=null!==(it=st.Buffer)&&void 0!==it?it:null,ct=st.TextEncoder?new st.TextEncoder:null;function ht(e,t){return(15&e)+(e>>6|e>>3&8)<<4|(15&t)+(t>>6|t>>3&8)}function ut(e,t){const r=t.length>>1;for(let i=0;i<r;i++){const r=i<<1;e[i]=ht(t.charCodeAt(r),t.charCodeAt(r+1))}}const lt="a".charCodeAt(0)-10,gt="0".charCodeAt(0);function pt(e,t,r){let i=0;for(let o=0;o<r;o++){let r=t[o]>>>4;e[i++]=r>9?r+lt:r+gt,r=15&t[o],e[i++]=r>9?r+lt:r+gt}return String.fromCharCode.apply(null,e)}const ft=null!==at?e=>{if("string"==typeof e){const t=at.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(at.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if("string"==typeof e)return ct.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dt=new Uint8Array(256);for(let e=0;e<It.length;e++)dt[It.charCodeAt(e)]=e;function Bt(e,t=!0){const r=e.length,i=r%3,o=[],n=r-i;for(let t=0;t<n;t+=3){const r=(e[t]<<16&16711680)+(e[t+1]<<8&65280)+(255&e[t+2]),i=It.charAt(r>>18&63)+It.charAt(r>>12&63)+It.charAt(r>>6&63)+It.charAt(63&r);o.push(i)}if(1===i){const i=e[r-1],n=It.charAt(i>>2),A=It.charAt(i<<4&63);o.push(`${n}${A}`),t&&o.push("==")}else if(2===i){const i=(e[r-2]<<8)+e[r-1],n=It.charAt(i>>10),A=It.charAt(i>>4&63),s=It.charAt(i<<2&63);o.push(`${n}${A}${s}`),t&&o.push("=")}return o.join("")}function wt(e){let t=Math.floor(.75*e.length);const r=e.length;return"="===e[r-1]&&(t-=1,"="===e[r-2]&&(t-=1)),t}function Ct(e){const t=wt(e),r=e.length,i=new Uint8Array(t);let o=0;for(let t=0;t<r;t+=4){const r=dt[e.charCodeAt(t)],n=dt[e.charCodeAt(t+1)],A=dt[e.charCodeAt(t+2)],s=dt[e.charCodeAt(t+3)];i[o]=r<<2|n>>4,o+=1,i[o]=(15&n)<<4|A>>2,o+=1,i[o]=(3&A)<<6|63&s,o+=1}return i}const Qt=16384,Et=4,yt=new At,mt=new Map;function bt(e,t){return nt(this,void 0,void 0,(function*(){let r=null,i=null,o=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const n=()=>new DataView(r.exports.memory.buffer).getUint32(r.exports.STATE_SIZE,!0),A=yt.dispatch((()=>nt(this,void 0,void 0,(function*(){if(!mt.has(e.name)){const t=Ct(e.data),r=WebAssembly.compile(t);mt.set(e.name,r)}const t=yield mt.get(e.name);r=yield WebAssembly.instantiate(t,{})})))),s=(e=null)=>{o=!0,r.exports.Hash_Init(e)},a=e=>{if(!o)throw new Error("update() called before init()");(e=>{let t=0;for(;t<e.length;){const o=e.subarray(t,t+Qt);t+=o.length,i.set(o),r.exports.Hash_Update(o.length)}})(ft(e))},c=new Uint8Array(2*t),h=(e,n=null)=>{if(!o)throw new Error("digest() called before init()");return o=!1,r.exports.Hash_Final(n),"binary"===e?i.slice(0,t):pt(c,i,t)},u=e=>"string"==typeof e?e.length<Qt/4:e.byteLength<Qt;let l=u;switch(e.name){case"argon2":case"scrypt":l=()=>!0;break;case"blake2b":case"blake2s":l=(e,t)=>t<=512&&u(e);break;case"blake3":l=(e,t)=>0===t&&u(e);break;case"xxhash64":case"xxhash3":case"xxhash128":l=()=>!1}return yield(()=>nt(this,void 0,void 0,(function*(){r||(yield A);const e=r.exports.Hash_GetBuffer(),t=r.exports.memory.buffer;i=new Uint8Array(t,e,Qt)})))(),{getMemory:()=>i,writeMemory:(e,t=