replaywebpage 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html class="no-overflow">
3
+ <head>
4
+ <link rel="manifest" href="/webmanifest.json">
5
+ <link rel="icon" href="build/icon.png" type="image/png" />
6
+ <title>ReplayWeb.page</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <script src="./ui.js"></script>
9
+ </head>
10
+ <body>
11
+ <replay-app-main></replay-app-main>
12
+ </body>
13
+ </html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "replaywebpage",
3
3
  "productName": "ReplayWeb.page",
4
- "version": "1.6.1",
4
+ "version": "1.6.2",
5
5
  "description": "Serverless Web Archive Replay",
6
6
  "repository": "https://github.com/webrecorder/replayweb.page",
7
7
  "homepage": "https://replayweb.page/",
@@ -51,7 +51,8 @@
51
51
  "/ruffle",
52
52
  "sw.js",
53
53
  "ui.js",
54
- "index.js"
54
+ "index.js",
55
+ "index.html"
55
56
  ],
56
57
  "scripts": {
57
58
  "build": "webpack --mode production",
package/src/coll.js CHANGED
@@ -66,6 +66,7 @@ class Coll extends LitElement
66
66
 
67
67
  this.editable = false;
68
68
  this.browsable = true;
69
+ this.clearable = true;
69
70
 
70
71
  this.showSidebar = localStorage.getItem("pages:showSidebar") === "1";
71
72
  this.splitter = null;
@@ -108,6 +109,7 @@ class Coll extends LitElement
108
109
  embed: { type: String },
109
110
  editable: { type: Boolean },
110
111
  browsable: { type: Boolean },
112
+ clearable: { type: Boolean },
111
113
 
112
114
  isVisible: { type: Boolean },
113
115
 
@@ -844,7 +846,7 @@ class Coll extends LitElement
844
846
  <span>Browse Contents</span>
845
847
  </a>` : ""}
846
848
  ${this.renderExtraToolbar(true)}
847
- ${!this.editable ? html`
849
+ ${this.clearable ? html`
848
850
  <hr class="dropdown-divider is-hidden-desktop">
849
851
  <a href="#" role="button" class="dropdown-item" @click="${this.onPurgeCache}" @keyup="${clickOnSpacebarPress}">
850
852
  <span class="icon is-small">
package/src/pageutils.js CHANGED
@@ -71,7 +71,7 @@ function tsToDate(ts) {
71
71
  }
72
72
 
73
73
  if (ts.length < 14) {
74
- ts += "00000000000000".substr(ts.length);
74
+ ts += "00000101000000".substr(ts.length);
75
75
  }
76
76
 
77
77
  const datestr = (ts.substring(0, 4) + "-" +
package/ui.js CHANGED
@@ -48,7 +48,7 @@ class oe extends re{constructor(e){if(super(e),this.it=R,e.type!==ie)throw Error
48
48
  * Copyright 2017 Google LLC
49
49
  * SPDX-License-Identifier: BSD-3-Clause
50
50
  */
51
- class se extends oe{}se.directiveName="unsafeSVG",se.resultType=2;const le=ae(se),ce=ae(class extends re{constructor(e){var t;if(super(e),e.type!==te||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const a=e[i];return null==a?t:t+`${i=i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ct){this.ct=new Set;for(const e in t)this.ct.add(e);return this.render(t)}this.ct.forEach((e=>{null==t[e]&&(this.ct.delete(e),e.includes("-")?i.removeProperty(e):i[e]="")}));for(const e in t){const a=t[e];null!=a&&(this.ct.add(e),e.includes("-")?i.setProperty(e,a):i[e]=a)}return P}});var de=__webpack_require__(6274),he=__webpack_require__(3029),fe=__webpack_require__.n(he);const be=r(de.Z);function ue(e){return[be,e]}const pe=window.IS_APP||window.electron&&window.electron.IS_APP||window.matchMedia("(display-mode: standalone)").matches,me="1.6.1";function ge(e){" "==e.key&&(e.preventDefault(),e.target.click())}class ve extends X{constructor(){super(),this.size="1.1em",this.width=null,this.height=null}static get properties(){return{svg:{type:String},size:{type:String},width:{type:String},height:{type:String}}}static get styles(){return o`
51
+ class se extends oe{}se.directiveName="unsafeSVG",se.resultType=2;const le=ae(se),ce=ae(class extends re{constructor(e){var t;if(super(e),e.type!==te||"style"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const a=e[i];return null==a?t:t+`${i=i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ct){this.ct=new Set;for(const e in t)this.ct.add(e);return this.render(t)}this.ct.forEach((e=>{null==t[e]&&(this.ct.delete(e),e.includes("-")?i.removeProperty(e):i[e]="")}));for(const e in t){const a=t[e];null!=a&&(this.ct.add(e),e.includes("-")?i.setProperty(e,a):i[e]=a)}return P}});var de=__webpack_require__(6274),he=__webpack_require__(3029),fe=__webpack_require__.n(he);const be=r(de.Z);function ue(e){return[be,e]}const pe=window.IS_APP||window.electron&&window.electron.IS_APP||window.matchMedia("(display-mode: standalone)").matches,me="1.6.2";function ge(e){" "==e.key&&(e.preventDefault(),e.target.click())}class ve extends X{constructor(){super(),this.size="1.1em",this.width=null,this.height=null}static get properties(){return{svg:{type:String},size:{type:String},width:{type:String},height:{type:String}}}static get styles(){return o`
52
52
  :host {
53
53
  display: inline-block;
54
54
  padding: 0;
@@ -654,7 +654,7 @@ class se extends oe{}se.directiveName="unsafeSVG",se.resultType=2;const le=ae(se
654
654
  </div>
655
655
  `:U``}
656
656
 
657
- </div>`}onCopy(e,t){return e.preventDefault(),e.stopPropagation(),navigator.clipboard.writeText(t),!1}onPurge(e){const t={reload:e};this.dispatchEvent(new CustomEvent("coll-purge",{detail:t}))}}customElements.define("wr-coll-info",Ye),customElements.define("wr-coll-index",Je);var Xe=__webpack_require__(5056),et=__webpack_require__.n(Xe),tt=__webpack_require__(5732),it=__webpack_require__.n(tt),at=__webpack_require__(8561),rt=__webpack_require__.n(at),ot=__webpack_require__(9885),nt=__webpack_require__.n(ot),st=__webpack_require__(4636),lt=__webpack_require__.n(st),ct=__webpack_require__(1615),dt=__webpack_require__.n(ct),ht=__webpack_require__(2302),ft=__webpack_require__.n(ht),bt=__webpack_require__(6368),ut=__webpack_require__.n(bt),pt=__webpack_require__(9125),mt=__webpack_require__.n(pt),gt=__webpack_require__(9998),vt=__webpack_require__.n(gt),wt=__webpack_require__(2164),xt=__webpack_require__.n(wt),kt=__webpack_require__(426),yt=__webpack_require__.n(kt),_t=__webpack_require__(430),$t=__webpack_require__.n(_t),St="undefined"!=typeof window?window:null,zt=null===St,At=zt?void 0:St.document,Ct="horizontal",Dt=function(){return!1},Et=zt?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=At.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",Lt=function(e){return"string"==typeof e||e instanceof String},It=function(e){if(Lt(e)){var t=At.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},Tt=function(e,t,i){var a=e[t];return void 0!==a?a:i},Ut=function(e,t,i,a){if(t){if("end"===a)return 0;if("center"===a)return e/2}else if(i){if("start"===a)return 0;if("center"===a)return e/2}return e},Pt=function(e,t){var i=At.createElement("div");return i.className="gutter gutter-"+t,i},Rt=function(e,t,i){var a={};return Lt(t)?a[e]=t:a[e]=Et+"("+t+"% - "+i+"px)",a},qt=function(e,t){var i;return(i={})[e]=t+"px",i};const Mt=function(e,t){if(void 0===t&&(t={}),zt)return{};var i,a,r,o,n,s,l=e;Array.from&&(l=Array.from(l));var c=It(l[0]).parentNode,d=getComputedStyle?getComputedStyle(c):null,h=d?d.flexDirection:null,f=Tt(t,"sizes")||l.map((function(){return 100/l.length})),b=Tt(t,"minSize",100),u=Array.isArray(b)?b:l.map((function(){return b})),p=Tt(t,"maxSize",1/0),m=Array.isArray(p)?p:l.map((function(){return p})),g=Tt(t,"expandToMin",!1),v=Tt(t,"gutterSize",10),w=Tt(t,"gutterAlign","center"),x=Tt(t,"snapOffset",30),k=Tt(t,"dragInterval",1),y=Tt(t,"direction",Ct),_=Tt(t,"cursor",y===Ct?"col-resize":"row-resize"),$=Tt(t,"gutter",Pt),S=Tt(t,"elementStyle",Rt),z=Tt(t,"gutterStyle",qt);function A(e,t,a,r){var o=S(i,t,a,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function C(){return s.map((function(e){return e.size}))}function D(e){return"touches"in e?e.touches[0][a]:e[a]}function E(e){var t=s[this.a],i=s[this.b],a=t.size+i.size;t.size=e/this.size*a,i.size=a-e/this.size*a,A(t.element,t.size,this._b,t.i),A(i.element,i.size,this._c,i.i)}function L(e){var i,a=s[this.a],r=s[this.b];this.dragging&&(i=D(e)-this.start+(this._b-this.dragOffset),k>1&&(i=Math.round(i/k)*k),i<=a.minSize+x+this._b?i=a.minSize+this._b:i>=this.size-(r.minSize+x+this._c)&&(i=this.size-(r.minSize+this._c)),i>=a.maxSize-x+this._b?i=a.maxSize+this._b:i<=this.size-(r.maxSize-x+this._c)&&(i=this.size-(r.maxSize+this._c)),E.call(this,i),Tt(t,"onDrag",Dt)(C()))}function I(){var e=s[this.a].element,t=s[this.b].element,a=e.getBoundingClientRect(),n=t.getBoundingClientRect();this.size=a[i]+n[i]+this._b+this._c,this.start=a[r],this.end=a[o]}function T(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var i=e[n];return 0===i?null:i-=y===Ct?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(c);if(null===t)return e;if(u.reduce((function(e,t){return e+t}),0)>t)return e;var i=0,a=[],r=e.map((function(r,o){var n=t*r/100,s=Ut(v,0===o,o===e.length-1,w),l=u[o]+s;return n<l?(i+=l-n,a.push(0),l):(a.push(n-l),n)}));return 0===i?e:r.map((function(e,r){var o=e;if(i>0&&a[r]-i>0){var n=Math.min(i,a[r]-i);i-=n,o=e-n}return o/t*100}))}function U(){var e=this,i=s[e.a].element,a=s[e.b].element;e.dragging&&Tt(t,"onDragEnd",Dt)(C()),e.dragging=!1,St.removeEventListener("mouseup",e.stop),St.removeEventListener("touchend",e.stop),St.removeEventListener("touchcancel",e.stop),St.removeEventListener("mousemove",e.move),St.removeEventListener("touchmove",e.move),e.stop=null,e.move=null,i.removeEventListener("selectstart",Dt),i.removeEventListener("dragstart",Dt),a.removeEventListener("selectstart",Dt),a.removeEventListener("dragstart",Dt),i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",a.style.userSelect="",a.style.webkitUserSelect="",a.style.MozUserSelect="",a.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",At.body.style.cursor=""}function P(e){if(!("button"in e)||0===e.button){var i=this,a=s[i.a].element,r=s[i.b].element;i.dragging||Tt(t,"onDragStart",Dt)(C()),e.preventDefault(),i.dragging=!0,i.move=L.bind(i),i.stop=U.bind(i),St.addEventListener("mouseup",i.stop),St.addEventListener("touchend",i.stop),St.addEventListener("touchcancel",i.stop),St.addEventListener("mousemove",i.move),St.addEventListener("touchmove",i.move),a.addEventListener("selectstart",Dt),a.addEventListener("dragstart",Dt),r.addEventListener("selectstart",Dt),r.addEventListener("dragstart",Dt),a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",i.gutter.style.cursor=_,i.parent.style.cursor=_,At.body.style.cursor=_,I.call(i),i.dragOffset=D(e)-i.end}}y===Ct?(i="width",a="clientX",r="left",o="right",n="clientWidth"):"vertical"===y&&(i="height",a="clientY",r="top",o="bottom",n="clientHeight"),f=T(f);var R=[];function q(e){var t=e.i===R.length,i=t?R[e.i-1]:R[e.i];I.call(i);var a=t?i.size-e.minSize-i._c:e.minSize+i._b;E.call(i,a)}return s=l.map((function(e,t){var a,r={element:It(e),size:f[t],minSize:u[t],maxSize:m[t],i:t};if(t>0&&((a={a:t-1,b:t,dragging:!1,direction:y,parent:c})._b=Ut(v,t-1==0,!1,w),a._c=Ut(v,!1,t===l.length-1,w),"row-reverse"===h||"column-reverse"===h)){var o=a.a;a.a=a.b,a.b=o}if(t>0){var n=$(t,y,r.element);!function(e,t,a){var r=z(i,t,a);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(n,v,t),a._a=P.bind(a),n.addEventListener("mousedown",a._a),n.addEventListener("touchstart",a._a),c.insertBefore(n,r.element),a.gutter=n}return A(r.element,r.size,Ut(v,0===t,t===l.length-1,w),t),t>0&&R.push(a),r})),s.forEach((function(e){var t=e.element.getBoundingClientRect()[i];t<e.minSize&&(g?q(e):e.minSize=t)})),{setSizes:function(e){var t=T(e);t.forEach((function(e,i){if(i>0){var a=R[i-1],r=s[a.a],o=s[a.b];r.size=t[i-1],o.size=e,A(r.element,r.size,a._b,r.i),A(o.element,o.size,a._c,o.i)}}))},getSizes:C,collapse:function(e){q(s[e])},destroy:function(e,t){R.forEach((function(a){if(!0!==t?a.parent.removeChild(a.gutter):(a.gutter.removeEventListener("mousedown",a._a),a.gutter.removeEventListener("touchstart",a._a)),!0!==e){var r=S(i,a.a.size,a._b);Object.keys(r).forEach((function(e){s[a.a].element.style[e]="",s[a.b].element.style[e]=""}))}}))},parent:c,pairs:R}},jt="search://";class Bt extends X{constructor(){super(),this.sourceUrl=null,this.inited=!1,this.isLoading=!1,this.coll="",this.collInfo=null,this._replaceLoc=!1,this._locUpdateNeeded=!1,this._locationHash="",this.tabData={},this.url="",this.ts="",this.tabNames=["pages","story","resources","info"],this.tabLabels={pages:"Pages",story:"Story",resources:"URLs",info:"Archive Info"},this.menuActive=!1,this.hasStory=!1,this.editable=!1,this.browsable=!0,this.showSidebar="1"===localStorage.getItem("pages:showSidebar"),this.splitter=null,this.isVisible=!0,this.favIconUrl="",this.autoUpdateInterval=10,this._autoUpdater=null,this.appName="ReplayWeb.page",this.appVersion=me,this.appLogo=fe()}static get properties(){return{inited:{type:Boolean},sourceUrl:{type:String},loadInfo:{type:Object,attribute:!1},showSidebar:{type:Boolean},collInfo:{type:Object,attribute:!1},coll:{type:String},hasStory:{type:Boolean},isLoading:{type:Boolean},tabData:{type:Object,attribute:!1},url:{type:String},ts:{type:String},isFullscreen:{type:Boolean},menuActive:{type:Boolean},embed:{type:String},editable:{type:Boolean},browsable:{type:Boolean},isVisible:{type:Boolean},favIconUrl:{type:String},appName:{type:String},appVersion:{type:String},appLogo:{type:String},autoUpdateInterval:{type:Number}}}firstUpdated(){this.inited=!0,window.addEventListener("hashchange",(e=>this.onHashChange(e))),this.addEventListener("fullscreenchange",(()=>{this.isFullscreen=!!document.fullscreenElement})),this.embed&&(this.observer=new IntersectionObserver((e=>{this.isVisible=e[0].isIntersecting})),this.observer.observe(this))}async runUpdateLoop(){try{for(;this.editable&&this.autoUpdateInterval&&(!this.collInfo||this.collInfo.pages.length<100);)await new Promise((e=>setTimeout(e,1e3*this.autoUpdateInterval))),await this.doUpdateInfo(!0)}finally{this._autoUpdater=null}}updated(e){if(e.has("sourceUrl")&&this.doUpdateInfo(),e.has("editable")&&this.editable&&this.autoUpdateInterval&&!this._autoUpdater&&(this._autoUpdater=this.runUpdateLoop()),e.has("tabData")){if(!this.collInfo||!this.collInfo.coll)return;Object.keys(this.tabData).forEach((e=>!this.tabData[e]&&delete this.tabData[e]));const t="#"+new URLSearchParams(this.tabData).toString();if(this.tabData.url||(this.url=jt+decodeURIComponent(this._paramsToString(this.tabData))),t!==this._locationHash){if(this._locationHash=t,this._replaceLoc||0===Object.keys(e.get("tabData")).length){const e=new URL(window.location.href);e.hash=this._locationHash,window.history.replaceState({},"",e.href),this._replaceLoc=!1}else if(window.location.hash=this._locationHash,!this.showSidebar){const e=this.renderRoot.querySelector("wr-coll-replay");e&&e.focus()}this.embed&&window.parent!==window&&window.parent.postMessage(this.tabData,"*")}this._locUpdateNeeded=!1}e.has("showSidebar")&&(this.embed||localStorage.setItem("pages:showSidebar",this.showSidebar?"1":"0")),(e.has("tabData")||e.has("showSidebar"))&&this.configureSplitter()}configureSplitter(){if(this.tabData.url&&this.showSidebar){const e=this.renderRoot.querySelector("#contents"),t=this.renderRoot.querySelector("wr-coll-replay");if(e&&t&&!this.splitter){const i={sizes:[30,70],minSize:[300,300],gutterSize:4,onDragStart(){t.setDisablePointer(!0)},onDragEnd(){t.setDisablePointer(!1)}};this.splitter=Mt([e,t],i)}}else if(this.splitter){try{this.splitter.destroy()}catch(e){}this.splitter=null}}async doUpdateInfo(e=!1){if(e&&this.tabData.url&&!this.showSidebar)return;let t=this.loadInfo&&this.loadInfo.customColl;if(!t){t=(await Ee(this.sourceUrl)).coll}this.coll=t;const i="./w/api/c/"+t,a="./w/"+t,r=await fetch(i+"?all=1");if(200!=r.status)return void(this.collInfo={});const o=await r.json();this.collInfo={apiPrefix:i,replayPrefix:a,coll:t,...o},this.collInfo.title||(this.collInfo.title=this.collInfo.filename),"replayonly"===this.embed&&(this.showSidebar=!1),this.hasStory=this.collInfo.desc||this.collInfo.lists.length,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{collInfo:this.collInfo,alreadyLoaded:!0}})),this.onHashChange()}onCollLoaded(e){this.doUpdateInfo(),this.loadInfo=null,e.detail.sourceUrl&&(this.sourceUrl=e.detail.sourceUrl),this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{sourceUrl:this.sourceUrl,collInfo:this.collInfo}}))}onCollUpdate(e){this.editable&&(this.collInfo={...this.collInfo,...e.detail})}onHashChange(){const e=window.location.hash;if(e&&e!==this._locationHash&&(this.tabData=Object.fromEntries(new URLSearchParams(e.slice(1)).entries()),this._locationHash=e),this.collInfo.coll&&!this.tabNames.includes(this.tabData.view)){const e=this.hasStory?"story":this.editable||this.collInfo.pages.length?"pages":"resources";this.tabData={...this.tabData,view:e}}if(this.tabData.url&&this.tabData.url.startsWith("page:")){const e=Number(this.tabData.url.slice("page:".length));if(!isNaN(e)&&e<this.collInfo.pages.length){const t=this.collInfo.pages[e];this.tabData.url=t.url,this.tabData.ts=Ae(t).timestamp}}this.hasStory||"story"!==this.tabData.view||(this.tabData.view="pages"),this.tabData.url&&this.tabData.query&&(this.showSidebar=!0)}onTabClick(e){e.preventDefault();const t=e.currentTarget.getAttribute("href");return this.tabData={...this.tabData,view:t.slice(1)},!1}onCollTabNav(e){e.detail.reload?this.onRefresh(null,!0):e.target.id===this.tabData.view||"replay"===e.target.id&&this.tabData.url?this.updateTabData(e.detail.data,e.detail.replaceLoc,!1):this.showSidebar&&this.tabData.url&&this.updateTabData(e.detail.data,e.detail.replaceLoc,!0)}updateTabData(e,t=!1){this.tabData={...this.tabData,...e},this.tabData.url&&(this.url=this.tabData.url||""),this.tabData.ts&&(this.ts=this.tabData.ts||""),this._replaceLoc=!this._locUpdateNeeded&&t,this._locUpdateNeeded=!0}static get styles(){return ue(Bt.compStyles)}static get compStyles(){return o`
657
+ </div>`}onCopy(e,t){return e.preventDefault(),e.stopPropagation(),navigator.clipboard.writeText(t),!1}onPurge(e){const t={reload:e};this.dispatchEvent(new CustomEvent("coll-purge",{detail:t}))}}customElements.define("wr-coll-info",Ye),customElements.define("wr-coll-index",Je);var Xe=__webpack_require__(5056),et=__webpack_require__.n(Xe),tt=__webpack_require__(5732),it=__webpack_require__.n(tt),at=__webpack_require__(8561),rt=__webpack_require__.n(at),ot=__webpack_require__(9885),nt=__webpack_require__.n(ot),st=__webpack_require__(4636),lt=__webpack_require__.n(st),ct=__webpack_require__(1615),dt=__webpack_require__.n(ct),ht=__webpack_require__(2302),ft=__webpack_require__.n(ht),bt=__webpack_require__(6368),ut=__webpack_require__.n(bt),pt=__webpack_require__(9125),mt=__webpack_require__.n(pt),gt=__webpack_require__(9998),vt=__webpack_require__.n(gt),wt=__webpack_require__(2164),xt=__webpack_require__.n(wt),kt=__webpack_require__(426),yt=__webpack_require__.n(kt),_t=__webpack_require__(430),$t=__webpack_require__.n(_t),St="undefined"!=typeof window?window:null,zt=null===St,At=zt?void 0:St.document,Ct="horizontal",Dt=function(){return!1},Et=zt?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=At.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",Lt=function(e){return"string"==typeof e||e instanceof String},It=function(e){if(Lt(e)){var t=At.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},Tt=function(e,t,i){var a=e[t];return void 0!==a?a:i},Ut=function(e,t,i,a){if(t){if("end"===a)return 0;if("center"===a)return e/2}else if(i){if("start"===a)return 0;if("center"===a)return e/2}return e},Pt=function(e,t){var i=At.createElement("div");return i.className="gutter gutter-"+t,i},Rt=function(e,t,i){var a={};return Lt(t)?a[e]=t:a[e]=Et+"("+t+"% - "+i+"px)",a},qt=function(e,t){var i;return(i={})[e]=t+"px",i};const Mt=function(e,t){if(void 0===t&&(t={}),zt)return{};var i,a,r,o,n,s,l=e;Array.from&&(l=Array.from(l));var c=It(l[0]).parentNode,d=getComputedStyle?getComputedStyle(c):null,h=d?d.flexDirection:null,f=Tt(t,"sizes")||l.map((function(){return 100/l.length})),b=Tt(t,"minSize",100),u=Array.isArray(b)?b:l.map((function(){return b})),p=Tt(t,"maxSize",1/0),m=Array.isArray(p)?p:l.map((function(){return p})),g=Tt(t,"expandToMin",!1),v=Tt(t,"gutterSize",10),w=Tt(t,"gutterAlign","center"),x=Tt(t,"snapOffset",30),k=Tt(t,"dragInterval",1),y=Tt(t,"direction",Ct),_=Tt(t,"cursor",y===Ct?"col-resize":"row-resize"),$=Tt(t,"gutter",Pt),S=Tt(t,"elementStyle",Rt),z=Tt(t,"gutterStyle",qt);function A(e,t,a,r){var o=S(i,t,a,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function C(){return s.map((function(e){return e.size}))}function D(e){return"touches"in e?e.touches[0][a]:e[a]}function E(e){var t=s[this.a],i=s[this.b],a=t.size+i.size;t.size=e/this.size*a,i.size=a-e/this.size*a,A(t.element,t.size,this._b,t.i),A(i.element,i.size,this._c,i.i)}function L(e){var i,a=s[this.a],r=s[this.b];this.dragging&&(i=D(e)-this.start+(this._b-this.dragOffset),k>1&&(i=Math.round(i/k)*k),i<=a.minSize+x+this._b?i=a.minSize+this._b:i>=this.size-(r.minSize+x+this._c)&&(i=this.size-(r.minSize+this._c)),i>=a.maxSize-x+this._b?i=a.maxSize+this._b:i<=this.size-(r.maxSize-x+this._c)&&(i=this.size-(r.maxSize+this._c)),E.call(this,i),Tt(t,"onDrag",Dt)(C()))}function I(){var e=s[this.a].element,t=s[this.b].element,a=e.getBoundingClientRect(),n=t.getBoundingClientRect();this.size=a[i]+n[i]+this._b+this._c,this.start=a[r],this.end=a[o]}function T(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var i=e[n];return 0===i?null:i-=y===Ct?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(c);if(null===t)return e;if(u.reduce((function(e,t){return e+t}),0)>t)return e;var i=0,a=[],r=e.map((function(r,o){var n=t*r/100,s=Ut(v,0===o,o===e.length-1,w),l=u[o]+s;return n<l?(i+=l-n,a.push(0),l):(a.push(n-l),n)}));return 0===i?e:r.map((function(e,r){var o=e;if(i>0&&a[r]-i>0){var n=Math.min(i,a[r]-i);i-=n,o=e-n}return o/t*100}))}function U(){var e=this,i=s[e.a].element,a=s[e.b].element;e.dragging&&Tt(t,"onDragEnd",Dt)(C()),e.dragging=!1,St.removeEventListener("mouseup",e.stop),St.removeEventListener("touchend",e.stop),St.removeEventListener("touchcancel",e.stop),St.removeEventListener("mousemove",e.move),St.removeEventListener("touchmove",e.move),e.stop=null,e.move=null,i.removeEventListener("selectstart",Dt),i.removeEventListener("dragstart",Dt),a.removeEventListener("selectstart",Dt),a.removeEventListener("dragstart",Dt),i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",a.style.userSelect="",a.style.webkitUserSelect="",a.style.MozUserSelect="",a.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",At.body.style.cursor=""}function P(e){if(!("button"in e)||0===e.button){var i=this,a=s[i.a].element,r=s[i.b].element;i.dragging||Tt(t,"onDragStart",Dt)(C()),e.preventDefault(),i.dragging=!0,i.move=L.bind(i),i.stop=U.bind(i),St.addEventListener("mouseup",i.stop),St.addEventListener("touchend",i.stop),St.addEventListener("touchcancel",i.stop),St.addEventListener("mousemove",i.move),St.addEventListener("touchmove",i.move),a.addEventListener("selectstart",Dt),a.addEventListener("dragstart",Dt),r.addEventListener("selectstart",Dt),r.addEventListener("dragstart",Dt),a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",i.gutter.style.cursor=_,i.parent.style.cursor=_,At.body.style.cursor=_,I.call(i),i.dragOffset=D(e)-i.end}}y===Ct?(i="width",a="clientX",r="left",o="right",n="clientWidth"):"vertical"===y&&(i="height",a="clientY",r="top",o="bottom",n="clientHeight"),f=T(f);var R=[];function q(e){var t=e.i===R.length,i=t?R[e.i-1]:R[e.i];I.call(i);var a=t?i.size-e.minSize-i._c:e.minSize+i._b;E.call(i,a)}return s=l.map((function(e,t){var a,r={element:It(e),size:f[t],minSize:u[t],maxSize:m[t],i:t};if(t>0&&((a={a:t-1,b:t,dragging:!1,direction:y,parent:c})._b=Ut(v,t-1==0,!1,w),a._c=Ut(v,!1,t===l.length-1,w),"row-reverse"===h||"column-reverse"===h)){var o=a.a;a.a=a.b,a.b=o}if(t>0){var n=$(t,y,r.element);!function(e,t,a){var r=z(i,t,a);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(n,v,t),a._a=P.bind(a),n.addEventListener("mousedown",a._a),n.addEventListener("touchstart",a._a),c.insertBefore(n,r.element),a.gutter=n}return A(r.element,r.size,Ut(v,0===t,t===l.length-1,w),t),t>0&&R.push(a),r})),s.forEach((function(e){var t=e.element.getBoundingClientRect()[i];t<e.minSize&&(g?q(e):e.minSize=t)})),{setSizes:function(e){var t=T(e);t.forEach((function(e,i){if(i>0){var a=R[i-1],r=s[a.a],o=s[a.b];r.size=t[i-1],o.size=e,A(r.element,r.size,a._b,r.i),A(o.element,o.size,a._c,o.i)}}))},getSizes:C,collapse:function(e){q(s[e])},destroy:function(e,t){R.forEach((function(a){if(!0!==t?a.parent.removeChild(a.gutter):(a.gutter.removeEventListener("mousedown",a._a),a.gutter.removeEventListener("touchstart",a._a)),!0!==e){var r=S(i,a.a.size,a._b);Object.keys(r).forEach((function(e){s[a.a].element.style[e]="",s[a.b].element.style[e]=""}))}}))},parent:c,pairs:R}},jt="search://";class Bt extends X{constructor(){super(),this.sourceUrl=null,this.inited=!1,this.isLoading=!1,this.coll="",this.collInfo=null,this._replaceLoc=!1,this._locUpdateNeeded=!1,this._locationHash="",this.tabData={},this.url="",this.ts="",this.tabNames=["pages","story","resources","info"],this.tabLabels={pages:"Pages",story:"Story",resources:"URLs",info:"Archive Info"},this.menuActive=!1,this.hasStory=!1,this.editable=!1,this.browsable=!0,this.clearable=!0,this.showSidebar="1"===localStorage.getItem("pages:showSidebar"),this.splitter=null,this.isVisible=!0,this.favIconUrl="",this.autoUpdateInterval=10,this._autoUpdater=null,this.appName="ReplayWeb.page",this.appVersion=me,this.appLogo=fe()}static get properties(){return{inited:{type:Boolean},sourceUrl:{type:String},loadInfo:{type:Object,attribute:!1},showSidebar:{type:Boolean},collInfo:{type:Object,attribute:!1},coll:{type:String},hasStory:{type:Boolean},isLoading:{type:Boolean},tabData:{type:Object,attribute:!1},url:{type:String},ts:{type:String},isFullscreen:{type:Boolean},menuActive:{type:Boolean},embed:{type:String},editable:{type:Boolean},browsable:{type:Boolean},clearable:{type:Boolean},isVisible:{type:Boolean},favIconUrl:{type:String},appName:{type:String},appVersion:{type:String},appLogo:{type:String},autoUpdateInterval:{type:Number}}}firstUpdated(){this.inited=!0,window.addEventListener("hashchange",(e=>this.onHashChange(e))),this.addEventListener("fullscreenchange",(()=>{this.isFullscreen=!!document.fullscreenElement})),this.embed&&(this.observer=new IntersectionObserver((e=>{this.isVisible=e[0].isIntersecting})),this.observer.observe(this))}async runUpdateLoop(){try{for(;this.editable&&this.autoUpdateInterval&&(!this.collInfo||this.collInfo.pages.length<100);)await new Promise((e=>setTimeout(e,1e3*this.autoUpdateInterval))),await this.doUpdateInfo(!0)}finally{this._autoUpdater=null}}updated(e){if(e.has("sourceUrl")&&this.doUpdateInfo(),e.has("editable")&&this.editable&&this.autoUpdateInterval&&!this._autoUpdater&&(this._autoUpdater=this.runUpdateLoop()),e.has("tabData")){if(!this.collInfo||!this.collInfo.coll)return;Object.keys(this.tabData).forEach((e=>!this.tabData[e]&&delete this.tabData[e]));const t="#"+new URLSearchParams(this.tabData).toString();if(this.tabData.url||(this.url=jt+decodeURIComponent(this._paramsToString(this.tabData))),t!==this._locationHash){if(this._locationHash=t,this._replaceLoc||0===Object.keys(e.get("tabData")).length){const e=new URL(window.location.href);e.hash=this._locationHash,window.history.replaceState({},"",e.href),this._replaceLoc=!1}else if(window.location.hash=this._locationHash,!this.showSidebar){const e=this.renderRoot.querySelector("wr-coll-replay");e&&e.focus()}this.embed&&window.parent!==window&&window.parent.postMessage(this.tabData,"*")}this._locUpdateNeeded=!1}e.has("showSidebar")&&(this.embed||localStorage.setItem("pages:showSidebar",this.showSidebar?"1":"0")),(e.has("tabData")||e.has("showSidebar"))&&this.configureSplitter()}configureSplitter(){if(this.tabData.url&&this.showSidebar){const e=this.renderRoot.querySelector("#contents"),t=this.renderRoot.querySelector("wr-coll-replay");if(e&&t&&!this.splitter){const i={sizes:[30,70],minSize:[300,300],gutterSize:4,onDragStart(){t.setDisablePointer(!0)},onDragEnd(){t.setDisablePointer(!1)}};this.splitter=Mt([e,t],i)}}else if(this.splitter){try{this.splitter.destroy()}catch(e){}this.splitter=null}}async doUpdateInfo(e=!1){if(e&&this.tabData.url&&!this.showSidebar)return;let t=this.loadInfo&&this.loadInfo.customColl;if(!t){t=(await Ee(this.sourceUrl)).coll}this.coll=t;const i="./w/api/c/"+t,a="./w/"+t,r=await fetch(i+"?all=1");if(200!=r.status)return void(this.collInfo={});const o=await r.json();this.collInfo={apiPrefix:i,replayPrefix:a,coll:t,...o},this.collInfo.title||(this.collInfo.title=this.collInfo.filename),"replayonly"===this.embed&&(this.showSidebar=!1),this.hasStory=this.collInfo.desc||this.collInfo.lists.length,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{collInfo:this.collInfo,alreadyLoaded:!0}})),this.onHashChange()}onCollLoaded(e){this.doUpdateInfo(),this.loadInfo=null,e.detail.sourceUrl&&(this.sourceUrl=e.detail.sourceUrl),this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{sourceUrl:this.sourceUrl,collInfo:this.collInfo}}))}onCollUpdate(e){this.editable&&(this.collInfo={...this.collInfo,...e.detail})}onHashChange(){const e=window.location.hash;if(e&&e!==this._locationHash&&(this.tabData=Object.fromEntries(new URLSearchParams(e.slice(1)).entries()),this._locationHash=e),this.collInfo.coll&&!this.tabNames.includes(this.tabData.view)){const e=this.hasStory?"story":this.editable||this.collInfo.pages.length?"pages":"resources";this.tabData={...this.tabData,view:e}}if(this.tabData.url&&this.tabData.url.startsWith("page:")){const e=Number(this.tabData.url.slice("page:".length));if(!isNaN(e)&&e<this.collInfo.pages.length){const t=this.collInfo.pages[e];this.tabData.url=t.url,this.tabData.ts=Ae(t).timestamp}}this.hasStory||"story"!==this.tabData.view||(this.tabData.view="pages"),this.tabData.url&&this.tabData.query&&(this.showSidebar=!0)}onTabClick(e){e.preventDefault();const t=e.currentTarget.getAttribute("href");return this.tabData={...this.tabData,view:t.slice(1)},!1}onCollTabNav(e){e.detail.reload?this.onRefresh(null,!0):e.target.id===this.tabData.view||"replay"===e.target.id&&this.tabData.url?this.updateTabData(e.detail.data,e.detail.replaceLoc,!1):this.showSidebar&&this.tabData.url&&this.updateTabData(e.detail.data,e.detail.replaceLoc,!0)}updateTabData(e,t=!1){this.tabData={...this.tabData,...e},this.tabData.url&&(this.url=this.tabData.url||""),this.tabData.ts&&(this.ts=this.tabData.ts||""),this._replaceLoc=!this._locUpdateNeeded&&t,this._locUpdateNeeded=!0}static get styles(){return ue(Bt.compStyles)}static get compStyles(){return o`
658
658
  :host {
659
659
  display: flex;
660
660
  flex-direction: column;
@@ -968,7 +968,7 @@ class se extends oe{}se.directiveName="unsafeSVG",se.resultType=2;const le=ae(se
968
968
  </a>
969
969
  </li>`:""}
970
970
  </ul>
971
- </nav>`}renderLocationBar(){if("replayonly"===this.embed)return"";const e=function(e){if(!e)return"";e.length<14&&(e+="00000000000000".substr(e.length));const t=e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8)+"T"+e.substring(8,10)+":"+e.substring(10,12)+":"+e.substring(12,14)+"-00:00";return new Date(t)}(this.ts).toLocaleString(),t=!!this.tabData.url,i=t&&this.favIconUrl;return U`
971
+ </nav>`}renderLocationBar(){if("replayonly"===this.embed)return"";const e=function(e){if(!e)return"";e.length<14&&(e+="00000101000000".substr(e.length));const t=e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8)+"T"+e.substring(8,10)+":"+e.substring(10,12)+":"+e.substring(12,14)+"-00:00";return new Date(t)}(this.ts).toLocaleString(),t=!!this.tabData.url,i=t&&this.favIconUrl;return U`
972
972
  <a class="skip-link" href="#skip-replay-target" @click="${this.skipMenu}">Skip replay navigation</a>
973
973
  <nav class="replay-bar" aria-label="replay">
974
974
  <div class="field has-addons">
@@ -1060,14 +1060,14 @@ class se extends oe{}se.directiveName="unsafeSVG",se.resultType=2;const le=ae(se
1060
1060
  <span>Browse Contents</span>
1061
1061
  </a>`:""}
1062
1062
  ${this.renderExtraToolbar(!0)}
1063
- ${this.editable?U``:U`
1063
+ ${this.clearable?U`
1064
1064
  <hr class="dropdown-divider is-hidden-desktop">
1065
1065
  <a href="#" role="button" class="dropdown-item" @click="${this.onPurgeCache}" @keyup="${ge}">
1066
1066
  <span class="icon is-small">
1067
1067
  <fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${ft()}"></fa-icon>
1068
1068
  </span>
1069
1069
  <span>Purge Cache + Full Reload</span>
1070
- </a>`}
1070
+ </a>`:U``}
1071
1071
  ${!this.editable&&this.sourceUrl.startsWith("http://")||this.sourceUrl.startsWith("https://")?U`
1072
1072
  <hr class="dropdown-divider">
1073
1073
  <a href="${this.sourceUrl}" role="button" class="dropdown-item" @keyup="${ge}">