var document={createElementNS:function(){return{}}},window=this;importScripts("/static/js/workers/pdf-worker-libs.js"),pdfMake.fonts={PdfFont:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-Italic.ttf"}};var replacePlaceholder=function(e){for(var t=0;t<e.length;t++)if("object"==typeof e[t]){if("{{motion-placeholder-to-insert-functions-here}}"===e[t].layout)return e[t].layout={hLineWidth:function(e,t){return 0===e||e===t.table.body.length?0:.5},vLineWidth:function(){return 0},hLineColor:function(){return"white"}},!0;if("{{ballot-placeholder-to-insert-functions-here}}"===e[t].layout)return e[t].layout={hLineWidth:function(e,t){return 0===e?0:.5},vLineWidth:function(e,t){return 0===e||e===t.table.widths.length?0:.5},hLineColor:function(){return"gray"},vLineColor:function(){return"gray"}},!0;replacePlaceholder(e[t])}},replaceFooter=function(e){e.footerTpl&&(e.footer=function(t,o){for(var n=JSON.parse(JSON.stringify(e.footerTpl.columns)),r=0;r<n.length;r++)n[r].text&&(n[r].text=n[r].text.replace("{{currentPage}}",t).replace("{{pageCount}}",o));return{columns:n,margin:e.footerTpl.margin}})};self.addEventListener("message",function(e){var t=JSON.parse(e.data),o=t.pdfDocument;replaceFooter(o),replacePlaceholder(o.content),pdfMake.createPdf(o).getBase64(function(e){t.filename?self.postMessage(JSON.stringify({filename:t.filename,base64:e})):self.postMessage(e)})},!1);