decidim-bulletin_board 0.24.2 → 0.24.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa7849b992690e2b682e6e6338ed13f20525b28de78816a67880a1c44061178
|
4
|
+
data.tar.gz: d3223ff3e8f3db61d7b2992334c4cd350fec637a8befd457b46dee771f9614f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de566d72e7607ce6f8f10aded1f248d1e8c14e20b6c0c0c74ca59125177b6f47b6e381b40dc57f840728a7e9c0c34d3b30271a4521833d9cbaf00bb6c66cb70e
|
7
|
+
data.tar.gz: 01eb078215604e7062c578469f1a8b327577ae2d8c017b8f367179d14559efd6a0fe387bdbf2a4b838fa5597aa5543a68cdef9837d712e1724f4efd63ec2f755
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
decidim-bulletin_board (0.24.
|
4
|
+
decidim-bulletin_board (0.24.3)
|
5
5
|
byebug (~> 11.0)
|
6
6
|
graphlient (~> 0.5.0)
|
7
7
|
jwt (~> 2.5.0)
|
@@ -121,7 +121,7 @@ GEM
|
|
121
121
|
faraday (>= 1.0)
|
122
122
|
faraday_middleware
|
123
123
|
graphql-client
|
124
|
-
graphql (2.1.
|
124
|
+
graphql (2.1.1)
|
125
125
|
graphql-client (0.18.0)
|
126
126
|
activesupport (>= 3.0)
|
127
127
|
graphql
|
@@ -290,4 +290,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
290
290
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
291
291
|
PERFORMANCE OF THIS SOFTWARE.
|
292
292
|
***************************************************************************** */
|
293
|
-
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function s(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))}function u(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function c(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}},5877:(e,t,r)=>{var n=r(3570),i=r(1171),a=i;a.v1=n,a.v4=i,e.exports=a},5327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},5217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},3570:(e,t,r)=>{var n,i,a=r(5217),o=r(5327),s=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==h){var p=a();null==f&&(f=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=i=16383&(p[6]<<8|p[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,v=d-s+(y-u)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||d>s)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=d,u=y,i=h;var g=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=d/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=h>>>8|128,l[c++]=255&h;for(var b=0;b<6;++b)l[c+b]=f[b];return t||o(l)}},1171:(e,t,r)=>{var n=r(5217),i=r(5327);e.exports=function(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[a+s]=o[s];return t||i(o)}},9329:(e,t,r)=>{e.exports=r(516).Observable},516:(e,t)=>{"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}t.Observable=void 0;var a=function(){return"function"==typeof Symbol},o=function(e){return a()&&Boolean(Symbol[e])},s=function(e){return o(e)?Symbol[e]:"@@"+e};a()&&!o("observable")&&(Symbol.observable=Symbol("observable"));var u=s("iterator"),c=s("observable"),l=s("species");function f(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[l])&&(t=void 0),void 0!==t?t:C}function p(e){return e instanceof C}function d(e){d.log?d.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){d(e)}}))}function v(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=f(t,"unsubscribe");r&&r.call(t)}}catch(e){d(e)}}function g(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function m(e,t,r){e._state="running";var n=e._observer;try{var i=f(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(g(e),!i)throw r;i.call(n,r);break;case"complete":g(e),i&&i.call(n)}}catch(e){d(e)}"closed"===e._state?v(e):"running"===e._state&&(e._state="ready")}function b(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(m(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void m(e,t,r);e._queue.push({type:t,value:r})}}var E=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new S(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return i(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(g(this),v(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),S=function(){function e(t){r(this,e),this._subscription=t}return i(e,[{key:"next",value:function(e){b(this._subscription,"next",e)}},{key:"error",value:function(e){b(this._subscription,"error",e)}},{key:"complete",value:function(){b(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),C=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return i(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new E(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(r,n){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,a)}catch(e){n(e),i.unsubscribe()}},error:n,complete:r});else n(new TypeError(e+" is not a function"));function a(){i.unsubscribe(),r()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=h(this),n=arguments.length>1,i=!1,a=arguments[1],o=a;return new r((function(r){return t.subscribe({next:function(t){var a=!i;if(i=!0,!a||n)try{o=e(o,t)}catch(e){return r.error(e)}else o=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(new TypeError("Cannot reduce an empty sequence"));r.next(o),r.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=h(this);return new i((function(t){var n,a=0;return function e(o){n=o.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){a===r.length?(n=void 0,t.complete()):e(i.from(r[a++]))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=h(this);return new r((function(n){var i=[],a=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var a=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(a);e>=0&&i.splice(e,1),o()}});i.push(a)},error:function(e){n.error(e)},complete:function(){o()}});function o(){a.closed&&0===i.length&&n.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),a.unsubscribe()}}))}},{key:c,value:function(){return this}}],[{key:"from",value:function(t){var r="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var n=f(t,c);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(o("iterator")&&(n=f(t,u)))return new r((function(e){y((function(){if(!e.closed){var r=!0,i=!1,a=void 0;try{for(var o,s=n.call(t)[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value;if(e.next(u),e.closed)return}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}e.complete()}}))}));if(Array.isArray(t))return new r((function(e){y((function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}}))}))}},{key:l,get:function(){return this}}]),e}();t.Observable=C,a()&&Object.defineProperty(C,Symbol("extensions"),{value:{symbol:c,hostReportError:d},configurable:!0})},5819:()=>{},3438:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";r.r(n),r.d(n,{Client:()=>d,Election:()=>m,IdentificationKeys:()=>$,KeyCeremonyComponent:()=>te,MESSAGE_PROCESSED:()=>G,MESSAGE_RECEIVED:()=>H,MessageIdentifier:()=>g,MessageParser:()=>Z,TallyComponent:()=>re,Trustee:()=>J,VoteComponent:()=>ne,Voter:()=>X});var e=r(1439),t=r(4206),i=r.n(t),a=r(9120),o=r.n(a),s=r(1798),u=r.n(s),c=r(5073),l=r.n(c),f=r(5053),h=r.n(f);class p{constructor({apiEndpointUrl:t,headers:r}){const n=new e.HttpLink({uri:t,headers:r});this.apolloClient=new e.fe({link:n,cache:new e.h4})}async getLogEntry({electionUniqueId:e,contentHash:t}){return(await this.apolloClient.query({query:l(),variables:{electionUniqueId:e,contentHash:t}})).data.logEntry}async getElectionLogEntries({electionUniqueId:e,after:t,types:r}){return(await this.apolloClient.query({query:i(),variables:{electionUniqueId:e,after:t,types:r},fetchPolicy:"no-cache"})).data.election.logEntries}async processKeyCeremonyStep({messageId:e,signedData:t}){const r=await this.apolloClient.mutate({mutation:o(),variables:{messageId:e,signedData:t}});if(r.data.processKeyCeremonyStep.error)throw new Error(r.data.processKeyCeremonyStep.error);return r.data.processKeyCeremonyStep.pendingMessage}async getPendingMessageByMessageId({messageId:e}){return(await this.apolloClient.query({query:h(),variables:{messageId:e}})).data.pendingMessage}async processTallyStep({messageId:e,signedData:t}){const r=await this.apolloClient.mutate({mutation:u(),variables:{messageId:e,signedData:t}});if(r.data.processTallyStep.error)throw new Error(r.data.processTallyStep.error);return r.data.processTallyStep.pendingMessage}}class d{constructor(e){this.apiClient=new p(e)}getLogEntry({electionUniqueId:e,contentHash:t}){return this.apiClient.getLogEntry({electionUniqueId:e,contentHash:t})}getElectionLogEntries(e){return this.apiClient.getElectionLogEntries(e)}processKeyCeremonyStep(e){return this.apiClient.processKeyCeremonyStep(e)}processTallyStep(e){return this.apiClient.processTallyStep(e)}waitForPendingMessageToBeProcessed(e,t=1e3){return new Promise((r=>{const n=setInterval((()=>{this.apiClient.getPendingMessageByMessageId({messageId:e}).then((e=>{"enqueued"!==e.status&&(clearInterval(n),r(e))}))}),t)}))}}const y="t",v=["a","b","v",y];class g{static parse(e){const[t,r]=e.split("+"),[n,i,a,o]=t.split(".",4),[s,u]=r.split(".",2),c=o?`.${o}`:"";if(!v.includes(s))throw new Error("Invalid message identifier format");return{electionId:`${n}.${i}`,type:a,subtype:o,typeSubtype:`${a}${c}`,author:{type:s,id:u}}}static format(e,t,r,n){return`${e}.${t}+${r}.${n}`}}class m{constructor({uniqueId:e,bulletinBoardClient:t,typesFilter:r,options:n}){this.uniqueId=e,this.bulletinBoardClient=t,this.logEntries=[],this.typesFilter=r,this.subscriptionId=null,this.options=n||{waitUntilNextCheck:2e3}}async subscribeToLogEntriesChanges(){this.unsubscribeToLogEntriesChanges(),await this.getLogEntries(),this.subscriptionId=setInterval((()=>{this.getLogEntries()}),this.options.waitUntilNextCheck)}unsubscribeToLogEntriesChanges(){null!==this.subscriptionId&&(clearInterval(this.subscriptionId),this.subscriptionId=null)}getLastMessageFromTrustee(e){for(let t=this.logEntries.length-1;t>=0;t--){const r=this.logEntries[t],n=g.parse(r.messageId);if(n.author.type===y&&n.author.id===e)return r}return null}getLogEntries(){const e=this.logEntries[this.logEntries.length-1],t=e&&e.id||null;return new Promise((e=>{this.bulletinBoardClient.getElectionLogEntries({electionUniqueId:this.uniqueId,after:t,types:this.typesFilter}).then((t=>{t.length&&(this.logEntries=[...this.logEntries,...t]),e()}))}))}}var b=r(655);function E(e){return"function"==typeof e}var S=!1,C={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;S=e},get useDeprecatedSynchronousErrorHandling(){return S}};function w(e){setTimeout((function(){throw e}),0)}var T={closed:!0,next:function(e){},error:function(e){if(C.useDeprecatedSynchronousErrorHandling)throw e;w(e)},complete:function(){}},A=function(){return Array.isArray||function(e){return e&&"number"==typeof e.length}}();var I=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}(),k=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r,n=this,i=n._parentOrParents,a=n._ctorUnsubscribe,o=n._unsubscribe,s=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof e)i.remove(this);else if(null!==i)for(var u=0;u<i.length;++u){i[u].remove(this)}if(E(o)){a&&(this._unsubscribe=void 0);try{o.call(this)}catch(e){t=e instanceof I?_(e.errors):[e]}}if(A(s)){u=-1;for(var c=s.length;++u<c;){var l=s[u];if(null!==(r=l)&&"object"==typeof r)try{l.unsubscribe()}catch(e){t=t||[],e instanceof I?t=t.concat(_(e.errors)):t.push(e)}}}if(t)throw new I(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var i=r._parentOrParents;if(null===i)r._parentOrParents=this;else if(i instanceof e){if(i===this)return r;r._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return r;i.push(this)}var a=this._subscriptions;return null===a?this._subscriptions=[r]:a.push(r),r},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function _(e){return e.reduce((function(e,t){return e.concat(t instanceof I?t.errors:t)}),[])}var B=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),N=function(e){function t(r,n,i){var a=e.call(this)||this;switch(a.syncErrorValue=null,a.syncErrorThrown=!1,a.syncErrorThrowable=!1,a.isStopped=!1,arguments.length){case 0:a.destination=T;break;case 1:if(!r){a.destination=T;break}if("object"==typeof r){r instanceof t?(a.syncErrorThrowable=r.syncErrorThrowable,a.destination=r,r.add(a)):(a.syncErrorThrowable=!0,a.destination=new O(a,r));break}default:a.syncErrorThrowable=!0,a.destination=new O(a,r,n,i)}return a}return b.ZT(t,e),t.prototype[B]=function(){return this},t.create=function(e,r,n){var i=new t(e,r,n);return i.syncErrorThrowable=!1,i},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(k),O=function(e){function t(t,r,n,i){var a,o=e.call(this)||this;o._parentSubscriber=t;var s=o;return E(r)?a=r:r&&(a=r.next,n=r.error,i=r.complete,r!==T&&(E((s=Object.create(r)).unsubscribe)&&o.add(s.unsubscribe.bind(s)),s.unsubscribe=o.unsubscribe.bind(o))),o._context=s,o._next=a,o._error=n,o._complete=i,o}return b.ZT(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;C.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=C.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):w(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;w(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};C.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),C.useDeprecatedSynchronousErrorHandling)throw e;w(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!C.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return C.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(w(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(N);var R=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function x(e){return e}function P(e){return 0===e.length?x:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var F=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,i=function(e,t,r){if(e){if(e instanceof N)return e;if(e[B])return e[B]()}return e||t||r?new N(e,t,r):new N(T)}(e,t,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||C.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),C.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){C.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),!function(e){for(;e;){var t=e,r=t.closed,n=t.destination,i=t.isStopped;if(r||i)return!1;e=n&&n instanceof N?n:null}return!0}(e)?console.warn(t):e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=D(t))((function(t,n){var i;i=r.subscribe((function(t){try{e(t)}catch(e){n(e),i&&i.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[R]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:P(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=D(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function D(e){if(e||(e=C.Promise||Promise),!e)throw new Error("no Promise impl found");return e}var L=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),U=function(e){function t(t,r){var n=e.call(this)||this;return n.subject=t,n.subscriber=r,n.closed=!1,n}return b.ZT(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var r=t.indexOf(this.subscriber);-1!==r&&t.splice(r,1)}}},t}(k),j=function(e){function t(t){var r=e.call(this,t)||this;return r.destination=t,r}return b.ZT(t,e),t}(N),V=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return b.ZT(t,e),t.prototype[B]=function(){return new j(this)},t.prototype.lift=function(e){var t=new K(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new L;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].next(e)},t.prototype.error=function(e){if(this.closed)throw new L;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new L;this.isStopped=!0;for(var e=this.observers,t=e.length,r=e.slice(),n=0;n<t;n++)r[n].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new L;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new L;return this.hasError?(e.error(this.thrownError),k.EMPTY):this.isStopped?(e.complete(),k.EMPTY):(this.observers.push(e),new U(this,e))},t.prototype.asObservable=function(){var e=new F;return e.source=this,e},t.create=function(e,t){return new K(e,t)},t}(F),K=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return b.ZT(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):k.EMPTY},t}(V);function M(){}var q=function(){function e(e,t,r){this.nextOrObserver=e,this.error=t,this.complete=r}return e.prototype.call=function(e,t){return t.subscribe(new z(e,this.nextOrObserver,this.error,this.complete))},e}(),z=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a._tapNext=M,a._tapError=M,a._tapComplete=M,a._tapError=n||M,a._tapComplete=i||M,E(r)?(a._context=a,a._tapNext=r):r&&(a._context=r,a._tapNext=r.next||M,a._tapError=r.error||M,a._tapComplete=r.complete||M),a}return b.ZT(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(N);const H="[Message] Received",G="[Message] Processed";class Q{constructor(){this.events=new V}subscribe(e){return this.events.pipe((t=e,function(e){return e.lift(new q(t,r,n))})).subscribe();var t,r,n}broadcastMessageReceived(e){this.events.next({type:H,message:e})}broadcastMessageProcessed(e,t){this.events.next({type:G,message:e,result:t})}}var W=r(1217);function Y(e,t){const r="string"==typeof e?JSON.parse(e):e,n="string"==typeof t?JSON.parse(t):t;if(r&&n){const{n:e,e:t,kty:i}=r,{n:a,e:o,kty:s}=n;return e===a&&t===o&&i===s}return!1}class Z{constructor({authorityPublicKeyJSON:e}){this.authorityPublicKeyJSON=e,this.authorityPublicKey=W.JWK.asKey(e,"json"),this.keys=null}async parse({messageId:e,signedData:t}){const r=g.parse(e),n=await(this.keys?this.keys[r.author.type][r.author.id]:this.authorityPublicKey);if(!t)return{messageIdentifier:r,decodedData:null};const i=await W.JWS.createVerify(n).verify(t,{algorithms:["RS256"]}),a=JSON.parse(new TextDecoder("utf-8").decode(i.payload));return this.keys||(this.keys=await this.parseCreateElection(a)),{messageIdentifier:r,decodedData:a}}async parseCreateElection({authority:e,bulletin_board:t,trustees:r}){if(!Y(e.public_key,this.authorityPublicKeyJSON))throw new Error("The authority public key doesn't match the election's authority public key.");const n={a:{[e.slug]:this.authorityPublicKey},b:{},[y]:{}},i=[];i.push(this.loadKey(t).then((e=>{n.b[t.slug]=e})));for(const e of r)i.push(this.loadKey(e).then((t=>{n.t[e.slug]=t})));return await Promise.all(i),n}loadKey(e){return W.JWK.asKey(e.public_key,"json")}}class J{constructor({uniqueId:e,authorityPublicKeyJSON:t,identificationKeys:r,wrapperAdapter:n,options:i}){this.uniqueId=e,this.identificationKeys=r,this.election=null,this.options=i||{waitUntilNextCheck:100},this.wrapperAdapter=n,this.parser=new Z({authorityPublicKeyJSON:t}),this.events=new Q,this.nextLogEntryIndexToProcess=0,this.lastMessageProcessedWithResult=null,this.hasSetupKeyCeremony=!1}async setup(){if(null===this.election)throw new Error("election is not set.");return await this.wrapperAdapter.setup(),this.election.subscribeToLogEntriesChanges()}tearDown(){this.election.unsubscribeToLogEntriesChanges()}async*setupKeyCeremony(){let e;for(;!e;)e=await this.waitForNextLogEntryResult();return yield await this.wrapperAdapter.backup(),await this.processKeyCeremonyStep(e),this.hasSetupKeyCeremony=!0,this.hasSetupKeyCeremony}async runKeyCeremony(){if(!this.hasSetupKeyCeremony)throw new Error("The key ceremony has not been setup yet");if(await this.needsToBeRestored())throw new Error("You need to restore the wrapper state to continue");return this.waitForNextLogEntryResult().then((async e=>(await this.processKeyCeremonyStep(e),await this.wrapperAdapter.isKeyCeremonyDone()?this.tearDown():this.runKeyCeremony())))}async runTally(){if(await this.needsToBeRestored())throw new Error("You need to restore the wrapper state to continue");return this.waitForNextLogEntryResult().then((async e=>(await this.processTallyStep(e),await this.wrapperAdapter.isTallyDone()?this.tearDown():this.runTally())))}async needsToBeRestored(){return this.election.getLastMessageFromTrustee(this.uniqueId)&&await this.wrapperAdapter.isFresh()}async restore(e){const t=this.election.getLastMessageFromTrustee(this.uniqueId);return this.hasSetupKeyCeremony=t&&await this.wrapperAdapter.restore(e),this.hasSetupKeyCeremony}async waitForNextLogEntryResult(){return await new Promise((e=>{const t=setInterval((async()=>{const{logEntries:r}=this.election;r.length>this.nextLogEntryIndexToProcess&&(clearInterval(t),e())}),this.options.waitUntilNextCheck)})),this.processNextLogEntry()}async processNextLogEntry(){const{logEntries:e}=this.election,t=e[this.nextLogEntryIndexToProcess];this.events.broadcastMessageReceived(t);const{messageIdentifier:r,decodedData:n}=await this.parser.parse(t),i=await this.wrapperAdapter.processMessage(r.typeSubtype,n);if(this.events.broadcastMessageProcessed(t,i),this.nextLogEntryIndexToProcess+=1,i){const{messageType:e,content:t}=i;return{message_id:g.format(this.election.uniqueId,e,y,this.uniqueId),content:t}}return i}async processKeyCeremonyStep(e){if(e&&!this.isMessageAlreadyLogged(e)){const t=await this.signMessage(e);return this.election.bulletinBoardClient.processKeyCeremonyStep({messageId:e.message_id,signedData:t})}}async processTallyStep(e){if(e&&!this.isMessageAlreadyLogged(e)){const t=await this.signMessage(e);return this.election.bulletinBoardClient.processTallyStep({messageId:e.message_id,signedData:t})}}isMessageAlreadyLogged({message_id:e}){const{logEntries:t}=this.election;return t.find((t=>t.messageId===e))}signMessage(e){return this.identificationKeys.sign({iat:Math.floor(new Date/1e3),...e})}}class X{constructor({bulletinBoardClient:e,authorityPublicKeyJSON:t,election:r,uniqueId:n,wrapperAdapter:i}){this.uniqueId=n,this.election=r,this.bulletinBoardClient=e,this.wrapperAdapter=i,this.parser=new Z({authorityPublicKeyJSON:t})}async setup(){return await this.wrapperAdapter.setup(),this.bulletinBoardClient.getElectionLogEntries({electionUniqueId:this.election.uniqueId,types:["create_election","end_key_ceremony"]}).then((async e=>{for(const t of e){const{messageIdentifier:e,decodedData:r}=await this.parser.parse(t);await this.wrapperAdapter.processMessage(e.typeSubtype,r)}}))}async encrypt(e,t){const{encryptedData:r,auditableData:n}=await this.wrapperAdapter.encrypt(e,t);return{encryptedData:r,encryptedDataHash:await this.hash(r),auditableData:n,plainVote:e,electionUniqueId:this.election.uniqueId}}async hash(e){return window.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then((e=>Array.from(new Uint8Array(e)).map((e=>e.toString(16).padStart(2,"0"))).join("")))}verifyVote(e){const{uniqueId:t}=this.election;return this.bulletinBoardClient.getLogEntry({electionUniqueId:t,contentHash:e})}}class ${constructor(e,t){this.format="jwk",this.algorithm={name:"RSASSA-PKCS1-v1_5",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},this.usages=["sign"],this.publicKeyAttrs=["alg","e","kty","n"],this.jwtHeader=this._encode64(JSON.stringify({alg:"RS256",typ:"JWT"})),this.trusteeUniqueId=e,this.privateKey=null,this.publicKey=null,this.storedPublicKey=JSON.parse(t||null),this.keyIdentifier=`${e}-private-key`,this.browserSupport=this._checkBrowserSupport(),this.textEncoder=new TextEncoder("utf-8"),this.dbName="identification_keys",this.dbVersion=1,this.presentPromise=this._read()}present(e){this.presentPromise.then((()=>{this._matchesStoredPublicKey(this.publicKey)?e(this.browserSupport&&null!==this.privateKey):this.reset().then(e(!1))}))}async generate(){return!(!this.browserSupport||this.storedPublicKey)&&new Promise(((e,t)=>{try{return this.crypto.subtle.generateKey(this.algorithm,!0,this.usages).then((t=>this.crypto.subtle.exportKey(this.format,t.privateKey).then((t=>{this.publicKey=this._publicKeyFromPrivateKey(t);const r=document.createElement("a");return r.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(JSON.stringify(t))}`),r.setAttribute("download",`${this.keyIdentifier}.jwk`),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),e()})).catch(this._handleErrors)))}catch(e){return t(e)}}))}async upload(e){return!(!this.browserSupport||null!==this.privateKey)&&new Promise(((t,r)=>{if(e)this.onUploadInputChange(e,t,r);else{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("accept",".jwk"),e.style.display="none",document.body.appendChild(e),e.addEventListener("change",(n=>{document.body.removeChild(e),this.onUploadInputChange(n,t,r)})),e.click()}}))}onUploadInputChange(e,t,r){const n=new FileReader;n.readAsText(e.target.files[0]),n.onload=e=>{let n="";try{n=JSON.parse(e.target.result)}catch(e){return r("invalid_format")}return this.crypto.subtle.importKey(this.format,n,this.algorithm,!1,this.usages).then((e=>{const i=this._publicKeyFromPrivateKey(n);this._matchesStoredPublicKey(i)?(this.publicKey=i,this.privateKey=e,this._save().then((()=>t(!0))).catch((()=>{r("could not be saved")}))):r("invalid_public_key")})).catch((()=>{r("invalid_key")}))}}reset(){return this.privateKey=this.publicKey=null,this._clear()}async sign(e){if(!this.browserSupport||null===this.privateKey)return!1;const t=`${this.jwtHeader}.${this._encode64(JSON.stringify(e))}`,r=await this.crypto.subtle.sign(this.algorithm,this.privateKey,this.textEncoder.encode(t));return`${t}.${btoa(Reflect.apply(String.fromCharCode,null,new Uint8Array(r))).replace(/[=]/g,"").replace(/\+/g,"-").replace(/\//g,"_")}`}_checkBrowserSupport(){return this.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,this.crypto=window.crypto||window.msCrypto,window.indexedDB&&window.crypto}_handleErrors(e){throw e}_publicKeyFromPrivateKey(e){return Object.keys(e).filter((e=>this.publicKeyAttrs.includes(e))).reduce(((t,r)=>(t[r]=e[r],t)),{})}_matchesStoredPublicKey(e){return Y(e,this.storedPublicKey)}_encode64(e){return btoa(unescape(encodeURIComponent(e))).replace(/[=]/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async _read(){return this._useDb("readonly",(e=>{e.get(this.keyIdentifier).onsuccess=e=>{e.target.result&&(this.privateKey=e.target.result.privateKey,this.publicKey=e.target.result.publicKey)}}))}async _save(){return this._useDb("readwrite",(e=>{e.add({privateKey:this.privateKey,publicKey:this.publicKey},this.keyIdentifier)}))}async _clear(){return this._useDb("readwrite",(e=>{e.delete(this.keyIdentifier)}))}async _useDb(e,t){return new Promise(((r,n)=>{let i=null;const a=this.indexedDB.open(this.dbName,this.dbVersion);a.onerror=e=>{i=null,n(e)},a.onupgradeneeded=()=>{i=a.result,i.createObjectStore("IdentificationKeys")},a.onsuccess=()=>{i=a.result;const n=i.transaction(["IdentificationKeys"],e);t(n.objectStore("IdentificationKeys")),n.oncomplete=()=>{i.close(),r()}}}))}}class ee{constructor({authorityPublicKeyJSON:e,trusteeUniqueId:t,trusteeIdentificationKeys:r,trusteeWrapperAdapter:n}){this.trustee=new J({uniqueId:t,authorityPublicKeyJSON:e,identificationKeys:r,wrapperAdapter:n})}async setupElection(){throw new Error("not implemented")}async setupElectionWithTypesFilter({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r,typesFilter:n}){const[i]=t.split("."),a=`${i}.${this.trustee.uniqueId}`,o=await this.trustee.signMessage({trustee_unique_id:a,exp:r}),s=new d({...e,headers:{Authorization:o,TrusteeUniqueId:a}}),u=new m({uniqueId:t,bulletinBoardClient:s,typesFilter:n});this.trustee.election=u}async bindEvents(){throw new Error("not implemented")}}class te extends ee{setupElection({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r}){return this.setupElectionWithTypesFilter({electionUniqueId:t,bulletinBoardClientParams:e,authorizationExpirationTimestamp:r,typesFilter:["create_election","start_key_ceremony","key_ceremony","end_key_ceremony"]})}async bindEvents({onEvent:e,onBindRestoreButton:t,onBindStartButton:r,onRestore:n,onComplete:i,onStart:a,onTrusteeNeedsToBeRestored:o,onBackupNeeded:s,onBindBackupButton:u,onBackupStarted:c}){const l=this.trustee.setup();this.trustee.events.subscribe(e),r((async e=>{if(a(),e.preventDefault(),await l,await this.trustee.needsToBeRestored())o();else{const e=this.trustee.setupKeyCeremony(),{value:t}=await e.next();s(),u(t,`${this.trustee.uniqueId}-election-${this.trustee.election.uniqueId}.bak`,(async()=>{c(),await e.next(),await this.trustee.runKeyCeremony(),i()}))}})),t((async e=>{await l;const t=e.target.files[0],r=new FileReader;r.onload=async({target:e})=>{const t=e.result;await this.trustee.restore(t)&&(n(),await this.trustee.runKeyCeremony(),i())},r.readAsText(t)}))}}class re extends ee{setupElection({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r}){return this.setupElectionWithTypesFilter({electionUniqueId:t,bulletinBoardClientParams:e,authorizationExpirationTimestamp:r,typesFilter:["create_election","start_key_ceremony","key_ceremony","end_key_ceremony","start_tally","tally","end_tally"]})}async bindEvents({onEvent:e,onBindRestoreButton:t,onBindStartButton:r,onRestore:n,onComplete:i,onStart:a,onTrusteeNeedsToBeRestored:o}){const s=this.trustee.setup();this.trustee.events.subscribe(e),r((async e=>{a(),e.preventDefault(),await s,await this.trustee.needsToBeRestored()?o():(await this.trustee.runTally(),i())})),t((async e=>{await s;const t=e.target.files[0],r=new FileReader;r.onload=async({target:e})=>{const t=e.result;await this.trustee.restore(t)&&(n(),await this.trustee.runTally(),i())},r.readAsText(t)}))}}class ne{constructor({bulletinBoardClientParams:e,authorityPublicKeyJSON:t,electionUniqueId:r,voterUniqueId:n,voterWrapperAdapter:i}){this.bulletinBoardClient=new d(e);const a=new m({uniqueId:r,bulletinBoardClient:this.bulletinBoardClient});this.voter=new X({bulletinBoardClient:this.bulletinBoardClient,authorityPublicKeyJSON:t,election:a,uniqueId:n,wrapperAdapter:i})}async bindEvents({onBindEncryptButton:e,onStart:t,onVoteEncryption:r,castOrAuditBallot:n,onBindAuditBallotButton:i,onBindCastBallotButton:a,onAuditBallot:o,onCastBallot:s,onAuditComplete:u,onCastComplete:c,onInvalid:l}){const f=this.voter.setup();e((async()=>{t(),await f,r(((e,t)=>{this.voter.encrypt(e,t).then((e=>{n(e),i((()=>{o(e,`${this.voter.uniqueId}-election-${this.voter.election.uniqueId}.txt`),u()})),a((async()=>{try{const t=await s(e);c(t)}catch{l()}}))}))}),(()=>{l()}))}))}}})(),window.decidimBulletinBoard=n})();
|
293
|
+
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function s(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))}function u(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function c(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}},5877:(e,t,r)=>{var n=r(3570),i=r(1171),a=i;a.v1=n,a.v4=i,e.exports=a},5327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,i=t;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},5217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},3570:(e,t,r)=>{var n,i,a=r(5217),o=r(5327),s=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:i;if(null==f||null==h){var p=a();null==f&&(f=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=i=16383&(p[6]<<8|p[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,v=d-s+(y-u)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||d>s)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=d,u=y,i=h;var g=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=g>>>24&255,l[c++]=g>>>16&255,l[c++]=g>>>8&255,l[c++]=255&g;var m=d/4294967296*1e4&268435455;l[c++]=m>>>8&255,l[c++]=255&m,l[c++]=m>>>24&15|16,l[c++]=m>>>16&255,l[c++]=h>>>8|128,l[c++]=255&h;for(var b=0;b<6;++b)l[c+b]=f[b];return t||o(l)}},1171:(e,t,r)=>{var n=r(5217),i=r(5327);e.exports=function(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[a+s]=o[s];return t||i(o)}},9329:(e,t,r)=>{e.exports=r(516).Observable},516:(e,t)=>{"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}t.Observable=void 0;var a=function(){return"function"==typeof Symbol},o=function(e){return a()&&Boolean(Symbol[e])},s=function(e){return o(e)?Symbol[e]:"@@"+e};a()&&!o("observable")&&(Symbol.observable=Symbol("observable"));var u=s("iterator"),c=s("observable"),l=s("species");function f(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function h(e){var t=e.constructor;return void 0!==t&&null===(t=t[l])&&(t=void 0),void 0!==t?t:C}function p(e){return e instanceof C}function d(e){d.log?d.log(e):setTimeout((function(){throw e}))}function y(e){Promise.resolve().then((function(){try{e()}catch(e){d(e)}}))}function v(e){var t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{var r=f(t,"unsubscribe");r&&r.call(t)}}catch(e){d(e)}}function g(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function m(e,t,r){e._state="running";var n=e._observer;try{var i=f(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(g(e),!i)throw r;i.call(n,r);break;case"complete":g(e),i&&i.call(n)}}catch(e){d(e)}"closed"===e._state?v(e):"running"===e._state&&(e._state="ready")}function b(e,t,r){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void y((function(){return function(e){var t=e._queue;if(t){e._queue=void 0,e._state="ready";for(var r=0;r<t.length&&(m(e,t[r].type,t[r].value),"closed"!==e._state);++r);}}(e)}))):void m(e,t,r);e._queue.push({type:t,value:r})}}var E=function(){function e(t,n){r(this,e),this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new S(this);try{this._cleanup=n.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}return i(e,[{key:"unsubscribe",value:function(){"closed"!==this._state&&(g(this),v(this))}},{key:"closed",get:function(){return"closed"===this._state}}]),e}(),S=function(){function e(t){r(this,e),this._subscription=t}return i(e,[{key:"next",value:function(e){b(this._subscription,"next",e)}},{key:"error",value:function(e){b(this._subscription,"error",e)}},{key:"complete",value:function(){b(this._subscription,"complete")}},{key:"closed",get:function(){return"closed"===this._subscription._state}}]),e}(),C=function(){function e(t){if(r(this,e),!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof t)throw new TypeError("Observable initializer must be a function");this._subscriber=t}return i(e,[{key:"subscribe",value:function(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new E(e,this._subscriber)}},{key:"forEach",value:function(e){var t=this;return new Promise((function(r,n){if("function"==typeof e)var i=t.subscribe({next:function(t){try{e(t,a)}catch(e){n(e),i.unsubscribe()}},error:n,complete:r});else n(new TypeError(e+" is not a function"));function a(){i.unsubscribe(),r()}}))}},{key:"map",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(r){return t.subscribe({next:function(t){try{t=e(t)}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))}},{key:"filter",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(h(this))((function(r){return t.subscribe({next:function(t){try{if(!e(t))return}catch(e){return r.error(e)}r.next(t)},error:function(e){r.error(e)},complete:function(){r.complete()}})}))}},{key:"reduce",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=h(this),n=arguments.length>1,i=!1,a=arguments[1],o=a;return new r((function(r){return t.subscribe({next:function(t){var a=!i;if(i=!0,!a||n)try{o=e(o,t)}catch(e){return r.error(e)}else o=t},error:function(e){r.error(e)},complete:function(){if(!i&&!n)return r.error(new TypeError("Cannot reduce an empty sequence"));r.next(o),r.complete()}})}))}},{key:"concat",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=h(this);return new i((function(t){var n,a=0;return function e(o){n=o.subscribe({next:function(e){t.next(e)},error:function(e){t.error(e)},complete:function(){a===r.length?(n=void 0,t.complete()):e(i.from(r[a++]))}})}(e),function(){n&&(n.unsubscribe(),n=void 0)}}))}},{key:"flatMap",value:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=h(this);return new r((function(n){var i=[],a=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return n.error(e)}var a=r.from(t).subscribe({next:function(e){n.next(e)},error:function(e){n.error(e)},complete:function(){var e=i.indexOf(a);e>=0&&i.splice(e,1),o()}});i.push(a)},error:function(e){n.error(e)},complete:function(){o()}});function o(){a.closed&&0===i.length&&n.complete()}return function(){i.forEach((function(e){return e.unsubscribe()})),a.unsubscribe()}}))}},{key:c,value:function(){return this}}],[{key:"from",value:function(t){var r="function"==typeof this?this:e;if(null==t)throw new TypeError(t+" is not an object");var n=f(t,c);if(n){var i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return p(i)&&i.constructor===r?i:new r((function(e){return i.subscribe(e)}))}if(o("iterator")&&(n=f(t,u)))return new r((function(e){y((function(){if(!e.closed){var r=!0,i=!1,a=void 0;try{for(var o,s=n.call(t)[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value;if(e.next(u),e.closed)return}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}e.complete()}}))}));if(Array.isArray(t))return new r((function(e){y((function(){if(!e.closed){for(var r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}}))}));throw new TypeError(t+" is not observable")}},{key:"of",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i="function"==typeof this?this:e;return new i((function(e){y((function(){if(!e.closed){for(var t=0;t<r.length;++t)if(e.next(r[t]),e.closed)return;e.complete()}}))}))}},{key:l,get:function(){return this}}]),e}();t.Observable=C,a()&&Object.defineProperty(C,Symbol("extensions"),{value:{symbol:c,hostReportError:d},configurable:!0})},5819:()=>{},3438:()=>{}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";r.r(n),r.d(n,{Client:()=>d,Election:()=>m,IdentificationKeys:()=>$,KeyCeremonyComponent:()=>te,MESSAGE_PROCESSED:()=>G,MESSAGE_RECEIVED:()=>H,MessageIdentifier:()=>g,MessageParser:()=>Z,TallyComponent:()=>re,Trustee:()=>J,VoteComponent:()=>ne,Voter:()=>X});var e=r(1439),t=r(4206),i=r.n(t),a=r(9120),o=r.n(a),s=r(1798),u=r.n(s),c=r(5073),l=r.n(c),f=r(5053),h=r.n(f);class p{constructor({apiEndpointUrl:t,headers:r}){const n=new e.HttpLink({uri:t,headers:r});this.apolloClient=new e.fe({link:n,cache:new e.h4})}async getLogEntry({electionUniqueId:e,contentHash:t}){return(await this.apolloClient.query({query:l(),variables:{electionUniqueId:e,contentHash:t}})).data.logEntry}async getElectionLogEntries({electionUniqueId:e,after:t,types:r}){return(await this.apolloClient.query({query:i(),variables:{electionUniqueId:e,after:t,types:r},fetchPolicy:"no-cache"})).data.election.logEntries}async processKeyCeremonyStep({messageId:e,signedData:t}){const r=await this.apolloClient.mutate({mutation:o(),variables:{messageId:e,signedData:t}});if(r.data.processKeyCeremonyStep.error)throw new Error(r.data.processKeyCeremonyStep.error);return r.data.processKeyCeremonyStep.pendingMessage}async getPendingMessageByMessageId({messageId:e}){return(await this.apolloClient.query({query:h(),variables:{messageId:e}})).data.pendingMessage}async processTallyStep({messageId:e,signedData:t}){const r=await this.apolloClient.mutate({mutation:u(),variables:{messageId:e,signedData:t}});if(r.data.processTallyStep.error)throw new Error(r.data.processTallyStep.error);return r.data.processTallyStep.pendingMessage}}class d{constructor(e){this.apiClient=new p(e)}getLogEntry({electionUniqueId:e,contentHash:t}){return this.apiClient.getLogEntry({electionUniqueId:e,contentHash:t})}getElectionLogEntries(e){return this.apiClient.getElectionLogEntries(e)}processKeyCeremonyStep(e){return this.apiClient.processKeyCeremonyStep(e)}processTallyStep(e){return this.apiClient.processTallyStep(e)}waitForPendingMessageToBeProcessed(e,t=1e3){return new Promise((r=>{const n=setInterval((()=>{this.apiClient.getPendingMessageByMessageId({messageId:e}).then((e=>{"enqueued"!==e.status&&(clearInterval(n),r(e))}))}),t)}))}}const y="t",v=["a","b","v",y];class g{static parse(e){const[t,r]=e.split("+"),[n,i,a,o]=t.split(".",4),[s,u]=r.split(".",2),c=o?`.${o}`:"";if(!v.includes(s))throw new Error("Invalid message identifier format");return{electionId:`${n}.${i}`,type:a,subtype:o,typeSubtype:`${a}${c}`,author:{type:s,id:u}}}static format(e,t,r,n){return`${e}.${t}+${r}.${n}`}}class m{constructor({uniqueId:e,bulletinBoardClient:t,typesFilter:r,options:n}){this.uniqueId=e,this.bulletinBoardClient=t,this.logEntries=[],this.typesFilter=r,this.subscriptionId=null,this.options=n||{waitUntilNextCheck:2e3}}async subscribeToLogEntriesChanges(){this.unsubscribeToLogEntriesChanges(),await this.getLogEntries(),this.subscriptionId=setInterval((()=>{this.getLogEntries()}),this.options.waitUntilNextCheck)}unsubscribeToLogEntriesChanges(){null!==this.subscriptionId&&(clearInterval(this.subscriptionId),this.subscriptionId=null)}getLastMessageFromTrustee(e){for(let t=this.logEntries.length-1;t>=0;t--){const r=this.logEntries[t],n=g.parse(r.messageId);if(n.author.type===y&&n.author.id===e)return r}return null}getLogEntries(){const e=this.logEntries[this.logEntries.length-1],t=e&&e.id||null;return new Promise((e=>{this.bulletinBoardClient.getElectionLogEntries({electionUniqueId:this.uniqueId,after:t,types:this.typesFilter}).then((t=>{t.length&&(this.logEntries=[...this.logEntries,...t]),e()}))}))}}var b=r(655);function E(e){return"function"==typeof e}var S=!1,C={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;S=e},get useDeprecatedSynchronousErrorHandling(){return S}};function w(e){setTimeout((function(){throw e}),0)}var T={closed:!0,next:function(e){},error:function(e){if(C.useDeprecatedSynchronousErrorHandling)throw e;w(e)},complete:function(){}},A=function(){return Array.isArray||function(e){return e&&"number"==typeof e.length}}();var I=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}(),k=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r,n=this,i=n._parentOrParents,a=n._ctorUnsubscribe,o=n._unsubscribe,s=n._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof e)i.remove(this);else if(null!==i)for(var u=0;u<i.length;++u){i[u].remove(this)}if(E(o)){a&&(this._unsubscribe=void 0);try{o.call(this)}catch(e){t=e instanceof I?_(e.errors):[e]}}if(A(s)){u=-1;for(var c=s.length;++u<c;){var l=s[u];if(null!==(r=l)&&"object"==typeof r)try{l.unsubscribe()}catch(e){t=t||[],e instanceof I?t=t.concat(_(e.errors)):t.push(e)}}}if(t)throw new I(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var i=r._parentOrParents;if(null===i)r._parentOrParents=this;else if(i instanceof e){if(i===this)return r;r._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return r;i.push(this)}var a=this._subscriptions;return null===a?this._subscriptions=[r]:a.push(r),r},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=function(e){return e.closed=!0,e}(new e),e}();function _(e){return e.reduce((function(e,t){return e.concat(t instanceof I?t.errors:t)}),[])}var B=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),N=function(e){function t(r,n,i){var a=e.call(this)||this;switch(a.syncErrorValue=null,a.syncErrorThrown=!1,a.syncErrorThrowable=!1,a.isStopped=!1,arguments.length){case 0:a.destination=T;break;case 1:if(!r){a.destination=T;break}if("object"==typeof r){r instanceof t?(a.syncErrorThrowable=r.syncErrorThrowable,a.destination=r,r.add(a)):(a.syncErrorThrowable=!0,a.destination=new O(a,r));break}default:a.syncErrorThrowable=!0,a.destination=new O(a,r,n,i)}return a}return b.ZT(t,e),t.prototype[B]=function(){return this},t.create=function(e,r,n){var i=new t(e,r,n);return i.syncErrorThrowable=!1,i},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(k),O=function(e){function t(t,r,n,i){var a,o=e.call(this)||this;o._parentSubscriber=t;var s=o;return E(r)?a=r:r&&(a=r.next,n=r.error,i=r.complete,r!==T&&(E((s=Object.create(r)).unsubscribe)&&o.add(s.unsubscribe.bind(s)),s.unsubscribe=o.unsubscribe.bind(o))),o._context=s,o._next=a,o._error=n,o._complete=i,o}return b.ZT(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;C.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=C.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):w(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;w(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};C.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),C.useDeprecatedSynchronousErrorHandling)throw e;w(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!C.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return C.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(w(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(N);var R=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function x(e){return e}function P(e){return 0===e.length?x:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var F=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,i=function(e,t,r){if(e){if(e instanceof N)return e;if(e[B])return e[B]()}return e||t||r?new N(e,t,r):new N(T)}(e,t,r);if(n?i.add(n.call(i,this.source)):i.add(this.source||C.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),C.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){C.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),!function(e){for(;e;){var t=e,r=t.closed,n=t.destination,i=t.isStopped;if(r||i)return!1;e=n&&n instanceof N?n:null}return!0}(e)?console.warn(t):e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=D(t))((function(t,n){var i;i=r.subscribe((function(t){try{e(t)}catch(e){n(e),i&&i.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[R]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:P(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=D(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function D(e){if(e||(e=C.Promise||Promise),!e)throw new Error("no Promise impl found");return e}var L=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}(),U=function(e){function t(t,r){var n=e.call(this)||this;return n.subject=t,n.subscriber=r,n.closed=!1,n}return b.ZT(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var r=t.indexOf(this.subscriber);-1!==r&&t.splice(r,1)}}},t}(k),j=function(e){function t(t){var r=e.call(this,t)||this;return r.destination=t,r}return b.ZT(t,e),t}(N),V=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return b.ZT(t,e),t.prototype[B]=function(){return new j(this)},t.prototype.lift=function(e){var t=new K(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new L;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].next(e)},t.prototype.error=function(e){if(this.closed)throw new L;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new L;this.isStopped=!0;for(var e=this.observers,t=e.length,r=e.slice(),n=0;n<t;n++)r[n].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new L;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new L;return this.hasError?(e.error(this.thrownError),k.EMPTY):this.isStopped?(e.complete(),k.EMPTY):(this.observers.push(e),new U(this,e))},t.prototype.asObservable=function(){var e=new F;return e.source=this,e},t.create=function(e,t){return new K(e,t)},t}(F),K=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return b.ZT(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):k.EMPTY},t}(V);function M(){}var q=function(){function e(e,t,r){this.nextOrObserver=e,this.error=t,this.complete=r}return e.prototype.call=function(e,t){return t.subscribe(new z(e,this.nextOrObserver,this.error,this.complete))},e}(),z=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a._tapNext=M,a._tapError=M,a._tapComplete=M,a._tapError=n||M,a._tapComplete=i||M,E(r)?(a._context=a,a._tapNext=r):r&&(a._context=r,a._tapNext=r.next||M,a._tapError=r.error||M,a._tapComplete=r.complete||M),a}return b.ZT(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(N);const H="[Message] Received",G="[Message] Processed";class Q{constructor(){this.events=new V}subscribe(e){return this.events.pipe((t=e,function(e){return e.lift(new q(t,r,n))})).subscribe();var t,r,n}broadcastMessageReceived(e){this.events.next({type:H,message:e})}broadcastMessageProcessed(e,t){this.events.next({type:G,message:e,result:t})}}var W=r(1217);function Y(e,t){const r="string"==typeof e?JSON.parse(e):e,n="string"==typeof t?JSON.parse(t):t;if(r&&n){const{n:e,e:t,kty:i}=r,{n:a,e:o,kty:s}=n;return e===a&&t===o&&i===s}return!1}class Z{constructor({authorityPublicKeyJSON:e}){this.authorityPublicKeyJSON=e,this.authorityPublicKey=W.JWK.asKey(e,"json"),this.keys=null}async parse({messageId:e,signedData:t}){const r=g.parse(e),n=await(this.keys?this.keys[r.author.type][r.author.id]:this.authorityPublicKey);if(!t)return{messageIdentifier:r,decodedData:null};const i=await W.JWS.createVerify(n).verify(t,{algorithms:["RS256"]}),a=JSON.parse(new TextDecoder("utf-8").decode(i.payload));return this.keys||(this.keys=await this.parseCreateElection(a)),{messageIdentifier:r,decodedData:a}}async parseCreateElection({authority:e,bulletin_board:t,trustees:r}){if(!Y(e.public_key,this.authorityPublicKeyJSON))throw new Error("The authority public key doesn't match the election's authority public key.");const n={a:{[e.slug]:this.authorityPublicKey},b:{},[y]:{}},i=[];i.push(this.loadKey(t).then((e=>{n.b[t.slug]=e})));for(const e of r)i.push(this.loadKey(e).then((t=>{n.t[e.slug]=t})));return await Promise.all(i),n}loadKey(e){return W.JWK.asKey(e.public_key,"json")}}class J{constructor({uniqueId:e,authorityPublicKeyJSON:t,identificationKeys:r,wrapperAdapter:n,options:i}){this.uniqueId=e,this.identificationKeys=r,this.election=null,this.options=i||{waitUntilNextCheck:100},this.wrapperAdapter=n,this.parser=new Z({authorityPublicKeyJSON:t}),this.events=new Q,this.nextLogEntryIndexToProcess=0,this.lastMessageProcessedWithResult=null,this.hasSetupKeyCeremony=!1}async setup(){if(null===this.election)throw new Error("election is not set.");return await this.wrapperAdapter.setup(),this.election.subscribeToLogEntriesChanges()}tearDown(){this.election.unsubscribeToLogEntriesChanges()}async*setupKeyCeremony(){let e;for(;!e;)e=await this.waitForNextLogEntryResult();return yield await this.wrapperAdapter.backup(),await this.processKeyCeremonyStep(e),this.hasSetupKeyCeremony=!0,this.hasSetupKeyCeremony}async runKeyCeremony(){if(!this.hasSetupKeyCeremony)throw new Error("The key ceremony has not been setup yet");if(await this.needsToBeRestored())throw new Error("You need to restore the wrapper state to continue");return this.waitForNextLogEntryResult().then((async e=>(await this.processKeyCeremonyStep(e),await this.wrapperAdapter.isKeyCeremonyDone()?this.tearDown():this.runKeyCeremony())))}async runTally(){if(await this.needsToBeRestored())throw new Error("You need to restore the wrapper state to continue");return this.waitForNextLogEntryResult().then((async e=>(await this.processTallyStep(e),await this.wrapperAdapter.isTallyDone()?this.tearDown():this.runTally())))}async needsToBeRestored(){return this.election.getLastMessageFromTrustee(this.uniqueId)&&await this.wrapperAdapter.isFresh()}async restore(e){const t=this.election.getLastMessageFromTrustee(this.uniqueId);return this.hasSetupKeyCeremony=t&&await this.wrapperAdapter.restore(e),this.hasSetupKeyCeremony}async waitForNextLogEntryResult(){return await new Promise((e=>{const t=setInterval((async()=>{const{logEntries:r}=this.election;r.length>this.nextLogEntryIndexToProcess&&(clearInterval(t),e())}),this.options.waitUntilNextCheck)})),this.processNextLogEntry()}async processNextLogEntry(){const{logEntries:e}=this.election,t=e[this.nextLogEntryIndexToProcess];this.events.broadcastMessageReceived(t);const{messageIdentifier:r,decodedData:n}=await this.parser.parse(t),i=await this.wrapperAdapter.processMessage(r.typeSubtype,n);if(this.events.broadcastMessageProcessed(t,i),this.nextLogEntryIndexToProcess+=1,i){const{messageType:e,content:t}=i;return{message_id:g.format(this.election.uniqueId,e,y,this.uniqueId),content:t}}return i}async processKeyCeremonyStep(e){if(e&&!this.isMessageAlreadyLogged(e)){const t=await this.signMessage(e);return this.election.bulletinBoardClient.processKeyCeremonyStep({messageId:e.message_id,signedData:t})}}async processTallyStep(e){if(e&&!this.isMessageAlreadyLogged(e)){const t=await this.signMessage(e);return this.election.bulletinBoardClient.processTallyStep({messageId:e.message_id,signedData:t})}}isMessageAlreadyLogged({message_id:e}){const{logEntries:t}=this.election;return t.find((t=>t.messageId===e))}signMessage(e){return this.identificationKeys.sign({iat:Math.floor(new Date/1e3),...e})}}class X{constructor({bulletinBoardClient:e,authorityPublicKeyJSON:t,election:r,uniqueId:n,wrapperAdapter:i}){this.uniqueId=n,this.election=r,this.bulletinBoardClient=e,this.wrapperAdapter=i,this.parser=new Z({authorityPublicKeyJSON:t})}async setup(){return await this.wrapperAdapter.setup(),this.bulletinBoardClient.getElectionLogEntries({electionUniqueId:this.election.uniqueId,types:["create_election","end_key_ceremony"]}).then((async e=>{for(const t of e){const{messageIdentifier:e,decodedData:r}=await this.parser.parse(t);await this.wrapperAdapter.processMessage(e.typeSubtype,r)}}))}async encrypt(e,t){const{encryptedData:r,auditableData:n}=await this.wrapperAdapter.encrypt(e,t);return{encryptedData:r,encryptedDataHash:await this.hash(r),auditableData:n,plainVote:e,electionUniqueId:this.election.uniqueId}}async hash(e){return window.crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e)).then((e=>Array.from(new Uint8Array(e)).map((e=>e.toString(16).padStart(2,"0"))).join("")))}verifyVote(e){const{uniqueId:t}=this.election;return this.bulletinBoardClient.getLogEntry({electionUniqueId:t,contentHash:e})}}class ${constructor(e,t){this.format="jwk",this.algorithm={name:"RSASSA-PKCS1-v1_5",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},this.usages=["sign"],this.publicKeyAttrs=["alg","e","kty","n"],this.jwtHeader=this._encode64(JSON.stringify({alg:"RS256",typ:"JWT"})),this.trusteeUniqueId=e,this.privateKey=null,this.publicKey=null,this.storedPublicKey=JSON.parse(t||null),this.keyIdentifier=`${e}-private-key`,this.browserSupport=this._checkBrowserSupport(),this.textEncoder=new TextEncoder("utf-8"),this.dbName="identification_keys",this.dbVersion=1,this.presentPromise=this._read()}present(e){this.presentPromise.then((()=>{this._matchesStoredPublicKey(this.publicKey)?e(this.browserSupport&&null!==this.privateKey):this.reset().then(e(!1))}))}async generate(){return!(!this.browserSupport||this.storedPublicKey)&&new Promise(((e,t)=>{try{return this.crypto.subtle.generateKey(this.algorithm,!0,this.usages).then((t=>this.crypto.subtle.exportKey(this.format,t.privateKey).then((t=>{this.publicKey=this._publicKeyFromPrivateKey(t);const r=document.createElement("a");return r.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(JSON.stringify(t))}`),r.setAttribute("download",`${this.keyIdentifier}.jwk`),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),e()})).catch(this._handleErrors)))}catch(e){return t(e)}}))}async upload(e){return!(!this.browserSupport||null!==this.privateKey)&&new Promise(((t,r)=>{if(e)this.onUploadInputChange(e,t,r);else{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("accept",".jwk"),e.style.display="none",document.body.appendChild(e),e.addEventListener("change",(n=>{document.body.removeChild(e),this.onUploadInputChange(n,t,r)})),e.click()}}))}onUploadInputChange(e,t,r){const n=new FileReader;n.readAsText(e.target.files[0]),n.onload=e=>{let n="";try{n=JSON.parse(e.target.result)}catch(e){return r("invalid_format")}return this.crypto.subtle.importKey(this.format,n,this.algorithm,!1,this.usages).then((e=>{const i=this._publicKeyFromPrivateKey(n);this._matchesStoredPublicKey(i)?(this.publicKey=i,this.privateKey=e,this._save().then((()=>t(!0))).catch((()=>{r("could not be saved")}))):r("invalid_public_key")})).catch((()=>{r("invalid_key")}))}}reset(){return this.privateKey=this.publicKey=null,this._clear()}async sign(e){if(!this.browserSupport||null===this.privateKey)return!1;const t=`${this.jwtHeader}.${this._encode64(JSON.stringify(e))}`,r=await this.crypto.subtle.sign(this.algorithm,this.privateKey,this.textEncoder.encode(t));return`${t}.${btoa(Reflect.apply(String.fromCharCode,null,new Uint8Array(r))).replace(/[=]/g,"").replace(/\+/g,"-").replace(/\//g,"_")}`}_checkBrowserSupport(){return this.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,this.crypto=window.crypto||window.msCrypto,window.indexedDB&&window.crypto}_handleErrors(e){throw e}_publicKeyFromPrivateKey(e){return Object.keys(e).filter((e=>this.publicKeyAttrs.includes(e))).reduce(((t,r)=>(t[r]=e[r],t)),{})}_matchesStoredPublicKey(e){return Y(e,this.storedPublicKey)}_encode64(e){return btoa(unescape(encodeURIComponent(e))).replace(/[=]/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async _read(){return this._useDb("readonly",(e=>{e.get(this.keyIdentifier).onsuccess=e=>{e.target.result&&(this.privateKey=e.target.result.privateKey,this.publicKey=e.target.result.publicKey)}}))}async _save(){return this._useDb("readwrite",(e=>{e.add({privateKey:this.privateKey,publicKey:this.publicKey},this.keyIdentifier)}))}async _clear(){return this._useDb("readwrite",(e=>{e.delete(this.keyIdentifier)}))}async _useDb(e,t){return new Promise(((r,n)=>{let i=null;const a=this.indexedDB.open(this.dbName,this.dbVersion);a.onerror=e=>{i=null,n(e)},a.onupgradeneeded=()=>{i=a.result,i.createObjectStore("IdentificationKeys")},a.onsuccess=()=>{i=a.result;const n=i.transaction(["IdentificationKeys"],e);t(n.objectStore("IdentificationKeys")),n.oncomplete=()=>{i.close(),r()}}}))}}class ee{constructor({authorityPublicKeyJSON:e,trusteeUniqueId:t,trusteeIdentificationKeys:r,trusteeWrapperAdapter:n}){this.trustee=new J({uniqueId:t,authorityPublicKeyJSON:e,identificationKeys:r,wrapperAdapter:n})}async setupElection(){throw new Error("not implemented")}async setupElectionWithTypesFilter({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r,typesFilter:n}){const[i]=t.split("."),a=`${i}.${this.trustee.uniqueId}`,o=await this.trustee.signMessage({trustee_unique_id:a,exp:r}),s=new d({...e,headers:{Authorization:o,TrusteeUniqueId:a}}),u=new m({uniqueId:t,bulletinBoardClient:s,typesFilter:n});this.trustee.election=u}async bindEvents(){throw new Error("not implemented")}}class te extends ee{setupElection({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r}){return this.setupElectionWithTypesFilter({electionUniqueId:t,bulletinBoardClientParams:e,authorizationExpirationTimestamp:r,typesFilter:["create_election","start_key_ceremony","key_ceremony","end_key_ceremony"]})}async bindEvents({onEvent:e,onBindRestoreButton:t,onBindStartButton:r,onRestore:n,onComplete:i,onStart:a,onTrusteeNeedsToBeRestored:o,onBackupNeeded:s,onBindBackupButton:u,onBackupStarted:c}){const l=await this.trustee.setup();this.trustee.events.subscribe(e),r((async e=>{if(a(),e.preventDefault(),await l,await this.trustee.needsToBeRestored())o();else{const e=this.trustee.setupKeyCeremony(),{value:t}=await e.next();s(),u(t,`${this.trustee.uniqueId}-election-${this.trustee.election.uniqueId}.bak`,(async()=>{c(),await e.next(),await this.trustee.runKeyCeremony(),i()}))}})),t((async e=>{await l;const t=e.target.files[0],r=new FileReader;r.onload=async({target:e})=>{const t=e.result;await this.trustee.restore(t)&&(n(),await this.trustee.runKeyCeremony(),i())},r.readAsText(t)}))}}class re extends ee{setupElection({bulletinBoardClientParams:e,electionUniqueId:t,authorizationExpirationTimestamp:r}){return this.setupElectionWithTypesFilter({electionUniqueId:t,bulletinBoardClientParams:e,authorizationExpirationTimestamp:r,typesFilter:["create_election","start_key_ceremony","key_ceremony","end_key_ceremony","start_tally","tally","end_tally"]})}async bindEvents({onEvent:e,onBindRestoreButton:t,onBindStartButton:r,onRestore:n,onComplete:i,onStart:a,onTrusteeNeedsToBeRestored:o}){const s=this.trustee.setup();this.trustee.events.subscribe(e),r((async e=>{a(),e.preventDefault(),await s,await this.trustee.needsToBeRestored()?o():(await this.trustee.runTally(),i())})),t((async e=>{await s;const t=e.target.files[0],r=new FileReader;r.onload=async({target:e})=>{const t=e.result;await this.trustee.restore(t)&&(n(),await this.trustee.runTally(),i())},r.readAsText(t)}))}}class ne{constructor({bulletinBoardClientParams:e,authorityPublicKeyJSON:t,electionUniqueId:r,voterUniqueId:n,voterWrapperAdapter:i}){this.bulletinBoardClient=new d(e);const a=new m({uniqueId:r,bulletinBoardClient:this.bulletinBoardClient});this.voter=new X({bulletinBoardClient:this.bulletinBoardClient,authorityPublicKeyJSON:t,election:a,uniqueId:n,wrapperAdapter:i})}async bindEvents({onBindEncryptButton:e,onStart:t,onVoteEncryption:r,castOrAuditBallot:n,onBindAuditBallotButton:i,onBindCastBallotButton:a,onAuditBallot:o,onCastBallot:s,onAuditComplete:u,onCastComplete:c,onInvalid:l}){const f=this.voter.setup();e((async()=>{t(),await f,r(((e,t)=>{this.voter.encrypt(e,t).then((e=>{n(e),i((()=>{o(e,`${this.voter.uniqueId}-election-${this.voter.election.uniqueId}.txt`),u()})),a((async()=>{try{const t=await s(e);c(t)}catch{l()}}))}))}),(()=>{l()}))}))}}})(),window.decidimBulletinBoard=n})();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-bulletin_board
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.24.
|
4
|
+
version: 0.24.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Morcillo
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2023-
|
14
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|