// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 (()=>{"use strict";var e,t,n={createElementNS:document.createElementNS};var o=!0;function r(e){o=e}function i(e){try{r(!1),e()}finally{r(!0)}}function s(e){!function(e,t,n){if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);var r="; expires="+o.toGMTString()}else r="";document.cookie=e+"="+t+r+"; path=/"}(e,"",-1)}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function l(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"src",n="_wm_".concat(t);return n in e.__proto__?e[n]:e[t]}g("Image","src"),g("Media","src"),g("Embed","src"),g("IFrame","src"),g("Script","src"),g("Link","href"),g("Anchor","href");var b=["January","February","March","April","May","June","July","August","September","October","November","December"],S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T={Y:function(e){return e.getUTCFullYear()},m:function(e){return e.getUTCMonth()+1},b:function(e){return S[e.getUTCMonth()]},B:function(e){return b[e.getUTCMonth()]},d:function(e){return e.getUTCDate()},H:function(e){return("0"+e.getUTCHours()).slice(-2)},M:function(e){return("0"+e.getUTCMinutes()).slice(-2)},S:function(e){return("0"+e.getUTCSeconds()).slice(-2)},"%":function(){return"%"}};function C(e){var t=function(e){return"number"==typeof e&&(e=e.toString()),[e.slice(-14,-10),e.slice(-10,-8),e.slice(-8,-6),e.slice(-6,-4),e.slice(-4,-2),e.slice(-2)]}(e);return new Date(Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5]))}function M(e){return S[e]}function _(e,t){return t.replace(/%./g,(function(t){var n=T[t[1]];return n?n(C(e)):t}))}var k=window.Date;function x(e,t){return(e=e.toString()).length>=t?e:"00000000".substring(0,t-e.length)+e}function E(e){for(var t=0,n=0;n3}(e)){var o=[];for(n=0;n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:"src",i=window.location.origin,s=H(U(window,e));try{for(s.s();!(o=s.n()).done;){var l=o.value;if(!n||n(l)){var c=w(l,r);c&&!c.startsWith(t)&&c.startsWith(i)&&(c.startsWith("data:")||a.push(c))}}}catch(e){s.e(e)}finally{s.f()}}l("img"),l("frame"),l("iframe",(function(e){return"playback"!==e.id})),l("script"),l("link",(function(e){return"stylesheet"===e.rel}),"href");var c=a.filter((function(e,t,n){return n.indexOf(e)===t}));c.length>0?(s=0,c.map((function(e){e.match("^https?://")&&(s++,v("HEAD",e,(function(e){if(200==e.status){var t=e.getResponseHeader("Memento-Datetime");if(null==t)console.log("%s: no Memento-Datetime",u);else{var n=document.createElement("span"),a=function(e,t){var n=new Date(e).getTime()-t,o="";n<0?(o+="-",n=Math.abs(n)):o+="+";var r=!1;if(n<1e3)return{delta:n,text:"",highlight:r};var i=n,s=Math.floor(n/1e3/60/60/24/30/12);n-=1e3*s*60*60*24*30*12;var a=Math.floor(n/1e3/60/60/24/30);n-=1e3*a*60*60*24*30;var l=Math.floor(n/1e3/60/60/24);n-=1e3*l*60*60*24;var c=Math.floor(n/1e3/60/60);n-=1e3*c*60*60;var u=Math.floor(n/1e3/60);n-=1e3*u*60;var h=Math.floor(n/1e3),f=[];return s>1?(f.push(s+" years"),r=!0):1==s&&(f.push(s+" year"),r=!0),a>1?(f.push(a+" months"),r=!0):1==a&&(f.push(a+" month"),r=!0),l>1?f.push(l+" days"):1==l&&f.push(l+" day"),c>1?f.push(c+" hours"):1==c&&f.push(c+" hour"),u>1?f.push(u+" minutes"):1==u&&f.push(u+" minute"),h>1?f.push(h+" seconds"):1==h&&f.push(h+" second"),f.length>2&&(f=f.slice(0,2)),{delta:i,text:o+f.join(" "),highlight:r}}(t,i),l=a.highlight?"color:red;":"";n.innerHTML=" "+a.text,n.title=t,n.setAttribute("style",l);var c=e.getResponseHeader("Content-Type"),u=e.responseURL.replace(window.location.origin,""),h=document.createElement("a");h.innerHTML=u.split("/").splice(3).join("/"),h._wm_href=u,h.title=c,h.onmouseover=N,h.onmouseout=j;var f=document.createElement("div");f.setAttribute("data-delta",a.delta),f.appendChild(h),f.append(n),o.appendChild(f);var p=Array.prototype.slice.call(o.childNodes,0);p.sort((function(e,t){return t.getAttribute("data-delta")-e.getAttribute("data-delta")})),o.innerHTML="";for(var d=0,m=p.length;d0)for(var n=0;n0)for(var n=0;n0?this.sc.scrollTop=r+this.sc.suggestionHeight+o-this.sc.maxHeight:r<0&&(this.sc.scrollTop=r+o)}}},{key:"blurHandler",value:function(){var e=this;try{var t=this.root.querySelector(".wb-autocomplete-suggestions:hover")}catch(e){t=null}t?this.input!==document.activeElement&&setTimeout((function(){return e.focus()}),20):(this.last_val=this.input.value,this.sc.style.display="none",setTimeout((function(){return e.sc.style.display="none"}),350))}},{key:"suggest",value:function(e){var t=this.input.value;if(this.cache[t]=e,e.length&&t.length>=this.minChars){for(var n="",o=0;o40)&&13!=n&&27!=n){var o=this.input.value;if(o.length>=this.minChars){if(o!=this.last_val){if(this.last_val=o,clearTimeout(this.timer),this.cache){if(o in this.cache)return void this.suggest(this.cache[o]);for(var r=1;r'+e.replace(n,"$1")+""}},{key:"onSelect",value:function(e,t,n){}}]),e}(),$=function(){function e(t,n){P(this,e);var o=t.getRootNode();if(o.querySelector){var r="object"==I(t)?[t]:o.querySelectorAll(t);this.elems=r.map((function(e){return new Y(e,n)}))}}return q(e,[{key:"destroy",value:function(){for(;this.elems.length>0;)this.elems.pop().unload()}}]),e}();function J(e){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J(e)}function G(e,t){for(var n=0;n=0))}))}var t,n,o;return t=e,n=[{key:"save",value:function(e){var t,n,o,r;this.start(),t=this.url,n=this.timestamp,o=[],r=(r={failure:this.failure.bind(this),success:this.success.bind(this)})||{},v("POST","/__wb/web-archive/",(function(e){401===e.status?r.userNotLoggedIn&&r.userNotLoggedIn(e):e.status>=400?r.failure&&r.failure(e):r.success&&r.success(e)}),{"Content-Type":"application/json"},z.stringify({url:t,snapshot:n,tags:o||[]}))}},{key:"start",value:function(){this.hide(["wm-save-snapshot-fail","wm-save-snapshot-open","wm-save-snapshot-success"]),this.show(["wm-save-snapshot-in-progress"])}},{key:"failure",value:function(e){401==e.status?this.userNotLoggedIn(e):(this.hide(["wm-save-snapshot-in-progress","wm-save-snapshot-success"]),this.show(["wm-save-snapshot-fail","wm-save-snapshot-open"]),console.log("You have got an error."),console.log("If you think something wrong here please send it to support."),console.log('Response: "'+e.responseText+'"'),console.log('status: "'+e.status+'"'))}},{key:"success",value:function(e){this.hide(["wm-save-snapshot-fail","wm-save-snapshot-in-progress"]),this.show(["wm-save-snapshot-open","wm-save-snapshot-success"])}},{key:"enableSaveSnapshot",value:function(){arguments.length>0&&void 0!==arguments[0]&&!arguments[0]?(this.hide(["wm-save-snapshot-open","wm-save-snapshot-in-progress"]),this.show("wm-sign-in")):(this.show("wm-save-snapshot-open"),this.hide("wm-sign-in"))}},{key:"show",value:function(e){this.setDisplayStyle(e,"inline-block")}},{key:"hide",value:function(e){this.setDisplayStyle(e,"none")}},{key:"setDisplayStyle",value:function(e,t){var n=this;(y(e)?e:[e]).forEach((function(e){var o=n.el.getRootNode().getElementById(e);o&&(o.style.display=t)}))}}],n&&G(t.prototype,n),o&&G(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();function K(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Q(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw i}}}}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n40)for(var t=0;t1?t-1:0),r=1;r0;)A.appendChild(L.children[0]);if(u)for(var O=0;O1?"captures":"capture");var f=_(r,"%d %b %Y");i!=r&&(f+=" - ".concat(_(i,"%d %b %Y")));var p=document.createElement("div");p.className="r",p.title="Timespan for captures of this URL",p.innerText=f,t.innerHTML="",t.appendChild(h),t.appendChild(p)}(o),function(e,t,n,o,r,i,s){var a=o.getContext("2d");if(a){a.fillStyle="#FFF";var l=(new k).getUTCFullYear(),c=t/(l-r+1),u=E(e.years),h=u[0],f=n/u[1];if(i>=r){var p=T(i);a.fillStyle="#FFFFA5",a.fillRect(p,0,c,n)}for(var d=r;d<=l;d++)p=T(d),a.beginPath(),a.moveTo(p,0),a.lineTo(p,n),a.lineWidth=1,a.strokeStyle="#CCC",a.stroke();s=parseInt(s)-1;for(var m=(c-1)/12,v=0;v0){var S=Math.ceil(b*f);a.fillStyle=d==i&&w==s?"#EC008C":"#000",a.fillRect(Math.round(g),Math.ceil(n-S),Math.ceil(m),Math.round(S))}g+=m}}}function T(e){return Math.ceil((e-r)*c)+.5}}(o,e,t,W,l,w,b)}}))}else{var X=new Image;X.src="/__wb/sparkline?url="+encodeURIComponent(s)+"&width="+e+"&height="+t+"&selected_year="+w+"&selected_month="+b+(r&&"&collection="+r||""),X.alt="sparkline",X.width=e,X.height=t,X.id="sparklineImgId",X.border="0",F.parentNode.replaceChild(X,F)}function Y(e){for(var t=[],n=e.length,o=0;o0&&i<60,i)}))}(e,t,(function(e,t){e?(ae("wm-screenshot").title="screen shot (delta: "+t+"s)",fe("wm-screenshot",!0)):fe("wm-screenshot",!1)}))}(s,le),h&&function(e,t){!function(e,t,n){var o="/web/"+t+"id_/http://wayback-metadata.archive.org/youtube-dl/"+e;v("GET",o,n)}(e,t,(function(e){if(e.status<300){var t=te.parse(e.responseText);fe("wm-video",!0),ae("wm-video").href=t.url,ae("wm-video").title="Video: "+t.title}else fe("wm-video",!1)}))}(s,le);var J=ae("wm-capinfo-notice");if(J)if("api"==J.getAttribute("source")){var G="https://wayback-api.archive.org/services/context/notices?url=".concat(encodeURIComponent(s),"×tamp=").concat(le);re(G,{credentials:"omit"}).then((function(e){return e.json()})).then((function(e){var t=e.status,n=e.notices;if("success"==t&&(null==n?void 0:n.length)>0)try{var o=document.createElement("div");o.setAttribute("style","background-color:#666;color:#fff;font-weight:bold;text-align:center"),o.textContent="NOTICE";var r=document.createElement("div");r.className="wm-capinfo-content";var s,a=K(n);try{var l=function(){var e=s.value;"string"==typeof e.notice&&i((function(){var t=document.createElement("div");t.innerHTML=e.notice,r.appendChild(t)}))};for(a.s();!(s=a.n()).done;)l()}catch(e){a.e(e)}finally{a.f()}J.appendChild(o),i((function(){return J.appendChild(r)})),ue(!0)}catch(e){console.error("failed to build content of %o - maybe notice text is malformed: %s",J,n)}}))}else ue(!0);new V(ae("wm-save-snapshot-open"),s,le)},ex:function(e){e.stopPropagation(),ue(!1)},ajax:v,sp:function(){return ce}}})(); // @license-end