UNPKG

@stacks/auth

Version:

Authentication for Stacks apps.

2 lines 198 kB
/*! For license information please see index.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StacksAuth=e():t.StacksAuth=e()}(this,()=>(()=>{var t,e,n={118:(t,e)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t){if(t){if("string"==typeof t)return n(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}function i(t,e){return void 0===e&&(e="{$origin}\n{$ttl}\n\n; SOA Record\n{name} {ttl} IN SOA {mname}{rname}(\n{serial} ;serial\n{refresh} ;refresh\n{retry} ;retry\n{expire} ;expire\n{minimum} ;minimum ttl\n)\n\n; NS Records\n{ns}\n\n; MX Records\n{mx}\n\n; A Records\n{a}\n\n; AAAA Records\n{aaaa}\n\n; CNAME Records\n{cname}\n\n; PTR Records\n{ptr}\n\n; TXT Records\n{txt}\n\n; SRV Records\n{srv}\n\n; SPF Records\n{spf}\n\n; URI Records\n{uri}\n"),e=function(t,e){var n="";return void 0!==t&&(n+="$ORIGIN "+t),e.replace("{$origin}",n)}(t.$origin,e),e=function(t,e){var n="";return void 0!==t&&(n+="$TTL "+t),e.replace("{$ttl}",n)}(t.$ttl,e),e=function(t,e){var n=e;if(void 0!==t)for(var r in t.name=t.name||"@",t.ttl=t.ttl||"",t)n=n.replace("{"+r+"}",t[r]+"\t");return n}(t.soa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tNS\t"+s.host+"\n"}return e.replace("{ns}",n)}(t.ns,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tA\t"+s.ip+"\n"}return e.replace("{a}",n)}(t.a,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tAAAA\t"+s.ip+"\n"}return e.replace("{aaaa}",n)}(t.aaaa,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tCNAME\t"+s.alias+"\n"}return e.replace("{cname}",n)}(t.cname,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tMX\t"+s.preference+"\t"+s.host+"\n"}return e.replace("{mx}",n)}(t.mx,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tPTR\t"+s.host+"\n"}return e.replace("{ptr}",n)}(t.ptr,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tTXT\t";var a=s.txt;"string"==typeof a?n+='"'+a+'"':a instanceof Array&&(n+=a.map(function(t){return'"'+t+'"'}).join(" ")),n+="\n"}return e.replace("{txt}",n)}(t.txt,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSRV\t"+s.priority+"\t",n+=s.weight+"\t",n+=s.port+"\t",n+=s.target+"\n"}return e.replace("{srv}",n)}(t.srv,e),e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tSPF\t"+s.data+"\n"}return e.replace("{spf}",n)}(t.spf,e),(e=function(t,e){e=(e=e.replace("{zone}",t.$origin||!!t.soa&&t.soa.name||"")).replace("{datetime}",(new Date).toISOString());var n=Math.round(Date.now()/1e3);return e.replace("{time}",""+n)}(t,e=function(t,e){var n="";if(t)for(var i,o=r(t);!(i=o()).done;){var s=i.value;n+=(s.name||"@")+"\t",s.ttl&&(n+=s.ttl+"\t"),n+="IN\tURI\t"+s.priority+"\t",n+=s.weight+"\t",n+='"'+s.target+'"\n'}return e.replace("{uri}",n)}(t.uri,e))).replace(/\n{2,}/gim,"\n\n")}function o(t){return function(t){for(var e,n={},i=r(t.split("\n"));!(e=i()).done;){var o=e.value;if(o&&o.trim()){var m=o.toUpperCase();/\s+TXT\s+/.test(m)?(n.txt=n.txt||[],n.txt.push(h(o))):0===m.indexOf("$ORIGIN")?n.$origin=o.split(/\s+/g)[1]:0===m.indexOf("$TTL")?n.$ttl=parseInt(o.split(/\s+/g)[1],10):/\s+SOA\s+/.test(m)?n.soa=s(o):/\s+NS\s+/.test(m)?(n.ns=n.ns||[],n.ns.push(a(o))):/\s+A\s+/.test(m)?(n.a=n.a||[],n.a.push(c(o,n.a))):/\s+AAAA\s+/.test(m)?(n.aaaa=n.aaaa||[],n.aaaa.push(u(o))):/\s+CNAME\s+/.test(m)?(n.cname=n.cname||[],n.cname.push(f(o))):/\s+MX\s+/.test(m)?(n.mx=n.mx||[],n.mx.push(l(o))):/\s+PTR\s+/.test(m)?(n.ptr=n.ptr||[],n.ptr.push(p(o,n.ptr,n.$origin))):/\s+SRV\s+/.test(m)?(n.srv=n.srv||[],n.srv.push(d(o))):/\s+SPF\s+/.test(m)?(n.spf=n.spf||[],n.spf.push(y(o))):/\s+URI\s+/.test(m)&&(n.uri=n.uri||[],n.uri.push(g(o)))}}return n}(t=function(t){for(var e=[],n=/\([\s\S]*?\)/gim,r=n.exec(t);null!==r;){var i=r[0].replace(/\s+/gm," ");e.push({match:r,replacement:i}),r=n.exec(t)}for(var o=t.split(""),s=0,a=e;s<a.length;s++){var c=a[s],u=c.match;o.splice(u.index,u[0].length,c.replacement)}return o.join("").replace(/\(|\)/gim," ")}(t=function(t){return t.replace(/(^|[^\\]);.*/g,function(t,e){return e||""})}(t)))}function s(t){var e={},n=t.trim().split(/\s+/g),r=n.length;return e.name=n[0],e.minimum=parseInt(n[r-1],10),e.expire=parseInt(n[r-2],10),e.retry=parseInt(n[r-3],10),e.refresh=parseInt(n[r-4],10),e.serial=parseInt(n[r-5],10),e.rname=n[r-6],e.mname=n[r-7],isNaN(n[1])||(e.ttl=parseInt(n[1],10)),e}function a(t){var e=t.trim().split(/\s+/g),n={name:e[0],host:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function c(t,e){var n=t.trim().split(/\s+/g),r=t.trim().toUpperCase().split(/\s+/g),i={name:n[0],ip:n[n.length-1]};return 0===r.lastIndexOf("A")&&(i.name=e.length?e[e.length-1].name:"@"),isNaN(n[1])||(i.ttl=parseInt(n[1],10)),i}function u(t){var e=t.trim().split(/\s+/g),n={name:e[0],ip:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function f(t){var e=t.trim().split(/\s+/g),n={name:e[0],alias:e[e.length-1]};return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function l(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],preference:parseInt(e[n-2],10),host:e[n-1]};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function h(t){var e=t.trim().match(/[^\s"']+|"[^"]*"|'[^']*'/g);if(!e)throw new Error("Failure to tokenize TXT record");var n,r=e.length,i=e.indexOf("TXT");function o(t){return t.indexOf('"')>-1&&(t=t.split('"')[1]),t}n=r-i-1>1?[].concat(e.slice(i+1).map(o)):o(e[r-1]);var s={name:e[0],txt:n};return isNaN(e[1])||(s.ttl=parseInt(e[1],10)),s}function p(t,e,n){var r=t.trim().split(/\s+/g);0===t.trim().toUpperCase().split(/\s+/g).lastIndexOf("PTR")&&e[e.length-1]&&r.unshift(e[e.length-1].name);var i={name:r[0],fullname:r[0]+"."+n,host:r[r.length-1]};return isNaN(r[1])||(i.ttl=parseInt(r[1],10)),i}function d(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1],priority:parseInt(e[n-4],10),weight:parseInt(e[n-3],10),port:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}function y(t){for(var e=t.trim().split(/\s+/g),n={name:e[0],data:""},r=e.length;r-- >4;)n.data=e[r]+" "+n.data.trim();return isNaN(e[1])||(n.ttl=parseInt(e[1],10)),n}function g(t){var e=t.trim().split(/\s+/g),n=e.length,r={name:e[0],target:e[n-1].replace(/"/g,""),priority:parseInt(e[n-3],10),weight:parseInt(e[n-2],10)};return isNaN(e[1])||(r.ttl=parseInt(e[1],10)),r}(function(){var t=function(t){this.jsonZoneFile="object"==typeof t?JSON.parse(JSON.stringify(t)):"string"==typeof t?o(t):void 0}.prototype;t.toJSON=function(){return this.jsonZoneFile},t.toString=function(){return i(this.toJSON())}})(),e.makeZoneFile=i,e.parseZoneFile=o},476:(t,e,n)=>{"use strict";var r,i,o,s;n.d(e,{BY:()=>s,J_:()=>o,Qp:()=>i,nU:()=>r}),function(t){t[t.Mainnet=1]="Mainnet",t[t.Testnet=2147483648]="Testnet"}(r||(r={})),function(t){t[t.Mainnet=385875968]="Mainnet",t[t.Testnet=4278190080]="Testnet"}(i||(i={})),r.Mainnet,function(t){t[t.Mainnet=0]="Mainnet",t[t.Testnet=128]="Testnet"}(o||(o={})),function(t){t[t.MainnetSingleSig=22]="MainnetSingleSig",t[t.MainnetMultiSig=20]="MainnetMultiSig",t[t.TestnetSingleSig=26]="TestnetSingleSig",t[t.TestnetMultiSig=21]="TestnetMultiSig"}(s||(s={})),o.Mainnet},669:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.c32decode=e.c32normalize=e.c32encode=e.c32=void 0;const r=n(9074);e.c32="0123456789ABCDEFGHJKMNPQRSTVWXYZ";const i="0123456789abcdef";function o(t){return t.toUpperCase().replace(/O/g,"0").replace(/L|I/g,"1")}e.c32encode=function(t,n){if(!t.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");t.length%2!=0&&(t=`0${t}`);let o=[],s=0;for(let n=(t=t.toLowerCase()).length-1;n>=0;n--)if(s<4){const r=i.indexOf(t[n])>>s;let a=0;0!==n&&(a=i.indexOf(t[n-1]));const c=1+s,u=a%(1<<c)<<5-c,f=e.c32[r+u];s=c,o.unshift(f)}else s=0;let a=0;for(let t=0;t<o.length&&"0"===o[t];t++)a++;o=o.slice(a);const c=(new TextDecoder).decode((0,r.hexToBytes)(t)).match(/^\u0000*/),u=c?c[0].length:0;for(let t=0;t<u;t++)o.unshift(e.c32[0]);if(n){const t=n-o.length;for(let n=0;n<t;n++)o.unshift(e.c32[0])}return o.join("")},e.c32normalize=o,e.c32decode=function(t,n){if(!(t=o(t)).match(`^[${e.c32}]*$`))throw new Error("Not a c32-encoded string");const r=t.match(`^${e.c32[0]}*`),s=r?r[0].length:0;let a=[],c=0,u=0;for(let n=t.length-1;n>=0;n--){4===u&&(a.unshift(i[c]),u=0,c=0);const r=(e.c32.indexOf(t[n])<<u)+c,o=i[r%16];if(u+=1,c=r>>4,c>1<<u)throw new Error("Panic error in decoding.");a.unshift(o)}a.unshift(i[c]),a.length%2==1&&a.unshift("0");let f=0;for(let t=0;t<a.length&&"0"===a[t];t++)f++;a=a.slice(f-f%2);let l=a.join("");for(let t=0;t<s;t++)l=`00${l}`;if(n){const t=2*n-l.length;for(let e=0;e<t;e+=2)l=`00${l}`}return l}},691:(t,e,n)=>{"use strict";n.d(e,{Sv:()=>a,_y:()=>i,kB:()=>o,of:()=>s});var r=n(5257);function i(t){return`did:btc-addr:${t}`}function o(t){return`did:ecdsa-pub:${t}`}function s(t){const e=t.split(":");if(3!==e.length)throw new r.N0("Decentralized IDs must have 3 parts");if("did"!==e[0].toLowerCase())throw new r.N0('Decentralized IDs must start with "did"');return e[1].toLowerCase()}function a(t){if(t)return"btc-addr"===s(t)?t.split(":")[2]:void 0}},769:(t,e,n)=>{"use strict";n.d(e,{Kt:()=>y,cP:()=>f,iu:()=>d,qV:()=>l,zu:()=>h});var r=n(2161),i=n(1239),o=n(5971),s=n(6818),a=n(832),c=n(691);const u="1.4.0";function f(){return(0,o.xg)()}const l=h;function h(t,e,n,i=a.zd.slice(),f,l=(0,r.wc)().getTime(),h={}){const p=t=>{const e=(0,r.VZ)("location",{throwIfUnavailable:!0,usageDesc:`makeAuthRequest([${t}=undefined])`});return null==e?void 0:e.origin};e||(e=`${p("redirectURI")}/`),n||(n=`${p("manifestURI")}/manifest.json`),f||(f=p("appDomain"));const d=Object.assign({},h,{jti:(0,r.Gy)(),iat:Math.floor((new Date).getTime()/1e3),exp:Math.floor(l/1e3),iss:null,public_keys:[],domain_name:f,manifest_uri:n,redirect_uri:e,version:u,do_not_include_profile:!0,supports_hub_url:!0,scopes:i}),y=s.SECP256K1Client.derivePublicKey(t);d.public_keys=[y];const g=(0,o.Fp)(y);return d.iss=(0,c._y)(g),new s.TokenSigner("ES256k",t).sign(d)}async function p(t,e){const n=await(0,i.Nq)(t,(0,r.AI)(e),!0),o=JSON.stringify(n);return(0,r.My)((0,r.AI)(o))}async function d(t,e){const n=(0,r.AE)((0,r.aT)(e)),o=JSON.parse(n),s=await(0,i.hm)(t,o);if("string"!=typeof s)throw new Error("Unable to correctly decrypt private key");return s}async function y(t,e={},n,i=null,a=null,f=(0,r.wc)().getTime(),l=null,h=null,d=null,y=null,g=null){const m=s.SECP256K1Client.derivePublicKey(t),b=(0,o.Fp)(m);let w=a,v=i,x={};null!=a&&(null!=l&&(w=await p(l,a),null!=i&&(v=await p(l,i))),x={email:(null==n?void 0:n.email)?n.email:null,profile_url:(null==n?void 0:n.profileUrl)?n.profileUrl:null,hubUrl:h,blockstackAPIUrl:d,associationToken:y,version:u});const E=Object.assign({},{jti:(0,r.Gy)(),iat:Math.floor((new Date).getTime()/1e3),exp:Math.floor(f/1e3),iss:(0,c._y)(b),private_key:w,public_keys:[m],appPrivateKeyFromWalletSalt:g,profile:e,core_token:v},x);return new s.TokenSigner("ES256k",t).sign(E)}},790:(t,e,n)=>{!function(){var e={};if(e.async=n(7668),"object"!=typeof e.async)throw new Error("Module async is required (https://github.com/caolan/async)");var r=e.async;function i(t,e){if(!e||"object"!=typeof e)return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function o(){var t={},e=Array.prototype.slice.call(arguments),n=null,r=null;return e.forEach(function(e){if(e&&e.constructor===Object)for(n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]]}),t}function s(){this.custom={},this.extend=function(t){return i(this.custom,t)},this.reset=function(){this.custom={}},this.remove=function(t){c.array(t)||(t=[t]),t.forEach(function(t){delete this.custom[t]},this)}}function a(t,e){var n=["@"];if(this._schema=t,this._custom={},null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._custom["$"+r]=e[r]);this._getDepth=function(){return n.length},this._dumpStack=function(){return n.map(function(t){return t.replace(/^\[/g,"")}).join(".").replace(/\.\u001b\u001c\u001d\u001e/g,"[")},this._deeperObject=function(t){return n.push(/^[a-z$_][a-z0-9$_]*$/i.test(t)?t:'["'+t+'"]'),this},this._deeperArray=function(t){return n.push("["+t+"]"),this},this._back=function(){return n.pop(),this}}var c={function:function(t){return"function"==typeof t},string:function(t){return"string"==typeof t},number:function(t){return"number"==typeof t&&!isNaN(t)},integer:function(t){return"number"==typeof t&&t%1==0},NaN:function(t){return"number"==typeof t&&isNaN(t)},boolean:function(t){return"boolean"==typeof t},null:function(t){return null===t},date:function(t){return null!=t&&t instanceof Date},object:function(t){return"object"==typeof t&&null!=t&&t.constructor!==Array},array:function(t){return null!=t&&t.constructor===Array},any:function(){return!0}};function u(t,e){return"function"==typeof t?e instanceof t:c[t=t in c?t:"any"](e)}function f(t,e){for(var n=[],r=t.indexOf(e);-1!==r;)n.push(r),r=t.indexOf(e,r+1);return n}var l={void:/^$/,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)?(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"date-time":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?(Z?|(-|\+)\d{2}:\d{2})$/,date:/^\d{4}-\d{2}-\d{2}$/,coolDateTime:/^\d{4}(-|\/)\d{2}(-|\/)\d{2}(T| )\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,time:/^\d{2}\:\d{2}\:\d{2}$/,color:/^#([0-9a-f])+$/i,email:new RegExp("(?:[^\\W_](?:[\\w\\.\\+]+)@(?:localhost|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|موريتانيا|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|السعودية|yokohama|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|католик|الجزائر|العليان|اتصالات|پاکستان|البحرين|كاثوليك|இந்தியா|yamaxun|youtube|zuerich|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|москва|онлайн|ファッション|भारतम्|ارامكو|امارات|الاردن|المغرب|ابوظبي|مليسيا|இலங்கை|فلسطين|yachts|yandex|zappos|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|ישראל|বাংলা|భారత్|भारोत|संगठन|ایران|بازار|بھارت|سودان|همراه|سورية|ഭാരതം|嘉里大酒店|yahoo|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|ಭಾರತ|ଭାରତ|大众汽车|ভাৰত|ভারত|موقع|香格里拉|сайт|アマゾン|дети|ポイント|ලංකා|電訊盈科|クラウド|ભારત|भारत|عمان|بارت|ڀارت|عراق|شبكة|بيتك|组织机构|تونس|グーグル|ਭਾਰਤ|yoga|zara|zero|zone|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|कॉम|セール|คอม|我爱你|қаз|срб|бел|קום|淡马锡|орг|नेट|ストア|мкд|كوم|中文网|ком|укр|亚马逊|诺基亚|飞利浦|мон|عرب|ไทย|рус|ລາວ|みんな|天主教|مصر|قطر|հայ|新加坡|xxx|xyz|you|yun|zip|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|佛山|慈善|集团|在线|한국|点看|八卦|公益|公司|网站|移动|联通|бг|时尚|微博|삼성|商标|商店|商城|ею|新闻|家電|中信|中国|中國|娱乐|谷歌|购物|通販|网店|餐厅|网络|香港|食品|台湾|台灣|手机|澳門|닷컴|政府|გე|机构|健康|招聘|рф|大拿|ευ|ελ|世界|書籍|网址|닷넷|コム|游戏|企业|信息|嘉里|广东|政务|ye|yt|za|zm|zw))))"),numeric:/^[0-9]+$/,integer:/^\-?[0-9]+$/,decimal:/^\-?[0-9]*\.?[0-9]+$/,alpha:/^[a-z]+$/i,alphaNumeric:/^[a-z0-9]+$/i,alphaDash:/^[a-z0-9_-]+$/i,javascript:/^[a-z_\$][a-z0-9_\$]*$/i,upperString:/^[A-Z ]*$/,lowerString:/^[a-z ]*$/,v4uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i},h={optional:function(t,e){!0!==("boolean"==typeof t.optional?t.optional:"true"===t.optional)&&void 0===e&&this.report("is missing and not optional",null,"optional")},type:function(t,e){if(void 0!==e&&("string"==typeof t.type||t.type instanceof Array||"function"==typeof t.type)){var n=c.array(t.type)?t.type:[t.type];n.some(function(t){return u(t,e)})||(n=n.map(function(t){return"function"==typeof t?"an instance of "+t.name:t}),this.report("must be "+n.join(" or ")+", but is "+function(t){for(var e in c)if(u(e,t))return"any"===e||"object"===e&&t.constructor!==Object?"an instance of "+t.constructor.name:e}(e),null,"type"))}},uniqueness:function(t,e){if("string"==typeof t.uniqueness&&(t.uniqueness="true"===t.uniqueness),"boolean"==typeof t.uniqueness&&!1!==t.uniqueness&&(c.array(e)||"string"==typeof e))for(var n=[],r=0;r<e.length;r++)if(!(n.indexOf(e[r])>=0)){var i=f(e,e[r]);i.length>1&&(n.push(e[r]),this.report("has value ["+e[r]+"] more than once at indexes ["+i.join(", ")+"]",null,"uniqueness"))}},pattern:function(t,e){var n=t.pattern;if("string"==typeof e){var r=!1;c.array(n)||(n=[n]),n.forEach(function(t){"string"==typeof t&&t in l&&(t=l[t]),t instanceof RegExp&&t.test(e)&&(r=!0)}),r||this.report("must match ["+n.join(" or ")+'], but is equal to "'+e+'"',null,"pattern")}},validDate:function(t,e){"true"===String(t.validDate)&&e instanceof Date&&isNaN(e.getTime())&&this.report("must be a valid date",null,"validDate")},minLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.minLength);isNaN(n)||e.length<n&&this.report("must be longer than "+n+" elements, but it has "+e.length,null,"minLength")}},maxLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.maxLength);isNaN(n)||e.length>n&&this.report("must be shorter than "+n+" elements, but it has "+e.length,null,"maxLength")}},exactLength:function(t,e){if("string"==typeof e||c.array(e)){var n=Number(t.exactLength);isNaN(n)||e.length!==n&&this.report("must have exactly "+n+" elements, but it have "+e.length,null,"exactLength")}},lt:function(t,e){var n=Number(t.lt);"number"!=typeof e||isNaN(n)||e>=n&&this.report("must be less than "+n+', but is equal to "'+e+'"',null,"lt")},lte:function(t,e){var n=Number(t.lte);"number"!=typeof e||isNaN(n)||e>n&&this.report("must be less than or equal to "+n+', but is equal to "'+e+'"',null,"lte")},gt:function(t,e){var n=Number(t.gt);"number"!=typeof e||isNaN(n)||e<=n&&this.report("must be greater than "+n+', but is equal to "'+e+'"',null,"gt")},gte:function(t,e){var n=Number(t.gte);"number"!=typeof e||isNaN(n)||e<n&&this.report("must be greater than or equal to "+n+', but is equal to "'+e+'"',null,"gte")},eq:function(t,e){if("number"==typeof e||"string"==typeof e||"boolean"==typeof e){var n=t.eq;if("number"==typeof n||"string"==typeof n||"boolean"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return;this.report("must be equal to ["+n.map(function(t){return'"'+t+'"'}).join(" or ")+'], but is equal to "'+e+'"',null,"eq")}else e!==n&&this.report('must be equal to "'+n+'", but is equal to "'+e+'"',null,"eq")}},ne:function(t,e){if("number"==typeof e||"string"==typeof e){var n=t.ne;if("number"==typeof n||"string"==typeof n||c.array(n))if(c.array(n)){for(var r=0;r<n.length;r++)if(e===n[r])return void this.report('must not be equal to "'+n[r]+'"',null,"ne")}else e===n&&this.report('must not be equal to "'+n+'"',null,"ne")}},someKeys:function(t,e){var n=t.someKeys;c.object(e)&&(n.some(function(t){return t in e})||this.report("must have at least key "+n.map(function(t){return'"'+t+'"'}).join(" or "),null,"someKeys"))},strict:function(t,e){if("string"==typeof t.strict&&(t.strict="true"===t.strict),!0===t.strict&&c.object(e)&&c.object(t.properties)&&void 0===t.properties["*"]){var n=Object.keys(e).filter(function(e){return void 0===t.properties[e]});if(n.length>0){var r="should not contains "+(n.length>1?"properties":"property")+" ["+n.map(function(t){return'"'+t+'"'}).join(", ")+"]";this.report(r,null,"strict")}}},exec:function(t,e,n){var r=this;if("function"==typeof n)return this.asyncExec(t,e,n);(c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&n.call(r,t,e)})},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(t.properties instanceof Object&&e instanceof Object){var r,i=t.properties;if(null!=i["*"])for(r in e)r in i||(this._deeperObject(r),this._validate(i["*"],e[r]),this._back());for(r in i)"*"!==r&&(this._deeperObject(r),this._validate(i[r],e[r]),this._back())}},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(t.items instanceof Object&&e instanceof Object){var r,i,o=t.items;if(c.array(o)&&c.array(e))for(r=0,i=o.length;r<i;r++)this._deeperArray(r),this._validate(o[r],e[r]),this._back();else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(this._deeperArray(s),this._validate(o,e[s]),this._back())}}},p={asyncExec:function(t,e,n){var i=this;r.eachSeries(c.array(t.exec)?t.exec:[t.exec],function(n,o){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,o);n.call(i,t,e)}r.nextTick(o)},n)},asyncProperties:function(t,e,n){if(!(t.properties instanceof Object&&c.object(e)))return n();var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();r.eachSeries(Object.keys(e),function(t,n){if(t in o)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o["*"],e[t],function(t){i._back(),n(t)})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return r.nextTick(n);i._deeperObject(t),i._asyncValidate(o[t],e[t],function(t){i._back(),n(t)})},t)}],n)},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n();var i=this,o=t.items;c.array(o)&&c.array(e)?r.timesSeries(o.length,function(t,n){i._deeperArray(t),i._asyncValidate(o[t],e[t],function(t,e){i._back(),n(t,e)}),i._back()},n):r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncValidate(o,e[t],function(t,e){i._back(),n(t,e)})},n)}};function d(t,e){a.prototype.constructor.call(this,t,o(d.custom,e));var n=[];this._basicFields=Object.keys(h),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t,e,r){var i={code:e||this.userCode||null,reason:r||"unknown",message:this.userError||t||"is invalid",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};return n.push(i),this},this.result=function(){return{error:n,valid:0===n.length,format:function(){return!0===this.valid?"Candidate is valid":this.error.map(function(t){return"Property "+t.property+": "+t.message}).join("\n")}}}}i(d.prototype,h),i(d.prototype,p),i(d,new s),d.prototype.validate=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return r.nextTick(function(){n._asyncValidate(n._schema,t,function(t){n.origin=null,e(t,n.result())})})}return this._validate(this._schema,t).result()},d.prototype._validate=function(t,e,n){return this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||this[n](t,e)},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&this._custom[n].call(this,t,e)},this),this},d.prototype._asyncValidate=function(t,e,n){var i=this;this.userCode=t.code||null,this.userError=t.error||null,this.userAlias=t.alias||null,r.series([function(n){r.eachSeries(Object.keys(h),function(n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);i[n](t,e)}o()})},n)},function(n){r.eachSeries(Object.keys(i._custom),function(n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);i._custom[n].call(i,t,e)}o()})},n)}],n)};var y={number:function(t,e){var n;if("number"==typeof t)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseFloat(t.replace(/,/g,".").replace(/ /g,""))))return n}else if(t instanceof Date)return+t;return null},integer:function(t,e){var n;if("number"==typeof t&&t%1==0)return t;if(""===t)return void 0!==e.def?e.def:null;if("string"==typeof t){if("number"==typeof(n=parseInt(t.replace(/ /g,""),10)))return n}else{if("number"==typeof t)return parseInt(t,10);if("boolean"==typeof t)return t?1:0;if(t instanceof Date)return+t}return null},string:function(t,e){return"boolean"==typeof t||"number"==typeof t||t instanceof Date?t.toString():c.array(t)?e.items||e.properties?t:t.join(String(e.joinWith||",")):t instanceof Object?e.items||e.properties?t:JSON.stringify(t):"string"==typeof t&&t.length?t:null},date:function(t,e){if(t instanceof Date)return t;var n=new Date(t);return isNaN(n.getTime())?null:n},boolean:function(t,e){return void 0===t?null:("string"!=typeof t||"false"!==t.toLowerCase())&&!!t},object:function(t,e){if("string"!=typeof t||c.object(t))return t;try{return JSON.parse(t)}catch(t){return null}},array:function(t,e){if(c.array(t))return t;if(void 0===t)return null;if("string"==typeof t){if("["===t.substring(0,1)&&"]"===t.slice(-1))try{return JSON.parse(t)}catch(t){return null}return t.split(String(e.splitWith||","))}return c.array(t)?null:[t]}},g={upper:function(t){return t.toUpperCase()},lower:function(t){return t.toLowerCase()},title:function(t){return t.replace(/\S*/g,function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()})},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.substr(1)},trim:function(t){return t.trim()}},m={strict:function(t,e){return"string"==typeof t.strict&&(t.strict="true"===t.strict),!0!==t.strict?e:c.object(t.properties)&&c.object(e)?(Object.keys(e).forEach(function(n){n in t.properties||delete e[n]}),e):e},optional:function(t,e){return!0===("boolean"==typeof t.optional?t.optional:"false"!==t.optional)||void 0!==e?e:(this.report(),t.def===Date?new Date:t.def)},type:function(t,e){if("string"!=typeof t.type||"function"!=typeof y[t.type])return e;var n,r="boolean"!=typeof t.optional||t.optional;return"function"==typeof y[t.type]?(null===(n=y[t.type](e,t))&&!r||!n&&isNaN(n)||null===n&&"string"===t.type)&&(n=t.def):r||(n=t.def),(null!=n||void 0!==t.def&&t.def===n)&&n!==e?(this.report(),n):e},rules:function(t,e){var n=t.rules;if("string"!=typeof e||"string"!=typeof n&&!c.array(n))return e;var r=!1;return(c.array(n)?n:[n]).forEach(function(t){"function"==typeof g[t]&&(e=g[t](e),r=!0)}),r&&this.report(),e},min:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.min);return isNaN(r)?e:n<r?(this.report(),r):e},max:function(t,e){var n=Number(e);if(isNaN(n))return e;var r=Number(t.max);return isNaN(r)?e:n>r?(this.report(),r):e},minLength:function(t,e){var n=Number(t.minLength);if("string"!=typeof e||isNaN(n)||n<0)return e;var r="",i=n-e.length;if(i>0){for(var o=0;o<i;o++)r+="-";return this.report(),e+r}return e},maxLength:function(t,e){var n=Number(t.maxLength);return"string"!=typeof e||isNaN(n)||n<0?e:e.length>n?(this.report(),e.slice(0,n)):e},properties:function(t,e,n){if("function"==typeof n)return this.asyncProperties(t,e,n);if(!e||"object"!=typeof e)return e;var r,i,o=t.properties;if(void 0!==o["*"])for(i in e)i in o||(this._deeperObject(i),(void 0!==(r=this._sanitize(o["*"],e[i]))||"exec"in o["*"])&&(e[i]=r),this._back());for(i in o)"*"!==i&&(this._deeperObject(i),(void 0!==(r=this._sanitize(o[i],e[i]))||"exec"in o[i])&&(e[i]=r),this._back());return e},items:function(t,e,n){if("function"==typeof n)return this.asyncItems(t,e,n);if(!(t.items instanceof Object&&e instanceof Object))return e;var r;if(c.array(t.items)&&c.array(e)){var i=t.items.length<e.length?t.items.length:e.length;for(r=0;r<i;r++)this._deeperArray(r),e[r]=this._sanitize(t.items[r],e[r]),this._back()}else for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._deeperArray(r),e[r]=this._sanitize(t.items,e[r]),this._back());return e},exec:function(t,e,n){return"function"==typeof n?this.asyncExec(t,e,n):((c.array(t.exec)?t.exec:[t.exec]).forEach(function(n){"function"==typeof n&&(e=n.call(this,t,e))},this),e)}},b={asyncExec:function(t,e,n){var i=this,o=c.array(t.exec)?t.exec:[t.exec];r.eachSeries(o,function(n,r){if("function"==typeof n){if(n.length>2)return n.call(i,t,e,function(t,n){if(t)return r(t);e=n,r()});e=n.call(i,t,e)}r()},function(t){n(t,e)})},asyncProperties:function(t,e,n){if(!e||"object"!=typeof e)return n(null,e);var i=this,o=t.properties;r.series([function(t){if(null==o["*"])return t();var n=o["*"];r.eachSeries(Object.keys(e),function(t,r){if(t in o)return r();i._deeperObject(t),i._asyncSanitize(n,e[t],function(n,o){void 0!==o&&(e[t]=o),i._back(),r()})},t)},function(t){r.eachSeries(Object.keys(o),function(t,n){if("*"===t)return n();i._deeperObject(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);void 0!==o&&(e[t]=o),i._back(),n()})},t)}],function(t){return n(t,e)})},asyncItems:function(t,e,n){if(!(t.items instanceof Object&&e instanceof Object))return n(null,e);var i=this,o=t.items;if(c.array(o)&&c.array(e)){var s=o.length<e.length?o.length:e.length;r.timesSeries(s,function(t,n){i._deeperArray(t),i._asyncSanitize(o[t],e[t],function(r,o){if(r)return n(r);e[t]=o,i._back(),n()})},function(t){n(t,e)})}else r.eachSeries(Object.keys(e),function(t,n){i._deeperArray(t),i._asyncSanitize(o,e[t],function(r,o){if(r)return n();e[t]=o,i._back(),n()})},function(t){n(t,e)});return e}};function w(t,e){a.prototype.constructor.call(this,t,o(w.custom,e));var n=[];this._basicFields=Object.keys(m),this._customFields=Object.keys(this._custom),this.origin=null,this.report=function(t){var e={message:t||"was sanitized",property:this.userAlias?this.userAlias+" ("+this._dumpStack()+")":this._dumpStack()};n.some(function(t){return t.property===e.property})||n.push(e)},this.result=function(t){return{data:t,reporting:n,format:function(){return this.reporting.map(function(t){return"Property "+t.property+" "+t.message}).join("\n")}}}}i(w.prototype,m),i(w.prototype,b),i(w,new s),w.prototype.sanitize=function(t,e){if(this.origin=t,"function"==typeof e){var n=this;return this._asyncSanitize(this._schema,t,function(t,r){n.origin=null,e(t,n.result(r))})}var r=this._sanitize(this._schema,t);return this.origin=null,this.result(r)},w.prototype._sanitize=function(t,e){return this.userAlias=t.alias||null,this._basicFields.forEach(function(n){!(n in t)&&"optional"!==n||"function"!=typeof this[n]||(e=this[n](t,e))},this),this._customFields.forEach(function(n){n in t&&"function"==typeof this._custom[n]&&(e=this._custom[n].call(this,t,e))},this),e},w.prototype._asyncSanitize=function(t,e,n){var i=this;this.userAlias=t.alias||null,r.waterfall([function(n){r.reduce(i._basicFields,e,function(e,n,o){r.nextTick(function(){if((n in t||"optional"===n)&&"function"==typeof i[n]){if(i[n].length>2)return i[n](t,e,o);e=i[n](t,e)}o(null,e)})},n)},function(e,n){r.reduce(i._customFields,e,function(e,n,o){r.nextTick(function(){if(n in t&&"function"==typeof i._custom[n]){if(i._custom[n].length>2)return i._custom[n].call(i,t,e,o);e=i._custom[n].call(i,t,e)}o(null,e)})},n)}],n)};var v=2147483647,x={int:function(t,e){return t+(0|Math.random()*(e-t+1))},float:function(t,e){return Math.random()*(e-t)+t},bool:function(){return Math.random()>.5},char:function(t,e){return String.fromCharCode(this.int(t,e))},fromList:function(t){return t[this.int(0,t.length-1)]}},E={"date-time":function(){return(new Date).toISOString()},date:function(){return(new Date).toISOString().replace(/T.*$/,"")},time:function(){return(new Date).toLocaleTimeString({},{hour12:!1})},color:function(t,e){var n="#";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("0123456789abcdefABCDEF");return n},numeric:function(){return""+x.int(0,v)},integer:function(){return!0===x.bool()?"-"+this.numeric():this.numeric()},decimal:function(){return this.integer()+"."+this.numeric()},alpha:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");return n},alphaNumeric:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");return n},alphaDash:function(t,e){var n="";t<1&&(t=1);for(var r=0,i=x.int(t,e);r<i;r++)n+=x.fromList("_-abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789_-");return n},javascript:function(t,e){for(var n=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),r=0,i=x.int(t,e-1);r<i;r++)n+=x.fromList("_$abcdefghijklmnopqrstuvwxyz_$ABCDEFGHIJKLMNOPQRSTUVWXYZ_$0123456789_$");return n}};function S(t){var e=-2147483648,n=v;return null!=t.gte?e=t.gte:null!=t.gt&&(e=t.gt+1),null!=t.lte?n=t.lte:null!=t.lt&&(n=t.lt-1),{min:e,max:n}}var A={string:function(t){if(null!=t.eq)return t.eq;var e="",n=null!=t.minLength?t.minLength:0,r=null!=t.maxLength?t.maxLength:32;if("string"==typeof t.pattern&&"function"==typeof E[t.pattern])return E[t.pattern](n,r);for(var i=null!=t.exactLength?t.exactLength:x.int(n,r),o=0;o<i;o++)e+=x.char(32,126);return e},number:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.float(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.float(e.min,e.max);return n},integer:function(t){if(null!=t.eq)return t.eq;var e=S(t),n=x.int(e.min,e.max);if(null!=t.ne)for(var r=c.array(t.ne)?t.ne:[t.ne];-1!==r.indexOf(n);)n=x.int(e.min,e.max);return n},boolean:function(t){return null!=t.eq?t.eq:x.bool()},null:function(t){return null},date:function(t){return null!=t.eq?t.eq:new Date},object:function(t){var e={},n=t.properties||{};for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){if(!0===n[r].optional&&!0===x.bool())continue;if("*"!==r)e[r]=this.generate(n[r]);else for(var i="__random_key_",o=i+0,s=x.int(1,9),a=1;a<=s;a++)o in n||(e[o]=this.generate(n[r])),o=i+a}return e},array:function(t){var e,n,r,i,o=t.items||{},s=null!=t.minLength?t.minLength:0,a=null!=t.maxLength?t.maxLength:16;if(c.array(o))for(r=o.length,null!=t.exactLength?r=t.exactLength:r<s?r=s:r>a&&(r=a),n=new Array(r),e=null,i=0;i<r;i++)e=o[i].type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),n[i]=this[e](o[i]);else for(r=null!=t.exactLength?t.exactLength:x.int(s,a),n=new Array(r),e=o.type||"any",c.array(e)&&(e=e[x.int(0,e.length-1)]),i=0;i<r;i++)n[i]=this[e](o);return n},any:function(t){var e=Object.keys(A);return this[e[x.int(0,e.length-2)]](t)}};function k(){}i(k.prototype,A);var _=null;k.instance=function(){return _ instanceof k||(_=new k),_},k.prototype.generate=function(t){var e=t.type||"any";return c.array(e)&&(e=e[x.int(0,e.length-1)]),this[e](t)};var O={};t.exports?t.exports=O:window.SchemaInspector=O,O.newSanitization=function(t,e){return new w(t,e)},O.newValidation=function(t,e){return new d(t,e)},O.Validation=d,O.Sanitization=w,O.sanitize=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new w(t,n).sanitize(e,r)},O.validate=function(t,e,n,r){return 3===arguments.length&&"function"==typeof n&&(r=n,n=null),new d(t,n).validate(e,r)},O.generate=function(t,e){if("number"==typeof e){for(var n=new Array(e),r=0;r<e;r++)n[r]=k.instance().generate(t);return n}return k.instance().generate(t)}}()},832:(t,e,n)=>{"use strict";n.d(e,{$R:()=>a,FG:()=>l,H7:()=>r,KG:()=>s,ft:()=>f,gy:()=>h,jh:()=>i,n_:()=>u,vc:()=>o,zd:()=>c});const r="blockstack",i="blockstack",o="https://browser.blockstack.org/auth",s={"@type":"Person","@context":"http://schema.org"};var a=(t=>(t.store_write="store_write",t.publish_data="publish_data",t.email="email",t))(a||{});const c=["store_write"],u="blockstack-transit-private-key",f="https://api.hiro.so",l="/v1/names",h="blockstack-session"},1193:(t,e,n)=>{"use strict";n.d(e,{D:()=>o});var r=n(6879),i=n(2756);class o extends i.Vw{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.O8)(this.buffer)}update(t){r.Ay.exists(this);const{view:e,buffer:n,blockLen:o}=this,s=(t=(0,i.ZJ)(t)).length;for(let r=0;r<s;){const a=Math.min(o-this.pos,s-r);if(a===o){const e=(0,i.O8)(t);for(;o<=s-r;r+=o)this.process(e,r);continue}n.set(t.subarray(r,r+a),this.pos),this.pos+=a,r+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){r.Ay.exists(this),r.Ay.output(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:o,isLE:s}=this;let{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let t=a;t<o;t++)e[t]=0;!function(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,u=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+u,a,r)}(n,o-8,BigInt(8*this.length),s),this.process(n,0);const c=(0,i.O8)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=u/4,l=this.get();if(f>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<f;t++)c.setUint32(4*t,l[t],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}}},1239:(t,e,n)=>{"use strict";n.d(e,{hm:()=>w,Nq:()=>b,iM:()=>v});var r=n(7713),i=n(2001),o=n(2084),s=n(2161),a=n(5257),c=n(7991);const u='Crypto lib not found. Either the WebCrypto "crypto.subtle" or Node.js "crypto" module must be available.';class f{constructor(t,e){this.createCipher=t,this.createDecipher=e}async encrypt(t,e,n,r){if("aes-128-cbc"!==t&&"aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);const i=this.createCipher(t,e,n),o=new Uint8Array((0,s.Id)(i.update(r),i.final()));return Promise.resolve(o)}async decrypt(t,e,n,r){if("aes-128-cbc"!==t&&"aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);const i=this.createDecipher(t,e,n),o=new Uint8Array((0,s.Id)(i.update(r),i.final()));return Promise.resolve(o)}}class l{constructor(t){this.subtleCrypto=t}async encrypt(t,e,n,r){let i,o;if("aes-128-cbc"===t)i="AES-CBC",o=128;else{if("aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);i="AES-CBC",o=256}const s=await this.subtleCrypto.importKey("raw",e,{name:i,length:o},!1,["encrypt"]),a=await this.subtleCrypto.encrypt({name:i,iv:n},s,r);return new Uint8Array(a)}async decrypt(t,e,n,r){let i,o;if("aes-128-cbc"===t)i="AES-CBC",o=128;else{if("aes-256-cbc"!==t)throw new Error(`Unsupported cipher algorithm "${t}"`);i="AES-CBC",o=256}const s=await this.subtleCrypto.importKey("raw",e,{name:i,length:o},!1,["decrypt"]),a=await this.subtleCrypto.decrypt({name:i,iv:n},s,r);return new Uint8Array(a)}}async function h(){const t=await async function(){if("undefined"!=typeof crypto&&void 0!==crypto.subtle)return{lib:crypto.subtle,name:"subtleCrypto"};try{return{lib:n(1441),name:"nodeCrypto"}}catch(t){throw new Error(u)}}();return"subtleCrypto"===t.name?new l(t.lib):new f(t.lib.createCipheriv,t.lib.createDecipheriv)}var p,d=n(5971),y=n(3390);function g(t,e){return(0,r.w)(i.s,t,e)}function m(t){const e=(0,y.Q9)(t);return{encryptionKey:e.slice(0,32),hmacKey:e.slice(32)}}async function b(t,e,n,r){const i=function(t){const e={result:!1,reason_data:"Invalid public key format",reason:p.InvalidFormat},n={result:!1,reason_data:"Public key is not a point",reason:p.IsNotPoint};if(66!==t.length&&130!==t.length)return e;const r=t.slice(0,2);if(130===t.length&&"04"!==r)return e;if(66===t.length&&"02"!==r&&"03"!==r)return e;if(null===t.match(/^[0-9a-f]+$/i))return e;try{return o.bR.fromHex(t).assertValidity(),{result:!0,reason_data:null,reason:null}}catch(t){return n}}(t);if(!i.result)throw i;const a=o.Wp.randomPrivateKey(),u=(0,o.lG)(a,!0);let f=(0,o.CH)(a,t,!0);f=f.slice(1);const l=m(f),d=o.Wp.randomBytes(16),y=await async function(t,e,n){const r=await h();return await r.encrypt("aes-256-cbc",e,t,n)}(d,l.encryptionKey,e),b=(0,s.Id)(d,u,y),w=g(l.hmacKey,b);let v;if(r&&"hex"!==r){if("base64"!==r)throw new Error(`Unexpected cipherTextEncoding "${r}"`);v=(0,c.fromByteArray)(y)}else v=(0,s.My)(y);const x={iv:(0,s.My)(d),ephemeralPK:(0,s.My)(u),cipherText:v,mac:(0,s.My)(w),wasString:n};return r&&"hex"!==r&&(x.cipherTextEncoding=r),x}async function w(t,e){if(!e.ephemeralPK)throw new a.tS("Unable to get public key from cipher object. You might be trying to decrypt an unencrypted object.");const n=e.ephemeralPK;let r=(0,o.CH)(t,n,!0);r=r.slice(1);const i=m(r),u=(0,s.aT)(e.iv);let f;if(e.cipherTextEncoding&&"hex"!==e.cipherTextEncoding){if("base64"!==e.cipherTextEncoding)throw new Error(`Unexpected cipherTextEncoding "${e.cipherTex