!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vault=e():(t.swh=t.swh||{},t.swh.vault=e())}(window,(function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/static/",o(o.s=261)}({166:function(t,e,o){"use strict";o.d(e,"a",(function(){return c})),o.d(e,"c",(function(){return s})),o.d(e,"d",(function(){return l})),o.d(e,"b",(function(){return d}));var n,r,i=o(2);function a(t,e){"new"===e.status?t.css("background-color","rgba(128, 128, 128, 0.5)"):"pending"===e.status?t.css("background-color","rgba(0, 0, 255, 0.5)"):"done"===e.status?t.css("background-color","#5cb85c"):"failed"===e.status&&(t.css("background-color","rgba(255, 0, 0, 0.5)"),t.css("background-image","none")),t.text(e.progress_message||e.status),"new"===e.status||"pending"===e.status?t.addClass("progress-bar-animated"):t.removeClass("progress-bar-striped")}function c(t){r=null,fetch(t).then((function(e){if(e.ok)$("#vault-fetch-iframe").attr("src",t);else{for(var o=JSON.parse(localStorage.getItem("swh-vault-cooking-tasks")),n=0;nDownload':f[0].innerHTML=""}else{var b=l.browse_url;b||(b="directory"===l.object_type?Urls.browse_directory(l.object_id):Urls.browse_revision(l.object_id));var v=$.parseHTML('
\n
\n
\n
;')[0];a($(v).find(".progress-bar"),l);var h=void 0;h="directory"===l.object_type?'':'',h+='
',h+='',h+='',l.origin?h+=''+l.origin+"":h+='unknown',h+=''+l.object_type+"",h+='id: '+l.object_id+"",l.path&&(h+="
path: "+l.path),h+="",h+=""+v.outerHTML+"";var g="";"done"===l.status&&(g=''),h+=''+g+"",h+="",r.prepend(h)}}localStorage.setItem("swh-vault-cooking-tasks",JSON.stringify(t)),n=setTimeout(u,5e3)})).catch((function(){}))}function l(t){var e=JSON.parse(localStorage.getItem("swh-vault-cooking-tasks"));e&&(e=$.grep(e,(function(e){return-1===$.inArray(e.object_id,t)})),localStorage.setItem("swh-vault-cooking-tasks",JSON.stringify(e)))}function d(){$("#vault-tasks-toggle-selection").change((function(t){$(".vault-task-toggle-selection").prop("checked",t.currentTarget.checked)})),$("#vault-remove-tasks").click((function(){clearTimeout(n);var t=[];$(".swh-vault-table tbody tr").each((function(e,o){if($(o).find(".vault-task-toggle-selection").prop("checked")){var n=$(o).find(".vault-object-info").data("object-id");t.push(n),$(o).remove()}})),l(t),$("#vault-tasks-toggle-selection").prop("checked",!1),n=setTimeout(u,5e3)})),u(),window.onfocus=function(){clearTimeout(n),u()}}},167:function(t,e,o){"use strict";o.d(e,"e",(function(){return i})),o.d(e,"a",(function(){return s})),o.d(e,"c",(function(){return u})),o.d(e,"b",(function(){return l})),o.d(e,"d",(function(){return d}));var n=o(2),r={position:"fixed",left:"1rem",bottom:"1rem","z-index":"100000"};function i(t,e){var o;o="directory"===t?Urls.api_1_vault_cook_directory(e):Urls.api_1_vault_cook_revision_gitfast(e),fetch(o).then((function(t){return t.json()})).then((function(o){if("NotFoundExc"===o.exception||"failed"===o.status)swh.vault.removeCookingTaskInfo([e]),$("#vault-cook-"+t+"-modal").modal("show");else if("done"===o.status)$("#vault-fetch-"+t+"-modal").modal("show");else{var i=$(Object(n.d)("danger","Archive cooking service is currently experiencing issues.
Please try again later.",!0));i.css(r),$("body").append(i)}}))}function a(t){var e=swh.webapp.getSwhIdsContext();t.origin=e[t.object_type].context.origin,t.path=e[t.object_type].context.path,t.browse_url=e[t.object_type].swhid_with_context_url,t.browse_url||(t.browse_url=e[t.object_type].swhid_url);var o,i=JSON.parse(localStorage.getItem("swh-vault-cooking-tasks"));(i||(i=[]),void 0===i.find((function(e){return e.object_type===t.object_type&&e.object_id===t.object_id})))&&(o="directory"===t.object_type?Urls.api_1_vault_cook_directory(t.object_id):Urls.api_1_vault_cook_revision_gitfast(t.object_id),t.email&&(o+="?email="+t.email),Object(n.a)(o).then(n.b).then((function(){i.push(t),localStorage.setItem("swh-vault-cooking-tasks",JSON.stringify(i)),$("#vault-cook-directory-modal").modal("hide"),$("#vault-cook-revision-modal").modal("hide");var e=$(Object(n.d)("success",'Archive cooking request successfully submitted.
Go to the Downloads page to get the download link once it is ready.',!0));e.css(r),$("body").append(e)})).catch((function(){$("#vault-cook-directory-modal").modal("hide"),$("#vault-cook-revision-modal").modal("hide");var t=$(Object(n.d)("danger","Archive cooking request submission failed.",!0));t.css(r),$("body").append(t)})))}function c(t){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(t).toLowerCase())}function s(t){var e=$("#swh-vault-directory-email").val().trim();!e||c(e)?a({object_type:"directory",object_id:t,email:e,status:"new"}):$("#invalid-email-modal").modal("show")}function u(t){$("#vault-fetch-directory-modal").modal("hide");var e=Urls.api_1_vault_cook_directory(t);fetch(e).then((function(t){return t.json()})).then((function(t){swh.vault.fetchCookedObject(t.fetch_url)}))}function l(t){var e=$("#swh-vault-revision-email").val().trim();!e||c(e)?a({object_type:"revision",object_id:t,email:e,status:"new"}):$("#invalid-email-modal").modal("show")}function d(t){$("#vault-fetch-directory-modal").modal("hide");var e=Urls.api_1_vault_cook_revision_gitfast(t);fetch(e).then((function(t){return t.json()})).then((function(t){swh.vault.fetchCookedObject(t.fetch_url)}))}},2:function(t,e,o){"use strict";function n(t){if(!t.ok)throw t;return t}function r(t){for(var e=0;e'+e+n+"
"}o.d(e,"b",(function(){return n})),o.d(e,"c",(function(){return r})),o.d(e,"h",(function(){return i})),o.d(e,"a",(function(){return a})),o.d(e,"e",(function(){return c})),o.d(e,"f",(function(){return s})),o.d(e,"g",(function(){return u})),o.d(e,"d",(function(){return l}))},261:function(t,e,o){t.exports=o(262)},262:function(t,e,o){"use strict";o.r(e);o(263);var n=o(166);o.d(e,"fetchCookedObject",(function(){return n.a})),o.d(e,"recookObject",(function(){return n.c})),o.d(e,"removeCookingTaskInfo",(function(){return n.d})),o.d(e,"initUi",(function(){return n.b}));var r=o(167);o.d(e,"vaultRequest",(function(){return r.e})),o.d(e,"cookDirectoryArchive",(function(){return r.a})),o.d(e,"fetchDirectoryArchive",(function(){return r.c})),o.d(e,"cookRevisionArchive",(function(){return r.b})),o.d(e,"fetchRevisionArchive",(function(){return r.d}))},263:function(t,e,o){}})})); //# sourceMappingURL=vault.5e9ca396f730a410304f.js.map