diff --git a/CHANGES.md b/CHANGES.md index b2b5d0a..32377af 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,7 @@ v1.3.9 (tip) - Fidelity: Upgrade to wabac.js 2.6.0-beta.0, wombat 3.1.0: improved POST request rewriting for multipart/form-data, Tableau dashboard fidelity -- UI: style fix on page delete spinner (editable mode) +- UI: editable mode: style fix on page delete spinner, don't show editing options on sidebar v1.3.8 - UI: Native files: Support asking permission when doing a full reload of a local file. diff --git a/src/coll.js b/src/coll.js index 79bebdd..40b8285 100644 --- a/src/coll.js +++ b/src/coll.js @@ -146,7 +146,7 @@ class Coll extends LitElement } if (changedProperties.has("editable")) { if (this.editable) { - this._pollColl = setInterval(() => this.doUpdateInfo(), 10000); + this._pollColl = setInterval(() => this.doUpdateInfo(true), 10000); } else if (this._pollColl) { clearInterval(this._pollColl); } @@ -230,7 +230,13 @@ class Coll extends LitElement } } - async doUpdateInfo() { + async doUpdateInfo(autorefresh = false) + { + // if auto-refresh, and replay and no sidebar, than skip update + if (autorefresh && this.tabData.url && !this.showSidebar) { + return; + } + let coll = this.loadInfo && this.loadInfo.customColl; if (!coll) { diff --git a/src/electron-main.js b/src/electron-main.js index 61d14e1..e5981ce 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -8,4 +8,4 @@ const replayApp = new ElectronReplayApp({ profileName: "replaywebpage" }); -replayApp.init(); +replayApp.init(true); diff --git a/src/electron-replay-app.js b/src/electron-replay-app.js index b9a1e16..ffd51e7 100644 --- a/src/electron-replay-app.js +++ b/src/electron-replay-app.js @@ -87,7 +87,7 @@ class ElectronReplayApp return "index.html"; } - init() { + init(includePlugins = false) { // Single instance check const gotTheLock = app.requestSingleInstanceLock(); @@ -101,30 +101,35 @@ class ElectronReplayApp }); } - switch (process.platform) { - case 'win32': - this.pluginPath = path.join(this.projPath, "plugins-win", `pepflashplayer-x86${process.arch === 'x64' ? '_64' : ''}.dll`); - break; - - case 'darwin': - this.pluginPath = path.join(this.projPath, "plugins-mac", "PepperFlashPlayer.plugin"); - break; - - case 'linux': - this.pluginPath = path.join(this.projPath, "plugins-mac", "libpepflashplayer.so"); - break; - - default: - console.log('platform unsupported: ' + process.platform); - break; - } + if (includePlugins) { + switch (process.platform) { + case 'win32': + this.pluginPath = path.join(this.projPath, "plugins-win", `pepflashplayer-x86${process.arch === 'x64' ? '_64' : ''}.dll`); + break; + + case 'darwin': + this.pluginPath = path.join(this.projPath, "plugins-mac", "PepperFlashPlayer.plugin"); + break; + + case 'linux': + this.pluginPath = path.join(this.projPath, "plugins-mac", "libpepflashplayer.so"); + break; + + default: + console.log('platform unsupported: ' + process.platform); + break; + } - app.commandLine.appendSwitch('ppapi-flash-path', this.pluginPath); + app.commandLine.appendSwitch('ppapi-flash-path', this.pluginPath); + } console.log('app path', this.appPath); console.log('dir name', __dirname); console.log('proj path', this.projPath); - console.log('plugin path', this.pluginPath); + + if (includePlugins) { + console.log('plugin path', this.pluginPath); + } console.log('app data', app.getPath('appData')); console.log('user data', app.getPath('userData')); diff --git a/src/pageentry.js b/src/pageentry.js index 8d585a3..9213304 100644 --- a/src/pageentry.js +++ b/src/pageentry.js @@ -182,8 +182,10 @@ class PageEntry extends LitElement const hasSize = typeof(p.size) === "number"; + const editable = this.editable && !this.isSidebar; + return html` - ${this.editable ? html` + ${editable ? html`
- ${this.editable ? html` + ${editable ? html` ${!this.deleting ? html` ` : html` diff --git a/src/pages.js b/src/pages.js index f4517da..2a27f3c 100644 --- a/src/pages.js +++ b/src/pages.js @@ -614,7 +614,7 @@ class Pages extends LitElement renderPageHeader() { return html` - ${this.editable && this.filteredPages.length ? html` + ${!this.isSidebar && this.editable && this.filteredPages.length ? html`
`:q``} - `}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",Ze),customElements.define("wr-coll-index",Ke);var Je=i(89),Ye=i.n(Je),Qe=i(51),Xe=i.n(Qe),et=i(90),tt=i.n(et),it=i(91),at=i.n(it),rt=i(92),ot=i.n(rt),nt=i(93),st=i.n(nt),lt=i(52),ct=i.n(lt),dt=i(53),ht=i.n(dt),ft=i(54),bt=i.n(ft),ut=i(94),pt=i.n(ut),mt=i(95),gt=i.n(mt),vt=i(96),wt=i.n(vt),xt="undefined"!=typeof window?window:null,kt=null===xt,yt=kt?void 0:xt.document,St=function(){return!1},zt=kt?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=yt.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",$t=function(e){return"string"==typeof e||e instanceof String},_t=function(e){if($t(e)){var t=yt.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},Ct=function(e,t,i){var a=e[t];return void 0!==a?a:i},Pt=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},Dt=function(e,t){var i=yt.createElement("div");return i.className="gutter gutter-"+t,i},Lt=function(e,t,i){var a={};return $t(t)?a[e]=t:a[e]=zt+"("+t+"% - "+i+"px)",a},Tt=function(e,t){var i;return(i={})[e]=t+"px",i},Et=function(e,t){if(void 0===t&&(t={}),kt)return{};var i,a,r,o,n,s,l=e;Array.from&&(l=Array.from(l));var c=_t(l[0]).parentNode,d=getComputedStyle?getComputedStyle(c):null,h=d?d.flexDirection:null,f=Ct(t,"sizes")||l.map((function(){return 100/l.length})),b=Ct(t,"minSize",100),u=Array.isArray(b)?b:l.map((function(){return b})),p=Ct(t,"expandToMin",!1),m=Ct(t,"gutterSize",10),g=Ct(t,"gutterAlign","center"),v=Ct(t,"snapOffset",30),w=Ct(t,"dragInterval",1),x=Ct(t,"direction","horizontal"),k=Ct(t,"cursor","horizontal"===x?"col-resize":"row-resize"),y=Ct(t,"gutter",Dt),S=Ct(t,"elementStyle",Lt),z=Ct(t,"gutterStyle",Tt);function $(e,t,a,r){var o=S(i,t,a,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function _(){return s.map((function(e){return e.size}))}function C(e){return"touches"in e?e.touches[0][a]:e[a]}function P(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,$(t.element,t.size,this._b,t.i),$(i.element,i.size,this._c,i.i)}function D(e){var i,a=s[this.a],r=s[this.b];this.dragging&&(i=C(e)-this.start+(this._b-this.dragOffset),w>1&&(i=Math.round(i/w)*w),i<=a.minSize+v+this._b?i=a.minSize+this._b:i>=this.size-(r.minSize+v+this._c)&&(i=this.size-(r.minSize+this._c)),P.call(this,i),Ct(t,"onDrag",St)(_()))}function L(){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-="horizontal"===x?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=Pt(m,0===o,o===e.length-1,g),l=u[o]+s;return n0&&a[r]-i>0){var n=Math.min(i,a[r]-i);i-=n,o=e-n}return o/t*100}))}function E(){var e=s[this.a].element,i=s[this.b].element;this.dragging&&Ct(t,"onDragEnd",St)(_()),this.dragging=!1,xt.removeEventListener("mouseup",this.stop),xt.removeEventListener("touchend",this.stop),xt.removeEventListener("touchcancel",this.stop),xt.removeEventListener("mousemove",this.move),xt.removeEventListener("touchmove",this.move),this.stop=null,this.move=null,e.removeEventListener("selectstart",St),e.removeEventListener("dragstart",St),i.removeEventListener("selectstart",St),i.removeEventListener("dragstart",St),e.style.userSelect="",e.style.webkitUserSelect="",e.style.MozUserSelect="",e.style.pointerEvents="",i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",this.gutter.style.cursor="",this.parent.style.cursor="",yt.body.style.cursor=""}function A(e){if(!("button"in e)||0===e.button){var i=s[this.a].element,a=s[this.b].element;this.dragging||Ct(t,"onDragStart",St)(_()),e.preventDefault(),this.dragging=!0,this.move=D.bind(this),this.stop=E.bind(this),xt.addEventListener("mouseup",this.stop),xt.addEventListener("touchend",this.stop),xt.addEventListener("touchcancel",this.stop),xt.addEventListener("mousemove",this.move),xt.addEventListener("touchmove",this.move),i.addEventListener("selectstart",St),i.addEventListener("dragstart",St),a.addEventListener("selectstart",St),a.addEventListener("dragstart",St),i.style.userSelect="none",i.style.webkitUserSelect="none",i.style.MozUserSelect="none",i.style.pointerEvents="none",a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",this.gutter.style.cursor=k,this.parent.style.cursor=k,yt.body.style.cursor=k,L.call(this),this.dragOffset=C(e)-this.end}}"horizontal"===x?(i="width",a="clientX",r="left",o="right",n="clientWidth"):"vertical"===x&&(i="height",a="clientY",r="top",o="bottom",n="clientHeight"),f=T(f);var I=[];function R(e){var t=e.i===I.length,i=t?I[e.i-1]:I[e.i];L.call(i);var a=t?i.size-e.minSize-i._c:e.minSize+i._b;P.call(i,a)}return(s=l.map((function(e,t){var a,r={element:_t(e),size:f[t],minSize:u[t],i:t};if(t>0&&((a={a:t-1,b:t,dragging:!1,direction:x,parent:c})._b=Pt(m,t-1==0,!1,g),a._c=Pt(m,!1,t===l.length-1,g),"row-reverse"===h||"column-reverse"===h)){var o=a.a;a.a=a.b,a.b=o}if(t>0){var n=y(t,x,r.element);!function(e,t,a){var r=z(i,t,a);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(n,m,t),a._a=A.bind(a),n.addEventListener("mousedown",a._a),n.addEventListener("touchstart",a._a),c.insertBefore(n,r.element),a.gutter=n}return $(r.element,r.size,Pt(m,0===t,t===l.length-1,g),t),t>0&&I.push(a),r}))).forEach((function(e){var t=e.element.getBoundingClientRect()[i];t0){var a=I[i-1],r=s[a.a],o=s[a.b];r.size=t[i-1],o.size=e,$(r.element,r.size,a._b,r.i),$(o.element,o.size,a._c,o.i)}}))},getSizes:_,collapse:function(e){R(s[e])},destroy:function(e,t){I.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:I}};class At extends re{constructor(){super(),this.sourceUrl=null,this.inited=!1,this.isLoading=!1,this.baseApiPrefix="./wabac/api",this.baseReplayPrefix="./wabac",this.apiPrefix="",this.replayPrefix="",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.showSidebar="1"===localStorage.getItem("pages:showSidebar"),this.splitter=null,this.isVisible=!0,this.favIconUrl="",this.appName="ReplayWeb.page",this.appLogo=fe.a}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},isVisible:{type:Boolean},favIconUrl:{type:String},appName:{type:String},appLogo:{type:String}}}firstUpdated(){this.inited=!0,window.addEventListener("hashchange",e=>this.onHashChange(e)),this.addEventListener("fullscreenchange",e=>{this.isFullscreen=!!document.fullscreenElement}),this.embed&&(this.observer=new IntersectionObserver((e,t)=>{this.isVisible=e[0].isIntersecting}),this.observer.observe(this))}updated(e){if(e.has("sourceUrl")&&this.doUpdateInfo(),e.has("editable")&&(this.editable?this._pollColl=setInterval(()=>this.doUpdateInfo(),1e4):this._pollColl&&clearInterval(this._pollColl)),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="search://"+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=Et([e,t],i)}}else if(this.splitter){try{this.splitter.destroy()}catch(e){}this.splitter=null}}async doUpdateInfo(){let e=this.loadInfo&&this.loadInfo.customColl;if(!e){e=(await Ce(this.sourceUrl)).coll}this.coll=e;const t=this.baseApiPrefix+"/"+e,i=this.baseReplayPrefix+"/"+e,a=await fetch(t+"?all=1");if(200!=a.status)return void(this.collInfo={});const r=await a.json();this.collInfo={apiPrefix:t,replayPrefix:i,coll:e,...r},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,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{sourceUrl:this.sourceUrl,collInfo:this.collInfo}}))}onCollUpdate(e){this.editable&&(this.collInfo={...this.collInfo,...e.detail})}onHashChange(e){const t=window.location.hash;if(t&&t!==this._locationHash&&(this.tabData=Object.fromEntries(new URLSearchParams(t.slice(1)).entries()),this._locationHash=t),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`}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",Ze),customElements.define("wr-coll-index",Ke);var Je=i(89),Ye=i.n(Je),Qe=i(51),Xe=i.n(Qe),et=i(90),tt=i.n(et),it=i(91),at=i.n(it),rt=i(92),ot=i.n(rt),nt=i(93),st=i.n(nt),lt=i(52),ct=i.n(lt),dt=i(53),ht=i.n(dt),ft=i(54),bt=i.n(ft),ut=i(94),pt=i.n(ut),mt=i(95),gt=i.n(mt),vt=i(96),wt=i.n(vt),xt="undefined"!=typeof window?window:null,kt=null===xt,yt=kt?void 0:xt.document,St=function(){return!1},zt=kt?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=yt.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",$t=function(e){return"string"==typeof e||e instanceof String},_t=function(e){if($t(e)){var t=yt.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},Ct=function(e,t,i){var a=e[t];return void 0!==a?a:i},Pt=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},Dt=function(e,t){var i=yt.createElement("div");return i.className="gutter gutter-"+t,i},Lt=function(e,t,i){var a={};return $t(t)?a[e]=t:a[e]=zt+"("+t+"% - "+i+"px)",a},Tt=function(e,t){var i;return(i={})[e]=t+"px",i},Et=function(e,t){if(void 0===t&&(t={}),kt)return{};var i,a,r,o,n,s,l=e;Array.from&&(l=Array.from(l));var c=_t(l[0]).parentNode,d=getComputedStyle?getComputedStyle(c):null,h=d?d.flexDirection:null,f=Ct(t,"sizes")||l.map((function(){return 100/l.length})),b=Ct(t,"minSize",100),u=Array.isArray(b)?b:l.map((function(){return b})),p=Ct(t,"expandToMin",!1),m=Ct(t,"gutterSize",10),g=Ct(t,"gutterAlign","center"),v=Ct(t,"snapOffset",30),w=Ct(t,"dragInterval",1),x=Ct(t,"direction","horizontal"),k=Ct(t,"cursor","horizontal"===x?"col-resize":"row-resize"),y=Ct(t,"gutter",Dt),S=Ct(t,"elementStyle",Lt),z=Ct(t,"gutterStyle",Tt);function $(e,t,a,r){var o=S(i,t,a,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function _(){return s.map((function(e){return e.size}))}function C(e){return"touches"in e?e.touches[0][a]:e[a]}function P(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,$(t.element,t.size,this._b,t.i),$(i.element,i.size,this._c,i.i)}function D(e){var i,a=s[this.a],r=s[this.b];this.dragging&&(i=C(e)-this.start+(this._b-this.dragOffset),w>1&&(i=Math.round(i/w)*w),i<=a.minSize+v+this._b?i=a.minSize+this._b:i>=this.size-(r.minSize+v+this._c)&&(i=this.size-(r.minSize+this._c)),P.call(this,i),Ct(t,"onDrag",St)(_()))}function L(){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-="horizontal"===x?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=Pt(m,0===o,o===e.length-1,g),l=u[o]+s;return n0&&a[r]-i>0){var n=Math.min(i,a[r]-i);i-=n,o=e-n}return o/t*100}))}function E(){var e=s[this.a].element,i=s[this.b].element;this.dragging&&Ct(t,"onDragEnd",St)(_()),this.dragging=!1,xt.removeEventListener("mouseup",this.stop),xt.removeEventListener("touchend",this.stop),xt.removeEventListener("touchcancel",this.stop),xt.removeEventListener("mousemove",this.move),xt.removeEventListener("touchmove",this.move),this.stop=null,this.move=null,e.removeEventListener("selectstart",St),e.removeEventListener("dragstart",St),i.removeEventListener("selectstart",St),i.removeEventListener("dragstart",St),e.style.userSelect="",e.style.webkitUserSelect="",e.style.MozUserSelect="",e.style.pointerEvents="",i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",this.gutter.style.cursor="",this.parent.style.cursor="",yt.body.style.cursor=""}function A(e){if(!("button"in e)||0===e.button){var i=s[this.a].element,a=s[this.b].element;this.dragging||Ct(t,"onDragStart",St)(_()),e.preventDefault(),this.dragging=!0,this.move=D.bind(this),this.stop=E.bind(this),xt.addEventListener("mouseup",this.stop),xt.addEventListener("touchend",this.stop),xt.addEventListener("touchcancel",this.stop),xt.addEventListener("mousemove",this.move),xt.addEventListener("touchmove",this.move),i.addEventListener("selectstart",St),i.addEventListener("dragstart",St),a.addEventListener("selectstart",St),a.addEventListener("dragstart",St),i.style.userSelect="none",i.style.webkitUserSelect="none",i.style.MozUserSelect="none",i.style.pointerEvents="none",a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",this.gutter.style.cursor=k,this.parent.style.cursor=k,yt.body.style.cursor=k,L.call(this),this.dragOffset=C(e)-this.end}}"horizontal"===x?(i="width",a="clientX",r="left",o="right",n="clientWidth"):"vertical"===x&&(i="height",a="clientY",r="top",o="bottom",n="clientHeight"),f=T(f);var I=[];function R(e){var t=e.i===I.length,i=t?I[e.i-1]:I[e.i];L.call(i);var a=t?i.size-e.minSize-i._c:e.minSize+i._b;P.call(i,a)}return(s=l.map((function(e,t){var a,r={element:_t(e),size:f[t],minSize:u[t],i:t};if(t>0&&((a={a:t-1,b:t,dragging:!1,direction:x,parent:c})._b=Pt(m,t-1==0,!1,g),a._c=Pt(m,!1,t===l.length-1,g),"row-reverse"===h||"column-reverse"===h)){var o=a.a;a.a=a.b,a.b=o}if(t>0){var n=y(t,x,r.element);!function(e,t,a){var r=z(i,t,a);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(n,m,t),a._a=A.bind(a),n.addEventListener("mousedown",a._a),n.addEventListener("touchstart",a._a),c.insertBefore(n,r.element),a.gutter=n}return $(r.element,r.size,Pt(m,0===t,t===l.length-1,g),t),t>0&&I.push(a),r}))).forEach((function(e){var t=e.element.getBoundingClientRect()[i];t0){var a=I[i-1],r=s[a.a],o=s[a.b];r.size=t[i-1],o.size=e,$(r.element,r.size,a._b,r.i),$(o.element,o.size,a._c,o.i)}}))},getSizes:_,collapse:function(e){R(s[e])},destroy:function(e,t){I.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:I}};class At extends re{constructor(){super(),this.sourceUrl=null,this.inited=!1,this.isLoading=!1,this.baseApiPrefix="./wabac/api",this.baseReplayPrefix="./wabac",this.apiPrefix="",this.replayPrefix="",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.showSidebar="1"===localStorage.getItem("pages:showSidebar"),this.splitter=null,this.isVisible=!0,this.favIconUrl="",this.appName="ReplayWeb.page",this.appLogo=fe.a}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},isVisible:{type:Boolean},favIconUrl:{type:String},appName:{type:String},appLogo:{type:String}}}firstUpdated(){this.inited=!0,window.addEventListener("hashchange",e=>this.onHashChange(e)),this.addEventListener("fullscreenchange",e=>{this.isFullscreen=!!document.fullscreenElement}),this.embed&&(this.observer=new IntersectionObserver((e,t)=>{this.isVisible=e[0].isIntersecting}),this.observer.observe(this))}updated(e){if(e.has("sourceUrl")&&this.doUpdateInfo(),e.has("editable")&&(this.editable?this._pollColl=setInterval(()=>this.doUpdateInfo(!0),1e4):this._pollColl&&clearInterval(this._pollColl)),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="search://"+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=Et([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 Ce(this.sourceUrl)).coll}this.coll=t;const i=this.baseApiPrefix+"/"+t,a=this.baseReplayPrefix+"/"+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,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:{sourceUrl:this.sourceUrl,collInfo:this.collInfo}}))}onCollUpdate(e){this.editable&&(this.collInfo={...this.collInfo,...e.detail})}onHashChange(e){const t=window.location.hash;if(t&&t!==this._locationHash&&(this.tabData=Object.fromEntries(new URLSearchParams(t.slice(1)).entries()),this._locationHash=t),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)&&et=>{if(!(t instanceof D))throw new Error("unsafeHTM `}renderPageHeader(){return q` - ${this.editable&&this.filteredPages.length?q` + ${!this.isSidebar&&this.editable&&this.filteredPages.length?q`
- ${this.editable?q` + ${a?q` ${this.deleting?q` `:q`