@eluvio/elv-client-js 3.1.80 → 3.1.81
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/dist/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/src/client/ContentAccess.js +14 -9
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/client/ContentAccess.js +13 -7
- package/typeSpecs/DropEventSite.js +51 -56
- package/typeSpecs/Marketplace.js +88 -80
package/dist/ElvClient-min.js
CHANGED
|
@@ -44,7 +44,7 @@ var r=n(75),a=n(76),i=n(51);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647
|
|
|
44
44
|
* Licensed under
|
|
45
45
|
* MIT License http://www.opensource.org/licenses/mit-license
|
|
46
46
|
*
|
|
47
|
-
*/!function(s,o){"use strict";"object"===i(t)&&t.exports?t.exports=o():void 0===(a="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=a)}(0,(function(t){"use strict";var e=t&&t.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;var r=t.lastIndexOf(".",e-1);if(r<=0||r>=e-1)return!1;var a=n.list[t.slice(e+1)];return!!a&&a.indexOf(" "+t.slice(r+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var r=n.list[t.slice(e+1)];return!!r&&r.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var r=t.lastIndexOf(".",e-1);if(r<=0||r>=e-1)return null;var a=n.list[t.slice(e+1)];return a?a.indexOf(" "+t.slice(r+1,e)+" ")<0?null:t.slice(r+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return n}))}).call(this,n(10)(t))},function(t,e,n){var r=n(159);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e){t.exports={abi:[{constant:!0,inputs:[],name:"creator",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_SEE",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"customValues",type:"bytes32[]"},{name:"stakeholders",type:"address[]"}],name:"accessRequestV3",outputs:[{name:"",type:"bool"}],payable:!0,stateMutability:"payable",type:"function"},{constant:!0,inputs:[],name:"visibility",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"kill",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"version",outputs:[{name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"versionAPI",outputs:[{name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"indexCategory",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newCreator",type:"address"}],name:"transferCreatorship",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"candidate",type:"address"}],name:"hasAccess",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_ACCESS",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_visibility_code",type:"uint8"}],name:"setVisibility",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"contentSpace",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_EDIT",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!1,name:"requestNonce",type:"uint256"},{indexed:!1,name:"parentAddress",type:"address"},{indexed:!1,name:"contextHash",type:"bytes32"},{indexed:!1,name:"accessor",type:"address"},{indexed:!1,name:"requestTimestamp",type:"uint256"}],name:"AccessRequestV3",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"contentSpace",type:"address"},{indexed:!1,name:"parentAddress",type:"address"},{indexed:!1,name:"visibility",type:"uint8"}],name:"VisibilityChanged",type:"event"}]}},function(t,e,n){var r=n(23),a=n(17),i=n(9),s=n(4);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=n(15),A=n(24),d=n(16),p=d.ValidateLibrary,f=d.ValidateObject,l=d.ValidateVersion,h=d.ValidatePartHash,y=d.ValidateWriteToken,g=d.ValidateParameters,b=n(187);e.permissionLevels={owner:{short:"Owner Only",description:"Only the owner has access to the object and ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!1}},editable:{short:"Editable",description:"Members of the editors group have full access to the object and the ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!0}},viewable:{short:"Viewable",description:"In addition to editors, members of the 'accessor' group can have read-only access to the object including playing video and retrieving metadata, images and documents",settings:{visibility:0,statusCode:0,kmsConk:!0}},listable:{short:"Publicly Listable",description:"Anyone can list the public portion of this object but only accounts with specific rights can access",settings:{visibility:1,statusCode:0,kmsConk:!0}},public:{short:"Public",description:"Anyone can access this object",settings:{visibility:10,statusCode:0,kmsConk:!0}}},e.Visibility=function(t){var e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.id,a.prev=1,n=this.utils.HashToAddress(e),this.visibilityInfo[n]||(this.visibilityInfo[n]=new Promise((function(t,a){return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,s.awrap(r.authClient.ContractHasMethod({contractAddress:n,methodName:"visibility"}));case 3:if(i.sent){i.next=7;break}return t(0),i.abrupt("return");case 7:return i.t0=t,i.next=10,s.awrap(r.CallContractMethod({contractAddress:r.utils.HashToAddress(e),methodName:"visibility"}));case 10:i.t1=i.sent,(0,i.t0)(i.t1),i.next=17;break;case 14:i.prev=14,i.t2=i.catch(0),a(i.t2);case 17:case"end":return i.stop()}}),null,null,[[0,14]])}))),a.prev=4,a.next=7,s.awrap(this.visibilityInfo[n]);case 7:return a.abrupt("return",a.sent);case 10:throw a.prev=10,a.t0=a.catch(4),delete this.visibilityInfo[n],a.t0;case 14:a.next=21;break;case 16:if(a.prev=16,a.t1=a.catch(1),"CALL_EXCEPTION"!==a.t1.code){a.next=20;break}return a.abrupt("return",0);case 20:throw a.t1;case 21:case"end":return a.stop()}}),null,this,[[1,16],[4,10]])},e.Permission=function(t){var e,n,r,a,i,o,u,c=this;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:return e=t.objectId,f(e),A.next=4,s.awrap(this.AccessType({id:e}));case 4:if(A.t0=A.sent,A.t1=this.authClient.ACCESS_TYPES.OBJECT,A.t0===A.t1){A.next=8;break}throw Error("Permission only valid for normal content objects: "+e);case 8:return A.next=10,s.awrap(this.Visibility({id:e}));case 10:return n=A.sent,A.next=13,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"addressKMS"}));case 13:if(r=A.sent,a=r&&"ikms".concat(this.utils.AddressToHash(r)),i=!1,!a){A.next=29;break}return A.t2=s,A.t3=this,A.next=21,s.awrap(this.ContentObjectLibraryId({objectId:e}));case 21:return A.t4=A.sent,A.t5=e,A.t6="eluv.caps.".concat(a),A.t7={libraryId:A.t4,objectId:A.t5,metadataSubtree:A.t6},A.t8=A.t3.ContentObjectMetadata.call(A.t3,A.t7),A.next=28,A.t2.awrap.call(A.t2,A.t8);case 28:i=!!A.sent;case 29:return A.next=31,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"statusCode"}));case 31:return o=A.sent,o=parseInt(o._hex,16),(u=Object.keys(this.permissionLevels).filter((function(t){var e=c.permissionLevels[t].settings;return n>=e.visibility&&o>=e.statusCode&&i===e.kmsConk})))||(u=i?["editable"]:["owner"]),A.abrupt("return",u.slice(-1)[0]);case 36:case"end":return A.stop()}}),null,this)},e.DefaultKMSAddress=function(){var t,e,n,r=arguments;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:{},e=t.tenantId,a.t0=e,!a.t0){a.next=8;break}return a.next=5,s.awrap(this.AccessType({id:e}));case 5:a.t1=a.sent,a.t2=this.authClient.ACCESS_TYPES.TENANT,a.t0=a.t1===a.t2;case 8:if(!a.t0){a.next=14;break}return a.next=11,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"addressKMS"}));case 11:if(!(n=a.sent)){a.next=14;break}return a.abrupt("return",n);case 14:return a.next=16,s.awrap(this.CallContractMethod({contractAddress:this.contentSpaceAddress,methodName:"addressKMS"}));case 16:return a.abrupt("return",a.sent);case 17:case"end":return a.stop()}}),null,this)},e.ContentSpaceId=function(){return this.contentSpaceId},e.ContentTypeOwner=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.name,n=t.typeId,r=t.versionHash,i.next=3,s.awrap(this.ContentType({name:e,typeId:n,versionHash:r}));case 3:return a=i.sent,i.t0=this.utils,i.next=7,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(a.id),methodName:"owner",methodArgs:[]}));case 7:return i.t1=i.sent,i.abrupt("return",i.t0.FormatAddress.call(i.t0,i.t1));case 9:case"end":return i.stop()}}),null,this)},e.ContentType=function(t){var e,n,r,a,i,o,u;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:if(e=t.name,n=t.typeId,r=t.versionHash,a=t.publicOnly,i=void 0!==a&&a,this.Log("Retrieving content type: ".concat(e||n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),!e){A.next=8;break}return this.Log("Looking up type by name in content space metadata..."),A.next=7,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:c("public","contentTypes",e)}));case 7:n=A.sent;case 8:if(n){A.next=18;break}return this.Log("Looking up type by name in available types..."),A.next=12,s.awrap(this.ContentTypes());case 12:if(o=A.sent,!e){A.next=17;break}return A.abrupt("return",Object.values(o).find((function(t){return(t.name||"").toLowerCase()===e.toLowerCase()})));case 17:return A.abrupt("return",Object.values(o).find((function(t){return t.hash===r})));case 18:if(r){A.next=22;break}return A.next=21,s.awrap(this.LatestVersionHash({objectId:n}));case 21:r=A.sent;case 22:if(A.prev=22,this.Log("Looking up type by ID..."),!i){A.next=34;break}return A.next=27,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:r,metadataSubtree:"public"}));case 27:if(A.t0=A.sent,A.t0){A.next=30;break}A.t0={};case 30:A.t1=A.t0,u={public:A.t1},A.next=40;break;case 34:return A.next=36,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:r}));case 36:if(A.t2=A.sent,A.t2){A.next=39;break}A.t2={};case 39:u=A.t2;case 40:return A.abrupt("return",{id:n,hash:r,name:u.public&&u.public.name||u.name||n,meta:u});case 43:throw A.prev=43,A.t3=A.catch(22),this.Log("Error looking up content type:"),this.Log(A.t3),new Error("Content Type ".concat(e||n," is invalid"));case 48:case"end":return A.stop()}}),null,this,[[22,43]])},e.ContentTypes=function(){var t,e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return this.contentTypes=this.contentTypes||{},this.Log("Looking up all available content types"),a.next=4,s.awrap(this.Collection({collectionType:"contentTypes"}));case 4:return t=a.sent,this.Log("Personally available types:"),this.Log(t),a.next=9,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:"public/contentTypes"}));case 9:if(a.t0=a.sent,a.t0){a.next=12;break}a.t0={};case 12:return e=a.t0,n=Object.values(e).map((function(t){return r.utils.HashToAddress(t)})),this.Log("Content space types:"),this.Log(n),t=t.concat(n).filter((function(t){return t})).map((function(t){return r.utils.FormatAddress(t)})).filter((function(t,e,n){return n.indexOf(t)===e})),a.next=19,s.awrap(Promise.all(t.map((function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(e=r.utils.AddressToObjectId(t),r.contentTypes[e]){n.next=11;break}return n.prev=2,n.next=5,s.awrap(r.ContentType({typeId:e,publicOnly:!0}));case 5:r.contentTypes[e]=n.sent,n.next=11;break;case 8:n.prev=8,n.t0=n.catch(2),console.error(n.t0);case 11:case"end":return n.stop()}}),null,null,[[2,8]])}))));case 19:return a.abrupt("return",this.contentTypes);case 20:case"end":return a.stop()}}),null,this)},e.ContentLibraries=function(){var t,e=this;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,s.awrap(this.Collection({collectionType:"libraries"}));case 2:return t=n.sent,n.abrupt("return",t.map((function(t){return e.utils.AddressToLibraryId(t)})));case 4:case"end":return n.stop()}}),null,this)},e.ContentLibrary=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,p(e),n=c("qlibs",e),a.t0=s,a.t1=this.utils,a.t2=this.HttpClient,a.next=8,s.awrap(this.authClient.AuthorizationHeader({libraryId:e}));case 8:return a.t3=a.sent,a.t4=n,a.t5={headers:a.t3,method:"GET",path:a.t4},a.t6=a.t2.Request.call(a.t2,a.t5),a.t7=a.t1.ResponseToJson.call(a.t1,a.t6),a.next=15,a.t0.awrap.call(a.t0,a.t7);case 15:return r=a.sent,a.abrupt("return",u({},r,{meta:r.meta||{}}));case 17:case"end":return a.stop()}}),null,this)},e.ContentLibraryOwner=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.libraryId,p(e),n.t0=this.utils,n.next=5,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"owner",methodArgs:[]}));case 5:return n.t1=n.sent,n.abrupt("return",n.t0.FormatAddress.call(n.t0,n.t1));case 7:case"end":return n.stop()}}),null,this)},e.LibraryContentTypes=function(t){var e,n,r,a=this;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.libraryId,p(e),this.Log("Retrieving library content types for ".concat(e)),i.next=5,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"contentTypesLength",methodArgs:[]}));case 5:if(n=i.sent.toNumber(),this.Log("".concat(n," types")),0!==n){i.next=9;break}return i.abrupt("return",{});case 9:return r={},i.next=12,s.awrap(Promise.all(Array.from(new Array(n),(function(t,n){var i,o;return s.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.awrap(a.ethClient.CallContractMethod({contractAddress:a.utils.HashToAddress(e),methodName:"contentTypes",methodArgs:[n]}));case 2:return i=t.sent,o=a.utils.AddressToObjectId(i),t.next=6,s.awrap(a.ContentType({typeId:o}));case 6:r[o]=t.sent;case 7:case"end":return t.stop()}}))}))));case 12:return this.Log(r),i.abrupt("return",r);case 14:case"end":return i.stop()}}),null,this)},e.ContentObjects=function(t){var e,n,r,a,i,o,u;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:return e=t.libraryId,n=t.filterOptions,r=void 0===n?{}:n,p(e),this.Log("Retrieving content objects from ".concat(e)),a=c("qlibs",e,"q"),i={filter:[]},r.cacheId&&(i.cache_id=r.cacheId),r.start&&(i.start=r.start),r.limit&&(i.limit=r.limit),r.select&&(i.select=r.select),r.sort&&(i.sort_by=r.sort,r.sortDesc&&(i.sort_descending=!0)),o={eq:":eq:",neq:":ne:",lt:":lt:",lte:":le:",gt:":gt:",gte:":ge:",cnt:":co:",ncnt:":nc:"},u=function(t){var e=t.key,n=t.type,r=t.filter;i.filter.push("".concat(e).concat(o[n]).concat(r))},r.filter&&(Array.isArray(r.filter)?r.filter.forEach((function(t){return u(t)})):u(r.filter)),this.Log("Filter options:"),this.Log(r),A.t0=s,A.t1=this.utils,A.t2=this.HttpClient,A.next=20,s.awrap(this.authClient.AuthorizationHeader({libraryId:e}));case 20:return A.t3=A.sent,A.t4=a,A.t5=i,A.t6={headers:A.t3,method:"GET",path:A.t4,queryParams:A.t5},A.t7=A.t2.Request.call(A.t2,A.t6),A.t8=A.t1.ResponseToJson.call(A.t1,A.t7),A.next=28,A.t0.awrap.call(A.t0,A.t8);case 28:return A.abrupt("return",A.sent);case 29:case"end":return A.stop()}}),null,this)},e.ContentObject=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object: ".concat(e||""," ").concat(n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),a=c("q",r||n),i.t0=s,i.t1=this.utils,i.t2=this.HttpClient,i.next=10,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 10:return i.t3=i.sent,i.t4=a,i.t5={headers:i.t3,method:"GET",path:i.t4},i.t6=i.t2.Request.call(i.t2,i.t5),i.t7=i.t1.ResponseToJson.call(i.t1,i.t6),i.next=17,i.t0.awrap.call(i.t0,i.t7);case 17:return i.abrupt("return",i.sent);case 18:case"end":return i.stop()}}),null,this)},e.ContentObjectOwner=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.objectId,f(e),this.Log("Retrieving content object owner: ".concat(e)),n.t0=this.utils,n.next=6,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"owner",methodArgs:[]}));case 6:return n.t1=n.sent,n.abrupt("return",n.t0.FormatAddress.call(n.t0,n.t1));case 8:case"end":return n.stop()}}),null,this)},e.ContentObjectTenantId=function(t){var e,n;return s.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.objectId,(n=t.versionHash)?l(n):f(e),n&&(e=this.utils.DecodeVersionHash(n).objectId),this.objectTenantIds[e]){r.next=7;break}return r.next=6,s.awrap(this.authClient.MakeElvMasterCall({methodName:"elv_getTenantById",params:[this.contentSpaceId,e]}));case 6:this.objectTenantIds[e]=r.sent;case 7:return r.abrupt("return",this.objectTenantIds[e]);case 8:case"end":return r.stop()}}),null,this)},e.ContentObjectLibraryId=function(t){var e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.objectId,(n=t.versionHash)?l(n):f(e),n&&(e=this.utils.DecodeVersionHash(n).objectId),a.next=5,s.awrap(this.authClient.AccessType(e));case 5:a.t0=a.sent,a.next=a.t0===this.authClient.ACCESS_TYPES.LIBRARY?8:a.t0===this.authClient.ACCESS_TYPES.OBJECT?9:a.t0===this.authClient.ACCESS_TYPES.OTHER?20:21;break;case 8:return a.abrupt("return",this.utils.AddressToLibraryId(this.utils.HashToAddress(e)));case 9:return this.objectLibraryIds[e]||(this.Log("Retrieving content object library ID: ".concat(e||n)),this.objectLibraryIds[e]=new Promise((function(t,n){return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.t0=t,a.t1=r.utils,a.next=5,s.awrap(r.CallContractMethod({contractAddress:r.utils.HashToAddress(e),methodName:"libraryAddress"}));case 5:a.t2=a.sent,a.t3=a.t1.AddressToLibraryId.call(a.t1,a.t2),(0,a.t0)(a.t3),a.next=13;break;case 10:a.prev=10,a.t4=a.catch(0),n(a.t4);case 13:case"end":return a.stop()}}),null,null,[[0,10]])}))),a.prev=10,a.next=13,s.awrap(this.objectLibraryIds[e]);case 13:return a.abrupt("return",a.sent);case 16:throw a.prev=16,a.t1=a.catch(10),delete this.objectLibraryIds[e],a.t1;case 20:throw Error("Unable to retrieve library ID for ".concat(n||e,": Unknown type. (wrong network or deleted object?)"));case 21:return a.abrupt("return",this.contentSpaceLibraryId);case 22:case"end":return a.stop()}}),null,this,[[10,16]])},e.ProduceMetadataLinks=function(t){var e,n,r,i,o,A,d,p,f=this;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,i=t.path,o=void 0===i?"/":i,A=t.metadata,d=t.authorizationToken,A&&"object"===a(A)){l.next=3;break}return l.abrupt("return",A);case 3:if(!Array.isArray(A)){l.next=7;break}return l.next=6,s.awrap(this.utils.LimitedMap(5,A,(function(t,a){return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,s.awrap(f.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:c(o,a.toString()),metadata:t,authorizationToken:d}));case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}))})));case 6:return l.abrupt("return",l.sent);case 7:if(!A["/"]||!A["/"].match(/\.\/(rep|files)\/.+/)&&!A["/"].match(/^\/?qfab\/([\w]+)\/?(rep|files)\/.+/)){l.next=16;break}return l.t0=u,l.t1={},l.t2=A,l.next=13,s.awrap(this.LinkUrl({libraryId:e,objectId:n,versionHash:r,linkPath:o,authorizationToken:d}));case 13:return l.t3=l.sent,l.t4={url:l.t3},l.abrupt("return",(0,l.t0)(l.t1,l.t2,l.t4));case 16:return p={},l.next=19,s.awrap(this.utils.LimitedMap(5,Object.keys(A),(function(t){return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,s.awrap(f.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:c(o,t),metadata:A[t],authorizationToken:d}));case 2:p[t]=a.sent;case 3:case"end":return a.stop()}}))})));case 19:return l.abrupt("return",p);case 20:case"end":return l.stop()}}),null,this)},e.MetadataAuth=function(t){var e,n,r,a,i,o,u,c,A,d,p,f,l;return s.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.path,i=void 0===a?"/":a,o=t.channelAuth,u=void 0!==o&&o,c=t.noAuth,A=void 0!==c&&c,g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),A=this.noAuth||A,d=A,A){h.next=14;break}return h.next=8,s.awrap(this.Visibility({id:n}));case 8:return f=h.sent,h.next=11,s.awrap(this.AccessType({id:n}));case 11:p=h.sent,d=(i||"").replace(/^\/+/,"").startsWith("public"),A=f>=10||d&&f>=1;case 14:if(!this.oauthToken){h.next=22;break}return h.next=17,s.awrap(this.authClient.KMSAddress({objectId:n,versionHash:r}));case 17:if(!(l=h.sent)||this.utils.EqualAddress(l,this.utils.nullAddress)){h.next=22;break}return h.next=21,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,channelAuth:!0,oauthToken:this.oauthToken}));case 21:return h.abrupt("return",h.sent);case 22:if(this.inaccessibleLibraries[e]||!d||p!==this.authClient.ACCESS_TYPES.OBJECT||u){h.next=50;break}if(h.prev=23,h.t0=s,h.t1=this.authClient,h.t2=e,h.t2){h.next=31;break}return h.next=30,s.awrap(this.ContentObjectLibraryId({objectId:n,versionHash:r}));case 30:h.t2=h.sent;case 31:return h.t3=h.t2,h.t4=A,h.t5={libraryId:h.t3,noAuth:h.t4},h.t6=h.t1.AuthorizationToken.call(h.t1,h.t5),h.next=37,h.t0.awrap.call(h.t0,h.t6);case 37:return h.abrupt("return",h.sent);case 40:if(h.prev=40,h.t7=h.catch(23),!h.t7.message||!h.t7.message.toLowerCase().startsWith("access denied")){h.next=47;break}return this.inaccessibleLibraries[e]=!0,h.next=46,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,noAuth:A,channelAuth:u}));case 46:return h.abrupt("return",h.sent);case 47:throw h.t7;case 48:h.next=53;break;case 50:return h.next=52,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,noAuth:A,channelAuth:u}));case 52:return h.abrupt("return",h.sent);case 53:case"end":return h.stop()}}),null,this,[[23,40]])},e.ContentObjectMetadata=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,y,b,m,I,C,v,w,E,B,Q,M,_,x,k,S,D,R;return s.async((function(N){for(;;)switch(N.prev=N.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.metadataSubtree,o=void 0===i?"/":i,A=t.queryParams,d=void 0===A?{}:A,p=t.select,f=void 0===p?[]:p,l=t.remove,h=void 0===l?[]:l,y=t.authorizationToken,b=t.noAuth,m=void 0!==b&&b,I=t.resolveLinks,C=void 0!==I&&I,v=t.resolveIncludeSource,w=void 0!==v&&v,E=t.resolveIgnoreErrors,B=void 0!==E&&E,Q=t.linkDepthLimit,M=void 0===Q?1:Q,_=t.produceLinkUrls,x=void 0!==_&&_,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object metadata: ".concat(e||""," ").concat(n||r," ").concat(a||"","\n Subtree: ").concat(o)),d=u({},d||{}),r&&(n=this.utils.DecodeVersionHash(r).objectId),k=c("q",a||r||n,"meta",o),N.next=8,s.awrap(this.MetadataAuth({libraryId:e,objectId:n,versionHash:r,path:o,noAuth:m}));case 8:return S=N.sent,D=[y,d.authorization,S].flat().filter((function(t){return t})),delete d.authorization,N.prev=11,N.next=14,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({headers:{Authorization:D.map((function(t){return"Bearer ".concat(t)}))},queryParams:u({},d,{select:f,remove:h,link_depth:M,resolve:C,resolve_include_source:w,resolve_ignore_errors:B}),method:"GET",path:k})));case 14:R=N.sent,N.next=22;break;case 17:if(N.prev=17,N.t0=N.catch(11),404===N.t0.status){N.next=21;break}throw N.t0;case 21:R="/"===o?{}:void 0;case 22:if(x){N.next=24;break}return N.abrupt("return",R);case 24:return N.next=26,s.awrap(this.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:o,metadata:R,authorizationToken:y}));case 26:return N.abrupt("return",N.sent);case 27:case"end":return N.stop()}}),null,this,[[11,17]])},e.AssetMetadata=function(t){var e,n,a,i,o,A,d,p,f=this;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:if(e=t.libraryId,n=t.objectId,a=t.versionHash,i=t.metadata,o=t.localization,A=t.produceLinkUrls,d=void 0!==A&&A,g({libraryId:e,objectId:n,versionHash:a}),n||(n=this.utils.DecodeVersionHash(a).objectId),i){l.next=12;break}return l.next=6,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:a,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIgnoreErrors:!0,produceLinkUrls:d}));case 6:if(l.t0=l.sent,l.t0){l.next=9;break}l.t0={};case 9:i=l.t0,l.next=16;break;case 12:if(!d){l.next=16;break}return l.next=15,s.awrap(this.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:a,path:c("public","asset_metadata"),metadata:i}));case 15:i=l.sent;case 16:return i.info||(i.info={}),p=u({},i),o&&o.reverse().forEach((function(t){var e,n=(e=f.utils).SafeTraverse.apply(e,[i].concat(r(t)))||{};p=b({},p,n,(function(t,e){return null===e||""===e?t:void 0}))})),l.abrupt("return",p);case 20:case"end":return l.stop()}}),null,this)},e.ContentObjectVersions=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,n=t.objectId,g({libraryId:e,objectId:n}),this.Log("Retrieving content object versions: ".concat(e||""," ").concat(n)),r=c("qid",n),a.t0=this.utils,a.t1=this.HttpClient,a.next=8,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n}));case 8:return a.t2=a.sent,a.t3=r,a.t4={headers:a.t2,method:"GET",path:a.t3},a.t5=a.t1.Request.call(a.t1,a.t4),a.abrupt("return",a.t0.ResponseToJson.call(a.t0,a.t5));case 13:case"end":return a.stop()}}),null,this)},e.LatestVersionHash=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.objectId,(n=t.versionHash)&&(e=this.utils.DecodeVersionHash(n).objectId),f(e),i.prev=3,i.next=6,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"objectHash"}));case 6:r=i.sent,i.next=11;break;case 9:i.prev=9,i.t0=i.catch(3);case 11:if(r){i.next=20;break}return i.next=14,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"countVersionHashes"}));case 14:if((a=i.sent).toNumber()){i.next=17;break}throw Error("Unable to determine latest version hash for ".concat(n||e," - Item deleted?"));case 17:return i.next=19,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"versionHashes",methodArgs:[a-1]}));case 19:r=i.sent;case 20:return i.abrupt("return",r);case 21:case"end":return i.stop()}}),null,this,[[3,9]])},e.AvailableDRMs=function(){var t,e,n,r,a,i,o,u,c;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:if(t=["clear","aes-128"],"undefined"!=typeof window){A.next=3;break}return A.abrupt("return",t);case 3:if(window.navigator&&window.navigator.userAgent&&((e=window.navigator.userAgent.match(/(iPad|iPhone|iphone|iPod).*?(OS |os |OS_)(\d+((_|\.)\d)?((_|\.)\d)?)/))&&e[3]&&(n=e[3].split("_"),r=parseInt(n[0]),a=parseInt(n[1]),(r>13||13===r&&a>=1)&&(t[1]="sample-aes",t[2]="fairplay")),/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent)&&(i=window.navigator.userAgent.match(/.+Version\/(\d+)\.(\d+)/))&&i[2]&&(o=parseInt(i[1]),u=parseInt(i[2]),(o>13||13===o&&u>=1)&&(t[1]="sample-aes",t[2]="fairplay"))),"undefined"==typeof window||"function"==typeof window.navigator.requestMediaKeySystemAccess){A.next=6;break}return A.abrupt("return",t);case 6:return A.prev=6,c=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4;codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4;codecs="avc1.42E01E"'}]}],A.next=10,s.awrap(navigator.requestMediaKeySystemAccess("com.widevine.alpha",c));case 10:t.push("widevine"),A.next=15;break;case 13:A.prev=13,A.t0=A.catch(6);case 15:return A.abrupt("return",t);case 16:case"end":return A.stop()}}),null,null,[[6,13]])},e.PlayoutPathResolution=function(t){var e,n,r,a,i,o,u,A,d,p,f,l,h,y,g,b,m;return s.async((function(I){for(;;)switch(I.prev=I.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.handler,u=t.offering,A=void 0===u?"":u,d=t.signedLink,p=void 0!==d&&d,f=t.authorizationToken,e){I.next=5;break}return I.next=4,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 4:e=I.sent;case 5:if(r){I.next=9;break}return I.next=8,s.awrap(this.LatestVersionHash({objectId:n}));case 8:r=I.sent;case 9:if(l=c("qlibs",e,"q",a||r,"rep",o,A,"options.json"),!i){I.next=26;break}return I.next=13,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:i,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:f}));case 13:if(m=I.sent,b=!!m&&!!m["/"]&&!m["/"].endsWith("options.json"),l=c("qlibs",e,"q",a||r,"meta",i),p){I.next=25;break}return I.next=19,s.awrap(this.LinkTarget({libraryId:e,objectId:n,versionHash:r,writeToken:a,linkPath:i,linkInfo:m,authorizationToken:f}));case 19:return g=I.sent,y=this.utils.DecodeVersionHash(g).objectId,I.next=23,s.awrap(this.ContentObjectLibraryId({objectId:y}));case 23:h=I.sent,b||A||(l=c("q",g,"rep",o,"options.json"));case 25:b&&(l=c(l,A,"options.json"));case 26:return I.abrupt("return",{path:l,multiOfferingLink:b,linkTarget:{libraryId:h,objectId:y,versionHash:g}});case 27:case"end":return I.stop()}}),null,this)},e.AvailableOfferings=function(t){var e,n,r,a,i,o,u,c,A,d,p,f;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.writeToken,a=t.linkPath,i=t.signedLink,o=t.directLink,u=t.handler,c=void 0===u?"playout":u,A=t.authorizationToken,e||(e=this.utils.DecodeVersionHash(n).objectId),!o){l.next=17;break}return l.t0=s,l.t1=this,l.next=7,s.awrap(this.ContentObjectLibraryId({objectId:e}));case 7:return l.t2=l.sent,l.t3=e,l.t4=n,l.t5=a,l.t6=A,l.t7={libraryId:l.t2,objectId:l.t3,versionHash:l.t4,metadataSubtree:l.t5,resolveLinks:!0,authorizationToken:l.t6},l.t8=l.t1.ContentObjectMetadata.call(l.t1,l.t7),l.next=16,l.t0.awrap.call(l.t0,l.t8);case 16:return l.abrupt("return",l.sent);case 17:return l.next=19,s.awrap(this.PlayoutPathResolution({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:i,handler:c,authorizationToken:A}));case 19:return d=l.sent,p=d.path,l.prev=21,l.t9=A,l.next=25,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken}));case 25:return l.t10=l.sent,l.t11=function(t){return t},f=[l.t9,l.t10].flat().filter(l.t11),l.next=30,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({path:p,method:"GET",headers:{Authorization:"Bearer ".concat(f.join(","))}})));case 30:return l.abrupt("return",l.sent);case 33:if(l.prev=33,l.t12=l.catch(21),!l.t12.status||500!==parseInt(l.t12.status)){l.next=37;break}return l.abrupt("return",{});case 37:throw l.t12;case 38:case"end":return l.stop()}}),null,this,[[21,33]])},e.PlayoutOptions=function(t){var e,n,r,a,o,A,d,p,h,y,g,b,m,I,C,v,w,E,B,Q,M,_,x,k,S,D,R,N,T,O,H,L,U,F,j,P,G,Y,q,K,z,J,V,W,Z=this;return s.async((function(X){for(;;)switch(X.prev=X.next){case 0:if(e=t.offeringURI,n=t.objectId,r=t.versionHash,a=t.writeToken,o=t.linkPath,A=t.signedLink,d=void 0!==A&&A,p=t.protocols,h=void 0===p?["dash","hls"]:p,y=t.handler,g=void 0===y?"playout":y,b=t.offering,m=void 0===b?"default":b,I=t.playoutType,C=t.drms,v=void 0===C?[]:C,w=t.context,E=t.hlsjsProfile,B=void 0===E||E,Q=t.authorizationToken,!e){X.next=8;break}if(M=e.match(/(hq__[^/]+)\/rep\/([^/]+)\/([^/]+)\/options.json/),r=M[1],g=M[2],m=M[3],r&&g&&m){X.next=8;break}throw Error("Invalid offering URI: ".concat(e));case 8:if(r?l(r):f(n),h=h.map((function(t){return t.toLowerCase()})),v=v.map((function(t){return t.toLowerCase()})),n){X.next=15;break}n=this.utils.DecodeVersionHash(r).objectId,X.next=19;break;case 15:if(r){X.next=19;break}return X.next=18,s.awrap(this.LatestVersionHash({objectId:n}));case 18:r=X.sent;case 19:return X.next=21,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 21:if(_=X.sent,X.prev=22,o){X.next=29;break}return x=c("public","asset_metadata","sources",m),X.next=27,s.awrap(this.ContentObjectMetadata({libraryId:_,objectId:n,versionHash:r,metadataSubtree:x,authorizationToken:Q}));case 27:X.sent&&(o=x);case 29:X.next=33;break;case 31:X.prev=31,X.t0=X.catch(22);case 33:return X.next=35,s.awrap(this.PlayoutPathResolution({libraryId:_,objectId:n,versionHash:r,writeToken:a,linkPath:o,signedLink:d,handler:g,offering:m,authorizationToken:Q}));case 35:if(k=X.sent,S=k.path,D=k.linkTarget,X.t1=this.authClient,X.t2=D.objectId||n,X.t3=D.versionHash||r,X.t3){X.next=45;break}return X.next=44,s.awrap(this.LatestVersionHash({objectId:n}));case 44:X.t3=X.sent;case 45:return X.t4=X.t3,X.t5=h,X.t6=v,X.t7=w,X.t8={objectId:X.t2,versionHash:X.t4,protocols:X.t5,drms:X.t6,context:X.t7},R=X.t1.AudienceData.call(X.t1,X.t8),X.t9=Q,X.next=54,s.awrap(this.authClient.AuthorizationToken({libraryId:_,objectId:n,channelAuth:!0,oauthToken:this.oauthToken,audienceData:R}));case 54:return X.t10=X.sent,X.t11=function(t){return t},N=[X.t9,X.t10].flat().filter(X.t11),T={authorization:N,resolve:!!o},X.t12=Object,X.next=61,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({path:S,method:"GET",queryParams:T})));case 61:if(X.t13=X.sent,O=X.t12.values.call(X.t12,X.t13),d||!D.versionHash){X.next=70;break}return X.t14=Q,X.next=67,s.awrap(this.authClient.AuthorizationToken({libraryId:D.libraryId,objectId:D.objectId,channelAuth:!0,oauthToken:this.oauthToken,audienceData:R}));case 67:X.t15=X.sent,X.t16=function(t){return t},T.authorization=[X.t14,X.t15].flat().filter(X.t16);case 70:H={},F=0;case 72:if(!(F<O.length)){X.next=118;break}if(j=O[F],P=j.properties.protocol,G=j.properties.drm,L=L||j.sid,U=U||!!j.properties.multiview,L&&(T.sid=L),Y=j.uri.split("?")[0],I&&(Y=Y.replace("playlist","playlist-".concat(I))),q=j.properties.license_servers,K=j.properties.cert,B&&"hls"===P&&"aes-128"===G&&(T.player_profile="hls-js"),X.t17=u,X.t18={},X.t19=H[P]||{},X.t20=u,X.t21={},X.t22=(H[P]||{}).playoutMethods||{},X.t23=i,X.t24={},X.t25=G||"clear",!d){X.next=99;break}return X.next=96,s.awrap(this.LinkUrl({versionHash:r,linkPath:c(o,m,Y),queryParams:T,noAuth:!0}));case 96:X.t26=X.sent,X.next=102;break;case 99:return X.next=101,s.awrap(this.Rep({libraryId:D.libraryId||_,objectId:D.objectId||n,versionHash:D.versionHash||r,rep:c(g,m,Y),noAuth:!0,queryParams:T}));case 101:X.t26=X.sent;case 102:for(z in X.t27=X.t26,X.t28=G?i({},G,{licenseServers:q,cert:K}):void 0,X.t29={playoutUrl:X.t27,drms:X.t28},X.t30=(0,X.t23)(X.t24,X.t25,X.t29),X.t31=(0,X.t20)(X.t21,X.t22,X.t30),X.t32={playoutMethods:X.t31},H[P]=(0,X.t17)(X.t18,X.t19,X.t32),H[P].playoutMethods)H[P].playoutMethods[z].drms&&H[P].playoutMethods[z].drms[G]&&H[P].playoutMethods[z].drms[G].cert&&((J=new URL(H[P].playoutMethods[z].playoutUrl)).pathname=J.pathname.split("/").slice(0,-1).concat(["drm.cert"]).join("/"),H[P].playoutMethods[z].drms[G].cert_url=J.toString());if(V=h.includes(P),W=v.includes(G||"clear")||0===v.length&&!G,V&&W){X.next=114;break}return X.abrupt("continue",115);case 114:(!H[P].playoutUrl||G&&"clear"!==G)&&(H[P].playoutUrl=H[P].playoutMethods[G||"clear"].playoutUrl,H[P].drms=H[P].playoutMethods[G||"clear"].drms);case 115:F++,X.next=72;break;case 118:return U&&L&&(H.sessionId=L,H.multiview=!0,H.AvailableViews=function(){return s.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=s,t.t1=Z.utils,t.next=4,s.awrap(Z.HttpClient.Request({path:c("q",D.versionHash||r,"rep",g,m,"views.json"),method:"GET",queryParams:{sid:L,authorization:N}}));case 4:return t.t2=t.sent,t.t3=t.t1.ResponseToFormat.call(t.t1,"json",t.t2),t.next=8,t.t0.awrap.call(t.t0,t.t3);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}))},H.SwitchView=function(t){return s.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.awrap(Z.HttpClient.Request({path:c("q",D.versionHash||r,"rep",g,m,"select_view"),method:"POST",queryParams:{sid:L,authorization:N},body:{view:t}}));case 2:case"end":return e.stop()}}))}),this.Log(H),X.abrupt("return",H);case 121:case"end":return X.stop()}}),null,this,[[22,31]])},e.BitmovinPlayoutOptions=function(t){var e,n,r,a,i,o,u,c,A,d,p,h,y,g,b,m,I,C,v,w,E,B;return s.async((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return e=t.objectId,n=t.versionHash,r=t.writeToken,a=t.linkPath,i=t.signedLink,o=void 0!==i&&i,u=t.protocols,c=void 0===u?["dash","hls"]:u,A=t.drms,d=void 0===A?[]:A,p=t.handler,h=void 0===p?"playout":p,y=t.offering,g=void 0===y?"default":y,b=t.playoutType,m=t.context,I=t.authorizationToken,n?l(n):f(e),e||(e=this.utils.DecodeVersionHash(n).objectId),Q.next=5,s.awrap(this.PlayoutOptions({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:o,protocols:c,drms:d,handler:h,offering:g,playoutType:b,hlsjsProfile:!1,context:m,authorizationToken:I}));case 5:return delete(C=Q.sent).playoutMethods,Q.next=9,s.awrap(this.PlayoutPathResolution({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:o,handler:h,offering:g,authorizationToken:I}));case 9:if(v=Q.sent,w=v.linkTarget,E=[],I&&E.push(I),!o&&w.versionHash){Q.next=21;break}return Q.t0=E,Q.next=17,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken}));case 17:Q.t1=Q.sent,Q.t0.push.call(Q.t0,Q.t1),Q.next=26;break;case 21:return Q.t2=E,Q.next=24,s.awrap(this.authClient.AuthorizationToken({libraryId:w.libraryId,objectId:w.objectId,channelAuth:!0,oauthToken:this.oauthToken}));case 24:Q.t3=Q.sent,Q.t2.push.call(Q.t2,Q.t3);case 26:return B={drm:{}},Object.keys(C).forEach((function(t){var e=C[t];B[t]=e.playoutUrl,e.drms&&Object.keys(e.drms).forEach((function(t){if(e.drms[t].licenseServers&&0!==e.drms[t].licenseServers.length){var n=function(t){return t.toLowerCase().startsWith("https")},r=e.drms[t].licenseServers;r.find(n)&&(r=r.filter(n));var a=r.sort((function(){return.5-Math.random()}))[0];B.drm[t]||(B.drm[t]={LA_URL:a,headers:{Authorization:"Bearer ".concat(E.flat().filter((function(t){return t})).join(","))}})}}))})),Q.abrupt("return",B);case 29:case"end":return Q.stop()}}),null,this)},e.CallBitcodeMethod=function(t){var e,n,r,a,i,o,u,A,d,p,f,l,h,y,b,m;return s.async((function(I){for(;;)switch(I.prev=I.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.method,o=t.queryParams,u=void 0===o?{}:o,A=t.body,d=void 0===A?{}:A,p=t.headers,f=void 0===p?{}:p,l=t.constant,h=void 0===l||l,y=t.format,b=void 0===y?"json":y,g({libraryId:e,objectId:n,versionHash:r}),i){I.next=4;break}throw"Bitcode method not specified";case 4:if(r&&(n=this.utils.DecodeVersionHash(r).objectId),m=c("q",a||r||n,"call",i),e&&(m=c("qlibs",e,m)),f.authorization||f.Authorization){I.next=12;break}return I.next=11,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,update:!h}));case 11:f.Authorization=I.sent.Authorization;case 12:return this.Log("Calling bitcode method: ".concat(e||""," ").concat(n||r," ").concat(a||"","\n ").concat(h?"GET":"POST"," ").concat(m,"\n Query Params:\n ").concat(JSON.stringify(u||""),"\n Body:\n ").concat(JSON.stringify(d||""),"\n Headers\n ").concat(JSON.stringify(f||""))),I.t0=this.utils,I.t1=b,I.next=17,s.awrap(this.HttpClient.Request({body:d,headers:f,method:h?"GET":"POST",path:m,queryParams:u,failover:!1}));case 17:return I.t2=I.sent,I.abrupt("return",I.t0.ResponseToFormat.call(I.t0,I.t1,I.t2));case 19:case"end":return I.stop()}}),null,this)},e.Rep=function(t){var e,n,r,a,i,o,u,c,A,d,p,f;return s.async((function(s){for(;;)switch(s.prev=s.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.rep,i=t.queryParams,o=void 0===i?{}:i,u=t.channelAuth,c=void 0!==u&&u,A=t.noAuth,d=void 0!==A&&A,p=t.noCache,f=void 0!==p&&p,g({libraryId:e,objectId:n,versionHash:r}),a){s.next=4;break}throw"Rep not specified";case 4:return s.abrupt("return",this.FabricUrl({libraryId:e,objectId:n,versionHash:r,rep:a,queryParams:o,channelAuth:c,noAuth:d,noCache:f}));case 5:case"end":return s.stop()}}),null,this)},e.PublicRep=function(t){var e,n,r,a,i,o;return s.async((function(s){for(;;)switch(s.prev=s.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.rep,i=t.queryParams,o=void 0===i?{}:i,g({libraryId:e,objectId:n,versionHash:r}),a){s.next=4;break}throw"Rep not specified";case 4:return s.abrupt("return",this.FabricUrl({libraryId:e,objectId:n,versionHash:r,publicRep:a,queryParams:o,noAuth:!0}));case 5:case"end":return s.stop()}}),null,this)},e.FabricUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,y,b,m,I,C,v;return s.async((function(w){for(;;)switch(w.prev=w.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.partHash,o=t.rep,A=t.publicRep,d=t.call,p=t.queryParams,f=void 0===p?{}:p,l=t.channelAuth,h=void 0!==l&&l,y=t.noAuth,b=void 0!==y&&y,m=t.noCache,I=void 0!==m&&m,(n||r)&&g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),this.Log("Building Fabric URL:\n libraryId: ".concat(e,"\n objectId: ").concat(n,"\n versionHash: ").concat(r,"\n writeToken: ").concat(a,"\n partHash: ").concat(i,"\n rep: ").concat(o,"\n publicRep: ").concat(A,"\n call: ").concat(d,"\n channelAuth: ").concat(h,"\n noAuth: ").concat(b,"\n noCache: ").concat(I,"\n queryParams: ").concat(JSON.stringify(f||{},null,2))),C=[],f.authorization&&C.push(f.authorization),b&&f.authorization){w.next=12;break}return w.t0=C,w.next=10,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,channelAuth:h,noAuth:b,noCache:I}));case 10:w.t1=w.sent,w.t0.push.call(w.t0,w.t1);case 12:if(f=u({},f,{authorization:C.flat()}),!o&&!A||!n||r){w.next=17;break}return w.next=16,s.awrap(this.LatestVersionHash({objectId:n}));case 16:r=w.sent;case 17:return v="",e?(v=c(v,"qlibs",e),(n||r)&&(v=c(v,"q",a||r||n))):r&&(v=c("q",r)),i?v=c(v,"data",i):o?v=c(v,"rep",o):A?v=c(v,"public",A):d&&(v=c(v,"call",d)),w.abrupt("return",this.HttpClient.URL({path:v,queryParams:f}));case 21:case"end":return w.stop()}}),null,this)},e.FileUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h;return s.async((function(y){for(;;)switch(y.prev=y.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.filePath,o=t.queryParams,A=void 0===o?{}:o,d=t.noCache,p=void 0!==d&&d,g({libraryId:e,objectId:n,versionHash:r}),i){y.next=4;break}throw"File path not specified";case 4:return r&&(n=this.utils.DecodeVersionHash(r).objectId),f=e?c("qlibs",e,"q",a||r||n):c("q",r),y.next=8,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,noCache:p}));case 8:return l=y.sent,A=u({},A,{authorization:l}),y.next=12,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:c("files",i)}));case 12:return h=y.sent,h&&h["."].encryption&&"cgck"===h["."].encryption.scheme?(f=c(f,"rep","files_download",i),A["header-x_decryption_mode"]="decrypt"):f=c(f,"files",i),y.abrupt("return",this.HttpClient.URL({path:f,queryParams:A}));case 16:case"end":return y.stop()}}),null,this)},e.ContentObjectImageUrl=function(t){var e,n,r,a,i,o,u;return s.async((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.height,i=t.imagePath,o=void 0===i?"public/display_image":i,g({libraryId:e,objectId:n,versionHash:r}),r){c.next=6;break}return c.next=5,s.awrap(this.LatestVersionHash({objectId:n}));case 5:r=c.sent;case 6:if(this.Log("Retrieving content object image url: ".concat(e," ").concat(n," ").concat(r)),this.objectImageUrls[r]){c.next=26;break}return c.prev=8,c.next=11,s.awrap(this.ContentObjectMetadata({versionHash:r,metadataSubtree:o}));case 11:if(c.sent){c.next=15;break}return this.Log("No image url set: ".concat(e," ").concat(n," ").concat(r)),c.abrupt("return");case 15:c.next=21;break;case 17:c.prev=17,c.t0=c.catch(8),this.Log("Unable to query for image metadata: ".concat(e," ").concat(n," ").concat(r),!0),this.Log(c.t0,!0);case 21:return u={},a&&!isNaN(parseInt(a))&&(u.height=parseInt(a)),c.next=25,s.awrap(this.LinkUrl({versionHash:r,linkPath:o,queryParams:u}));case 25:this.objectImageUrls[r]=c.sent;case 26:return c.abrupt("return",this.objectImageUrls[r]);case 27:case"end":return c.stop()}}),null,this,[[8,17]])},e.ContentObjectGraph=function(t){var e,n,r,a,i,o,u,A,d,p,f=this;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.autoUpdate,i=void 0!==a&&a,o=t.select,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object graph: ".concat(e||""," ").concat(n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),u=c("q",r||n,"links"),l.prev=5,l.t0=s,l.t1=this.utils,l.t2=this.HttpClient,l.next=11,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 11:return l.t3=l.sent,l.t4={auto_update:i,select:o},l.t5=u,l.t6={headers:l.t3,queryParams:l.t4,method:"GET",path:l.t5},l.t7=l.t2.Request.call(l.t2,l.t6),l.t8=l.t1.ResponseToJson.call(l.t1,l.t7),l.next=19,l.t0.awrap.call(l.t0,l.t8);case 19:return l.abrupt("return",l.sent);case 22:if(l.prev=22,l.t9=l.catch(5),l.prev=24,(d=l.t9.body.errors[0].cause.cause.cause.cycle)&&0!==d.length){l.next=28;break}throw l.t9;case 28:return p={},l.next=31,s.awrap(Promise.all(d.map((function(t){var e,n;return s.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(!p[t]){r.next=2;break}return r.abrupt("return");case 2:return e=f.utils.DecodeVersionHash(t).objectId,r.next=5,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/asset_metadata/display_title"}));case 5:if(r.t2=r.sent,r.t2){r.next=10;break}return r.next=9,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/name"}));case 9:r.t2=r.sent;case 10:if(r.t1=r.t2,r.t1){r.next=15;break}return r.next=14,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"name"}));case 14:r.t1=r.sent;case 15:if(r.t0=r.t1,r.t0){r.next=18;break}r.t0=e;case 18:n=r.t0,p[t]={name:n,objectId:e};case 20:case"end":return r.stop()}}))}))));case 31:A=d.map((function(t){return"".concat(p[t].name," (").concat(p[t].objectId,")")})),l.next=37;break;case 34:throw l.prev=34,l.t10=l.catch(24),l.t9;case 37:throw new Error("Cycle found in links: ".concat(A.join(" -> ")));case 38:case"end":return l.stop()}}),null,this,[[5,22],[24,34]])},e.LinkTarget=function(t){var e,n,r,i,o,u,c,A,d;return s.async((function(p){for(;;)switch(p.prev=p.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,i=t.writeToken,o=t.linkPath,u=t.authorizationToken,c=t.linkInfo,g({libraryId:e,objectId:n,versionHash:r}),i&&y(i),r&&(n=this.utils.DecodeVersionHash(r).objectId),!i||e){p.next=8;break}return p.next=7,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 7:e=p.sent;case 8:if(c){p.next=12;break}return p.next=11,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:o,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:u}));case 11:c=p.sent;case 12:if(!c||!c["/"]){p.next=27;break}if((A=((c["/"]||"").match(/^\/?qfab\/([\w]+)\/?.+/)||[])[1])||(A=c["."].container),!A){p.next=19;break}return p.abrupt("return",A);case 19:if(!r){p.next=21;break}return p.abrupt("return",r);case 21:if(p.t0=r,p.t0){p.next=26;break}return p.next=25,s.awrap(this.LatestVersionHash({objectId:n}));case 25:p.t0=p.sent;case 26:return p.abrupt("return",p.t0);case 27:return p.next=29,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:o,resolveIncludeSource:!0,authorizationToken:u}));case 29:if((c=p.sent)&&c["."]){p.next=49;break}if("object"!==a(c)){p.next=38;break}if(p.t1=r,p.t1){p.next=37;break}return p.next=36,s.awrap(this.LatestVersionHash({objectId:n}));case 36:p.t1=p.sent;case 37:return p.abrupt("return",p.t1);case 38:if(d=o.split("/").slice(0,-1).join("/")){p.next=46;break}if(p.t2=r,p.t2){p.next=45;break}return p.next=44,s.awrap(this.LatestVersionHash({objectId:n}));case 44:p.t2=p.sent;case 45:return p.abrupt("return",p.t2);case 46:return p.next=48,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:d,resolveIncludeSource:!0,authorizationToken:u}));case 48:c=p.sent;case 49:return p.abrupt("return",c["."].source);case 50:case"end":return p.stop()}}),null,this)},e.LinkUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,b,m,I;return s.async((function(C){for(;;)switch(C.prev=C.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.mimeType,A=t.authorizationToken,d=t.queryParams,p=void 0===d?{}:d,f=t.channelAuth,l=void 0!==f&&f,h=t.noAuth,b=void 0!==h&&h,g({libraryId:e,objectId:n,versionHash:r}),a&&y(a),i){C.next=5;break}throw Error("Link path not specified");case 5:return r&&(n=this.utils.DecodeVersionHash(r).objectId),m=e?c("qlibs",e,"q",a||r||n,"meta",i):c("q",r,"meta",i),I=[A],C.t0=I,C.next=11,s.awrap(this.MetadataAuth({libraryId:e,objectId:n,versionHash:r,path:i,channelAuth:l,noAuth:b}));case 11:return C.t1=C.sent,C.t0.push.call(C.t0,C.t1),p.authorization&&I.push(p.authorization),p=u({},p,{authorization:I.flat().filter((function(t){return t})),resolve:!0}),o&&(p["header-accept"]=o),C.abrupt("return",this.HttpClient.URL({path:m,queryParams:p}));case 17:case"end":return C.stop()}}),null,this)},e.LinkData=function(t){var e,n,r,a,i,o,u,c,d,p,f;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.queryParams,u=void 0===o?{}:o,c=t.format,d=void 0===c?"json":c,p=t.channelAuth,l.next=3,s.awrap(this.LinkUrl({libraryId:e,objectId:n,versionHash:r,writeToken:a,linkPath:i,queryParams:u,channelAuth:p}));case 3:return f=l.sent,l.t0=this.utils,l.t1=d,l.next=8,s.awrap(A.Fetch(f));case 8:return l.t2=l.sent,l.abrupt("return",l.t0.ResponseToFormat.call(l.t0,l.t1,l.t2));case 10:case"end":return l.stop()}}),null,this)},e.CreateEncryptionConk=function(t){var e,n,r,a,i,o,u,c,A,d,p;return s.async((function(f){for(;;)switch(f.prev=f.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.createKMSConk,o=void 0===i||i,g({libraryId:e,objectId:n,versionHash:r}),y(a),n||(n=client.DecodeVersionHash(r).objectId),e){f.next=8;break}return f.next=7,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 7:e=f.sent;case 8:return u="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=11,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,writeToken:a,metadataSubtree:u}));case 11:if(!(c=f.sent)){f.next=18;break}return f.next=15,s.awrap(this.Crypto.DecryptCap(c,this.signer.signingKey.privateKey));case 15:this.encryptionConks[n]=f.sent,f.next=34;break;case 18:return f.next=20,s.awrap(this.Crypto.GeneratePrimaryConk({spaceId:this.contentSpaceId,objectId:n}));case 20:return this.encryptionConks[n]=f.sent,f.t0=s,f.t1=this,f.t2=e,f.t3=n,f.t4=a,f.t5=u,f.next=29,s.awrap(this.Crypto.EncryptConk(this.encryptionConks[n],this.signer.signingKey.publicKey));case 29:return f.t6=f.sent,f.t7={libraryId:f.t2,objectId:f.t3,writeToken:f.t4,metadataSubtree:f.t5,metadata:f.t6},f.t8=f.t1.ReplaceMetadata.call(f.t1,f.t7),f.next=34,f.t0.awrap.call(f.t0,f.t8);case 34:if(!o){f.next=66;break}return f.prev=35,f.next=38,s.awrap(this.authClient.KMSAddress({objectId:n}));case 38:return A=f.sent,f.next=41,s.awrap(this.authClient.KMSInfo({objectId:n}));case 41:return d=f.sent.publicKey,p="eluv.caps.ikms".concat(this.utils.AddressToHash(A)),f.next=45,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,writeToken:a,metadataSubtree:p}));case 45:if(f.sent){f.next=60;break}return f.t9=s,f.t10=this,f.t11=e,f.t12=n,f.t13=a,f.t14=p,f.next=55,s.awrap(this.Crypto.EncryptConk(this.encryptionConks[n],d));case 55:return f.t15=f.sent,f.t16={libraryId:f.t11,objectId:f.t12,writeToken:f.t13,metadataSubtree:f.t14,metadata:f.t15},f.t17=f.t10.ReplaceMetadata.call(f.t10,f.t16),f.next=60,f.t9.awrap.call(f.t9,f.t17);case 60:f.next=66;break;case 62:f.prev=62,f.t18=f.catch(35),console.error("Failed to create encryption cap for KMS:"),console.error(f.t18);case 66:return f.abrupt("return",this.encryptionConks[n]);case 67:case"end":return f.stop()}}),null,this,[[35,62]])},e.EncryptionConk=function(t){var e,n,r,a,i,o,u,c,A,d,p;return s.async((function(f){for(;;)switch(f.prev=f.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.download,o=void 0!==i&&i,g({libraryId:e,objectId:n,versionHash:r}),a&&y(a),n||(n=client.DecodeVersionHash(r).objectId),f.next=6,s.awrap(this.authClient.Owner({id:n}));case 6:return u=f.sent,c="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=10,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,metadataSubtree:c}));case 10:if(A=f.sent,this.utils.EqualAddress(u,this.signer.address)||A){f.next=21;break}if(!o){f.next=18;break}return f.next=15,s.awrap(this.authClient.ReEncryptionConk({libraryId:e,objectId:n,versionHash:r}));case 15:return f.abrupt("return",f.sent);case 18:return f.next=20,s.awrap(this.authClient.EncryptionConk({libraryId:e,objectId:n,versionHash:r}));case 20:return f.abrupt("return",f.sent);case 21:if(this.encryptionConks[n]){f.next=38;break}return d="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=25,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:d}));case 25:if(!(p=f.sent)){f.next=32;break}return f.next=29,s.awrap(this.Crypto.DecryptCap(p,this.signer.signingKey.privateKey));case 29:this.encryptionConks[n]=f.sent,f.next=38;break;case 32:if(!a){f.next=37;break}return f.next=35,s.awrap(this.CreateEncryptionConk({libraryId:e,objectId:n,versionHash:r,writeToken:a,createKMSConk:!1}));case 35:f.next=38;break;case 37:throw"No encryption conk present for "+n;case 38:return f.abrupt("return",this.encryptionConks[n]);case 39:case"end":return f.stop()}}),null,this)},e.Encrypt=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.writeToken,a=t.chunk,g({libraryId:e,objectId:n}),u.next=4,s.awrap(this.EncryptionConk({libraryId:e,objectId:n,writeToken:r}));case 4:return i=u.sent,u.next=7,s.awrap(this.Crypto.Encrypt(i,a));case 7:return o=u.sent,u.abrupt("return",o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength));case 9:case"end":return u.stop()}}),null,this)},e.Decrypt=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.writeToken,a=t.chunk,g({libraryId:e,objectId:n}),u.next=4,s.awrap(this.EncryptionConk({libraryId:e,objectId:n,writeToken:r,download:!0}));case 4:return i=u.sent,u.next=7,s.awrap(this.Crypto.Decrypt(i,a));case 7:return o=u.sent,u.abrupt("return",o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength));case 9:case"end":return u.stop()}}),null,this)},e.AccessType=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.id,n.next=3,s.awrap(this.authClient.AccessType(e));case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),null,this)},e.AccessInfo=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.objectId,n=t.args,f(e),n||(n=[0,[],[]]),this.Log("Retrieving access info: ".concat(e)),a.next=6,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"getAccessInfo",methodArgs:n}));case 6:return r=a.sent,this.Log(r),a.abrupt("return",{visibilityCode:r[0],visible:r[0]>=1,accessible:r[0]>=10,editable:r[0]>=100,hasAccess:0===r[1],accessCode:r[1],accessCharge:this.utils.WeiToEther(r[2]).toString()});case 9:case"end":return a.stop()}}),null,this)},e.AccessRequest=function(t){var e,n,r,a,i,o,u,c,A;return s.async((function(d){for(;;)switch(d.prev=d.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.args,i=void 0===a?[]:a,o=t.update,u=void 0!==o&&o,c=t.noCache,A=void 0!==c&&c,g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),d.next=5,s.awrap(this.authClient.MakeAccessRequest({libraryId:e,objectId:n,versionHash:r,args:i,update:u,skipCache:!0,noCache:A}));case 5:return d.abrupt("return",d.sent);case 6:case"end":return d.stop()}}),null,this)},e.SetAuthContext=function(t){var e=t.context;if(e&&Object.values(e).find((function(t){return"string"!=typeof t})))throw Error("Context must be a map of string->string");this.authContext=e},e.GenerateStateChannelToken=function(t){var e,n,r,a,i;return s.async((function(o){for(;;)switch(o.prev=o.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.context,a=t.noCache,i=void 0!==a&&a,n?l(n):f(e),!n){o.next=6;break}e=this.utils.DecodeVersionHash(n).objectId,o.next=10;break;case 6:if(this.stateChannelAccess[e]){o.next=10;break}return o.next=9,s.awrap(this.LatestVersionHash({objectId:e}));case 9:n=o.sent;case 10:return this.stateChannelAccess[e]=n,o.next=13,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken,context:r,noCache:i}));case 13:return o.abrupt("return",o.sent);case 14:case"end":return o.stop()}}),null,this)},e.FinalizeStateChannelAccess=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.percentComplete,n?l(n):f(e),!n){a.next=6;break}e=this.utils.DecodeVersionHash(n).objectId,a.next=13;break;case 6:if(!this.stateChannelAccess[e]){a.next=10;break}n=this.stateChannelAccess[e],a.next=13;break;case 10:return a.next=12,s.awrap(this.LatestVersionHash({objectId:e}));case 12:n=a.sent;case 13:return this.stateChannelAccess[e]=void 0,a.next=16,s.awrap(this.authClient.ChannelContentFinalize({objectId:e,versionHash:n,percent:r}));case 16:case"end":return a.stop()}}),null,this)},e.ContentObjectAccessComplete=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(e=t.objectId,n=t.score,r=void 0===n?100:n,f(e),!(r<0||r>100)){a.next=4;break}throw Error("Invalid AccessComplete score: "+r);case 4:return a.next=6,s.awrap(this.authClient.AccessComplete({id:e,score:r}));case 6:return a.abrupt("return",a.sent);case 7:case"end":return a.stop()}}),null,this)},e.Collection=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(e=t.collectionType,["accessGroups","contentObjects","contentTypes","contracts","libraries"].includes(e)){n.next=4;break}throw new Error("Invalid collection type: "+e);case 4:if(!this.signer){n.next=10;break}return n.next=7,s.awrap(this.userProfileClient.WalletAddress());case 7:n.t0=n.sent,n.next=11;break;case 10:n.t0=void 0;case 11:if(n.t0){n.next=14;break}throw new Error("Unable to get collection: User wallet doesn't exist");case 14:return this.Log("Retrieving ".concat(e," contract collection for user ").concat(this.signer.address)),n.next=17,s.awrap(this.ethClient.MakeProviderCall({methodName:"send",args:["elv_getWalletCollection",[this.contentSpaceId,"iusr".concat(this.utils.AddressToHash(this.signer.address)),e]]}));case 17:if(n.t1=n.sent,n.t1){n.next=20;break}n.t1=[];case 20:return n.abrupt("return",n.t1);case 21:case"end":return n.stop()}}),null,this)},e.VerifyContentObject=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,g({libraryId:e,objectId:n,versionHash:r}),a.next=4,s.awrap(ContentObjectVerification.VerifyContentObject({client:this,libraryId:e,objectId:n,versionHash:r}));case 4:return a.abrupt("return",a.sent);case 5:case"end":return a.stop()}}),null,this)},e.Proofs=function(t){var e,n,r,a,i;return s.async((function(o){for(;;)switch(o.prev=o.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.partHash,g({libraryId:e,objectId:n,versionHash:r}),h(a),r&&(n=this.utils.DecodeVersionHash(r).objectId),i=c("q",r||n,"data",a,"proofs"),o.t0=this.utils,o.t1=this.HttpClient,o.next=9,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 9:return o.t2=o.sent,o.t3=i,o.t4={headers:o.t2,method:"GET",path:o.t3},o.t5=o.t1.Request.call(o.t1,o.t4),o.abrupt("return",o.t0.ResponseToJson.call(o.t0,o.t5));case 14:case"end":return o.stop()}}),null,this)},e.QParts=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.partHash,a=t.format,i=void 0===a?"blob":a,g({libraryId:e,objectId:n,versionHash:versionHash}),h(r),o=c("qparts",r),u.t0=this.utils,u.t1=i,u.t2=this.HttpClient,u.next=9,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,partHash:r}));case 9:return u.t3=u.sent,u.t4=o,u.t5={headers:u.t3,method:"GET",path:u.t4},u.t6=u.t2.Request.call(u.t2,u.t5),u.abrupt("return",u.t0.ResponseToFormat.call(u.t0,u.t1,u.t6));case 14:case"end":return u.stop()}}),null,this)}},function(t,e,n){var r=n(54)(n(25),"Map");t.exports=r},function(t,e,n){var r=n(25).Symbol;t.exports=r},function(t,e,n){(function(e){function n(t){return(n="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)}var r="object"==(void 0===e?"undefined":n(e))&&e&&e.Object===Object&&e;t.exports=r}).call(this,n(5))},function(t,e,n){var r=n(56),a=n(41);t.exports=function(t,e,n){(void 0===n||a(t[e],n))&&(void 0!==n||e in t)||r(t,e,n)}},function(t,e,n){var r=n(54),a=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=a},function(t,e,n){var r=n(230)(Object.getPrototypeOf,Object);t.exports=r},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(231),a=n(31),i=Object.prototype,s=i.hasOwnProperty,o=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return a(t)&&s.call(t,"callee")&&!o.call(t,"callee")};t.exports=u},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,n){(function(t){function r(t){return(r="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)}var a=n(25),i=n(233),s="object"==r(e)&&e&&!e.nodeType&&e,o=s&&"object"==r(t)&&t&&!t.nodeType&&t,u=o&&o.exports===s?a.Buffer:void 0,c=(u?u.isBuffer:void 0)||i;t.exports=c}).call(this,n(10)(t))},function(t,e,n){var r=n(235),a=n(236),i=n(237),s=i&&i.isTypedArray,o=s?a(s):r;t.exports=o},function(t,e){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},function(t,e,n){var r=n(241),a=n(243),i=n(57);t.exports=function(t){return i(t)?r(t,!0):a(t)}},function(t,e){function n(t){return(n="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)}var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var a=n(t);return!!(e=null==e?9007199254740991:e)&&("number"==a||"symbol"!=a&&r.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,n){"use strict";(function(e,r){var a=n(46);t.exports=m;var i,s=n(51);m.ReadableState=b;n(32).EventEmitter;var o=function(t,e){return t.listeners(e).length},u=n(101),c=n(59).Buffer,A=e.Uint8Array||function(){};var d=n(33);d.inherits=n(0);var p=n(261),f=void 0;f=p&&p.debuglog?p.debuglog("stream"):function(){};var l,h=n(262),y=n(102);d.inherits(m,u);var g=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var r=e instanceof(i=i||n(21));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var a=t.highWaterMark,s=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:r&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(34).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(i=i||n(21),!(this instanceof m))return new m(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function I(t,e,n,r,a){var i,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,w(t)}(t,s)):(a||(i=function(t,e){var n;r=e,c.isBuffer(r)||r instanceof A||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,e)),i?t.emit("error",i):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):C(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?C(t,s,e,!1):B(t,s)):C(t,s,e,!1))):r||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(s)}function C(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&w(t)),B(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=y.destroy,m.prototype._undestroy=y.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),I(this,t,e,!1,n)},m.prototype.unshift=function(t){return I(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=n(34).StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};function v(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function w(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?a.nextTick(E,t):E(t))}function E(t){f("emit readable"),t.emit("readable"),x(t)}function B(t,e){e.readingMore||(e.readingMore=!0,a.nextTick(Q,t,e))}function Q(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(f("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function M(t){f("readable nexttick read 0"),t.read(0)}function _(t,e){e.reading||(f("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function k(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,a=n.data;t-=a.length;for(;n=n.next;){var i=n.data,s=t>i.length?i.length:t;if(s===i.length?a+=i:a+=i.slice(0,t),0===(t-=s)){s===i.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=i.slice(s));break}++r}return e.length-=r,a}(t,e):function(t,e){var n=c.allocUnsafe(t),r=e.head,a=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(n,n.length-t,0,s),0===(t-=s)){s===i.length?(++a,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=i.slice(s));break}++a}return e.length-=a,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function S(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,a.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}m.prototype.read=function(t){f("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?S(this):w(this),null;if(0===(t=v(t,e))&&e.ended)return 0===e.length&&S(this),null;var r,a=e.needReadable;return f("need readable",a),(0===e.length||e.length-t<e.highWaterMark)&&f("length less than watermark",a=!0),e.ended||e.reading?f("reading or ended",a=!1):a&&(f("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=v(n,e))),null===(r=t>0?k(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&S(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?A:m;function c(e,r){f("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",b),t.removeListener("drain",d),t.removeListener("error",y),t.removeListener("unpipe",c),n.removeListener("end",A),n.removeListener("end",m),n.removeListener("data",h),p=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function A(){f("onend"),t.end()}i.endEmitted?a.nextTick(u):n.once("end",u),t.on("unpipe",c);var d=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,x(t))}}(n);t.on("drain",d);var p=!1;var l=!1;function h(e){f("ondata"),l=!1,!1!==t.write(e)||l||((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==R(i.pipes,t))&&!p&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,l=!0),n.pause())}function y(e){f("onerror",e),m(),t.removeListener("error",y),0===o(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",b),m()}function b(){f("onfinish"),t.removeListener("close",g),m()}function m(){f("unpipe"),n.unpipe(t)}return n.on("data",h),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",y),t.once("close",g),t.once("finish",b),t.emit("pipe",n),i.flowing||(f("pipe resume"),n.resume()),t},m.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,a=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<a;i++)r[i].emit("unpipe",this,n);return this}var s=R(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n),this)},m.prototype.on=function(t,e){var n=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&w(this):a.nextTick(M,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,a.nextTick(_,t,e))}(this,t)),this},m.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var a in t.on("end",(function(){if(f("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(a){(f("wrapped data"),n.decoder&&(a=n.decoder.write(a)),n.objectMode&&null==a)||(n.objectMode||a&&a.length)&&(e.push(a)||(r=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function(e){return function(){return t[e].apply(t,arguments)}}(a));for(var i=0;i<g.length;i++)t.on(g[i],this.emit.bind(this,g[i]));return this._read=function(e){f("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=k}).call(this,n(5),n(6))},function(t,e,n){t.exports=n(32).EventEmitter},function(t,e,n){"use strict";var r=n(46);function a(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(a,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(r.nextTick(a,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(5))},function(t,e,n){"use strict";t.exports=s;var r=n(21),a=n(33);function i(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function s(t){if(!(this instanceof s))return new s(t);r.call(this,t),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",o)}function o(){var t=this;"function"==typeof this._flush?this._flush((function(e,n){u(t,e,n)})):u(this,null,null)}function u(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}a.inherits=n(0),a.inherits(s,r),s.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},s.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var a=this._readableState;(r.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},s.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},s.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,(function(t){e(t),n.emit("close")}))}},function(t,e,n){"use strict";var r=n(1).Buffer,a=n(45).Transform;function i(t){a.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(0)(i,a),i.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,a=0;this._blockOffset+t.length-a>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=t[a++];this._update(),this._blockOffset=0}for(;a<t.length;)n[this._blockOffset++]=t[a++];for(var s=0,o=8*t.length;o>0;++s)this._length[s]+=o,(o=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*o);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=i},function(t,e,n){var r=n(0),a=n(27),i=n(1).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=new Array(64);function u(){this.init(),this._w=o,a.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function A(t,e,n){return t&e|n&(t|e)}function d(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function p(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,a),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,o=0|this._d,u=0|this._e,l=0|this._f,h=0|this._g,y=0|this._h,g=0;g<16;++g)n[g]=t.readInt32BE(4*g);for(;g<64;++g)n[g]=0|(((e=n[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[g-7]+f(n[g-15])+n[g-16];for(var b=0;b<64;++b){var m=y+p(u)+c(u,l,h)+s[b]+n[b]|0,I=d(r)+A(r,a,i)|0;y=h,h=l,l=u,u=o+m|0,o=i,i=a,a=r,r=m+I|0}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=u+this._e|0,this._f=l+this._f|0,this._g=h+this._g|0,this._h=y+this._h|0},u.prototype._hash=function(){var t=i.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,n){var r=n(0),a=n(27),i=n(1).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],o=new Array(160);function u(){this.init(),this._w=o,a.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function A(t,e,n){return t&e|n&(t|e)}function d(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function p(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function h(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}r(u,a),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,a=0|this._ch,i=0|this._dh,o=0|this._eh,u=0|this._fh,b=0|this._gh,m=0|this._hh,I=0|this._al,C=0|this._bl,v=0|this._cl,w=0|this._dl,E=0|this._el,B=0|this._fl,Q=0|this._gl,M=0|this._hl,_=0;_<32;_+=2)e[_]=t.readInt32BE(4*_),e[_+1]=t.readInt32BE(4*_+4);for(;_<160;_+=2){var x=e[_-30],k=e[_-30+1],S=f(x,k),D=l(k,x),R=h(x=e[_-4],k=e[_-4+1]),N=y(k,x),T=e[_-14],O=e[_-14+1],H=e[_-32],L=e[_-32+1],U=D+O|0,F=S+T+g(U,D)|0;F=(F=F+R+g(U=U+N|0,N)|0)+H+g(U=U+L|0,L)|0,e[_]=F,e[_+1]=U}for(var j=0;j<160;j+=2){F=e[j],U=e[j+1];var P=A(n,r,a),G=A(I,C,v),Y=d(n,I),q=d(I,n),K=p(o,E),z=p(E,o),J=s[j],V=s[j+1],W=c(o,u,b),Z=c(E,B,Q),X=M+z|0,$=m+K+g(X,M)|0;$=($=($=$+W+g(X=X+Z|0,Z)|0)+J+g(X=X+V|0,V)|0)+F+g(X=X+U|0,U)|0;var tt=q+G|0,et=Y+P+g(tt,q)|0;m=b,M=Q,b=u,Q=B,u=o,B=E,o=i+$+g(E=w+X|0,w)|0,i=a,w=v,a=r,v=C,r=n,C=I,n=$+et+g(I=X+tt|0,X)|0}this._al=this._al+I|0,this._bl=this._bl+C|0,this._cl=this._cl+v|0,this._dl=this._dl+w|0,this._el=this._el+E|0,this._fl=this._fl+B|0,this._gl=this._gl+Q|0,this._hl=this._hl+M|0,this._ah=this._ah+n+g(this._al,I)|0,this._bh=this._bh+r+g(this._bl,C)|0,this._ch=this._ch+a+g(this._cl,v)|0,this._dh=this._dh+i+g(this._dl,w)|0,this._eh=this._eh+o+g(this._el,E)|0,this._fh=this._fh+u+g(this._fl,B)|0,this._gh=this._gh+b+g(this._gl,Q)|0,this._hh=this._hh+m+g(this._hl,M)|0},u.prototype._hash=function(){var t=i.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,n){var r=n(61);t.exports=function(t){return(new r).update(t).digest()}},function(t,e,n){t.exports=n(110)},function(t){t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(t,e,n){(function(e){var n=Math.pow(2,30)-1;function r(t,n){if("string"!=typeof t&&!e.isBuffer(t))throw new TypeError(n+" must be a buffer or string")}t.exports=function(t,e,a,i){if(r(t,"Password"),r(e,"Salt"),"number"!=typeof a)throw new TypeError("Iterations not a number");if(a<0)throw new TypeError("Bad iterations");if("number"!=typeof i)throw new TypeError("Key length not a number");if(i<0||i>n||i!=i)throw new TypeError("Bad key length")}}).call(this,n(2).Buffer)},function(t,e,n){(function(e){var n;e.browser?n="utf-8":n=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";t.exports=n}).call(this,n(6))},function(t,e,n){var r=n(108),a=n(62),i=n(63),s=n(111),o=n(112),u=n(1).Buffer,c=u.alloc(128),A={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,n){var s=function(t){function e(e){return i(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new a).update(t).digest()}:"md5"===t?r:e}(t),o="sha512"===t||"sha384"===t?128:64;e.length>o?e=s(e):e.length<o&&(e=u.concat([e,c],o));for(var d=u.allocUnsafe(o+A[t]),p=u.allocUnsafe(o+A[t]),f=0;f<o;f++)d[f]=54^e[f],p[f]=92^e[f];var l=u.allocUnsafe(o+n+4);d.copy(l,0,0,o),this.ipad1=l,this.ipad2=d,this.opad=p,this.alg=t,this.blocksize=o,this.hash=s,this.size=A[t]}d.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,n,r,a){s(t,e,n,r),u.isBuffer(t)||(t=u.from(t,o)),u.isBuffer(e)||(e=u.from(e,o));var i=new d(a=a||"sha1",t,e.length),c=u.allocUnsafe(r),p=u.allocUnsafe(e.length+4);e.copy(p,0,0,e.length);for(var f=0,l=A[a],h=Math.ceil(r/l),y=1;y<=h;y++){p.writeUInt32BE(y,e.length);for(var g=i.run(p,i.ipad1),b=g,m=1;m<n;m++){b=i.run(b,i.ipad2);for(var I=0;I<l;I++)g[I]^=b[I]}g.copy(c,f),f+=l}return c}},function(t,e,n){var r=n(278),a=n(67),i=n(68),s=n(291),o=n(48);function u(t,e,n){if(t=t.toLowerCase(),i[t])return a.createCipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),i[t])return a.createDecipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),i[t])n=i[t].key,r=i[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var a=o(e,!1,n,r);return u(t,a.key,a.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),i[t])n=i[t].key,r=i[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var a=o(e,!1,n,r);return c(t,a.key,a.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(a.getCiphers())}},function(t,e,n){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var a=0,i=0,s=6;s>=0;s-=2){for(var o=0;o<=24;o+=8)a<<=1,a|=e>>>o+s&1;for(o=0;o<=24;o+=8)a<<=1,a|=t>>>o+s&1}for(s=6;s>=0;s-=2){for(o=1;o<=25;o+=8)i<<=1,i|=e>>>o+s&1;for(o=1;o<=25;o+=8)i<<=1,i|=t>>>o+s&1}n[r+0]=a>>>0,n[r+1]=i>>>0},e.rip=function(t,e,n,r){for(var a=0,i=0,s=0;s<4;s++)for(var o=24;o>=0;o-=8)a<<=1,a|=e>>>o+s&1,a<<=1,a|=t>>>o+s&1;for(s=4;s<8;s++)for(o=24;o>=0;o-=8)i<<=1,i|=e>>>o+s&1,i<<=1,i|=t>>>o+s&1;n[r+0]=a>>>0,n[r+1]=i>>>0},e.pc1=function(t,e,n,r){for(var a=0,i=0,s=7;s>=5;s--){for(var o=0;o<=24;o+=8)a<<=1,a|=e>>o+s&1;for(o=0;o<=24;o+=8)a<<=1,a|=t>>o+s&1}for(o=0;o<=24;o+=8)a<<=1,a|=e>>o+s&1;for(s=1;s<=3;s++){for(o=0;o<=24;o+=8)i<<=1,i|=e>>o+s&1;for(o=0;o<=24;o+=8)i<<=1,i|=t>>o+s&1}for(o=0;o<=24;o+=8)i<<=1,i|=t>>o+s&1;n[r+0]=a>>>0,n[r+1]=i>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,a){for(var i=0,s=0,o=r.length>>>1,u=0;u<o;u++)i<<=1,i|=t>>>r[u]&1;for(u=o;u<r.length;u++)s<<=1,s|=e>>>r[u]&1;n[a+0]=i>>>0,n[a+1]=s>>>0},e.expand=function(t,e,n){var r=0,a=0;r=(1&t)<<5|t>>>27;for(var i=23;i>=15;i-=4)r<<=6,r|=t>>>i&63;for(i=11;i>=3;i-=4)a|=t>>>i&63,a<<=6;a|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=a>>>0};var a=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,r=0;r<4;r++){n<<=4,n|=a[64*r+(t>>>18-6*r&63)]}for(r=0;r<4;r++){n<<=4,n|=a[256+64*r+(e>>>18-6*r&63)]}return n>>>0};var i=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n<i.length;n++)e<<=1,e|=t>>>i[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length<e;)r="0"+r;for(var a=[],i=0;i<e;i+=n)a.push(r.slice(i,i+n));return a.join(" ")}},function(t,e,n){"use strict";var r=n(7),a=n(0),i=n(115),s=n(66);function o(){this.tmp=new Array(2),this.keys=null}function u(t){s.call(this,t);var e=new o;this._desState=e,this.deriveKeys(e,t.key)}a(u,s),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=i.readUInt32BE(e,0),a=i.readUInt32BE(e,4);i.pc1(n,a,t.tmp,0),n=t.tmp[0],a=t.tmp[1];for(var s=0;s<t.keys.length;s+=2){var o=c[s>>>1];n=i.r28shl(n,o),a=i.r28shl(a,o),i.pc2(n,a,t.keys,s)}},u.prototype._update=function(t,e,n,r){var a=this._desState,s=i.readUInt32BE(t,e),o=i.readUInt32BE(t,e+4);i.ip(s,o,a.tmp,0),s=a.tmp[0],o=a.tmp[1],"encrypt"===this.type?this._encrypt(a,s,o,a.tmp,0):this._decrypt(a,s,o,a.tmp,0),s=a.tmp[0],o=a.tmp[1],i.writeUInt32BE(n,s,r),i.writeUInt32BE(n,o,r+4)},u.prototype._pad=function(t,e){for(var n=t.length-e,r=e;r<t.length;r++)t[r]=n;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],n=t.length-e;n<t.length;n++)r.equal(t[n],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,n,r,a){for(var s=e,o=n,u=0;u<t.keys.length;u+=2){var c=t.keys[u],A=t.keys[u+1];i.expand(o,t.tmp,0),c^=t.tmp[0],A^=t.tmp[1];var d=i.substitute(c,A),p=o;o=(s^i.permute(d))>>>0,s=p}i.rip(o,s,r,a)},u.prototype._decrypt=function(t,e,n,r,a){for(var s=n,o=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],A=t.keys[u+1];i.expand(s,t.tmp,0),c^=t.tmp[0],A^=t.tmp[1];var d=i.substitute(c,A),p=s;s=(o^i.permute(d))>>>0,o=p}i.rip(s,o,r,a)}},function(t,e,n){var r=n(35),a=n(1).Buffer,i=n(118);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return i(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),i=t._cache.length;t._cache=a.concat([t._cache,a.allocUnsafe(16*n)]);for(var o=0;o<n;o++){var u=s(t),c=i+16*o;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var A=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),r(e,A)}},function(t,e){t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,e,n){var r=n(47),a=n(1).Buffer,i=n(19),s=n(0),o=n(289),u=n(35),c=n(118);function A(t,e,n,s){i.call(this);var u=a.alloc(4,0);this._cipher=new r.AES(e);var A=this._cipher.encryptBlock(u);this._ghash=new o(A),n=function(t,e,n){if(12===e.length)return t._finID=a.concat([e,a.from([0,0,0,1])]),a.concat([e,a.from([0,0,0,2])]);var r=new o(n),i=e.length,s=i%16;r.update(e),s&&(s=16-s,r.update(a.alloc(s,0))),r.update(a.alloc(8,0));var u=8*i,A=a.alloc(8);A.writeUIntBE(u,0,8),r.update(A),t._finID=r.state;var d=a.from(t._finID);return c(d),d}(this,n,A),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(A,i),A.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=a.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},A.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),a=0;a<r;++a)n+=t[a]^e[a];return n}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},A.prototype.getAuthTag=function(){if(this._decrypt||!a.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},A.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},A.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=A},function(t,e,n){var r=n(47),a=n(1).Buffer,i=n(19);function s(t,e,n,s){i.call(this),this._cipher=new r.AES(e),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=s,this._mode=t}n(0)(s,i),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},function(t,e,n){(function(t){var r=n(123),a=n(294),i=n(295);var s={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var n=new t(a[e].prime,"hex"),r=new t(a[e].gen,"hex");return new i(n,r)},e.createDiffieHellman=e.DiffieHellman=function e(n,a,o,u){return t.isBuffer(a)||void 0===s[a]?e(n,"binary",a,o):(a=a||"binary",u=u||"binary",o=o||new t([2]),t.isBuffer(o)||(o=new t(o,u)),"number"==typeof n?new i(r(n,o),o,!0):(t.isBuffer(n)||(n=new t(n,a)),new i(n,o,!0)))}}).call(this,n(2).Buffer)},function(t,e,n){var r=n(22);t.exports=b,b.simpleSieve=y,b.fermatTest=g;var a=n(3),i=new a(24),s=new(n(124)),o=new a(1),u=new a(2),c=new a(5),A=(new a(16),new a(8),new a(10)),d=new a(3),p=(new a(7),new a(11)),f=new a(4),l=(new a(12),null);function h(){if(null!==l)return l;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),a=0;a<e&&t[a]<=r&&n%t[a]!=0;a++);e!==a&&t[a]<=r||(t[e++]=n)}return l=t,t}function y(t){for(var e=h(),n=0;n<e.length;n++)if(0===t.modn(e[n]))return 0===t.cmpn(e[n]);return!0}function g(t){var e=a.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function b(t,e){if(t<16)return new a(2===e||5===e?[140,123]:[140,39]);var n,l;for(e=new a(e);;){for(n=new a(r(Math.ceil(t/8)));n.bitLength()>t;)n.ishrn(1);if(n.isEven()&&n.iadd(o),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(A).cmp(d);)n.iadd(f)}else for(;n.mod(i).cmp(p);)n.iadd(f);if(y(l=n.shrn(1))&&y(n)&&g(l)&&g(n)&&s.test(l)&&s.test(n))return n}}},function(t,e,n){var r=n(3),a=n(69);function i(t){this.rand=t||new a.Rand}t.exports=i,i.create=function(t){return new i(t)},i.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var a=new r(this.rand.generate(n))}while(a.cmp(t)>=0);return a},i.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},i.prototype.test=function(t,e,n){var a=t.bitLength(),i=r.mont(t),s=new r(1).toRed(i);e||(e=Math.max(1,a/48|0));for(var o=t.subn(1),u=0;!o.testn(u);u++);for(var c=t.shrn(u),A=o.toRed(i);e>0;e--){var d=this._randrange(new r(2),o);n&&n(d);var p=d.toRed(i).redPow(c);if(0!==p.cmp(s)&&0!==p.cmp(A)){for(var f=1;f<u;f++){if(0===(p=p.redSqr()).cmp(s))return!1;if(0===p.cmp(A))break}if(f===u)return!1}}return!0},i.prototype.getDivisor=function(t,e){var n=t.bitLength(),a=r.mont(t),i=new r(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),o=0;!s.testn(o);o++);for(var u=t.shrn(o),c=s.toRed(a);e>0;e--){var A=this._randrange(new r(2),s),d=t.gcd(A);if(0!==d.cmpn(1))return d;var p=A.toRed(a).redPow(u);if(0!==p.cmp(i)&&0!==p.cmp(c)){for(var f=1;f<o;f++){if(0===(p=p.redSqr()).cmp(i))return p.fromRed().subn(1).gcd(t);if(0===p.cmp(c))break}if(f===o)return(p=p.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,n){(function(e){var r=n(26),a=n(45),i=n(0),s=n(296),o=n(328),u=n(110);function c(t){a.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function A(t){a.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new c(t)}function p(t){return new A(t)}Object.keys(u).forEach((function(t){u[t].id=new e(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),i(c,a.Writable),c.prototype._write=function(t,e,n){this._hash.update(t),n()},c.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=s(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},i(A,a.Writable),A.prototype._write=function(t,e,n){this._hash.update(t),n()},A.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},A.prototype.verify=function(t,n,r){"string"==typeof n&&(n=new e(n,r)),this.end();var a=this._hash.digest();return o(n,a,t,this._signType,this._tag)},t.exports={Sign:d,Verify:p,createSign:d,createVerify:p}}).call(this,n(2).Buffer)},function(t,e,n){"use strict";var r=e;function a(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n<t.length;n++)e+=a(t[n].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var a=t.charCodeAt(r),i=a>>8,s=255&a;i?n.push(i,s):n.push(s)}return n},r.zero2=a,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},function(t,e,n){"use strict";var r=e;r.base=n(49),r.short=n(298),r.mont=n(299),r.edwards=n(300)},function(t,e,n){"use strict";var r=n(11).rotr32;function a(t,e,n){return t&e^~t&n}function i(t,e,n){return t&e^t&n^e&n}function s(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?a(e,n,r):1===t||3===t?s(e,n,r):2===t?i(e,n,r):void 0},e.ch32=a,e.maj32=i,e.p32=s,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},function(t,e,n){"use strict";var r=n(11),a=n(36),i=n(128),s=n(7),o=r.sum32,u=r.sum32_4,c=r.sum32_5,A=i.ch32,d=i.maj32,p=i.s0_256,f=i.s1_256,l=i.g0_256,h=i.g1_256,y=a.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}r.inherits(b,y),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=u(h(n[r-2]),n[r-7],l(n[r-15]),n[r-16]);var a=this.h[0],i=this.h[1],y=this.h[2],g=this.h[3],b=this.h[4],m=this.h[5],I=this.h[6],C=this.h[7];for(s(this.k.length===n.length),r=0;r<n.length;r++){var v=c(C,f(b),A(b,m,I),this.k[r],n[r]),w=o(p(a),d(a,i,y));C=I,I=m,m=b,b=o(g,v),g=y,y=i,i=a,a=o(v,w)}this.h[0]=o(this.h[0],a),this.h[1]=o(this.h[1],i),this.h[2]=o(this.h[2],y),this.h[3]=o(this.h[3],g),this.h[4]=o(this.h[4],b),this.h[5]=o(this.h[5],m),this.h[6]=o(this.h[6],I),this.h[7]=o(this.h[7],C)},b.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(11),a=n(36),i=n(7),s=r.rotr64_hi,o=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,A=r.sum64,d=r.sum64_hi,p=r.sum64_lo,f=r.sum64_4_hi,l=r.sum64_4_lo,h=r.sum64_5_hi,y=r.sum64_5_lo,g=a.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function I(t,e,n,r,a){var i=t&n^~t&a;return i<0&&(i+=4294967296),i}function C(t,e,n,r,a,i){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function v(t,e,n,r,a){var i=t&n^t&a^n&a;return i<0&&(i+=4294967296),i}function w(t,e,n,r,a,i){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function E(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function B(t,e){var n=o(t,e,28)^o(e,t,2)^o(e,t,7);return n<0&&(n+=4294967296),n}function Q(t,e){var n=s(t,e,14)^s(t,e,18)^s(e,t,9);return n<0&&(n+=4294967296),n}function M(t,e){var n=o(t,e,14)^o(t,e,18)^o(e,t,9);return n<0&&(n+=4294967296),n}function _(t,e){var n=s(t,e,1)^s(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function x(t,e){var n=o(t,e,1)^o(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function k(t,e){var n=s(t,e,19)^s(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}function S(t,e){var n=o(t,e,19)^o(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(m,g),t.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var a=k(n[r-4],n[r-3]),i=S(n[r-4],n[r-3]),s=n[r-14],o=n[r-13],u=_(n[r-30],n[r-29]),c=x(n[r-30],n[r-29]),A=n[r-32],d=n[r-31];n[r]=f(a,i,s,o,u,c,A,d),n[r+1]=l(a,i,s,o,u,c,A,d)}},m.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],a=this.h[1],s=this.h[2],o=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],l=this.h[7],g=this.h[8],b=this.h[9],m=this.h[10],_=this.h[11],x=this.h[12],k=this.h[13],S=this.h[14],D=this.h[15];i(this.k.length===n.length);for(var R=0;R<n.length;R+=2){var N=S,T=D,O=Q(g,b),H=M(g,b),L=I(g,b,m,_,x),U=C(g,b,m,_,x,k),F=this.k[R],j=this.k[R+1],P=n[R],G=n[R+1],Y=h(N,T,O,H,L,U,F,j,P,G),q=y(N,T,O,H,L,U,F,j,P,G);N=E(r,a),T=B(r,a),O=v(r,a,s,o,u),H=w(r,a,s,o,u,c);var K=d(N,T,O,H),z=p(N,T,O,H);S=x,D=k,x=m,k=_,m=g,_=b,g=d(f,l,Y,q),b=p(l,l,Y,q),f=u,l=c,u=s,c=o,s=r,o=a,r=d(Y,q,K,z),a=p(Y,q,K,z)}A(this.h,0,r,a),A(this.h,2,s,o),A(this.h,4,u,c),A(this.h,6,f,l),A(this.h,8,g,b),A(this.h,10,m,_),A(this.h,12,x,k),A(this.h,14,S,D)},m.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){function r(t){return(r="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)}var a=n(0),i=n(38).Reporter,s=n(2).Buffer;function o(t,e){i.call(this,e),s.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function u(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof u||(t=new u(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=s.byteLength(t);else{if(!s.isBuffer(t))return e.error("Unsupported type: "+r(t));this.value=t,this.length=t.length}}a(o,i),e.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},o.prototype.restore=function(t){var e=new o(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},o.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var n=new o(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},o.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=u,u.prototype.join=function(t,e){return t||(t=new s(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach((function(n){n.join(t,e),e+=n.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):s.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},function(t,e,n){var r=e;r._reverse=function(t){var e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);var r=t[n];e[r]=n})),e},r.der=n(320)},function(t,e,n){var r=n(0),a=n(37),i=a.base,s=a.bignum,o=a.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){i.Node.call(this,"der",t)}function A(t,e){var n=t.readUInt8(e);if(t.isError(n))return n;var r=o.tagClass[n>>6],a=0==(32&n);if(31==(31&n)){var i=n;for(n=0;128==(128&i);){if(i=t.readUInt8(e),t.isError(i))return i;n<<=7,n|=127&i}}else n&=31;return{cls:r,primitive:a,tag:n,tagStr:o.tag[n]}}function d(t,e,n){var r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;var a=127&r;if(a>4)return t.error("length octect is too long");r=0;for(var i=0;i<a;i++){r<<=8;var s=t.readUInt8(n);if(t.isError(s))return s;r|=s}return r}t.exports=u,u.prototype.decode=function(t,e){return t instanceof i.DecoderBuffer||(t=new i.DecoderBuffer(t,e)),this.tree._decode(t,e)},r(c,i.Node),c.prototype._peekTag=function(t,e,n){if(t.isEmpty())return!1;var r=t.save(),a=A(t,'Failed to peek tag: "'+e+'"');return t.isError(a)?a:(t.restore(r),a.tag===e||a.tagStr===e||a.tagStr+"of"===e||n)},c.prototype._decodeTag=function(t,e,n){var r=A(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;var a=d(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(a))return a;if(!n&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==a)return t.skip(a,'Failed to match body of: "'+e+'"');var i=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(a=t.offset-i.offset,t.restore(i),t.skip(a,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){var n=A(t,e);if(t.isError(n))return n;var r,a=d(t,n.primitive,e);if(t.isError(a))return a;if(r=n.primitive||null!==a?t.skip(a):this._skipUntilEnd(t,e),t.isError(r))return r;if("end"===n.tagStr)break}},c.prototype._decodeList=function(t,e,n,r){for(var a=[];!t.isEmpty();){var i=this._peekTag(t,"end");if(t.isError(i))return i;var s=n.decode(t,"der",r);if(t.isError(s)&&i)break;a.push(s)}return a},c.prototype._decodeStr=function(t,e){if("bitstr"===e){var n=t.readUInt8();return t.isError(n)?n:{unused:n,data:t.raw()}}if("bmpstr"===e){var r=t.raw();if(r.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var a="",i=0;i<r.length/2;i++)a+=String.fromCharCode(r.readUInt16BE(2*i));return a}if("numstr"===e){var s=t.raw().toString("ascii");return this._isNumstr(s)?s:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var o=t.raw().toString("ascii");return this._isPrintstr(o)?o:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,n){for(var r,a=[],i=0;!t.isEmpty();){var s=t.readUInt8();i<<=7,i|=127&s,0==(128&s)&&(a.push(i),i=0)}128&s&&a.push(i);var o=a[0]/40|0,u=a[0]%40;if(r=n?a:[o,u].concat(a.slice(1)),e){var c=e[r.join(" ")];void 0===c&&(c=e[r.join(".")]),void 0!==c&&(r=c)}return r},c.prototype._decodeTime=function(t,e){var n=t.raw().toString();if("gentime"===e)var r=0|n.slice(0,4),a=0|n.slice(4,6),i=0|n.slice(6,8),s=0|n.slice(8,10),o=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|n.slice(0,2),a=0|n.slice(2,4),i=0|n.slice(4,6),s=0|n.slice(6,8),o=0|n.slice(8,10),u=0|n.slice(10,12);r=r<70?2e3+r:1900+r}return Date.UTC(r,a-1,i,s,o,u,0)},c.prototype._decodeNull=function(t){return null},c.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){var n=t.raw(),r=new s(n);return e&&(r=e[r.toString(10)]||r),r},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t,e,n){var r=n(0),a=n(2).Buffer,i=n(37),s=i.base,o=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){s.Node.call(this,"der",t)}function A(t){return t<10?"0"+t:t}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(c,s.Node),c.prototype._encodeComposite=function(t,e,n,r){var i,s=function(t,e,n,r){var a;"seqof"===t?t="seq":"setof"===t&&(t="set");if(o.tagByName.hasOwnProperty(t))a=o.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);a=t}if(a>=31)return r.error("Multi-octet tag encoding unsupported");e||(a|=32);return a|=o.tagClassByName[n||"universal"]<<6}(t,e,n,this.reporter);if(r.length<128)return(i=new a(2))[0]=s,i[1]=r.length,this._createEncoderBuffer([i,r]);for(var u=1,c=r.length;c>=256;c>>=8)u++;(i=new a(2+u))[0]=s,i[1]=128|u;c=1+u;for(var A=r.length;A>0;c--,A>>=8)i[c]=255&A;return this._createEncoderBuffer([i,r])},c.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var n=new a(2*t.length),r=0;r<t.length;r++)n.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(n)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)?this._createEncoderBuffer(t):"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},c.prototype._encodeObjid=function(t,e,n){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var r=0;r<t.length;r++)t[r]|=0}else if(Array.isArray(t)){t=t.slice();for(r=0;r<t.length;r++)t[r]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var i=0;for(r=0;r<t.length;r++){var s=t[r];for(i++;s>=128;s>>=7)i++}var o=new a(i),u=o.length-1;for(r=t.length-1;r>=0;r--){s=t[r];for(o[u--]=127&s;(s>>=7)>0;)o[u--]=128|127&s}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(t,e){var n,r=new Date(t);return"gentime"===e?n=[A(r.getFullYear()),A(r.getUTCMonth()+1),A(r.getUTCDate()),A(r.getUTCHours()),A(r.getUTCMinutes()),A(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[A(r.getFullYear()%100),A(r.getUTCMonth()+1),A(r.getUTCDate()),A(r.getUTCHours()),A(r.getUTCMinutes()),A(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!a.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new a(n)}if(a.isBuffer(t)){var r=t.length;0===t.length&&r++;var i=new a(r);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);r=1;for(var s=t;s>=256;s>>=8)r++;for(s=(i=new Array(r)).length-1;s>=0;s--)i[s]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new a(i))},c.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},c.prototype._skipDefault=function(t,e,n){var r,a=this._baseState;if(null===a.default)return!1;var i=t.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,e,n).join()),i.length!==a.defaultBuffer.length)return!1;for(r=0;r<i.length;r++)if(i[r]!==a.defaultBuffer[r])return!1;return!0}},function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(t,e,n){(function(e){var r=n(71),a=n(3);t.exports=function(t){return new s(t)};var i={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function s(t){this.curveType=i[t],this.curveType||(this.curveType={name:t}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}function o(t,n,r){Array.isArray(t)||(t=t.toArray());var a=new e(t);if(r&&a.length<r){var i=new e(r-a.length);i.fill(0),a=e.concat([i,a])}return n?a.toString(n):a}i.p224=i.secp224r1,i.p256=i.secp256r1=i.prime256v1,i.p192=i.secp192r1=i.prime192v1,i.p384=i.secp384r1,i.p521=i.secp521r1,s.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},s.prototype.computeSecret=function(t,n,r){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),o(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},s.prototype.getPublicKey=function(t,e){var n=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(n[n.length-1]%2?n[0]=7:n[0]=6),o(n,t)},s.prototype.getPrivateKey=function(t){return o(this.keys.getPrivate(),t)},s.prototype.setPublicKey=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.keys._importPublic(t),this},s.prototype.setPrivateKey=function(t,n){n=n||"utf8",e.isBuffer(t)||(t=new e(t,n));var r=new a(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}}).call(this,n(2).Buffer)},function(t,e,n){e.publicEncrypt=n(329),e.privateDecrypt=n(330),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},function(t,e,n){var r=n(26),a=n(1).Buffer;function i(t){var e=a.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,s=a.alloc(0),o=0;s.length<e;)n=i(o++),s=a.concat([s,r("sha1").update(t).update(n).digest()]);return s.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var n=t.length,r=-1;++r<n;)t[r]^=e[r];return t}},function(t,e,n){var r=n(3),a=n(1).Buffer;t.exports=function(t,e){return a.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},function(t,e,n){"use strict";(function(t,r){function a(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=n(1),s=n(22),o=i.Buffer,u=i.kMaxLength,c=t.crypto||t.msCrypto,A=Math.pow(2,32)-1;function d(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>A||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function p(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>A||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function f(t,e,n,a){if(r.browser){var i=t.buffer,o=new Uint8Array(i,e,n);return c.getRandomValues(o),a?void r.nextTick((function(){a(null,t)})):t}if(!a)return s(n).copy(t,e),t;s(n,(function(n,r){if(n)return a(n);r.copy(t,e),a(null,t)}))}c&&c.getRandomValues||!r.browser?(e.randomFill=function(e,n,r,a){if(!(o.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)a=n,n=0,r=e.length;else if("function"==typeof r)a=r,r=e.length-n;else if("function"!=typeof a)throw new TypeError('"cb" argument must be a function');return d(n,e.length),p(r,n,e.length),f(e,n,r,a)},e.randomFillSync=function(e,n,r){void 0===n&&(n=0);if(!(o.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(n,e.length),void 0===r&&(r=e.length-n);return p(r,n,e.length),f(e,n,r)}):(e.randomFill=a,e.randomFillSync=a)}).call(this,n(5),n(6))},function(t,e,n){(function(t){var r,a,i,s;function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),t}function A(t){return(A="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)}window,s=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==A(t)&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return i}));var r=n(7),a=n.n(r),i=function(){function e(t){o(this,e),this.wasm=t}return c(e,[{key:"arrayToBuf",value:function(e){var n=this.wasm,r={ptr:null,len:0};if(!e)return r;var a=null;if(e instanceof Uint8Array||void 0!==t&&e instanceof t)a=e;else{if(!(e instanceof ArrayBuffer||e.__proto__.toString().includes("ArrayBuffer")))throw new Error("arrayToBuf() failed: Expected Uint8Array, Buffer, or\n ArrayBuffer");a=new Uint8Array(e)}return r.len=a.length,r.ptr=n._malloc(a.length),n.writeArrayToMemory(a,r.ptr),r}},{key:"arrayToSmartBuf",value:function(t){var e=this.wasm,n=this.arrayToBuf(t);return n.ptr&&setTimeout((function(){e._free(n.ptr),n.len=0,n.ptr=null}),0),n}},{key:"smartMalloc",value:function(t){var e=this.wasm,n=e._malloc(t);return setTimeout((function(){e._free(n)}),0),n}}],[{key:"bytesToHex",value:function(t){return t.reduce((function(t,e){return t+e.toString(16).padStart(2,"0")}),"")}},{key:"bytesToBinary",value:function(t){return t.reduce((function(t,e){return t+e.toString(2).padStart(8,"0")+" "}),"")}},{key:"hexToBytes",value:function(t){return new Uint8Array(t.match(/.{1,2}/g).map((function(t){return parseInt(t,16)})))}},{key:"randomBytes",value:function(t){if("undefined"!=typeof window&&"undefined"!==window.crypto){var e=new Uint8Array(t);return window.crypto.getRandomValues(e),e}return a.a.randomBytes(t)}}]),e}()}).call(this,n(3).Buffer)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(e){o(this,t),this.wasm=e,this.ptr=null,this.len=0}return c(t,[{key:"clear",value:function(){this.len=0}},{key:"free",value:function(){null!==this.ptr&&(this.wasm._free(this.ptr),this.len=0,this.ptr=null)}},{key:"resize",value:function(t){null!==this.ptr&&this.free(),this.len=t,this.ptr=this.wasm._malloc(t)}},{key:"ensureSize",value:function(t){(null===this.ptr||this.len<t)&&this.resize(t)}}]),t}()},function(t,e){t.exports=n(331)},function(t,e,n){"use strict";(function(t){
|
|
47
|
+
*/!function(s,o){"use strict";"object"===i(t)&&t.exports?t.exports=o():void 0===(a="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=a)}(0,(function(t){"use strict";var e=t&&t.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;var r=t.lastIndexOf(".",e-1);if(r<=0||r>=e-1)return!1;var a=n.list[t.slice(e+1)];return!!a&&a.indexOf(" "+t.slice(r+1,e)+" ")>=0},is:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return!1;if(t.lastIndexOf(".",e-1)>=0)return!1;var r=n.list[t.slice(e+1)];return!!r&&r.indexOf(" "+t.slice(0,e)+" ")>=0},get:function(t){var e=t.lastIndexOf(".");if(e<=0||e>=t.length-1)return null;var r=t.lastIndexOf(".",e-1);if(r<=0||r>=e-1)return null;var a=n.list[t.slice(e+1)];return a?a.indexOf(" "+t.slice(r+1,e)+" ")<0?null:t.slice(r+1):null},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=e),this}};return n}))}).call(this,n(10)(t))},function(t,e,n){var r=n(159);t.exports=r("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},function(t,e){t.exports={abi:[{constant:!0,inputs:[],name:"creator",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_SEE",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"customValues",type:"bytes32[]"},{name:"stakeholders",type:"address[]"}],name:"accessRequestV3",outputs:[{name:"",type:"bool"}],payable:!0,stateMutability:"payable",type:"function"},{constant:!0,inputs:[],name:"visibility",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[],name:"kill",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"version",outputs:[{name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"versionAPI",outputs:[{name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"indexCategory",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newCreator",type:"address"}],name:"transferCreatorship",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"candidate",type:"address"}],name:"hasAccess",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_ACCESS",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_visibility_code",type:"uint8"}],name:"setVisibility",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"contentSpace",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"CAN_EDIT",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!1,name:"requestNonce",type:"uint256"},{indexed:!1,name:"parentAddress",type:"address"},{indexed:!1,name:"contextHash",type:"bytes32"},{indexed:!1,name:"accessor",type:"address"},{indexed:!1,name:"requestTimestamp",type:"uint256"}],name:"AccessRequestV3",type:"event"},{anonymous:!1,inputs:[{indexed:!1,name:"contentSpace",type:"address"},{indexed:!1,name:"parentAddress",type:"address"},{indexed:!1,name:"visibility",type:"uint8"}],name:"VisibilityChanged",type:"event"}]}},function(t,e,n){var r=n(23),a=n(17),i=n(9),s=n(4);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=n(15),A=n(24),d=n(16),p=d.ValidateLibrary,f=d.ValidateObject,l=d.ValidateVersion,h=d.ValidatePartHash,y=d.ValidateWriteToken,g=d.ValidateParameters,b=n(187);e.permissionLevels={owner:{short:"Owner Only",description:"Only the owner has access to the object and ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!1}},editable:{short:"Editable",description:"Members of the editors group have full access to the object and the ability to change permissions",settings:{visibility:0,statusCode:-1,kmsConk:!0}},viewable:{short:"Viewable",description:"In addition to editors, members of the 'accessor' group can have read-only access to the object including playing video and retrieving metadata, images and documents",settings:{visibility:0,statusCode:0,kmsConk:!0}},listable:{short:"Publicly Listable",description:"Anyone can list the public portion of this object but only accounts with specific rights can access",settings:{visibility:1,statusCode:0,kmsConk:!0}},public:{short:"Public",description:"Anyone can access this object",settings:{visibility:10,statusCode:0,kmsConk:!0}}},e.Visibility=function(t){var e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.id,a.prev=1,n=this.utils.HashToAddress(e),this.visibilityInfo[n]||(this.visibilityInfo[n]=new Promise((function(t,a){return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,s.awrap(r.authClient.ContractHasMethod({contractAddress:n,methodName:"visibility"}));case 3:if(i.sent){i.next=7;break}return t(0),i.abrupt("return");case 7:return i.t0=t,i.next=10,s.awrap(r.CallContractMethod({contractAddress:r.utils.HashToAddress(e),methodName:"visibility"}));case 10:i.t1=i.sent,(0,i.t0)(i.t1),i.next=17;break;case 14:i.prev=14,i.t2=i.catch(0),a(i.t2);case 17:case"end":return i.stop()}}),null,null,[[0,14]])}))),a.prev=4,a.next=7,s.awrap(this.visibilityInfo[n]);case 7:return a.abrupt("return",a.sent);case 10:throw a.prev=10,a.t0=a.catch(4),delete this.visibilityInfo[n],a.t0;case 14:a.next=21;break;case 16:if(a.prev=16,a.t1=a.catch(1),"CALL_EXCEPTION"!==a.t1.code){a.next=20;break}return a.abrupt("return",0);case 20:throw a.t1;case 21:case"end":return a.stop()}}),null,this,[[1,16],[4,10]])},e.Permission=function(t){var e,n,r,a,i,o,u,c=this;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:return e=t.objectId,f(e),A.next=4,s.awrap(this.AccessType({id:e}));case 4:if(A.t0=A.sent,A.t1=this.authClient.ACCESS_TYPES.OBJECT,A.t0===A.t1){A.next=8;break}throw Error("Permission only valid for normal content objects: "+e);case 8:return A.next=10,s.awrap(this.Visibility({id:e}));case 10:return n=A.sent,A.next=13,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"addressKMS"}));case 13:if(r=A.sent,a=r&&"ikms".concat(this.utils.AddressToHash(r)),i=!1,!a){A.next=29;break}return A.t2=s,A.t3=this,A.next=21,s.awrap(this.ContentObjectLibraryId({objectId:e}));case 21:return A.t4=A.sent,A.t5=e,A.t6="eluv.caps.".concat(a),A.t7={libraryId:A.t4,objectId:A.t5,metadataSubtree:A.t6},A.t8=A.t3.ContentObjectMetadata.call(A.t3,A.t7),A.next=28,A.t2.awrap.call(A.t2,A.t8);case 28:i=!!A.sent;case 29:return A.next=31,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"statusCode"}));case 31:return o=A.sent,o=parseInt(o._hex,16),(u=Object.keys(this.permissionLevels).filter((function(t){var e=c.permissionLevels[t].settings;return n>=e.visibility&&o>=e.statusCode&&i===e.kmsConk})))||(u=i?["editable"]:["owner"]),A.abrupt("return",u.slice(-1)[0]);case 36:case"end":return A.stop()}}),null,this)},e.DefaultKMSAddress=function(){var t,e,n,r=arguments;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(t=r.length>0&&void 0!==r[0]?r[0]:{},e=t.tenantId,a.t0=e,!a.t0){a.next=8;break}return a.next=5,s.awrap(this.AccessType({id:e}));case 5:a.t1=a.sent,a.t2=this.authClient.ACCESS_TYPES.TENANT,a.t0=a.t1===a.t2;case 8:if(!a.t0){a.next=14;break}return a.next=11,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"addressKMS"}));case 11:if(!(n=a.sent)){a.next=14;break}return a.abrupt("return",n);case 14:return a.next=16,s.awrap(this.CallContractMethod({contractAddress:this.contentSpaceAddress,methodName:"addressKMS"}));case 16:return a.abrupt("return",a.sent);case 17:case"end":return a.stop()}}),null,this)},e.ContentSpaceId=function(){return this.contentSpaceId},e.ContentTypeOwner=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.name,n=t.typeId,r=t.versionHash,i.next=3,s.awrap(this.ContentType({name:e,typeId:n,versionHash:r}));case 3:return a=i.sent,i.t0=this.utils,i.next=7,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(a.id),methodName:"owner",methodArgs:[]}));case 7:return i.t1=i.sent,i.abrupt("return",i.t0.FormatAddress.call(i.t0,i.t1));case 9:case"end":return i.stop()}}),null,this)},e.ContentType=function(t){var e,n,r,a,i,o,u;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:if(e=t.name,n=t.typeId,r=t.versionHash,a=t.publicOnly,i=void 0!==a&&a,this.Log("Retrieving content type: ".concat(e||n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),!e){A.next=8;break}return this.Log("Looking up type by name in content space metadata..."),A.next=7,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:c("public","contentTypes",e)}));case 7:n=A.sent;case 8:if(n){A.next=18;break}return this.Log("Looking up type by name in available types..."),A.next=12,s.awrap(this.ContentTypes());case 12:if(o=A.sent,!e){A.next=17;break}return A.abrupt("return",Object.values(o).find((function(t){return(t.name||"").toLowerCase()===e.toLowerCase()})));case 17:return A.abrupt("return",Object.values(o).find((function(t){return t.hash===r})));case 18:if(r){A.next=22;break}return A.next=21,s.awrap(this.LatestVersionHash({objectId:n}));case 21:r=A.sent;case 22:if(A.prev=22,this.Log("Looking up type by ID..."),!i){A.next=34;break}return A.next=27,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:r,metadataSubtree:"public"}));case 27:if(A.t0=A.sent,A.t0){A.next=30;break}A.t0={};case 30:A.t1=A.t0,u={public:A.t1},A.next=40;break;case 34:return A.next=36,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:n,versionHash:r}));case 36:if(A.t2=A.sent,A.t2){A.next=39;break}A.t2={};case 39:u=A.t2;case 40:return A.abrupt("return",{id:n,hash:r,name:u.public&&u.public.name||u.name||n,meta:u});case 43:throw A.prev=43,A.t3=A.catch(22),this.Log("Error looking up content type:"),this.Log(A.t3),new Error("Content Type ".concat(e||n," is invalid"));case 48:case"end":return A.stop()}}),null,this,[[22,43]])},e.ContentTypes=function(){var t,e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return this.contentTypes=this.contentTypes||{},this.Log("Looking up all available content types"),a.next=4,s.awrap(this.Collection({collectionType:"contentTypes"}));case 4:return t=a.sent,this.Log("Personally available types:"),this.Log(t),a.next=9,s.awrap(this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:this.contentSpaceObjectId,metadataSubtree:"public/contentTypes"}));case 9:if(a.t0=a.sent,a.t0){a.next=12;break}a.t0={};case 12:return e=a.t0,n=Object.values(e).map((function(t){return r.utils.HashToAddress(t)})),this.Log("Content space types:"),this.Log(n),t=t.concat(n).filter((function(t){return t})).map((function(t){return r.utils.FormatAddress(t)})).filter((function(t,e,n){return n.indexOf(t)===e})),a.next=19,s.awrap(Promise.all(t.map((function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(e=r.utils.AddressToObjectId(t),r.contentTypes[e]){n.next=11;break}return n.prev=2,n.next=5,s.awrap(r.ContentType({typeId:e,publicOnly:!0}));case 5:r.contentTypes[e]=n.sent,n.next=11;break;case 8:n.prev=8,n.t0=n.catch(2),console.error(n.t0);case 11:case"end":return n.stop()}}),null,null,[[2,8]])}))));case 19:return a.abrupt("return",this.contentTypes);case 20:case"end":return a.stop()}}),null,this)},e.ContentLibraries=function(){var t,e=this;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,s.awrap(this.Collection({collectionType:"libraries"}));case 2:return t=n.sent,n.abrupt("return",t.map((function(t){return e.utils.AddressToLibraryId(t)})));case 4:case"end":return n.stop()}}),null,this)},e.ContentLibrary=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,p(e),n=c("qlibs",e),a.t0=s,a.t1=this.utils,a.t2=this.HttpClient,a.next=8,s.awrap(this.authClient.AuthorizationHeader({libraryId:e}));case 8:return a.t3=a.sent,a.t4=n,a.t5={headers:a.t3,method:"GET",path:a.t4},a.t6=a.t2.Request.call(a.t2,a.t5),a.t7=a.t1.ResponseToJson.call(a.t1,a.t6),a.next=15,a.t0.awrap.call(a.t0,a.t7);case 15:return r=a.sent,a.abrupt("return",u({},r,{meta:r.meta||{}}));case 17:case"end":return a.stop()}}),null,this)},e.ContentLibraryOwner=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.libraryId,p(e),n.t0=this.utils,n.next=5,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"owner",methodArgs:[]}));case 5:return n.t1=n.sent,n.abrupt("return",n.t0.FormatAddress.call(n.t0,n.t1));case 7:case"end":return n.stop()}}),null,this)},e.LibraryContentTypes=function(t){var e,n,r,a=this;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.libraryId,p(e),this.Log("Retrieving library content types for ".concat(e)),i.next=5,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"contentTypesLength",methodArgs:[]}));case 5:if(n=i.sent.toNumber(),this.Log("".concat(n," types")),0!==n){i.next=9;break}return i.abrupt("return",{});case 9:return r={},i.next=12,s.awrap(Promise.all(Array.from(new Array(n),(function(t,n){var i,o;return s.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.awrap(a.ethClient.CallContractMethod({contractAddress:a.utils.HashToAddress(e),methodName:"contentTypes",methodArgs:[n]}));case 2:return i=t.sent,o=a.utils.AddressToObjectId(i),t.next=6,s.awrap(a.ContentType({typeId:o}));case 6:r[o]=t.sent;case 7:case"end":return t.stop()}}))}))));case 12:return this.Log(r),i.abrupt("return",r);case 14:case"end":return i.stop()}}),null,this)},e.ContentObjects=function(t){var e,n,r,a,i,o,u;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:return e=t.libraryId,n=t.filterOptions,r=void 0===n?{}:n,p(e),this.Log("Retrieving content objects from ".concat(e)),a=c("qlibs",e,"q"),i={filter:[]},r.cacheId&&(i.cache_id=r.cacheId),r.start&&(i.start=r.start),r.limit&&(i.limit=r.limit),r.select&&(i.select=r.select),r.sort&&(i.sort_by=r.sort,r.sortDesc&&(i.sort_descending=!0)),o={eq:":eq:",neq:":ne:",lt:":lt:",lte:":le:",gt:":gt:",gte:":ge:",cnt:":co:",ncnt:":nc:"},u=function(t){var e=t.key,n=t.type,r=t.filter;i.filter.push("".concat(e).concat(o[n]).concat(r))},r.filter&&(Array.isArray(r.filter)?r.filter.forEach((function(t){return u(t)})):u(r.filter)),this.Log("Filter options:"),this.Log(r),A.t0=s,A.t1=this.utils,A.t2=this.HttpClient,A.next=20,s.awrap(this.authClient.AuthorizationHeader({libraryId:e}));case 20:return A.t3=A.sent,A.t4=a,A.t5=i,A.t6={headers:A.t3,method:"GET",path:A.t4,queryParams:A.t5},A.t7=A.t2.Request.call(A.t2,A.t6),A.t8=A.t1.ResponseToJson.call(A.t1,A.t7),A.next=28,A.t0.awrap.call(A.t0,A.t8);case 28:return A.abrupt("return",A.sent);case 29:case"end":return A.stop()}}),null,this)},e.ContentObject=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object: ".concat(e||""," ").concat(n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),a=c("q",r||n),i.t0=s,i.t1=this.utils,i.t2=this.HttpClient,i.next=10,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 10:return i.t3=i.sent,i.t4=a,i.t5={headers:i.t3,method:"GET",path:i.t4},i.t6=i.t2.Request.call(i.t2,i.t5),i.t7=i.t1.ResponseToJson.call(i.t1,i.t6),i.next=17,i.t0.awrap.call(i.t0,i.t7);case 17:return i.abrupt("return",i.sent);case 18:case"end":return i.stop()}}),null,this)},e.ContentObjectOwner=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.objectId,f(e),this.Log("Retrieving content object owner: ".concat(e)),n.t0=this.utils,n.next=6,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"owner",methodArgs:[]}));case 6:return n.t1=n.sent,n.abrupt("return",n.t0.FormatAddress.call(n.t0,n.t1));case 8:case"end":return n.stop()}}),null,this)},e.ContentObjectTenantId=function(t){var e,n;return s.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(e=t.objectId,(n=t.versionHash)?l(n):f(e),n&&(e=this.utils.DecodeVersionHash(n).objectId),this.objectTenantIds[e]){r.next=7;break}return r.next=6,s.awrap(this.authClient.MakeElvMasterCall({methodName:"elv_getTenantById",params:[this.contentSpaceId,e]}));case 6:this.objectTenantIds[e]=r.sent;case 7:return r.abrupt("return",this.objectTenantIds[e]);case 8:case"end":return r.stop()}}),null,this)},e.ContentObjectLibraryId=function(t){var e,n,r=this;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.objectId,(n=t.versionHash)?l(n):f(e),n&&(e=this.utils.DecodeVersionHash(n).objectId),a.next=5,s.awrap(this.authClient.AccessType(e));case 5:a.t0=a.sent,a.next=a.t0===this.authClient.ACCESS_TYPES.LIBRARY?8:a.t0===this.authClient.ACCESS_TYPES.OBJECT?9:a.t0===this.authClient.ACCESS_TYPES.OTHER?20:21;break;case 8:return a.abrupt("return",this.utils.AddressToLibraryId(this.utils.HashToAddress(e)));case 9:return this.objectLibraryIds[e]||(this.Log("Retrieving content object library ID: ".concat(e||n)),this.objectLibraryIds[e]=new Promise((function(t,n){return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.t0=t,a.t1=r.utils,a.next=5,s.awrap(r.CallContractMethod({contractAddress:r.utils.HashToAddress(e),methodName:"libraryAddress"}));case 5:a.t2=a.sent,a.t3=a.t1.AddressToLibraryId.call(a.t1,a.t2),(0,a.t0)(a.t3),a.next=13;break;case 10:a.prev=10,a.t4=a.catch(0),n(a.t4);case 13:case"end":return a.stop()}}),null,null,[[0,10]])}))),a.prev=10,a.next=13,s.awrap(this.objectLibraryIds[e]);case 13:return a.abrupt("return",a.sent);case 16:throw a.prev=16,a.t1=a.catch(10),delete this.objectLibraryIds[e],a.t1;case 20:throw Error("Unable to retrieve library ID for ".concat(n||e,": Unknown type. (wrong network or deleted object?)"));case 21:return a.abrupt("return",this.contentSpaceLibraryId);case 22:case"end":return a.stop()}}),null,this,[[10,16]])},e.ProduceMetadataLinks=function(t){var e,n,r,i,o,A,d,p,f,l=this;return s.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,i=t.path,o=void 0===i?"/":i,A=t.metadata,d=t.authorizationToken,p=t.noAuth,A&&"object"===a(A)){h.next=3;break}return h.abrupt("return",A);case 3:if(!Array.isArray(A)){h.next=7;break}return h.next=6,s.awrap(this.utils.LimitedMap(5,A,(function(t,a){return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,s.awrap(l.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:c(o,a.toString()),metadata:t,authorizationToken:d,noAuth:p}));case 2:return i.abrupt("return",i.sent);case 3:case"end":return i.stop()}}))})));case 6:return h.abrupt("return",h.sent);case 7:if(!A["/"]||!A["/"].match(/\.\/(rep|files)\/.+/)&&!A["/"].match(/^\/?qfab\/([\w]+)\/?(rep|files)\/.+/)){h.next=16;break}return h.t0=u,h.t1={},h.t2=A,h.next=13,s.awrap(this.LinkUrl({libraryId:e,objectId:n,versionHash:r,linkPath:o,authorizationToken:d}));case 13:return h.t3=h.sent,h.t4={url:h.t3},h.abrupt("return",(0,h.t0)(h.t1,h.t2,h.t4));case 16:return f={},h.next=19,s.awrap(this.utils.LimitedMap(5,Object.keys(A),(function(t){return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,s.awrap(l.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:c(o,t),metadata:A[t],authorizationToken:d,noAuth:p}));case 2:f[t]=a.sent;case 3:case"end":return a.stop()}}))})));case 19:return h.abrupt("return",f);case 20:case"end":return h.stop()}}),null,this)},e.MetadataAuth=function(t){var e,n,r,a,i,o,u,c,A,d,p,f,l;return s.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.path,i=void 0===a?"/":a,o=t.channelAuth,u=void 0!==o&&o,c=t.noAuth,A=void 0!==c&&c,g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),A=this.noAuth||A,d=A,A){h.next=14;break}return h.next=8,s.awrap(this.Visibility({id:n}));case 8:return f=h.sent,h.next=11,s.awrap(this.AccessType({id:n}));case 11:p=h.sent,d=(i||"").replace(/^\/+/,"").startsWith("public"),A=f>=10||d&&f>=1;case 14:if(!this.oauthToken){h.next=22;break}return h.next=17,s.awrap(this.authClient.KMSAddress({objectId:n,versionHash:r}));case 17:if(!(l=h.sent)||this.utils.EqualAddress(l,this.utils.nullAddress)){h.next=22;break}return h.next=21,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,channelAuth:!0,oauthToken:this.oauthToken}));case 21:return h.abrupt("return",h.sent);case 22:if(this.inaccessibleLibraries[e]||!d||p!==this.authClient.ACCESS_TYPES.OBJECT||u){h.next=50;break}if(h.prev=23,h.t0=s,h.t1=this.authClient,h.t2=e,h.t2){h.next=31;break}return h.next=30,s.awrap(this.ContentObjectLibraryId({objectId:n,versionHash:r}));case 30:h.t2=h.sent;case 31:return h.t3=h.t2,h.t4=A,h.t5={libraryId:h.t3,noAuth:h.t4},h.t6=h.t1.AuthorizationToken.call(h.t1,h.t5),h.next=37,h.t0.awrap.call(h.t0,h.t6);case 37:return h.abrupt("return",h.sent);case 40:if(h.prev=40,h.t7=h.catch(23),!h.t7.message||!h.t7.message.toLowerCase().startsWith("access denied")){h.next=47;break}return this.inaccessibleLibraries[e]=!0,h.next=46,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,noAuth:A,channelAuth:u}));case 46:return h.abrupt("return",h.sent);case 47:throw h.t7;case 48:h.next=53;break;case 50:return h.next=52,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,noAuth:A,channelAuth:u}));case 52:return h.abrupt("return",h.sent);case 53:case"end":return h.stop()}}),null,this,[[23,40]])},e.ContentObjectMetadata=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,y,b,m,I,C,v,w,E,B,Q,M,_,x,k,S,D,R;return s.async((function(N){for(;;)switch(N.prev=N.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.metadataSubtree,o=void 0===i?"/":i,A=t.queryParams,d=void 0===A?{}:A,p=t.select,f=void 0===p?[]:p,l=t.remove,h=void 0===l?[]:l,y=t.authorizationToken,b=t.noAuth,m=void 0!==b&&b,I=t.resolveLinks,C=void 0!==I&&I,v=t.resolveIncludeSource,w=void 0!==v&&v,E=t.resolveIgnoreErrors,B=void 0!==E&&E,Q=t.linkDepthLimit,M=void 0===Q?1:Q,_=t.produceLinkUrls,x=void 0!==_&&_,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object metadata: ".concat(e||""," ").concat(n||r," ").concat(a||"","\n Subtree: ").concat(o)),d=u({},d||{}),r&&(n=this.utils.DecodeVersionHash(r).objectId),k=c("q",a||r||n,"meta",o),N.next=8,s.awrap(this.MetadataAuth({libraryId:e,objectId:n,versionHash:r,path:o,noAuth:m}));case 8:return S=N.sent,D=[y,d.authorization,S].flat().filter((function(t){return t})),delete d.authorization,N.prev=11,N.next=14,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({headers:{Authorization:D.map((function(t){return"Bearer ".concat(t)}))},queryParams:u({},d,{select:f,remove:h,link_depth:M,resolve:C,resolve_include_source:w,resolve_ignore_errors:B}),method:"GET",path:k})));case 14:R=N.sent,N.next=22;break;case 17:if(N.prev=17,N.t0=N.catch(11),404===N.t0.status){N.next=21;break}throw N.t0;case 21:R="/"===o?{}:void 0;case 22:if(x){N.next=24;break}return N.abrupt("return",R);case 24:return N.next=26,s.awrap(this.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:r,path:o,metadata:R,authorizationToken:y,noAuth:m}));case 26:return N.abrupt("return",N.sent);case 27:case"end":return N.stop()}}),null,this,[[11,17]])},e.AssetMetadata=function(t){var e,n,a,i,o,A,d,p,f,l=this;return s.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(e=t.libraryId,n=t.objectId,a=t.versionHash,i=t.metadata,o=t.localization,A=t.noAuth,d=t.produceLinkUrls,p=void 0!==d&&d,g({libraryId:e,objectId:n,versionHash:a}),n||(n=this.utils.DecodeVersionHash(a).objectId),i){h.next=12;break}return h.next=6,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:a,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIgnoreErrors:!0,produceLinkUrls:p,noAuth:A}));case 6:if(h.t0=h.sent,h.t0){h.next=9;break}h.t0={};case 9:i=h.t0,h.next=16;break;case 12:if(!p){h.next=16;break}return h.next=15,s.awrap(this.ProduceMetadataLinks({libraryId:e,objectId:n,versionHash:a,path:c("public","asset_metadata"),metadata:i,noAuth:A}));case 15:i=h.sent;case 16:return i.info||(i.info={}),f=u({},i),o&&o.reverse().forEach((function(t){var e,n=(e=l.utils).SafeTraverse.apply(e,[i].concat(r(t)))||{};f=b({},f,n,(function(t,e){return null===e||""===e?t:void 0}))})),h.abrupt("return",f);case 20:case"end":return h.stop()}}),null,this)},e.ContentObjectVersions=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,n=t.objectId,g({libraryId:e,objectId:n}),this.Log("Retrieving content object versions: ".concat(e||""," ").concat(n)),r=c("qid",n),a.t0=this.utils,a.t1=this.HttpClient,a.next=8,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n}));case 8:return a.t2=a.sent,a.t3=r,a.t4={headers:a.t2,method:"GET",path:a.t3},a.t5=a.t1.Request.call(a.t1,a.t4),a.abrupt("return",a.t0.ResponseToJson.call(a.t0,a.t5));case 13:case"end":return a.stop()}}),null,this)},e.LatestVersionHash=function(t){var e,n,r,a;return s.async((function(i){for(;;)switch(i.prev=i.next){case 0:return e=t.objectId,(n=t.versionHash)&&(e=this.utils.DecodeVersionHash(n).objectId),f(e),i.prev=3,i.next=6,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"objectHash"}));case 6:r=i.sent,i.next=11;break;case 9:i.prev=9,i.t0=i.catch(3);case 11:if(r){i.next=20;break}return i.next=14,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"countVersionHashes"}));case 14:if((a=i.sent).toNumber()){i.next=17;break}throw Error("Unable to determine latest version hash for ".concat(n||e," - Item deleted?"));case 17:return i.next=19,s.awrap(this.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"versionHashes",methodArgs:[a-1]}));case 19:r=i.sent;case 20:return i.abrupt("return",r);case 21:case"end":return i.stop()}}),null,this,[[3,9]])},e.AvailableDRMs=function(){var t,e,n,r,a,i,o,u,c;return s.async((function(A){for(;;)switch(A.prev=A.next){case 0:if(t=["clear","aes-128"],"undefined"!=typeof window){A.next=3;break}return A.abrupt("return",t);case 3:if(window.navigator&&window.navigator.userAgent&&((e=window.navigator.userAgent.match(/(iPad|iPhone|iphone|iPod).*?(OS |os |OS_)(\d+((_|\.)\d)?((_|\.)\d)?)/))&&e[3]&&(n=e[3].split("_"),r=parseInt(n[0]),a=parseInt(n[1]),(r>13||13===r&&a>=1)&&(t[1]="sample-aes",t[2]="fairplay")),/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent)&&(i=window.navigator.userAgent.match(/.+Version\/(\d+)\.(\d+)/))&&i[2]&&(o=parseInt(i[1]),u=parseInt(i[2]),(o>13||13===o&&u>=1)&&(t[1]="sample-aes",t[2]="fairplay"))),"undefined"==typeof window||"function"==typeof window.navigator.requestMediaKeySystemAccess){A.next=6;break}return A.abrupt("return",t);case 6:return A.prev=6,c=[{initDataTypes:["cenc"],audioCapabilities:[{contentType:'audio/mp4;codecs="mp4a.40.2"'}],videoCapabilities:[{contentType:'video/mp4;codecs="avc1.42E01E"'}]}],A.next=10,s.awrap(navigator.requestMediaKeySystemAccess("com.widevine.alpha",c));case 10:t.push("widevine"),A.next=15;break;case 13:A.prev=13,A.t0=A.catch(6);case 15:return A.abrupt("return",t);case 16:case"end":return A.stop()}}),null,null,[[6,13]])},e.PlayoutPathResolution=function(t){var e,n,r,a,i,o,u,A,d,p,f,l,h,y,g,b,m;return s.async((function(I){for(;;)switch(I.prev=I.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.handler,u=t.offering,A=void 0===u?"":u,d=t.signedLink,p=void 0!==d&&d,f=t.authorizationToken,e){I.next=5;break}return I.next=4,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 4:e=I.sent;case 5:if(r){I.next=9;break}return I.next=8,s.awrap(this.LatestVersionHash({objectId:n}));case 8:r=I.sent;case 9:if(l=c("qlibs",e,"q",a||r,"rep",o,A,"options.json"),!i){I.next=26;break}return I.next=13,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:i,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:f}));case 13:if(m=I.sent,b=!!m&&!!m["/"]&&!m["/"].endsWith("options.json"),l=c("qlibs",e,"q",a||r,"meta",i),p){I.next=25;break}return I.next=19,s.awrap(this.LinkTarget({libraryId:e,objectId:n,versionHash:r,writeToken:a,linkPath:i,linkInfo:m,authorizationToken:f}));case 19:return g=I.sent,y=this.utils.DecodeVersionHash(g).objectId,I.next=23,s.awrap(this.ContentObjectLibraryId({objectId:y}));case 23:h=I.sent,b||A||(l=c("q",g,"rep",o,"options.json"));case 25:b&&(l=c(l,A,"options.json"));case 26:return I.abrupt("return",{path:l,multiOfferingLink:b,linkTarget:{libraryId:h,objectId:y,versionHash:g}});case 27:case"end":return I.stop()}}),null,this)},e.AvailableOfferings=function(t){var e,n,r,a,i,o,u,c,A,d,p,f;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.writeToken,a=t.linkPath,i=t.signedLink,o=t.directLink,u=t.handler,c=void 0===u?"playout":u,A=t.authorizationToken,e||(e=this.utils.DecodeVersionHash(n).objectId),!o){l.next=17;break}return l.t0=s,l.t1=this,l.next=7,s.awrap(this.ContentObjectLibraryId({objectId:e}));case 7:return l.t2=l.sent,l.t3=e,l.t4=n,l.t5=a,l.t6=A,l.t7={libraryId:l.t2,objectId:l.t3,versionHash:l.t4,metadataSubtree:l.t5,resolveLinks:!0,authorizationToken:l.t6},l.t8=l.t1.ContentObjectMetadata.call(l.t1,l.t7),l.next=16,l.t0.awrap.call(l.t0,l.t8);case 16:return l.abrupt("return",l.sent);case 17:return l.next=19,s.awrap(this.PlayoutPathResolution({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:i,handler:c,authorizationToken:A}));case 19:return d=l.sent,p=d.path,l.prev=21,l.t9=A,l.next=25,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken}));case 25:return l.t10=l.sent,l.t11=function(t){return t},f=[l.t9,l.t10].flat().filter(l.t11),l.next=30,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({path:p,method:"GET",headers:{Authorization:"Bearer ".concat(f.join(","))}})));case 30:return l.abrupt("return",l.sent);case 33:if(l.prev=33,l.t12=l.catch(21),!l.t12.status||500!==parseInt(l.t12.status)){l.next=37;break}return l.abrupt("return",{});case 37:throw l.t12;case 38:case"end":return l.stop()}}),null,this,[[21,33]])},e.PlayoutOptions=function(t){var e,n,r,a,o,A,d,p,h,y,g,b,m,I,C,v,w,E,B,Q,M,_,x,k,S,D,R,N,T,O,H,L,U,F,j,P,G,Y,q,K,z,J,V,W,Z=this;return s.async((function(X){for(;;)switch(X.prev=X.next){case 0:if(e=t.offeringURI,n=t.objectId,r=t.versionHash,a=t.writeToken,o=t.linkPath,A=t.signedLink,d=void 0!==A&&A,p=t.protocols,h=void 0===p?["dash","hls"]:p,y=t.handler,g=void 0===y?"playout":y,b=t.offering,m=void 0===b?"default":b,I=t.playoutType,C=t.drms,v=void 0===C?[]:C,w=t.context,E=t.hlsjsProfile,B=void 0===E||E,Q=t.authorizationToken,!e){X.next=8;break}if(M=e.match(/(hq__[^/]+)\/rep\/([^/]+)\/([^/]+)\/options.json/),r=M[1],g=M[2],m=M[3],r&&g&&m){X.next=8;break}throw Error("Invalid offering URI: ".concat(e));case 8:if(r?l(r):f(n),h=h.map((function(t){return t.toLowerCase()})),v=v.map((function(t){return t.toLowerCase()})),n){X.next=15;break}n=this.utils.DecodeVersionHash(r).objectId,X.next=19;break;case 15:if(r){X.next=19;break}return X.next=18,s.awrap(this.LatestVersionHash({objectId:n}));case 18:r=X.sent;case 19:return X.next=21,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 21:if(_=X.sent,X.prev=22,o){X.next=29;break}return x=c("public","asset_metadata","sources",m),X.next=27,s.awrap(this.ContentObjectMetadata({libraryId:_,objectId:n,versionHash:r,metadataSubtree:x,authorizationToken:Q}));case 27:X.sent&&(o=x);case 29:X.next=33;break;case 31:X.prev=31,X.t0=X.catch(22);case 33:return X.next=35,s.awrap(this.PlayoutPathResolution({libraryId:_,objectId:n,versionHash:r,writeToken:a,linkPath:o,signedLink:d,handler:g,offering:m,authorizationToken:Q}));case 35:if(k=X.sent,S=k.path,D=k.linkTarget,X.t1=this.authClient,X.t2=D.objectId||n,X.t3=D.versionHash||r,X.t3){X.next=45;break}return X.next=44,s.awrap(this.LatestVersionHash({objectId:n}));case 44:X.t3=X.sent;case 45:return X.t4=X.t3,X.t5=h,X.t6=v,X.t7=w,X.t8={objectId:X.t2,versionHash:X.t4,protocols:X.t5,drms:X.t6,context:X.t7},R=X.t1.AudienceData.call(X.t1,X.t8),X.t9=Q,X.next=54,s.awrap(this.authClient.AuthorizationToken({libraryId:_,objectId:n,channelAuth:!0,oauthToken:this.oauthToken,audienceData:R}));case 54:return X.t10=X.sent,X.t11=function(t){return t},N=[X.t9,X.t10].flat().filter(X.t11),T={authorization:N,resolve:!!o},X.t12=Object,X.next=61,s.awrap(this.utils.ResponseToJson(this.HttpClient.Request({path:S,method:"GET",queryParams:T})));case 61:if(X.t13=X.sent,O=X.t12.values.call(X.t12,X.t13),d||!D.versionHash){X.next=70;break}return X.t14=Q,X.next=67,s.awrap(this.authClient.AuthorizationToken({libraryId:D.libraryId,objectId:D.objectId,channelAuth:!0,oauthToken:this.oauthToken,audienceData:R}));case 67:X.t15=X.sent,X.t16=function(t){return t},T.authorization=[X.t14,X.t15].flat().filter(X.t16);case 70:H={},F=0;case 72:if(!(F<O.length)){X.next=118;break}if(j=O[F],P=j.properties.protocol,G=j.properties.drm,L=L||j.sid,U=U||!!j.properties.multiview,L&&(T.sid=L),Y=j.uri.split("?")[0],I&&(Y=Y.replace("playlist","playlist-".concat(I))),q=j.properties.license_servers,K=j.properties.cert,B&&"hls"===P&&"aes-128"===G&&(T.player_profile="hls-js"),X.t17=u,X.t18={},X.t19=H[P]||{},X.t20=u,X.t21={},X.t22=(H[P]||{}).playoutMethods||{},X.t23=i,X.t24={},X.t25=G||"clear",!d){X.next=99;break}return X.next=96,s.awrap(this.LinkUrl({versionHash:r,linkPath:c(o,m,Y),queryParams:T,noAuth:!0}));case 96:X.t26=X.sent,X.next=102;break;case 99:return X.next=101,s.awrap(this.Rep({libraryId:D.libraryId||_,objectId:D.objectId||n,versionHash:D.versionHash||r,rep:c(g,m,Y),noAuth:!0,queryParams:T}));case 101:X.t26=X.sent;case 102:for(z in X.t27=X.t26,X.t28=G?i({},G,{licenseServers:q,cert:K}):void 0,X.t29={playoutUrl:X.t27,drms:X.t28},X.t30=(0,X.t23)(X.t24,X.t25,X.t29),X.t31=(0,X.t20)(X.t21,X.t22,X.t30),X.t32={playoutMethods:X.t31},H[P]=(0,X.t17)(X.t18,X.t19,X.t32),H[P].playoutMethods)H[P].playoutMethods[z].drms&&H[P].playoutMethods[z].drms[G]&&H[P].playoutMethods[z].drms[G].cert&&((J=new URL(H[P].playoutMethods[z].playoutUrl)).pathname=J.pathname.split("/").slice(0,-1).concat(["drm.cert"]).join("/"),H[P].playoutMethods[z].drms[G].cert_url=J.toString());if(V=h.includes(P),W=v.includes(G||"clear")||0===v.length&&!G,V&&W){X.next=114;break}return X.abrupt("continue",115);case 114:(!H[P].playoutUrl||G&&"clear"!==G)&&(H[P].playoutUrl=H[P].playoutMethods[G||"clear"].playoutUrl,H[P].drms=H[P].playoutMethods[G||"clear"].drms);case 115:F++,X.next=72;break;case 118:return U&&L&&(H.sessionId=L,H.multiview=!0,H.AvailableViews=function(){return s.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=s,t.t1=Z.utils,t.next=4,s.awrap(Z.HttpClient.Request({path:c("q",D.versionHash||r,"rep",g,m,"views.json"),method:"GET",queryParams:{sid:L,authorization:N}}));case 4:return t.t2=t.sent,t.t3=t.t1.ResponseToFormat.call(t.t1,"json",t.t2),t.next=8,t.t0.awrap.call(t.t0,t.t3);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}))},H.SwitchView=function(t){return s.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.awrap(Z.HttpClient.Request({path:c("q",D.versionHash||r,"rep",g,m,"select_view"),method:"POST",queryParams:{sid:L,authorization:N},body:{view:t}}));case 2:case"end":return e.stop()}}))}),this.Log(H),X.abrupt("return",H);case 121:case"end":return X.stop()}}),null,this,[[22,31]])},e.BitmovinPlayoutOptions=function(t){var e,n,r,a,i,o,u,c,A,d,p,h,y,g,b,m,I,C,v,w,E,B;return s.async((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return e=t.objectId,n=t.versionHash,r=t.writeToken,a=t.linkPath,i=t.signedLink,o=void 0!==i&&i,u=t.protocols,c=void 0===u?["dash","hls"]:u,A=t.drms,d=void 0===A?[]:A,p=t.handler,h=void 0===p?"playout":p,y=t.offering,g=void 0===y?"default":y,b=t.playoutType,m=t.context,I=t.authorizationToken,n?l(n):f(e),e||(e=this.utils.DecodeVersionHash(n).objectId),Q.next=5,s.awrap(this.PlayoutOptions({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:o,protocols:c,drms:d,handler:h,offering:g,playoutType:b,hlsjsProfile:!1,context:m,authorizationToken:I}));case 5:return delete(C=Q.sent).playoutMethods,Q.next=9,s.awrap(this.PlayoutPathResolution({objectId:e,versionHash:n,writeToken:r,linkPath:a,signedLink:o,handler:h,offering:g,authorizationToken:I}));case 9:if(v=Q.sent,w=v.linkTarget,E=[],I&&E.push(I),!o&&w.versionHash){Q.next=21;break}return Q.t0=E,Q.next=17,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken}));case 17:Q.t1=Q.sent,Q.t0.push.call(Q.t0,Q.t1),Q.next=26;break;case 21:return Q.t2=E,Q.next=24,s.awrap(this.authClient.AuthorizationToken({libraryId:w.libraryId,objectId:w.objectId,channelAuth:!0,oauthToken:this.oauthToken}));case 24:Q.t3=Q.sent,Q.t2.push.call(Q.t2,Q.t3);case 26:return B={drm:{}},Object.keys(C).forEach((function(t){var e=C[t];B[t]=e.playoutUrl,e.drms&&Object.keys(e.drms).forEach((function(t){if(e.drms[t].licenseServers&&0!==e.drms[t].licenseServers.length){var n=function(t){return t.toLowerCase().startsWith("https")},r=e.drms[t].licenseServers;r.find(n)&&(r=r.filter(n));var a=r.sort((function(){return.5-Math.random()}))[0];B.drm[t]||(B.drm[t]={LA_URL:a,headers:{Authorization:"Bearer ".concat(E.flat().filter((function(t){return t})).join(","))}})}}))})),Q.abrupt("return",B);case 29:case"end":return Q.stop()}}),null,this)},e.CallBitcodeMethod=function(t){var e,n,r,a,i,o,u,A,d,p,f,l,h,y,b,m;return s.async((function(I){for(;;)switch(I.prev=I.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.method,o=t.queryParams,u=void 0===o?{}:o,A=t.body,d=void 0===A?{}:A,p=t.headers,f=void 0===p?{}:p,l=t.constant,h=void 0===l||l,y=t.format,b=void 0===y?"json":y,g({libraryId:e,objectId:n,versionHash:r}),i){I.next=4;break}throw"Bitcode method not specified";case 4:if(r&&(n=this.utils.DecodeVersionHash(r).objectId),m=c("q",a||r||n,"call",i),e&&(m=c("qlibs",e,m)),f.authorization||f.Authorization){I.next=12;break}return I.next=11,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,update:!h}));case 11:f.Authorization=I.sent.Authorization;case 12:return this.Log("Calling bitcode method: ".concat(e||""," ").concat(n||r," ").concat(a||"","\n ").concat(h?"GET":"POST"," ").concat(m,"\n Query Params:\n ").concat(JSON.stringify(u||""),"\n Body:\n ").concat(JSON.stringify(d||""),"\n Headers\n ").concat(JSON.stringify(f||""))),I.t0=this.utils,I.t1=b,I.next=17,s.awrap(this.HttpClient.Request({body:d,headers:f,method:h?"GET":"POST",path:m,queryParams:u,failover:!1}));case 17:return I.t2=I.sent,I.abrupt("return",I.t0.ResponseToFormat.call(I.t0,I.t1,I.t2));case 19:case"end":return I.stop()}}),null,this)},e.Rep=function(t){var e,n,r,a,i,o,u,c,A,d,p,f;return s.async((function(s){for(;;)switch(s.prev=s.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.rep,i=t.queryParams,o=void 0===i?{}:i,u=t.channelAuth,c=void 0!==u&&u,A=t.noAuth,d=void 0!==A&&A,p=t.noCache,f=void 0!==p&&p,g({libraryId:e,objectId:n,versionHash:r}),a){s.next=4;break}throw"Rep not specified";case 4:return s.abrupt("return",this.FabricUrl({libraryId:e,objectId:n,versionHash:r,rep:a,queryParams:o,channelAuth:c,noAuth:d,noCache:f}));case 5:case"end":return s.stop()}}),null,this)},e.PublicRep=function(t){var e,n,r,a,i,o;return s.async((function(s){for(;;)switch(s.prev=s.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.rep,i=t.queryParams,o=void 0===i?{}:i,g({libraryId:e,objectId:n,versionHash:r}),a){s.next=4;break}throw"Rep not specified";case 4:return s.abrupt("return",this.FabricUrl({libraryId:e,objectId:n,versionHash:r,publicRep:a,queryParams:o,noAuth:!0}));case 5:case"end":return s.stop()}}),null,this)},e.FabricUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,y,b,m,I,C,v;return s.async((function(w){for(;;)switch(w.prev=w.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.partHash,o=t.rep,A=t.publicRep,d=t.call,p=t.queryParams,f=void 0===p?{}:p,l=t.channelAuth,h=void 0!==l&&l,y=t.noAuth,b=void 0!==y&&y,m=t.noCache,I=void 0!==m&&m,(n||r)&&g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),this.Log("Building Fabric URL:\n libraryId: ".concat(e,"\n objectId: ").concat(n,"\n versionHash: ").concat(r,"\n writeToken: ").concat(a,"\n partHash: ").concat(i,"\n rep: ").concat(o,"\n publicRep: ").concat(A,"\n call: ").concat(d,"\n channelAuth: ").concat(h,"\n noAuth: ").concat(b,"\n noCache: ").concat(I,"\n queryParams: ").concat(JSON.stringify(f||{},null,2))),C=[],f.authorization&&C.push(f.authorization),b&&f.authorization){w.next=12;break}return w.t0=C,w.next=10,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,versionHash:r,channelAuth:h,noAuth:b,noCache:I}));case 10:w.t1=w.sent,w.t0.push.call(w.t0,w.t1);case 12:if(f=u({},f,{authorization:C.flat()}),!o&&!A||!n||r){w.next=17;break}return w.next=16,s.awrap(this.LatestVersionHash({objectId:n}));case 16:r=w.sent;case 17:return v="",e?(v=c(v,"qlibs",e),(n||r)&&(v=c(v,"q",a||r||n))):r&&(v=c("q",r)),i?v=c(v,"data",i):o?v=c(v,"rep",o):A?v=c(v,"public",A):d&&(v=c(v,"call",d)),w.abrupt("return",this.HttpClient.URL({path:v,queryParams:f}));case 21:case"end":return w.stop()}}),null,this)},e.FileUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h;return s.async((function(y){for(;;)switch(y.prev=y.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.filePath,o=t.queryParams,A=void 0===o?{}:o,d=t.noCache,p=void 0!==d&&d,g({libraryId:e,objectId:n,versionHash:r}),i){y.next=4;break}throw"File path not specified";case 4:return r&&(n=this.utils.DecodeVersionHash(r).objectId),f=e?c("qlibs",e,"q",a||r||n):c("q",r),y.next=8,s.awrap(this.authClient.AuthorizationToken({libraryId:e,objectId:n,noCache:p}));case 8:return l=y.sent,A=u({},A,{authorization:l}),y.next=12,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:c("files",i)}));case 12:return h=y.sent,h&&h["."].encryption&&"cgck"===h["."].encryption.scheme?(f=c(f,"rep","files_download",i),A["header-x_decryption_mode"]="decrypt"):f=c(f,"files",i),y.abrupt("return",this.HttpClient.URL({path:f,queryParams:A}));case 16:case"end":return y.stop()}}),null,this)},e.ContentObjectImageUrl=function(t){var e,n,r,a,i,o,u;return s.async((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.height,i=t.imagePath,o=void 0===i?"public/display_image":i,g({libraryId:e,objectId:n,versionHash:r}),r){c.next=6;break}return c.next=5,s.awrap(this.LatestVersionHash({objectId:n}));case 5:r=c.sent;case 6:if(this.Log("Retrieving content object image url: ".concat(e," ").concat(n," ").concat(r)),this.objectImageUrls[r]){c.next=26;break}return c.prev=8,c.next=11,s.awrap(this.ContentObjectMetadata({versionHash:r,metadataSubtree:o}));case 11:if(c.sent){c.next=15;break}return this.Log("No image url set: ".concat(e," ").concat(n," ").concat(r)),c.abrupt("return");case 15:c.next=21;break;case 17:c.prev=17,c.t0=c.catch(8),this.Log("Unable to query for image metadata: ".concat(e," ").concat(n," ").concat(r),!0),this.Log(c.t0,!0);case 21:return u={},a&&!isNaN(parseInt(a))&&(u.height=parseInt(a)),c.next=25,s.awrap(this.LinkUrl({versionHash:r,linkPath:o,queryParams:u}));case 25:this.objectImageUrls[r]=c.sent;case 26:return c.abrupt("return",this.objectImageUrls[r]);case 27:case"end":return c.stop()}}),null,this,[[8,17]])},e.ContentObjectGraph=function(t){var e,n,r,a,i,o,u,A,d,p,f=this;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.autoUpdate,i=void 0!==a&&a,o=t.select,g({libraryId:e,objectId:n,versionHash:r}),this.Log("Retrieving content object graph: ".concat(e||""," ").concat(n||r)),r&&(n=this.utils.DecodeVersionHash(r).objectId),u=c("q",r||n,"links"),l.prev=5,l.t0=s,l.t1=this.utils,l.t2=this.HttpClient,l.next=11,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 11:return l.t3=l.sent,l.t4={auto_update:i,select:o},l.t5=u,l.t6={headers:l.t3,queryParams:l.t4,method:"GET",path:l.t5},l.t7=l.t2.Request.call(l.t2,l.t6),l.t8=l.t1.ResponseToJson.call(l.t1,l.t7),l.next=19,l.t0.awrap.call(l.t0,l.t8);case 19:return l.abrupt("return",l.sent);case 22:if(l.prev=22,l.t9=l.catch(5),l.prev=24,(d=l.t9.body.errors[0].cause.cause.cause.cycle)&&0!==d.length){l.next=28;break}throw l.t9;case 28:return p={},l.next=31,s.awrap(Promise.all(d.map((function(t){var e,n;return s.async((function(r){for(;;)switch(r.prev=r.next){case 0:if(!p[t]){r.next=2;break}return r.abrupt("return");case 2:return e=f.utils.DecodeVersionHash(t).objectId,r.next=5,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/asset_metadata/display_title"}));case 5:if(r.t2=r.sent,r.t2){r.next=10;break}return r.next=9,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/name"}));case 9:r.t2=r.sent;case 10:if(r.t1=r.t2,r.t1){r.next=15;break}return r.next=14,s.awrap(f.ContentObjectMetadata({versionHash:t,metadataSubtree:"name"}));case 14:r.t1=r.sent;case 15:if(r.t0=r.t1,r.t0){r.next=18;break}r.t0=e;case 18:n=r.t0,p[t]={name:n,objectId:e};case 20:case"end":return r.stop()}}))}))));case 31:A=d.map((function(t){return"".concat(p[t].name," (").concat(p[t].objectId,")")})),l.next=37;break;case 34:throw l.prev=34,l.t10=l.catch(24),l.t9;case 37:throw new Error("Cycle found in links: ".concat(A.join(" -> ")));case 38:case"end":return l.stop()}}),null,this,[[5,22],[24,34]])},e.LinkTarget=function(t){var e,n,r,i,o,u,c,A,d;return s.async((function(p){for(;;)switch(p.prev=p.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,i=t.writeToken,o=t.linkPath,u=t.authorizationToken,c=t.linkInfo,g({libraryId:e,objectId:n,versionHash:r}),i&&y(i),r&&(n=this.utils.DecodeVersionHash(r).objectId),!i||e){p.next=8;break}return p.next=7,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 7:e=p.sent;case 8:if(c){p.next=12;break}return p.next=11,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:o,resolveLinks:!1,resolveIgnoreErrors:!0,resolveIncludeSource:!0,authorizationToken:u}));case 11:c=p.sent;case 12:if(!c||!c["/"]){p.next=27;break}if((A=((c["/"]||"").match(/^\/?qfab\/([\w]+)\/?.+/)||[])[1])||(A=c["."].container),!A){p.next=19;break}return p.abrupt("return",A);case 19:if(!r){p.next=21;break}return p.abrupt("return",r);case 21:if(p.t0=r,p.t0){p.next=26;break}return p.next=25,s.awrap(this.LatestVersionHash({objectId:n}));case 25:p.t0=p.sent;case 26:return p.abrupt("return",p.t0);case 27:return p.next=29,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:o,resolveIncludeSource:!0,authorizationToken:u}));case 29:if((c=p.sent)&&c["."]){p.next=49;break}if("object"!==a(c)){p.next=38;break}if(p.t1=r,p.t1){p.next=37;break}return p.next=36,s.awrap(this.LatestVersionHash({objectId:n}));case 36:p.t1=p.sent;case 37:return p.abrupt("return",p.t1);case 38:if(d=o.split("/").slice(0,-1).join("/")){p.next=46;break}if(p.t2=r,p.t2){p.next=45;break}return p.next=44,s.awrap(this.LatestVersionHash({objectId:n}));case 44:p.t2=p.sent;case 45:return p.abrupt("return",p.t2);case 46:return p.next=48,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:i,metadataSubtree:d,resolveIncludeSource:!0,authorizationToken:u}));case 48:c=p.sent;case 49:return p.abrupt("return",c["."].source);case 50:case"end":return p.stop()}}),null,this)},e.LinkUrl=function(t){var e,n,r,a,i,o,A,d,p,f,l,h,b,m,I;return s.async((function(C){for(;;)switch(C.prev=C.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.mimeType,A=t.authorizationToken,d=t.queryParams,p=void 0===d?{}:d,f=t.channelAuth,l=void 0!==f&&f,h=t.noAuth,b=void 0!==h&&h,g({libraryId:e,objectId:n,versionHash:r}),a&&y(a),i){C.next=5;break}throw Error("Link path not specified");case 5:return r&&(n=this.utils.DecodeVersionHash(r).objectId),m=e?c("qlibs",e,"q",a||r||n,"meta",i):c("q",r,"meta",i),I=[A],C.t0=I,C.next=11,s.awrap(this.MetadataAuth({libraryId:e,objectId:n,versionHash:r,path:i,channelAuth:l,noAuth:b}));case 11:return C.t1=C.sent,C.t0.push.call(C.t0,C.t1),p.authorization&&I.push(p.authorization),p=u({},p,{authorization:I.flat().filter((function(t){return t})),resolve:!0}),o&&(p["header-accept"]=o),C.abrupt("return",this.HttpClient.URL({path:m,queryParams:p}));case 17:case"end":return C.stop()}}),null,this)},e.LinkData=function(t){var e,n,r,a,i,o,u,c,d,p,f;return s.async((function(l){for(;;)switch(l.prev=l.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.linkPath,o=t.queryParams,u=void 0===o?{}:o,c=t.format,d=void 0===c?"json":c,p=t.channelAuth,l.next=3,s.awrap(this.LinkUrl({libraryId:e,objectId:n,versionHash:r,writeToken:a,linkPath:i,queryParams:u,channelAuth:p}));case 3:return f=l.sent,l.t0=this.utils,l.t1=d,l.next=8,s.awrap(A.Fetch(f));case 8:return l.t2=l.sent,l.abrupt("return",l.t0.ResponseToFormat.call(l.t0,l.t1,l.t2));case 10:case"end":return l.stop()}}),null,this)},e.CreateEncryptionConk=function(t){var e,n,r,a,i,o,u,c,A,d,p;return s.async((function(f){for(;;)switch(f.prev=f.next){case 0:if(e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.createKMSConk,o=void 0===i||i,g({libraryId:e,objectId:n,versionHash:r}),y(a),n||(n=client.DecodeVersionHash(r).objectId),e){f.next=8;break}return f.next=7,s.awrap(this.ContentObjectLibraryId({objectId:n}));case 7:e=f.sent;case 8:return u="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=11,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,writeToken:a,metadataSubtree:u}));case 11:if(!(c=f.sent)){f.next=18;break}return f.next=15,s.awrap(this.Crypto.DecryptCap(c,this.signer.signingKey.privateKey));case 15:this.encryptionConks[n]=f.sent,f.next=34;break;case 18:return f.next=20,s.awrap(this.Crypto.GeneratePrimaryConk({spaceId:this.contentSpaceId,objectId:n}));case 20:return this.encryptionConks[n]=f.sent,f.t0=s,f.t1=this,f.t2=e,f.t3=n,f.t4=a,f.t5=u,f.next=29,s.awrap(this.Crypto.EncryptConk(this.encryptionConks[n],this.signer.signingKey.publicKey));case 29:return f.t6=f.sent,f.t7={libraryId:f.t2,objectId:f.t3,writeToken:f.t4,metadataSubtree:f.t5,metadata:f.t6},f.t8=f.t1.ReplaceMetadata.call(f.t1,f.t7),f.next=34,f.t0.awrap.call(f.t0,f.t8);case 34:if(!o){f.next=66;break}return f.prev=35,f.next=38,s.awrap(this.authClient.KMSAddress({objectId:n}));case 38:return A=f.sent,f.next=41,s.awrap(this.authClient.KMSInfo({objectId:n}));case 41:return d=f.sent.publicKey,p="eluv.caps.ikms".concat(this.utils.AddressToHash(A)),f.next=45,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,writeToken:a,metadataSubtree:p}));case 45:if(f.sent){f.next=60;break}return f.t9=s,f.t10=this,f.t11=e,f.t12=n,f.t13=a,f.t14=p,f.next=55,s.awrap(this.Crypto.EncryptConk(this.encryptionConks[n],d));case 55:return f.t15=f.sent,f.t16={libraryId:f.t11,objectId:f.t12,writeToken:f.t13,metadataSubtree:f.t14,metadata:f.t15},f.t17=f.t10.ReplaceMetadata.call(f.t10,f.t16),f.next=60,f.t9.awrap.call(f.t9,f.t17);case 60:f.next=66;break;case 62:f.prev=62,f.t18=f.catch(35),console.error("Failed to create encryption cap for KMS:"),console.error(f.t18);case 66:return f.abrupt("return",this.encryptionConks[n]);case 67:case"end":return f.stop()}}),null,this,[[35,62]])},e.EncryptionConk=function(t){var e,n,r,a,i,o,u,c,A,d,p;return s.async((function(f){for(;;)switch(f.prev=f.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.writeToken,i=t.download,o=void 0!==i&&i,g({libraryId:e,objectId:n,versionHash:r}),a&&y(a),n||(n=client.DecodeVersionHash(r).objectId),f.next=6,s.awrap(this.authClient.Owner({id:n}));case 6:return u=f.sent,c="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=10,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,metadataSubtree:c}));case 10:if(A=f.sent,this.utils.EqualAddress(u,this.signer.address)||A){f.next=21;break}if(!o){f.next=18;break}return f.next=15,s.awrap(this.authClient.ReEncryptionConk({libraryId:e,objectId:n,versionHash:r}));case 15:return f.abrupt("return",f.sent);case 18:return f.next=20,s.awrap(this.authClient.EncryptionConk({libraryId:e,objectId:n,versionHash:r}));case 20:return f.abrupt("return",f.sent);case 21:if(this.encryptionConks[n]){f.next=38;break}return d="eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address)),f.next=25,s.awrap(this.ContentObjectMetadata({libraryId:e,objectId:n,versionHash:r,writeToken:a,metadataSubtree:d}));case 25:if(!(p=f.sent)){f.next=32;break}return f.next=29,s.awrap(this.Crypto.DecryptCap(p,this.signer.signingKey.privateKey));case 29:this.encryptionConks[n]=f.sent,f.next=38;break;case 32:if(!a){f.next=37;break}return f.next=35,s.awrap(this.CreateEncryptionConk({libraryId:e,objectId:n,versionHash:r,writeToken:a,createKMSConk:!1}));case 35:f.next=38;break;case 37:throw"No encryption conk present for "+n;case 38:return f.abrupt("return",this.encryptionConks[n]);case 39:case"end":return f.stop()}}),null,this)},e.Encrypt=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.writeToken,a=t.chunk,g({libraryId:e,objectId:n}),u.next=4,s.awrap(this.EncryptionConk({libraryId:e,objectId:n,writeToken:r}));case 4:return i=u.sent,u.next=7,s.awrap(this.Crypto.Encrypt(i,a));case 7:return o=u.sent,u.abrupt("return",o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength));case 9:case"end":return u.stop()}}),null,this)},e.Decrypt=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.writeToken,a=t.chunk,g({libraryId:e,objectId:n}),u.next=4,s.awrap(this.EncryptionConk({libraryId:e,objectId:n,writeToken:r,download:!0}));case 4:return i=u.sent,u.next=7,s.awrap(this.Crypto.Decrypt(i,a));case 7:return o=u.sent,u.abrupt("return",o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength));case 9:case"end":return u.stop()}}),null,this)},e.AccessType=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:return e=t.id,n.next=3,s.awrap(this.authClient.AccessType(e));case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),null,this)},e.AccessInfo=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.objectId,n=t.args,f(e),n||(n=[0,[],[]]),this.Log("Retrieving access info: ".concat(e)),a.next=6,s.awrap(this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(e),methodName:"getAccessInfo",methodArgs:n}));case 6:return r=a.sent,this.Log(r),a.abrupt("return",{visibilityCode:r[0],visible:r[0]>=1,accessible:r[0]>=10,editable:r[0]>=100,hasAccess:0===r[1],accessCode:r[1],accessCharge:this.utils.WeiToEther(r[2]).toString()});case 9:case"end":return a.stop()}}),null,this)},e.AccessRequest=function(t){var e,n,r,a,i,o,u,c,A;return s.async((function(d){for(;;)switch(d.prev=d.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.args,i=void 0===a?[]:a,o=t.update,u=void 0!==o&&o,c=t.noCache,A=void 0!==c&&c,g({libraryId:e,objectId:n,versionHash:r}),r&&(n=this.utils.DecodeVersionHash(r).objectId),d.next=5,s.awrap(this.authClient.MakeAccessRequest({libraryId:e,objectId:n,versionHash:r,args:i,update:u,skipCache:!0,noCache:A}));case 5:return d.abrupt("return",d.sent);case 6:case"end":return d.stop()}}),null,this)},e.SetAuthContext=function(t){var e=t.context;if(e&&Object.values(e).find((function(t){return"string"!=typeof t})))throw Error("Context must be a map of string->string");this.authContext=e},e.GenerateStateChannelToken=function(t){var e,n,r,a,i;return s.async((function(o){for(;;)switch(o.prev=o.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.context,a=t.noCache,i=void 0!==a&&a,n?l(n):f(e),!n){o.next=6;break}e=this.utils.DecodeVersionHash(n).objectId,o.next=10;break;case 6:if(this.stateChannelAccess[e]){o.next=10;break}return o.next=9,s.awrap(this.LatestVersionHash({objectId:e}));case 9:n=o.sent;case 10:return this.stateChannelAccess[e]=n,o.next=13,s.awrap(this.authClient.AuthorizationToken({objectId:e,channelAuth:!0,oauthToken:this.oauthToken,context:r,noCache:i}));case 13:return o.abrupt("return",o.sent);case 14:case"end":return o.stop()}}),null,this)},e.FinalizeStateChannelAccess=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(e=t.objectId,n=t.versionHash,r=t.percentComplete,n?l(n):f(e),!n){a.next=6;break}e=this.utils.DecodeVersionHash(n).objectId,a.next=13;break;case 6:if(!this.stateChannelAccess[e]){a.next=10;break}n=this.stateChannelAccess[e],a.next=13;break;case 10:return a.next=12,s.awrap(this.LatestVersionHash({objectId:e}));case 12:n=a.sent;case 13:return this.stateChannelAccess[e]=void 0,a.next=16,s.awrap(this.authClient.ChannelContentFinalize({objectId:e,versionHash:n,percent:r}));case 16:case"end":return a.stop()}}),null,this)},e.ContentObjectAccessComplete=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(e=t.objectId,n=t.score,r=void 0===n?100:n,f(e),!(r<0||r>100)){a.next=4;break}throw Error("Invalid AccessComplete score: "+r);case 4:return a.next=6,s.awrap(this.authClient.AccessComplete({id:e,score:r}));case 6:return a.abrupt("return",a.sent);case 7:case"end":return a.stop()}}),null,this)},e.Collection=function(t){var e;return s.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(e=t.collectionType,["accessGroups","contentObjects","contentTypes","contracts","libraries"].includes(e)){n.next=4;break}throw new Error("Invalid collection type: "+e);case 4:if(!this.signer){n.next=10;break}return n.next=7,s.awrap(this.userProfileClient.WalletAddress());case 7:n.t0=n.sent,n.next=11;break;case 10:n.t0=void 0;case 11:if(n.t0){n.next=14;break}throw new Error("Unable to get collection: User wallet doesn't exist");case 14:return this.Log("Retrieving ".concat(e," contract collection for user ").concat(this.signer.address)),n.next=17,s.awrap(this.ethClient.MakeProviderCall({methodName:"send",args:["elv_getWalletCollection",[this.contentSpaceId,"iusr".concat(this.utils.AddressToHash(this.signer.address)),e]]}));case 17:if(n.t1=n.sent,n.t1){n.next=20;break}n.t1=[];case 20:return n.abrupt("return",n.t1);case 21:case"end":return n.stop()}}),null,this)},e.VerifyContentObject=function(t){var e,n,r;return s.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,g({libraryId:e,objectId:n,versionHash:r}),a.next=4,s.awrap(ContentObjectVerification.VerifyContentObject({client:this,libraryId:e,objectId:n,versionHash:r}));case 4:return a.abrupt("return",a.sent);case 5:case"end":return a.stop()}}),null,this)},e.Proofs=function(t){var e,n,r,a,i;return s.async((function(o){for(;;)switch(o.prev=o.next){case 0:return e=t.libraryId,n=t.objectId,r=t.versionHash,a=t.partHash,g({libraryId:e,objectId:n,versionHash:r}),h(a),r&&(n=this.utils.DecodeVersionHash(r).objectId),i=c("q",r||n,"data",a,"proofs"),o.t0=this.utils,o.t1=this.HttpClient,o.next=9,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,versionHash:r}));case 9:return o.t2=o.sent,o.t3=i,o.t4={headers:o.t2,method:"GET",path:o.t3},o.t5=o.t1.Request.call(o.t1,o.t4),o.abrupt("return",o.t0.ResponseToJson.call(o.t0,o.t5));case 14:case"end":return o.stop()}}),null,this)},e.QParts=function(t){var e,n,r,a,i,o;return s.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=t.libraryId,n=t.objectId,r=t.partHash,a=t.format,i=void 0===a?"blob":a,g({libraryId:e,objectId:n,versionHash:versionHash}),h(r),o=c("qparts",r),u.t0=this.utils,u.t1=i,u.t2=this.HttpClient,u.next=9,s.awrap(this.authClient.AuthorizationHeader({libraryId:e,objectId:n,partHash:r}));case 9:return u.t3=u.sent,u.t4=o,u.t5={headers:u.t3,method:"GET",path:u.t4},u.t6=u.t2.Request.call(u.t2,u.t5),u.abrupt("return",u.t0.ResponseToFormat.call(u.t0,u.t1,u.t6));case 14:case"end":return u.stop()}}),null,this)}},function(t,e,n){var r=n(54)(n(25),"Map");t.exports=r},function(t,e,n){var r=n(25).Symbol;t.exports=r},function(t,e,n){(function(e){function n(t){return(n="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)}var r="object"==(void 0===e?"undefined":n(e))&&e&&e.Object===Object&&e;t.exports=r}).call(this,n(5))},function(t,e,n){var r=n(56),a=n(41);t.exports=function(t,e,n){(void 0===n||a(t[e],n))&&(void 0!==n||e in t)||r(t,e,n)}},function(t,e,n){var r=n(54),a=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=a},function(t,e,n){var r=n(230)(Object.getPrototypeOf,Object);t.exports=r},function(t,e){var n=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},function(t,e,n){var r=n(231),a=n(31),i=Object.prototype,s=i.hasOwnProperty,o=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return a(t)&&s.call(t,"callee")&&!o.call(t,"callee")};t.exports=u},function(t,e){var n=Array.isArray;t.exports=n},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,n){(function(t){function r(t){return(r="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)}var a=n(25),i=n(233),s="object"==r(e)&&e&&!e.nodeType&&e,o=s&&"object"==r(t)&&t&&!t.nodeType&&t,u=o&&o.exports===s?a.Buffer:void 0,c=(u?u.isBuffer:void 0)||i;t.exports=c}).call(this,n(10)(t))},function(t,e,n){var r=n(235),a=n(236),i=n(237),s=i&&i.isTypedArray,o=s?a(s):r;t.exports=o},function(t,e){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},function(t,e,n){var r=n(241),a=n(243),i=n(57);t.exports=function(t){return i(t)?r(t,!0):a(t)}},function(t,e){function n(t){return(n="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)}var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var a=n(t);return!!(e=null==e?9007199254740991:e)&&("number"==a||"symbol"!=a&&r.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e){t.exports=function(t){return t}},function(t,e,n){"use strict";(function(e,r){var a=n(46);t.exports=m;var i,s=n(51);m.ReadableState=b;n(32).EventEmitter;var o=function(t,e){return t.listeners(e).length},u=n(101),c=n(59).Buffer,A=e.Uint8Array||function(){};var d=n(33);d.inherits=n(0);var p=n(261),f=void 0;f=p&&p.debuglog?p.debuglog("stream"):function(){};var l,h=n(262),y=n(102);d.inherits(m,u);var g=["error","close","destroy","pause","resume"];function b(t,e){t=t||{};var r=e instanceof(i=i||n(21));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var a=t.highWaterMark,s=t.readableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:r&&(s||0===s)?s:o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(34).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(i=i||n(21),!(this instanceof m))return new m(t);this._readableState=new b(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function I(t,e,n,r,a){var i,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,w(t)}(t,s)):(a||(i=function(t,e){var n;r=e,c.isBuffer(r)||r instanceof A||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,e)),i?t.emit("error",i):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):C(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?C(t,s,e,!1):B(t,s)):C(t,s,e,!1))):r||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(s)}function C(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&w(t)),B(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=y.destroy,m.prototype._undestroy=y.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),I(this,t,e,!1,n)},m.prototype.unshift=function(t){return I(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=n(34).StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};function v(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function w(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?a.nextTick(E,t):E(t))}function E(t){f("emit readable"),t.emit("readable"),x(t)}function B(t,e){e.readingMore||(e.readingMore=!0,a.nextTick(Q,t,e))}function Q(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(f("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function M(t){f("readable nexttick read 0"),t.read(0)}function _(t,e){e.reading||(f("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),x(t),e.flowing&&!e.reading&&t.read(0)}function x(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function k(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,a=n.data;t-=a.length;for(;n=n.next;){var i=n.data,s=t>i.length?i.length:t;if(s===i.length?a+=i:a+=i.slice(0,t),0===(t-=s)){s===i.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=i.slice(s));break}++r}return e.length-=r,a}(t,e):function(t,e){var n=c.allocUnsafe(t),r=e.head,a=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(n,n.length-t,0,s),0===(t-=s)){s===i.length?(++a,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=i.slice(s));break}++a}return e.length-=a,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function S(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,a.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}m.prototype.read=function(t){f("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?S(this):w(this),null;if(0===(t=v(t,e))&&e.ended)return 0===e.length&&S(this),null;var r,a=e.needReadable;return f("need readable",a),(0===e.length||e.length-t<e.highWaterMark)&&f("length less than watermark",a=!0),e.ended||e.reading?f("reading or ended",a=!1):a&&(f("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=v(n,e))),null===(r=t>0?k(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&S(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?A:m;function c(e,r){f("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",b),t.removeListener("drain",d),t.removeListener("error",y),t.removeListener("unpipe",c),n.removeListener("end",A),n.removeListener("end",m),n.removeListener("data",h),p=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function A(){f("onend"),t.end()}i.endEmitted?a.nextTick(u):n.once("end",u),t.on("unpipe",c);var d=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,x(t))}}(n);t.on("drain",d);var p=!1;var l=!1;function h(e){f("ondata"),l=!1,!1!==t.write(e)||l||((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==R(i.pipes,t))&&!p&&(f("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,l=!0),n.pause())}function y(e){f("onerror",e),m(),t.removeListener("error",y),0===o(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",b),m()}function b(){f("onfinish"),t.removeListener("close",g),m()}function m(){f("unpipe"),n.unpipe(t)}return n.on("data",h),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",y),t.once("close",g),t.once("finish",b),t.emit("pipe",n),i.flowing||(f("pipe resume"),n.resume()),t},m.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,a=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<a;i++)r[i].emit("unpipe",this,n);return this}var s=R(e.pipes,t);return-1===s?this:(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n),this)},m.prototype.on=function(t,e){var n=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&w(this):a.nextTick(M,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,a.nextTick(_,t,e))}(this,t)),this},m.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var a in t.on("end",(function(){if(f("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(a){(f("wrapped data"),n.decoder&&(a=n.decoder.write(a)),n.objectMode&&null==a)||(n.objectMode||a&&a.length)&&(e.push(a)||(r=!0,t.pause()))})),t)void 0===this[a]&&"function"==typeof t[a]&&(this[a]=function(e){return function(){return t[e].apply(t,arguments)}}(a));for(var i=0;i<g.length;i++)t.on(g[i],this.emit.bind(this,g[i]));return this._read=function(e){f("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=k}).call(this,n(5),n(6))},function(t,e,n){t.exports=n(32).EventEmitter},function(t,e,n){"use strict";var r=n(46);function a(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(a,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(r.nextTick(a,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(5))},function(t,e,n){"use strict";t.exports=s;var r=n(21),a=n(33);function i(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function s(t){if(!(this instanceof s))return new s(t);r.call(this,t),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",o)}function o(){var t=this;"function"==typeof this._flush?this._flush((function(e,n){u(t,e,n)})):u(this,null,null)}function u(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}a.inherits=n(0),a.inherits(s,r),s.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},s.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var a=this._readableState;(r.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},s.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},s.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,(function(t){e(t),n.emit("close")}))}},function(t,e,n){"use strict";var r=n(1).Buffer,a=n(45).Transform;function i(t){a.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(0)(i,a),i.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},i.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,a=0;this._blockOffset+t.length-a>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=t[a++];this._update(),this._blockOffset=0}for(;a<t.length;)n[this._blockOffset++]=t[a++];for(var s=0,o=8*t.length;o>0;++s)this._length[s]+=o,(o=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*o);return this},i.prototype._update=function(){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=i},function(t,e,n){var r=n(0),a=n(27),i=n(1).Buffer,s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=new Array(64);function u(){this.init(),this._w=o,a.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function A(t,e,n){return t&e|n&(t|e)}function d(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function p(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,a),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,o=0|this._d,u=0|this._e,l=0|this._f,h=0|this._g,y=0|this._h,g=0;g<16;++g)n[g]=t.readInt32BE(4*g);for(;g<64;++g)n[g]=0|(((e=n[g-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[g-7]+f(n[g-15])+n[g-16];for(var b=0;b<64;++b){var m=y+p(u)+c(u,l,h)+s[b]+n[b]|0,I=d(r)+A(r,a,i)|0;y=h,h=l,l=u,u=o+m|0,o=i,i=a,a=r,r=m+I|0}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=u+this._e|0,this._f=l+this._f|0,this._g=h+this._g|0,this._h=y+this._h|0},u.prototype._hash=function(){var t=i.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,n){var r=n(0),a=n(27),i=n(1).Buffer,s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],o=new Array(160);function u(){this.init(),this._w=o,a.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function A(t,e,n){return t&e|n&(t|e)}function d(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function p(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function l(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function h(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function y(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function g(t,e){return t>>>0<e>>>0?1:0}r(u,a),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,a=0|this._ch,i=0|this._dh,o=0|this._eh,u=0|this._fh,b=0|this._gh,m=0|this._hh,I=0|this._al,C=0|this._bl,v=0|this._cl,w=0|this._dl,E=0|this._el,B=0|this._fl,Q=0|this._gl,M=0|this._hl,_=0;_<32;_+=2)e[_]=t.readInt32BE(4*_),e[_+1]=t.readInt32BE(4*_+4);for(;_<160;_+=2){var x=e[_-30],k=e[_-30+1],S=f(x,k),D=l(k,x),R=h(x=e[_-4],k=e[_-4+1]),N=y(k,x),T=e[_-14],O=e[_-14+1],H=e[_-32],L=e[_-32+1],U=D+O|0,F=S+T+g(U,D)|0;F=(F=F+R+g(U=U+N|0,N)|0)+H+g(U=U+L|0,L)|0,e[_]=F,e[_+1]=U}for(var j=0;j<160;j+=2){F=e[j],U=e[j+1];var P=A(n,r,a),G=A(I,C,v),Y=d(n,I),q=d(I,n),K=p(o,E),z=p(E,o),J=s[j],V=s[j+1],W=c(o,u,b),Z=c(E,B,Q),X=M+z|0,$=m+K+g(X,M)|0;$=($=($=$+W+g(X=X+Z|0,Z)|0)+J+g(X=X+V|0,V)|0)+F+g(X=X+U|0,U)|0;var tt=q+G|0,et=Y+P+g(tt,q)|0;m=b,M=Q,b=u,Q=B,u=o,B=E,o=i+$+g(E=w+X|0,w)|0,i=a,w=v,a=r,v=C,r=n,C=I,n=$+et+g(I=X+tt|0,X)|0}this._al=this._al+I|0,this._bl=this._bl+C|0,this._cl=this._cl+v|0,this._dl=this._dl+w|0,this._el=this._el+E|0,this._fl=this._fl+B|0,this._gl=this._gl+Q|0,this._hl=this._hl+M|0,this._ah=this._ah+n+g(this._al,I)|0,this._bh=this._bh+r+g(this._bl,C)|0,this._ch=this._ch+a+g(this._cl,v)|0,this._dh=this._dh+i+g(this._dl,w)|0,this._eh=this._eh+o+g(this._el,E)|0,this._fh=this._fh+u+g(this._fl,B)|0,this._gh=this._gh+b+g(this._gl,Q)|0,this._hh=this._hh+m+g(this._hl,M)|0},u.prototype._hash=function(){var t=i.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,n){var r=n(61);t.exports=function(t){return(new r).update(t).digest()}},function(t,e,n){t.exports=n(110)},function(t){t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(t,e,n){(function(e){var n=Math.pow(2,30)-1;function r(t,n){if("string"!=typeof t&&!e.isBuffer(t))throw new TypeError(n+" must be a buffer or string")}t.exports=function(t,e,a,i){if(r(t,"Password"),r(e,"Salt"),"number"!=typeof a)throw new TypeError("Iterations not a number");if(a<0)throw new TypeError("Bad iterations");if("number"!=typeof i)throw new TypeError("Key length not a number");if(i<0||i>n||i!=i)throw new TypeError("Bad key length")}}).call(this,n(2).Buffer)},function(t,e,n){(function(e){var n;e.browser?n="utf-8":n=parseInt(e.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";t.exports=n}).call(this,n(6))},function(t,e,n){var r=n(108),a=n(62),i=n(63),s=n(111),o=n(112),u=n(1).Buffer,c=u.alloc(128),A={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function d(t,e,n){var s=function(t){function e(e){return i(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new a).update(t).digest()}:"md5"===t?r:e}(t),o="sha512"===t||"sha384"===t?128:64;e.length>o?e=s(e):e.length<o&&(e=u.concat([e,c],o));for(var d=u.allocUnsafe(o+A[t]),p=u.allocUnsafe(o+A[t]),f=0;f<o;f++)d[f]=54^e[f],p[f]=92^e[f];var l=u.allocUnsafe(o+n+4);d.copy(l,0,0,o),this.ipad1=l,this.ipad2=d,this.opad=p,this.alg=t,this.blocksize=o,this.hash=s,this.size=A[t]}d.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,n,r,a){s(t,e,n,r),u.isBuffer(t)||(t=u.from(t,o)),u.isBuffer(e)||(e=u.from(e,o));var i=new d(a=a||"sha1",t,e.length),c=u.allocUnsafe(r),p=u.allocUnsafe(e.length+4);e.copy(p,0,0,e.length);for(var f=0,l=A[a],h=Math.ceil(r/l),y=1;y<=h;y++){p.writeUInt32BE(y,e.length);for(var g=i.run(p,i.ipad1),b=g,m=1;m<n;m++){b=i.run(b,i.ipad2);for(var I=0;I<l;I++)g[I]^=b[I]}g.copy(c,f),f+=l}return c}},function(t,e,n){var r=n(278),a=n(67),i=n(68),s=n(291),o=n(48);function u(t,e,n){if(t=t.toLowerCase(),i[t])return a.createCipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),i[t])return a.createDecipheriv(t,e,n);if(s[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),i[t])n=i[t].key,r=i[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var a=o(e,!1,n,r);return u(t,a.key,a.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),i[t])n=i[t].key,r=i[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");n=8*s[t].key,r=s[t].iv}var a=o(e,!1,n,r);return c(t,a.key,a.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(a.getCiphers())}},function(t,e,n){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var a=0,i=0,s=6;s>=0;s-=2){for(var o=0;o<=24;o+=8)a<<=1,a|=e>>>o+s&1;for(o=0;o<=24;o+=8)a<<=1,a|=t>>>o+s&1}for(s=6;s>=0;s-=2){for(o=1;o<=25;o+=8)i<<=1,i|=e>>>o+s&1;for(o=1;o<=25;o+=8)i<<=1,i|=t>>>o+s&1}n[r+0]=a>>>0,n[r+1]=i>>>0},e.rip=function(t,e,n,r){for(var a=0,i=0,s=0;s<4;s++)for(var o=24;o>=0;o-=8)a<<=1,a|=e>>>o+s&1,a<<=1,a|=t>>>o+s&1;for(s=4;s<8;s++)for(o=24;o>=0;o-=8)i<<=1,i|=e>>>o+s&1,i<<=1,i|=t>>>o+s&1;n[r+0]=a>>>0,n[r+1]=i>>>0},e.pc1=function(t,e,n,r){for(var a=0,i=0,s=7;s>=5;s--){for(var o=0;o<=24;o+=8)a<<=1,a|=e>>o+s&1;for(o=0;o<=24;o+=8)a<<=1,a|=t>>o+s&1}for(o=0;o<=24;o+=8)a<<=1,a|=e>>o+s&1;for(s=1;s<=3;s++){for(o=0;o<=24;o+=8)i<<=1,i|=e>>o+s&1;for(o=0;o<=24;o+=8)i<<=1,i|=t>>o+s&1}for(o=0;o<=24;o+=8)i<<=1,i|=t>>o+s&1;n[r+0]=a>>>0,n[r+1]=i>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,a){for(var i=0,s=0,o=r.length>>>1,u=0;u<o;u++)i<<=1,i|=t>>>r[u]&1;for(u=o;u<r.length;u++)s<<=1,s|=e>>>r[u]&1;n[a+0]=i>>>0,n[a+1]=s>>>0},e.expand=function(t,e,n){var r=0,a=0;r=(1&t)<<5|t>>>27;for(var i=23;i>=15;i-=4)r<<=6,r|=t>>>i&63;for(i=11;i>=3;i-=4)a|=t>>>i&63,a<<=6;a|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=a>>>0};var a=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,r=0;r<4;r++){n<<=4,n|=a[64*r+(t>>>18-6*r&63)]}for(r=0;r<4;r++){n<<=4,n|=a[256+64*r+(e>>>18-6*r&63)]}return n>>>0};var i=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n<i.length;n++)e<<=1,e|=t>>>i[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length<e;)r="0"+r;for(var a=[],i=0;i<e;i+=n)a.push(r.slice(i,i+n));return a.join(" ")}},function(t,e,n){"use strict";var r=n(7),a=n(0),i=n(115),s=n(66);function o(){this.tmp=new Array(2),this.keys=null}function u(t){s.call(this,t);var e=new o;this._desState=e,this.deriveKeys(e,t.key)}a(u,s),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=i.readUInt32BE(e,0),a=i.readUInt32BE(e,4);i.pc1(n,a,t.tmp,0),n=t.tmp[0],a=t.tmp[1];for(var s=0;s<t.keys.length;s+=2){var o=c[s>>>1];n=i.r28shl(n,o),a=i.r28shl(a,o),i.pc2(n,a,t.keys,s)}},u.prototype._update=function(t,e,n,r){var a=this._desState,s=i.readUInt32BE(t,e),o=i.readUInt32BE(t,e+4);i.ip(s,o,a.tmp,0),s=a.tmp[0],o=a.tmp[1],"encrypt"===this.type?this._encrypt(a,s,o,a.tmp,0):this._decrypt(a,s,o,a.tmp,0),s=a.tmp[0],o=a.tmp[1],i.writeUInt32BE(n,s,r),i.writeUInt32BE(n,o,r+4)},u.prototype._pad=function(t,e){for(var n=t.length-e,r=e;r<t.length;r++)t[r]=n;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],n=t.length-e;n<t.length;n++)r.equal(t[n],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,n,r,a){for(var s=e,o=n,u=0;u<t.keys.length;u+=2){var c=t.keys[u],A=t.keys[u+1];i.expand(o,t.tmp,0),c^=t.tmp[0],A^=t.tmp[1];var d=i.substitute(c,A),p=o;o=(s^i.permute(d))>>>0,s=p}i.rip(o,s,r,a)},u.prototype._decrypt=function(t,e,n,r,a){for(var s=n,o=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],A=t.keys[u+1];i.expand(s,t.tmp,0),c^=t.tmp[0],A^=t.tmp[1];var d=i.substitute(c,A),p=s;s=(o^i.permute(d))>>>0,o=p}i.rip(s,o,r,a)}},function(t,e,n){var r=n(35),a=n(1).Buffer,i=n(118);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return i(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),i=t._cache.length;t._cache=a.concat([t._cache,a.allocUnsafe(16*n)]);for(var o=0;o<n;o++){var u=s(t),c=i+16*o;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var A=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),r(e,A)}},function(t,e){t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,e,n){var r=n(47),a=n(1).Buffer,i=n(19),s=n(0),o=n(289),u=n(35),c=n(118);function A(t,e,n,s){i.call(this);var u=a.alloc(4,0);this._cipher=new r.AES(e);var A=this._cipher.encryptBlock(u);this._ghash=new o(A),n=function(t,e,n){if(12===e.length)return t._finID=a.concat([e,a.from([0,0,0,1])]),a.concat([e,a.from([0,0,0,2])]);var r=new o(n),i=e.length,s=i%16;r.update(e),s&&(s=16-s,r.update(a.alloc(s,0))),r.update(a.alloc(8,0));var u=8*i,A=a.alloc(8);A.writeUIntBE(u,0,8),r.update(A),t._finID=r.state;var d=a.from(t._finID);return c(d),d}(this,n,A),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(A,i),A.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=a.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},A.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),a=0;a<r;++a)n+=t[a]^e[a];return n}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},A.prototype.getAuthTag=function(){if(this._decrypt||!a.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},A.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},A.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=A},function(t,e,n){var r=n(47),a=n(1).Buffer,i=n(19);function s(t,e,n,s){i.call(this),this._cipher=new r.AES(e),this._prev=a.from(n),this._cache=a.allocUnsafe(0),this._secCache=a.allocUnsafe(0),this._decrypt=s,this._mode=t}n(0)(s,i),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},function(t,e,n){(function(t){var r=n(123),a=n(294),i=n(295);var s={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var n=new t(a[e].prime,"hex"),r=new t(a[e].gen,"hex");return new i(n,r)},e.createDiffieHellman=e.DiffieHellman=function e(n,a,o,u){return t.isBuffer(a)||void 0===s[a]?e(n,"binary",a,o):(a=a||"binary",u=u||"binary",o=o||new t([2]),t.isBuffer(o)||(o=new t(o,u)),"number"==typeof n?new i(r(n,o),o,!0):(t.isBuffer(n)||(n=new t(n,a)),new i(n,o,!0)))}}).call(this,n(2).Buffer)},function(t,e,n){var r=n(22);t.exports=b,b.simpleSieve=y,b.fermatTest=g;var a=n(3),i=new a(24),s=new(n(124)),o=new a(1),u=new a(2),c=new a(5),A=(new a(16),new a(8),new a(10)),d=new a(3),p=(new a(7),new a(11)),f=new a(4),l=(new a(12),null);function h(){if(null!==l)return l;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),a=0;a<e&&t[a]<=r&&n%t[a]!=0;a++);e!==a&&t[a]<=r||(t[e++]=n)}return l=t,t}function y(t){for(var e=h(),n=0;n<e.length;n++)if(0===t.modn(e[n]))return 0===t.cmpn(e[n]);return!0}function g(t){var e=a.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function b(t,e){if(t<16)return new a(2===e||5===e?[140,123]:[140,39]);var n,l;for(e=new a(e);;){for(n=new a(r(Math.ceil(t/8)));n.bitLength()>t;)n.ishrn(1);if(n.isEven()&&n.iadd(o),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(A).cmp(d);)n.iadd(f)}else for(;n.mod(i).cmp(p);)n.iadd(f);if(y(l=n.shrn(1))&&y(n)&&g(l)&&g(n)&&s.test(l)&&s.test(n))return n}}},function(t,e,n){var r=n(3),a=n(69);function i(t){this.rand=t||new a.Rand}t.exports=i,i.create=function(t){return new i(t)},i.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var a=new r(this.rand.generate(n))}while(a.cmp(t)>=0);return a},i.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},i.prototype.test=function(t,e,n){var a=t.bitLength(),i=r.mont(t),s=new r(1).toRed(i);e||(e=Math.max(1,a/48|0));for(var o=t.subn(1),u=0;!o.testn(u);u++);for(var c=t.shrn(u),A=o.toRed(i);e>0;e--){var d=this._randrange(new r(2),o);n&&n(d);var p=d.toRed(i).redPow(c);if(0!==p.cmp(s)&&0!==p.cmp(A)){for(var f=1;f<u;f++){if(0===(p=p.redSqr()).cmp(s))return!1;if(0===p.cmp(A))break}if(f===u)return!1}}return!0},i.prototype.getDivisor=function(t,e){var n=t.bitLength(),a=r.mont(t),i=new r(1).toRed(a);e||(e=Math.max(1,n/48|0));for(var s=t.subn(1),o=0;!s.testn(o);o++);for(var u=t.shrn(o),c=s.toRed(a);e>0;e--){var A=this._randrange(new r(2),s),d=t.gcd(A);if(0!==d.cmpn(1))return d;var p=A.toRed(a).redPow(u);if(0!==p.cmp(i)&&0!==p.cmp(c)){for(var f=1;f<o;f++){if(0===(p=p.redSqr()).cmp(i))return p.fromRed().subn(1).gcd(t);if(0===p.cmp(c))break}if(f===o)return(p=p.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,n){(function(e){var r=n(26),a=n(45),i=n(0),s=n(296),o=n(328),u=n(110);function c(t){a.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function A(t){a.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=r(e.hash),this._tag=e.id,this._signType=e.sign}function d(t){return new c(t)}function p(t){return new A(t)}Object.keys(u).forEach((function(t){u[t].id=new e(u[t].id,"hex"),u[t.toLowerCase()]=u[t]})),i(c,a.Writable),c.prototype._write=function(t,e,n){this._hash.update(t),n()},c.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},c.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=s(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},i(A,a.Writable),A.prototype._write=function(t,e,n){this._hash.update(t),n()},A.prototype.update=function(t,n){return"string"==typeof t&&(t=new e(t,n)),this._hash.update(t),this},A.prototype.verify=function(t,n,r){"string"==typeof n&&(n=new e(n,r)),this.end();var a=this._hash.digest();return o(n,a,t,this._signType,this._tag)},t.exports={Sign:d,Verify:p,createSign:d,createVerify:p}}).call(this,n(2).Buffer)},function(t,e,n){"use strict";var r=e;function a(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n<t.length;n++)e+=a(t[n].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var a=t.charCodeAt(r),i=a>>8,s=255&a;i?n.push(i,s):n.push(s)}return n},r.zero2=a,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},function(t,e,n){"use strict";var r=e;r.base=n(49),r.short=n(298),r.mont=n(299),r.edwards=n(300)},function(t,e,n){"use strict";var r=n(11).rotr32;function a(t,e,n){return t&e^~t&n}function i(t,e,n){return t&e^t&n^e&n}function s(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?a(e,n,r):1===t||3===t?s(e,n,r):2===t?i(e,n,r):void 0},e.ch32=a,e.maj32=i,e.p32=s,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},function(t,e,n){"use strict";var r=n(11),a=n(36),i=n(128),s=n(7),o=r.sum32,u=r.sum32_4,c=r.sum32_5,A=i.ch32,d=i.maj32,p=i.s0_256,f=i.s1_256,l=i.g0_256,h=i.g1_256,y=a.BlockHash,g=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;y.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=new Array(64)}r.inherits(b,y),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=u(h(n[r-2]),n[r-7],l(n[r-15]),n[r-16]);var a=this.h[0],i=this.h[1],y=this.h[2],g=this.h[3],b=this.h[4],m=this.h[5],I=this.h[6],C=this.h[7];for(s(this.k.length===n.length),r=0;r<n.length;r++){var v=c(C,f(b),A(b,m,I),this.k[r],n[r]),w=o(p(a),d(a,i,y));C=I,I=m,m=b,b=o(g,v),g=y,y=i,i=a,a=o(v,w)}this.h[0]=o(this.h[0],a),this.h[1]=o(this.h[1],i),this.h[2]=o(this.h[2],y),this.h[3]=o(this.h[3],g),this.h[4]=o(this.h[4],b),this.h[5]=o(this.h[5],m),this.h[6]=o(this.h[6],I),this.h[7]=o(this.h[7],C)},b.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(11),a=n(36),i=n(7),s=r.rotr64_hi,o=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,A=r.sum64,d=r.sum64_hi,p=r.sum64_lo,f=r.sum64_4_hi,l=r.sum64_4_lo,h=r.sum64_5_hi,y=r.sum64_5_lo,g=a.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function I(t,e,n,r,a){var i=t&n^~t&a;return i<0&&(i+=4294967296),i}function C(t,e,n,r,a,i){var s=e&r^~e&i;return s<0&&(s+=4294967296),s}function v(t,e,n,r,a){var i=t&n^t&a^n&a;return i<0&&(i+=4294967296),i}function w(t,e,n,r,a,i){var s=e&r^e&i^r&i;return s<0&&(s+=4294967296),s}function E(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function B(t,e){var n=o(t,e,28)^o(e,t,2)^o(e,t,7);return n<0&&(n+=4294967296),n}function Q(t,e){var n=s(t,e,14)^s(t,e,18)^s(e,t,9);return n<0&&(n+=4294967296),n}function M(t,e){var n=o(t,e,14)^o(t,e,18)^o(e,t,9);return n<0&&(n+=4294967296),n}function _(t,e){var n=s(t,e,1)^s(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function x(t,e){var n=o(t,e,1)^o(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function k(t,e){var n=s(t,e,19)^s(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}function S(t,e){var n=o(t,e,19)^o(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(m,g),t.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var a=k(n[r-4],n[r-3]),i=S(n[r-4],n[r-3]),s=n[r-14],o=n[r-13],u=_(n[r-30],n[r-29]),c=x(n[r-30],n[r-29]),A=n[r-32],d=n[r-31];n[r]=f(a,i,s,o,u,c,A,d),n[r+1]=l(a,i,s,o,u,c,A,d)}},m.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],a=this.h[1],s=this.h[2],o=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],l=this.h[7],g=this.h[8],b=this.h[9],m=this.h[10],_=this.h[11],x=this.h[12],k=this.h[13],S=this.h[14],D=this.h[15];i(this.k.length===n.length);for(var R=0;R<n.length;R+=2){var N=S,T=D,O=Q(g,b),H=M(g,b),L=I(g,b,m,_,x),U=C(g,b,m,_,x,k),F=this.k[R],j=this.k[R+1],P=n[R],G=n[R+1],Y=h(N,T,O,H,L,U,F,j,P,G),q=y(N,T,O,H,L,U,F,j,P,G);N=E(r,a),T=B(r,a),O=v(r,a,s,o,u),H=w(r,a,s,o,u,c);var K=d(N,T,O,H),z=p(N,T,O,H);S=x,D=k,x=m,k=_,m=g,_=b,g=d(f,l,Y,q),b=p(l,l,Y,q),f=u,l=c,u=s,c=o,s=r,o=a,r=d(Y,q,K,z),a=p(Y,q,K,z)}A(this.h,0,r,a),A(this.h,2,s,o),A(this.h,4,u,c),A(this.h,6,f,l),A(this.h,8,g,b),A(this.h,10,m,_),A(this.h,12,x,k),A(this.h,14,S,D)},m.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){function r(t){return(r="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)}var a=n(0),i=n(38).Reporter,s=n(2).Buffer;function o(t,e){i.call(this,e),s.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function u(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof u||(t=new u(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=s.byteLength(t);else{if(!s.isBuffer(t))return e.error("Unsupported type: "+r(t));this.value=t,this.length=t.length}}a(o,i),e.DecoderBuffer=o,o.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},o.prototype.restore=function(t){var e=new o(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},o.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var n=new o(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},o.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=u,u.prototype.join=function(t,e){return t||(t=new s(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach((function(n){n.join(t,e),e+=n.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):s.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},function(t,e,n){var r=e;r._reverse=function(t){var e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);var r=t[n];e[r]=n})),e},r.der=n(320)},function(t,e,n){var r=n(0),a=n(37),i=a.base,s=a.bignum,o=a.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){i.Node.call(this,"der",t)}function A(t,e){var n=t.readUInt8(e);if(t.isError(n))return n;var r=o.tagClass[n>>6],a=0==(32&n);if(31==(31&n)){var i=n;for(n=0;128==(128&i);){if(i=t.readUInt8(e),t.isError(i))return i;n<<=7,n|=127&i}}else n&=31;return{cls:r,primitive:a,tag:n,tagStr:o.tag[n]}}function d(t,e,n){var r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;var a=127&r;if(a>4)return t.error("length octect is too long");r=0;for(var i=0;i<a;i++){r<<=8;var s=t.readUInt8(n);if(t.isError(s))return s;r|=s}return r}t.exports=u,u.prototype.decode=function(t,e){return t instanceof i.DecoderBuffer||(t=new i.DecoderBuffer(t,e)),this.tree._decode(t,e)},r(c,i.Node),c.prototype._peekTag=function(t,e,n){if(t.isEmpty())return!1;var r=t.save(),a=A(t,'Failed to peek tag: "'+e+'"');return t.isError(a)?a:(t.restore(r),a.tag===e||a.tagStr===e||a.tagStr+"of"===e||n)},c.prototype._decodeTag=function(t,e,n){var r=A(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;var a=d(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(a))return a;if(!n&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==a)return t.skip(a,'Failed to match body of: "'+e+'"');var i=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(a=t.offset-i.offset,t.restore(i),t.skip(a,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){var n=A(t,e);if(t.isError(n))return n;var r,a=d(t,n.primitive,e);if(t.isError(a))return a;if(r=n.primitive||null!==a?t.skip(a):this._skipUntilEnd(t,e),t.isError(r))return r;if("end"===n.tagStr)break}},c.prototype._decodeList=function(t,e,n,r){for(var a=[];!t.isEmpty();){var i=this._peekTag(t,"end");if(t.isError(i))return i;var s=n.decode(t,"der",r);if(t.isError(s)&&i)break;a.push(s)}return a},c.prototype._decodeStr=function(t,e){if("bitstr"===e){var n=t.readUInt8();return t.isError(n)?n:{unused:n,data:t.raw()}}if("bmpstr"===e){var r=t.raw();if(r.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var a="",i=0;i<r.length/2;i++)a+=String.fromCharCode(r.readUInt16BE(2*i));return a}if("numstr"===e){var s=t.raw().toString("ascii");return this._isNumstr(s)?s:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var o=t.raw().toString("ascii");return this._isPrintstr(o)?o:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,n){for(var r,a=[],i=0;!t.isEmpty();){var s=t.readUInt8();i<<=7,i|=127&s,0==(128&s)&&(a.push(i),i=0)}128&s&&a.push(i);var o=a[0]/40|0,u=a[0]%40;if(r=n?a:[o,u].concat(a.slice(1)),e){var c=e[r.join(" ")];void 0===c&&(c=e[r.join(".")]),void 0!==c&&(r=c)}return r},c.prototype._decodeTime=function(t,e){var n=t.raw().toString();if("gentime"===e)var r=0|n.slice(0,4),a=0|n.slice(4,6),i=0|n.slice(6,8),s=0|n.slice(8,10),o=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|n.slice(0,2),a=0|n.slice(2,4),i=0|n.slice(4,6),s=0|n.slice(6,8),o=0|n.slice(8,10),u=0|n.slice(10,12);r=r<70?2e3+r:1900+r}return Date.UTC(r,a-1,i,s,o,u,0)},c.prototype._decodeNull=function(t){return null},c.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){var n=t.raw(),r=new s(n);return e&&(r=e[r.toString(10)]||r),r},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t,e,n){var r=n(0),a=n(2).Buffer,i=n(37),s=i.base,o=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){s.Node.call(this,"der",t)}function A(t){return t<10?"0"+t:t}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(c,s.Node),c.prototype._encodeComposite=function(t,e,n,r){var i,s=function(t,e,n,r){var a;"seqof"===t?t="seq":"setof"===t&&(t="set");if(o.tagByName.hasOwnProperty(t))a=o.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);a=t}if(a>=31)return r.error("Multi-octet tag encoding unsupported");e||(a|=32);return a|=o.tagClassByName[n||"universal"]<<6}(t,e,n,this.reporter);if(r.length<128)return(i=new a(2))[0]=s,i[1]=r.length,this._createEncoderBuffer([i,r]);for(var u=1,c=r.length;c>=256;c>>=8)u++;(i=new a(2+u))[0]=s,i[1]=128|u;c=1+u;for(var A=r.length;A>0;c--,A>>=8)i[c]=255&A;return this._createEncoderBuffer([i,r])},c.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var n=new a(2*t.length),r=0;r<t.length;r++)n.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(n)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)?this._createEncoderBuffer(t):"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},c.prototype._encodeObjid=function(t,e,n){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var r=0;r<t.length;r++)t[r]|=0}else if(Array.isArray(t)){t=t.slice();for(r=0;r<t.length;r++)t[r]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var i=0;for(r=0;r<t.length;r++){var s=t[r];for(i++;s>=128;s>>=7)i++}var o=new a(i),u=o.length-1;for(r=t.length-1;r>=0;r--){s=t[r];for(o[u--]=127&s;(s>>=7)>0;)o[u--]=128|127&s}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(t,e){var n,r=new Date(t);return"gentime"===e?n=[A(r.getFullYear()),A(r.getUTCMonth()+1),A(r.getUTCDate()),A(r.getUTCHours()),A(r.getUTCMinutes()),A(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[A(r.getFullYear()%100),A(r.getUTCMonth()+1),A(r.getUTCDate()),A(r.getUTCHours()),A(r.getUTCMinutes()),A(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!a.isBuffer(t)){var n=t.toArray();!t.sign&&128&n[0]&&n.unshift(0),t=new a(n)}if(a.isBuffer(t)){var r=t.length;0===t.length&&r++;var i=new a(r);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);r=1;for(var s=t;s>=256;s>>=8)r++;for(s=(i=new Array(r)).length-1;s>=0;s--)i[s]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new a(i))},c.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},c.prototype._skipDefault=function(t,e,n){var r,a=this._baseState;if(null===a.default)return!1;var i=t.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,e,n).join()),i.length!==a.defaultBuffer.length)return!1;for(r=0;r<i.length;r++)if(i[r]!==a.defaultBuffer[r])return!1;return!0}},function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(t,e,n){(function(e){var r=n(71),a=n(3);t.exports=function(t){return new s(t)};var i={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function s(t){this.curveType=i[t],this.curveType||(this.curveType={name:t}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}function o(t,n,r){Array.isArray(t)||(t=t.toArray());var a=new e(t);if(r&&a.length<r){var i=new e(r-a.length);i.fill(0),a=e.concat([i,a])}return n?a.toString(n):a}i.p224=i.secp224r1,i.p256=i.secp256r1=i.prime256v1,i.p192=i.secp192r1=i.prime192v1,i.p384=i.secp384r1,i.p521=i.secp521r1,s.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},s.prototype.computeSecret=function(t,n,r){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),o(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},s.prototype.getPublicKey=function(t,e){var n=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(n[n.length-1]%2?n[0]=7:n[0]=6),o(n,t)},s.prototype.getPrivateKey=function(t){return o(this.keys.getPrivate(),t)},s.prototype.setPublicKey=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.keys._importPublic(t),this},s.prototype.setPrivateKey=function(t,n){n=n||"utf8",e.isBuffer(t)||(t=new e(t,n));var r=new a(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}}).call(this,n(2).Buffer)},function(t,e,n){e.publicEncrypt=n(329),e.privateDecrypt=n(330),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},function(t,e,n){var r=n(26),a=n(1).Buffer;function i(t){var e=a.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,s=a.alloc(0),o=0;s.length<e;)n=i(o++),s=a.concat([s,r("sha1").update(t).update(n).digest()]);return s.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var n=t.length,r=-1;++r<n;)t[r]^=e[r];return t}},function(t,e,n){var r=n(3),a=n(1).Buffer;t.exports=function(t,e){return a.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},function(t,e,n){"use strict";(function(t,r){function a(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var i=n(1),s=n(22),o=i.Buffer,u=i.kMaxLength,c=t.crypto||t.msCrypto,A=Math.pow(2,32)-1;function d(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>A||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function p(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>A||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function f(t,e,n,a){if(r.browser){var i=t.buffer,o=new Uint8Array(i,e,n);return c.getRandomValues(o),a?void r.nextTick((function(){a(null,t)})):t}if(!a)return s(n).copy(t,e),t;s(n,(function(n,r){if(n)return a(n);r.copy(t,e),a(null,t)}))}c&&c.getRandomValues||!r.browser?(e.randomFill=function(e,n,r,a){if(!(o.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)a=n,n=0,r=e.length;else if("function"==typeof r)a=r,r=e.length-n;else if("function"!=typeof a)throw new TypeError('"cb" argument must be a function');return d(n,e.length),p(r,n,e.length),f(e,n,r,a)},e.randomFillSync=function(e,n,r){void 0===n&&(n=0);if(!(o.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(n,e.length),void 0===r&&(r=e.length-n);return p(r,n,e.length),f(e,n,r)}):(e.randomFill=a,e.randomFillSync=a)}).call(this,n(5),n(6))},function(t,e,n){(function(t){var r,a,i,s;function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),t}function A(t){return(A="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)}window,s=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==A(t)&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(r,a,function(e){return t[e]}.bind(null,a));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return i}));var r=n(7),a=n.n(r),i=function(){function e(t){o(this,e),this.wasm=t}return c(e,[{key:"arrayToBuf",value:function(e){var n=this.wasm,r={ptr:null,len:0};if(!e)return r;var a=null;if(e instanceof Uint8Array||void 0!==t&&e instanceof t)a=e;else{if(!(e instanceof ArrayBuffer||e.__proto__.toString().includes("ArrayBuffer")))throw new Error("arrayToBuf() failed: Expected Uint8Array, Buffer, or\n ArrayBuffer");a=new Uint8Array(e)}return r.len=a.length,r.ptr=n._malloc(a.length),n.writeArrayToMemory(a,r.ptr),r}},{key:"arrayToSmartBuf",value:function(t){var e=this.wasm,n=this.arrayToBuf(t);return n.ptr&&setTimeout((function(){e._free(n.ptr),n.len=0,n.ptr=null}),0),n}},{key:"smartMalloc",value:function(t){var e=this.wasm,n=e._malloc(t);return setTimeout((function(){e._free(n)}),0),n}}],[{key:"bytesToHex",value:function(t){return t.reduce((function(t,e){return t+e.toString(16).padStart(2,"0")}),"")}},{key:"bytesToBinary",value:function(t){return t.reduce((function(t,e){return t+e.toString(2).padStart(8,"0")+" "}),"")}},{key:"hexToBytes",value:function(t){return new Uint8Array(t.match(/.{1,2}/g).map((function(t){return parseInt(t,16)})))}},{key:"randomBytes",value:function(t){if("undefined"!=typeof window&&"undefined"!==window.crypto){var e=new Uint8Array(t);return window.crypto.getRandomValues(e),e}return a.a.randomBytes(t)}}]),e}()}).call(this,n(3).Buffer)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(e){o(this,t),this.wasm=e,this.ptr=null,this.len=0}return c(t,[{key:"clear",value:function(){this.len=0}},{key:"free",value:function(){null!==this.ptr&&(this.wasm._free(this.ptr),this.len=0,this.ptr=null)}},{key:"resize",value:function(t){null!==this.ptr&&this.free(),this.len=t,this.ptr=this.wasm._malloc(t)}},{key:"ensureSize",value:function(t){(null===this.ptr||this.len<t)&&this.resize(t)}}]),t}()},function(t,e){t.exports=n(331)},function(t,e,n){"use strict";(function(t){
|
|
48
48
|
/*!
|
|
49
49
|
* The buffer module from node.js, for the browser.
|
|
50
50
|
*
|